@hanzo/ui 5.5.1 → 5.6.1

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.
File without changes
File without changes
File without changes
File without changes
File without changes
package/bin/test-mcp.sh CHANGED
File without changes
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var j=Object.defineProperty;var n=(t,e)=>j(t,"name",{value:e,configurable:true});function Y({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,label:r="Sign in with Hanzo",className:l="",variant:s="default"}){let[c,i]=react.useState(false),u=react.useCallback(()=>{i(true);let a=o||`${window.location.origin}/auth/callback`,m=crypto.randomUUID(),h=new URL(`${t}/login/oauth/authorize`);h.searchParams.set("client_id",e),h.searchParams.set("response_type","code"),h.searchParams.set("redirect_uri",a),h.searchParams.set("scope","openid profile email"),h.searchParams.set("state",m),window.location.href=h.toString();},[t,e,o]);return jsxRuntime.jsxs("button",{type:"button",className:`inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${s==="outline"?"border border-[#333] bg-transparent text-white hover:bg-[#1a1a1f]":"bg-white text-black hover:bg-[#e5e5e5]"} ${l}`,onClick:u,disabled:c,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("text",{x:"4",y:"26",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif",fontSize:"28",fontWeight:"700",fill:"currentColor",children:"H"})}),c?"Redirecting...":r]})}n(Y,"IAMLoginButton");var E="hanzo-auth-token",S="hanzo-user",$="hanzo-auth-expires",V="https://iam.hanzo.ai",X={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function A(){let[t,e]=react.useState(void 0),[o,r]=react.useState([]),[l,s]=react.useState(void 0),[c,i]=react.useState(null),[u,f]=react.useState(true),g=react.useCallback(async()=>{try{let h=localStorage.getItem(E),H=localStorage.getItem($);if(!h||H&&Date.now()>Number(H)){f(!1);return}i(h);let R=localStorage.getItem(S);if(R)try{let p=JSON.parse(R);p?.email&&e({id:p.id,name:p.displayName||p.name,email:p.email,avatar:p.avatar});}catch{}let U=await fetch(`${V}/api/userinfo`,{headers:{Authorization:`Bearer ${h}`}});if(U.ok){let p=await U.json(),B={id:p.sub||p.id,name:p.name||p.displayName,email:p.email,avatar:p.picture||p.avatar};e(B),localStorage.setItem(S,JSON.stringify(p));let x=(p.groups||[]).map(G=>{let D=G.toLowerCase().replace(/^\//,""),k=X[D];return k?{id:D,name:k.name,slug:k.slug}:null}).filter(Boolean);x.length===0&&B.email&&x.push({id:"personal",name:"Personal",slug:"personal"}),r(x),s(x[0]?.id);}}catch{}finally{f(false);}},[]);react.useEffect(()=>{g();},[g]);let a=react.useCallback(()=>{localStorage.removeItem(E),localStorage.removeItem(S),localStorage.removeItem($),window.location.href="https://hanzo.id";},[]),m=react.useCallback(h=>{s(h);},[]);return {user:t,organizations:o,currentOrgId:l,token:c,loading:u,signOut:a,switchOrg:m}}n(A,"useHanzoAuth");function Q({loginUrl:t,clientId:e,fallback:o,children:r}){let{user:l,loading:s}=A();return react.useEffect(()=>{if(!s&&!l)if(t)window.location.href=t;else if(e){let c=`${window.location.origin}/auth/callback`,i=new URL("https://hanzo.id/login/oauth/authorize");i.searchParams.set("client_id",e),i.searchParams.set("response_type","code"),i.searchParams.set("redirect_uri",c),i.searchParams.set("scope","openid profile email"),window.location.href=i.toString();}else window.location.href="https://hanzo.id";},[s,l,t,e]),s?jsxRuntime.jsx(jsxRuntime.Fragment,{children:o??jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:r}):null}n(Q,"AuthGuard");var O={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var tt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function et(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(et,"hashStr");function y(t,e,o){return t%(e*(o+1))%e}n(y,"getUnit");function ot(t,e){return y(t,2,e)===0}n(ot,"getBoolean");function F(t,e,o){return o[y(t,o.length,e)]}n(F,"getRandomColor");function st(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),r=parseInt(t.slice(5,7),16);return e*.299+o*.587+r*.114>128?"#000":"#fff"}n(st,"getContrast");function T({name:t,size:e=40,colors:o=tt,className:r,square:l=false}){let s=et(t),c=F(s,0,o),i=st(c),u=ot(s,2),f=y(s,3,7),g=y(s,5,8),a=y(s,10,9),m=a>6?a-10:a,h=y(s,5,10)>3?y(s,5,10)-5:y(s,5,10);return jsxRuntime.jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:r,style:l?void 0:{borderRadius:"50%"},children:[jsxRuntime.jsx("mask",{id:`beam-${s}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsxRuntime.jsx("rect",{width:36,height:36,rx:l?void 0:72,fill:"#fff"})}),jsxRuntime.jsxs("g",{mask:`url(#beam-${s})`,children:[jsxRuntime.jsx("rect",{width:36,height:36,fill:c}),jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${m} ${h}) rotate(${a} 18 18)`,fill:F(s,1,o),rx:6}),jsxRuntime.jsxs("g",{transform:`translate(${m} ${h}) rotate(${a} 18 18)`,children:[u?jsxRuntime.jsx("path",{d:`M15 ${19+f}c2 1 4 1 6 0`,stroke:i,fill:"none",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:`M13 ${19+f}a1 .75 0 0 0 10 0`,fill:i}),jsxRuntime.jsx("rect",{x:14-g,y:14,width:1.5,height:2,rx:1,fill:i}),jsxRuntime.jsx("rect",{x:20+g,y:14,width:1.5,height:2,rx:1,fill:i})]})]})]})}n(T,"BeamAvatar");async function rt(t){let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(r)).map(l=>l.toString(16).padStart(2,"0")).join("")}n(rt,"sha256");function nt(t,e){let[o,r]=react.useState(null);return react.useMemo(()=>{if(!t){r(null);return}let l=t.trim().toLowerCase();rt(l).then(s=>{r(`https://www.gravatar.com/avatar/${s}?s=${e||80}&d=404`);});},[t,e]),o}n(nt,"useGravatarUrl");function _({src:t,email:e,name:o,size:r=40,colors:l,className:s}){let[c,i]=react.useState(false),[u,f]=react.useState(false),g=nt(e,r*2),a=`rounded-full object-cover ${s||""}`,m={width:r,height:r};return t&&!c?jsxRuntime.jsx("img",{src:t,alt:o||e||"avatar",className:a,style:m,onError:()=>i(true)}):g&&!u?jsxRuntime.jsx("img",{src:g,alt:o||e||"avatar",className:a,style:m,onError:()=>f(true)}):jsxRuntime.jsx(T,{name:o||e||"user",size:r,colors:l,className:s})}n(_,"UserAvatar");function ht({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:r,onSignOut:l}){let[s,c]=react.useState(false),i=react.useRef(null);if(react.useEffect(()=>{let a=n(m=>{i.current&&!i.current.contains(m.target)&&c(false);},"handler");return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),!t)return null;let u=e.find(a=>a.id===o),f=u?.slug||"hanzo",g=O[f]||O.hanzo;return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>c(a=>!a),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsx(_,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxRuntime.jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsxRuntime.jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsxRuntime.jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsxRuntime.jsx("path",{d:"M6 9l6 6 6-6"})})]}),s&&jsxRuntime.jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsxRuntime.jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsxRuntime.jsx("p",{className:"text-[11px] text-white/40",children:t.email}),u&&jsxRuntime.jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:u.name})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsxRuntime.jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(a=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{r?.(a.id),c(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-[13px] text-white/70",children:a.name}),a.role&&jsxRuntime.jsx("span",{className:"text-[10px] text-white/25 capitalize",children:a.role})]}),a.id===o&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},a.id))]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsx("a",{href:`${g.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Account settings"}),jsxRuntime.jsx("a",{href:g.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Billing"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{c(false),l?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(ht,"UserOrgDropdown");
3
+ exports.AuthGuard=Q;exports.IAMLoginButton=Y;exports.UserOrgDropdown=ht;exports.useHanzoAuth=A;
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import {useState,useCallback,useEffect,useRef,useMemo}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var j=Object.defineProperty;var n=(t,e)=>j(t,"name",{value:e,configurable:true});function Y({iamUrl:t="https://hanzo.id",clientId:e,redirectUri:o,label:r="Sign in with Hanzo",className:l="",variant:s="default"}){let[c,i]=useState(false),u=useCallback(()=>{i(true);let a=o||`${window.location.origin}/auth/callback`,m=crypto.randomUUID(),h=new URL(`${t}/login/oauth/authorize`);h.searchParams.set("client_id",e),h.searchParams.set("response_type","code"),h.searchParams.set("redirect_uri",a),h.searchParams.set("scope","openid profile email"),h.searchParams.set("state",m),window.location.href=h.toString();},[t,e,o]);return jsxs("button",{type:"button",className:`inline-flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${s==="outline"?"border border-[#333] bg-transparent text-white hover:bg-[#1a1a1f]":"bg-white text-black hover:bg-[#e5e5e5]"} ${l}`,onClick:u,disabled:c,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:jsx("text",{x:"4",y:"26",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif",fontSize:"28",fontWeight:"700",fill:"currentColor",children:"H"})}),c?"Redirecting...":r]})}n(Y,"IAMLoginButton");var E="hanzo-auth-token",S="hanzo-user",$="hanzo-auth-expires",V="https://iam.hanzo.ai",X={hanzo:{name:"Hanzo AI",slug:"hanzo"},lux:{name:"Lux Network",slug:"lux"},zoo:{name:"Zoo Labs",slug:"zoo"},pars:{name:"Pars",slug:"pars"}};function A(){let[t,e]=useState(void 0),[o,r]=useState([]),[l,s]=useState(void 0),[c,i]=useState(null),[u,f]=useState(true),g=useCallback(async()=>{try{let h=localStorage.getItem(E),H=localStorage.getItem($);if(!h||H&&Date.now()>Number(H)){f(!1);return}i(h);let R=localStorage.getItem(S);if(R)try{let p=JSON.parse(R);p?.email&&e({id:p.id,name:p.displayName||p.name,email:p.email,avatar:p.avatar});}catch{}let U=await fetch(`${V}/api/userinfo`,{headers:{Authorization:`Bearer ${h}`}});if(U.ok){let p=await U.json(),B={id:p.sub||p.id,name:p.name||p.displayName,email:p.email,avatar:p.picture||p.avatar};e(B),localStorage.setItem(S,JSON.stringify(p));let x=(p.groups||[]).map(G=>{let D=G.toLowerCase().replace(/^\//,""),k=X[D];return k?{id:D,name:k.name,slug:k.slug}:null}).filter(Boolean);x.length===0&&B.email&&x.push({id:"personal",name:"Personal",slug:"personal"}),r(x),s(x[0]?.id);}}catch{}finally{f(false);}},[]);useEffect(()=>{g();},[g]);let a=useCallback(()=>{localStorage.removeItem(E),localStorage.removeItem(S),localStorage.removeItem($),window.location.href="https://hanzo.id";},[]),m=useCallback(h=>{s(h);},[]);return {user:t,organizations:o,currentOrgId:l,token:c,loading:u,signOut:a,switchOrg:m}}n(A,"useHanzoAuth");function Q({loginUrl:t,clientId:e,fallback:o,children:r}){let{user:l,loading:s}=A();return useEffect(()=>{if(!s&&!l)if(t)window.location.href=t;else if(e){let c=`${window.location.origin}/auth/callback`,i=new URL("https://hanzo.id/login/oauth/authorize");i.searchParams.set("client_id",e),i.searchParams.set("response_type","code"),i.searchParams.set("redirect_uri",c),i.searchParams.set("scope","openid profile email"),window.location.href=i.toString();}else window.location.href="https://hanzo.id";},[s,l,t,e]),s?jsx(Fragment,{children:o??jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#09090b",color:"#888"},children:"Loading..."})}):l?jsx(Fragment,{children:r}):null}n(Q,"AuthGuard");var O={hanzo:{id:"hanzo",iam:"https://hanzo.id",billing:"https://billing.hanzo.ai",console:"https://console.hanzo.ai",cloud:"https://cloud.hanzo.ai",chat:"https://hanzo.chat",flow:"https://flow.hanzo.ai",bot:"https://hanzo.bot",o11y:"https://o11y.hanzo.ai",sentry:"https://sentry.hanzo.ai",insights:"https://insights.hanzo.ai",analytics:"https://analytics.hanzo.ai",platform:"https://platform.hanzo.ai",storage:"https://s3.hanzo.ai",s3:"https://s3.hanzo.ai",kms:"https://kms.hanzo.ai",dns:"https://dns.hanzo.ai",registry:"https://registry.hanzo.ai",commerce:"https://commerce.hanzo.ai",base:"https://base.hanzo.ai",search:"https://search.hanzo.ai",auto:"https://auto.hanzo.ai",team:"https://hanzo.team",sign:"https://sign.hanzo.ai",dataroom:"https://dataroom.hanzo.ai",captable:"https://captable.hanzo.ai",docs:"https://docs.hanzo.ai",status:"https://status.hanzo.ai"},lux:{id:"lux",iam:"https://lux.id",billing:"https://billing.lux.network",console:"https://console.lux.network",cloud:"https://cloud.lux.network",chat:"https://lux.chat",flow:"https://flow.lux.network",bot:"https://bot.lux.network",o11y:"https://o11y.lux.network",sentry:"https://sentry.lux.network",insights:"https://insights.lux.network",analytics:"https://analytics.lux.network",platform:"https://platform.lux.network",storage:"https://s3.lux.network",s3:"https://s3.lux.network",kms:"https://kms.lux.network",dns:"https://dns.lux.network",registry:"https://registry.lux.network",commerce:"https://commerce.lux.network",base:"https://base.lux.network",search:"https://search.lux.network",auto:"https://auto.lux.network",team:"https://team.lux.network",sign:"https://sign.lux.network",dataroom:"https://dataroom.lux.network",captable:"https://captable.lux.network",docs:"https://docs.lux.network",status:"https://status.lux.network"},zoo:{id:"zoo",iam:"https://zoo.id",billing:"https://billing.zoo.ngo",console:"https://console.zoo.ngo",cloud:"https://cloud.zoo.network",chat:"https://chat.zoo.ngo",flow:"https://flow.zoo.ngo",bot:"https://bot.zoo.ngo",o11y:"https://o11y.zoo.network",sentry:"https://sentry.zoo.network",insights:"https://insights.zoo.ngo",analytics:"https://analytics.zoo.ngo",platform:"https://platform.zoo.ngo",storage:"https://s3.zoo.ngo",s3:"https://s3.zoo.ngo",kms:"https://kms.zoo.network",dns:"https://dns.zoo.ngo",registry:"https://registry.zoo.ngo",commerce:"https://commerce.zoo.ngo",base:"https://base.zoo.ngo",search:"https://search.zoo.ngo",auto:"https://auto.zoo.ngo",team:"https://team.zoo.ngo",sign:"https://sign.zoo.ngo",dataroom:"https://dataroom.zoo.ngo",captable:"https://captable.zoo.ngo",docs:"https://docs.zoo.ngo",status:"https://status.zoo.network"},pars:{id:"pars",iam:"https://pars.id",billing:"https://billing.pars.network",console:"https://console.pars.network",cloud:"https://cloud.pars.network",chat:"https://chat.pars.network",flow:"https://flow.pars.network",bot:"https://bot.pars.network",o11y:"https://o11y.pars.network",sentry:"https://sentry.pars.network",insights:"https://insights.pars.network",analytics:"https://analytics.pars.network",platform:"https://platform.pars.network",storage:"https://s3.pars.network",s3:"https://s3.pars.network",kms:"https://kms.pars.network",dns:"https://dns.pars.network",registry:"https://registry.pars.network",commerce:"https://commerce.pars.network",base:"https://base.pars.network",search:"https://search.pars.network",auto:"https://auto.pars.network",team:"https://team.pars.network",sign:"https://sign.pars.network",dataroom:"https://dataroom.pars.network",captable:"https://captable.pars.network",docs:"https://docs.pars.network",status:"https://status.pars.network"}};var tt=["#0A0310","#49007E","#FF005B","#FF7D10","#FFB238"];function et(t){let e=0;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}n(et,"hashStr");function y(t,e,o){return t%(e*(o+1))%e}n(y,"getUnit");function ot(t,e){return y(t,2,e)===0}n(ot,"getBoolean");function F(t,e,o){return o[y(t,o.length,e)]}n(F,"getRandomColor");function st(t){let e=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),r=parseInt(t.slice(5,7),16);return e*.299+o*.587+r*.114>128?"#000":"#fff"}n(st,"getContrast");function T({name:t,size:e=40,colors:o=tt,className:r,square:l=false}){let s=et(t),c=F(s,0,o),i=st(c),u=ot(s,2),f=y(s,3,7),g=y(s,5,8),a=y(s,10,9),m=a>6?a-10:a,h=y(s,5,10)>3?y(s,5,10)-5:y(s,5,10);return jsxs("svg",{viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,className:r,style:l?void 0:{borderRadius:"50%"},children:[jsx("mask",{id:`beam-${s}`,maskUnits:"userSpaceOnUse",x:0,y:0,width:36,height:36,children:jsx("rect",{width:36,height:36,rx:l?void 0:72,fill:"#fff"})}),jsxs("g",{mask:`url(#beam-${s})`,children:[jsx("rect",{width:36,height:36,fill:c}),jsx("rect",{x:0,y:0,width:36,height:36,transform:`translate(${m} ${h}) rotate(${a} 18 18)`,fill:F(s,1,o),rx:6}),jsxs("g",{transform:`translate(${m} ${h}) rotate(${a} 18 18)`,children:[u?jsx("path",{d:`M15 ${19+f}c2 1 4 1 6 0`,stroke:i,fill:"none",strokeLinecap:"round"}):jsx("path",{d:`M13 ${19+f}a1 .75 0 0 0 10 0`,fill:i}),jsx("rect",{x:14-g,y:14,width:1.5,height:2,rx:1,fill:i}),jsx("rect",{x:20+g,y:14,width:1.5,height:2,rx:1,fill:i})]})]})]})}n(T,"BeamAvatar");async function rt(t){let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return Array.from(new Uint8Array(r)).map(l=>l.toString(16).padStart(2,"0")).join("")}n(rt,"sha256");function nt(t,e){let[o,r]=useState(null);return useMemo(()=>{if(!t){r(null);return}let l=t.trim().toLowerCase();rt(l).then(s=>{r(`https://www.gravatar.com/avatar/${s}?s=${e||80}&d=404`);});},[t,e]),o}n(nt,"useGravatarUrl");function _({src:t,email:e,name:o,size:r=40,colors:l,className:s}){let[c,i]=useState(false),[u,f]=useState(false),g=nt(e,r*2),a=`rounded-full object-cover ${s||""}`,m={width:r,height:r};return t&&!c?jsx("img",{src:t,alt:o||e||"avatar",className:a,style:m,onError:()=>i(true)}):g&&!u?jsx("img",{src:g,alt:o||e||"avatar",className:a,style:m,onError:()=>f(true)}):jsx(T,{name:o||e||"user",size:r,colors:l,className:s})}n(_,"UserAvatar");function ht({user:t,organizations:e=[],currentOrgId:o,onOrgSwitch:r,onSignOut:l}){let[s,c]=useState(false),i=useRef(null);if(useEffect(()=>{let a=n(m=>{i.current&&!i.current.contains(m.target)&&c(false);},"handler");return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),!t)return null;let u=e.find(a=>a.id===o),f=u?.slug||"hanzo",g=O[f]||O.hanzo;return jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>c(a=>!a),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-white/[0.06] transition-colors",children:[jsx(_,{src:t.avatar,email:t.email,name:t.name,size:28}),jsxs("div",{className:"hidden flex-col items-start sm:flex",children:[t.name&&jsx("span",{className:"text-[12px] font-medium text-white/70 leading-none",children:t.name}),jsx("span",{className:"text-[11px] text-white/30 leading-none mt-0.5",children:t.email})]}),jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/30 hidden sm:block",children:jsx("path",{d:"M6 9l6 6 6-6"})})]}),s&&jsxs("div",{className:"absolute right-0 top-10 z-50 w-64 rounded-xl border border-white/[0.08] bg-[#0e0e13] shadow-2xl",children:[jsxs("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[jsx("p",{className:"text-[13px] font-medium text-white/80",children:t.name||"User"}),jsx("p",{className:"text-[11px] text-white/40",children:t.email}),u&&jsx("p",{className:"mt-0.5 text-[10px] font-medium text-white/25 uppercase tracking-wider",children:u.name})]}),e.length>0&&jsxs("div",{className:"border-b border-white/[0.06] p-2",children:[jsx("p",{className:"px-2 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/30",children:"Organizations"}),e.map(a=>jsxs("button",{type:"button",onClick:()=>{r?.(a.id),c(false);},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left hover:bg-white/[0.06] transition-colors",children:[jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:"text-[13px] text-white/70",children:a.name}),a.role&&jsx("span",{className:"text-[10px] text-white/25 capitalize",children:a.role})]}),a.id===o&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white/50",children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},a.id))]}),jsxs("div",{className:"p-2",children:[jsx("a",{href:`${g.iam}/account`,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Account settings"}),jsx("a",{href:g.billing,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/60 hover:bg-white/[0.06] hover:text-white/80 transition-colors",onClick:()=>c(false),children:"Billing"}),jsx("button",{type:"button",onClick:()=>{c(false),l?.();},className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] text-white/40 hover:bg-white/[0.06] hover:text-red-400/70 transition-colors",children:"Sign out"})]})]})]})}n(ht,"UserOrgDropdown");
3
+ export{Q as AuthGuard,Y as IAMLoginButton,ht as UserOrgDropdown,A as useHanzoAuth};