PageSourceSearch

https://vrsa.app/assets/FingerprintPanel-Cxq5FXen.js

js vrsa.app collected 2026-10-02 00:25:42 UTC 114,373 bytes, 5 lines download raw bytes

1import{c as z,s as rn,L as R,I as bt,C as Yn,j as t,a as $,T as Jn,r as m,b as Ce,d as Le,e as et,f as an,h as ae,R as tt,F as nt,U as st,S as Wn,A as on,g as ln,i as cn,k as dn,l as un,m as mn,n as pn,o as fn,E as Xn,p as pe,q as _t,t as Qn,u as hn,B as xn,v as Zn,w as bn,K as es}from"./index-QLSbBzCG.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"f5c7ab7ebf08f618c9b156b88e1c35f1a6bf8616"};var n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fd990125-b5fe-4b3b-bb58-189aa2e40275",e._sentryDebugIdIdentifier="sentry-dbid-fd990125-b5fe-4b3b-bb58-189aa2e40275")}catch{}})();const ts=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ns=z("activity",ts);const ss=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],is=z("globe",ss);const rs=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],as=z("layout-dashboard",rs);const os=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],it=z("link-2",os);const ls=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],we=z("radar",ls);const cs=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ds=z("settings-2",cs);const us=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ms=z("smartphone",us);const ps=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],fs=z("user-round",ps);const hs=[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]],xs=z("user-search",hs);const bs=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],_s=z("webhook",bs),gs="fingerprint-admin",ys=/^[A-Za-z0-9._-]+$/,vs=/^[A-Za-z0-9]{20}$/,Ss=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,js=e=>typeof e=="string"&&e.length>=1&&e.length<=64&&ys.test(e),he=e=>typeof e=="string"&&vs.test(e),Ns=e=>typeof e=="string"&&Ss.test(e),_n=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],ks=["regional_activity","suspect_score","timestamps"],As=["any","true","false"],rt=[{id:"health",label:"Health",description:"Management API reachability and status",redacted:[]},{id:"api_keys",label:"API keys",description:"Public, secret and management keys — tokens are reduced to a four-character hint",redacted:["token"]},{id:"environments",label:"Environments",description:"Workspace environments",redacted:[]},{id:"webhooks",label:"Webhooks",description:"Webhook endpoints — signing keys and basic-auth credentials are redacted",redacted:["signing_key","basic_auth"]},{id:"filtering_rules",label:"Filtering rules",description:"Request filtering rules per environment",redacted:[]},{id:"subdomains",label:"Subdomains",description:"Custom subdomains and their certificate status",redacted:[]},{id:"encryption_keys",label:"Encryption keys",description:"Sealed-results encryption keys — key material is redacted",redacted:["token","previous_token","next_token"]}],Es=new Set(rt.map(e=>e.id)),Cs=["advertising_and_marketing","aggregator","ai_agent","ai_assistant","ai_browser","ai_crawler","ai_search","browser_automation","ecommerce","monitoring_and_analytics","other","scraping","security","search_engine_crawler","search_engine_optimization","unknown"],Ls=["verified","signed","spoofed","unknown"],ws=["low","medium","high"],Is=["<p95","p95-p99","p99-p99.5","p99.5-p99.9","p99.9+","not_seen"],gn=[{name:"limit",label:"Limit",kind:"number",group:"paging",placeholder:"20",help:"1–100 events per page"},{name:"pagination_key",label:"Pagination key",kind:"text",group:"paging",help:"Returned with the previous page"},{name:"visitor_id",label:"Visitor id",kind:"text",group:"identity",placeholder:"Ibk1527CUFmcnjLwIs4A"},{name:"high_recall_id",label:"High recall id",kind:"text",group:"identity"},{name:"bot",label:"Bot",kind:"enum",group:"bot",options:["all","good","bad","none"]},{name:"bot_info",label:"Bot info",kind:"enum",group:"bot",options:["all","none"]},{name:"bot_info_category",label:"Bot category",kind:"multi",group:"bot",options:Cs},{name:"bot_info_identity",label:"Bot identity",kind:"multi",group:"bot",options:Ls},{name:"bot_info_confidence",label:"Bot confidence",kind:"multi",group:"bot",options:ws},{name:"bot_info_provider",label:"Bot provider",kind:"multi",group:"bot",help:"One provider per entry"},{name:"bot_info_name",label:"Bot name",kind:"multi",group:"bot",help:"One name per entry"},{name:"ip_address",label:"IP address",kind:"text",group:"network"},{name:"asn",label:"ASN",kind:"text",group:"network"},{name:"linked_id",label:"Linked id",kind:"text",group:"identity",help:"Supabase user id on account-linked events"},{name:"url",label:"URL",kind:"text",group:"identity"},{name:"bundle_id",label:"Bundle id",kind:"text",group:"mobile",help:"iOS"},{name:"package_name",label:"Package name",kind:"text",group:"mobile",help:"Android"},{name:"origin",label:"Origin",kind:"text",group:"identity"},{name:"start",label:"Start",kind:"datetime",group:"time",help:"RFC 3339 or Unix milliseconds"},{name:"end",label:"End",kind:"datetime",group:"time",help:"RFC 3339 or Unix milliseconds"},{name:"reverse",label:"Reverse order",kind:"bool",group:"time"},{name:"suspect",label:"Suspect",kind:"bool",group:"signals"},{name:"vpn",label:"VPN",kind:"bool",group:"network"},{name:"virtual_machine",label:"Virtual machine",kind:"bool",group:"signals"},{name:"tampering",label:"Tampering",kind:"bool",group:"signals"},{name:"anti_detect_browser",label:"Anti-detect browser",kind:"bool",group:"signals"},{name:"incognito",label:"Incognito",kind:"bool",group:"signals"},{name:"privacy_settings",label:"Privacy settings",kind:"bool",group:"signals"},{name:"jailbroken",label:"Jailbroken",kind:"bool",group:"mobile"},{name:"frida",label:"Frida",kind:"bool",group:"mobile"},{name:"factory_reset",label:"Factory reset",kind:"bool",group:"mobile"},{name:"cloned_app",label:"Cloned app",kind:"bool",group:"mobile"},{name:"emulator",label:"Emulator",kind:"bool",group:"mobile"},{name:"root_apps",label:"Root apps",kind:"bool",group:"mobile"},{name:"vpn_confidence",label:"VPN confidence",kind:"enum",group:"network",options:["high","medium","low"]},{name:"min_suspect_score",label:"Minimum suspect score",kind:"number",group:"signals",help:"0 or more"},{name:"developer_tools",label:"Developer tools",kind:"bool",group:"signals"},{name:"location_spoofing",label:"Location spoofing",kind:"bool",group:"mobile"},{name:"mitm_attack",label:"MitM attack",kind:"bool",group:"mobile"},{name:"rare_device",label:"Rare device",kind:"bool",group:"signals"},{name:"rare_device_percentile_bucket",label:"Rare device bucket",kind:"enum",group:"signals",options:Is},{name:"proxy",label:"Proxy",kind:"bool",group:"network"}
1,{name:"sdk_version",label:"SDK version",kind:"text",group:"sdk"},{name:"sdk_platform",label:"SDK platform",kind:"enum",group:"sdk",options:["js","android","ios"]},{name:"environment",label:"Environment",kind:"multi",group:"sdk",help:"One environment id per entry"},{name:"proximity_id",label:"Proximity id",kind:"text",group:"identity"},{name:"total_hits",label:"Total hits",kind:"number",group:"paging",help:"Count matches up to this many (1–1000)"},{name:"tor_node",label:"Tor node",kind:"bool",group:"network"},{name:"incremental_identification_status",label:"Incremental identification",kind:"enum",group:"identity",options:["partially_completed","completed"]},{name:"simulator",label:"Simulator",kind:"bool",group:"mobile"},{name:"active_call",label:"Active call",kind:"bool",group:"mobile"},{name:"source",label:"Source",kind:"multi",group:"sdk",options:["edge"],help:"Automation Intelligence (edge) events only"}],Ts=e=>e===""||e===null||e===void 0||e==="any"||typeof e=="string"&&e.trim()==="";function gt(e){const n={};if(!e||typeof e!="object")return n;for(const s of gn){const i=e[s.name];if(!Ts(i))switch(s.kind){case"number":{const r=typeof i=="number"?i:Number(String(i).trim());if(!Number.isFinite(r))break;n[s.name]=s.name==="limit"?Math.min(100,Math.max(1,Math.trunc(r))):r;break}case"bool":{i===!0||i==="true"?n[s.name]=!0:(i===!1||i==="false")&&(n[s.name]=!1);break}case"multi":{if(!Array.isArray(i))break;const r=i.filter(a=>typeof a=="string"&&a.trim()!=="").map(a=>a.trim());r.length>0&&(n[s.name]=r);break}case"datetime":n[s.name]=typeof i=="string"?i.trim():i;break;default:{const r=typeof i=="string"?i.trim():String(i);r!==""&&r!=="any"&&(n[s.name]=r)}}}return n}function Rs(e){if(typeof e!="string")return[];const n=[];for(const s of e.split(/\r?\n/)){const i=s.indexOf(":");if(i<0)continue;const r=s.slice(0,i).trim();r&&n.push({name:r,value:s.slice(i+1).trim()})}return n}const yn=e=>{const n=typeof e=="string"&&e.trim()!==""?Number(e):e;if(typeof n!="number"||!Number.isFinite(n)||n<=0)return null;const s=new Date(n);return Number.isNaN(s.getTime())?null:s.toISOString()},Ds=e=>yn(e)??"—",N=e=>{if(e==null||e==="")return"—";const n=new Date(e);return Number.isNaN(n.getTime())?"—":n.toISOString().replace("T"," ").replace(/\.\d{3}Z$/," UTC")},ke=(e,n=8)=>{if(e==null||e==="")return"—";const s=String(e);return s.length<=n?s:`${s.slice(0,n)}…`},A=(e,n)=>n.split(".").reduce((s,i)=>s?.[i],e),w=e=>e===void 0?null:e,at=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},me=(...e)=>{const n=e.filter(s=>typeof s=="string"&&s.trim()!==""||typeof s=="number");return n.length>0?n.join(" "):null},vn=e=>A(e,"ip_info.v4.datacenter_result")===!0||A(e,"ip_info.v6.datacenter_result")===!0,$s=[["vpn","vpn"],["proxy","proxy"],["tampering","tampering"],["anti_detect_browser","tampering_details.anti_detect_browser"],["incognito","incognito"],["virtual_machine","virtual_machine"],["privacy_settings","privacy_settings"],["developer_tools","developer_tools"],["high_activity_device","high_activity_device"],["rare_device","rare_device"],["replayed","replayed"],["tor_node","ip_blocklist.tor_node"],["attack_source","ip_blocklist.attack_source"],["email_spam","ip_blocklist.email_spam"],["datacenter",null],["emulator","emulator"],["simulator","simulator"],["cloned_app","cloned_app"],["jailbroken","jailbroken"],["frida","frida"],["root_apps","root_apps"],["location_spoofing","location_spoofing"],["mitm_attack","mitm_attack"],["active_call","active_call"]];function ot(e){const n=at(e),s=A(n,"ip_info.v4.geolocation")??A(n,"ip_info.v6.geolocation")??null,i=A(n,"browser_details.browser_name"),r=A(n,"browser_details.os")??n.os,a=A(n,"browser_details.os_version")??n.os_version;return{eventId:w(n.event_id),timestamp:w(n.timestamp),time:yn(n.timestamp),visitorId:w(A(n,"identification.visitor_id")),linkedId:w(n.linked_id),ipAddress:w(n.ip_address??A(n,"ip_info.v4.address")??A(n,"ip_info.v6.address")),country:w(s?.country_name??s?.country_code),city:w(s?.city_name),browser:i?me(i,A(n,"browser_details.browser_major_version")):null,os:r?me(r,a):null,device:w(A(n,"browser_details.device")??n.device),bot:w(n.bot),botCategory:w(A(n,"bot_info.category")),suspect:w(n.suspect),suspectScore:w(n.suspect_score),confidence:w(A(n,"identification.confidence.score")),visitorFound:w(A(n,"identification.visitor_found")),flags:$s.filter(([,o])=>o?A(n,o)===!0:vn(n)).map(([o])=>o),source:w(n.source),sdkPlatform:w(A(n,"sdk.platform")),url:w(n.url)}}const Os=new Set(["tampering","tampering_details.anti_detect_browser","virtual_machine","ip_blocklist.tor_node","ip_blocklist.attack_source","ip_blocklist.email_spam","mitm_attack","frida","cloned_app","emulator","simulator","jailbroken","root_apps","location_spoofing","replayed","suspect"]),Fs=new Set(["vpn","proxy","incognito","privacy_settings","developer_tools","high_activity_device","rare_device","ip_info.v4.datacenter_result","ip_info.v6.datacenter_result"]),Bs=(e,n,s)=>{if(!s)return"none";if(e==="bot")return n==="bad"?"bad":n==="good"?"warn":"info";if(n===!0){if(Os.has(e))return"bad";if(Fs.has(e))return"warn"}return"info"},Ps=e=>Array.isArray(e)?e.map(n=>!n||typeof n!="object"?String(n):me(n.name,n.iso_code?`(${n.iso_code})`:null)??""):e,Us=e=>Array.isArray(e)?e.map(n=>{if(!n||typeof n!="object")return String(n);const s=me(n.name,n.version)??"unknown",i=n.subintegration?me(n.subintegration.name,n.subintegration.version):null;return i?`${s} (${i})`:s}):e,Ms=e=>Array.isArray(e)?e.map(n=>!n||typeof n!="object"?String(n):[n.label,n.prediction,n.ml_score].filter(s=>s!=null).map(String).join(" ")):e,yt=e=>{const n=`ip_info.${e}`;return[[`${n}.address`,"Address","text"],[`${n}.geolocation.accuracy_radius`,"Accuracy radius","number"],[`${n}.geolocation.latitude`,"Latitude","number"],[`${n}.geolocation.longitude`,"Longitude","number"],[`${n}.geolocation.postal_code`,"Postal code","text"],[`${n}.geolocation.timezone`,"Timezone","text"],[`${n}.geolocation.city_name`,"City","text"],[`${n}.geolocation.country_code`,"Country code","text"],[`${n}.geolocation.country_name`,"Country","text"],[`${n}.geolocation.continent_code`,"Continent code","text"],[`${n}.geolocation.continent_name`,"Continent","text"],[`${n}.geolocation.subdivisions`,"Subdivisions","list",Ps],[`${n}.asn`,"ASN","text"],[`${n}.asn_name`,"ASN name","text"],[`${n}.asn_network`,"ASN network","text"],[`${n}.asn_type`,"ASN type","text"],[`${n}.datacenter_result`,"Datacenter","bool"],[`${n}.datacenter_name`,"Datacenter name","text"]]},Vs=[["distinct_ip","Distinct IPs"],["distinct_linked_id","Distinct linked ids"],["distinct_country","Distinct countries"],["events","Events"],["ip_events","IP events"],["distinct_ip_by_linked_id","Distinct IPs by linked id"],["distinct_visitor_id_by_linked_id","Distinct visitor ids by linked id"]],zs=[["5_minutes","5 min"],["1_hour","1 h"],["24_hours","24 h"]],qs=()=>Vs.flatMap(([e,n])=>zs.map(([s,i])=>[`velocity.${e}.${s}`,`${n} · ${i}`,"number"])),Hs=[{id:"identification",title:"Identification",fields:[["identification.visitor_id","Visitor id","text"],["identification.visitor_found","Visitor found","bool"],["identification.confidence.score","Confidence score","score"],["identification.confidence.version","Confidence version","text"],["identification.confidence.comment","Confidence comment","text"],["identification.first_seen_at","First seen","time"],["identification.last_seen_at","Last seen","time"],["incremental_identification_status","Incremental identification","enum"]]},{id:"high_recall",title:"High recall id",note:"Supplementary id tuned for recall over precision",fields:[["supplementary_id_high_recall.visitor_id","Visitor id","text"],["supplementary_id_high_recall.visitor_found","Visitor found","bool"],["supplementary_id_high_recall.confidence.score","Confidence score","score"],["supplementary_id_high_recall.first_seen_at","First seen","time"],["supplementary_id_high_recall.last_seen_at","Last seen","time"]]},{id:"request",title:"Request",fields:[["event_id","Event id","text"],["timestamp","Timestamp","time"],["source","Source","enum"],["environment_id","Environment id","text"],["linked_id","Linked id","text"],["tags","Tags","json"],["url","URL","text"],["client_referrer","Referrer","text"],["ip_address","IP address","text"],["user_agent","User agent","text"],["replayed","Replayed","bool"],["suspect","Suspect","bool"],["bundle_id","Bundle id","text"],["package_name","Package name","text"]]},{id:"sdk",title:"SDK",fields:[["sdk.platform","Platform","enum"],["sdk.version","Version","text"],["sdk.integrations","Integrations","list",Us]]},{id:"browser_device",title:"Browser and device",fields:[["browser_details.browser_name","Browser","text"],["browser_details.browser_major_version","Browser major version","text"],["browser_details.browser_full_version","Browser full version","text"],["browser_details.os","OS","text"],["browser_details.os_version","OS version","text"],["browser_details.device","Device","text"],["device","Device (top level)","text"],["os","OS (top level)","text"],["os_version","OS version (top level)","text"]]},{id:"bot",title:"Bot detection",fields:[["bot","Bot","enum"],["bot_type","Bot type","text"],["bot_info.category","Category","enum"],["bot_info.provider","Provider","text"],["bot_info.provider_url","Provider URL","text"],["bot_info.name","Name","text"],["bot_info.identity","Identity","enum"],["bot_info.confidence","Confidence","enum"]]},{id:"network_v4",title:"Network (IPv4)",fields:yt("v4")},{id:"network_v6",title:"Network (IPv6)",fields:yt("v6")},{id:"vpn",title:"VPN",fields:[["vpn","VPN","bool"],["vpn_confidence","Confidence","enum"],["vpn_ml_score","ML score","score"],["vpn_origin_t
1imezone","Origin timezone","text"],["vpn_origin_country","Origin country","text"],["vpn_methods.timezone_mismatch","Timezone mismatch","bool"],["vpn_methods.public_vpn","Public VPN","bool"],["vpn_methods.auxiliary_mobile","Auxiliary mobile","bool"],["vpn_methods.os_mismatch","OS mismatch","bool"],["vpn_methods.relay","Relay","bool"],["vpn_methods.ml_prediction","ML prediction","bool"]]},{id:"proxy",title:"Proxy",fields:[["proxy","Proxy","bool"],["proxy_confidence","Confidence","enum"],["proxy_ml_score","ML score","score"],["proxy_details.proxy_type","Proxy type","enum"],["proxy_details.last_seen_at","Last seen","time"],["proxy_details.provider","Provider","text"]]},{id:"ip_blocklist",title:"IP blocklist",fields:[["ip_blocklist.email_spam","Email spam","bool"],["ip_blocklist.attack_source","Attack source","bool"],["ip_blocklist.tor_node","Tor node","bool"]]},{id:"tampering",title:"Tampering",fields:[["tampering","Tampering","bool"],["tampering_confidence","Confidence","enum"],["tampering_ml_score","ML score","score"],["tampering_details.anomaly_score","Anomaly score","score"],["tampering_details.anti_detect_browser","Anti-detect browser","bool"]]},{id:"browser_state",title:"Browser state",fields:[["incognito","Incognito","bool"],["privacy_settings","Privacy settings","bool"],["developer_tools","Developer tools","bool"],["virtual_machine","Virtual machine","bool"],["virtual_machine_ml_score","Virtual machine ML score","score"],["rare_device","Rare device","bool"],["rare_device_percentile_bucket","Rare device bucket","enum"],["high_activity_device","High-activity device","bool"]]},{id:"mobile",title:"Mobile",note:"Android and iOS SDK signals; a factory reset timestamp of 0 means never reset",fields:[["emulator","Emulator","bool"],["simulator","Simulator","bool"],["cloned_app","Cloned app","bool"],["jailbroken","Jailbroken","bool"],["frida","Frida","bool"],["root_apps","Root apps","bool"],["factory_reset_timestamp","Factory reset","time"],["location_spoofing","Location spoofing","bool"],["mitm_attack","MitM attack","bool"],["active_call","Active call","bool"]]},{id:"velocity",title:"Velocity",fields:qs()},{id:"risk",title:"Risk",fields:[["suspect_score","Suspect score","number"],["labels","Labels","list",Ms]]},{id:"proximity",title:"Proximity",fields:[["proximity.id","Proximity id","text"],["proximity.precision_radius","Precision radius","number"],["proximity.confidence","Confidence","score"]]},{id:"rule_action",title:"Rule action",fields:[["rule_action.type","Type","enum"],["rule_action.ruleset_id","Ruleset id","text"],["rule_action.rule_id","Rule id","text"],["rule_action.rule_expression","Rule expression","text"],["rule_action.status_code","Status code","number"]]},{id:"raw_device_attributes",title:"Raw device attributes",fields:[["raw_device_attributes","Raw device attributes","json"]]}],Gs=(e,[n,s,i,r])=>{const a=A(e,n),o=a!=null;return{key:n,label:s,value:o?r?r(a):a:null,kind:i,present:o,severity:Bs(n,a,o)}};function Sn(e){const n=at(e);return Hs.map(({id:s,title:i,note:r,fields:a})=>({id:s,title:i,...r?{note:r}:{},items:a.map(o=>Gs(n,o))}))}const Ks="docs.fingerprint.com/docs/suspect-score",Ys=[{signal:"bot",field:"bot == bad",weight:7},{signal:"incognito",field:"incognito",weight:4},{signal:"vpn_timezone_mismatch",field:"vpn_methods.timezone_mismatch",weight:3},{signal:"vpn_public_vpn",field:"vpn_methods.public_vpn",weight:4},{signal:"vpn_relay",field:"vpn_methods.relay",weight:4},{signal:"tampering",field:"tampering",weight:8},{signal:"anti_detect_browser",field:"tampering_details.anti_detect_browser",weight:8},{signal:"virtual_machine",field:"virtual_machine",weight:14},{signal:"developer_tools",field:"developer_tools",weight:8},{signal:"privacy_settings",field:"privacy_settings",weight:6},{signal:"email_spam",field:"ip_blocklist.email_spam",weight:14},{signal:"attack_source",field:"ip_blocklist.attack_source",weight:13},{signal:"tor_node",field:"ip_blocklist.tor_node",weight:14},{signal:"datacenter_proxy",field:"ip_info.v4.datacenter_result || ip_info.v6.datacenter_result || proxy_details.proxy_type == data_center",weight:14},{signal:"residential_proxy",field:"proxy_details.proxy_type == residential",weight:6},{signal:"high_activity_device",field:"high_activity_device",weight:6}],Js={bot:e=>e.bot==="bad",datacenter_proxy:e=>vn(e)||A(e,"proxy_details.proxy_type")==="data_center",residential_proxy:e=>A(e,"proxy_details.proxy_type")==="residential"};function Ws(e){const n=at(e);return Ys.map(({signal:s,field:i,weight:r})=>{const a=Js[s];return{signal:s,weight:r,triggered:a?a(n):A(n,i)===!0}})}const se=(e,n,s=null,i=null)=>({data:null,error:{code:e,message:n,status:s,retryAfter:i}}),Xs="The request was rejected before reaching the function.",Qs=async e=>{if(!e||typeof e.json!="function")return null;try{const n=await e.json();return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}},Zs=e=>{const n=e?.headers;if(!n||typeof n.get!="function")return null;try{return n.get("Retry-After")??null}catch{return null}},ei=async e=>{const n=e?.name;if(n==="FunctionsHttpError"){const s=e.context?.status??null,i=await Qs(e.context),r=typeof i?.error=="string"?i.error:null,a=i?.retry_after??Zs(e.context)??null;return!r&&s===404?{code:"function_not_deployed",message:"The fingerprint-admin function is not deployed yet",status:s,retryAfter:a}:r?{code:r,message:typeof i?.message=="string"?i.message:"",status:s,retryAfter:a}:{code:`http_${s??"unknown"}`,message:Xs,status:s,retryAfter:a}}return n==="FunctionsFetchError"?{code:"network",message:"Could not reach the fingerprint-admin function",status:null,retryAfter:null}:n==="FunctionsRelayError"?{code:"relay",message:"The Supabase relay rejected the request",status:e.context?.status??null,retryAfter:null}:{code:"unexpected",message:"Unexpected error while calling the fingerprint-admin function",status:e?.context?.status??null,retryAfter:null}};async function F(e,n={}
1){const s={action:e,params:n&&typeof n=="object"&&!Array.isArray(n)?n:{}};let i;try{i=await rn.functions.invoke(gs,{body:s})}catch(o){return console.warn("fingerprint-admin call failed",{action:e,code:"unexpected",name:o?.name??null}),se("unexpected","Unexpected error while calling the fingerprint-admin function")}const{data:r,error:a}=i??{};return a?{data:null,error:await ei(a)}:!r||typeof r!="object"||typeof r.ok!="boolean"?se("invalid_response","Unexpected response from the fingerprint-admin function"):r.ok?{data:r.data===void 0?null:r.data,error:null}:se(typeof r.error=="string"?r.error:"request_failed",typeof r.message=="string"?r.message:"",null,r.retry_after??null)}const ti=()=>F("config_status");function vt(e,{rulesetId:n}={}){const s={event_id:e};return typeof n=="string"&&n.trim()!==""&&(s.ruleset_id=n.trim()),F("get_event",s)}const lt=e=>F("search_events",e??{});function ni(e,{linkedId:n,tags:s,suspect:i}={}){const r={event_id:e};return n!==void 0&&(r.linked_id=n),s!==void 0&&(r.tags=s),i!==void 0&&(r.suspect=i),F("update_event",r)}const si=e=>F("event_feedback",{event_id:e,reset_identification_confidence_score:!0}),ii=(e,n=e)=>F("delete_visitor",{visitor_id:e,confirm:n}),ri=e=>F("automation_intelligence",e??{}),ai=()=>F("automation_intelligence_self");function oi(e,n){const s={visitor_id:e};return Array.isArray(n)&&n.length>0&&(s.signals=n),F("drn_get",s)}const li=(e=50)=>F("accounts_recent",{limit:e}),ci=e=>F("accounts_by_user",{user_id:e}),di=({days:e=7,limit:n=50}={})=>F("accounts_old_browser",{days:e,limit:n}),ui=()=>F("accounts_summary");function mi(e,n={}){return Es.has(e)?F(`mgmt_${e}`,n):Promise.resolve(se("invalid_section","Unknown workspace section"))}const St="The database request failed";async function jn(e,n){try{const{data:s,error:i}=await rn.rpc(e,n);if(i){const r=typeof i.code=="string"&&i.code!==""?i.code:"rpc_failed";return se(r,r==="42501"?"Admin access required":St)}return{data:s??null,error:null}}catch(s){return console.warn("fingerprint-admin rpc failed",{fn:e,code:"rpc_failed",name:s?.name??null}),se("rpc_failed",St)}}const pi=(e=2)=>jn("get_multi_account_visitors",{min_accounts:e}),Nn=e=>jn("get_visitor_accounts",{p_visitor_id:e}),O={FIELD_LABEL_CLASSES:"mb-1 block font-mono-micro text-[10px] uppercase tracking-[0.12em] text-faint",FIELD_INPUT_CLASSES:"w-full rounded-[7px] border border-line bg-paper px-3 py-2.5 text-sm text-ink outline-none placeholder:text-faint focus:border-ink disabled:cursor-not-allowed disabled:opacity-50",BUTTON_ACCENT_CLASSES:"inline-flex items-center justify-center gap-2 rounded-sm bg-accent px-4 py-2 text-sm font-semibold text-paper transition-colors hover:bg-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:cursor-not-allowed disabled:opacity-50",BUTTON_HAIRLINE_CLASSES:"inline-flex items-center justify-center gap-2 rounded-sm border border-line px-4 py-2 text-sm text-sub transition-colors hover:border-ink hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:cursor-not-allowed disabled:opacity-50",ICON_GHOST_CLASSES:"rounded-sm p-2 text-faint transition-colors hover:bg-wash hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",CARD_CLASSES:"rounded-xl border border-line bg-card p-6 shadow-card",TABLE_HEAD_CLASSES:"p-3 text-left font-mono-micro text-[10px] uppercase tracking-[0.12em] text-faint",TABLE_CELL_CLASSES:"p-3 text-sm text-ink align-top",MICRO_LABEL_CLASSES:"font-mono-micro text-[10px] uppercase tracking-[0.12em] text-faint"},kn=e=>{const n=String(e).trim();return/^\d+$/.test(n)?`${n} ${n==="1"?"second":"seconds"}`:n},Ae=e=>e!=null&&e!=="",jt={error:{role:"alert",Icon:Yn,iconClass:"text-accent",defaultTitle:"Something went wrong",frame:"border-accent/40 bg-accent/10"},empty:{role:"status",Icon:bt,iconClass:"text-faint",defaultTitle:"Nothing to show",frame:"border-line bg-card"},info:{role:"status",Icon:bt,iconClass:"text-sub",defaultTitle:null,frame:"border-line bg-card"},loading:{role:"status",Icon:R,iconClass:"animate-spin text-sub",defaultTitle:"Loading",frame:"border-line bg-card"}};function _({kind:e="info",title:n,message:s,retryAfter:i,onRetry:r,children:a}){const o=jt[e]??jt.info,d=n??o.defaultTitle,{Icon:u}=o;return t.jsxs("div",{role:o.role,"aria-busy":e==="loading"||void 0,"data-kind":e,className:$("flex items-start gap-3 rounded-lg border p-4 text-sm",o.frame),children:[t.jsx(u,{size:16,"aria-hidden":"true",className:$("mt-0.5 shrink-0",o.iconClass)}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[d&&t.jsx("p",{className:"font-semibold text-ink",children:d}),Ae(s)&&t.jsx("p",{className:"text-sub",children:s}),Ae(i)&&t.jsxs("p",{className:O.MICRO_LABEL_CLASSES,children:["Retry after ",kn(i)]}),a,r&&t.jsx("button",{type:"button",onClick:r,className:O.BUTTON_HAIRLINE_CLASSES,children:"Try again"})]})]})}const Nt={bad:"text-accent bg-accent/10 border-accent/40",warn:"text-ink bg-wash border-line",info:"text-sub border-line",none:"text-faint border-line/50"},fi=e=>Ae(e)?typeof e=="boolean"?e?"Yes":"No":String(e):null;function P({label:e,severity:n="none",present:s=!0,value:i}){const r=s===!1?"none":Nt[n]?n:"none",a=s===!1?null:fi(i);
1return t.jsxs("span",{"data-severity":r,"data-present":s===!1?"false":"true",title:s===!1?"Not returned":void 0,className:$("inline-flex items-center gap-1 rounded-pill border px-2.5 py-0.5 font-mono-micro text-[10px] uppercase tracking-[0.12em]",Nt[r]),children:[r==="bad"&&t.jsx(Jn,{size:11,"aria-hidden":"true"}),t.jsx("span",{children:e}),a!==null&&t.jsx("span",{children:a})]})}const hi={idle:"Copy",copied:"Copied",failed:"Copy failed",unavailable:"Copy unavailable"},xi=e=>{try{const n=JSON.stringify(e===void 0?null:e,null,2);return n===void 0?"null":n}catch{return'"[unserializable value]"'}};function re({value:e,label:n="JSON",collapsedByDefault:s=!0}){const i=m.useId(),[r,a]=m.useState(!s),[o,d]=m.useState("idle"),u=m.useMemo(()=>xi(e),[e]);m.useEffect(()=>{if(o==="idle")return;const f=setTimeout(()=>d("idle"),2e3);return()=>clearTimeout(f)},[o]);const c=()=>{const f=typeof navigator<"u"?navigator.clipboard:void 0;if(!f||typeof f.writeText!="function"){d("unavailable");return}let p;try{p=f.writeText(u)}catch{d("failed");return}Promise.resolve(p).then(()=>d("copied")).catch(()=>d("failed"))},h=r?Ce:Le,l=o==="copied"?et:an;return t.jsxs("div",{className:"rounded-lg border border-line bg-card",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5",children:[t.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":r?i:void 0,onClick:()=>a(f=>!f),className:"inline-flex items-center gap-1.5 rounded-sm font-mono-micro text-[10px] uppercase tracking-[0.12em] text-sub transition-colors hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:[t.jsx(h,{size:12,"aria-hidden":"true"}),n]}),t.jsxs("button",{type:"button",onClick:c,title:`Copy ${n}`,className:$(O.ICON_GHOST_CLASSES,"inline-flex items-center gap-1 text-xs"),children:[t.jsx(l,{size:14,"aria-hidden":"true"}),hi[o]]})]}),r&&t.jsx("pre",{id:i,className:"max-h-96 overflow-auto whitespace-pre-wrap break-words border-t border-line bg-wash px-3 py-2 font-mono-micro text-xs leading-relaxed text-ink",children:u})]})}const kt={bad:"font-semibold text-accent",warn:"font-medium text-ink",info:"text-ink",none:"text-faint"},bi=e=>{const n=Number(e);return Number.isFinite(n)?n.toFixed(2):String(e)},_i=e=>{if(e==null)return"";if(typeof e!="object")return String(e);try{return JSON.stringify(e)}catch{return"[unserializable value]"}},gi=e=>Array.isArray(e)?e.length===0?"—":e.map(_i).join(", "):String(e);function yi({item:e}){if(e.present===!1)return t.jsx("span",{className:"italic text-faint",children:"Not returned"});const n=kt[e.severity]??kt.info;switch(e.kind){case"bool":return t.jsx("span",{className:n,children:e.value?"Yes":"No"});case"score":return t.jsx("span",{className:$("font-mono-micro text-xs",n),children:bi(e.value)});case"time":return t.jsx("span",{className:$("font-mono-micro text-xs",n),children:Ds(e.value)});case"json":return t.jsx(re,{value:e.value,label:e.label});case"list":return t.jsx("span",{className:n,children:gi(e.value)});case"number":return t.jsx("span",{className:$("font-mono-micro text-xs",n),children:String(e.value)});default:return t.jsx("span",{className:n,children:String(e.value)})}}function ct({items:e}){return!Array.isArray(e)||e.length===0?null:t.jsx("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-[minmax(0,220px)_minmax(0,1fr)]",children:e.map((n,s)=>t.jsxs(m.Fragment,{children:[t.jsx("dt",{className:$(O.MICRO_LABEL_CLASSES,"pt-0.5"),children:n.label}),t.jsx("dd",{"data-severity":n.severity??"none",className:"min-w-0 break-words text-sm",children:t.jsx(yi,{item:n})})]},n.key??`${n.label}-${s}`))})}const At="Your session has expired — sign in again",Et="Admin access required",Oe={function_not_deployed:"The fingerprint-admin function is not deployed yet",unauthenticated:At,forbidden:Et,http_401:At,http_403:Et,too_many_requests:"Fingerprint rate limit reached",too_many_search_requests:"Fingerprint search rate limit reached",feature_not_enabled:"This needs the Fingerprint Enterprise plan — the feature is not enabled for this workspace",management_api_not_configured:"The Management API key is not configured on the fingerprint-admin function",management_api_key_invalid:"Fingerprint rejected the Management API key",fingerprint_unavailable:"Fingerprint did n
1ot answer — try again in a moment",network:"Could not reach the fingerprint-admin function — check your connection",relay:"The Supabase relay rejected the request — try again",unexpected:"Unexpected error while calling the fingerprint-admin function",invalid_response:"The fingerprint-admin function returned an unexpected response",event_not_found:"No event matches that id",visitor_not_found:"No visitor matches that id",state_not_ready:"The event is not ready to be updated yet — try again in a few seconds",confirmation_mismatch:"The confirmation does not match the visitor id",payload_too_large:"The request is too large for Fingerprint",misconfigured:"The fingerprint-admin function is missing its configuration",internal_error:"The fingerprint-admin function hit an internal error",method_not_allowed:"The fingerprint-admin function rejected the request method",invalid_section:"Unknown workspace section",rpc_failed:"The database request failed"},vi=new Set(["invalid_json","invalid_request","invalid_params","unknown_action","no_client_ip","request_cannot_be_parsed","ruleset_not_found"]),Si=new Set(["secret_api_key_required","secret_api_key_not_found","public_api_key_required","public_api_key_not_found","wrong_region","subscription_not_active","WorkspaceScopedSecretKeyRequired"]);function I(e){if(!e||typeof e!="object")return"Something went wrong";const n=typeof e.code=="string"?e.code:"",s=typeof e.message=="string"?e.message.trim():"";if(n==="too_many_requests"||n==="too_many_search_requests"){const i=Oe[n];return Ae(e.retryAfter)?`${i} — retry after ${kn(e.retryAfter)}`:i}return vi.has(n)?s?`Invalid request: ${s}`:"Invalid request":Si.has(n)?"Fingerprint rejected the workspace key or region — check the function configuration":Oe[n]?Oe[n]:s||(n?`Request failed (${n})`:"Something went wrong")}const{BUTTON_HAIRLINE_CLASSES:An,CARD_CLASSES:ji,MICRO_LABEL_CLASSES:Ie,TABLE_CELL_CLASSES:Ni,TABLE_HEAD_CLASSES:ki}=O,Ai="rounded-sm font-mono-micro text-xs text-ink underline decoration-line underline-offset-2 transition-colors hover:text-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",En=1440*60*1e3,Ct=10,Lt=10,wt=3,Ei=new Set(["tampering","anti_detect_browser","virtual_machine","tor_node","attack_source","email_spam","mitm_attack","frida","cloned_app","emulator","simulator","jailbroken","root_apps","location_spoofing","replayed"]),K={status:"loading",data:null,error:null},xe={status:"skipped",data:null,error:null},Ci={code:"unexpected",message:"",status:null,retryAfter:null},It=e=>e.error?{status:"error",data:null,error:e.error}:{status:"ready",data:e.data,error:null},Tt=(e,n)=>{n?.code!=="function_not_deployed"&&ae(new Error(`fingerprint-admin ${n?.code??"unknown"}`),{function:e,code:n?.code??null,status:n?.status??null})},Te=e=>e!=null&&e!=="",H=e=>Te(e)?String(e):"—",Rt=e=>e===!0?"Yes":"No",be=e=>typeof e=="number"&&Number.isFinite(e)?e.toLocaleString("en-US"):"—",Li=e=>{const n=Number(e);return Te(e)&&Number.isFinite(n)?n.toFixed(2):"—"},wi=e=>{const n=Date.parse(e?.visitor_first_seen_at),s=Date.parse(e?.account_created_at);return!Number.isFinite(n)||!Number.isFinite(s)?"—":((s-n)/En).toFixed(1)},Ii=e=>e==="bad"?"bad":e==="good"?"warn":"info";function _e({icon:e,title:n,caption:s,children:i}){const r=e,a=m.useId();return t.jsxs("section",{"aria-labelledby":a,className:ji,children:[t.jsxs("div",{className:"mb-4 flex flex-wrap items-baseline justify-between gap-2",children:[t.jsxs("h3",{id:a,className:"flex items-center gap-2 font-serif-display text-2xl text-ink",children:[t.jsx(r,{size:20,className:"text-accent","aria-hidden":"true"}),n]}),s&&t.jsx("p",{className:Ie,children:s})]}),i]})}function ge({icon:e,label:n,value:s}){const i=e;return t.jsxs("div",{className:"rounded-xl border border-line bg-card p-4 shadow-card",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-wash",children:t.jsx(i,{size:20,className:"text-accent","aria-hidden":"true"})}),t.jsx("p",{className:"mt-3 font-serif-display text-3xl text-ink",children:s}),t.jsx("p",{className:Ie,children:n})]})}function Cn({id:e,onSelect:n}){return Te(e)?t.jsx("button",{type:"button",onClick:()=>n?.(e),title:`Open visitor ${e}`,className:Ai,children:e}):t.jsx("span",{className:"text-faint",children:"—"})}function Ln({columns:e,rows:n,rowKey:s}){return t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{children:t.jsx("tr",{className:"border-b border-line",children:e.map(i=>t.jsx("th",{scope:"col",className:ki,children:i.label},i.label))})}),t.jsx("tbody",{children:n.map((i,r)=>t.jsx("tr",{className:"border-b border-line/50 hover:bg-wash",children:e.map(a=>t.jsx("td",{className:Ni,children:a.render(i)},a.label))},s(i,r)))})]})})}function Dt({name:e}){return t.jsx("span",{className:"font-mono-micro text-xs text-sub",children:e})}function Ti({state:e,onRetry:n}){if(e.status==="loading")return t.jsx(_,{kind:"loading",message:"Checking the fingerprint-admin function"});if(e.status==="error")return e.error.code==="function_not_deployed"?t.jsx(_,{kind:"error",title:"The fingerprint-admin function is not deployed",message:"Nothing on this tab can load until the fingerprint-admin Supabase edge function is deployed. Follow docs/fingerprint-admin.md, then refresh.",onRetry:n}):t.jsx(_,{kind:"error",title:"Configuration check failed",message:I(e.error),retryAfter:e.error.retryAfter,onRetry:n});if(e.status!=="ready")return null;const s=e.data??{},i=[["Server API configured",t.jsxs(t.Fragment,{children:[Rt(s.server_api_configured)," ",t.jsx(Dt,{name:"FINGERPRINT_SECRET_API_KEY"})]})],["Management API configured",t.jsxs(t.Fragment,{children:[Rt(s.management_api_configured)," ",t.jsx(Dt,{name:"FINGERPRINT_MANAGEMENT_API_KEY"})]})],["Server API base",H(s.server_api_base)],["DRN API base",H(s.drn_api_base)],["Management API base",H(s.management_api_base)],["Function version",H(s.function_version)]];return t.jsx("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-[minmax(0,220px)_minmax(0,1fr)]",children:i.map(([r,a])=>t.jsxs("div",{className:"contents",children:[t.jsx("dt",{className:`${Ie} pt-0.5`,children:r}),t.jsx("dd",{className:"min-w-0 break-all text-sm text-ink",children:a})]},r))})}function Ri({state:e,onRetry:n}){if(e.status==="loading")return t.jsx(_,{kind:"loading",message:"Counting sign-in links"});if(e.status==="error")return t.jsx(_,{kind:"error",title:"Linking summary failed",message:I(e.error),retryAfter:e.error.retryAfter,onRetry:n});if(e.status!=="ready")return null;const s=e.data??{};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[t.jsx(ge,{icon:it,label:"Total links",value:be(s.total_links)}),t.jsx(ge,{icon:nt,label:"Distinct visitors",value:be(s.distinct_visitors)}),t.jsx(ge,{icon:fs,label:"Distinct users",value:be(s.distinct_users)}),t.jsx(ge,{icon:st,label:"Multi-account visitors",value:be(s.multi_account_visitors)})]}),s.bounded===!0&&t.jsx("p",{className:"mt-3 text-xs text-sub",children:"Bounded sample — the distinct counts come from the 5,000 most recent links; the total is exact."})]})}const Di=e=>[{label:"Email",render:n=>H(n.email)},{label:"Username",render:n=>H(n.username)},{label:"Visitor id",render:n=>t.jsx(Cn,{id:n.visitor_id,onSelect:e})},{label:"Auth provider",render:n=>H(n.auth_provider)},{label:"Linked at",render:n=>N(n.linked_at)},{label:"Browser age at sign-up (days)",render:wi},{label:"Confidence",render:n=>Li(n.confidence_score)}];function $i({state:e,onRetry:n,onVisitorSelect:s}){if(e.status==="loading")return t.jsx(_,{kind:"loading",message:"Fetching the newest sign-in links"});if(e.status==="error")return t.jsx(_,{kind:"error",title:"Recent links failed",message:I(e.error),retryAfter:e.error.retryAfter,onRetry:n});if(e.status!=="ready")return null;const i=Array.isArray(e.data?.rows)?e.data.rows:[];return i.length===0?t.jsx(_,{kind:"empty",message:"No sign-in links yet"}):t.jsx(Ln,{columns:Di(s),rows:i,rowKey:(r,a)=>r.id??r.event_id??a})}function Oi({flags:e}){if(!Array.isArray(e)||e.length===0)return t.jsx("span",{className:"text-faint",children:"—"});const n=e.slice(0,wt),s=e.slice(wt);return t.jsxs("span",{className:"flex flex-wrap items-center gap-1",children:[n.map(i=>t.jsx(P,{label:i.replace(/_/g," "),severity:Ei.has(i)?"bad":"warn"},i)),s.length>0&&t.jsxs("span",{className:Ie,title:s.join(", "),children:["+",s.length]})]})}const Fi=(e,n)=>[{label:"Time",render:({summary:s})=>N(s.time)},{label:"Visitor id",render:({summary:s})=>t.jsx(Cn,{id:s.visitorId,onSelect:n})},{label:"Browser / OS",render:({summary:s})=>
1[s.browser,s.os].filter(Boolean).join(" · ")||"—"},{label:"Country",render:({summary:s})=>H(s.country)},{label:"Bot",render:({summary:s})=>Te(s.bot)?t.jsx(P,{label:"Bot",severity:Ii(s.bot),value:s.bot}):"—"},{label:"Suspect score",render:({summary:s})=>H(s.suspectScore)},{label:"Flags",render:({summary:s})=>t.jsx(Oi,{flags:s.flags})},{label:"Detail",render:({event:s,summary:i})=>t.jsx("button",{type:"button",onClick:()=>e?.(s),"aria-label":`View event ${i.eventId??""}`.trim(),className:`${An} px-3 py-1`,children:"View"})}];function Bi({state:e,onRetry:n,onEventSelect:s,onVisitorSelect:i}){if(e.status==="loading")return t.jsx(_,{kind:"loading",message:"Searching the last 24 hours of events"});if(e.status==="skipped")return t.jsx(_,{kind:"info",title:"Server API not configured",message:"Set FINGERPRINT_SECRET_API_KEY on the fingerprint-admin function to list events here."});if(e.status==="error")return t.jsx(_,{kind:"error",title:"Event search failed",message:I(e.error),retryAfter:e.error.retryAfter,onRetry:n});if(e.status!=="ready")return null;const r=Array.isArray(e.data?.events)?e.data.events:[];if(r.length===0)return t.jsx(_,{kind:"empty",message:"No events in the last 24 hours"});const a=r.map(o=>({event:o,summary:ot(o)}));return t.jsx(Ln,{columns:Fi(s,i),rows:a,rowKey:({summary:o},d)=>o.eventId??d})}function Pi({onEventSelect:e,onVisitorSelect:n}){const[s,i]=m.useState(K),[r,a]=m.useState(K),[o,d]=m.useState(K),[u,c]=m.useState(K),[h,l]=m.useState(0),f=m.useRef(0);m.useEffect(()=>{const v=f.current+1;f.current=v;const x=()=>f.current===v,g=(y,E)=>C=>{x()&&(C.error&&Tt(E,C.error),y(It(C)))};return(async()=>{i(K),a(K),d(K),c(K);const y=await ti();if(!x())return;if(i(It(y)),y.error){Tt("OverviewTab.getConfigStatus",y.error),a(xe),d(xe),c(xe);return}const E=[ui().then(g(a,"OverviewTab.getAccountsSummary")),li(Ct).then(g(d,"OverviewTab.getRecentAccountLinks"))];if(y.data?.server_api_configured===!0){const C=new Date(Date.now()-En).toISOString();E.push(lt({limit:Lt,start:C}).then(g(c,"OverviewTab.searchEvents")))}else c(xe);await Promise.all(E)})().catch(y=>{if(!x())return;ae(y,{function:"OverviewTab.load",code:"unexpected",status:null});const E=C=>C.status==="loading"?{status:"error",data:null,error:Ci}:C;i(E),a(E),d(E),c(E)}),()=>{f.current+=1}},[h]);const p=[s,r,o,u].some(v=>v.status==="loading"),b=()=>l(v=>v+1);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:"text-sm text-sub",children:"Function configuration, the account-linking summary and the newest Fingerprint events. Loads once per visit or refresh — no polling."}),t.jsxs("button",{type:"button",onClick:b,disabled:p,className:An,children:[t.jsx(tt,{size:16,className:p?"animate-spin":"","aria-hidden":"true"}),"Refresh"]})]}),t.jsx(_e,{icon:nt,title:"Configuration",caption:"fingerprint-admin edge function",children:t.jsx(Ti,{state:s,onRetry:b})}),r.status!=="skipped"&&t.jsx(_e,{icon:st,title:"Linking summary",caption:"visitor_accounts",children:t.jsx(Ri,{state:r,onRetry:b})}),o.status!=="skipped"&&t.jsx(_e,{icon:it,title:"Recent sign-in links",caption:`Newest ${Ct}`,children:t.jsx($i,{state:o,onRetry:b,onVisitorSelect:n})}),!(u.status==="skipped"&&s.status!=="ready")&&t.jsx(_e,{icon:we,title:"Events in the last 24 h",caption:`One Server API search per load · newest ${Lt}`,children:t.jsx(Bi,{state:u,onRetry:b,onEventSelect:e,onVisitorSelect:n})})]})}const{CARD_CLASSES:Fe,FIELD_LABEL_CLASSES:Be,FIELD_INPUT_CLASSES:Pe,BUTTON_ACCENT_CLASSES:Ui,BUTTON_HAIRLINE_CLASSES:wn,ICON_GHOST_CLASSES:Mi,TABLE_HEAD_CLASSES:Ue,TABLE_CELL_CLASSES:Me,MICRO_LABEL_CLASSES:le}=O,Vi="rounded-xl border border-line bg-card shadow-card",zi="break-all rounded-sm text-left font-mono-micro text-xs text-accent underline-offset-2 transition-colors hover:text-ink hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",qi="Not returned for this event (plan or platform)",Hi="Event not mutable yet, retry in a moment",Ve=256,Gi=8*1024,Ki={idle:"Copy id",copied:"Copied",failed:"Copy failed",unavailable:"Copy unavailable"},Yi=[{value:"unchanged",label:"Unchanged"},{value:"true",label:"Suspect"},{value:"false",label:"Not suspect"}],Ji=new Set(["too_many_requests","too_many_search_requests","event_not_found","state_not_ready","forbidden","unauthenticated","function_not_deployed","feature_not_enabled","invali
1d_params","invalid_request","request_cannot_be_parsed","ruleset_not_found"]),In=(e,n,s)=>{!n||Ji.has(n.code)||ae(new Error(`fingerprint-admin ${n?.code??"unknown"}`),{function:e,code:n?.code??null,status:n?.status??null,eventId:s})},Je=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Wi=e=>typeof e!="number"?"none":e>=20?"bad":e>=10?"warn":"info",Xi=e=>e==="bad"?"bad":e==="good"?"warn":"info";function Qi({text:e}){const[n,s]=m.useState("idle");m.useEffect(()=>{if(n==="idle")return;const a=setTimeout(()=>s("idle"),2e3);return()=>clearTimeout(a)},[n]);const i=()=>{const a=typeof navigator<"u"?navigator.clipboard:void 0;if(!a||typeof a.writeText!="function"){s("unavailable");return}let o;try{o=a.writeText(e)}catch{s("failed");return}Promise.resolve(o).then(()=>s("copied")).catch(()=>s("failed"))},r=n==="copied"?et:an;return t.jsxs("button",{type:"button",onClick:i,title:"Copy event id",className:$(Mi,"inline-flex items-center gap-1 text-xs"),children:[t.jsx(r,{size:14,"aria-hidden":"true"}),Ki[n]]})}function Zi({title:e,note:n,caption:s,defaultOpen:i,children:r}){const a=m.useId(),[o,d]=m.useState(i),u=o?Ce:Le;return t.jsxs("section",{className:Vi,children:[t.jsxs("button",{type:"button","aria-expanded":o,"aria-controls":o?a:void 0,onClick:()=>d(c=>!c),className:"flex w-full flex-wrap items-center justify-between gap-2 rounded-xl px-5 py-3.5 text-left transition-colors hover:bg-wash focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:[t.jsxs("span",{className:"inline-flex items-center gap-2",children:[t.jsx(u,{size:14,"aria-hidden":"true",className:"text-faint"}),t.jsx("span",{className:"font-serif-display text-lg text-ink",children:e})]}),s&&t.jsx("span",{className:"text-xs italic text-faint",children:s})]}),o&&t.jsxs("div",{id:a,className:"space-y-3 border-t border-line px-5 py-4",children:[n&&t.jsx("p",{className:"text-xs text-faint",children:n}),r]})]})}function er({event:e,onEventUpdated:n}){const s=m.useId(),i=typeof e.linked_id=="string"?e.linked_id:"",r=Je(e.tags)&&Object.keys(e.tags).length>0?JSON.stringify(e.tags,null,2):"",[a,o]=m.useState(i),[d,u]=m.useState(r),[c,h]=m.useState("unchanged"),[l,f]=m.useState(null),[p,b]=m.useState(!1),[v,x]=m.useState(null),g=()=>{const y={},E=a.trim();if(E!==""&&E!==i){if(E.length>Ve)return{error:`Linked id must be ${Ve} characters or fewer`};y.linkedId=E}const C=d.trim();if(C!==""&&C!==r.trim()){let S;try{S=JSON.parse(C)}catch{return{error:"Tags must be valid JSON"}}if(!Je(S))return{error:'Tags must be a JSON object, for example { "reviewed": true }'};if(JSON.stringify(S).length>Gi)return{error:"Tags must serialise to 8 KB or less"};y.tags=S}return c!=="unchanged"&&(y.suspect=c==="true"),Object.keys(y).length===0?{error:"Change at least one field before updating"}:{changes:y}},j=async y=>{y.preventDefault();const{changes:E,error:C}=g();if(C){f(C),x(null);return}f(null),x(null),b(!0);const{error:S}=await ni(e.event_id,E);if(b(!1),S){In("updateEvent",S,e.event_id),x({kind:"error",error:S});return}x({kind:"success"}),n?.()};return t.jsxs("form",{onSubmit:j,"aria-label":"Update event",className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h5",{className:"font-medium text-ink",children:"Update event"}),t.jsx("p",{className:"text-xs text-faint",children:"Sets linked id, tags or the suspect flag on this event; only changed fields are sent."})]}),t.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${s}-linked-id`,className:Be,children:"Linked id"}),t.jsx("input",{id:`${s}-linked-id`,type:"text",value:a,maxLength:Ve,onChange:y=>o(y.target.value),autoComplete:"off",className:Pe})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${s}-suspect`,className:Be,children:"Suspect"}),t.jsx("select",{id:`${s}-suspect`,value:c,onChange:y=>h(y.target.value),className:Pe,children:Yi.map(y=>t.jsx("option",{value:y.value,children:y.label},y.value))})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${s}-tags`,className:Be,children:"Tags (JSON object)"}),t.jsx("textarea",{id:`${s}-tags`,rows:4,value:d,onChange:y=>u(y.target.value),placeholder:'{ "reviewed": true }',spellCheck:!1,className:$(Pe,"font-mono-micro")})]}),l&&t.jsx("p",{role:"alert",className:"text-sm text-accent",children:l}),v?.kind==="success"&&t.jsx(_,{kind:"info",title:"Event updated",message:"Fingerprint accepted the change"}),v?.kind==="error"&&t.jsx(_,{kind:"error",title:v.error.code==="state_not_ready"?Hi:"Update failed",message:I(v.error)}),t.jsxs("button",{type:"submit",disabled:p,className:Ui,children:[p?t.jsx(R,{size:16,"aria-hidden":"true",className:"animate-spin"}):t.jsx(et,{size:16,"aria-hidden":"true"}
1),"Update event"]})]})}function tr({eventId:e}){const[n,s]=m.useState(!1),[i,r]=m.useState(!1),[a,o]=m.useState(null),d=async()=>{s(!1),o(null),r(!0);const{error:u}=await si(e);if(r(!1),u){In("submitEventFeedback",u,e),o({kind:"error",error:u});return}o({kind:"success"})};return t.jsxs("div",{className:"space-y-3 border-t border-line pt-4",children:[t.jsxs("div",{children:[t.jsx("h5",{className:"font-medium text-ink",children:"Reset identification confidence"}),t.jsx("p",{className:"text-xs text-faint",children:"Tells Fingerprint this identification was wrong so its confidence score is reset. Only within 24 hours of the event, only for JavaScript agent events, at most 30 per hour."})]}),t.jsxs("button",{type:"button",onClick:()=>s(!0),disabled:i,className:wn,children:[i?t.jsx(R,{size:16,"aria-hidden":"true",className:"animate-spin"}):t.jsx(Wn,{size:16,"aria-hidden":"true"}),"Reset identification confidence"]}),a?.kind==="success"&&t.jsx(_,{kind:"info",title:"Feedback accepted",message:"Fingerprint will reset the confidence score for this event"}),a?.kind==="error"&&t.jsx(_,{kind:"error",title:"Feedback rejected",message:I(a.error)}),t.jsx(on,{open:n,onOpenChange:s,children:t.jsxs(ln,{"data-sentry-block":!0,children:[t.jsxs(cn,{children:[t.jsx(dn,{children:"Reset identification confidence?"}),t.jsxs(un,{children:["Fingerprint only accepts this feedback within 24 hours of the event, only for events from the JavaScript agent, and at most 30 times per hour. The confidence score of event ",e," will be reset."]})]}),t.jsxs(mn,{children:[t.jsx(pn,{children:"Cancel"}),t.jsx(fn,{onClick:d,children:"Reset confidence"})]})]})})]})}function nr({event:e,busy:n=!1,error:s=null,onRefresh:i,onVisitorSelect:r,onEventUpdated:a}){const o=m.useMemo(()=>ot(e),[e]),d=m.useMemo(()=>Sn(e),[e]),u=m.useMemo(()=>Ws(e),[e]);if(!Je(e))return t.jsxs("div",{className:"space-y-4",children:[s&&t.jsx(_,{kind:"error",title:"Event unavailable",message:I(s)}),t.jsx(_,{kind:"empty",title:"No event selected",message:"Search for events or look up an event id to see every signal Fingerprint returned"})]});const c=o.eventId??"",h=u.filter(l=>l.triggered).reduce((l,f)=>l+f.weight,0);return t.jsxs("div",{className:"space-y-4","data-event-id":c,children:[t.jsxs("section",{className:Fe,children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 space-y-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:le,children:"Event"}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h3",{className:"break-all font-mono-micro text-base text-ink",children:c||"—"}),c&&t.jsx(Qi,{text:c})]})]}),t.jsxs("dl",{className:"flex flex-wrap gap-x-6 gap-y-2",children:[t.jsxs("div",{children:[t.jsx("dt",{className:le,children:"Time"}),t.jsx("dd",{className:"font-mono-micro text-xs text-ink",children:o.time??"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{className:le,children:"Source"}),t.jsx("dd",{className:"text-sm text-ink",children:o.source??"—"})]}),t.jsxs("div",{children:[t.jsx("dt",{className:le,children:"Visitor id"}),t.jsx("dd",{className:"text-sm",children:o.visitorId?t.jsx("button",{type:"button",title:o.visitorId,onClick:()=>r?.(o.visitorId),className:zi,children:o.visitorId}):t.jsx("span",{className:"text-faint",children:"—"})})]}),t.jsxs("div",{children:[t.jsx("dt",{className:le,children:"Linked id"}),t.jsx("dd",{className:"break-all font-mono-micro text-xs text-ink",children:o.linkedId??"—"})]})]})]}),t.jsxs("button",{type:"button",onClick:i,disabled:n,className:wn,children:[n?t.jsx(R,{size:16,"aria-hidden":"true",className:"animate-spin"}):t.jsx(tt,{size:16,"aria-hidden":"true"}),"Refresh"]})]}),s&&t.jsx("div",{className:"mt-4",children:t.jsx(_,{kind:"error",title:"Refresh failed",message:I(s)})}),t.jsxs("div",{className:"mt-4 flex flex-wrap gap-1.5",children:[t.jsx(P,{label:"Suspect",severity:o.suspect===!0?"bad":"info",present:o.suspect!==null,value:o.suspect}),t.jsx(P,{label:"Suspect score",severity:Wi(o.suspectScore),present:o.suspectScore!==null,value:o.suspectScore}),t.jsx(P,{label:"Confidence",severity:"info",present:o.confidence!==null,value:typeof o.confidence=="number"?o.confidence.toFixed(2):o.confidence}),t.jsx(P,{label:"Bot",severity:Xi(o.bot),present:o.bot!==null,value:o.bot}
1),o.flags.map(l=>t.jsx(P,{label:l,severity:"warn"},l))]})]}),t.jsxs("section",{className:Fe,children:[t.jsx("h4",{className:"font-serif-display text-xl text-ink",children:"Suspect score breakdown"}),t.jsxs("p",{className:"mt-1 text-xs text-faint",children:["Default web weights from ",Ks,"; workspaces can override them in the dashboard, so this explains the score rather than recomputing it. Event score ",o.suspectScore??"—"," · triggered weights sum to"," ",h,"."]}),t.jsx("div",{className:"mt-3 overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("caption",{className:"sr-only",children:"Suspect score signals"}),t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-line",children:[t.jsx("th",{scope:"col",className:Ue,children:"Signal"}),t.jsx("th",{scope:"col",className:Ue,children:"Weight"}),t.jsx("th",{scope:"col",className:Ue,children:"Triggered"})]})}),t.jsx("tbody",{children:u.map(l=>t.jsxs("tr",{"data-triggered":l.triggered?"true":"false",className:$("border-b border-line/50",l.triggered&&"bg-accent/5"),children:[t.jsx("td",{className:Me,children:l.signal}),t.jsx("td",{className:Me,children:t.jsx("span",{className:"font-mono-micro text-xs",children:l.weight})}),t.jsx("td",{className:Me,children:t.jsx("span",{className:l.triggered?"font-semibold text-accent":"text-sub",children:l.triggered?"Yes":"No"})})]},l.signal))})]})})]}),d.map(l=>{const f=l.items.filter(b=>b.present).length,p=f===0;return t.jsx(Zi,{title:l.title,note:l.note,caption:p?qi:`${f} of ${l.items.length} fields`,defaultOpen:!p,children:t.jsx(ct,{items:l.items})},`${c}-${l.id}`)}),t.jsx(re,{value:e,label:"Raw event JSON"}),t.jsxs("section",{className:Fe,children:[t.jsx("h4",{className:"font-serif-display text-xl text-ink",children:"Actions"}),t.jsxs("div",{className:"mt-4 space-y-6",children:[t.jsx(er,{event:e,onEventUpdated:a},c),t.jsx(tr,{eventId:c},`feedback-${c}`)]})]})]})}const{TABLE_HEAD_CLASSES:$t,TABLE_CELL_CLASSES:V,BUTTON_HAIRLINE_CLASSES:Ot}=O,Ft=4,sr=["Time","Visitor","Linked id","Browser / OS","IP / country","Bot","Suspect score","Confidence","Flags"],ir="rounded-sm font-mono-micro text-xs text-accent underline-offset-2 transition-colors hover:text-ink hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",rr=e=>typeof e!="number"?"text-faint":e>=20?"font-semibold text-accent":e>=10?"font-medium text-ink":"text-sub",Bt=(...e)=>{const n=e.filter(s=>s!=null&&s!=="");return n.length>0?n.join(" · "):"—"},ar=e=>typeof e=="number"?e.toFixed(2):"—";function Tn({events:e,selectedEventId:n,onSelect:s,onVisitorSelect:i,paginationKey:r,onLoadMore:a,busy:o=!1,totalHits:d}){const u=Array.isArray(e)?e:[];return u.length===0?t.jsx(_,{kind:"empty",title:"No events",message:"No events matched this query"}):t.jsxs("div",{children:[t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full min-w-[1080px]",children:[t.jsx("caption",{className:"sr-only",children:"Event search results"}),t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-line",children:[sr.map(c=>t.jsx("th",{scope:"col",className:$t,children:c},c)),t.jsx("th",{scope:"col",className:$t,children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsx("tbody",{children:u.map((c,h)=>{const l=ot(c),f=l.eventId!==null&&l.eventId===n,p=l.flags.length-Ft;return t.jsxs("tr",{"data-selected":f?"true":void 0,className:$("border-b border-line/50 transition-colors hover:bg-wash",f&&"bg-wash"),children:[t.jsx("td",{className:V,children:t.jsx("span",{className:"font-mono-micro text-xs",children:l.time??"—"})}),t.jsx("td",{className:V,children:l.visitorId?t.jsx("button",{type:"button",title:l.visitorId,onClick:()=>i?.(l.visitorId),className:ir,children:ke(l.visitorId)}):"—"}),t.jsx("td",{className:V,children:t.jsx("span",{className:"font-mono-micro text-xs",title:l.linkedId??void 0,children:ke(l.linkedId,12)})}),t.jsx("td",{className:V,children:Bt(l.browser,l.os)}),t.jsx("td",{className:V,children:t.jsx("span",{className:"font-mono-micro text-xs",children:Bt(l.ipAddress,l.country)})}),t.jsxs("td",{className:V,children:[l.bot??"—",l.botCategory&&t.jsx("span",{className:"block text-xs text-faint",children:l.botCategory})]}),t.jsx("td",{className:V,children:t.jsx("span",{className:$("font-mono-micro text-xs",rr(l.suspectScore)),children:l.suspectScore??"—"})}),t.jsx("td",{className:V,children:t.jsx("span",{className:"font-mono-micro text-xs",children:ar(l.confidence)})}),t.jsx("td",{className:V,children:l.flags.length===0?"—":t.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[l.flags.slice(0,Ft).map(b=>t.jsx(P,{label:b,severity:"warn"},b)),p>0&&t.jsxs("span",{className:"text-xs text-faint",children:["+",p," more"]})]})}),t.jsx("td",{className:V,children:t.jsxs("button",{type:"button",onClick:()=>s(c),title:l.eventId?`View event ${l.eventId}`:"View event",className:Ot,children:[t.jsx(Xn,{size:14,"aria-hidden":"true"}),"View"]}
1)})]},l.eventId??h)})})]})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-line px-3 py-3",children:[t.jsxs("p",{className:"text-xs text-faint",children:[u.length," ",u.length===1?"event":"events"," shown",typeof d=="number"&&` · ${d} total hits`]}),r&&t.jsxs("button",{type:"button",onClick:a,disabled:o,className:Ot,children:[o&&t.jsx(R,{size:14,"aria-hidden":"true",className:"animate-spin"}),"Load more"]})]})]})}const{FIELD_LABEL_CLASSES:or,FIELD_INPUT_CLASSES:W,BUTTON_ACCENT_CLASSES:lr,BUTTON_HAIRLINE_CLASSES:cr,MICRO_LABEL_CLASSES:Pt}=O,dr=[{id:"identity",label:"Identity",defaultOpen:!0},{id:"time",label:"Time",defaultOpen:!0},{id:"paging",label:"Paging",defaultOpen:!1},{id:"bot",label:"Bot",defaultOpen:!1},{id:"network",label:"Network",defaultOpen:!1},{id:"signals",label:"Signals",defaultOpen:!1},{id:"mobile",label:"Mobile",defaultOpen:!1},{id:"sdk",label:"SDK",defaultOpen:!1}],ze=3600*1e3,ur=[{label:"Last 24 h",ms:24*ze},{label:"Last 7 days",ms:168*ze},{label:"Last 30 days",ms:720*ze}],mr={any:"Any",true:"Yes",false:"No"},pr="RFC3339 or Unix ms",fr="rounded-pill border border-line px-3 py-1 text-xs text-sub transition-colors hover:border-ink hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",Ut=e=>Array.isArray(e)?e:[];function hr({field:e,id:n,value:s,onChange:i}){const r=a=>i(e.name,a.target.value);switch(e.kind){case"number":return t.jsx("input",{id:n,type:"number",value:s??"",onChange:r,placeholder:e.placeholder,className:W});case"bool":return t.jsx("select",{id:n,value:s??"any",onChange:r,className:W,children:As.map(a=>t.jsx("option",{value:a,children:mr[a]??a},a))});case"enum":return t.jsxs("select",{id:n,value:s??"",onChange:r,className:W,children:[t.jsx("option",{value:"",children:"Any"}),(e.options??[]).map(a=>t.jsx("option",{value:a,children:a},a))]});case"multi":return Array.isArray(e.options)&&e.options.length>0?t.jsx("select",{id:n,multiple:!0,size:Math.min(e.options.length,5),value:Ut(s),onChange:a=>i(e.name,Array.from(a.target.selectedOptions,o=>o.value)),className:$(W,"min-h-[5rem]"),children:e.options.map(a=>t.jsx("option",{value:a,children:a},a))}):t.jsx("textarea",{id:n,rows:2,value:Ut(s).join(`
2`),onChange:a=>i(e.name,a.target.value.split(`
3`)),placeholder:"One per line",className:W});case"datetime":return t.jsx("input",{id:n,type:"text",value:s??"",onChange:r,placeholder:pr,autoComplete:"off",className:W});default:return t.jsx("input",{id:n,type:"text",value:s??"",onChange:r,placeholder:e.placeholder,autoComplete:"off",className:W})}}function xr({values:e,onChange:n,onSubmit:s,onReset:i,busy:r=!1}){const a=m.useId(),o=e&&typeof e=="object"?e:{},d=c=>{c.preventDefault(),s()},u=c=>{n("start",new Date(Date.now()-c).toISOString()),n("end","")};return t.jsxs("form",{onSubmit:d,"aria-label":"Event search filters",className:"space-y-4",children:[dr.map(c=>{const h=gn.filter(l=>l.group===c.id);return h.length===0?null:t.jsxs("details",{open:c.defaultOpen,className:"rounded-lg border border-line",children:[t.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-3 rounded-lg px-4 py-3 transition-colors hover:bg-wash focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:[t.jsx("span",{className:"font-serif-display text-lg text-ink",children:c.label}),t.jsxs("span",{className:Pt,children:[h.length," ",h.length===1?"filter":"filters"]})]}),t.jsxs("fieldset",{className:"border-t border-line p-4",children:[t.jsxs("legend",{className:"sr-only",children:[c.label," filters"]}),c.id==="time"&&t.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:Pt,children:"Quick range"}),ur.map(l=>t.jsx("button",{type:"button",onClick:()=>u(l.ms),className:fr,children:l.label},l.label))]}),t.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:h.map(l=>{const f=`${a}-${l.name}`;return t.jsxs("div",{children:[t.jsx("label",{htmlFor:f,className:or,children:l.label}),t.jsx(hr,{field:l,id:f,value:o[l.name],onChange:n}),l.help&&t.jsx("p",{className:"mt-1 text-xs text-faint",children:l.help})]},l.name)})})]})]},c.id)}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-line pt-4",children:[t.jsxs("button",{type:"submit",disabled:r,className:lr,children:[r?t.jsx(R,{size:16,"aria-hidden":"true",className:"animate-spin"}):t.jsx(pe,{size:16,"aria-hidden":"true"}),"Search events"]}),t.jsx("button",{type:"button",onClick:i,className:cr,children:"Reset"}),t.jsx("p",{className:"text-xs text-faint",children:"Filters are only sent when you press Search events; Fingerprint rate-limits searches (too_many_search_requests)."})]})]})}const{CARD_CLASSES:br,FIELD_LABEL_CLASSES:Mt,FIELD_INPUT_CLASSES:Vt,BUTTON_HAIRLINE_CLASSES:_r}=O,zt={limit:20},gr="overflow-hidden rounded-xl border border-line bg-card shadow-card",yr="Enter a valid event id: 1–
364 characters, letters, digits, dots, underscores or hyphens",vr={search:"Search failed",load_more:"Could not load more events",lookup:"Lookup failed",refresh:"Refresh failed"};function Sr({busy:e,onLookup:n}){const s=m.useId(),[i,r]=m.useState(""),[a,o]=m.useState(""),[d,u]=m.useState(null),c=h=>{h.preventDefault();const l=i.trim();if(!js(l)){u(yr);return}u(null),n(l,a.trim())};return t.jsxs("form",{onSubmit:c,"aria-label":"Look up by event id",className:"space-y-3 border-t border-line pt-4",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-ink",children:"Look up by event id"}),t.jsx("p",{className:"text-xs text-faint",children:"Fetches one event with every Smart Signal; the optional ruleset id evaluates it against a ruleset."})]}),t.jsxs("div",{className:"grid gap-4 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_auto] sm:items-end",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${s}-event-id`,className:Mt,children:"Event id"}),t.jsx("input",{id:`${s}-event-id`,type:"text",value:i,onChange:h=>r(h.target.value),placeholder:"1708102555327.NLOjmg",autoComplete:"off",spellCheck:!1,"aria-invalid":d?"true":void 0,"aria-describedby":d?`${s}-event-id-error`:void 0,className:Vt})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${s}-ruleset-id`,className:Mt,children:"Ruleset id (optional)"}),t.jsx("input",{id:`${s}-ruleset-id`,type:"text",value:a,onChange:h=>o(h.target.value),maxLength:64,autoComplete:"off",spellCheck:!1,className:Vt})]}),t.jsxs("button",{type:"submit",disabled:e,className:_r,children:[e?t.jsx(R,{size:16,"aria-hidden":"true",className:"animate-spin"}):t.jsx(pe,{size:16,"aria-hidden":"true"}),"Look up event"]})]}),d&&t.jsx("p",{id:`${s}-event-id-error`,role:"alert",className:"text-sm text-accent",children:d})]})}function jr({initialEvent:e,onVisitorSelect:n}){const[s,i]=m.useState(zt),[r,a]=m.useState([]),[o,d]=m.useState(null),[u,c]=m.useState(null),[h,l]=m.useState(e??null),[f,p]=m.useState(e?.event_id??null),[b,v]=m.useState(!1),[x,g]=m.useState(!1),[j,y]=m.useState(null);m.useEffect(()=>{const L=e?.event_id??null;!L||L===f||(p(L),l(e))},[e,f]);const E=(L,B)=>i(T=>({...T,[L]:B})),C=()=>i(zt),S=async(L,{append:B=!1}={})=>{g(!0),y(null);const{data:T,error:fe}=await lt(L);if(g(!1),fe){y({scope:B?"load_more":"search",error:fe});return}const oe=Array.isArray(T?.events)?T.events:[];v(!0),a(Kn=>B?[...Kn,...oe]:oe),d(typeof T?.pagination_key=="string"&&T.pagination_key!==""?T.pagination_key:null),typeof T?.total_hits=="number"?c(T.total_hits):B||c(null),B||l(null)},D=()=>S(gt(s)),U=()=>{if(o)return S({...gt(s),pagination_key:o},{append:!0})},J=L=>{!L||typeof L!="object"||(l(L),a(B=>B.map(T=>T?.event_id===L.event_id?L:T)))},ht=async(L,B,T)=>{g(!0),y(null);const{data:fe,error:oe}=T?await vt(B,{rulesetId:T}):await vt(B);if(g(!1),oe){y({scope:L,error:oe});return}J(fe)},xt=()=>{if(h?.event_id)return ht("refresh",h.event_id)},Hn=(L,B)=>ht("lookup",L,B),Gn=j?.scope==="refresh"?j.error:null,$e=j&&j.scope!=="refresh"?j:null;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("section",{className:br,children:[t.jsx("h3",{className:"font-serif-display text-2xl text-ink",children:"Search events"}),t.jsx("p",{className:"mb-4 mt-1 text-sm text-sub",children:"Every documented Server API v4 filter; results are full events, so selecting a row needs no second request."}),t.jsx(xr,{values:s,onChange:E,onSubmit:D,onReset:C,busy:x}),t.jsx("div",{className:"mt-4",children:t.jsx(Sr,{busy:x,onLookup:Hn})})]}),$e&&t.jsx(_,{kind:"error",title:vr[$e.scope]??"Request failed",message:I($e.error)}),t.jsxs("section",{className:gr,children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-line px-6 py-4",children:[t.jsx("h3",{className:"font-serif-display text-2xl text-ink",children:"Results"}),x&&t.jsxs("span",{className:"inline-flex items-center gap-2 text-xs text-faint",children:[t.jsx(R,{size:14,"aria-hidden":"true",className:"animate-spin"}),"Working"]})]}),b?t.jsx(Tn,{events:r,selectedEventId:h?.event_id??null,onSelect:l,onVisitorSelect:n,paginationKey:o,onLoadMore:U,busy:x,totalHits:u}):t.jsx("div",{className:"p-6",children:t.jsx(_,{kind:"empty",title:"No search yet",message:"Set filters and press Search events, or look up an event by id"})})]}),t.jsx(nr,{event:h,busy:x,error:Gn,onRefresh:xt,onVisitorSelect:n,onEventUpdated:xt})]})}const{CARD_CLASSES:qe,FIELD_LABEL_CLASSES:Nr,FIELD_INPUT_CLASSES:kr,BUTTON_HAIRLINE_CLASSES:qt,TABLE_HEAD_CLASSES:Se,TABLE_CELL_CLASSES:M,MICRO_LABEL_CLASSES:je}=O,Ht=20,Ar="rounded-xl border border-accent/40 bg-card p-6 shadow-card",Er="inl
3ine-flex items-center justify-center gap-2 rounded-sm border border-accent/40 px-4 py-2 text-sm font-semibold text-accent transition-colors hover:bg-accent/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:cursor-not-allowed disabled:opacity-50",Cr=["Email","User id","Auth provider","Account created","Linked at","Visitor first seen","Visitor last seen","Confidence"],ye={loading:!0,error:null,data:null},ce={loading:!1,error:null,notFound:!1,data:null},Gt={open:!1,confirmText:"",busy:!1,outcome:null},ue=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Ne=e=>e!=null&&e!=="",Lr=e=>{const n=Number(e);return Ne(e)&&Number.isFinite(n)?n.toFixed(2):"—"},wr=e=>typeof e=="number"?`${(e*100).toFixed(1)}%`:"—",q=(e,n,s,i="text")=>({key:e,label:n,value:Ne(s)?s:null,kind:i,present:Ne(s),severity:Ne(s)?"info":"none"}),Ir=e=>ue(e?.data)?e.data:ue(e)?e:{},Tr=e=>{const n=ue(e.regionalActivity)?e.regionalActivity:{},s=ue(e.suspectScore)?e.suspectScore:{},i=ue(e.timestamps)?e.timestamps:{};return[q("regional.startDate","Regional activity from",n.startDate),q("regional.endDate","Regional activity to",n.endDate),q("suspect.startDate","Suspect score from",s.startDate),q("suspect.endDate","Suspect score to",s.endDate),q("suspect.minimum","Minimum suspect score",s.minimum?.value,"number"),q("suspect.maximum","Maximum suspect score",s.maximum?.value,"number"),q("suspect.percentile","Maximum score percentile",s.maximum?.percentile,"number"),q("timestamps.firstSeenAt","First seen",i.firstSeenAt??i.firstSeentAt),q("timestamps.lastSeenAt","Last seen",i.lastSeenAt)]},Rr=e=>(Array.isArray(e.regionalActivity?.countries)?e.regionalActivity.countries:[]).flatMap((s,i)=>(Array.isArray(s?.detectors)?s.detectors:[]).map((a,o)=>({key:`${i}-${o}`,code:s.code??"—",type:a?.type??"—",percentage:wr(a?.activityPercentage)})));function Dr({rows:e}){return e.length===0?t.jsx(_,{kind:"empty",title:"No accounts linked to this visitor"}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full min-w-[960px]",children:[t.jsx("caption",{className:"sr-only",children:"Accounts linked to this visitor"}),t.jsx("thead",{children:t.jsx("tr",{className:"border-b border-line",children:Cr.map(n=>t.jsx("th",{scope:"col",className:Se,children:n},n))})}),t.jsx("tbody",{children:e.map((n,s)=>t.jsxs("tr",{className:"border-b border-line/50",children:[t.jsx("td",{className:M,children:n.email??"—"}),t.jsx("td",{className:M,children:t.jsx("span",{className:"font-mono-micro text-xs",title:n.user_id??void 0,children:ke(n.user_id)})}),t.jsx("td",{className:M,children:n.auth_provider??"—"}),t.jsx("td",{className:M,children:t.jsx("span",{className:"font-mono-micro text-xs",children:N(n.account_created_at)})}),t.jsx("td",{className:M,children:t.jsx("span",{className:"font-mono-micro text-xs",children:N(n.linked_at)})}),t.jsx("td",{className:M,children:t.jsx("span",{className:"font-mono-micro text-xs",children:N(n.visitor_first_seen_at)})}),t.jsx("td",{className:M,children:t.jsx("span",{className:"font-mono-micro text-xs",children:N(n.visitor_last_seen_at)})}),t.jsx("td",{className:M,children:t.jsx("span",{className:"font-mono-micro text-xs",children:Lr(n.confidence_score)})})]},n.id??`${n.user_id}-${s}`))})]})})}function $r({data:e}){const n=Ir(e),s=Rr(n);return t.jsxs("div",{className:"space-y-4",children:[t.jsx(ct,{items:Tr(n)}),t.jsxs("div",{children:[t.jsx("p",{className:je,children:"Regional activity"}),s.length===0?t.jsx("p",{className:"mt-1 text-sm text-faint",children:"No regional activity returned"}):t.jsx("div",{className:"mt-2 overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("caption",{className:"sr-only",children:"Regional activity by country"}),t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-line",children:[t.jsx("th",{scope:"col",className:Se,children:"Country"}),t.jsx("th",{scope:"col",className:Se,children:"Detector"}),t.jsx("th",{scope:"col",className:Se,children:"Activity"})]})}),t.jsx("tbody",{children:s.map(i=>t.jsxs("tr",{className:"border-b border-line/50",children:[t.jsx("td",{className:M,children:i.code}),t.jsx("td",{className:M,children:i.type}),t.jsx("td",{className:M,children:t.jsx("span",{className:"font-mono-micro text-xs",children:i.percentage})})]},i.key))})]})})]}),t.jsx(re,{value:e,label:"Raw DRN JSON"})]})}function Or({visitorId:e,onEventSelect:n}){const s=m.useId(),[i,r]=m.useState(0),[a,o]=m.useState(ye),[d,u]=m.useState(ye),[c,h]=m.useState(ce),[l,f]=m.useState(Gt),p=m.useRef(e);m.useEffect(()=>{p.current=e,h(ce),f(Gt)},[e]),m.useEffect(()=>{let S=!1;o(ye),u(ye);const D=U=>J=>{S||U({loading:!1,error:J?.error??null,data:J?.data??null})};
3return Promise.all([Nn(e).then(D(o)),lt({visitor_id:e,limit:Ht}).then(D(u))]).catch(()=>{}),()=>{S=!0}},[e,i]);const b=()=>r(S=>S+1),v=async()=>{const S=e;h({...ce,loading:!0});const{data:D,error:U}=await oi(S,ks);if(p.current===S){if(U){const J=U.code==="visitor_not_found"||U.status===404;h({...ce,notFound:J,error:J?null:U});return}h({...ce,data:D})}},x=S=>f(D=>({...D,open:S,confirmText:S?D.confirmText:""})),g=async()=>{const S=l.confirmText;f(U=>({...U,open:!1,busy:!0,outcome:null}));const{error:D}=await ii(e,S);p.current===e&&f(U=>({...U,busy:!1,confirmText:"",outcome:D?{kind:"error",error:D}:{kind:"success"}}))},j=Array.isArray(a.data)?a.data:[],y=Array.isArray(d.data?.events)?d.data.events:[],E=l.outcome?.kind==="error"&&l.outcome.error.code==="feature_not_enabled",C=l.confirmText===e;return t.jsxs("div",{className:"space-y-6","data-visitor-id":e,children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:je,children:"Visitor"}),t.jsx("p",{className:"break-all font-mono-micro text-base text-ink",children:e})]}),t.jsxs("button",{type:"button",onClick:b,className:qt,children:[t.jsx(tt,{size:16,"aria-hidden":"true"}),"Refresh"]})]}),t.jsxs("section",{className:qe,children:[t.jsx("h4",{className:"font-serif-display text-xl text-ink",children:"Linked accounts"}),t.jsx("p",{className:"mb-4 mt-1 text-xs text-faint",children:"Accounts that signed in from this visitor id (visitor_accounts, ADR-028)."}),a.loading&&t.jsx(_,{kind:"loading",title:"Loading linked accounts"}),!a.loading&&a.error&&t.jsx(_,{kind:"error",title:"Linked accounts unavailable",message:I(a.error),onRetry:b}),!a.loading&&!a.error&&t.jsx(Dr,{rows:j})]}),t.jsxs("section",{className:qe,children:[t.jsx("h4",{className:"font-serif-display text-xl text-ink",children:"Recent events"}),t.jsxs("p",{className:"mb-4 mt-1 text-xs text-faint",children:["The ",Ht," most recent identification events for this visitor."]}),d.loading&&t.jsx(_,{kind:"loading",title:"Loading recent events"}),!d.loading&&d.error&&t.jsx(_,{kind:"error",title:"Recent events unavailable",message:I(d.error),onRetry:b}),!d.loading&&!d.error&&t.jsx(Tn,{events:y,selectedEventId:null,onSelect:S=>n?.(S),onVisitorSelect:()=>{},paginationKey:null,onLoadMore:()=>{},busy:!1})]}),t.jsxs("section",{className:qe,children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h4",{className:"font-serif-display text-xl text-ink",children:"Device reputation (DRN)"}),t.jsx("span",{className:je,children:"Android devices only"})]}),t.jsx("p",{className:"mb-4 mt-1 text-xs text-faint",children:"Device Reputation Network signals: regional activity, suspect score range and first/last seen dates."}),t.jsxs("button",{type:"button",onClick:v,disabled:c.loading,className:qt,children:[c.loading?t.jsx(R,{size:16,"aria-hidden":"true",className:"animate-spin"}):t.jsx(ms,{size:16,"aria-hidden":"true"}),"Load device reputation"]}),t.jsxs("div",{className:"mt-4 space-y-4",children:[c.loading&&t.jsx(_,{kind:"loading",title:"Loading device reputation"}),c.notFound&&t.jsx(_,{kind:"empty",title:"No device reputation data for this visitor",message:"DRN only covers Android devices"}),c.error&&t.jsx(_,{kind:"error",title:"Device reputation unavailable",message:I(c.error)}),c.data&&t.jsx($r,{data:c.data})]})]}),t.jsxs("section",{className:Ar,children:[t.jsxs("h4",{className:"flex items-center gap-2 font-serif-display text-xl text-accent",children:[t.jsx(_t,{size:18,"aria-hidden":"true"}),"Danger zone"]}),t.jsx("p",{className:`${je} mt-1`,children:"Enterprise — Delete API"}),t.jsx("p",{className:"mb-4 mt-2 text-sm text-sub",children:"Asks Fingerprint to delete every identification event stored for this visitor. Deletion is scheduled asynchronously and cannot be undone."}),t.jsxs("button",{type:"button",onClick:()=>x(!0),disabled:l.busy,className:Er,children:[l.busy?t.jsx(R,{size:16,"aria-hidden":"true",className:"animate-spin"}):t.jsx(_t,{size:16,"aria-hidden":"true"}),"Delete visitor data"]}),t.jsxs("div",{className:"mt-4 space-y-3",children:[l.outcome?.kind==="success"&&t.jsx(_,{kind:"info",title:"Deleti
3on scheduled",message:"Fingerprint accepted the request; the data for this visitor will be removed asynchronously"}),l.outcome?.kind==="error"&&t.jsx(_,{kind:"error",title:E?"Delete API not included in this plan":"Deletion failed",message:I(l.outcome.error)})]}),t.jsx(on,{open:l.open,onOpenChange:x,children:t.jsxs(ln,{"data-sentry-block":!0,children:[t.jsxs(cn,{children:[t.jsx(dn,{children:"Delete all data for this visitor?"}),t.jsxs(un,{children:["This schedules deletion of every event Fingerprint holds for visitor ",e,". It is permanent and needs the Enterprise Delete API."]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${s}-confirm`,className:Nr,children:"Type the visitor id to confirm"}),t.jsx("input",{id:`${s}-confirm`,type:"text",value:l.confirmText,onChange:S=>f(D=>({...D,confirmText:S.target.value})),autoComplete:"off",spellCheck:!1,className:kr})]}),t.jsxs(mn,{children:[t.jsx(pn,{children:"Cancel"}),t.jsx(fn,{disabled:!C,onClick:g,children:"Permanently delete visitor data"})]})]})})]})]})}const{CARD_CLASSES:Fr,FIELD_LABEL_CLASSES:Br,FIELD_INPUT_CLASSES:Pr,BUTTON_ACCENT_CLASSES:Ur}=O,He="Enter a 20-character visitor id (letters and digits only)";function Mr({initialVisitorId:e,onEventSelect:n}){const s=m.useId(),[i,r]=m.useState(e??""),[a,o]=m.useState(he(e)?e:null),[d,u]=m.useState(e??null),[c,h]=m.useState(e&&!he(e)?He:null);m.useEffect(()=>{!e||e===d||(u(e),r(e),he(e)?(o(e),h(null)):h(He))},[e,d]);const l=f=>{f.preventDefault();const p=i.trim();if(!he(p)){h(He);return}h(null),o(p)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("section",{className:Fr,children:[t.jsx("h3",{className:"font-serif-display text-2xl text-ink",children:"Visitor lookup"}),t.jsx("p",{className:"mb-4 mt-1 text-sm text-sub",children:"Linked accounts, recent events, device reputation and the Enterprise Delete API for one visitor id."}),t.jsxs("form",{onSubmit:l,"aria-label":"Visitor lookup",className:"flex flex-wrap items-end gap-3",children:[t.jsxs("div",{className:"min-w-[260px] flex-1",children:[t.jsx("label",{htmlFor:`${s}-visitor-id`,className:Br,children:"Visitor id"}),t.jsx("input",{id:`${s}-visitor-id`,type:"text",value:i,onChange:f=>r(f.target.value),placeholder:"20 characters, for example Ibk1527CUFmcnjLwIs4A",autoComplete:"off",spellCheck:!1,"aria-invalid":c?"true":void 0,"aria-describedby":c?`${s}-visitor-id-error`:void 0,className:Pr})]}),t.jsxs("button",{type:"submit",className:Ur,children:[t.jsx(pe,{size:16,"aria-hidden":"true"}),"Look up"]})]}),c&&t.jsx("p",{id:`${s}-visitor-id-error`,role:"alert",className:"mt-2 text-sm text-accent",children:c})]}),a&&t.jsx(Or,{visitorId:a,onEventSelect:n},a)]})}const{BUTTON_ACCENT_CLASSES:Vr,BUTTON_HAIRLINE_CLASSES:zr,CARD_CLASSES:qr,FIELD_INPUT_CLASSES:Rn,FIELD_LABEL_CLASSES:Hr,MICRO_LABEL_CLASSES:Gr,TABLE_CELL_CLASSES:Kr,TABLE_HEAD_CLASSES:Yr}=O,Jr="rounded-sm font-mono-micro text-xs text-ink underline decoration-line underline-offset-2 transition-colors hover:text-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",Wr=2,Xr=7,Ge=365,Qr=50,Ke=200,G={status:"idle",rows:[],meta:null,error:null},dt={status:"loading",rows:[],meta:null,error:null},ne=e=>Array.isArray(e)?e:[],Ee=(e,n)=>{ae(new Error(`fingerprint-admin ${n?.code??"unknown"}`),{function:e,code:n?.code??null,status:n?.status??null})},We=(e,n,s)=>{const i=typeof e=="string"?e.trim():e;if(i===""||i===null||i===void 0)return null;const r=Number(i);return!Number.isInteger(r)||r<n||r>s?null:r},Y=e=>e!=null&&e!=="",te=e=>Y(e)?String(e):"—",Dn=e=>{const n=Number(e);return Y(e)&&Number.isFinite(n)?n.toFixed(2):"—"},Zr=e=>{const n=Number(e);return Y(e)&&Number.isFinite(n)?n.toFixed(1):"—"};function ut({icon:e,title:n,intro:s,children:i}){const r=e,a=m.useId();return t.jsxs("section",{"aria-labelledby":a,className:qr,children:[t.jsxs("h3",{id:a,className:"mb-2 flex items-center gap-2 font-serif-display text-2xl text-ink",children:[t.jsx(r,{size:20,className:"text-accent","aria-hidden":"true"}),n]}),s&&t.jsx("p",{className:"mb-4 text-sm text-sub",children:s}),i]})}function $n({id:e,label:n,error:s,help:i,children:r}){return t.jsxs("div",{className:"min-w-0",children:[t.jsx("label",{htmlFor:e,className:Hr,children:n}),r,i&&!s&&t.jsx("p",{className:"mt-1 text-xs text-faint",children:i}),s&&t.jsx("p",{id:`${e}-error`,className:"mt-1 text-xs text-accent",children:s})]})}function Xe({id:e,label:n,value:s,onChange:i,min:r,max:a,error:o,help:d}){return t.jsx($n,{id:e,label:n,error:o,help:d,children:t.jsx("input",{id:e,type:"number",inputMode:"numeric",min:r,max:a,step:1,value:s,onChange:u=>i(u.target.value),"aria-invalid":o?"true":void 0,"aria-describedby":o?`${e}-error`:void 0,className:Rn})})}function mt({busy:e,children:n}){return t.jsxs("button",{type:"submit",disabled:e,className:Vr,children:[e?t.jsx(R,{size:16,className:"animate-spin","aria-hidden":"true"}):t.jsx(pe,{size:16,"aria-hidden":"true"}),n]})}function pt({id:e,onSelect:n}){return Y(e)?t.jsx("button",{type:"button",onClick:()=>n?.(e),title:`Open visitor ${e}`,className:Jr,children:e}):t.jsx("span",{className:"text-faint",children:"—"})}function Re({id:e}){return Y(e)?t.jsx("span",{title:String(e),className:"font-mono-micro text-xs text-ink",children:ke(e)}):t.jsx("span",{className:"text-faint",children:"—"})}function De({columns:e,rows:n,rowKey:s,renderAfterRow:i}){return t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{children:t.jsx("tr",{className:"border-b border-line",children:e.map(r=>
3t.jsx("th",{scope:"col",className:Yr,children:r.label},r.label))})}),t.jsx("tbody",{children:n.map((r,a)=>{const o=s(r,a),d=i?i(r):null;return[t.jsx("tr",{className:"border-b border-line/50 hover:bg-wash",children:e.map(u=>t.jsx("td",{className:Kr,children:u.render(r)},u.label))},o),d?t.jsx("tr",{className:"border-b border-line/50",children:t.jsx("td",{colSpan:e.length,className:"bg-wash p-3",children:d})},`${o}-detail`):null]})})]})})}function ft({state:e,loadingMessage:n,errorTitle:s,emptyMessage:i,onRetry:r,children:a}){return e.status==="idle"?null:e.status==="loading"?t.jsx(_,{kind:"loading",message:n}):e.status==="error"?t.jsx(_,{kind:"error",title:s,message:I(e.error),retryAfter:e.error?.retryAfter,onRetry:r}):e.rows.length===0?t.jsx(_,{kind:"empty",message:i}):a}const ea=[{label:"Email",render:e=>te(e.email)},{label:"User id",render:e=>t.jsx(Re,{id:e.user_id})},{label:"Auth provider",render:e=>te(e.auth_provider)},{label:"Account created",render:e=>N(e.account_created_at??e.profile_created_at)},{label:"Linked at",render:e=>N(e.linked_at)},{label:"Confidence",render:e=>Dn(e.confidence_score)}];function ta({visitorId:e,detail:n,onRetry:s}){return!n||!n.open?null:n.status==="loading"?t.jsx(_,{kind:"loading",message:`Loading the accounts linked to ${e}`}):n.status==="error"?t.jsx(_,{kind:"error",title:"Could not load this visitor's accounts",message:I(n.error),onRetry:s}):n.rows.length===0?t.jsx(_,{kind:"empty",message:"No link rows for this visitor"}):t.jsx(De,{columns:ea,rows:n.rows,rowKey:(i,r)=>i.id??i.event_id??r})}function na({onVisitorSelect:e}){const n=m.useId(),[s,i]=m.useState(String(Wr)),[r,a]=m.useState(null),[o,d]=m.useState(G),[u,c]=m.useState({}),h=m.useRef(0),l=async()=>{const x=We(s,1,Number.MAX_SAFE_INTEGER);if(x===null){a("Enter a whole number of 1 or more");return}a(null);const g=h.current+1;h.current=g,d(dt),c({});const j=await pi(x);if(h.current===g){if(j.error){Ee("LinkedAccountsTab.getMultiAccountVisitors",j.error),d({...G,status:"error",error:j.error});return}d({...G,status:"ready",rows:ne(j.data)})}},f=x=>{x.preventDefault(),l()},p=async x=>{const g=h.current;c(y=>({...y,[x]:{open:!0,status:"loading",rows:[],error:null}}));const j=await Nn(x);h.current===g&&(j.error&&Ee("LinkedAccountsTab.getVisitorAccounts",j.error),c(y=>({...y,[x]:{open:!0,status:j.error?"error":"ready",rows:ne(j.data),error:j.error}})))},b=x=>{const g=u[x];if(g?.status==="ready"){c(j=>({...j,[x]:{...g,open:!g.open}}));return}p(x)},v=[{label:"Visitor id",render:x=>t.jsx(pt,{id:x.visitor_id,onSelect:e})},{label:"Accounts",render:x=>te(x.account_count)},{label:"User ids",render:x=>t.jsxs("span",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[ne(x.user_ids).map(g=>t.jsx(Re,{id:g},g)),ne(x.user_ids).length===0&&t.jsx("span",{className:"text-faint",children:"—"})]})},{label:"First seen",render:x=>N(x.first_seen_at)},{label:"Last linked",render:x=>N(x.last_linked_at)},{label:"Accounts detail",render:x=>{const g=u[x.visitor_id]?.open===!0,j=g?Ce:Le;return t.jsxs("button",{type:"button",onClick:()=>b(x.visitor_id),"aria-expanded":g,"aria-label":`${g?"Collapse":"Expand"} ${x.visitor_id}`,className:`${zr} px-3 py-1`,children:[t.jsx(j,{size:14,"aria-hidden":"true"}),g?"Collapse":"Expand"]})}}];return t.jsxs(ut,{icon:st,title:"Visitors with multiple accounts",intro:"Browsers that have signed in as several different accounts, from the visitor_accounts table. Expand a row to see every linked account.",children:[t.jsxs("form",{onSubmit:f,noValidate:!0,className:"mb-4 flex flex-wrap items-end gap-3",children:[t.jsx("div",{className:"w-40",children:t.jsx(Xe,{id:`${n}-min`,label:"Minimum accounts",value:s,onChange:i,min:1,error:r})}),t.jsx(mt,{busy:o.status==="loading",children:"Load"})]}),t.jsx(ft,{state:o,loadingMessage:"Grouping sign-in links by visitor",errorTitle:"Could not load multi-account visitors",emptyMessage:"No visitor has signed in as that many accounts",onRetry:l,children:t.jsx(De,{columns:v,rows:o.rows,rowKey:(x,g)=>x.visitor_id??g,renderAfterRow:x=>u[x.visitor_id]?.open?t.jsx(ta,{visitorId:x.visitor_id,detail:u[x.visitor_id],onRetry:()=>p(x.visitor_id)}):null})})]})}const sa=e=>[{label:"Visitor id",render:n=>t.jsx(pt,{id:n.visitor_id,onSelect:e})},{label:"Event id",render:n=>t.jsx(Re,{id:n.event_id})},{label:"Linked at",render:n=>N(n.linked_at)},{label:"Auth provider",render:n=>te(n.auth_provider)},{label:"Visitor first seen",render:n=>N(n.visitor_first_seen_at)},{label:"Visitor last seen",render:n=>N(n.visitor_last_seen_at)},{label:"Confidence",render:n=>
3Dn(n.confidence_score)}];function ia({onVisitorSelect:e}){const n=m.useId(),[s,i]=m.useState(""),[r,a]=m.useState(null),[o,d]=m.useState(G),u=m.useRef(0),c=async()=>{const f=s.trim();if(!Ns(f)){a("Enter a valid user id (uuid)");return}a(null);const p=u.current+1;u.current=p,d(dt);const b=await ci(f);if(u.current===p){if(b.error){Ee("LinkedAccountsTab.getAccountsByUser",b.error),d({...G,status:"error",error:b.error});return}d({...G,status:"ready",rows:ne(b.data?.rows)})}},h=f=>{f.preventDefault(),c()},l=o.rows[0];return t.jsxs(ut,{icon:pe,title:"Lookup by user id",intro:"Every visitor (browser) that has signed in to one account.",children:[t.jsxs("form",{onSubmit:h,noValidate:!0,className:"mb-4 flex flex-wrap items-end gap-3",children:[t.jsx("div",{className:"min-w-0 flex-1 sm:max-w-md",children:t.jsx($n,{id:`${n}-user`,label:"User id",error:r,children:t.jsx("input",{id:`${n}-user`,type:"text",value:s,onChange:f=>i(f.target.value),placeholder:"00000000-0000-0000-0000-000000000000",autoComplete:"off",spellCheck:!1,"aria-invalid":r?"true":void 0,"aria-describedby":r?`${n}-user-error`:void 0,className:Rn})})}),t.jsx(mt,{busy:o.status==="loading",children:"Look up"})]}),t.jsxs(ft,{state:o,loadingMessage:"Fetching this user's sign-in links",errorTitle:"Could not load this user's links",emptyMessage:"No sign-in links for this user",onRetry:c,children:[l&&(Y(l.email)||Y(l.username))&&t.jsxs("p",{className:"mb-2 text-sm text-sub",children:["Account: ",te(l.email),Y(l.username)?` · ${l.username}`:""]}),t.jsx(De,{columns:sa(e),rows:o.rows,rowKey:(f,p)=>f.id??f.event_id??p})]})]})}const ra=e=>[{label:"Email",render:n=>te(n.email)},{label:"User id",render:n=>t.jsx(Re,{id:n.user_id})},{label:"Account created",render:n=>N(n.account_created_at)},{label:"Visitor id",render:n=>t.jsx(pt,{id:n.visitor_id,onSelect:e})},{label:"Visitor first seen",render:n=>N(n.visitor_first_seen_at)},{label:"Browser age (days)",render:n=>Zr(n.browser_age_days)}];function aa({onVisitorSelect:e}){const n=m.useId(),[s,i]=m.useState(String(Xr)),[r,a]=m.useState(String(Qr)),[o,d]=m.useState({}),[u,c]=m.useState(G),h=m.useRef(0),l=async()=>{const p=We(s,1,Ge),b=We(r,1,Ke),v={};if(p===null&&(v.days=`Enter a whole number between 1 and ${Ge}`),b===null&&(v.limit=`Enter a whole number between 1 and ${Ke}`),d(v),Object.keys(v).length>0)return;const x=h.current+1;h.current=x,c(dt);const g=await di({days:p,limit:b});if(h.current===x){if(g.error){Ee("LinkedAccountsTab.getOldBrowserAccounts",g.error),c({...G,status:"error",error:g.error});return}c({...G,status:"ready",rows:ne(g.data?.rows),meta:{scanned:g.data?.scanned??null,truncated:g.data?.truncated===!0}})}},f=p=>{p.preventDefault(),l()};return t.jsxs(ut,{icon:Qn,title:"Old browser at sign-up",intro:"Accounts created on a browser Fingerprint had already known for more than the given number of days — a trial-abuse heuristic: a returning device signing up as a brand-new account.",children:[t.jsxs("form",{onSubmit:f,noValidate:!0,className:"mb-4 flex flex-wrap items-end gap-3",children:[t.jsx("div",{className:"w-32",children:t.jsx(Xe,{id:`${n}-days`,label:"Days",value:s,onChange:i,min:1,max:Ge,error:o.days})}),t.jsx("div",{className:"w-32",children:t.jsx(Xe,{id:`${n}-limit`,label:"Limit",value:r,onChange:a,min:1,max:Ke,error:o.limit})}),t.jsx(mt,{busy:u.status==="loading",children:"Load"})]}),t.jsxs(ft,{state:u,loadingMessage:"Comparing sign-up dates with first-seen dates",errorTitle:"Could not load old-browser sign-ups",emptyMessage:"No account was created on a browser older than that",onRetry:l,children:[u.meta&&t.jsxs("p",{className:`${Gr} mb-2`,children:["Scanned ",te(u.meta.scanned)," links",u.meta.truncated?" (bounded — more matches may exist)":""]}),t.jsx(De,{columns:ra(e),rows:u.rows,rowKey:(p,b)=>p.id??p.event_id??b})]})]})}function oa({onVisitorSelect:e}){return t.jsxs("div",{className:"space-y-6",children:[t.jsx(na,{onVisitorSelect:e}),t.jsx(ia,{onVisitorSelect:e}),t.jsx(aa,{onVisitorSelect:e})]})}const{BUTTON_ACCENT_CLASSES:On,BUTTON_HAIRLINE_CLASSES:la,CARD_CLASSES:ca,FIELD_INPUT_CLASSES:X,FIELD_LABEL_CLASSES:Q,MICRO_LABEL_CLASSES:Kt}=O,da="inline-flex items-center rounded-pill border border-line bg-wash px-2.5 py-0.5 font-mono-micro text-[10px] uppercase tracking-[0.12em] text-ink",Yt=2048,Jt=200,Qe
3=256,ua=45,ma=/^(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/,pa=/^[0-9A-Fa-f:.]+$/,fa=new Set(["browser_automation","scraping"]),ha=[{id:"bot",title:"Bot",keys:new Set(["bot_info.category","bot_info.provider","bot_info.provider_url","bot_info.name","bot_info.identity","bot_info.confidence"])},{id:"network_v4",title:"IP intelligence (IPv4)",keys:null},{id:"network_v6",title:"IP intelligence (IPv6)",keys:null},{id:"proxy",title:"Proxy",keys:new Set(["proxy","proxy_confidence","proxy_details.proxy_type","proxy_details.last_seen_at","proxy_details.provider"])},{id:"vpn",title:"VPN",keys:new Set(["vpn","vpn_confidence","vpn_methods.timezone_mismatch","vpn_methods.public_vpn","vpn_methods.auxiliary_mobile","vpn_methods.os_mismatch","vpn_methods.relay","vpn_methods.ml_prediction"])},{id:"request",title:"Request echo",keys:new Set(["event_id","timestamp","source","url","linked_id","tags"])}],ee={status:"idle",data:null,error:null},Fn={status:"loading",data:null,error:null},Bn=(e,n)=>{ae(new Error(`fingerprint-admin ${n?.code??"unknown"}`),{function:e,code:n?.code??null,status:n?.status??null})},Ze=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),de=e=>e==null||e===""?"unknown":String(e),xa=e=>{try{return JSON.parse(e)}catch{return}},ba=e=>{const n={},s={method:_n.includes(e.method)?e.method:"GET"},i=e.url.trim();let r=null;try{r=new URL(i)}catch{r=null}!r||r.protocol!=="http:"&&r.protocol!=="https:"?n.url="Enter an absolute http(s) URL":i.includes("#")?n.url="Remove the #fragment — Fingerprint rejects URLs with one":i.length>Yt?n.url=`The URL must be ${Yt} characters or fewer`:s.url=i;const a=e.ipv4.trim(),o=e.ipv6.trim();!a&&!o&&(n.ip="Enter an IPv4 or IPv6 address — at least one is required"),a&&(ma.test(a)?s.ipv4_address=a:n.ipv4="IPv4 must be a dotted quad such as 203.0.113.9"),o&&(o.includes(":")&&o.length<=ua&&pa.test(o)?s.ipv6_address=o:n.ipv6="IPv6 must contain colons and only hex digits, colons and dots");const d=Rs(e.headers);d.length===0?n.headers='Add at least one header as "Name: value"':d.length>Jt?n.headers=`At most ${Jt} headers`:s.headers=d;const u=e.linkedId.trim();u&&(u.length>Qe?n.linkedId=`The linked id must be ${Qe} characters or fewer`:s.linked_id=u);const c=e.tags.trim();if(c){const h=xa(c);Ze(h)?s.tags=h:n.tags='Tags must be a JSON object such as {"source": "manual"}'}return{errors:n,params:s}};function Pn({icon:e,title:n,intro:s,children:i}){const r=e,a=m.useId();return t.jsxs("section",{"aria-labelledby":a,className:ca,children:[t.jsxs("h3",{id:a,className:"mb-2 flex items-center gap-2 font-serif-display text-2xl text-ink",children:[t.jsx(r,{size:20,className:"text-accent","aria-hidden":"true"}),n]}),s&&t.jsx("p",{className:"mb-4 text-sm text-sub",children:s}),i]})}function Z({id:e,message:n}){return n?t.jsx("p",{id:e,className:"mt-1 text-xs text-accent",children:n}):null}function Un({state:e,errorTitle:n,loadingMessage:s,onRetry:i}){return e.status==="loading"?t.jsx(_,{kind:"loading",message:s}):e.status==="error"?t.jsx(_,{kind:"error",title:n,message:I(e.error),retryAfter:e.error?.retryAfter,onRetry:i,children:e.error?.code==="no_client_ip"&&t.jsx("p",{className:"text-sub",children:"The function found no x-forwarded-for, cf-connecting-ip or x-real-ip header on the incoming request, so there was no address to analyse."})}):null}function Mn({result:e}){const n=Ze(e)?e:{},s=Ze(n.bot_info)?n.bot_info:null,i=s&&(s.identity==="spoofed"||fa.has(s.category))?"bad":"warn",r=n.ip_info?.v4?.datacenter_result===!0||n.ip_info?.v6?.datacenter_result===!0,a=n.ip_info?.v4?.datacenter_name||n.ip_info?.v6?.datacenter_name||null,o=Sn(n),d=ha.map(({id:u,title:c,keys:h})=>{const l=o.find(p=>p.id===u),f=l?h?l.items.filter(p=>h.has(p.key)):l.items:[];return{id:u,title:c,items:f}});return t.jsxs("div",{className:"space-y-5","data-testid":"edge-result",children:[t.jsxs("div",{className:"rounded-lg border border-line bg-wash p-4",children:[t.jsx("p",{className:`${Kt} mb-2`,children:"Verdict"}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s?t.jsx(P,{label:"Bot",severity:i,value:s.name??s.category??"detected"}):t.jsx(P,{label:"No bot detected",severity:"info"}),n.proxy===!0&&t.jsx(P,{label:"Proxy",severity:"warn",value:n.proxy_details?.proxy_type??n.proxy_confidence}),n.vpn===!0&&t.jsx(P,{label:"VPN",severity:"warn",value:n.vpn_confidence}),r&&t.jsx(P,{label:"Datacenter",severity:"warn",value:a})]}),t.jsx("p",{className:"mt-2 text-sm text-sub",children:s?`${de(s.name)} by ${de(s.provider)} — category ${de(s.category)}, identity ${de(s.identity)}, confidence ${de(s.confidence)}
3.`:"Fingerprint did not classify this request as a bot or AI agent."})]}),d.map(u=>t.jsxs("section",{"aria-label":u.title,className:"space-y-2",children:[t.jsx("h4",{className:Kt,children:u.title}),t.jsx(ct,{items:u.items})]},u.id)),t.jsx(re,{value:n,label:"Raw response"})]})}function _a(){const[e,n]=m.useState(ee),s=m.useRef(0),i=async()=>{const r=s.current+1;s.current=r,n(Fn);const a=await ai();if(s.current===r){if(a.error){Bn("AutomationIntelligenceTab.analyzeOwnRequest",a.error),n({...ee,status:"error",error:a.error});return}n({...ee,status:"ready",data:a.data})}};return t.jsxs(Pn,{icon:hn,title:"Analyze my current request",intro:"Forwards this browser's request headers to the edge function, which blanks Authorization, Cookie and similar values before sending them to Fingerprint together with your public IP address. The linked id is your user id.",children:[t.jsxs("button",{type:"button",onClick:i,disabled:e.status==="loading",className:`${On} mb-4`,children:[e.status==="loading"?t.jsx(R,{size:16,className:"animate-spin","aria-hidden":"true"}):t.jsx(we,{size:16,"aria-hidden":"true"}),"Analyze my request"]}),t.jsx(Un,{state:e,errorTitle:"Self-check failed",loadingMessage:"Asking Fingerprint about this request",onRetry:i}),e.status==="ready"&&t.jsx(Mn,{result:e.data})]})}const Wt={url:"",method:"GET",ipv4:"",ipv6:"",headers:"",linkedId:"",tags:""};function ga(){const e=m.useId(),[n,s]=m.useState(Wt),[i,r]=m.useState({}),[a,o]=m.useState(ee),d=m.useRef(0),u=p=>b=>s(v=>({...v,[p]:b.target.value})),c=p=>i[p]?`${e}-${p}-error`:void 0,h=async p=>{const b=d.current+1;d.current=b,o(Fn);const v=await ri(p);if(d.current===b){if(v.error){Bn("AutomationIntelligenceTab.analyzeRequest",v.error),o({...ee,status:"error",error:v.error});return}o({...ee,status:"ready",data:v.data})}},l=p=>{p.preventDefault();const{errors:b,params:v}=ba(n);r(b),!(Object.keys(b).length>0)&&h(v)},f=()=>{s(Wt),r({}),o(ee)};return t.jsxs(Pn,{icon:xn,title:"Analyze a request",intro:"Rebuild a request your server received — URL, method, the headers in their original order, and the client IP — to see how Fingerprint classifies it. Put an empty value after any header that carried a secret.",children:[t.jsxs("form",{onSubmit:l,noValidate:!0,className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-[minmax(0,1fr)_10rem]",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${e}-url`,className:Q,children:"URL"}),t.jsx("input",{id:`${e}-url`,type:"url",value:n.url,onChange:u("url"),placeholder:"https://example.com/login",autoComplete:"off",spellCheck:!1,"aria-invalid":i.url?"true":void 0,"aria-describedby":c("url"),className:X}),t.jsx(Z,{id:c("url"),message:i.url})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${e}-method`,className:Q,children:"Method"}),t.jsx("select",{id:`${e}-method`,value:n.method,onChange:u("method"),className:X,children:_n.map(p=>t.jsx("option",{value:p,children:p},p))})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${e}-ipv4`,className:Q,children:"IPv4 address"}),t.jsx("input",{id:`${e}-ipv4`,type:"text",value:n.ipv4,onChange:u("ipv4"),placeholder:"203.0.113.9",autoComplete:"off",spellCheck:!1,"aria-invalid":i.ipv4||i.ip?"true":void 0,"aria-describedby":c("ipv4")??c("ip"),className:X}),t.jsx(Z,{id:c("ipv4"),message:i.ipv4})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${e}-ipv6`,className:Q,children:"IPv6 address"}),t.jsx("input",{id:`${e}-ipv6`,type:"text",value:n.ipv6,onChange:u("ipv6"),placeholder:"2001:db8::1",autoComplete:"off",spellCheck:!1,"aria-invalid":i.ipv6||i.ip?"true":void 0,"aria-describedby":c("ipv6")??c("ip"),className:X}),t.jsx(Z,{id:c("ipv6"),message:i.ipv6})]})]}),t.jsx(Z,{id:c("ip"),message:i.ip}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${e}-headers`,className:Q,children:"Headers"}),t.jsx("textarea",{id:`${e}-headers`,value:n.headers,onChange:u("headers"),rows:6,placeholder:`Host: example.com
4User-Agent: Mozilla/5.0
5Authorization: `,spellCheck:!1,"aria-invalid":i.headers?"true":void 0,"aria-describedby":c("headers")??`${e}-headers-help`,className:`${X} font-mono-micro text-xs`}),!i.headers&&t.jsx("p",{id:`${e}-headers-help`,className:"mt-1 text-xs text-faint",children:"One header per line, Name: value — keep the original order and capitalisation; leave secret values empty."}),t.jsx(Z,{id:c("headers"),message:i.headers})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${e}-linked`,className:Q,children:"Linked id (optional)"}),t.jsx("input",{id:`${e}-linked`,type:"text",value:n.linkedId,onChange:u("linkedId"),maxLength:Qe,autoComplete:"off",spellCheck:!1,"aria-invalid":i.linkedId?"true":void 0,"aria-describedby":c("linkedId"),className:X}),t.jsx(Z,{id:c("linkedId"),message:i.linkedId})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${e}-tags`,className:Q,children:"Tags (optional JSON object)"}),t.jsx("textarea",{id:`${e}-tags`,value:n.tags,onChange:u("tags"),rows:2,placeholder:'{"source": "manual"}',spellCheck:!1,"aria-invalid":i.tags?"true":void 0,"aria-describedby":c("tags"),className:`${X} font-mono-micro text-xs`}),t.jsx(Z,{id:c("tags"),message:i.tags})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.jsxs("button",{type:"submit",disabled:a.status==="loading",className:On,children:[a.status==="loading"?t.jsx(R,{size:16,className:"animate-spin","aria-hidden":"true"}):t.jsx(we,{size:16,"aria-hidden":"true"}),"Analyze"]}),t.jsx("button",{type:"button",onClick:f,className:la,children:"Clear"})]})]}),t.jsxs("div",{className:"mt-4 space-y-4",children:[t.jsx(Un,{state:a,errorTitle:"Analysis failed",loadingMessage:"Asking Fingerprint about this request"}),a.status==="ready"&&t.jsx(Mn,{result:a.data})]})]})}function ya(){return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:da,children:"Public preview"}),t.jsx("p",{className:"text-sm text-sub",children:"The Automation Intelligence API analyses a request's headers and IP address entirely server-side — bot and AI-agent detection plus IP intelligence (geolocation, ASN, datacenter, proxy and VPN) with no JavaScript agent involved. Fingerprint answers in under 30 ms on average; results are shown here and never stored by VRS/A."})]}),t.jsx(_a,{}),t.jsx(ga,{})]})}const{BUTTON_HAIRLINE_CLASSES:Vn,CARD_CLASSES:va,MICRO_LABEL_CLASSES:zn,TABLE_CELL_CLASSES:Sa,TABLE_HEAD_CLASSES:ja}=O,Na={health:ns,api_keys:es,environments:bn,webhooks:_s,filtering_rules:hn,subdomains:is,encryption_keys:Zn},qn="redacted",ka={open:!1,status:"idle",items:[],payload:null,metadata:null,error:null},Xt=()=>Object.fromEntries(rt.map(e=>[e.id,ka])),Aa=(e,n)=>{n?.code!=="management_api_not_configured"&&ae(new Error(`fingerprint-admin ${n?.code??"unknown"}`),{function:e,code:n?.code??null,status:n?.status??null})},ie=e=>e!=null&&e!=="",k=e=>ie(e)?String(e):"—",Ye=e=>e===!0?"Yes":"No",Qt=e=>Array.isArray(e)?e:[],ve=(e,n="—")=>ie(e)?typeof e=="string"||typeof e=="number"?String(e):typeof e=="object"?ie(e.n
5ame)?String(e.name):ie(e.id)?String(e.id):n:String(e):n,Ea=e=>ie(e?.token_hint)?`…${e.token_hint}`:qn,Ca=e=>[e?.pagination?.next_cursor,e?.pagination?.cursor,e?.next_cursor,e?.cursor].find(i=>typeof i=="string"&&i.trim()!=="")??null,La=e=>Array.isArray(e)?e:Array.isArray(e?.data)?e.data:[],Zt=e=>Array.isArray(e?.allow)||Array.isArray(e?.deny);function wa({columns:e,rows:n,rowKey:s}){return t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{children:t.jsx("tr",{className:"border-b border-line",children:e.map(i=>t.jsx("th",{scope:"col",className:ja,children:i.label},i.label))})}),t.jsx("tbody",{children:n.map((i,r)=>t.jsx("tr",{className:"border-b border-line/50 hover:bg-wash",children:e.map(a=>t.jsx("td",{className:Sa,children:a.render(i)},a.label))},s(i,r)))})]})})}function en(){return t.jsx("span",{className:"italic text-faint",children:qn})}function tn({label:e,values:n}){return t.jsxs("span",{className:"block",children:[t.jsxs("span",{className:zn,children:[e,": "]}),n.length>0?n.map(String).join(", "):"—"]})}const Ia={api_keys:[{label:"Name",render:e=>k(e.name)},{label:"Type",render:e=>k(e.type)},{label:"Status",render:e=>k(e.status)},{label:"Environment",render:e=>ve(e.environment)},{label:"Token",render:e=>ie(e.token_hint)?t.jsx("span",{className:"font-mono-micro text-xs",children:Ea(e)}):t.jsx(en,{})},{label:"Rate limit",render:e=>k(e.rate_limit)},{label:"Created",render:e=>N(e.created_at)},{label:"Disabled",render:e=>N(e.disabled_at)}],environments:[{label:"Name",render:e=>k(e.name)},{label:"Description",render:e=>k(e.description)},{label:"Limit mode",render:e=>k(e.limit_mode)},{label:"Limit value",render:e=>k(e.limit_value)},{label:"Restricted",render:e=>Ye(e.is_restricted)},{label:"Created",render:e=>N(e.created_at)}],webhooks:[{label:"URL",render:e=>t.jsx("span",{className:"break-all",children:k(e.url)})},{label:"Description",render:e=>k(e.description)},{label:"Status",render:e=>k(e.status)},{label:"Verified",render:e=>Ye(e.verified)},{label:"Environment",render:e=>ve(e.environment,"Global")},{label:"Legacy",render:e=>Ye(e.legacy)},{label:"Basic auth",render:e=>e.basic_auth?.configured===!0?"Configured":"Not configured"},{label:"Created",render:e=>N(e.created_at)}],filtering_rules:[{label:"Name",render:e=>Zt(e)?`${k(e.type)} list`:k(e.name)},{label:"Environment",render:e=>ve(e.environment)},{label:"Rule",render:e=>Zt(e)?t.jsxs("span",{className:"block space-y-1 text-sm",children:[t.jsx(tn,{label:"Allow",values:Qt(e.allow)}),t.jsx(tn,{label:"Deny",values:Qt(e.deny)})]}):t.jsx("code",{className:"break-all font-mono-micro text-xs",children:k(e.expression)})},{label:"Action",render:e=>k(e.action)},{label:"Status",render:e=>k(e.status)},{label:"Deny with",render:e=>k(e.deny_with)},{label:"Created",render:e=>N(e.created_at)}],subdomains:[{label:"Subdomain",render:e=>k(e.subdomain)},{label:"Status",render:e=>k(e.status)},{label:"Created",render:e=>N(e.created_at)},{label:"Updated",render:e=>N(e.updated_at)}],encryption_keys:[{label:"Name",render:e=>k(e.name)},{label:"Status",render:e=>k(e.status)},{label:"Environment",render:e=>ve(e.environment)},{label:"Token",render:()=>t.jsx(en,{})},{label:"Created",render:e=>N(e.created_at)},{label:"Last rotated",render:e=>N(e.last_rotated_at)}]},Ta=(e,n)=>e?.id??e?.subdomain??e?.url??`${e?.environment??""}-${n}`;function Ra({section:e,state:n,onRetry:s,onLoadMore:i}){const{items:r,payload:a,metadata:o,status:d,error:u}=n;if(d==="idle")return t.jsx("p",{className:"text-sm text-faint",children:"Not loaded yet."});if(d==="loading"&&r.length===0)return t.jsx(_,{kind:"loading",message:`Fetching ${e.label.toLowerCase()}`});if(d==="error")return t.jsx(_,{kind:"error",title:`Could not load ${e.label.toLowerCase()}`,message:I(u),retryAfter:u?.retryAfter,onRetry:s});if(e.id==="health")return t.jsx(re,{value:a,label:"Health",collapsedByDefault:!1});const c=Ia[e.id],h=Ca(o);return t.jsxs("div",{className:"space-y-3",children:[r.length===0?t.jsx(_,{kind:"empty",message:`No ${e.label.toLowerCase()} in this workspace`}):c?t.jsx(wa,{columns:c,rows:r,rowKey:Ta}):t.jsx(re,{value:a,label:e.label,collapsedByDefault:!1}),h&&t.jsxs("button",{type:"button",onClick:()=>i(h),disabled:d==="loading",className:Vn,children:[d==="loading"&&t.jsx(R,{size:16,className:"animate-spin","aria-hidden":"true"}),"Load more"]})]})}function Da({section:e,state:n,hideActions:s,onToggle:i,onLoad:r,onLoadMore:a}){const o=m.useId(),d=Na[e.id]??bn,u=n.open?Ce:Le,c=n.status==="ready"?"Reload":"Load";return t.jsxs("section",{className:va,children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("button",{type:"button",onClick:i,"aria-expanded":n.open,"aria-controls":n.open?o:void 0,className:"inline-flex items-center gap-2 rounded-sm text-left font-serif-display text-2xl text-ink transition-colors hover:text-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:[t.jsx(u,{size:18,"aria-hidden":"true"}),t.jsx(d,{size:20,className:"text-accent","aria-hidden":"true"}),e.label]}),!s&&t.jsxs("button",{type:"button",onClick:r,disabled:n.status==="loading","aria-label":`${c} ${e.label}`,className:Vn,children:[n.status==="loading"?t.jsx(R,{size:16,className:"animate-spin","aria-hidden":"true"}):null,c]})]}),t.jsx("p",{className:"mt-1 text-sm text-sub",children:e.description}),e.redacted.length>0&&t.jsxs("p",{className:`${zn}
5 mt-1`,children:["Redacted server-side: ",e.redacted.join(", ")]}),n.open&&!s&&t.jsx("div",{id:o,className:"mt-4",children:t.jsx(Ra,{section:e,state:n,onRetry:r,onLoadMore:a})})]})}function $a(){const[e,n]=m.useState(!1),[s,i]=m.useState(Xt),r=(d,u)=>i(c=>({...c,[d]:{...c[d],...typeof u=="function"?u(c[d]):u}})),a=async(d,u=null)=>{r(d,f=>({open:!0,status:"loading",error:null,items:u?f.items:[],metadata:u?f.metadata:null,payload:u?f.payload:null}));const c=await mi(d,u?{cursor:u}:{});if(c.error){if(c.error.code==="management_api_not_configured"){n(!0),i(Xt());return}Aa(`WorkspaceTab.${d}`,c.error),r(d,{status:"error",error:c.error});return}const h=c.data,l=La(h);r(d,f=>({status:"ready",payload:h,metadata:h?.metadata??null,items:u?[...f.items,...l]:l}))},o=d=>r(d,u=>({open:!u.open}));return t.jsxs("div",{className:"space-y-6",children:[t.jsx("p",{className:"text-sm text-sub",children:"Read-only view of the Fingerprint Management API for this workspace. It uses a separate Management API key; secrets and tokens are redacted server-side before anything reaches the browser."}),e&&t.jsx(_,{kind:"info",title:"Management API not configured",message:"Set FINGERPRINT_MANAGEMENT_API_KEY on the fingerprint-admin function to read the workspace's API keys, environments, webhooks, filtering rules, subdomains and encryption keys. Tokens and signing keys stay redacted even once it is set."}),rt.map(d=>t.jsx(Da,{section:d,state:s[d.id],hideActions:e,onToggle:()=>o(d.id),onLoad:()=>a(d.id),onLoadMore:u=>a(d.id,u)},d.id))]})}const nn="overview",Oa="flex items-center gap-2 rounded-sm px-4 py-2 text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",Fa="bg-wash text-ink",Ba="text-sub hover:bg-wash hover:text-ink",Pa="inline-flex items-center rounded-pill border border-line bg-card px-2 py-0.5 font-mono-micro text-[10px] uppercase tracking-[0.12em] text-sub",sn=[{id:"overview",label:"Overview",icon:as,render:({onEventSelect:e,onVisitorSelect:n})=>t.jsx(Pi,{onEventSelect:e,onVisitorSelect:n})},{id:"events",label:"Events",icon:we,render:({selectedEvent:e,onVisitorSelect:n})=>t.jsx(jr,{initialEvent:e,onVisitorSelect:n})},{id:"visitors",label:"Visitors",icon:xs,render:({selectedVisitorId:e,onEventSelect:n})=>t.jsx(Mr,{initialVisitorId:e,onEventSelect:n})},{id:"linked-accounts",label:"Linked accounts",icon:it,render:({onVisitorSelect:e})=>t.jsx(oa,{onVisitorSelect:e})},{id:"automation-intelligence",label:"Automation intelligence",icon:xn,badge:"Public preview",render:()=>t.jsx(ya,{})},{id:"workspace",label:"Workspace",icon:ds,render:()=>t.jsx($a,{})}];function Ma(){const e=m.useId(),[n,s]=m.useState(nn),[i,r]=m.useState(()=>new Set([nn])),[a,o]=m.useState(null),[d,u]=m.useState(null),c=p=>{s(p),r(b=>b.has(p)?b:new Set(b).add(p))},f={selectedEvent:a,selectedVisitorId:d,onEventSelect:p=>{o(p),c("events")},onVisitorSelect:p=>{u(p),c("visitors")}};return t.jsxs("section",{"data-sentry-block":!0,"aria-labelledby":e,children:[t.jsxs("div",{className:"mb-6",children:[t.jsxs("h2",{id:e,className:"flex items-center gap-2 font-serif-display text-3xl text-ink",children:[t.jsx(nt,{size:24,className:"text-accent","aria-hidden":"true"}),"Fingerprint"]}),t.jsx("p",{className:"mt-1 text-sm text-sub",children:"Server API, Automation Intelligence and account linking — shown to admins only, never stored by VRS/A"})]}),t.jsx("div",{className:"mb-6 flex flex-wrap gap-2 border-b border-line pb-2",children:sn.map(p=>{const b=n===p.id;return t.jsxs("button",{type:"button",onClick:()=>c(p.id),"aria-pressed":b,className:`${Oa} ${b?Fa:Ba}`,children:[t.jsx(p.icon,{size:16,"aria-hidden":"true"}),p.label,p.badge&&t.jsx("span",{className:Pa,children:p.badge})]},p.id)})}),sn.filter(p=>i.has(p.id)).map(p=>t.jsx("div",{"data-tab":p.id,hidden:n!==p.id,children:p.render(f)},p.id))]})}export{Ma as default};

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.