1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[987,1487,2446,6257],{25164:(e,t,r)=>{r.d(t,{k:()=>i});var n=r(90786);function a(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function i(e){var t;let r={},i="Something went wrong. Please try again.",o=a(t=e)?a(t.data)||"status"in t&&a(t.data)?s(t.data):s(t):null;if(!o)return e instanceof Error&&e.message&&(i=(0,n.eB)(e.message)),{message:i,fieldErrors:r};let l=function(e){if("detail"in e)return e.detail;let t=e.result??e.data;return a(t)&&"detail"in t?t.detail:e.detail}(o);if(Array.isArray(l)){let e=[];for(let t of l){if(!a(t))continue;let i=function(e){let t=String(e.msg??e.message??"").trim();return(0,n.eB)(t)}(t);if(!i)continue;let s=Array.isArray(t.loc)?t.loc:[],o=(0,n.wv)(s);o&&(r[o]=i),e.push(i)}return e.length>0?i=e.join(" "):"string"==typeof o.message&&o.message.trim()&&(i=o.message.trim()),{message:i,fieldErrors:r}}if(a(l)){let e,t=(e=String(l.message??l.error??"").trim(),(0,n.eB)(e)),a="string"==typeof l.field?(0,n.wv)(l.field):null;if(a&&t&&(r[a]=t),t)return{message:i=t,fieldErrors:r}}if("string"==typeof l&&l.trim())return{message:i=(0,n.eB)(l),fieldErrors:r};let u=String(o.message??"").trim(),c=String(o.error??"").trim(),d=/^validation error\b/i.test(u)||/^validation error\b/i.test(c);u&&!d?i=(0,n.eB)(u):c&&!d&&(i=(0,n.eB)(c));let m=o.errors;if(a(m))for(let[e,t]of Object.entries(m)){let a=(0,n.wv)(["body",e]),i=(0,n.eB)(Array.isArray(t)?t.map(String).join(" "):String(t));a&&i&&(r[a]=i)}return{message:i,fieldErrors:r}}function s(e){let t=e;for(let e=0;e<4;e++){if("detail"in t)return t;let e=t.result??t.data;if(!a(e))break;t=e}return e}},38291:(e,t,r)=>{r.d(t,{E:()=>o});var n=r(95155),a=r(18460),i=r(91337);let s=(0,a.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function o({className:e,variant:t,...r}){return(0,n.jsx)("div",{className:(0,i.cn)(s({variant:t}),e),...r})}},39658:(e,t,r)=>{r.d(t,{p:()=>i});var n=r(95155);r(12115);var a=r(91337);function i({className:e,type:t,...r}){return(0,n.jsx)("input",{type:t,"data-slot":"input",className:(0,a.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}},46463:(e,t,r)=>{function n(e){let t=String(e??"").trim();return t?/^[a-z][a-z0-9+.-]*:/i.test(t)?t:t.startsWith("//")?`https:${t}`:`https://${t}`:""}function a(e){return n(e)||void 0}function i(e){let t={...e};return"url"in e&&(t.url=a(e.url)),"image_url"in e&&(t.image_url=a(e.image_url)),t}r.d(t,{Q7:()=>a,_o:()=>n,g0:()=>i})},46739:(e,t,r)=>{r.d(t,{$x:()=>c,AT:()=>p,Mc:()=>f,aj:()=>g,io:()=>d,xM:()=>m});var n=r(60272);function a(e){if(!e||"object"!=typeof e)return"";let t=e.detail??e.error??e.message;if("string"==typeof t)return t;if(Array.isArray(t))return t.map(e=>"object"==typeof e&&e&&"msg"in e?String(e.msg):String(e)).join("; ");let r=e.result?.message;return"string"==typeof r?r:""}function i(){let e=(0,n.iD)();return{accept:"application/json","Content-Type":"application/json",...e?{Authorization:`Bearer ${e}`}:{}}}let s="connectedUsers";function o(e){let t=String(e??(0,n.sE)()?.id??"").trim();return t?`connectedUsers:${t}`:null}function l(e){let t=o(e);if(!t)return[];try{localStorage.removeItem(s);let e=localStorage.getItem(t);if(!e)return[];let r=JSON.parse(e);return Array.isArray(r)?r.map(e=>
1String(e??"").trim()).filter(Boolean):[]}catch{}return[]}function u(e,t){let r=o(t);if(r)try{localStorage.setItem(r,JSON.stringify(e)),localStorage.removeItem(s)}catch{}}async function c(e){let t=String(e??"").trim();if(!t)throw Error("This user has no default clone to connect to");let r=await fetch(`/api/users/userclone/connect/${encodeURIComponent(t)}`,{method:"POST",headers:i(),body:JSON.stringify({})}),n=await r.json().catch(()=>({})),s=a(n),o=s.toLowerCase();if(r.ok){let e=n?.result??n,t=e&&"object"==typeof e?e:{};return{creditsDeducted:Number(t.credits_deducted??1)||1,remainingCredits:"number"==typeof t.remaining_credits?t.remaining_credits:void 0,alreadyConnected:!1}}if(400===r.status&&(o.includes("already connected")||o.includes("already")))return{creditsDeducted:0,alreadyConnected:!0};if(o.includes("insufficient"))throw Error(s||"Insufficient credits to connect");throw Error(s||`Could not connect (${r.status})`)}async function d(e){let t=String(e??"").trim();if(!t)throw Error("No clone to disconnect");let r=await fetch(`/api/users/userclone/disconnect/${encodeURIComponent(t)}`,{method:"DELETE",headers:i()});if(!r.ok&&404!==r.status)throw Error(a(await r.json().catch(()=>({})))||`Could not disconnect (${r.status})`)}function m(e){let t={};for(let r of l(e))t[r]=!0;return t}function f(e,t,r){try{let n=l(r);n.includes(e)||n.push(e);let a=String(t??"").replace(/^@/,"");a&&!n.includes(a)&&n.push(a),u(n,r)}catch{}}function p(e,t,r){try{let n=l(r),a=String(t??"").replace(/^@/,""),i=n.filter(t=>t!==e&&t!==a);u(i,r)}catch{}}function g(e){try{let t=o(e);t&&localStorage.removeItem(t),localStorage.removeItem(s)}catch{}}},66151:(e,t,r)=>{r.d(t,{a:()=>o,m:()=>l});var n=r(12115),a=r(60272),i=r(46739);let s=null;function o(){s=null}function l({enabled:e,cloneFilter:t,searchQuery:r,ratingFourPlusOnly:o,selectedSkills:l,sortBy:u}){let[c,d]=(0,n.useState)(r),m=c.trim().slice(0,50),f=String((0,a.sE)()?.id??"").trim()||null,p=s?.cloneFilter===t&&s?.search===m&&(s?.viewerId??null)===f,[g,h]=(0,n.useState)(()=>p?s.users:[]),[y,b]=(0,n.useState)(()=>p?s.page:1),[w,S]=(0,n.useState)(()=>p?s.total:null),[_,v]=(0,n.useState)(()=>
1!p||s.hasMore),[A,E]=(0,n.useState)(!1),[C,T]=(0,n.useState)(null),[x,I]=(0,n.useState)(()=>(0,i.xM)(f)),N=(0,n.useRef)(0),k=(0,n.useRef)(!1),$=(0,n.useRef)(!!(p&&s&&s.users.length>0)),j=(0,n.useRef)(t),O=(0,n.useRef)(m),M=(0,n.useRef)(f),D=(0,n.useRef)(g.length);D.current=g.length,(0,n.useEffect)(()=>{M.current!==f&&(M.current=f,s=null,I((0,i.xM)(f)),h([]),b(1),S(null),v(!0),$.current=!1)},[f]),(0,n.useEffect)(()=>{I((0,i.xM)(f))},[f]),(0,n.useEffect)(()=>{let e=window.setTimeout(()=>d(r.slice(0,50)),300);return()=>window.clearTimeout(e)},[r]),(0,n.useEffect)(()=>{(j.current!==t||O.current!==m)&&(j.current=t,O.current=m,b(1),v(!0),S(null),h([]),T(null),E(!0),$.current=!1,s=null)},[t,m]),(0,n.useEffect)(()=>{if(!e||1===y&&$.current&&D.current>0)return;let r=++N.current,n=new AbortController;return async function(){E(!0),T(null);try{let e=(0,a.iD)(),o=new URLSearchParams({page:String(y),page_size:String(12),filter:"connected"===t?"connected":"all"});m&&o.set("search",m);let l=await fetch(`/api/users/networks/users?${o.toString()}`,{method:"GET",signal:n.signal,headers:{accept:"application/json",...e?{Authorization:`Bearer ${e}`}:{}}});if(!l.ok)throw Error(502===l.status?"Network directory timed out. Please retry.":`Failed to fetch network users (${l.status})`);if(r!==N.current)return;let u=await l.json(),c=u?.result??u,d=c?.data??c?.results??c?.items??(Array.isArray(c)?c:[]),p=c?.total??u?.total??(Array.isArray(u)?u.length:null),g=Number(c?.total_pages??u?.total_pages),b=Number.isFinite(g)?g:null,w=(Array.isArray(d)?d:[]).map((e,t)=>(function(e,t,r){if(!e||"object"!=typeof e)return null;let n=function(e,t,r){let n=e.id??e.user?.id;if(null!=n&&String(n).trim())return String(n).trim();let a=e.username??e.user?.email?.split("@")[0]??null,i="string"==typeof a&&a.startsWith("@")?a.slice(1):a;if("string"==typeof i&&i.trim())return`username:${i.trim().toLowerCase()}`;let s=e.user?.email;return"string"==typeof s&&s.trim()?`email:${s.trim().toLowerCase()}`:`page-${r}-row-${t}`}(e,t,r);if(!n)return null;let a=String(e.fullName??e.user?.name??e.name??"Unknown"),i=e.username??e.user?.email?.split("@")[0]??"user",s="string"==typeof i&&i.startsWith("@")?i.slice(1):String(i),o=e.default_clone,l="string"==typeof e.image&&e.image||"string"==typeof o?.avatar&&o.avatar||"string"==typeof e.user?.avatar&&e.user.avatar||void 0,u=!!(e.isVerified??e.is_verified??e.user?.is_verified),c=e.user?.hma_rating??{},d=Number(c.avg_rating),m=Number(c.ratings_count),f=Number(c.hma_score),p=Number.isFinite(d)?d:4.5*!!u,g=Number.isFinite(m)?m:0,h=Number.isFinite(f)?f:null,y=Array.isArray(e.skills)?e.skills.map(e=>"string"==typeof e?e:String(e?.name??"").trim()).filter(e=>e.length>0):[],b=o?.activeUserTemplateId??o?.active_user_template_id??e.activeUserTemplateId??e.active_user_template_id??null,w=o?.appliedUserTemplates??o?.applied_user_templates??e.appliedUserTemplates??e.applied_user_templates,S=!!(!0===(o?.has_dialog_setup??o?.dialog_configured??e.has_dialog_setup??e.dialog_configured)||b||Array.isArray(w)&&w.length>0);return{id:n,name:a,username:s,avatar:l,bio:String(o?.about_us??"").trim()||String(e.description??o?.description??"").trim(),isVerified:u,rating:p,ratingsCount:g,hmaScore:h,clones:Number(e.connected_clones_count??e.connected_clones?.length??0),environments:0,isOnline:!0,lastSeen:!0===e.connected?"Connected":"â",skills:y,isConnected:!0===e.connected,isOwned:!0===e.isOwned||!0===e.is_owned||!0===e.owned,default_clone_id:String(e.default_clone_id??o?.id??"")||void 0,hasDialogSetup:S,_api:e}})(e,t,y)).filter(e=>null!=e),_="number"==typeof p?p:null,A="number"==typeof b?y<b:null,E="number"==typeof p?12*y<p:null,C=w.length>=12,T=A??E??C;h(e=>{let r,n,a=y<=1?w:(r=[...e],n=new Set(e.map(e=>String(e.id))),w.forEach(e=>{let t=String(e.id);n.has(t)||(r.push(e),n.add(t))}),r);return s={users:a,page:y,total:_,hasMore:T,cloneFilter:t,search:m,viewerId:f},a}),S(_),v(T),I(e=>{let t={...e};return w.forEach(e=>{let r=String(e.username??"").replace(/^@/,"");e.isConnected?(t[e.id]=!0,r&&(t[r]=!0),(0,i.Mc)(e.id,e.username,f)):(t[e.id]&&delete t[e.id],r&&t[r]&&delete t[r],(0,i.AT)(e.id,e.username,f))}),t}),$.current=!0}catch(e){if(n.signal.aborted||r!==N.current)return;T(e instanceof Error?e.message:"Failed to load users"),y<=1&&h([]),v(!1)}finally{r===N.current&&(E(!1),k.current=!1)}}(),()=>n.abort()},[e,y,t,m,f]);let U=(0,n.useMemo)(()=>{let e=new Set;return g.forEach(t=>
1{t.skills.forEach(t=>{let r=String(t||"").trim();r&&e.add(r)})}),Array.from(e).sort((e,t)=>e.localeCompare(t))},[g]),B=(0,n.useMemo)(()=>{let e=l.map(e=>e.toLowerCase());return g.filter(r=>{let n="connected"!==t||!!(x[r.id]||x[r.username]),a=!o||Number(r.rating||0)>=4,i=r.skills.map(e=>e.toLowerCase()),s=0===e.length||e.some(e=>i.includes(e));return n&&a&&s})},[g,t,o,l,x]),P=(0,n.useMemo)(()=>{let e=[...B];switch(u){case"rating":return e.sort((e,t)=>Number(t.rating||0)-Number(e.rating||0));case"alphabetical":return e.sort((e,t)=>String(e.name||"").localeCompare(String(t.name||"")));case"popular":return e.sort((e,t)=>Number(t.clones||0)-Number(e.clones||0));case"connected":return e.sort((e,t)=>{let r=x[e.id]||x[e.username]?1:0;return(x[t.id]||x[t.username]?1:0)-r});default:return e}},[B,u,x]),F=e&&A&&1===y&&0===g.length&&!C,R=e&&A&&g.length>0,L=(0,n.useCallback)(()=>{e&&!A&&_&&!k.current&&(k.current=!0,b(e=>e+1))},[e,A,_]),z=(0,n.useCallback)(()=>{e&&(T(null),v(!0),b(1),h([]),E(!0),$.current=!1,s=null)},[e]),V=(0,n.useCallback)(async e=>{let t=String(e.default_clone_id||e._api?.default_clone_id||e._api?.default_clone?.id||"").trim();if(!t)throw Error("This user has no default clone to connect to");let r=await (0,i.$x)(t);return I(t=>({...t,[e.id]:!0,...e.username?{[e.username]:!0}:{}})),(0,i.Mc)(e.id,e.username,f),h(t=>t.map(t=>t.id===e.id?{...t,isConnected:!0}:t)),r},[f]),q=(0,n.useCallback)(e=>!!(e.isConnected||x[e.id]||x[e.username]),[x]);return{users:P,availableSkills:U,total:w,hasMore:_,loading:F,loadingMore:R,error:C,retry:z,loadMore:L,connectUser:V,isUserConnected:q,hasClientFilters:o||l.length>0,hasActiveSearch:m.length>0,loadedCount:g.length,pageSize:12}}},76257:(e,t,r)=>{r.r(t),r.d(t,{performLogout:()=>c});var n=r(96905),a=r(74356),i=r(98584),s=r(7886),o=r(60272),l=r(46739),u=r(66151);async function c(e="/login?switch_account=1"){let t=String((0,o.sE)()?.id??"").trim()||null;(0,l.aj)(t),(0,u.a)(),(0,o.m_)();try{s.M.dispatch(a.q.util.resetApiState())}catch{}try{await (0,n.CI)(i.j)}catch{}window.location.replace(e)}},79792:(e,t,r)=>{r.d(t,{J:()=>s});var n=r(95155);r(12115);var a=r(29486),i=r(91337);function s({className:e,...t}){return(0,n.jsx)(a.b,{"data-slot":"label",className:(0,i.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}},81890:(e,t,r)=>{r.d(t,{dj:()=>d});var n=r(12115);let a=0,i=new Map,s=e=>{if(i.has(e))return;let t=setTimeout(()=>{i.delete(e),u({type:"REMOVE_TOAST",toastId:e})},1e6);i.set(e,t)},o=[],l={toasts:[]};function u(e){l=((e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?s(r):e.toasts.forEach(e=>{s(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}})(l,e),o.forEach(e=>{e(l)})}let c=({...e})=>(function({...e}){let t=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),r=()=>u({type:"DISMISS_TOAST",toastId:t});return u({type:"ADD_TOAST",toast:{...e,id:t,open:!0,duration:5e3,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:e=>u({type:"UPDATE_TOAST",toast:{...e,id:t}})}})({...e,onOpenChange:t=>{e.onOpenChange&&e.onOpenChange(t)}});function d(){let[e,t]=n.useState(l);return n.useEffect(()=>(o.push(t),()=>{let e=o.indexOf(t);e>-1&&o.splice(e,1)}),[e]),{...e,toast:c,dismiss:e=>u({type:"DISMISS_TOAST",toastId:e})}}},90786:(e,t,r)=>{r.d(t,{$T:()=>n,Bd:()=>o,Ze:()=>f,eB:()=>m,fY:()=>d,oZ:()=>u,wv:()=>g,zu:()=>p});let n=8,a=/[#$@!%^&*]/,i=/[A-Z]/,s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,o=/^[a-zA-Z0-9_-]{3,30}$/,l="#$@!%^&*".split("").join(", ");function u(e){return[{id:"minLength",label:`At least ${n} characters`,met:e.length>=n},{id:"uppercase",label:"At least 1 uppercase letter",met:i.test(e)},{id:"lowercase",label:"At least 1 lowercase letter",met:/[a-z]/.test(e)},{id:"number",label:"At least 1 number",met:/\d/.test(e)},{id:"specialChar",label:`At least 1 special character (${l})`,met:a.test(e)}]}let c={minLength:`password must be at least ${n} characters long`,uppercase:"password must contain at least 1 uppercase letter",lowercase:"password must contain at least 1 lowercase letter",number:"password must contain at least 1 number",specialChar:`password must contain at least 1 special character (e.g., ${l})`};function d(e){return u(e).every(e=>e.met)}function m(e){let t=String(e??"").trim();return t&&((t=(t=(t=t.replace(/^Value error,\s*/i,"")).replace(/^Validation error[:\s-]*/i,"")).trim()).length>0&&(t=t.charAt(0).toUpperCase()+t.slice(1)),/[.!?]$/.test(t)||(t+=".")),t}function f(e){let t={},r=e.name.trim(),n=e.username.trim(),a=e.email.trim(),i=e.password,l=e.confirmPassword;r?r.length<2&&(t.name="Full name must be at least 2 characters."):t.name="Full name is required.",n?o.test(n)||(t.username="Use 3â30 characters: letters, numbers, underscores, and hyphens."):t.username="Username is required.",a?s.test(a)||(t.email="Enter a valid email address."):t.email="Email is required.";let d=function(e){if(!e)return"Password is required.";let t=u(e).find(e=>!e.met);if(!t)return null;let r=c[t.id];return r?m(r):null}(i);return d&&(t.password=d),l?i!==l&&(t.confirmPassword="Passwords do not match."):t.confirmPassword="Please confirm your password.",t}function p(e){for(let t of["name","username","email","password","confirmPassword"])if(e[t])return e[t];return null}function g(e){let t=Array.isArray(e)?e.map(e=>String(e).toLowerCase()):[String(e).toLowerCase()],r=t[t.length-1];return"name"===r?"name":"username"===r?"username":"email"===r?"email":"password"===r||"current_password"===r||"new_password"===r?"password":"confirm_password"===r||"confirmpassword"===r?"confirmPassword":null}},98584:(e,t,r)=>{let n;r.d(t,{j:()=>s});var a=r(97873),i=r(96905);n=0===(0,a.Dk)().length?(0,a.Wp)({apiKey:"AIzaSyBODY80Qnzo-302alF2-wBvHoAioUvAXQI",authDomain:"aphid-staging.firebaseapp.com",projectId:"aphid-staging",storageBucket:"aphid-staging.appspot.com",messagingSenderId:"1087066125394",appId:"your_web_app_id_here"}):(0,a.Dk)()[0];let s=(0,i.xI)(n)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.