@decocms/mesh 1.0.0-alpha.32 → 1.0.0-alpha.33

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 (82) hide show
  1. package/dist/client/assets/{alert-dialog-CCDQTgck.js → alert-dialog-Bj3sxji2.js} +1 -1
  2. package/dist/client/assets/{auth-DcsMEwUL.js → auth-bF2_ysdG.js} +1 -1
  3. package/dist/client/assets/{auth-catchall-CcVurtOz.js → auth-catchall-BRnZAoYY.js} +1 -1
  4. package/dist/client/assets/{avatar-4ymdPXa_.js → avatar-B9zSDca0.js} +1 -1
  5. package/dist/client/assets/{badge-M2zkAPfT.js → badge-Ba7oj8pn.js} +1 -1
  6. package/dist/client/assets/{button-DpN85Po0.js → button-8a8UdvyR.js} +1 -1
  7. package/dist/client/assets/{card-CjmS8q7G.js → card-Cyeg7tCo.js} +1 -1
  8. package/dist/client/assets/{checkbox-DWHTP51a.js → checkbox-DCjoNloy.js} +1 -1
  9. package/dist/client/assets/{circle-alert-nIYjC1xl.js → circle-alert-DVLBfxyX.js} +1 -1
  10. package/dist/client/assets/{collection-detail-BEA961Ga.js → collection-detail-ieEvVULW.js} +1 -1
  11. package/dist/client/assets/{collection-display-button-Cq_29P0W.js → collection-display-button-CGcY64sw.js} +1 -1
  12. package/dist/client/assets/{collection-header-CP7DLL6n.js → collection-header-B92Inaku.js} +1 -1
  13. package/dist/client/assets/{collection-page-C1jzPNDj.js → collection-page-BfXTrpEI.js} +1 -1
  14. package/dist/client/assets/{collection-search-CrkK01Ci.js → collection-search-C7G2QK3t.js} +1 -1
  15. package/dist/client/assets/{collection-table-wrapper-DtI6Q7NT.js → collection-table-wrapper-DdGYlOCN.js} +1 -1
  16. package/dist/client/assets/{connection-card-CvYHrR5S.js → connection-card-xMF7zskf.js} +1 -1
  17. package/dist/client/assets/{connection-detail-8UBUICjc.js → connection-detail-CKuTnq-B.js} +1 -1
  18. package/dist/client/assets/{connections-B3SNLZTA.js → connections-Bm36z6Kn.js} +1 -1
  19. package/dist/client/assets/{core-C84vbQ6C.js → core-DHnxmqjc.js} +1 -1
  20. package/dist/client/assets/{create-organization-dialog-DXWcXd5o.js → create-organization-dialog-Cz9P_oQD.js} +1 -1
  21. package/dist/client/assets/{dialog-CfKieCBd.js → dialog-DOdwpjqP.js} +1 -1
  22. package/dist/client/assets/{dropdown-menu-Bvf4p8xE.js → dropdown-menu-BTTzlaf4.js} +1 -1
  23. package/dist/client/assets/{empty-state-jtBjSgAJ.js → empty-state-CwiQR0XJ.js} +1 -1
  24. package/dist/client/assets/{error-boundary-BjLQDRan.js → error-boundary-8a3_at8W.js} +1 -1
  25. package/dist/client/assets/{extract-connection-data-CbCjXz3B.js → extract-connection-data-BpMaEsIX.js} +1 -1
  26. package/dist/client/assets/{form-C-tSv2Q6.js → form-DU90-O_I.js} +1 -1
  27. package/dist/client/assets/{gateway-detail-ho3nacsQ.js → gateway-detail-B2bI_bIU.js} +1 -1
  28. package/dist/client/assets/{gateways-BMuRXxz2.js → gateways-BxMjTmO6.js} +1 -1
  29. package/dist/client/assets/{home-MLX9b5zd.js → home-CSzEs1Rf.js} +1 -1
  30. package/dist/client/assets/{icon-CBAJ1FOz.js → icon-CzxeHWBl.js} +1 -1
  31. package/dist/client/assets/{index-DysuQWmq.js → index-Bgo9U3qs.js} +1 -1
  32. package/dist/client/assets/index-ChN7etWB.css +1 -0
  33. package/dist/client/assets/{index-BHlakCJ5.js → index-DCY07ujJ.js} +1 -1
  34. package/dist/client/assets/{index-WOQ13cP6.js → index-HoRNE_Oj.js} +2 -2
  35. package/dist/client/assets/{index-DV_-45hJ.js → index-jKafgZHH.js} +1 -1
  36. package/dist/client/assets/{input-DRMFvIcp.js → input-GtBoan0u.js} +1 -1
  37. package/dist/client/assets/json-CFpQXyKn.js +1 -0
  38. package/dist/client/assets/{layout-C7PMXMWr.js → layout-DtdXVJv4.js} +1 -1
  39. package/dist/client/assets/{lazy-highlighter-lg0C_alN.js → lazy-highlighter-BAj2Mxm0.js} +1 -1
  40. package/dist/client/assets/{localstorage-keys-D9JCFoUA.js → localstorage-keys-DdRmNbGe.js} +1 -1
  41. package/dist/client/assets/{login-BBdlWaUa.js → login-DHkcl1CZ.js} +1 -1
  42. package/dist/client/assets/{mcp-oauth-CF0djzC4.js → mcp-oauth-pvU53iS3.js} +1 -1
  43. package/dist/client/assets/{members-D_0pxXiL.js → members-CX-ziwX2.js} +1 -1
  44. package/dist/client/assets/{monitoring-dAXFetG3.js → monitoring-5rf2nLo0.js} +1 -1
  45. package/dist/client/assets/{oauth-callback-VTrUtdoZ.js → oauth-callback-NjwvQ7fr.js} +1 -1
  46. package/dist/client/assets/{page-BR8BRWlW.js → page-DQXzmwPi.js} +1 -1
  47. package/dist/client/assets/{popover-DIDe1tAI.js → popover-DdVvJgdl.js} +1 -1
  48. package/dist/client/assets/prism-light-CixH9adM.js +1 -0
  49. package/dist/client/assets/{resource-tabs-e5WwAHct.js → resource-tabs-D-d1_s9d.js} +1 -1
  50. package/dist/client/assets/{schema-DaJ1vGek.js → schema-zp4LhQ6R.js} +1 -1
  51. package/dist/client/assets/{select-DzEOHgSq.js → select-gKhGAtmi.js} +1 -1
  52. package/dist/client/assets/{settings-DCv43rTD.js → settings-DOjDcDAR.js} +1 -1
  53. package/dist/client/assets/{shell-layout-CE6a48bs.js → shell-layout-BDhhfHrp.js} +44 -44
  54. package/dist/client/assets/{spinner-DCnW_hcw.js → spinner-Uc4IX4M6.js} +1 -1
  55. package/dist/client/assets/{store-w0RourHd.js → store-B09vXexU.js} +1 -1
  56. package/dist/client/assets/{store-app-detail-Boq9PC3_.js → store-app-detail-BqI8KTAM.js} +1 -1
  57. package/dist/client/assets/{switch-P43q-fGo.js → switch-8wTpXb1-.js} +1 -1
  58. package/dist/client/assets/{textarea-BNSwm2Uw.js → textarea-CTPqKmyI.js} +1 -1
  59. package/dist/client/assets/{tool-set-selector-M0YnbcFP.js → tool-set-selector-B9UyeKAH.js} +1 -1
  60. package/dist/client/assets/{tooltip-D5O925Gp.js → tooltip-ocFCU6ZE.js} +1 -1
  61. package/dist/client/assets/{types-8p_ZLQNY.js → types-CqJfCRYk.js} +3 -3
  62. package/dist/client/assets/{upload-RqBSTCRA.js → upload-CXce3aGG.js} +1 -1
  63. package/dist/client/assets/{use-binding-BxKMNjmS.js → use-binding-BPQhbEIl.js} +1 -1
  64. package/dist/client/assets/{use-connection-B5VryFm7.js → use-connection-DbdMBpCj.js} +1 -1
  65. package/dist/client/assets/{use-gateway-Bcl96GTS.js → use-gateway-DN4bQAAB.js} +1 -1
  66. package/dist/client/assets/{use-list-state-BvxCVBXg.js → use-list-state-DhZmck5D.js} +1 -1
  67. package/dist/client/assets/{use-mcp-BXroRbt9.js → use-mcp-CQqxPDky.js} +1 -1
  68. package/dist/client/assets/{use-members--7RkMxwe.js → use-members-C17JGpEk.js} +1 -1
  69. package/dist/client/assets/{use-mobile-D09YPI1X.js → use-mobile-BnwnARpl.js} +1 -1
  70. package/dist/client/assets/{use-organization-settings-Ctjt5GGI.js → use-organization-settings-CTBiXWgx.js} +1 -1
  71. package/dist/client/assets/{use-tool-call-DMT2JJQo.js → use-tool-call-BxgOuqkM.js} +1 -1
  72. package/dist/client/assets/useQuery-CeKP0W1d.js +1 -0
  73. package/dist/client/assets/utils-oBMoklwF.js +1 -0
  74. package/dist/client/index.html +2 -2
  75. package/dist/server/cli.js +1 -1
  76. package/dist/server/server.js +1 -1
  77. package/package.json +1 -1
  78. package/dist/client/assets/index-BMLzl8gY.css +0 -1
  79. package/dist/client/assets/json-CNPNTT1T.js +0 -1
  80. package/dist/client/assets/prism-light-DJ9E6c7l.js +0 -1
  81. package/dist/client/assets/useQuery-XS-ILlMf.js +0 -1
  82. package/dist/client/assets/utils-E9aiNDpO.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/login-BBdlWaUa.js","assets/button-DpN85Po0.js","assets/utils-E9aiNDpO.js","assets/input-DRMFvIcp.js","assets/shell-layout-CE6a48bs.js","assets/empty-state-jtBjSgAJ.js","assets/use-connection-B5VryFm7.js","assets/icon-CBAJ1FOz.js","assets/tooltip-D5O925Gp.js","assets/use-gateway-Bcl96GTS.js","assets/use-binding-BxKMNjmS.js","assets/auth-DcsMEwUL.js","assets/localstorage-keys-D9JCFoUA.js","assets/useQuery-XS-ILlMf.js","assets/select-DzEOHgSq.js","assets/use-mobile-D09YPI1X.js","assets/textarea-BNSwm2Uw.js","assets/connection-card-CvYHrR5S.js","assets/card-CjmS8q7G.js","assets/error-boundary-BjLQDRan.js","assets/dialog-CfKieCBd.js","assets/use-organization-settings-Ctjt5GGI.js","assets/create-organization-dialog-DXWcXd5o.js","assets/alert-dialog-CCDQTgck.js","assets/form-C-tSv2Q6.js","assets/spinner-DCnW_hcw.js","assets/popover-DIDe1tAI.js","assets/avatar-4ymdPXa_.js","assets/dropdown-menu-Bvf4p8xE.js","assets/home-MLX9b5zd.js","assets/page-BR8BRWlW.js","assets/collection-header-CP7DLL6n.js","assets/collection-display-button-Cq_29P0W.js","assets/collection-page-C1jzPNDj.js","assets/use-tool-call-DMT2JJQo.js","assets/types-8p_ZLQNY.js","assets/index-BHlakCJ5.js","assets/badge-M2zkAPfT.js","assets/page-BZV40eAE.css","assets/members-D_0pxXiL.js","assets/collection-search-CrkK01Ci.js","assets/collection-table-wrapper-DtI6Q7NT.js","assets/tool-set-selector-M0YnbcFP.js","assets/checkbox-DWHTP51a.js","assets/use-members--7RkMxwe.js","assets/well-known-mcp-Dg77mwx9.js","assets/switch-P43q-fGo.js","assets/connections-B3SNLZTA.js","assets/schema-DaJ1vGek.js","assets/use-list-state-BvxCVBXg.js","assets/generate-id-Dyweu44Y.js","assets/settings-DCv43rTD.js","assets/upload-RqBSTCRA.js","assets/monitoring-dAXFetG3.js","assets/index-DysuQWmq.js","assets/store-w0RourHd.js","assets/slugify-CEUa2lfQ.js","assets/registry-utils-ulDDT0d8.js","assets/app-name-gTETL9So.js","assets/store-app-detail-Boq9PC3_.js","assets/resource-tabs-e5WwAHct.js","assets/layout-C7PMXMWr.js","assets/resource-tabs-CSRUKxnt.css","assets/use-mcp-BXroRbt9.js","assets/extract-connection-data-CbCjXz3B.js","assets/connection-detail-8UBUICjc.js","assets/index-DV_-45hJ.js","assets/mcp-oauth-CF0djzC4.js","assets/formatDistanceToNow-Ctx6mZEP.js","assets/collection-detail-BEA961Ga.js","assets/circle-alert-nIYjC1xl.js","assets/gateways-BMuRXxz2.js","assets/gateway-detail-ho3nacsQ.js","assets/oauth-callback-VTrUtdoZ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/login-DHkcl1CZ.js","assets/button-8a8UdvyR.js","assets/utils-oBMoklwF.js","assets/input-GtBoan0u.js","assets/shell-layout-BDhhfHrp.js","assets/empty-state-CwiQR0XJ.js","assets/use-connection-DbdMBpCj.js","assets/icon-CzxeHWBl.js","assets/tooltip-ocFCU6ZE.js","assets/use-gateway-DN4bQAAB.js","assets/use-binding-BPQhbEIl.js","assets/auth-bF2_ysdG.js","assets/localstorage-keys-DdRmNbGe.js","assets/useQuery-CeKP0W1d.js","assets/select-gKhGAtmi.js","assets/use-mobile-BnwnARpl.js","assets/textarea-CTPqKmyI.js","assets/connection-card-xMF7zskf.js","assets/card-Cyeg7tCo.js","assets/error-boundary-8a3_at8W.js","assets/dialog-DOdwpjqP.js","assets/use-organization-settings-CTBiXWgx.js","assets/create-organization-dialog-Cz9P_oQD.js","assets/alert-dialog-Bj3sxji2.js","assets/form-DU90-O_I.js","assets/spinner-Uc4IX4M6.js","assets/popover-DdVvJgdl.js","assets/avatar-B9zSDca0.js","assets/dropdown-menu-BTTzlaf4.js","assets/home-CSzEs1Rf.js","assets/page-DQXzmwPi.js","assets/collection-header-B92Inaku.js","assets/collection-display-button-CGcY64sw.js","assets/collection-page-BfXTrpEI.js","assets/use-tool-call-BxgOuqkM.js","assets/types-CqJfCRYk.js","assets/index-DCY07ujJ.js","assets/badge-Ba7oj8pn.js","assets/page-BZV40eAE.css","assets/members-CX-ziwX2.js","assets/collection-search-C7G2QK3t.js","assets/collection-table-wrapper-DdGYlOCN.js","assets/tool-set-selector-B9UyeKAH.js","assets/checkbox-DCjoNloy.js","assets/use-members-C17JGpEk.js","assets/well-known-mcp-Dg77mwx9.js","assets/switch-8wTpXb1-.js","assets/connections-Bm36z6Kn.js","assets/schema-zp4LhQ6R.js","assets/use-list-state-DhZmck5D.js","assets/generate-id-Dyweu44Y.js","assets/settings-DOjDcDAR.js","assets/upload-CXce3aGG.js","assets/monitoring-5rf2nLo0.js","assets/index-Bgo9U3qs.js","assets/store-B09vXexU.js","assets/slugify-CEUa2lfQ.js","assets/registry-utils-ulDDT0d8.js","assets/app-name-gTETL9So.js","assets/store-app-detail-BqI8KTAM.js","assets/resource-tabs-D-d1_s9d.js","assets/layout-DtdXVJv4.js","assets/resource-tabs-CSRUKxnt.css","assets/use-mcp-CQqxPDky.js","assets/extract-connection-data-BpMaEsIX.js","assets/connection-detail-CKuTnq-B.js","assets/index-jKafgZHH.js","assets/mcp-oauth-pvU53iS3.js","assets/formatDistanceToNow-Ctx6mZEP.js","assets/collection-detail-ieEvVULW.js","assets/circle-alert-DVLBfxyX.js","assets/gateways-BxMjTmO6.js","assets/gateway-detail-B2bI_bIU.js","assets/oauth-callback-NjwvQ7fr.js"])))=>i.map(i=>d[i]);
2
2
  function fC(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const o in a)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>a[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();const hC="modulepreload",pC=function(e){return"/"+e},g_={},Dn=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=d?.nonce||d?.getAttribute("nonce");o=u(n.map(h=>{if(h=pC(h),h in g_)return;g_[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":hC,g||(y.as="script"),y.crossOrigin="",y.href=h,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((_,S)=>{y.addEventListener("load",_),y.addEventListener("error",()=>S(Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return o.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})};var IB=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function No(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rm={exports:{}},Vl={};var v_;function mC(){if(v_)return Vl;v_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:a,key:u,ref:o!==void 0?o:null,props:l}}return Vl.Fragment=t,Vl.jsx=n,Vl.jsxs=n,Vl}var y_;function gC(){return y_||(y_=1,rm.exports=mC()),rm.exports}var b=gC(),am={exports:{}},Fl={},im={exports:{}},om={};var b_;function vC(){return b_||(b_=1,(function(e){function t(P,V){var $=P.length;P.push(V);e:for(;0<$;){var re=$-1>>>1,ve=P[re];if(0<o(ve,V))P[re]=V,P[$]=ve,$=re;else break e}}function n(P){return P.length===0?null:P[0]}function a(P){if(P.length===0)return null;var V=P[0],$=P.pop();if($!==V){P[0]=$;e:for(var re=0,ve=P.length,k=ve>>>1;re<k;){var Z=2*(re+1)-1,ee=P[Z],oe=Z+1,pe=P[oe];if(0>o(ee,$))oe<ve&&0>o(pe,ee)?(P[re]=pe,P[oe]=$,re=oe):(P[re]=ee,P[Z]=$,re=Z);else if(oe<ve&&0>o(pe,$))P[re]=pe,P[oe]=$,re=oe;else break e}}return V}function o(P,V){var $=P.sortIndex-V.sortIndex;return $!==0?$:P.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var f=[],h=[],g=1,p=null,y=3,_=!1,S=!1,w=!1,T=!1,R=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function O(P){for(var V=n(h);V!==null;){if(V.callback===null)a(h);else if(V.startTime<=P)a(h),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(h)}}function I(P){if(w=!1,O(P),!S)if(n(f)!==null)S=!0,L||(L=!0,W());else{var V=n(h);V!==null&&ie(I,V.startTime-P)}}var L=!1,N=-1,D=5,U=-1;function Q(){return T?!0:!(e.unstable_now()-U<D)}function G(){if(T=!1,L){var P=e.unstable_now();U=P;var V=!0;try{e:{S=!1,w&&(w=!1,A(N),N=-1),_=!0;var $=y;try{t:{for(O(P),p=n(f);p!==null&&!(p.expirationTime>P&&Q());){var re=p.callback;if(typeof re=="function"){p.callback=null,y=p.priorityLevel;var ve=re(p.expirationTime<=P);if(P=e.unstable_now(),typeof ve=="function"){p.callback=ve,O(P),V=!0;break t}p===n(f)&&a(f),O(P)}else a(f);p=n(f)}if(p!==null)V=!0;else{var k=n(h);k!==null&&ie(I,k.startTime-P),V=!1}}break e}finally{p=null,y=$,_=!1}V=void 0}}finally{V?W():L=!1}}}var W;if(typeof C=="function")W=function(){C(G)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,ne=j.port2;j.port1.onmessage=G,W=function(){ne.postMessage(null)}}else W=function(){R(G,0)};function ie(P,V){N=R(function(){P(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(P){switch(y){case 1:case 2:case 3:var V=3;break;default:V=y}var $=y;y=V;try{return P()}finally{y=$}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(P,V){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var $=y;y=P;try{return V()}finally{y=$}},e.unstable_scheduleCallback=function(P,V,$){var re=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?re+$:re):$=re,P){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=$+ve,P={id:g++,callback:V,priorityLevel:P,startTime:$,expirationTime:ve,sortIndex:-1},$>re?(P.sortIndex=$,t(h,P),n(f)===null&&P===n(h)&&(w?(A(N),N=-1):w=!0,ie(I,$-re))):(P.sortIndex=ve,t(f,P),S||_||(S=!0,L||(L=!0,W()))),P},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(P){var V=y;return function(){var $=y;y=V;try{return P.apply(this,arguments)}finally{y=$}}}})(om)),om}var __;function yC(){return __||(__=1,im.exports=vC()),im.exports}var sm={exports:{}},Ge={};var E_;function bC(){if(E_)return Ge;E_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),y=Symbol.iterator;function _(k){return k===null||typeof k!="object"?null:(k=y&&k[y]||k["@@iterator"],typeof k=="function"?k:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function R(k,Z,ee){this.props=k,this.context=Z,this.refs=T,this.updater=ee||S}R.prototype.isReactComponent={},R.prototype.setState=function(k,Z){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,Z,"setState")},R.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function A(){}A.prototype=R.prototype;function C(k,Z,ee){this.props=k,this.context=Z,this.refs=T,this.updater=ee||S}var O=C.prototype=new A;O.constructor=C,w(O,R.prototype),O.isPureReactComponent=!0;var I=Array.isArray;function L(){}var N={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function U(k,Z,ee){var oe=ee.ref;return{$$typeof:e,type:k,key:Z,ref:oe!==void 0?oe:null,props:ee}}function Q(k,Z){return U(k.type,Z,k.props)}function G(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function W(k){var Z={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(ee){return Z[ee]})}var j=/\/+/g;function ne(k,Z){return typeof k=="object"&&k!==null&&k.key!=null?W(""+k.key):Z.toString(36)}function ie(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(L,L):(k.status="pending",k.then(function(Z){k.status==="pending"&&(k.status="fulfilled",k.value=Z)},function(Z){k.status==="pending"&&(k.status="rejected",k.reason=Z)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function P(k,Z,ee,oe,pe){var be=typeof k;(be==="undefined"||be==="boolean")&&(k=null);var ye=!1;if(k===null)ye=!0;else switch(be){case"bigint":case"string":case"number":ye=!0;break;case"object":switch(k.$$typeof){case e:case t:ye=!0;break;case g:return ye=k._init,P(ye(k._payload),Z,ee,oe,pe)}}if(ye)return pe=pe(k),ye=oe===""?"."+ne(k,0):oe,I(pe)?(ee="",ye!=null&&(ee=ye.replace(j,"$&/")+"/"),P(pe,Z,ee,"",function(ke){return ke})):pe!=null&&(G(pe)&&(pe=Q(pe,ee+(pe.key==null||k&&k.key===pe.key?"":(""+pe.key).replace(j,"$&/")+"/")+ye)),Z.push(pe)),1;ye=0;var Se=oe===""?".":oe+":";if(I(k))for(var Pe=0;Pe<k.length;Pe++)oe=k[Pe],be=Se+ne(oe,Pe),ye+=P(oe,Z,ee,be,pe);else if(Pe=_(k),typeof Pe=="function")for(k=Pe.call(k),Pe=0;!(oe=k.next()).done;)oe=oe.value,be=Se+ne(oe,Pe++),ye+=P(oe,Z,ee,be,pe);else if(be==="object"){if(typeof k.then=="function")return P(ie(k),Z,ee,oe,pe);throw Z=String(k),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return ye}function V(k,Z,ee){if(k==null)return k;var oe=[],pe=0;return P(k,oe,"","",function(be){return Z.call(ee,be,pe++)}),oe}function $(k){if(k._status===-1){var Z=k._result;Z=Z(),Z.then(function(ee){(k._status===0||k._status===-1)&&(k._status=1,k._result=ee)},function(ee){(k._status===0||k._status===-1)&&(k._status=2,k._result=ee)}),k._status===-1&&(k._status=0,k._result=Z)}if(k._status===1)return k._result.default;throw k._result}var re=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},ve={map:V,forEach:function(k,Z,ee){V(k,function(){Z.apply(this,arguments)},ee)},count:function(k){var Z=0;return V(k,function(){Z++}),Z},toArray:function(k){return V(k,function(Z){return Z})||[]},only:function(k){if(!G(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Ge.Activity=p,Ge.Children=ve,Ge.Component=R,Ge.Fragment=n,Ge.Profiler=o,Ge.PureComponent=C,Ge.StrictMode=a,Ge.Suspense=f,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(k){return N.H.useMemoCache(k)}},Ge.cache=function(k){return function(){return k.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(k,Z,ee){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var oe=w({},k.props),pe=k.key;if(Z!=null)for(be in Z.key!==void 0&&(pe=""+Z.key),Z)!D.call(Z,be)||be==="key"||be==="__self"||be==="__source"||be==="ref"&&Z.ref===void 0||(oe[be]=Z[be]);var be=arguments.length-2;if(be===1)oe.children=ee;else if(1<be){for(var ye=Array(be),Se=0;Se<be;Se++)ye[Se]=arguments[Se+2];oe.children=ye}return U(k.type,pe,oe)},Ge.createContext=function(k){return k={$$typeof:u,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:l,_context:k},k},Ge.createElement=function(k,Z,ee){var oe,pe={},be=null;if(Z!=null)for(oe in Z.key!==void 0&&(be=""+Z.key),Z)D.call(Z,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(pe[oe]=Z[oe]);var ye=arguments.length-2;if(ye===1)pe.children=ee;else if(1<ye){for(var Se=Array(ye),Pe=0;Pe<ye;Pe++)Se[Pe]=arguments[Pe+2];pe.children=Se}if(k&&k.defaultProps)for(oe in ye=k.defaultProps,ye)pe[oe]===void 0&&(pe[oe]=ye[oe]);return U(k,be,pe)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(k){return{$$typeof:d,render:k}},Ge.isValidElement=G,Ge.lazy=function(k){return{$$typeof:g,_payload:{_status:-1,_result:k},_init:$}},Ge.memo=function(k,Z){return{$$typeof:h,type:k,compare:Z===void 0?null:Z}},Ge.startTransition=function(k){var Z=N.T,ee={};N.T=ee;try{var oe=k(),pe=N.S;pe!==null&&pe(ee,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(L,re)}catch(be){re(be)}finally{Z!==null&&ee.types!==null&&(Z.types=ee.types),N.T=Z}},Ge.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ge.use=function(k){return N.H.use(k)},Ge.useActionState=function(k,Z,ee){return N.H.useActionState(k,Z,ee)},Ge.useCallback=function(k,Z){return N.H.useCallback(k,Z)},Ge.useContext=function(k){return N.H.useContext(k)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(k,Z){return N.H.useDeferredValue(k,Z)},Ge.useEffect=function(k,Z){return N.H.useEffect(k,Z)},Ge.useEffectEvent=function(k){return N.H.useEffectEvent(k)},Ge.useId=function(){return N.H.useId()},Ge.useImperativeHandle=function(k,Z,ee){return N.H.useImperativeHandle(k,Z,ee)},Ge.useInsertionEffect=function(k,Z){return N.H.useInsertionEffect(k,Z)},Ge.useLayoutEffect=function(k,Z){return N.H.useLayoutEffect(k,Z)},Ge.useMemo=function(k,Z){return N.H.useMemo(k,Z)},Ge.useOptimistic=function(k,Z){return N.H.useOptimistic(k,Z)},Ge.useReducer=function(k,Z,ee){return N.H.useReducer(k,Z,ee)},Ge.useRef=function(k){return N.H.useRef(k)},Ge.useState=function(k){return N.H.useState(k)},Ge.useSyncExternalStore=function(k,Z,ee){return N.H.useSyncExternalStore(k,Z,ee)},Ge.useTransition=function(){return N.H.useTransition()},Ge.version="19.2.3",Ge}var S_;function $i(){return S_||(S_=1,sm.exports=bC()),sm.exports}var lm={exports:{}},In={};var w_;function _C(){if(w_)return In;w_=1;var e=$i();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(f,h,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:p==null?null:""+p,children:f,containerInfo:h,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return In.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,In.createPortal=function(f,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(f,h,null,g)},In.flushSync=function(f){var h=u.T,g=a.p;try{if(u.T=null,a.p=2,f)return f()}finally{u.T=h,a.p=g,a.d.f()}},In.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(f,h))},In.prefetchDNS=function(f){typeof f=="string"&&a.d.D(f)},In.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,p=d(g,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,_=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?a.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:y,fetchPriority:_}):g==="script"&&a.d.X(f,{crossOrigin:p,integrity:y,fetchPriority:_,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},In.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);a.d.M(f,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(f)},In.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,p=d(g,h.crossOrigin);a.d.L(f,g,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},In.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=d(h.as,h.crossOrigin);a.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(f)},In.requestFormReset=function(f){a.d.r(f)},In.unstable_batchedUpdates=function(f,h){return f(h)},In.useFormState=function(f,h,g){return u.H.useFormState(f,h,g)},In.useFormStatus=function(){return u.H.useHostTransitionStatus()},In.version="19.2.3",In}var x_;function dw(){if(x_)return lm.exports;x_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),lm.exports=_C(),lm.exports}var R_;function EC(){if(R_)return Fl;R_=1;var e=yC(),t=$i(),n=dw();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var i=r,s=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(s=i.return),r=i.return;while(r)}return i.tag===3?s:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function d(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(l(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=l(r),i===null)throw Error(a(188));return i!==r?null:r}for(var s=r,c=i;;){var m=s.return;if(m===null)break;var v=m.alternate;if(v===null){if(c=m.return,c!==null){s=c;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===s)return f(m),r;if(v===c)return f(m),i;v=v.sibling}throw Error(a(188))}if(s.return!==c.return)s=m,c=v;else{for(var x=!1,M=m.child;M;){if(M===s){x=!0,s=m,c=v;break}if(M===c){x=!0,c=m,s=v;break}M=M.sibling}if(!x){for(M=v.child;M;){if(M===s){x=!0,s=v,c=m;break}if(M===c){x=!0,c=v,s=m;break}M=M.sibling}if(!x)throw Error(a(189))}}if(s.alternate!==c)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?r:i}function g(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=g(r),i!==null)return i;r=r.sibling}return null}var p=Object.assign,y=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),C=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function W(r){return r===null||typeof r!="object"?null:(r=G&&r[G]||r["@@iterator"],typeof r=="function"?r:null)}var j=Symbol.for("react.client.reference");function ne(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===j?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case w:return"Fragment";case R:return"Profiler";case T:return"StrictMode";case I:return"Suspense";case L:return"SuspenseList";case U:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case C:return r.displayName||"Context";case A:return(r._context.displayName||"Context")+".Consumer";case O:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case N:return i=r.displayName||null,i!==null?i:ne(r.type)||"Memo";case D:i=r._payload,r=r._init;try{return ne(r(i))}catch{}}return null}var ie=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},re=[],ve=-1;function k(r){return{current:r}}function Z(r){0>ve||(r.current=re[ve],re[ve]=null,ve--)}function ee(r,i){ve++,re[ve]=r.current,r.current=i}var oe=k(null),pe=k(null),be=k(null),ye=k(null);function Se(r,i){switch(ee(be,i),ee(pe,r),ee(oe,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Bb(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Bb(i),r=zb(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Z(oe),ee(oe,r)}function Pe(){Z(oe),Z(pe),Z(be)}function ke(r){r.memoizedState!==null&&ee(ye,r);var i=oe.current,s=zb(i,r.type);i!==s&&(ee(pe,r),ee(oe,s))}function Ee(r){pe.current===r&&(Z(oe),Z(pe)),ye.current===r&&(Z(ye),jl._currentValue=$)}var ze,Pt;function ge(r){if(ze===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);ze=i&&i[1]||"",Pt=-1<s.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+ze+r+Pt}var me=!1;function Re(r,i){if(!r||me)return"";me=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(i){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ae){var te=ae}Reflect.construct(r,[],ue)}else{try{ue.call()}catch(ae){te=ae}r.call(ue.prototype)}}else{try{throw Error()}catch(ae){te=ae}(ue=r())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ae){if(ae&&te&&typeof ae.stack=="string")return[ae.stack,te.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=c.DetermineComponentFrameRoot(),x=v[0],M=v[1];if(x&&M){var z=x.split(`
@@ -115,4 +115,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
115
115
  .dark .grecaptcha-badge {
116
116
  border-color: var(--input) !important;
117
117
  }
118
- `}),b.jsx(A9,{ref:e,sitekey:t.siteKey,theme:n,hl:a,size:t.provider==="google-recaptcha-v2-invisible"?"invisible":"normal",className:de(t.provider==="google-recaptcha-v2-invisible"?"absolute":"mx-auto h-[76px] w-[302px] overflow-hidden rounded bg-muted")},`${n}-${a}-${t.provider}`)]}):null}var HU=["/sign-up/email","/sign-in/email","/forget-password"];function Uc({ref:e,localization:t,action:n}){const{captcha:a}=E.useContext(Ze);if(!a||n&&!(a.endpoints||HU).includes(n))return null;const{theme:o}=Nv(),l=a.provider==="google-recaptcha-v2-checkbox"||a.provider==="google-recaptcha-v2-invisible",u=a.provider==="google-recaptcha-v3"||a.provider==="google-recaptcha-v2-invisible",d=a.provider==="cloudflare-turnstile",f=a.provider==="hcaptcha",h=a.provider==="captchafox";return b.jsxs(b.Fragment,{children:[l&&b.jsx(FU,{ref:e}),u&&b.jsx(VU,{localization:t}),d&&b.jsx(CO,{className:"mx-auto",ref:e,siteKey:a.siteKey,options:{theme:o,size:"flexible"}}),f&&b.jsx("div",{className:"mx-auto",children:b.jsx(t9,{ref:e,sitekey:a.siteKey,theme:o})}),h&&b.jsx("div",{className:"mx-auto",children:b.jsx(bO,{ref:e,sitekey:a.siteKey,theme:o})})]})}function w0({className:e,containerClassName:t,...n}){return b.jsx(LO,{"data-slot":"input-otp",containerClassName:de("flex items-center gap-2 has-disabled:opacity-50",t),className:de("disabled:cursor-not-allowed",e),...n})}function Cs({className:e,...t}){return b.jsx("div",{"data-slot":"input-otp-group",className:de("flex items-center",e),...t})}function gn({index:e,className:t,...n}){const a=E.useContext(DO),{char:o,hasFakeCaret:l,isActive:u}=a?.slots[e]??{};return b.jsxs("div",{"data-slot":"input-otp-slot","data-active":u,className:de("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",t),...n,children:[o,l&&b.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:b.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function mg({...e}){return b.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...e,children:b.jsx(xN,{})})}function x0({otpSeparators:e=0}){return e===0?b.jsxs(Cs,{children:[b.jsx(gn,{index:0}),b.jsx(gn,{index:1}),b.jsx(gn,{index:2}),b.jsx(gn,{index:3}),b.jsx(gn,{index:4}),b.jsx(gn,{index:5})]}):e===1?b.jsxs(b.Fragment,{children:[b.jsxs(Cs,{children:[b.jsx(gn,{index:0}),b.jsx(gn,{index:1}),b.jsx(gn,{index:2})]}),b.jsx(mg,{}),b.jsxs(Cs,{children:[b.jsx(gn,{index:3}),b.jsx(gn,{index:4}),b.jsx(gn,{index:5})]})]}):b.jsxs(b.Fragment,{children:[b.jsxs(Cs,{children:[b.jsx(gn,{index:0}),b.jsx(gn,{index:1})]}),b.jsx(mg,{}),b.jsxs(Cs,{children:[b.jsx(gn,{index:2}),b.jsx(gn,{index:3})]}),b.jsx(mg,{}),b.jsxs(Cs,{children:[b.jsx(gn,{index:4}),b.jsx(gn,{index:5})]})]})}function sw(e){const[t,n]=E.useState();return t?b.jsx(GU,{...e,email:t}):b.jsx($U,{...e,setEmail:n})}function $U({className:e,classNames:t,isSubmitting:n,localization:a,setIsSubmitting:o,setEmail:l}){const u=Xa(),{captchaRef:d,getCaptchaHeaders:f}=jc({localization:a}),{authClient:h,localization:g,toast:p,localizeErrors:y}=E.useContext(Ze);a={...g,...a};const _=Pn({email:et().email({message:`${a.EMAIL} ${a.IS_INVALID}`})}),S=_a({resolver:Ea(_),defaultValues:{email:""}});n=n||S.formState.isSubmitting,E.useEffect(()=>{o?.(S.formState.isSubmitting)},[S.formState.isSubmitting,o]);async function w({email:T}){const R={throw:!0,headers:await f("/email-otp/send-verification-otp")};try{await h.emailOtp.sendVerificationOtp({email:T,type:"sign-in",fetchOptions:R}),p({variant:"success",message:a.EMAIL_OTP_VERIFICATION_SENT}),l(T)}catch(A){p({variant:"error",message:Ut({error:A,localization:a,localizeErrors:y})})}}return b.jsx(wa,{...S,children:b.jsxs("form",{onSubmit:S.handleSubmit(w),noValidate:u,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:S.control,name:"email",render:({field:T})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{className:t?.input,type:"email",placeholder:a.EMAIL_PLACEHOLDER,disabled:n,...T})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Uc,{ref:d,localization:a,action:"/email-otp/send-verification-otp"}),b.jsx(Ot,{type:"submit",disabled:n,className:de("w-full",t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.EMAIL_OTP_SEND_ACTION})]})})}function GU({className:e,classNames:t,isSubmitting:n,localization:a,otpSeparators:o=0,redirectTo:l,setIsSubmitting:u,email:d}){const{authClient:f,localization:h,toast:g,localizeErrors:p}=E.useContext(Ze);a={...h,...a};const{onSuccess:y,isPending:_}=xa({redirectTo:l}),S=Pn({code:et().min(1,{message:`${a.EMAIL_OTP} ${a.IS_REQUIRED}`}).min(6,{message:`${a.EMAIL_OTP} ${a.IS_INVALID}`})}),w=_a({resolver:Ea(S),defaultValues:{code:""}});n=n||w.formState.isSubmitting||_,E.useEffect(()=>{u?.(w.formState.isSubmitting||_)},[w.formState.isSubmitting,_,u]);async function T({code:R}){try{await f.signIn.emailOtp({email:d,otp:R,fetchOptions:{throw:!0}}),await y()}catch(A){g({variant:"error",message:Ut({error:A,localization:a,localizeErrors:p})}),w.reset()}}return b.jsx(wa,{...w,children:b.jsxs("form",{onSubmit:w.handleSubmit(T),className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:w.control,name:"code",render:({field:R})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.EMAIL_OTP}),b.jsx(an,{children:b.jsx(w0,{...R,maxLength:6,onChange:A=>{R.onChange(A),A.length===6&&w.handleSubmit(T)()},containerClassName:t?.otpInputContainer,className:t?.otpInput,disabled:n,children:b.jsx(x0,{otpSeparators:o})})}),b.jsx(fn,{className:t?.error})]})}),b.jsx("div",{className:"grid gap-4",children:b.jsxs(Ot,{type:"submit",disabled:n,className:de(t?.button,t?.primaryButton),children:[n&&b.jsx(_n,{className:"animate-spin"}),a.EMAIL_OTP_VERIFY_ACTION]})})]})})}function qU({onCancel:e,localization:t,className:n,classNames:a,otpSeparators:o,callbackURL:l,isSubmitting:u,redirectTo:d,setIsSubmitting:f}){const[h,g]=E.useState(!0),[p,y]=E.useState(30),{authClient:_,localization:S,toast:w,localizeErrors:T,navigate:R,basePath:A,viewPaths:C}=E.useContext(Ze);t={...S,...t};const O=typeof window<"u"&&new URLSearchParams(window.location.search).get("email")||"",{onSuccess:I,isPending:L}=xa({redirectTo:d}),N=Pn({code:et().min(1,{message:`${t.EMAIL_OTP} ${t.IS_REQUIRED}`}).min(6,{message:`${t.EMAIL_OTP} ${t.IS_INVALID}`})}),D=_a({resolver:Ea(N),defaultValues:{code:""}}),U=u||D.formState.isSubmitting||L;E.useEffect(()=>{f?.(D.formState.isSubmitting||L)},[D.formState.isSubmitting,L,f]),E.useEffect(()=>{if(p>0){const W=setTimeout(()=>y(p-1),1e3);return()=>clearTimeout(W)}else g(!1)},[p]);async function Q({code:W}){try{const j=await _.emailOtp.verifyEmail({email:O,otp:W,fetchOptions:{throw:!0}});"token"in j&&j.token?await I():(R(`${A}/${C.SIGN_IN}${window.location.search}`),w({variant:"success",message:t.EMAIL_VERIFICATION_SUCCESS}))}catch(j){w({variant:"error",message:Ut({error:j,localization:t,localizeErrors:T})}),D.reset()}}async function G(){if(!h){g(!0),y(30);try{await _.emailOtp.sendVerificationOtp({email:O,type:"email-verification",fetchOptions:{throw:!0}}),w({variant:"success",message:t.EMAIL_OTP_VERIFICATION_SENT})}catch(W){w({variant:"error",message:Ut({error:W,localization:t,localizeErrors:T})}),g(!1),y(0)}}}return O?b.jsx(wa,{...D,children:b.jsxs("form",{onSubmit:D.handleSubmit(Q),className:de("grid w-full gap-6",n,a?.base),children:[b.jsx(Gt,{control:D.control,name:"code",render:({field:W})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:a?.label,children:t.EMAIL_OTP}),b.jsx(an,{children:b.jsx(w0,{...W,maxLength:6,onChange:j=>{W.onChange(j),j.length===6&&D.handleSubmit(Q)()},containerClassName:a?.otpInputContainer,className:a?.otpInput,disabled:U,children:b.jsx(x0,{otpSeparators:o})})}),b.jsx(fn,{className:a?.error})]})}),b.jsxs("div",{className:"grid gap-4",children:[b.jsxs(Ot,{type:"submit",disabled:U,className:de(a?.button,a?.primaryButton),children:[U&&b.jsx(_n,{className:"animate-spin"}),t.EMAIL_OTP_VERIFY_ACTION]}),b.jsx(Ot,{type:"button",variant:"outline",onClick:G,disabled:h||U,className:de("w-full",a?.button),children:h?`${t.RESEND_VERIFICATION_EMAIL} (${p}s)`:t.RESEND_VERIFICATION_EMAIL}),e&&b.jsx(Ot,{type:"button",variant:"ghost",onClick:e,disabled:U,className:"w-full",children:t.CANCEL})]})]})}):b.jsx("div",{className:de("grid w-full gap-6",n),children:b.jsxs("div",{className:"text-center",children:[b.jsx("h2",{className:"font-semibold text-destructive text-lg",children:"Invalid Request"}),b.jsx("p",{className:"text-muted-foreground text-sm",children:t.EMAIL_REQUIRED||"Email address is required"})]})})}function YU({className:e,classNames:t,isSubmitting:n,localization:a,setIsSubmitting:o}){const l=Xa(),{captchaRef:u,getCaptchaHeaders:d,resetCaptcha:f}=jc({localization:a}),{authClient:h,basePath:g,baseURL:p,localization:y,navigate:_,toast:S,viewPaths:w,localizeErrors:T}=E.useContext(Ze);a={...y,...a};const R=Pn({email:et().email({message:`${a.EMAIL} ${a.IS_INVALID}`}).min(1,{message:`${a.EMAIL} ${a.IS_REQUIRED}`})}),A=_a({resolver:Ea(R),defaultValues:{email:""}});n=n||A.formState.isSubmitting,E.useEffect(()=>{o?.(A.formState.isSubmitting)},[A.formState.isSubmitting,o]);async function C({email:O}){try{const I={throw:!0,headers:await d("/forget-password")};await h.requestPasswordReset({email:O,redirectTo:`${p}${g}/${w.RESET_PASSWORD}`,fetchOptions:I}),S({variant:"success",message:a.FORGOT_PASSWORD_EMAIL}),_(`${g}/${w.SIGN_IN}${window.location.search}`)}catch(I){S({variant:"error",message:Ut({error:I,localization:a,localizeErrors:T})}),f()}}return b.jsx(wa,{...A,children:b.jsxs("form",{onSubmit:A.handleSubmit(C),noValidate:l,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:A.control,name:"email",render:({field:O})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{className:t?.input,type:"email",placeholder:a.EMAIL_PLACEHOLDER,disabled:n,...O})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Uc,{ref:u,localization:a,action:"/forget-password"}),b.jsx(Ot,{type:"submit",disabled:n,className:de("w-full",t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.FORGOT_PASSWORD_ACTION})]})})}function lw({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,redirectTo:l,setIsSubmitting:u}){const d=Xa(),{captchaRef:f,getCaptchaHeaders:h,resetCaptcha:g}=jc({localization:o}),{authClient:p,basePath:y,baseURL:_,persistClient:S,localization:w,redirectTo:T,viewPaths:R,toast:A,localizeErrors:C}=E.useContext(Ze);o={...w,...o};const O=E.useCallback(()=>l||Do("redirectTo")||T,[l,T]),I=E.useCallback(()=>`${_}${n||(S?`${y}/${R.CALLBACK}?redirectTo=${encodeURIComponent(O())}`:O())}`,[n,S,y,R,_,O]),L=Pn({email:et().email({message:`${o.EMAIL} ${o.IS_INVALID}`})}),N=_a({resolver:Ea(L),defaultValues:{email:""}});a=a||N.formState.isSubmitting,E.useEffect(()=>{u?.(N.formState.isSubmitting)},[N.formState.isSubmitting,u]);async function D({email:U}){try{const Q={throw:!0,headers:await h("/sign-in/magic-link")};await p.signIn.magicLink({email:U,callbackURL:I(),fetchOptions:Q}),A({variant:"success",message:o.MAGIC_LINK_EMAIL}),N.reset()}catch(Q){A({variant:"error",message:Ut({error:Q,localization:o,localizeErrors:C})}),g()}}return b.jsx(wa,{...N,children:b.jsxs("form",{onSubmit:N.handleSubmit(D),noValidate:d,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:N.control,name:"email",render:({field:U})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{className:t?.input,type:"email",placeholder:o.EMAIL_PLACEHOLDER,disabled:a,...U})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Uc,{ref:f,localization:o,action:"/sign-in/magic-link"}),b.jsx(Ot,{type:"submit",disabled:a,className:de("w-full",t?.button,t?.primaryButton),children:a?b.jsx(_n,{className:"animate-spin"}):o.MAGIC_LINK_ACTION})]})})}function KU({className:e,classNames:t,isSubmitting:n,localization:a,redirectTo:o,setIsSubmitting:l}){const{authClient:u,localization:d,toast:f,localizeErrors:h}=E.useContext(Ze);a={...d,...a};const{onSuccess:g,isPending:p}=xa({redirectTo:o}),y=Pn({code:et().min(1,{message:a.BACKUP_CODE_REQUIRED})}),_=_a({resolver:Ea(y),defaultValues:{code:""}});n=n||_.formState.isSubmitting||p,E.useEffect(()=>{l?.(_.formState.isSubmitting||p)},[_.formState.isSubmitting,p,l]);async function S({code:w}){try{await u.twoFactor.verifyBackupCode({code:w,fetchOptions:{throw:!0}}),await g()}catch(T){f({variant:"error",message:Ut({error:T,localization:a,localizeErrors:h})}),_.reset()}}return b.jsx(wa,{..._,children:b.jsxs("form",{onSubmit:_.handleSubmit(S),className:de("grid gap-6",e,t?.base),children:[b.jsx(Gt,{control:_.control,name:"code",render:({field:w})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.BACKUP_CODE}),b.jsx(an,{children:b.jsx(Zr,{placeholder:a.BACKUP_CODE_PLACEHOLDER,autoComplete:"off",className:t?.input,disabled:n,...w})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Ot,{type:"submit",disabled:n,className:de(t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.RECOVER_ACCOUNT_ACTION})]})})}function WU({className:e,classNames:t,localization:n,passwordValidation:a}){const o=E.useRef(!1),{authClient:l,basePath:u,credentials:d,localization:f,viewPaths:h,navigate:g,toast:p,localizeErrors:y}=E.useContext(Ze),_=d?.confirmPassword,S=d?.passwordValidation;n={...f,...n},a={...S,...a};const w=Pn({newPassword:vc(a,{PASSWORD_REQUIRED:n.NEW_PASSWORD_REQUIRED,PASSWORD_TOO_SHORT:n.PASSWORD_TOO_SHORT,PASSWORD_TOO_LONG:n.PASSWORD_TOO_LONG,INVALID_PASSWORD:n.INVALID_PASSWORD}),confirmPassword:_?vc(a,{PASSWORD_REQUIRED:n.CONFIRM_PASSWORD_REQUIRED,PASSWORD_TOO_SHORT:n.PASSWORD_TOO_SHORT,PASSWORD_TOO_LONG:n.PASSWORD_TOO_LONG,INVALID_PASSWORD:n.INVALID_PASSWORD}):et().optional()}).refine(C=>!_||C.newPassword===C.confirmPassword,{message:n.PASSWORDS_DO_NOT_MATCH,path:["confirmPassword"]}),T=_a({resolver:Ea(w),defaultValues:{newPassword:"",confirmPassword:""}}),R=T.formState.isSubmitting;E.useEffect(()=>{if(o.current)return;o.current=!0;const O=new URLSearchParams(window.location.search).get("token");(!O||O==="INVALID_TOKEN")&&(g(`${u}/${h.SIGN_IN}${window.location.search}`),p({variant:"error",message:n.INVALID_TOKEN}))},[u,g,p,h,n]);async function A({newPassword:C}){try{const I=new URLSearchParams(window.location.search).get("token");await l.resetPassword({newPassword:C,token:I,fetchOptions:{throw:!0}}),p({variant:"success",message:n.RESET_PASSWORD_SUCCESS}),g(`${u}/${h.SIGN_IN}${window.location.search}`)}catch(O){p({variant:"error",message:Ut({error:O,localization:n,localizeErrors:y})}),T.reset()}}return b.jsx(wa,{...T,children:b.jsxs("form",{onSubmit:T.handleSubmit(A),className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:T.control,name:"newPassword",render:({field:C})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:n.NEW_PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:n.NEW_PASSWORD_PLACEHOLDER,disabled:R,...C})}),b.jsx(fn,{className:t?.error})]})}),_&&b.jsx(Gt,{control:T.control,name:"confirmPassword",render:({field:C})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:n.CONFIRM_PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:n.CONFIRM_PASSWORD_PLACEHOLDER,disabled:R,...C})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Ot,{type:"submit",disabled:R,className:de("w-full",t?.button,t?.primaryButton),children:R?b.jsx(_n,{className:"animate-spin"}):n.RESET_PASSWORD_ACTION})]})})}function ZU({className:e,classNames:t,isSubmitting:n,localization:a,redirectTo:o,setIsSubmitting:l,passwordValidation:u}){const d=Xa(),{captchaRef:f,getCaptchaHeaders:h,resetCaptcha:g}=jc({localization:a}),{authClient:p,basePath:y,credentials:_,localization:S,viewPaths:w,navigate:T,toast:R,Link:A,localizeErrors:C,emailVerification:O}=E.useContext(Ze),I=_?.rememberMe,L=_?.username,N=_?.passwordValidation;a={...S,...a},u={...N,...u};const{onSuccess:D,isPending:U}=xa({redirectTo:o}),Q=Pn({email:L?et().min(1,{message:`${a.USERNAME} ${a.IS_REQUIRED}`}):et().email({message:`${a.EMAIL} ${a.IS_INVALID}`}),password:vc(u,a),rememberMe:Cv().optional()}),G=_a({resolver:Ea(Q),defaultValues:{email:"",password:"",rememberMe:!I}});n=n||G.formState.isSubmitting||U,E.useEffect(()=>{l?.(G.formState.isSubmitting||U)},[G.formState.isSubmitting,U,l]);async function W({email:j,password:ne,rememberMe:ie}){var P;try{let V={};if(L&&!kI(j)){const $={throw:!0,headers:await h("/sign-in/username")};V=await p.signIn.username({username:j,password:ne,rememberMe:ie,fetchOptions:$})}else{const $={throw:!0,headers:await h("/sign-in/email")};V=await p.signIn.email({email:j,password:ne,rememberMe:ie,fetchOptions:$})}V.twoFactorRedirect?T(`${y}/${w.TWO_FACTOR}${window.location.search}`):await D()}catch(V){G.resetField("password"),g(),R({variant:"error",message:Ut({error:V,localization:a,localizeErrors:C})}),O?.otp&&((P=V?.error)==null?void 0:P.code)==="EMAIL_NOT_VERIFIED"&&T(`${y}/${w.EMAIL_VERIFICATION}?email=${encodeURIComponent(j)}`)}}return b.jsx(wa,{...G,children:b.jsxs("form",{onSubmit:G.handleSubmit(W),noValidate:d,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:G.control,name:"email",render:({field:j})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:L?a.USERNAME:a.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:L?"username":"email",className:t?.input,type:L?"text":"email",placeholder:L?a.SIGN_IN_USERNAME_PLACEHOLDER:a.EMAIL_PLACEHOLDER,disabled:n,...j})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:G.control,name:"password",render:({field:j})=>b.jsxs(qt,{children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx(Yt,{className:t?.label,children:a.PASSWORD}),_?.forgotPassword&&b.jsx(A,{className:de("text-sm hover:underline",t?.forgotPasswordLink),href:`${y}/${w.FORGOT_PASSWORD}${d?window.location.search:""}`,children:a.FORGOT_PASSWORD_LINK})]}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"current-password",className:t?.input,placeholder:a.PASSWORD_PLACEHOLDER,disabled:n,...j})}),b.jsx(fn,{className:t?.error})]})}),I&&b.jsx(Gt,{control:G.control,name:"rememberMe",render:({field:j})=>b.jsxs(qt,{className:"flex",children:[b.jsx(an,{children:b.jsx(S0,{checked:j.value,onCheckedChange:j.onChange,disabled:n})}),b.jsx(Yt,{children:a.REMEMBER_ME})]})}),b.jsx(Uc,{ref:f,localization:a,action:"/sign-in/email"}),b.jsx(Ot,{type:"submit",disabled:n,className:de("w-full",t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.SIGN_IN_ACTION})]})})}function QU({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,redirectTo:l,setIsSubmitting:u,passwordValidation:d}){const f=Xa(),{captchaRef:h,getCaptchaHeaders:g,resetCaptcha:p}=jc({localization:o}),{additionalFields:y,authClient:_,basePath:S,baseURL:w,credentials:T,localization:R,nameRequired:A,persistClient:C,redirectTo:O,signUp:I,viewPaths:L,navigate:N,toast:D,avatar:U,localizeErrors:Q,emailVerification:G}=E.useContext(Ze),W=T?.confirmPassword,j=T?.username,ne=T?.usernameRequired??!0,ie=T?.passwordValidation,P=I?.fields;o={...R,...o},d={...ie,...d};const V=E.useRef(null),[$,re]=E.useState(null),[ve,k]=E.useState(!1),Z=E.useCallback(()=>l||Do("redirectTo")||O,[l,O]),ee=E.useCallback(()=>`${w}${n||(C?`${S}/${L.CALLBACK}?redirectTo=${encodeURIComponent(Z())}`:Z())}`,[n,C,S,L,w,Z]),{onSuccess:oe,isPending:pe}=xa({redirectTo:l}),be={email:et().email({message:`${o.EMAIL} ${o.IS_INVALID}`}),password:vc(d,o),name:P?.includes("name")&&A?et().min(1,{message:`${o.NAME} ${o.IS_REQUIRED}`}):et().optional(),image:et().optional(),username:j&&ne?et().min(1,{message:`${o.USERNAME} ${o.IS_REQUIRED}`}):et().optional(),confirmPassword:W?vc(d,{PASSWORD_REQUIRED:o.CONFIRM_PASSWORD_REQUIRED,PASSWORD_TOO_SHORT:o.PASSWORD_TOO_SHORT,PASSWORD_TOO_LONG:o.PASSWORD_TOO_LONG,INVALID_PASSWORD:o.INVALID_PASSWORD}):et().optional()},ye={};if(P)for(const me of P){if(me==="name"||me==="image")continue;const Re=y?.[me];if(!Re)continue;let Ue;Re.type==="number"?Ue=Re.required?PI(it=>it?Number(it):void 0,wx({message:`${Re.label} ${o.IS_INVALID}`})):Dm.number({message:`${Re.label} ${o.IS_INVALID}`}).optional():Re.type==="boolean"?Ue=Re.required?Dm.boolean({message:`${Re.label} ${o.IS_INVALID}`}).refine(it=>it===!0,{message:`${Re.label} ${o.IS_REQUIRED}`}):Dm.boolean({message:`${Re.label} ${o.IS_INVALID}`}).optional():Ue=Re.required?et().min(1,`${Re.label} ${o.IS_REQUIRED}`):et().optional(),ye[me]=Ue}const Se=Pn(be).extend(ye).refine(me=>W?me.password===me.confirmPassword:!0,{message:o.PASSWORDS_DO_NOT_MATCH,path:["confirmPassword"]}),Pe={email:"",password:"",...W&&{confirmPassword:""},...P?.includes("name")?{name:""}:{},...j?{username:""}:{},...P?.includes("image")&&U?{image:""}:{}};if(P)for(const me of P){if(me==="name"||me==="image")continue;const Re=y?.[me];Re&&(Pe[me]=Re.type==="boolean"?!1:"")}const ke=_a({resolver:Ea(Se),defaultValues:Pe});a=a||ke.formState.isSubmitting||pe,E.useEffect(()=>{u?.(ke.formState.isSubmitting||pe)},[ke.formState.isSubmitting,pe,u]);const Ee=async me=>{if(U){k(!0);try{const Re=await sU(me,crypto.randomUUID(),U.size,U.extension);let Ue;U.upload?Ue=await U.upload(Re):Ue=await cU(Re),Ue?(re(Ue),ke.setValue("image",Ue)):(re(null),ke.setValue("image",""))}catch(Re){console.error(Re),D({variant:"error",message:Ut({error:Re,localization:o,localizeErrors:Q})})}k(!1)}},ze=()=>{re(null),ke.setValue("image","")},Pt=()=>{var me;return(me=V.current)==null?void 0:me.click()};async function ge({email:me,password:Re,name:Ue,username:it,confirmPassword:He,image:tt,...B}){try{for(const[he,fe]of Object.entries(B)){const xe=y?.[he];if(xe?.validate&&typeof fe=="string"&&!await xe.validate(fe)){ke.setError(he,{message:`${xe.label} ${o.IS_INVALID}`});return}}const q={throw:!0,headers:await g("/sign-up/email")},Y={};it!==void 0&&(!ne&&(it===null||it===""||typeof it=="string"&&it.trim()==="")||(Y.username=it)),tt!==void 0&&(Y.image=tt);const ce=await _.signUp.email({email:me,password:Re,name:Ue||"",...Y,...B,callbackURL:ee(),fetchOptions:q});"token"in ce&&ce.token?await oe():G?.otp?N(`${S}/${L.EMAIL_VERIFICATION}?email=${encodeURIComponent(me)}`):(N(`${S}/${L.SIGN_IN}${window.location.search}`),D({variant:"success",message:o.SIGN_UP_EMAIL}))}catch(q){D({variant:"error",message:Ut({error:q,localization:o,localizeErrors:Q})}),ke.resetField("password"),ke.resetField("confirmPassword"),p()}}return b.jsx(wa,{...ke,children:b.jsxs("form",{onSubmit:ke.handleSubmit(ge),noValidate:f,className:de("grid w-full gap-6",e,t?.base),children:[P?.includes("image")&&U&&b.jsxs(b.Fragment,{children:[b.jsx("input",{ref:V,accept:"image/*",disabled:ve,hidden:!0,type:"file",onChange:me=>{var Re;const Ue=(Re=me.target.files)==null?void 0:Re.item(0);Ue&&Ee(Ue),me.target.value=""}}),b.jsx(Gt,{control:ke.control,name:"image",render:()=>b.jsxs(qt,{children:[b.jsx(Yt,{children:o.AVATAR}),b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs(zO,{children:[b.jsx(VO,{asChild:!0,children:b.jsx(Ot,{className:"size-fit rounded-full",size:"icon",variant:"ghost",type:"button",children:b.jsx(ZO,{isPending:ve,className:"size-16",user:$?{name:ke.watch("name"),email:ke.watch("email"),image:$}:null,localization:o})})}),b.jsxs(FO,{align:"start",onCloseAutoFocus:me=>me.preventDefault(),children:[b.jsxs(Ef,{onClick:Pt,disabled:ve,children:[b.jsx(dN,{}),o.UPLOAD_AVATAR]}),$&&b.jsxs(Ef,{onClick:ze,disabled:ve,variant:"destructive",children:[b.jsx(CN,{}),o.DELETE_AVATAR]})]})]}),b.jsxs(Ot,{type:"button",variant:"outline",onClick:Pt,disabled:ve,children:[ve&&b.jsx(_n,{className:"animate-spin"}),o.UPLOAD]})]}),b.jsx(fn,{})]})})]}),P?.includes("name")&&b.jsx(Gt,{control:ke.control,name:"name",render:({field:me})=>b.jsxs(qt,{children:[b.jsxs(Yt,{className:t?.label,children:[o.NAME,!A&&b.jsx("span",{className:"ml-1 text-muted-foreground",children:o.OPTIONAL_BRACKETS})]}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:"name",className:t?.input,placeholder:o.NAME_PLACEHOLDER,disabled:a,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),j&&b.jsx(Gt,{control:ke.control,name:"username",render:({field:me})=>b.jsxs(qt,{children:[b.jsxs(Yt,{className:t?.label,children:[o.USERNAME,!ne&&b.jsx("span",{className:"ml-1 text-muted-foreground",children:o.OPTIONAL_BRACKETS})]}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:"username",className:t?.input,placeholder:o.USERNAME_PLACEHOLDER,disabled:a,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:ke.control,name:"email",render:({field:me})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:"email",className:t?.input,type:"email",placeholder:o.EMAIL_PLACEHOLDER,disabled:a,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:ke.control,name:"password",render:({field:me})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:o.PASSWORD_PLACEHOLDER,disabled:a,enableToggle:!0,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),W&&b.jsx(Gt,{control:ke.control,name:"confirmPassword",render:({field:me})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.CONFIRM_PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:o.CONFIRM_PASSWORD_PLACEHOLDER,disabled:a,enableToggle:!0,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),P?.filter(me=>me!=="name"&&me!=="image").map(me=>{const Re=y?.[me];return Re?Re.type==="boolean"?b.jsx(Gt,{control:ke.control,name:me,render:({field:Ue})=>b.jsxs(qt,{className:"flex",children:[b.jsx(an,{children:b.jsx(S0,{checked:Ue.value,onCheckedChange:Ue.onChange,disabled:a})}),b.jsx(Yt,{className:t?.label,children:Re.label}),b.jsx(fn,{className:t?.error})]})},me):b.jsx(Gt,{control:ke.control,name:me,render:({field:Ue})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:Re.label}),b.jsx(an,{children:Re.type==="number"?b.jsx(Zr,{className:t?.input,type:"number",placeholder:Re.placeholder||(typeof Re.label=="string"?Re.label:""),disabled:a,...Ue,value:Ue.value}):Re.multiline?b.jsx(pU,{className:t?.input,placeholder:Re.placeholder||(typeof Re.label=="string"?Re.label:""),disabled:a,...Ue,value:Ue.value}):b.jsx(Zr,{className:t?.input,type:"text",placeholder:Re.placeholder||(typeof Re.label=="string"?Re.label:""),disabled:a,...Ue,value:Ue.value})}),b.jsx(fn,{className:t?.error})]})},me):(console.error(`Additional field ${me} not found`),null)}),b.jsx(Uc,{ref:h,localization:o,action:"/sign-up/email"}),b.jsx(Ot,{type:"submit",disabled:a,className:de("w-full",t?.button,t?.primaryButton),children:a?b.jsx(_n,{className:"animate-spin"}):o.SIGN_UP_ACTION})]})})}function XU({className:e,classNames:t,isSubmitting:n,localization:a,otpSeparators:o=0,redirectTo:l,setIsSubmitting:u}){var d;const f=Xa(),h=f?Do("totpURI"):null,g=E.useRef(!1),{authClient:p,basePath:y,hooks:{useSession:_},localization:S,twoFactor:w,viewPaths:T,toast:R,Link:A,localizeErrors:C}=E.useContext(Ze);a={...S,...a};const{onSuccess:O,isPending:I}=xa({redirectTo:l}),{data:L}=_(),N=(d=L?.user)==null?void 0:d.twoFactorEnabled,[D,U]=E.useState(w?.length===1?w[0]:null),[Q,G]=E.useState(!1),[W,j]=E.useState(0),ne=Pn({code:et().min(1,{message:`${a.ONE_TIME_PASSWORD} ${a.IS_REQUIRED}`}).min(6,{message:`${a.ONE_TIME_PASSWORD} ${a.IS_INVALID}`}),trustDevice:Cv().optional()}),ie=_a({resolver:Ea(ne),defaultValues:{code:""}});n=n||ie.formState.isSubmitting||I,E.useEffect(()=>{u?.(ie.formState.isSubmitting||I)},[ie.formState.isSubmitting,I,u]),E.useEffect(()=>{D==="otp"&&W<=0&&!g.current&&(g.current=!0,P())},[D]),E.useEffect(()=>{if(W<=0)return;const $=setTimeout(()=>{j(re=>re-1)},1e3);return()=>clearTimeout($)},[W]);const P=async()=>{if(!(Q||W>0)){try{G(!0),await p.twoFactor.sendOtp({fetchOptions:{throw:!0}}),j(60)}catch($){R({variant:"error",message:Ut({error:$,localization:a,localizeErrors:C})}),$.error.code==="INVALID_TWO_FACTOR_COOKIE"&&history.back()}g.current=!1,G(!1)}};async function V({code:$,trustDevice:re}){try{await(D==="totp"?p.twoFactor.verifyTotp:p.twoFactor.verifyOtp)({code:$,trustDevice:re,fetchOptions:{throw:!0}}),await O(),L&&!N&&R({variant:"success",message:a?.TWO_FACTOR_ENABLED})}catch(ve){R({variant:"error",message:Ut({error:ve,localization:a,localizeErrors:C})}),ie.reset()}}return b.jsx(wa,{...ie,children:b.jsxs("form",{onSubmit:ie.handleSubmit(V),className:de("grid w-full gap-6",e,t?.base),children:[w?.includes("totp")&&h&&D==="totp"&&b.jsxs("div",{className:"space-y-3",children:[b.jsx(HO,{className:t?.label,children:a.TWO_FACTOR_TOTP_LABEL}),b.jsx(Z9,{className:de("border shadow-xs",t?.qrCode),value:h})]}),D!==null&&b.jsxs(b.Fragment,{children:[b.jsx(Gt,{control:ie.control,name:"code",render:({field:$})=>b.jsxs(qt,{children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx(Yt,{className:t?.label,children:a.ONE_TIME_PASSWORD}),b.jsx(A,{className:de("text-sm hover:underline",t?.forgotPasswordLink),href:`${y}/${T.RECOVER_ACCOUNT}${f?window.location.search:""}`,children:a.FORGOT_AUTHENTICATOR})]}),b.jsx(an,{children:b.jsx(w0,{...$,maxLength:6,onChange:re=>{$.onChange(re),re.length===6&&ie.handleSubmit(V)()},containerClassName:t?.otpInputContainer,className:t?.otpInput,disabled:n,children:b.jsx(x0,{otpSeparators:o})})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:ie.control,name:"trustDevice",render:({field:$})=>b.jsxs(qt,{className:"flex",children:[b.jsx(an,{children:b.jsx(S0,{checked:$.value,onCheckedChange:$.onChange,disabled:n,className:t?.checkbox})}),b.jsx(Yt,{className:t?.label,children:a.TRUST_DEVICE})]})})]}),b.jsxs("div",{className:"grid gap-4",children:[D!==null&&b.jsxs(Ot,{type:"submit",disabled:n,className:de(t?.button,t?.primaryButton),children:[n&&b.jsx(_n,{className:"animate-spin"}),a.TWO_FACTOR_ACTION]}),D==="otp"&&w?.includes("otp")&&b.jsxs(Ot,{type:"button",variant:"outline",onClick:P,disabled:W>0||Q||n,className:de(t?.button,t?.outlineButton),children:[Q?b.jsx(_n,{className:"animate-spin"}):b.jsx(UE,{className:t?.icon}),a.RESEND_CODE,W>0&&` (${W})`]}),D!=="otp"&&w?.includes("otp")&&b.jsxs(Ot,{type:"button",variant:"secondary",className:de(t?.button,t?.secondaryButton),onClick:()=>U("otp"),disabled:n,children:[b.jsx(UE,{className:t?.icon}),a.SEND_VERIFICATION_CODE]}),D!=="totp"&&w?.includes("totp")&&b.jsxs(Ot,{type:"button",variant:"secondary",className:de(t?.button,t?.secondaryButton),onClick:()=>U("totp"),disabled:n,children:[b.jsx(ON,{className:t?.icon}),a.CONTINUE_WITH_AUTHENTICATOR]})]})]})})}function XO({redirectTo:e}){const t=E.useRef(!1),{authClient:n,basePath:a,viewPaths:o}=E.useContext(Ze),{onSuccess:l}=xa({redirectTo:e||`${a}/${o.SIGN_IN}`});return E.useEffect(()=>{t.current||(t.current=!0,n.signOut().finally(l))},[n,l]),b.jsx(_n,{className:"animate-spin"})}function JU({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,pathname:l,redirectTo:u,view:d,otpSeparators:f=0,setIsSubmitting:h}){const{basePath:g,credentials:p,localization:y,magicLink:_,emailOTP:S,signUp:w,twoFactor:T,viewPaths:R,replace:A}=E.useContext(Ze),C=!!w;if(o={...y,...o},E.useEffect(()=>{l&&!Lg(R,l)&&(console.error(`Invalid auth view: ${l}`),A(`${g}/${R.SIGN_IN}${window.location.search}`))},[l,R,g,A]),d=d||Lg(R,l)||"SIGN_IN",E.useEffect(()=>{let O=!1;d==="MAGIC_LINK"&&(!_||!p&&!S)&&(O=!0),d==="EMAIL_OTP"&&(!S||!p&&!_)&&(O=!0),d==="SIGN_UP"&&!C&&(O=!0),!p&&["SIGN_UP","FORGOT_PASSWORD","RESET_PASSWORD","TWO_FACTOR","RECOVER_ACCOUNT"].includes(d)&&(O=!0),["TWO_FACTOR","RECOVER_ACCOUNT"].includes(d)&&!T&&(O=!0),O&&A(`${g}/${R.SIGN_IN}${window.location.search}`)},[g,d,R,p,A,S,C,_,T]),d==="SIGN_OUT")return b.jsx(XO,{redirectTo:u});if(d==="CALLBACK")return b.jsx(QO,{redirectTo:u});if(d==="SIGN_IN")return p?b.jsx(ZU,{className:e,classNames:t,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h}):_?b.jsx(lw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h}):S?b.jsx(sw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h}):null;if(d==="TWO_FACTOR")return b.jsx(XU,{className:e,classNames:t,localization:o,otpSeparators:f,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="RECOVER_ACCOUNT")return b.jsx(KU,{className:e,classNames:t,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="MAGIC_LINK")return b.jsx(lw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="EMAIL_OTP")return b.jsx(sw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="EMAIL_VERIFICATION")return b.jsx(qU,{className:e,classNames:t,callbackURL:n,localization:o,otpSeparators:f,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="FORGOT_PASSWORD")return b.jsx(YU,{className:e,classNames:t,localization:o,isSubmitting:a,setIsSubmitting:h});if(d==="RESET_PASSWORD")return b.jsx(WU,{className:e,classNames:t,localization:o});if(d==="SIGN_UP")return C&&b.jsx(QU,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h})}function eB({className:e,classNames:t,localization:n}){const{localization:a,redirectTo:o,replace:l,toast:u}=E.useContext(Ze),d=E.useMemo(()=>({...a,...n}),[a,n]),{data:f}=tU(),[h,g]=E.useState(null);return E.useEffect(()=>{const p=Do("invitationId");if(!p){u({variant:"error",message:d.INVITATION_NOT_FOUND}),l(o);return}g(p)},[d.INVITATION_NOT_FOUND,u,l,o]),!f||!h?b.jsx(JO,{className:e,classNames:t}):b.jsx(tB,{className:e,classNames:t,localization:d,invitationId:h})}function tB({className:e,classNames:t,localization:n,invitationId:a}){var o;const{authClient:l,hooks:{useInvitation:u},localization:d,organization:f,redirectTo:h,replace:g,toast:p,localizeErrors:y}=E.useContext(Ze),_=E.useMemo(()=>({...d,...n}),[d,n]),[S,w]=E.useState(!1),[T,R]=E.useState(!1),A=S||T,{data:C,isPending:O}=u({query:{id:a}}),I=E.useCallback(()=>Do("redirectTo")||h,[h]);E.useEffect(()=>{if(!(O||!a)){if(!C){p({variant:"error",message:_.INVITATION_NOT_FOUND}),g(h);return}(C.status!=="pending"||new Date(C.expiresAt)<new Date)&&(p({variant:"error",message:new Date(C.expiresAt)<new Date?_.INVITATION_EXPIRED:_.INVITATION_NOT_FOUND}),g(h))}},[C,O,a,_,p,g,h]);const L=async()=>{R(!0);try{await l.organization.acceptInvitation({invitationId:a,fetchOptions:{throw:!0}}),p({variant:"success",message:_.INVITATION_ACCEPTED||"Invitation accepted"}),g(I())}catch(G){p({variant:"error",message:Ut({error:G,localization:_,localizeErrors:y})}),R(!1)}},N=async()=>{w(!0);try{await l.organization.rejectInvitation({invitationId:a,fetchOptions:{throw:!0}}),p({variant:"success",message:_.INVITATION_REJECTED}),g(h)}catch(G){p({variant:"error",message:Ut({error:G,localization:_,localizeErrors:y})}),w(!1)}},Q=((o=[...[{role:"owner",label:_.OWNER},{role:"admin",label:_.ADMIN},{role:"member",label:_.MEMBER}],...f?.customRoles||[]].find(G=>G.role===C?.role))==null?void 0:o.label)||C?.role;return C?b.jsxs(Io,{className:de("w-full max-w-sm",e,t?.base),children:[b.jsxs($f,{className:de("justify-items-center text-center",t?.header),children:[b.jsx(_0,{className:de("text-lg md:text-xl",t?.title),children:_.ACCEPT_INVITATION}),b.jsx(Gf,{className:de("text-xs md:text-sm",t?.description),children:_.ACCEPT_INVITATION_DESCRIPTION})]}),b.jsxs(qf,{className:de("flex flex-col gap-6 truncate",t?.content),children:[b.jsxs(Io,{className:de("flex-row items-center p-4"),children:[b.jsx(WO,{organization:{id:C.organizationId,name:C.organizationName,slug:C.organizationSlug,logo:C.organizationLogo,createdAt:new Date},localization:_}),b.jsx("p",{className:"ml-auto text-muted-foreground text-sm",children:Q})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs(Ot,{variant:"outline",className:de(t?.button,t?.outlineButton),onClick:N,disabled:A,children:[S?b.jsx(_n,{className:"animate-spin"}):b.jsx(Mx,{}),_.REJECT]}),b.jsxs(Ot,{className:de(t?.button,t?.primaryButton),onClick:L,disabled:A,children:[T?b.jsx(_n,{className:"animate-spin"}):b.jsx(Dv,{}),_.ACCEPT]})]})]})]}):b.jsx(JO,{className:e,classNames:t})}var JO=({className:e,classNames:t,localization:n})=>b.jsxs(Io,{className:de("w-full max-w-sm",e,t?.base),children:[b.jsxs($f,{className:de("justify-items-center",t?.header),children:[b.jsx(vr,{className:de("my-1 h-5 w-full max-w-32 md:h-5.5 md:w-40",t?.skeleton)}),b.jsx(vr,{className:de("my-0.5 h-3 w-full max-w-56 md:h-3.5 md:w-64",t?.skeleton)})]}),b.jsxs(qf,{className:de("flex flex-col gap-6 truncate",t?.content),children:[b.jsxs(Io,{className:de("flex-row items-center p-4"),children:[b.jsx(WO,{isPending:!0,localization:n}),b.jsx(vr,{className:"mt-0.5 ml-auto h-4 w-full max-w-14 shrink-2"})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsx(vr,{className:"h-9 w-full"}),b.jsx(vr,{className:"h-9 w-full"})]})]})]});function cw({className:e,orientation:t="horizontal",decorative:n=!0,...a}){return b.jsx(eU,{"data-slot":"separator",decorative:n,orientation:t,className:de("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...a})}function nB({classNames:e,isSubmitting:t,localization:n,view:a}){var o,l,u,d;const{viewPaths:f,navigate:h,basePath:g}=E.useContext(Ze);return b.jsxs(Ot,{className:de("w-full",(o=e?.form)==null?void 0:o.button,(l=e?.form)==null?void 0:l.secondaryButton),disabled:t,type:"button",variant:"secondary",onClick:()=>h(`${g}/${a==="EMAIL_OTP"?f.SIGN_IN:f.EMAIL_OTP}${window.location.search}`),children:[a==="EMAIL_OTP"?b.jsx(Ax,{className:(u=e?.form)==null?void 0:u.icon}):b.jsx(Cx,{className:(d=e?.form)==null?void 0:d.icon}),n.SIGN_IN_WITH," ",a==="EMAIL_OTP"?n.PASSWORD:n.EMAIL_OTP]})}function rB({classNames:e,isSubmitting:t,localization:n,view:a}){var o,l,u,d;const{viewPaths:f,navigate:h,basePath:g,credentials:p}=E.useContext(Ze);return b.jsxs(Ot,{className:de("w-full",(o=e?.form)==null?void 0:o.button,(l=e?.form)==null?void 0:l.secondaryButton),disabled:t,type:"button",variant:"secondary",onClick:()=>h(`${g}/${a==="MAGIC_LINK"||!p?f.SIGN_IN:f.MAGIC_LINK}${window.location.search}`),children:[a==="MAGIC_LINK"?b.jsx(Ax,{className:(u=e?.form)==null?void 0:u.icon}):b.jsx(Cx,{className:(d=e?.form)==null?void 0:d.icon}),n.SIGN_IN_WITH," ",a==="MAGIC_LINK"?n.PASSWORD:n.MAGIC_LINK]})}function aB({localization:e,redirectTo:t}){const{authClient:n,localization:a,toast:o,localizeErrors:l}=E.useContext(Ze),u=E.useRef(!1);e=E.useMemo(()=>({...a,...e}),[a,e]);const{onSuccess:d}=xa({redirectTo:t});return E.useEffect(()=>{if(!u.current){u.current=!0;try{n.oneTap({fetchOptions:{throw:!0,onSuccess:d}})}catch(f){o({variant:"error",message:Ut({error:f,localization:e,localizeErrors:l})})}}},[n,e,l,d,o]),null}function iB({classNames:e,isSubmitting:t,localization:n,redirectTo:a,setIsSubmitting:o}){var l,u;const{authClient:d,localization:f,toast:h,localizeErrors:g}=E.useContext(Ze);n={...f,...n};const{onSuccess:p}=xa({redirectTo:a}),y=async()=>{o?.(!0);try{const _=await d.signIn.passkey({fetchOptions:{throw:!0}});_?.error?(h({variant:"error",message:Ut({error:_.error,localization:n,localizeErrors:g})}),o?.(!1)):p()}catch(_){h({variant:"error",message:Ut({error:_,localization:n,localizeErrors:g})}),o?.(!1)}};return b.jsxs(Ot,{className:de("w-full",(l=e?.form)==null?void 0:l.button,(u=e?.form)==null?void 0:u.secondaryButton),disabled:t,formNoValidate:!0,name:"passkey",value:"true",variant:"secondary",onClick:y,children:[b.jsx(bN,{}),n.SIGN_IN_WITH," ",n.PASSKEY]})}function uw({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,other:l,provider:u,redirectTo:d,socialLayout:f,setIsSubmitting:h}){var g,p,y,_;const{authClient:S,basePath:w,baseURL:T,persistClient:R,redirectTo:A,viewPaths:C,social:O,genericOAuth:I,toast:L,localizeErrors:N}=E.useContext(Ze),D=E.useCallback(()=>d||Do("redirectTo")||A,[d,A]),U=E.useCallback(()=>`${T}${n||(R?`${w}/${C.CALLBACK}?redirectTo=${encodeURIComponent(D())}`:D())}`,[n,R,w,C,T,D]),Q=async()=>{h(!0);try{if(l){const G={providerId:u.provider,callbackURL:U(),fetchOptions:{throw:!0}};I?.signIn?(await I.signIn(G),setTimeout(()=>{h(!1)},1e4)):await S.signIn.oauth2(G)}else{const G={provider:u.provider,callbackURL:U(),fetchOptions:{throw:!0}};O?.signIn?(await O.signIn(G),setTimeout(()=>{h(!1)},1e4)):await S.signIn.social(G)}}catch(G){L({variant:"error",message:Ut({error:G,localization:o,localizeErrors:N})}),h(!1)}};return b.jsxs(Ot,{className:de(f==="vertical"?"w-full":"grow",e,(g=t?.form)==null?void 0:g.button,(p=t?.form)==null?void 0:p.outlineButton,(y=t?.form)==null?void 0:y.providerButton),disabled:a,variant:"outline",onClick:Q,children:[u.icon&&b.jsx(u.icon,{className:(_=t?.form)==null?void 0:_.icon}),f==="grid"&&u.name,f==="vertical"&&`${o.SIGN_IN_WITH} ${u.name}`]})}function Lz({className:e,classNames:t,callbackURL:n,cardHeader:a,cardFooter:o,localization:l,path:u,pathname:d,redirectTo:f,socialLayout:h="auto",view:g,otpSeparators:p=0}){var y,_,S,w,T,R;const A=Xa(),{basePath:C,credentials:O,localization:I,magicLink:L,emailOTP:N,oneTap:D,passkey:U,signUp:Q,social:G,genericOAuth:W,viewPaths:j,Link:ne}=E.useContext(Ze);l={...I,...l};let ie=h;ie==="auto"&&(ie=O&&G?.providers&&G.providers.length>2?"horizontal":"vertical");const P=u??d?.split("/").pop(),V=g||Lg(j,P)||"SIGN_IN",[$,re]=E.useState(!1);if(E.useEffect(()=>{const k=()=>re(!1);return window.addEventListener("pagehide",k),()=>{re(!1),window.removeEventListener("pagehide",k)}},[]),V==="CALLBACK")return b.jsx(QO,{redirectTo:f});if(V==="SIGN_OUT")return b.jsx(XO,{redirectTo:f});if(V==="ACCEPT_INVITATION")return b.jsx(eB,{className:e,classNames:t});const ve=!O&&!L&&!N?l.DISABLED_CREDENTIALS_DESCRIPTION:l[`${V}_DESCRIPTION`];return b.jsxs(Io,{className:de("w-full max-w-sm",e,t?.base),children:[b.jsx($f,{className:t?.header,children:a||b.jsxs(b.Fragment,{children:[b.jsx(_0,{className:de("text-lg md:text-xl",t?.title),children:l[V]}),ve&&b.jsx(Gf,{className:de("text-xs md:text-sm",t?.description),children:ve})]})}),b.jsxs(qf,{className:de("grid gap-6",t?.content),children:[D&&["SIGN_IN","SIGN_UP","MAGIC_LINK","EMAIL_OTP"].includes(V)&&b.jsx(aB,{localization:l,redirectTo:f}),(O||L||N)&&b.jsxs("div",{className:"grid gap-4",children:[b.jsx(JU,{classNames:t?.form,callbackURL:n,isSubmitting:$,localization:l,otpSeparators:p,view:V,redirectTo:f,setIsSubmitting:re}),L&&(O&&["FORGOT_PASSWORD","SIGN_UP","SIGN_IN","MAGIC_LINK","EMAIL_OTP"].includes(V)||N&&V==="EMAIL_OTP")&&b.jsx(rB,{classNames:t,localization:l,view:V,isSubmitting:$}),N&&(O&&["FORGOT_PASSWORD","SIGN_UP","SIGN_IN","MAGIC_LINK","EMAIL_OTP"].includes(V)||L&&["SIGN_IN","MAGIC_LINK"].includes(V))&&b.jsx(nB,{classNames:t,localization:l,view:V,isSubmitting:$})]}),V!=="RESET_PASSWORD"&&V!=="EMAIL_VERIFICATION"&&(((y=G?.providers)==null?void 0:y.length)||((_=W?.providers)==null?void 0:_.length)||V==="SIGN_IN"&&U)&&b.jsxs(b.Fragment,{children:[(O||L||N)&&b.jsxs("div",{className:de("flex items-center gap-2",t?.continueWith),children:[b.jsx(cw,{className:de("!w-auto grow",t?.separator)}),b.jsx("span",{className:"flex-shrink-0 text-muted-foreground text-sm",children:l.OR_CONTINUE_WITH}),b.jsx(cw,{className:de("!w-auto grow",t?.separator)})]}),b.jsxs("div",{className:"grid gap-4",children:[(((S=G?.providers)==null?void 0:S.length)||((w=W?.providers)==null?void 0:w.length))&&b.jsxs("div",{className:de("flex w-full items-center justify-between gap-4",ie==="horizontal"&&"flex-wrap",ie==="vertical"&&"flex-col",ie==="grid"&&"grid grid-cols-2"),children:[(T=G?.providers)==null?void 0:T.map(k=>{const Z=UU.find(ee=>ee.provider===k);return Z?b.jsx(uw,{classNames:t,callbackURL:n,isSubmitting:$,localization:l,provider:Z,redirectTo:f,setIsSubmitting:re,socialLayout:ie},k):null}),(R=W?.providers)==null?void 0:R.map(k=>b.jsx(uw,{classNames:t,callbackURL:n,isSubmitting:$,localization:l,provider:k,redirectTo:f,setIsSubmitting:re,socialLayout:ie,other:!0},k.provider))]}),U&&["SIGN_IN","MAGIC_LINK","EMAIL_OTP","RECOVER_ACCOUNT","TWO_FACTOR","FORGOT_PASSWORD"].includes(V)&&b.jsx(iB,{classNames:t,isSubmitting:$,localization:l,redirectTo:f,setIsSubmitting:re})]})]})]}),o&&b.jsx(lv,{className:t?.footer,children:o}),O&&Q&&b.jsxs(lv,{className:de("justify-center gap-1.5 text-muted-foreground text-sm",t?.footer),children:[V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"?l.DONT_HAVE_AN_ACCOUNT:V==="SIGN_UP"?l.ALREADY_HAVE_AN_ACCOUNT:b.jsx(oN,{className:"size-3"}),V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"||V==="SIGN_UP"?b.jsx(ne,{className:de("text-foreground underline",t?.footerLink),href:`${C}/${j[V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"?"SIGN_UP":"SIGN_IN"]}${A?window.location.search:""}`,children:b.jsx(Ot,{variant:"link",size:"sm",className:de("px-0 text-foreground underline",t?.footerLink),children:V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"?l.SIGN_UP:l.SIGN_IN})}):b.jsx(Ot,{variant:"link",size:"sm",className:de("px-0 text-foreground underline",t?.footerLink),onClick:()=>window.history.back(),children:l.GO_BACK})]})]})}function Pz({children:e}){const{hooks:{useSession:t}}=E.useContext(Ze),{isPending:n}=t();return n?e:null}function kz({children:e}){const{hooks:{useSession:t}}=E.useContext(Ze),{data:n}=t();return n?e:null}function jz({children:e}){const{hooks:{useSession:t}}=E.useContext(Ze),{data:n,isPending:a}=t();return!n&&!a?e:null}function oB(e){const t=Sf.c(8),{children:n}=e,a=Oc();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={basePath:"/",pathMode:"slug"},t[0]=o):o=t[0];let l,u;t[1]!==a?(l=f=>a({to:f}),u=f=>a({to:f,replace:!0}),t[1]=a,t[2]=l,t[3]=u):(l=t[2],u=t[3]);let d;return t[4]!==n||t[5]!==l||t[6]!==u?(d=b.jsx(J6,{authClient:_M,organization:o,navigate:l,replace:u,Link:sB,children:n}),t[4]=n,t[5]=l,t[6]=u,t[7]=d):d=t[7],d}function sB(e){const{href:t,className:n,children:a,...o}=e;return b.jsx(xv,{to:t,className:n,...o,children:a})}const lB=new KC;function cB(e){const t=Sf.c(3),{children:n}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=b.jsx(C6,{}),t[0]=a):a=t[0];let o;return t[1]!==n?(o=b.jsxs(ZC,{client:lB,children:[a,b.jsx(f4,{children:b.jsx(oB,{children:n})})]}),t[1]=n,t[2]=o):o=t[2],o}const uB=function(){return null};function dB(){const e=Sf.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=b.jsx("div",{className:"flex items-center justify-center min-h-screen",children:b.jsx("div",{className:"text-gray-500",children:"Loading..."})}),e[0]=t):t=e[0],t}const Bc=P3({component:()=>b.jsxs(cB,{children:[b.jsx(E.Suspense,{fallback:b.jsx(dB,{}),children:b.jsx($w,{})}),b.jsx(uB,{})]})}),fB=An({getParentRoute:()=>Bc,path:"/login",component:Ln(()=>Dn(()=>import("./login-BBdlWaUa.js"),__vite__mapDeps([0,1,2,3]))),validateSearch:Ks(()=>Pn({next:et().optional(),client_id:et().optional(),redirect_uri:et().optional(),response_type:et().optional(),state:et().optional(),scope:et().optional(),code_challenge:et().optional(),code_challenge_method:et().optional()}))}),hB=An({getParentRoute:()=>Bc,path:"/auth/$pathname",component:Ln(()=>Dn(()=>import("./auth-catchall-CcVurtOz.js"),[]))}),Br=An({getParentRoute:()=>Bc,id:"shell",component:Ln(()=>Dn(()=>import("./shell-layout-CE6a48bs.js"),__vite__mapDeps([4,5,2,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,3,25,26,27,28])))}),pB=An({getParentRoute:()=>Br,path:"/",component:Ln(()=>Dn(()=>import("./home-MLX9b5zd.js"),__vite__mapDeps([29,18,2,27,7,1,3,22,23,24,25])))}),mB=An({getParentRoute:()=>Br,path:"/$org",component:Ln(()=>Dn(()=>import("./page-BR8BRWlW.js"),__vite__mapDeps([30,6,2,7,8,1,31,32,28,33,19,34,9,35,36,37,38])))}),gB=An({getParentRoute:()=>Br,path:"/$org/members",component:Ln(()=>Dn(()=>import("./members-D_0pxXiL.js"),__vite__mapDeps([39,31,32,1,2,28,8,7,33,40,3,41,42,6,43,14,44,45,13,27,37,23,20,46,5,19,24,16,18])))}),vB=An({getParentRoute:()=>Br,path:"/$org/mcps",component:Ln(()=>Dn(()=>import("./connections-B3SNLZTA.js"),__vite__mapDeps([47,48,31,32,1,2,28,8,7,33,40,3,41,17,18,6,5,19,49,15,23,37,20,24,14,16,50]))),validateSearch:Ks(()=>Pn({action:Mv(["create"]).optional()}))}),yB=An({getParentRoute:()=>Br,path:"/$org/settings",component:Ln(()=>Dn(()=>import("./settings-DCv43rTD.js"),__vite__mapDeps([51,31,32,1,2,28,8,7,33,24,3,52])))}),bB=An({getParentRoute:()=>Br,path:"/$org/monitoring",component:Ln(()=>Dn(()=>import("./monitoring-dAXFetG3.js"),__vite__mapDeps([53,6,2,7,8,1,31,32,28,33,40,3,5,19,35,36,37,9,44,34,43,14,54,26]))),validateSearch:Ks(()=>Pn({from:et().default("now-24h"),to:et().default("now"),connectionId:CE(et()).optional().default([]),gatewayId:CE(et()).optional().default([]),tool:et().default(""),status:Mv(["all","success","errors"]).default("all"),search:et().default(""),page:wx().optional(),streaming:Cv().default(!0)}))}),eT=An({getParentRoute:()=>Br,path:"/$org/store",component:Ln(()=>Dn(()=>import("./store-w0RourHd.js"),__vite__mapDeps([55,45,31,32,1,2,28,8,7,6,56,40,3,18,57,58,14,17,5,10,11,12,13])))}),_B=An({getParentRoute:()=>eT,path:"/$appName",component:Ln(()=>Dn(()=>import("./store-app-detail-Boq9PC3_.js"),__vite__mapDeps([59,7,2,1,6,8,28,5,60,13,57,32,40,3,41,18,61,37,62,10,11,34,63,64,50,56,58]))),validateSearch:Ks(()=>Pn({registryId:et().optional(),serverName:et().optional(),itemId:et().optional()}))}),EB=An({getParentRoute:()=>Br,path:"/$org/mcps/$connectionId",component:Ln(()=>Dn(()=>import("./connection-detail-8UBUICjc.js"),__vite__mapDeps([65,5,2,19,1,6,7,8,10,11,66,67,21,34,61,24,3,14,9,68,64,57,50,36,54,48,60,13,32,28,40,41,18,37,62,49,15,23]))),validateSearch:Ks(()=>Pn({tab:et().optional()}))}),SB=An({getParentRoute:()=>Br,path:"/$org/mcps/$connectionId/$collectionName/$itemId",component:Ln(()=>Dn(()=>import("./collection-detail-BEA961Ga.js"),__vite__mapDeps([69,6,2,7,8,1,42,43,14,40,3,37,25,16,66,67,11,21,5,19,10,34,61,24,9,68,64,57,50,36,54,48,52,63,13,70])))}),wB=An({getParentRoute:()=>Br,path:"/$org/gateways",component:Ln(()=>Dn(()=>import("./gateways-BMuRXxz2.js"),__vite__mapDeps([71,31,32,1,2,28,8,7,33,40,3,41,17,18,6,5,19,9,49,15,23,37]))),validateSearch:Ks(()=>Pn({action:Mv(["create"]).optional()}))}),xB=An({getParentRoute:()=>Br,path:"/$org/gateways/$gatewayId",component:Ln(()=>Dn(()=>import("./gateway-detail-ho3nacsQ.js"),__vite__mapDeps([72,5,2,19,1,6,7,8,42,43,14,40,3,9,46,24,56,61,68])))}),RB=An({getParentRoute:()=>Bc,path:"/oauth/callback",component:Ln(()=>Dn(()=>import("./oauth-callback-VTrUtdoZ.js"),__vite__mapDeps([73,18,2,7,67,11,70])))}),OB=eT.addChildren([_B]),TB=Br.addChildren([pB,mB,gB,vB,wB,xB,bB,OB,yB,EB,SB]),AB=Bc.addChildren([TB,fB,hB,RB]),CB=$3({routeTree:AB}),MB=document.getElementById("root");wC.createRoot(MB).render(b.jsx(E.StrictMode,{children:b.jsx(Y3,{router:CB})}));export{$x as $,Lz as A,yz as B,sz as C,JB as D,QB as E,az as F,oz as G,Wx as H,bz as I,_z as J,fD as K,gD as L,pD as M,kB as N,dz as O,fz as P,cz as Q,uz as R,dB as S,hz as T,pz as U,qx as V,Ws as W,No as X,Nz as Y,Fe as Z,vD as _,_M as a,yP as a$,Xr as a0,WC as a1,u4 as a2,c4 as a3,Dn as a4,Oc as a5,NE as a6,eU as a7,GL as a8,ZL as a9,AR as aA,CP as aB,PB as aC,ox as aD,CE as aE,YB as aF,Cv as aG,ik as aH,ok as aI,ak as aJ,qL as aK,Mx as aL,hn as aM,Ja as aN,Qr as aO,HR as aP,XR as aQ,Ui as aR,gP as aS,Gv as aT,uR as aU,qv as aV,bc as aW,tR as aX,$v as aY,Hv as aZ,vP as a_,Oz as aa,WL as ab,YL as ac,Tz as ad,KL as ae,oD as af,Hx as ag,Ze as ah,bU as ai,Dz as aj,Pz as ak,kz as al,jz as am,cv as an,$w as ao,Pn as ap,et as aq,Ea as ar,_a as as,Cc as at,Bt as au,Ke as av,F as aw,Lo as ax,e2 as ay,MP as az,wv as b,Az as b$,IB as b0,Bw as b1,Tf as b2,$i as b3,Ka as b4,VC as b5,j_ as b6,DB as b7,NB as b8,l4 as b9,TR as bA,Mv as bB,FB as bC,Pc as bD,Ac as bE,KB as bF,zB as bG,VB as bH,$B as bI,wx as bJ,HB as bK,qB as bL,Ks as bM,UB as bN,BB as bO,jB as bP,xz as bQ,Rz as bR,wz as bS,F7 as bT,H7 as bU,$7 as bV,G7 as bW,q7 as bX,Cz as bY,Mz as bZ,Iz as b_,a4 as ba,er as bb,oN as bc,tr as bd,Cn as be,Rc as bf,Tn as bg,vg as bh,hw as bi,QC as bj,e4 as bk,i4 as bl,t4 as bm,n4 as bn,Xn as bo,s4 as bp,U_ as bq,o4 as br,r4 as bs,xv as bt,lI as bu,Z2 as bv,X2 as bw,W7 as bx,Ek as by,VR as bz,Sf as c,PN as c0,UN as c1,Cf as c2,Bv as c3,fc as c4,GC as c5,LC as c6,_n as c7,WB as c8,GB as c9,_e as ca,ZB as cb,Sv as d,iz as e,ez as f,vz as g,lz as h,tz as i,b as j,dD as k,If as l,Mf as m,XB as n,lD as o,gz as p,rz as q,E as r,uD as s,nS as t,LB as u,nz as v,Gx as w,Ez as x,Sz as y,mz as z};
118
+ `}),b.jsx(A9,{ref:e,sitekey:t.siteKey,theme:n,hl:a,size:t.provider==="google-recaptcha-v2-invisible"?"invisible":"normal",className:de(t.provider==="google-recaptcha-v2-invisible"?"absolute":"mx-auto h-[76px] w-[302px] overflow-hidden rounded bg-muted")},`${n}-${a}-${t.provider}`)]}):null}var HU=["/sign-up/email","/sign-in/email","/forget-password"];function Uc({ref:e,localization:t,action:n}){const{captcha:a}=E.useContext(Ze);if(!a||n&&!(a.endpoints||HU).includes(n))return null;const{theme:o}=Nv(),l=a.provider==="google-recaptcha-v2-checkbox"||a.provider==="google-recaptcha-v2-invisible",u=a.provider==="google-recaptcha-v3"||a.provider==="google-recaptcha-v2-invisible",d=a.provider==="cloudflare-turnstile",f=a.provider==="hcaptcha",h=a.provider==="captchafox";return b.jsxs(b.Fragment,{children:[l&&b.jsx(FU,{ref:e}),u&&b.jsx(VU,{localization:t}),d&&b.jsx(CO,{className:"mx-auto",ref:e,siteKey:a.siteKey,options:{theme:o,size:"flexible"}}),f&&b.jsx("div",{className:"mx-auto",children:b.jsx(t9,{ref:e,sitekey:a.siteKey,theme:o})}),h&&b.jsx("div",{className:"mx-auto",children:b.jsx(bO,{ref:e,sitekey:a.siteKey,theme:o})})]})}function w0({className:e,containerClassName:t,...n}){return b.jsx(LO,{"data-slot":"input-otp",containerClassName:de("flex items-center gap-2 has-disabled:opacity-50",t),className:de("disabled:cursor-not-allowed",e),...n})}function Cs({className:e,...t}){return b.jsx("div",{"data-slot":"input-otp-group",className:de("flex items-center",e),...t})}function gn({index:e,className:t,...n}){const a=E.useContext(DO),{char:o,hasFakeCaret:l,isActive:u}=a?.slots[e]??{};return b.jsxs("div",{"data-slot":"input-otp-slot","data-active":u,className:de("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",t),...n,children:[o,l&&b.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:b.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function mg({...e}){return b.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...e,children:b.jsx(xN,{})})}function x0({otpSeparators:e=0}){return e===0?b.jsxs(Cs,{children:[b.jsx(gn,{index:0}),b.jsx(gn,{index:1}),b.jsx(gn,{index:2}),b.jsx(gn,{index:3}),b.jsx(gn,{index:4}),b.jsx(gn,{index:5})]}):e===1?b.jsxs(b.Fragment,{children:[b.jsxs(Cs,{children:[b.jsx(gn,{index:0}),b.jsx(gn,{index:1}),b.jsx(gn,{index:2})]}),b.jsx(mg,{}),b.jsxs(Cs,{children:[b.jsx(gn,{index:3}),b.jsx(gn,{index:4}),b.jsx(gn,{index:5})]})]}):b.jsxs(b.Fragment,{children:[b.jsxs(Cs,{children:[b.jsx(gn,{index:0}),b.jsx(gn,{index:1})]}),b.jsx(mg,{}),b.jsxs(Cs,{children:[b.jsx(gn,{index:2}),b.jsx(gn,{index:3})]}),b.jsx(mg,{}),b.jsxs(Cs,{children:[b.jsx(gn,{index:4}),b.jsx(gn,{index:5})]})]})}function sw(e){const[t,n]=E.useState();return t?b.jsx(GU,{...e,email:t}):b.jsx($U,{...e,setEmail:n})}function $U({className:e,classNames:t,isSubmitting:n,localization:a,setIsSubmitting:o,setEmail:l}){const u=Xa(),{captchaRef:d,getCaptchaHeaders:f}=jc({localization:a}),{authClient:h,localization:g,toast:p,localizeErrors:y}=E.useContext(Ze);a={...g,...a};const _=Pn({email:et().email({message:`${a.EMAIL} ${a.IS_INVALID}`})}),S=_a({resolver:Ea(_),defaultValues:{email:""}});n=n||S.formState.isSubmitting,E.useEffect(()=>{o?.(S.formState.isSubmitting)},[S.formState.isSubmitting,o]);async function w({email:T}){const R={throw:!0,headers:await f("/email-otp/send-verification-otp")};try{await h.emailOtp.sendVerificationOtp({email:T,type:"sign-in",fetchOptions:R}),p({variant:"success",message:a.EMAIL_OTP_VERIFICATION_SENT}),l(T)}catch(A){p({variant:"error",message:Ut({error:A,localization:a,localizeErrors:y})})}}return b.jsx(wa,{...S,children:b.jsxs("form",{onSubmit:S.handleSubmit(w),noValidate:u,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:S.control,name:"email",render:({field:T})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{className:t?.input,type:"email",placeholder:a.EMAIL_PLACEHOLDER,disabled:n,...T})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Uc,{ref:d,localization:a,action:"/email-otp/send-verification-otp"}),b.jsx(Ot,{type:"submit",disabled:n,className:de("w-full",t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.EMAIL_OTP_SEND_ACTION})]})})}function GU({className:e,classNames:t,isSubmitting:n,localization:a,otpSeparators:o=0,redirectTo:l,setIsSubmitting:u,email:d}){const{authClient:f,localization:h,toast:g,localizeErrors:p}=E.useContext(Ze);a={...h,...a};const{onSuccess:y,isPending:_}=xa({redirectTo:l}),S=Pn({code:et().min(1,{message:`${a.EMAIL_OTP} ${a.IS_REQUIRED}`}).min(6,{message:`${a.EMAIL_OTP} ${a.IS_INVALID}`})}),w=_a({resolver:Ea(S),defaultValues:{code:""}});n=n||w.formState.isSubmitting||_,E.useEffect(()=>{u?.(w.formState.isSubmitting||_)},[w.formState.isSubmitting,_,u]);async function T({code:R}){try{await f.signIn.emailOtp({email:d,otp:R,fetchOptions:{throw:!0}}),await y()}catch(A){g({variant:"error",message:Ut({error:A,localization:a,localizeErrors:p})}),w.reset()}}return b.jsx(wa,{...w,children:b.jsxs("form",{onSubmit:w.handleSubmit(T),className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:w.control,name:"code",render:({field:R})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.EMAIL_OTP}),b.jsx(an,{children:b.jsx(w0,{...R,maxLength:6,onChange:A=>{R.onChange(A),A.length===6&&w.handleSubmit(T)()},containerClassName:t?.otpInputContainer,className:t?.otpInput,disabled:n,children:b.jsx(x0,{otpSeparators:o})})}),b.jsx(fn,{className:t?.error})]})}),b.jsx("div",{className:"grid gap-4",children:b.jsxs(Ot,{type:"submit",disabled:n,className:de(t?.button,t?.primaryButton),children:[n&&b.jsx(_n,{className:"animate-spin"}),a.EMAIL_OTP_VERIFY_ACTION]})})]})})}function qU({onCancel:e,localization:t,className:n,classNames:a,otpSeparators:o,callbackURL:l,isSubmitting:u,redirectTo:d,setIsSubmitting:f}){const[h,g]=E.useState(!0),[p,y]=E.useState(30),{authClient:_,localization:S,toast:w,localizeErrors:T,navigate:R,basePath:A,viewPaths:C}=E.useContext(Ze);t={...S,...t};const O=typeof window<"u"&&new URLSearchParams(window.location.search).get("email")||"",{onSuccess:I,isPending:L}=xa({redirectTo:d}),N=Pn({code:et().min(1,{message:`${t.EMAIL_OTP} ${t.IS_REQUIRED}`}).min(6,{message:`${t.EMAIL_OTP} ${t.IS_INVALID}`})}),D=_a({resolver:Ea(N),defaultValues:{code:""}}),U=u||D.formState.isSubmitting||L;E.useEffect(()=>{f?.(D.formState.isSubmitting||L)},[D.formState.isSubmitting,L,f]),E.useEffect(()=>{if(p>0){const W=setTimeout(()=>y(p-1),1e3);return()=>clearTimeout(W)}else g(!1)},[p]);async function Q({code:W}){try{const j=await _.emailOtp.verifyEmail({email:O,otp:W,fetchOptions:{throw:!0}});"token"in j&&j.token?await I():(R(`${A}/${C.SIGN_IN}${window.location.search}`),w({variant:"success",message:t.EMAIL_VERIFICATION_SUCCESS}))}catch(j){w({variant:"error",message:Ut({error:j,localization:t,localizeErrors:T})}),D.reset()}}async function G(){if(!h){g(!0),y(30);try{await _.emailOtp.sendVerificationOtp({email:O,type:"email-verification",fetchOptions:{throw:!0}}),w({variant:"success",message:t.EMAIL_OTP_VERIFICATION_SENT})}catch(W){w({variant:"error",message:Ut({error:W,localization:t,localizeErrors:T})}),g(!1),y(0)}}}return O?b.jsx(wa,{...D,children:b.jsxs("form",{onSubmit:D.handleSubmit(Q),className:de("grid w-full gap-6",n,a?.base),children:[b.jsx(Gt,{control:D.control,name:"code",render:({field:W})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:a?.label,children:t.EMAIL_OTP}),b.jsx(an,{children:b.jsx(w0,{...W,maxLength:6,onChange:j=>{W.onChange(j),j.length===6&&D.handleSubmit(Q)()},containerClassName:a?.otpInputContainer,className:a?.otpInput,disabled:U,children:b.jsx(x0,{otpSeparators:o})})}),b.jsx(fn,{className:a?.error})]})}),b.jsxs("div",{className:"grid gap-4",children:[b.jsxs(Ot,{type:"submit",disabled:U,className:de(a?.button,a?.primaryButton),children:[U&&b.jsx(_n,{className:"animate-spin"}),t.EMAIL_OTP_VERIFY_ACTION]}),b.jsx(Ot,{type:"button",variant:"outline",onClick:G,disabled:h||U,className:de("w-full",a?.button),children:h?`${t.RESEND_VERIFICATION_EMAIL} (${p}s)`:t.RESEND_VERIFICATION_EMAIL}),e&&b.jsx(Ot,{type:"button",variant:"ghost",onClick:e,disabled:U,className:"w-full",children:t.CANCEL})]})]})}):b.jsx("div",{className:de("grid w-full gap-6",n),children:b.jsxs("div",{className:"text-center",children:[b.jsx("h2",{className:"font-semibold text-destructive text-lg",children:"Invalid Request"}),b.jsx("p",{className:"text-muted-foreground text-sm",children:t.EMAIL_REQUIRED||"Email address is required"})]})})}function YU({className:e,classNames:t,isSubmitting:n,localization:a,setIsSubmitting:o}){const l=Xa(),{captchaRef:u,getCaptchaHeaders:d,resetCaptcha:f}=jc({localization:a}),{authClient:h,basePath:g,baseURL:p,localization:y,navigate:_,toast:S,viewPaths:w,localizeErrors:T}=E.useContext(Ze);a={...y,...a};const R=Pn({email:et().email({message:`${a.EMAIL} ${a.IS_INVALID}`}).min(1,{message:`${a.EMAIL} ${a.IS_REQUIRED}`})}),A=_a({resolver:Ea(R),defaultValues:{email:""}});n=n||A.formState.isSubmitting,E.useEffect(()=>{o?.(A.formState.isSubmitting)},[A.formState.isSubmitting,o]);async function C({email:O}){try{const I={throw:!0,headers:await d("/forget-password")};await h.requestPasswordReset({email:O,redirectTo:`${p}${g}/${w.RESET_PASSWORD}`,fetchOptions:I}),S({variant:"success",message:a.FORGOT_PASSWORD_EMAIL}),_(`${g}/${w.SIGN_IN}${window.location.search}`)}catch(I){S({variant:"error",message:Ut({error:I,localization:a,localizeErrors:T})}),f()}}return b.jsx(wa,{...A,children:b.jsxs("form",{onSubmit:A.handleSubmit(C),noValidate:l,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:A.control,name:"email",render:({field:O})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{className:t?.input,type:"email",placeholder:a.EMAIL_PLACEHOLDER,disabled:n,...O})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Uc,{ref:u,localization:a,action:"/forget-password"}),b.jsx(Ot,{type:"submit",disabled:n,className:de("w-full",t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.FORGOT_PASSWORD_ACTION})]})})}function lw({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,redirectTo:l,setIsSubmitting:u}){const d=Xa(),{captchaRef:f,getCaptchaHeaders:h,resetCaptcha:g}=jc({localization:o}),{authClient:p,basePath:y,baseURL:_,persistClient:S,localization:w,redirectTo:T,viewPaths:R,toast:A,localizeErrors:C}=E.useContext(Ze);o={...w,...o};const O=E.useCallback(()=>l||Do("redirectTo")||T,[l,T]),I=E.useCallback(()=>`${_}${n||(S?`${y}/${R.CALLBACK}?redirectTo=${encodeURIComponent(O())}`:O())}`,[n,S,y,R,_,O]),L=Pn({email:et().email({message:`${o.EMAIL} ${o.IS_INVALID}`})}),N=_a({resolver:Ea(L),defaultValues:{email:""}});a=a||N.formState.isSubmitting,E.useEffect(()=>{u?.(N.formState.isSubmitting)},[N.formState.isSubmitting,u]);async function D({email:U}){try{const Q={throw:!0,headers:await h("/sign-in/magic-link")};await p.signIn.magicLink({email:U,callbackURL:I(),fetchOptions:Q}),A({variant:"success",message:o.MAGIC_LINK_EMAIL}),N.reset()}catch(Q){A({variant:"error",message:Ut({error:Q,localization:o,localizeErrors:C})}),g()}}return b.jsx(wa,{...N,children:b.jsxs("form",{onSubmit:N.handleSubmit(D),noValidate:d,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:N.control,name:"email",render:({field:U})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{className:t?.input,type:"email",placeholder:o.EMAIL_PLACEHOLDER,disabled:a,...U})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Uc,{ref:f,localization:o,action:"/sign-in/magic-link"}),b.jsx(Ot,{type:"submit",disabled:a,className:de("w-full",t?.button,t?.primaryButton),children:a?b.jsx(_n,{className:"animate-spin"}):o.MAGIC_LINK_ACTION})]})})}function KU({className:e,classNames:t,isSubmitting:n,localization:a,redirectTo:o,setIsSubmitting:l}){const{authClient:u,localization:d,toast:f,localizeErrors:h}=E.useContext(Ze);a={...d,...a};const{onSuccess:g,isPending:p}=xa({redirectTo:o}),y=Pn({code:et().min(1,{message:a.BACKUP_CODE_REQUIRED})}),_=_a({resolver:Ea(y),defaultValues:{code:""}});n=n||_.formState.isSubmitting||p,E.useEffect(()=>{l?.(_.formState.isSubmitting||p)},[_.formState.isSubmitting,p,l]);async function S({code:w}){try{await u.twoFactor.verifyBackupCode({code:w,fetchOptions:{throw:!0}}),await g()}catch(T){f({variant:"error",message:Ut({error:T,localization:a,localizeErrors:h})}),_.reset()}}return b.jsx(wa,{..._,children:b.jsxs("form",{onSubmit:_.handleSubmit(S),className:de("grid gap-6",e,t?.base),children:[b.jsx(Gt,{control:_.control,name:"code",render:({field:w})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:a.BACKUP_CODE}),b.jsx(an,{children:b.jsx(Zr,{placeholder:a.BACKUP_CODE_PLACEHOLDER,autoComplete:"off",className:t?.input,disabled:n,...w})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Ot,{type:"submit",disabled:n,className:de(t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.RECOVER_ACCOUNT_ACTION})]})})}function WU({className:e,classNames:t,localization:n,passwordValidation:a}){const o=E.useRef(!1),{authClient:l,basePath:u,credentials:d,localization:f,viewPaths:h,navigate:g,toast:p,localizeErrors:y}=E.useContext(Ze),_=d?.confirmPassword,S=d?.passwordValidation;n={...f,...n},a={...S,...a};const w=Pn({newPassword:vc(a,{PASSWORD_REQUIRED:n.NEW_PASSWORD_REQUIRED,PASSWORD_TOO_SHORT:n.PASSWORD_TOO_SHORT,PASSWORD_TOO_LONG:n.PASSWORD_TOO_LONG,INVALID_PASSWORD:n.INVALID_PASSWORD}),confirmPassword:_?vc(a,{PASSWORD_REQUIRED:n.CONFIRM_PASSWORD_REQUIRED,PASSWORD_TOO_SHORT:n.PASSWORD_TOO_SHORT,PASSWORD_TOO_LONG:n.PASSWORD_TOO_LONG,INVALID_PASSWORD:n.INVALID_PASSWORD}):et().optional()}).refine(C=>!_||C.newPassword===C.confirmPassword,{message:n.PASSWORDS_DO_NOT_MATCH,path:["confirmPassword"]}),T=_a({resolver:Ea(w),defaultValues:{newPassword:"",confirmPassword:""}}),R=T.formState.isSubmitting;E.useEffect(()=>{if(o.current)return;o.current=!0;const O=new URLSearchParams(window.location.search).get("token");(!O||O==="INVALID_TOKEN")&&(g(`${u}/${h.SIGN_IN}${window.location.search}`),p({variant:"error",message:n.INVALID_TOKEN}))},[u,g,p,h,n]);async function A({newPassword:C}){try{const I=new URLSearchParams(window.location.search).get("token");await l.resetPassword({newPassword:C,token:I,fetchOptions:{throw:!0}}),p({variant:"success",message:n.RESET_PASSWORD_SUCCESS}),g(`${u}/${h.SIGN_IN}${window.location.search}`)}catch(O){p({variant:"error",message:Ut({error:O,localization:n,localizeErrors:y})}),T.reset()}}return b.jsx(wa,{...T,children:b.jsxs("form",{onSubmit:T.handleSubmit(A),className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:T.control,name:"newPassword",render:({field:C})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:n.NEW_PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:n.NEW_PASSWORD_PLACEHOLDER,disabled:R,...C})}),b.jsx(fn,{className:t?.error})]})}),_&&b.jsx(Gt,{control:T.control,name:"confirmPassword",render:({field:C})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:n.CONFIRM_PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:n.CONFIRM_PASSWORD_PLACEHOLDER,disabled:R,...C})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Ot,{type:"submit",disabled:R,className:de("w-full",t?.button,t?.primaryButton),children:R?b.jsx(_n,{className:"animate-spin"}):n.RESET_PASSWORD_ACTION})]})})}function ZU({className:e,classNames:t,isSubmitting:n,localization:a,redirectTo:o,setIsSubmitting:l,passwordValidation:u}){const d=Xa(),{captchaRef:f,getCaptchaHeaders:h,resetCaptcha:g}=jc({localization:a}),{authClient:p,basePath:y,credentials:_,localization:S,viewPaths:w,navigate:T,toast:R,Link:A,localizeErrors:C,emailVerification:O}=E.useContext(Ze),I=_?.rememberMe,L=_?.username,N=_?.passwordValidation;a={...S,...a},u={...N,...u};const{onSuccess:D,isPending:U}=xa({redirectTo:o}),Q=Pn({email:L?et().min(1,{message:`${a.USERNAME} ${a.IS_REQUIRED}`}):et().email({message:`${a.EMAIL} ${a.IS_INVALID}`}),password:vc(u,a),rememberMe:Cv().optional()}),G=_a({resolver:Ea(Q),defaultValues:{email:"",password:"",rememberMe:!I}});n=n||G.formState.isSubmitting||U,E.useEffect(()=>{l?.(G.formState.isSubmitting||U)},[G.formState.isSubmitting,U,l]);async function W({email:j,password:ne,rememberMe:ie}){var P;try{let V={};if(L&&!kI(j)){const $={throw:!0,headers:await h("/sign-in/username")};V=await p.signIn.username({username:j,password:ne,rememberMe:ie,fetchOptions:$})}else{const $={throw:!0,headers:await h("/sign-in/email")};V=await p.signIn.email({email:j,password:ne,rememberMe:ie,fetchOptions:$})}V.twoFactorRedirect?T(`${y}/${w.TWO_FACTOR}${window.location.search}`):await D()}catch(V){G.resetField("password"),g(),R({variant:"error",message:Ut({error:V,localization:a,localizeErrors:C})}),O?.otp&&((P=V?.error)==null?void 0:P.code)==="EMAIL_NOT_VERIFIED"&&T(`${y}/${w.EMAIL_VERIFICATION}?email=${encodeURIComponent(j)}`)}}return b.jsx(wa,{...G,children:b.jsxs("form",{onSubmit:G.handleSubmit(W),noValidate:d,className:de("grid w-full gap-6",e,t?.base),children:[b.jsx(Gt,{control:G.control,name:"email",render:({field:j})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:L?a.USERNAME:a.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:L?"username":"email",className:t?.input,type:L?"text":"email",placeholder:L?a.SIGN_IN_USERNAME_PLACEHOLDER:a.EMAIL_PLACEHOLDER,disabled:n,...j})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:G.control,name:"password",render:({field:j})=>b.jsxs(qt,{children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx(Yt,{className:t?.label,children:a.PASSWORD}),_?.forgotPassword&&b.jsx(A,{className:de("text-sm hover:underline",t?.forgotPasswordLink),href:`${y}/${w.FORGOT_PASSWORD}${d?window.location.search:""}`,children:a.FORGOT_PASSWORD_LINK})]}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"current-password",className:t?.input,placeholder:a.PASSWORD_PLACEHOLDER,disabled:n,...j})}),b.jsx(fn,{className:t?.error})]})}),I&&b.jsx(Gt,{control:G.control,name:"rememberMe",render:({field:j})=>b.jsxs(qt,{className:"flex",children:[b.jsx(an,{children:b.jsx(S0,{checked:j.value,onCheckedChange:j.onChange,disabled:n})}),b.jsx(Yt,{children:a.REMEMBER_ME})]})}),b.jsx(Uc,{ref:f,localization:a,action:"/sign-in/email"}),b.jsx(Ot,{type:"submit",disabled:n,className:de("w-full",t?.button,t?.primaryButton),children:n?b.jsx(_n,{className:"animate-spin"}):a.SIGN_IN_ACTION})]})})}function QU({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,redirectTo:l,setIsSubmitting:u,passwordValidation:d}){const f=Xa(),{captchaRef:h,getCaptchaHeaders:g,resetCaptcha:p}=jc({localization:o}),{additionalFields:y,authClient:_,basePath:S,baseURL:w,credentials:T,localization:R,nameRequired:A,persistClient:C,redirectTo:O,signUp:I,viewPaths:L,navigate:N,toast:D,avatar:U,localizeErrors:Q,emailVerification:G}=E.useContext(Ze),W=T?.confirmPassword,j=T?.username,ne=T?.usernameRequired??!0,ie=T?.passwordValidation,P=I?.fields;o={...R,...o},d={...ie,...d};const V=E.useRef(null),[$,re]=E.useState(null),[ve,k]=E.useState(!1),Z=E.useCallback(()=>l||Do("redirectTo")||O,[l,O]),ee=E.useCallback(()=>`${w}${n||(C?`${S}/${L.CALLBACK}?redirectTo=${encodeURIComponent(Z())}`:Z())}`,[n,C,S,L,w,Z]),{onSuccess:oe,isPending:pe}=xa({redirectTo:l}),be={email:et().email({message:`${o.EMAIL} ${o.IS_INVALID}`}),password:vc(d,o),name:P?.includes("name")&&A?et().min(1,{message:`${o.NAME} ${o.IS_REQUIRED}`}):et().optional(),image:et().optional(),username:j&&ne?et().min(1,{message:`${o.USERNAME} ${o.IS_REQUIRED}`}):et().optional(),confirmPassword:W?vc(d,{PASSWORD_REQUIRED:o.CONFIRM_PASSWORD_REQUIRED,PASSWORD_TOO_SHORT:o.PASSWORD_TOO_SHORT,PASSWORD_TOO_LONG:o.PASSWORD_TOO_LONG,INVALID_PASSWORD:o.INVALID_PASSWORD}):et().optional()},ye={};if(P)for(const me of P){if(me==="name"||me==="image")continue;const Re=y?.[me];if(!Re)continue;let Ue;Re.type==="number"?Ue=Re.required?PI(it=>it?Number(it):void 0,wx({message:`${Re.label} ${o.IS_INVALID}`})):Dm.number({message:`${Re.label} ${o.IS_INVALID}`}).optional():Re.type==="boolean"?Ue=Re.required?Dm.boolean({message:`${Re.label} ${o.IS_INVALID}`}).refine(it=>it===!0,{message:`${Re.label} ${o.IS_REQUIRED}`}):Dm.boolean({message:`${Re.label} ${o.IS_INVALID}`}).optional():Ue=Re.required?et().min(1,`${Re.label} ${o.IS_REQUIRED}`):et().optional(),ye[me]=Ue}const Se=Pn(be).extend(ye).refine(me=>W?me.password===me.confirmPassword:!0,{message:o.PASSWORDS_DO_NOT_MATCH,path:["confirmPassword"]}),Pe={email:"",password:"",...W&&{confirmPassword:""},...P?.includes("name")?{name:""}:{},...j?{username:""}:{},...P?.includes("image")&&U?{image:""}:{}};if(P)for(const me of P){if(me==="name"||me==="image")continue;const Re=y?.[me];Re&&(Pe[me]=Re.type==="boolean"?!1:"")}const ke=_a({resolver:Ea(Se),defaultValues:Pe});a=a||ke.formState.isSubmitting||pe,E.useEffect(()=>{u?.(ke.formState.isSubmitting||pe)},[ke.formState.isSubmitting,pe,u]);const Ee=async me=>{if(U){k(!0);try{const Re=await sU(me,crypto.randomUUID(),U.size,U.extension);let Ue;U.upload?Ue=await U.upload(Re):Ue=await cU(Re),Ue?(re(Ue),ke.setValue("image",Ue)):(re(null),ke.setValue("image",""))}catch(Re){console.error(Re),D({variant:"error",message:Ut({error:Re,localization:o,localizeErrors:Q})})}k(!1)}},ze=()=>{re(null),ke.setValue("image","")},Pt=()=>{var me;return(me=V.current)==null?void 0:me.click()};async function ge({email:me,password:Re,name:Ue,username:it,confirmPassword:He,image:tt,...B}){try{for(const[he,fe]of Object.entries(B)){const xe=y?.[he];if(xe?.validate&&typeof fe=="string"&&!await xe.validate(fe)){ke.setError(he,{message:`${xe.label} ${o.IS_INVALID}`});return}}const q={throw:!0,headers:await g("/sign-up/email")},Y={};it!==void 0&&(!ne&&(it===null||it===""||typeof it=="string"&&it.trim()==="")||(Y.username=it)),tt!==void 0&&(Y.image=tt);const ce=await _.signUp.email({email:me,password:Re,name:Ue||"",...Y,...B,callbackURL:ee(),fetchOptions:q});"token"in ce&&ce.token?await oe():G?.otp?N(`${S}/${L.EMAIL_VERIFICATION}?email=${encodeURIComponent(me)}`):(N(`${S}/${L.SIGN_IN}${window.location.search}`),D({variant:"success",message:o.SIGN_UP_EMAIL}))}catch(q){D({variant:"error",message:Ut({error:q,localization:o,localizeErrors:Q})}),ke.resetField("password"),ke.resetField("confirmPassword"),p()}}return b.jsx(wa,{...ke,children:b.jsxs("form",{onSubmit:ke.handleSubmit(ge),noValidate:f,className:de("grid w-full gap-6",e,t?.base),children:[P?.includes("image")&&U&&b.jsxs(b.Fragment,{children:[b.jsx("input",{ref:V,accept:"image/*",disabled:ve,hidden:!0,type:"file",onChange:me=>{var Re;const Ue=(Re=me.target.files)==null?void 0:Re.item(0);Ue&&Ee(Ue),me.target.value=""}}),b.jsx(Gt,{control:ke.control,name:"image",render:()=>b.jsxs(qt,{children:[b.jsx(Yt,{children:o.AVATAR}),b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs(zO,{children:[b.jsx(VO,{asChild:!0,children:b.jsx(Ot,{className:"size-fit rounded-full",size:"icon",variant:"ghost",type:"button",children:b.jsx(ZO,{isPending:ve,className:"size-16",user:$?{name:ke.watch("name"),email:ke.watch("email"),image:$}:null,localization:o})})}),b.jsxs(FO,{align:"start",onCloseAutoFocus:me=>me.preventDefault(),children:[b.jsxs(Ef,{onClick:Pt,disabled:ve,children:[b.jsx(dN,{}),o.UPLOAD_AVATAR]}),$&&b.jsxs(Ef,{onClick:ze,disabled:ve,variant:"destructive",children:[b.jsx(CN,{}),o.DELETE_AVATAR]})]})]}),b.jsxs(Ot,{type:"button",variant:"outline",onClick:Pt,disabled:ve,children:[ve&&b.jsx(_n,{className:"animate-spin"}),o.UPLOAD]})]}),b.jsx(fn,{})]})})]}),P?.includes("name")&&b.jsx(Gt,{control:ke.control,name:"name",render:({field:me})=>b.jsxs(qt,{children:[b.jsxs(Yt,{className:t?.label,children:[o.NAME,!A&&b.jsx("span",{className:"ml-1 text-muted-foreground",children:o.OPTIONAL_BRACKETS})]}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:"name",className:t?.input,placeholder:o.NAME_PLACEHOLDER,disabled:a,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),j&&b.jsx(Gt,{control:ke.control,name:"username",render:({field:me})=>b.jsxs(qt,{children:[b.jsxs(Yt,{className:t?.label,children:[o.USERNAME,!ne&&b.jsx("span",{className:"ml-1 text-muted-foreground",children:o.OPTIONAL_BRACKETS})]}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:"username",className:t?.input,placeholder:o.USERNAME_PLACEHOLDER,disabled:a,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:ke.control,name:"email",render:({field:me})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.EMAIL}),b.jsx(an,{children:b.jsx(Zr,{autoComplete:"email",className:t?.input,type:"email",placeholder:o.EMAIL_PLACEHOLDER,disabled:a,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:ke.control,name:"password",render:({field:me})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:o.PASSWORD_PLACEHOLDER,disabled:a,enableToggle:!0,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),W&&b.jsx(Gt,{control:ke.control,name:"confirmPassword",render:({field:me})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:o.CONFIRM_PASSWORD}),b.jsx(an,{children:b.jsx(xc,{autoComplete:"new-password",className:t?.input,placeholder:o.CONFIRM_PASSWORD_PLACEHOLDER,disabled:a,enableToggle:!0,...me,value:me.value})}),b.jsx(fn,{className:t?.error})]})}),P?.filter(me=>me!=="name"&&me!=="image").map(me=>{const Re=y?.[me];return Re?Re.type==="boolean"?b.jsx(Gt,{control:ke.control,name:me,render:({field:Ue})=>b.jsxs(qt,{className:"flex",children:[b.jsx(an,{children:b.jsx(S0,{checked:Ue.value,onCheckedChange:Ue.onChange,disabled:a})}),b.jsx(Yt,{className:t?.label,children:Re.label}),b.jsx(fn,{className:t?.error})]})},me):b.jsx(Gt,{control:ke.control,name:me,render:({field:Ue})=>b.jsxs(qt,{children:[b.jsx(Yt,{className:t?.label,children:Re.label}),b.jsx(an,{children:Re.type==="number"?b.jsx(Zr,{className:t?.input,type:"number",placeholder:Re.placeholder||(typeof Re.label=="string"?Re.label:""),disabled:a,...Ue,value:Ue.value}):Re.multiline?b.jsx(pU,{className:t?.input,placeholder:Re.placeholder||(typeof Re.label=="string"?Re.label:""),disabled:a,...Ue,value:Ue.value}):b.jsx(Zr,{className:t?.input,type:"text",placeholder:Re.placeholder||(typeof Re.label=="string"?Re.label:""),disabled:a,...Ue,value:Ue.value})}),b.jsx(fn,{className:t?.error})]})},me):(console.error(`Additional field ${me} not found`),null)}),b.jsx(Uc,{ref:h,localization:o,action:"/sign-up/email"}),b.jsx(Ot,{type:"submit",disabled:a,className:de("w-full",t?.button,t?.primaryButton),children:a?b.jsx(_n,{className:"animate-spin"}):o.SIGN_UP_ACTION})]})})}function XU({className:e,classNames:t,isSubmitting:n,localization:a,otpSeparators:o=0,redirectTo:l,setIsSubmitting:u}){var d;const f=Xa(),h=f?Do("totpURI"):null,g=E.useRef(!1),{authClient:p,basePath:y,hooks:{useSession:_},localization:S,twoFactor:w,viewPaths:T,toast:R,Link:A,localizeErrors:C}=E.useContext(Ze);a={...S,...a};const{onSuccess:O,isPending:I}=xa({redirectTo:l}),{data:L}=_(),N=(d=L?.user)==null?void 0:d.twoFactorEnabled,[D,U]=E.useState(w?.length===1?w[0]:null),[Q,G]=E.useState(!1),[W,j]=E.useState(0),ne=Pn({code:et().min(1,{message:`${a.ONE_TIME_PASSWORD} ${a.IS_REQUIRED}`}).min(6,{message:`${a.ONE_TIME_PASSWORD} ${a.IS_INVALID}`}),trustDevice:Cv().optional()}),ie=_a({resolver:Ea(ne),defaultValues:{code:""}});n=n||ie.formState.isSubmitting||I,E.useEffect(()=>{u?.(ie.formState.isSubmitting||I)},[ie.formState.isSubmitting,I,u]),E.useEffect(()=>{D==="otp"&&W<=0&&!g.current&&(g.current=!0,P())},[D]),E.useEffect(()=>{if(W<=0)return;const $=setTimeout(()=>{j(re=>re-1)},1e3);return()=>clearTimeout($)},[W]);const P=async()=>{if(!(Q||W>0)){try{G(!0),await p.twoFactor.sendOtp({fetchOptions:{throw:!0}}),j(60)}catch($){R({variant:"error",message:Ut({error:$,localization:a,localizeErrors:C})}),$.error.code==="INVALID_TWO_FACTOR_COOKIE"&&history.back()}g.current=!1,G(!1)}};async function V({code:$,trustDevice:re}){try{await(D==="totp"?p.twoFactor.verifyTotp:p.twoFactor.verifyOtp)({code:$,trustDevice:re,fetchOptions:{throw:!0}}),await O(),L&&!N&&R({variant:"success",message:a?.TWO_FACTOR_ENABLED})}catch(ve){R({variant:"error",message:Ut({error:ve,localization:a,localizeErrors:C})}),ie.reset()}}return b.jsx(wa,{...ie,children:b.jsxs("form",{onSubmit:ie.handleSubmit(V),className:de("grid w-full gap-6",e,t?.base),children:[w?.includes("totp")&&h&&D==="totp"&&b.jsxs("div",{className:"space-y-3",children:[b.jsx(HO,{className:t?.label,children:a.TWO_FACTOR_TOTP_LABEL}),b.jsx(Z9,{className:de("border shadow-xs",t?.qrCode),value:h})]}),D!==null&&b.jsxs(b.Fragment,{children:[b.jsx(Gt,{control:ie.control,name:"code",render:({field:$})=>b.jsxs(qt,{children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx(Yt,{className:t?.label,children:a.ONE_TIME_PASSWORD}),b.jsx(A,{className:de("text-sm hover:underline",t?.forgotPasswordLink),href:`${y}/${T.RECOVER_ACCOUNT}${f?window.location.search:""}`,children:a.FORGOT_AUTHENTICATOR})]}),b.jsx(an,{children:b.jsx(w0,{...$,maxLength:6,onChange:re=>{$.onChange(re),re.length===6&&ie.handleSubmit(V)()},containerClassName:t?.otpInputContainer,className:t?.otpInput,disabled:n,children:b.jsx(x0,{otpSeparators:o})})}),b.jsx(fn,{className:t?.error})]})}),b.jsx(Gt,{control:ie.control,name:"trustDevice",render:({field:$})=>b.jsxs(qt,{className:"flex",children:[b.jsx(an,{children:b.jsx(S0,{checked:$.value,onCheckedChange:$.onChange,disabled:n,className:t?.checkbox})}),b.jsx(Yt,{className:t?.label,children:a.TRUST_DEVICE})]})})]}),b.jsxs("div",{className:"grid gap-4",children:[D!==null&&b.jsxs(Ot,{type:"submit",disabled:n,className:de(t?.button,t?.primaryButton),children:[n&&b.jsx(_n,{className:"animate-spin"}),a.TWO_FACTOR_ACTION]}),D==="otp"&&w?.includes("otp")&&b.jsxs(Ot,{type:"button",variant:"outline",onClick:P,disabled:W>0||Q||n,className:de(t?.button,t?.outlineButton),children:[Q?b.jsx(_n,{className:"animate-spin"}):b.jsx(UE,{className:t?.icon}),a.RESEND_CODE,W>0&&` (${W})`]}),D!=="otp"&&w?.includes("otp")&&b.jsxs(Ot,{type:"button",variant:"secondary",className:de(t?.button,t?.secondaryButton),onClick:()=>U("otp"),disabled:n,children:[b.jsx(UE,{className:t?.icon}),a.SEND_VERIFICATION_CODE]}),D!=="totp"&&w?.includes("totp")&&b.jsxs(Ot,{type:"button",variant:"secondary",className:de(t?.button,t?.secondaryButton),onClick:()=>U("totp"),disabled:n,children:[b.jsx(ON,{className:t?.icon}),a.CONTINUE_WITH_AUTHENTICATOR]})]})]})})}function XO({redirectTo:e}){const t=E.useRef(!1),{authClient:n,basePath:a,viewPaths:o}=E.useContext(Ze),{onSuccess:l}=xa({redirectTo:e||`${a}/${o.SIGN_IN}`});return E.useEffect(()=>{t.current||(t.current=!0,n.signOut().finally(l))},[n,l]),b.jsx(_n,{className:"animate-spin"})}function JU({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,pathname:l,redirectTo:u,view:d,otpSeparators:f=0,setIsSubmitting:h}){const{basePath:g,credentials:p,localization:y,magicLink:_,emailOTP:S,signUp:w,twoFactor:T,viewPaths:R,replace:A}=E.useContext(Ze),C=!!w;if(o={...y,...o},E.useEffect(()=>{l&&!Lg(R,l)&&(console.error(`Invalid auth view: ${l}`),A(`${g}/${R.SIGN_IN}${window.location.search}`))},[l,R,g,A]),d=d||Lg(R,l)||"SIGN_IN",E.useEffect(()=>{let O=!1;d==="MAGIC_LINK"&&(!_||!p&&!S)&&(O=!0),d==="EMAIL_OTP"&&(!S||!p&&!_)&&(O=!0),d==="SIGN_UP"&&!C&&(O=!0),!p&&["SIGN_UP","FORGOT_PASSWORD","RESET_PASSWORD","TWO_FACTOR","RECOVER_ACCOUNT"].includes(d)&&(O=!0),["TWO_FACTOR","RECOVER_ACCOUNT"].includes(d)&&!T&&(O=!0),O&&A(`${g}/${R.SIGN_IN}${window.location.search}`)},[g,d,R,p,A,S,C,_,T]),d==="SIGN_OUT")return b.jsx(XO,{redirectTo:u});if(d==="CALLBACK")return b.jsx(QO,{redirectTo:u});if(d==="SIGN_IN")return p?b.jsx(ZU,{className:e,classNames:t,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h}):_?b.jsx(lw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h}):S?b.jsx(sw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h}):null;if(d==="TWO_FACTOR")return b.jsx(XU,{className:e,classNames:t,localization:o,otpSeparators:f,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="RECOVER_ACCOUNT")return b.jsx(KU,{className:e,classNames:t,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="MAGIC_LINK")return b.jsx(lw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="EMAIL_OTP")return b.jsx(sw,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="EMAIL_VERIFICATION")return b.jsx(qU,{className:e,classNames:t,callbackURL:n,localization:o,otpSeparators:f,redirectTo:u,isSubmitting:a,setIsSubmitting:h});if(d==="FORGOT_PASSWORD")return b.jsx(YU,{className:e,classNames:t,localization:o,isSubmitting:a,setIsSubmitting:h});if(d==="RESET_PASSWORD")return b.jsx(WU,{className:e,classNames:t,localization:o});if(d==="SIGN_UP")return C&&b.jsx(QU,{className:e,classNames:t,callbackURL:n,localization:o,redirectTo:u,isSubmitting:a,setIsSubmitting:h})}function eB({className:e,classNames:t,localization:n}){const{localization:a,redirectTo:o,replace:l,toast:u}=E.useContext(Ze),d=E.useMemo(()=>({...a,...n}),[a,n]),{data:f}=tU(),[h,g]=E.useState(null);return E.useEffect(()=>{const p=Do("invitationId");if(!p){u({variant:"error",message:d.INVITATION_NOT_FOUND}),l(o);return}g(p)},[d.INVITATION_NOT_FOUND,u,l,o]),!f||!h?b.jsx(JO,{className:e,classNames:t}):b.jsx(tB,{className:e,classNames:t,localization:d,invitationId:h})}function tB({className:e,classNames:t,localization:n,invitationId:a}){var o;const{authClient:l,hooks:{useInvitation:u},localization:d,organization:f,redirectTo:h,replace:g,toast:p,localizeErrors:y}=E.useContext(Ze),_=E.useMemo(()=>({...d,...n}),[d,n]),[S,w]=E.useState(!1),[T,R]=E.useState(!1),A=S||T,{data:C,isPending:O}=u({query:{id:a}}),I=E.useCallback(()=>Do("redirectTo")||h,[h]);E.useEffect(()=>{if(!(O||!a)){if(!C){p({variant:"error",message:_.INVITATION_NOT_FOUND}),g(h);return}(C.status!=="pending"||new Date(C.expiresAt)<new Date)&&(p({variant:"error",message:new Date(C.expiresAt)<new Date?_.INVITATION_EXPIRED:_.INVITATION_NOT_FOUND}),g(h))}},[C,O,a,_,p,g,h]);const L=async()=>{R(!0);try{await l.organization.acceptInvitation({invitationId:a,fetchOptions:{throw:!0}}),p({variant:"success",message:_.INVITATION_ACCEPTED||"Invitation accepted"}),g(I())}catch(G){p({variant:"error",message:Ut({error:G,localization:_,localizeErrors:y})}),R(!1)}},N=async()=>{w(!0);try{await l.organization.rejectInvitation({invitationId:a,fetchOptions:{throw:!0}}),p({variant:"success",message:_.INVITATION_REJECTED}),g(h)}catch(G){p({variant:"error",message:Ut({error:G,localization:_,localizeErrors:y})}),w(!1)}},Q=((o=[...[{role:"owner",label:_.OWNER},{role:"admin",label:_.ADMIN},{role:"member",label:_.MEMBER}],...f?.customRoles||[]].find(G=>G.role===C?.role))==null?void 0:o.label)||C?.role;return C?b.jsxs(Io,{className:de("w-full max-w-sm",e,t?.base),children:[b.jsxs($f,{className:de("justify-items-center text-center",t?.header),children:[b.jsx(_0,{className:de("text-lg md:text-xl",t?.title),children:_.ACCEPT_INVITATION}),b.jsx(Gf,{className:de("text-xs md:text-sm",t?.description),children:_.ACCEPT_INVITATION_DESCRIPTION})]}),b.jsxs(qf,{className:de("flex flex-col gap-6 truncate",t?.content),children:[b.jsxs(Io,{className:de("flex-row items-center p-4"),children:[b.jsx(WO,{organization:{id:C.organizationId,name:C.organizationName,slug:C.organizationSlug,logo:C.organizationLogo,createdAt:new Date},localization:_}),b.jsx("p",{className:"ml-auto text-muted-foreground text-sm",children:Q})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsxs(Ot,{variant:"outline",className:de(t?.button,t?.outlineButton),onClick:N,disabled:A,children:[S?b.jsx(_n,{className:"animate-spin"}):b.jsx(Mx,{}),_.REJECT]}),b.jsxs(Ot,{className:de(t?.button,t?.primaryButton),onClick:L,disabled:A,children:[T?b.jsx(_n,{className:"animate-spin"}):b.jsx(Dv,{}),_.ACCEPT]})]})]})]}):b.jsx(JO,{className:e,classNames:t})}var JO=({className:e,classNames:t,localization:n})=>b.jsxs(Io,{className:de("w-full max-w-sm",e,t?.base),children:[b.jsxs($f,{className:de("justify-items-center",t?.header),children:[b.jsx(vr,{className:de("my-1 h-5 w-full max-w-32 md:h-5.5 md:w-40",t?.skeleton)}),b.jsx(vr,{className:de("my-0.5 h-3 w-full max-w-56 md:h-3.5 md:w-64",t?.skeleton)})]}),b.jsxs(qf,{className:de("flex flex-col gap-6 truncate",t?.content),children:[b.jsxs(Io,{className:de("flex-row items-center p-4"),children:[b.jsx(WO,{isPending:!0,localization:n}),b.jsx(vr,{className:"mt-0.5 ml-auto h-4 w-full max-w-14 shrink-2"})]}),b.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b.jsx(vr,{className:"h-9 w-full"}),b.jsx(vr,{className:"h-9 w-full"})]})]})]});function cw({className:e,orientation:t="horizontal",decorative:n=!0,...a}){return b.jsx(eU,{"data-slot":"separator",decorative:n,orientation:t,className:de("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...a})}function nB({classNames:e,isSubmitting:t,localization:n,view:a}){var o,l,u,d;const{viewPaths:f,navigate:h,basePath:g}=E.useContext(Ze);return b.jsxs(Ot,{className:de("w-full",(o=e?.form)==null?void 0:o.button,(l=e?.form)==null?void 0:l.secondaryButton),disabled:t,type:"button",variant:"secondary",onClick:()=>h(`${g}/${a==="EMAIL_OTP"?f.SIGN_IN:f.EMAIL_OTP}${window.location.search}`),children:[a==="EMAIL_OTP"?b.jsx(Ax,{className:(u=e?.form)==null?void 0:u.icon}):b.jsx(Cx,{className:(d=e?.form)==null?void 0:d.icon}),n.SIGN_IN_WITH," ",a==="EMAIL_OTP"?n.PASSWORD:n.EMAIL_OTP]})}function rB({classNames:e,isSubmitting:t,localization:n,view:a}){var o,l,u,d;const{viewPaths:f,navigate:h,basePath:g,credentials:p}=E.useContext(Ze);return b.jsxs(Ot,{className:de("w-full",(o=e?.form)==null?void 0:o.button,(l=e?.form)==null?void 0:l.secondaryButton),disabled:t,type:"button",variant:"secondary",onClick:()=>h(`${g}/${a==="MAGIC_LINK"||!p?f.SIGN_IN:f.MAGIC_LINK}${window.location.search}`),children:[a==="MAGIC_LINK"?b.jsx(Ax,{className:(u=e?.form)==null?void 0:u.icon}):b.jsx(Cx,{className:(d=e?.form)==null?void 0:d.icon}),n.SIGN_IN_WITH," ",a==="MAGIC_LINK"?n.PASSWORD:n.MAGIC_LINK]})}function aB({localization:e,redirectTo:t}){const{authClient:n,localization:a,toast:o,localizeErrors:l}=E.useContext(Ze),u=E.useRef(!1);e=E.useMemo(()=>({...a,...e}),[a,e]);const{onSuccess:d}=xa({redirectTo:t});return E.useEffect(()=>{if(!u.current){u.current=!0;try{n.oneTap({fetchOptions:{throw:!0,onSuccess:d}})}catch(f){o({variant:"error",message:Ut({error:f,localization:e,localizeErrors:l})})}}},[n,e,l,d,o]),null}function iB({classNames:e,isSubmitting:t,localization:n,redirectTo:a,setIsSubmitting:o}){var l,u;const{authClient:d,localization:f,toast:h,localizeErrors:g}=E.useContext(Ze);n={...f,...n};const{onSuccess:p}=xa({redirectTo:a}),y=async()=>{o?.(!0);try{const _=await d.signIn.passkey({fetchOptions:{throw:!0}});_?.error?(h({variant:"error",message:Ut({error:_.error,localization:n,localizeErrors:g})}),o?.(!1)):p()}catch(_){h({variant:"error",message:Ut({error:_,localization:n,localizeErrors:g})}),o?.(!1)}};return b.jsxs(Ot,{className:de("w-full",(l=e?.form)==null?void 0:l.button,(u=e?.form)==null?void 0:u.secondaryButton),disabled:t,formNoValidate:!0,name:"passkey",value:"true",variant:"secondary",onClick:y,children:[b.jsx(bN,{}),n.SIGN_IN_WITH," ",n.PASSKEY]})}function uw({className:e,classNames:t,callbackURL:n,isSubmitting:a,localization:o,other:l,provider:u,redirectTo:d,socialLayout:f,setIsSubmitting:h}){var g,p,y,_;const{authClient:S,basePath:w,baseURL:T,persistClient:R,redirectTo:A,viewPaths:C,social:O,genericOAuth:I,toast:L,localizeErrors:N}=E.useContext(Ze),D=E.useCallback(()=>d||Do("redirectTo")||A,[d,A]),U=E.useCallback(()=>`${T}${n||(R?`${w}/${C.CALLBACK}?redirectTo=${encodeURIComponent(D())}`:D())}`,[n,R,w,C,T,D]),Q=async()=>{h(!0);try{if(l){const G={providerId:u.provider,callbackURL:U(),fetchOptions:{throw:!0}};I?.signIn?(await I.signIn(G),setTimeout(()=>{h(!1)},1e4)):await S.signIn.oauth2(G)}else{const G={provider:u.provider,callbackURL:U(),fetchOptions:{throw:!0}};O?.signIn?(await O.signIn(G),setTimeout(()=>{h(!1)},1e4)):await S.signIn.social(G)}}catch(G){L({variant:"error",message:Ut({error:G,localization:o,localizeErrors:N})}),h(!1)}};return b.jsxs(Ot,{className:de(f==="vertical"?"w-full":"grow",e,(g=t?.form)==null?void 0:g.button,(p=t?.form)==null?void 0:p.outlineButton,(y=t?.form)==null?void 0:y.providerButton),disabled:a,variant:"outline",onClick:Q,children:[u.icon&&b.jsx(u.icon,{className:(_=t?.form)==null?void 0:_.icon}),f==="grid"&&u.name,f==="vertical"&&`${o.SIGN_IN_WITH} ${u.name}`]})}function Lz({className:e,classNames:t,callbackURL:n,cardHeader:a,cardFooter:o,localization:l,path:u,pathname:d,redirectTo:f,socialLayout:h="auto",view:g,otpSeparators:p=0}){var y,_,S,w,T,R;const A=Xa(),{basePath:C,credentials:O,localization:I,magicLink:L,emailOTP:N,oneTap:D,passkey:U,signUp:Q,social:G,genericOAuth:W,viewPaths:j,Link:ne}=E.useContext(Ze);l={...I,...l};let ie=h;ie==="auto"&&(ie=O&&G?.providers&&G.providers.length>2?"horizontal":"vertical");const P=u??d?.split("/").pop(),V=g||Lg(j,P)||"SIGN_IN",[$,re]=E.useState(!1);if(E.useEffect(()=>{const k=()=>re(!1);return window.addEventListener("pagehide",k),()=>{re(!1),window.removeEventListener("pagehide",k)}},[]),V==="CALLBACK")return b.jsx(QO,{redirectTo:f});if(V==="SIGN_OUT")return b.jsx(XO,{redirectTo:f});if(V==="ACCEPT_INVITATION")return b.jsx(eB,{className:e,classNames:t});const ve=!O&&!L&&!N?l.DISABLED_CREDENTIALS_DESCRIPTION:l[`${V}_DESCRIPTION`];return b.jsxs(Io,{className:de("w-full max-w-sm",e,t?.base),children:[b.jsx($f,{className:t?.header,children:a||b.jsxs(b.Fragment,{children:[b.jsx(_0,{className:de("text-lg md:text-xl",t?.title),children:l[V]}),ve&&b.jsx(Gf,{className:de("text-xs md:text-sm",t?.description),children:ve})]})}),b.jsxs(qf,{className:de("grid gap-6",t?.content),children:[D&&["SIGN_IN","SIGN_UP","MAGIC_LINK","EMAIL_OTP"].includes(V)&&b.jsx(aB,{localization:l,redirectTo:f}),(O||L||N)&&b.jsxs("div",{className:"grid gap-4",children:[b.jsx(JU,{classNames:t?.form,callbackURL:n,isSubmitting:$,localization:l,otpSeparators:p,view:V,redirectTo:f,setIsSubmitting:re}),L&&(O&&["FORGOT_PASSWORD","SIGN_UP","SIGN_IN","MAGIC_LINK","EMAIL_OTP"].includes(V)||N&&V==="EMAIL_OTP")&&b.jsx(rB,{classNames:t,localization:l,view:V,isSubmitting:$}),N&&(O&&["FORGOT_PASSWORD","SIGN_UP","SIGN_IN","MAGIC_LINK","EMAIL_OTP"].includes(V)||L&&["SIGN_IN","MAGIC_LINK"].includes(V))&&b.jsx(nB,{classNames:t,localization:l,view:V,isSubmitting:$})]}),V!=="RESET_PASSWORD"&&V!=="EMAIL_VERIFICATION"&&(((y=G?.providers)==null?void 0:y.length)||((_=W?.providers)==null?void 0:_.length)||V==="SIGN_IN"&&U)&&b.jsxs(b.Fragment,{children:[(O||L||N)&&b.jsxs("div",{className:de("flex items-center gap-2",t?.continueWith),children:[b.jsx(cw,{className:de("!w-auto grow",t?.separator)}),b.jsx("span",{className:"flex-shrink-0 text-muted-foreground text-sm",children:l.OR_CONTINUE_WITH}),b.jsx(cw,{className:de("!w-auto grow",t?.separator)})]}),b.jsxs("div",{className:"grid gap-4",children:[(((S=G?.providers)==null?void 0:S.length)||((w=W?.providers)==null?void 0:w.length))&&b.jsxs("div",{className:de("flex w-full items-center justify-between gap-4",ie==="horizontal"&&"flex-wrap",ie==="vertical"&&"flex-col",ie==="grid"&&"grid grid-cols-2"),children:[(T=G?.providers)==null?void 0:T.map(k=>{const Z=UU.find(ee=>ee.provider===k);return Z?b.jsx(uw,{classNames:t,callbackURL:n,isSubmitting:$,localization:l,provider:Z,redirectTo:f,setIsSubmitting:re,socialLayout:ie},k):null}),(R=W?.providers)==null?void 0:R.map(k=>b.jsx(uw,{classNames:t,callbackURL:n,isSubmitting:$,localization:l,provider:k,redirectTo:f,setIsSubmitting:re,socialLayout:ie,other:!0},k.provider))]}),U&&["SIGN_IN","MAGIC_LINK","EMAIL_OTP","RECOVER_ACCOUNT","TWO_FACTOR","FORGOT_PASSWORD"].includes(V)&&b.jsx(iB,{classNames:t,isSubmitting:$,localization:l,redirectTo:f,setIsSubmitting:re})]})]})]}),o&&b.jsx(lv,{className:t?.footer,children:o}),O&&Q&&b.jsxs(lv,{className:de("justify-center gap-1.5 text-muted-foreground text-sm",t?.footer),children:[V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"?l.DONT_HAVE_AN_ACCOUNT:V==="SIGN_UP"?l.ALREADY_HAVE_AN_ACCOUNT:b.jsx(oN,{className:"size-3"}),V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"||V==="SIGN_UP"?b.jsx(ne,{className:de("text-foreground underline",t?.footerLink),href:`${C}/${j[V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"?"SIGN_UP":"SIGN_IN"]}${A?window.location.search:""}`,children:b.jsx(Ot,{variant:"link",size:"sm",className:de("px-0 text-foreground underline",t?.footerLink),children:V==="SIGN_IN"||V==="MAGIC_LINK"||V==="EMAIL_OTP"?l.SIGN_UP:l.SIGN_IN})}):b.jsx(Ot,{variant:"link",size:"sm",className:de("px-0 text-foreground underline",t?.footerLink),onClick:()=>window.history.back(),children:l.GO_BACK})]})]})}function Pz({children:e}){const{hooks:{useSession:t}}=E.useContext(Ze),{isPending:n}=t();return n?e:null}function kz({children:e}){const{hooks:{useSession:t}}=E.useContext(Ze),{data:n}=t();return n?e:null}function jz({children:e}){const{hooks:{useSession:t}}=E.useContext(Ze),{data:n,isPending:a}=t();return!n&&!a?e:null}function oB(e){const t=Sf.c(8),{children:n}=e,a=Oc();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={basePath:"/",pathMode:"slug"},t[0]=o):o=t[0];let l,u;t[1]!==a?(l=f=>a({to:f}),u=f=>a({to:f,replace:!0}),t[1]=a,t[2]=l,t[3]=u):(l=t[2],u=t[3]);let d;return t[4]!==n||t[5]!==l||t[6]!==u?(d=b.jsx(J6,{authClient:_M,organization:o,navigate:l,replace:u,Link:sB,children:n}),t[4]=n,t[5]=l,t[6]=u,t[7]=d):d=t[7],d}function sB(e){const{href:t,className:n,children:a,...o}=e;return b.jsx(xv,{to:t,className:n,...o,children:a})}const lB=new KC;function cB(e){const t=Sf.c(3),{children:n}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=b.jsx(C6,{}),t[0]=a):a=t[0];let o;return t[1]!==n?(o=b.jsxs(ZC,{client:lB,children:[a,b.jsx(f4,{children:b.jsx(oB,{children:n})})]}),t[1]=n,t[2]=o):o=t[2],o}const uB=function(){return null};function dB(){const e=Sf.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=b.jsx("div",{className:"flex items-center justify-center min-h-screen",children:b.jsx("div",{className:"text-gray-500",children:"Loading..."})}),e[0]=t):t=e[0],t}const Bc=P3({component:()=>b.jsxs(cB,{children:[b.jsx(E.Suspense,{fallback:b.jsx(dB,{}),children:b.jsx($w,{})}),b.jsx(uB,{})]})}),fB=An({getParentRoute:()=>Bc,path:"/login",component:Ln(()=>Dn(()=>import("./login-DHkcl1CZ.js"),__vite__mapDeps([0,1,2,3]))),validateSearch:Ks(()=>Pn({next:et().optional(),client_id:et().optional(),redirect_uri:et().optional(),response_type:et().optional(),state:et().optional(),scope:et().optional(),code_challenge:et().optional(),code_challenge_method:et().optional()}))}),hB=An({getParentRoute:()=>Bc,path:"/auth/$pathname",component:Ln(()=>Dn(()=>import("./auth-catchall-BRnZAoYY.js"),[]))}),Br=An({getParentRoute:()=>Bc,id:"shell",component:Ln(()=>Dn(()=>import("./shell-layout-BDhhfHrp.js"),__vite__mapDeps([4,5,2,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,3,25,26,27,28])))}),pB=An({getParentRoute:()=>Br,path:"/",component:Ln(()=>Dn(()=>import("./home-CSzEs1Rf.js"),__vite__mapDeps([29,18,2,27,7,1,3,22,23,24,25])))}),mB=An({getParentRoute:()=>Br,path:"/$org",component:Ln(()=>Dn(()=>import("./page-DQXzmwPi.js"),__vite__mapDeps([30,6,2,7,8,1,31,32,28,33,19,34,9,35,36,37,38])))}),gB=An({getParentRoute:()=>Br,path:"/$org/members",component:Ln(()=>Dn(()=>import("./members-CX-ziwX2.js"),__vite__mapDeps([39,31,32,1,2,28,8,7,33,40,3,41,42,6,43,14,44,45,13,27,37,23,20,46,5,19,24,16,18])))}),vB=An({getParentRoute:()=>Br,path:"/$org/mcps",component:Ln(()=>Dn(()=>import("./connections-Bm36z6Kn.js"),__vite__mapDeps([47,48,31,32,1,2,28,8,7,33,40,3,41,17,18,6,5,19,49,15,23,37,20,24,14,16,50]))),validateSearch:Ks(()=>Pn({action:Mv(["create"]).optional()}))}),yB=An({getParentRoute:()=>Br,path:"/$org/settings",component:Ln(()=>Dn(()=>import("./settings-DOjDcDAR.js"),__vite__mapDeps([51,31,32,1,2,28,8,7,33,24,3,52])))}),bB=An({getParentRoute:()=>Br,path:"/$org/monitoring",component:Ln(()=>Dn(()=>import("./monitoring-5rf2nLo0.js"),__vite__mapDeps([53,6,2,7,8,1,31,32,28,33,40,3,5,19,35,36,37,9,44,34,43,14,54,26]))),validateSearch:Ks(()=>Pn({from:et().default("now-24h"),to:et().default("now"),connectionId:CE(et()).optional().default([]),gatewayId:CE(et()).optional().default([]),tool:et().default(""),status:Mv(["all","success","errors"]).default("all"),search:et().default(""),page:wx().optional(),streaming:Cv().default(!0)}))}),eT=An({getParentRoute:()=>Br,path:"/$org/store",component:Ln(()=>Dn(()=>import("./store-B09vXexU.js"),__vite__mapDeps([55,45,31,32,1,2,28,8,7,6,56,40,3,18,57,58,14,17,5,10,11,12,13])))}),_B=An({getParentRoute:()=>eT,path:"/$appName",component:Ln(()=>Dn(()=>import("./store-app-detail-BqI8KTAM.js"),__vite__mapDeps([59,7,2,1,6,8,28,5,60,13,57,32,40,3,41,18,61,37,62,10,11,34,63,64,50,56,58]))),validateSearch:Ks(()=>Pn({registryId:et().optional(),serverName:et().optional(),itemId:et().optional()}))}),EB=An({getParentRoute:()=>Br,path:"/$org/mcps/$connectionId",component:Ln(()=>Dn(()=>import("./connection-detail-CKuTnq-B.js"),__vite__mapDeps([65,5,2,19,1,6,7,8,10,11,66,67,21,34,61,24,3,14,9,68,64,57,50,36,54,48,60,13,32,28,40,41,18,37,62,49,15,23]))),validateSearch:Ks(()=>Pn({tab:et().optional()}))}),SB=An({getParentRoute:()=>Br,path:"/$org/mcps/$connectionId/$collectionName/$itemId",component:Ln(()=>Dn(()=>import("./collection-detail-ieEvVULW.js"),__vite__mapDeps([69,6,2,7,8,1,42,43,14,40,3,37,25,16,66,67,11,21,5,19,10,34,61,24,9,68,64,57,50,36,54,48,52,63,13,70])))}),wB=An({getParentRoute:()=>Br,path:"/$org/gateways",component:Ln(()=>Dn(()=>import("./gateways-BxMjTmO6.js"),__vite__mapDeps([71,31,32,1,2,28,8,7,33,40,3,41,17,18,6,5,19,9,49,15,23,37]))),validateSearch:Ks(()=>Pn({action:Mv(["create"]).optional()}))}),xB=An({getParentRoute:()=>Br,path:"/$org/gateways/$gatewayId",component:Ln(()=>Dn(()=>import("./gateway-detail-B2bI_bIU.js"),__vite__mapDeps([72,5,2,19,1,6,7,8,42,43,14,40,3,9,46,24,56,61,68])))}),RB=An({getParentRoute:()=>Bc,path:"/oauth/callback",component:Ln(()=>Dn(()=>import("./oauth-callback-NjwvQ7fr.js"),__vite__mapDeps([73,18,2,7,67,11,70])))}),OB=eT.addChildren([_B]),TB=Br.addChildren([pB,mB,gB,vB,wB,xB,bB,OB,yB,EB,SB]),AB=Bc.addChildren([TB,fB,hB,RB]),CB=$3({routeTree:AB}),MB=document.getElementById("root");wC.createRoot(MB).render(b.jsx(E.StrictMode,{children:b.jsx(Y3,{router:CB})}));export{$x as $,Lz as A,yz as B,sz as C,JB as D,QB as E,az as F,oz as G,Wx as H,bz as I,_z as J,fD as K,gD as L,pD as M,kB as N,dz as O,fz as P,cz as Q,uz as R,dB as S,hz as T,pz as U,qx as V,Ws as W,No as X,Nz as Y,Fe as Z,vD as _,_M as a,yP as a$,Xr as a0,WC as a1,u4 as a2,c4 as a3,Dn as a4,Oc as a5,NE as a6,eU as a7,GL as a8,ZL as a9,AR as aA,CP as aB,PB as aC,ox as aD,CE as aE,YB as aF,Cv as aG,ik as aH,ok as aI,ak as aJ,qL as aK,Mx as aL,hn as aM,Ja as aN,Qr as aO,HR as aP,XR as aQ,Ui as aR,gP as aS,Gv as aT,uR as aU,qv as aV,bc as aW,tR as aX,$v as aY,Hv as aZ,vP as a_,Oz as aa,WL as ab,YL as ac,Tz as ad,KL as ae,oD as af,Hx as ag,Ze as ah,bU as ai,Dz as aj,Pz as ak,kz as al,jz as am,cv as an,$w as ao,Pn as ap,et as aq,Ea as ar,_a as as,Cc as at,Bt as au,Ke as av,F as aw,Lo as ax,e2 as ay,MP as az,wv as b,Az as b$,IB as b0,Bw as b1,Tf as b2,$i as b3,Ka as b4,VC as b5,j_ as b6,DB as b7,NB as b8,l4 as b9,TR as bA,Mv as bB,FB as bC,Pc as bD,Ac as bE,KB as bF,zB as bG,VB as bH,$B as bI,wx as bJ,HB as bK,qB as bL,Ks as bM,UB as bN,BB as bO,jB as bP,xz as bQ,Rz as bR,wz as bS,F7 as bT,H7 as bU,$7 as bV,G7 as bW,q7 as bX,Cz as bY,Mz as bZ,Iz as b_,a4 as ba,er as bb,oN as bc,tr as bd,Cn as be,Rc as bf,Tn as bg,vg as bh,hw as bi,QC as bj,e4 as bk,i4 as bl,t4 as bm,n4 as bn,Xn as bo,s4 as bp,U_ as bq,o4 as br,r4 as bs,xv as bt,lI as bu,Z2 as bv,X2 as bw,W7 as bx,Ek as by,VR as bz,Sf as c,PN as c0,UN as c1,Cf as c2,Bv as c3,fc as c4,GC as c5,LC as c6,_n as c7,WB as c8,GB as c9,_e as ca,ZB as cb,Sv as d,iz as e,ez as f,vz as g,lz as h,tz as i,b as j,dD as k,If as l,Mf as m,XB as n,lD as o,gz as p,rz as q,E as r,uD as s,nS as t,LB as u,nz as v,Gx as w,Ez as x,Sz as y,mz as z};