@xenon-device-management/xenon 1.20.1 → 1.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/package.json +1 -1
- package/lib/public/assets/{ApiKeyGate-DvGX2jRA.js → ApiKeyGate-DZb6NwEl.js} +1 -1
- package/lib/public/assets/{BugReportButton-DwbQRjXg.js → BugReportButton-CXMTmp4u.js} +1 -1
- package/lib/public/assets/{DeviceMosaicView-FwTyGhoV.js → DeviceMosaicView-D18a1AYh.js} +1 -1
- package/lib/public/assets/{EmptyState-qENFDW98.js → EmptyState-DdKOWe90.js} +1 -1
- package/lib/public/assets/{FieldGroup-C0fVhQC6.js → FieldGroup-CeFDx8aU.js} +1 -1
- package/lib/public/assets/{Modal-CbQKnS9E.js → Modal-BeDHd61x.js} +1 -1
- package/lib/public/assets/{SegmentedControl-Dr587STp.js → SegmentedControl-ClGNBJqP.js} +1 -1
- package/lib/public/assets/{SettingCard-kS2h4hI_.js → SettingCard-D5Ljar8F.js} +1 -1
- package/lib/public/assets/{Table-CnJZG7Tr.js → Table-CVoYIFrV.js} +1 -1
- package/lib/public/assets/{activity-5LzBRwZc.js → activity-C8kSwV4x.js} +1 -1
- package/lib/public/assets/{ai-settings-C8sncqu3.js → ai-settings-mZn3VsgO.js} +1 -1
- package/lib/public/assets/{api-keys-BMHuU8Dr.js → api-keys-BN4ZdSKI.js} +1 -1
- package/lib/public/assets/{apps-C4yIXLri.js → apps--1DGQgSd.js} +1 -1
- package/lib/public/assets/{arrow-left-EoA0rn6G.js → arrow-left-Bx1-ExQr.js} +1 -1
- package/lib/public/assets/{arrow-up-right-DC8JANkC.js → arrow-up-right-C06pFukR.js} +1 -1
- package/lib/public/assets/{auth-shell-DsytSZTs.js → auth-shell-Bzztd971.js} +1 -1
- package/lib/public/assets/{builds-page-Dg7iuOE4.js → builds-page-uchHuZzS.js} +1 -1
- package/lib/public/assets/{button-DqHN9g-N.js → button-BD0qp0wO.js} +1 -1
- package/lib/public/assets/{check-ZT6Urlsn.js → check-DfuIwbk5.js} +1 -1
- package/lib/public/assets/{chevron-right-Y4J1bdGR.js → chevron-right-Bnhlh4jC.js} +1 -1
- package/lib/public/assets/{circle-check-CcffaTbj.js → circle-check-BYavFzCx.js} +1 -1
- package/lib/public/assets/{circle-x-BswrxAR8.js → circle-x-D0e-HLLy.js} +1 -1
- package/lib/public/assets/{clock-zVgWx7x9.js → clock-Y9Spj4eZ.js} +1 -1
- package/lib/public/assets/{copy-CYRQVVgz.js → copy-D2H_l8Za.js} +1 -1
- package/lib/public/assets/{device-explorer-BXkLeHOo.js → device-explorer-wIzpD8uj.js} +2 -2
- package/lib/public/assets/{download-DI-vTQr5.js → download-DXRyWZTc.js} +1 -1
- package/lib/public/assets/{forgot-password-CT5p3biH.js → forgot-password-D1hanmCa.js} +1 -1
- package/lib/public/assets/{funnel-DfN4Y_Ae.js → funnel-_KldywHh.js} +1 -1
- package/lib/public/assets/{index-Cz4zmgOc.js → index-D9hpVxoi.js} +2 -2
- package/lib/public/assets/{input-CKlF0GHd.js → input-DNFrhBhx.js} +1 -1
- package/lib/public/assets/{layers-5pKiqzBC.js → layers-y9zk6puF.js} +1 -1
- package/lib/public/assets/{lock-DKz-4Hu1.js → lock-D8MCyBaM.js} +1 -1
- package/lib/public/assets/{login-DHJeq8S7.js → login-DKWKvs3G.js} +1 -1
- package/lib/public/assets/{maintenance-settings-CAh7HUZ-.js → maintenance-settings-CjVfi491.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-CBJI7WHO.js → mouse-pointer-2-x4iFczMu.js} +1 -1
- package/lib/public/assets/{overview-C1R2UQl1.js → overview-C6ZfEbkx.js} +1 -1
- package/lib/public/assets/{page-header-DMEJCtqt.js → page-header-B4fWZ7PA.js} +1 -1
- package/lib/public/assets/{plus-BxyD47mK.js → plus-D6xpkCEm.js} +1 -1
- package/lib/public/assets/{profile-page-Du1DxpAU.js → profile-page-C5a037Qf.js} +1 -1
- package/lib/public/assets/{reset-password-B9XZ2maL.js → reset-password-C4Ive_lM.js} +1 -1
- package/lib/public/assets/{runbook-page-CccKo_ux.js → runbook-page-81jN3TdY.js} +1 -1
- package/lib/public/assets/{select-BN67cHdi.js → select-BscNeBV4.js} +1 -1
- package/lib/public/assets/{selector-detail-page-Clqvo8sX.js → selector-detail-page-RO6D6fu3.js} +1 -1
- package/lib/public/assets/{selector-health-page-Y-aKtKUI.js → selector-health-page-BNqjAYVM.js} +1 -1
- package/lib/public/assets/{selector-health-BQiuIT0W.js → selector-health-rV92V-Zl.js} +1 -1
- package/lib/public/assets/{session-detail-page-CqA1LWms.js → session-detail-page-BgRonRhj.js} +1 -1
- package/lib/public/assets/{settings-Dx_rptOw.js → settings-CUtTT1jN.js} +1 -1
- package/lib/public/assets/{shield-BYFc_C8i.js → shield-CexzwYTz.js} +1 -1
- package/lib/public/assets/{shield-alert-C5C7eS3d.js → shield-alert-BIv3SNUv.js} +1 -1
- package/lib/public/assets/{status-pill-outline-BzIno_Qd.js → status-pill-outline-CkiBdQ0F.js} +1 -1
- package/lib/public/assets/{tablet-3_hH8L-z.js → tablet-D8v87f0D.js} +1 -1
- package/lib/public/assets/{teams-DSbeLNCv.js → teams-B-H7q6dd.js} +1 -1
- package/lib/public/assets/{trash-2-DSomvDBz.js → trash-2-B3JVmViZ.js} +1 -1
- package/lib/public/assets/{upload-DOcSAmR4.js → upload-BLZQPsul.js} +1 -1
- package/lib/public/assets/{useSocket-DB7529bF.js → useSocket-DsmPkV7G.js} +1 -1
- package/lib/public/assets/{users-DWiAFkSA.js → users-CQh4bnF2.js} +1 -1
- package/lib/public/assets/{webhook-settings-7uAwLEYD.js → webhook-settings-BlK9CsG0.js} +1 -1
- package/lib/public/assets/{zap-BMP6M_kU.js → zap-o6UsCI-y.js} +1 -1
- package/lib/public/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as W,j as t,r as d,h as hn,R as Jn,i as Qn,k as je,C as Os,U as ei,X as B,m as Zt,n as fn,u as ks,b as ti,o as si,p as tt,q as Ot,s as pn,c as gn,t as is,S as Ps,v as rs}from"./index-
|
|
1
|
+
import{g as W,j as t,r as d,h as hn,R as Jn,i as Qn,k as je,C as Os,U as ei,X as B,m as Zt,n as fn,u as ks,b as ti,o as si,p as tt,q as Ot,s as pn,c as gn,t as is,S as Ps,v as rs}from"./index-D9hpVxoi.js";import{P as ni}from"./page-header-B4fWZ7PA.js";import{B as st}from"./button-BD0qp0wO.js";import{S as Jt}from"./select-BscNeBV4.js";import{P as Pe,B as ii}from"./BugReportButton-CXMTmp4u.js";import{P as wt,u as Vt,a as vt,b as xn,c as As,d as ri,D as oi,e as zs,f as ai,g as nt,h as ci,M as yn}from"./Modal-BeDHd61x.js";import{F as Ut}from"./FieldGroup-CeFDx8aU.js";import{C as vn}from"./clock-Y9Spj4eZ.js";import{P as li}from"./plus-D6xpkCEm.js";import{A as di}from"./activity-C8kSwV4x.js";import{C as Xe}from"./copy-D2H_l8Za.js";import{T as bn,P as ui,U as mi}from"./upload-BLZQPsul.js";import{f as hi}from"./time-B8FIgwPE.js";import{M as Fs,F as fi}from"./mouse-pointer-2-x4iFczMu.js";import{L as pi,C as os}from"./layers-y9zk6puF.js";import{S as et}from"./shield-alert-BIv3SNUv.js";import{Z as xs}from"./zap-o6UsCI-y.js";import{C as Bt}from"./check-DfuIwbk5.js";import{C as wn}from"./chevron-right-Bnhlh4jC.js";import{A as xt,I as as}from"./keycodes-bIEJfQzr.js";import{D as gi}from"./download-DXRyWZTc.js";import{T as Ht}from"./trash-2-B3JVmViZ.js";import{L as xi}from"./lock-D8MCyBaM.js";import{S as yi}from"./SegmentedControl-ClGNBJqP.js";import{u as vi}from"./useSocket-DsmPkV7G.js";import"./utils-CDN07tui.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -251,5 +251,5 @@ ${o?`await driver.$('target').clearValue();
|
|
|
251
251
|
|
|
252
252
|
${r}${a}
|
|
253
253
|
`}function Fc(e,s){const n=new Date(s).toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");return`logcat-${e}-${n}.txt`}const un=Cs.filter(e=>e!=="V").map(e=>({value:e,label:e==="F"?"F only":`${e} and above`})),Uc=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function mn(e,s){const n=URL.createObjectURL(new Blob([e],{type:"text/plain"})),i=document.createElement("a");i.href=n,i.download=s,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(n),0)}const Bc=d.memo(function({record:s,index:n,isHit:i,isActiveHit:r}){return t.jsxs("div",{"data-row-index":n,className:`logcat-row ${s.synthetic?"is-synthetic":""} ${i?"is-hit":""} ${r?"is-active-hit":""}`,children:[t.jsx("span",{className:"logcat-time",children:Uc.format(s.ts)}),t.jsxs("span",{className:"logcat-pid",children:[s.pid,"-",s.tid]}),t.jsx("span",{className:"logcat-tag",title:s.tag,style:{color:_c(s.tag)},children:s.tag}),t.jsx("span",{className:"logcat-pkg",title:s.pkg,children:s.pkg??""}),t.jsx("span",{className:`logcat-level lvl-${s.level}`,children:s.level}),t.jsx("span",{className:"logcat-msg",children:s.message})]})});function Hc({udid:e,platform:s}){const n=(s||"").toLowerCase(),i=n==="ios",r=n==="android"||i,[a,c]=d.useState(""),l=d.useMemo(()=>i?Lc(a):void 0,[i,a]),{records:o,connected:u,clear:m,deniedReason:x,exhausted:g,retry:f}=Ec(e,r,l),[b,w]=d.useState(!0),[v,k]=d.useState(!1),[C,N]=d.useState(!0),[j,D]=d.useState(""),[R,I]=d.useState(0),$=d.useRef(null),H=d.useRef(null),T=d.useRef(null),[O,z]=d.useState(!1),[G,V]=d.useState(0),J=d.useRef(-1),F=d.useMemo(()=>Yn(a,{caseSensitive:v}),[a,v]),U=d.useMemo(()=>o.filter(P=>Dc(P,F)),[o,F]),p=d.useMemo(()=>{if(!j)return[];const P=v?j:j.toLowerCase(),Z=[];return U.forEach((ne,se)=>{(v?`${ne.tag} ${ne.message}`:`${ne.tag} ${ne.message}`.toLowerCase()).includes(P)&&Z.push(se)}),Z},[U,j,v]),Q=p.length?Math.min(R,p.length-1):0,ie=d.useMemo(()=>new Set(p),[p]),oe=d.useCallback(P=>{var ne,se;if(!p.length)return;const Z=(Q+P+p.length)%p.length;I(Z),w(!1),(se=(ne=H.current)==null?void 0:ne.querySelector(`[data-row-index="${p[Z]}"]`))==null||se.scrollIntoView({block:"center"})},[p,Q]),ye=un.some(P=>P.value===F.minLevel)?F.minLevel:"",ue=d.useCallback(()=>{mn(U.map(Zn).join(`
|
|
254
|
-
`),`logcat-${e}-${Date.now()}.txt`)},[U,e]);d.useEffect(()=>{const P=T.current;if(!P||!o.length)return;const Z=o.filter(se=>se.seq>J.current);if(!Z.length)return;const ne=J.current+1;J.current>=0&&Z[0].seq>ne&&(P.dropped+=Z[0].seq-ne),Pc(P,Z),J.current=Z[Z.length-1].seq,V(P.lines.length)},[o]);const ve=d.useCallback(()=>{const P=T.current;if(!P){J.current=o.length?o[o.length-1].seq:-1,T.current=Oc(Date.now()),V(0),z(!0);return}const Z=zc(P,Date.now(),e);T.current=null,z(!1),V(0),mn(Z,Fc(e,P.startedAt))},[o,e]);if(d.useEffect(()=>{var P;b&&((P=$.current)==null||P.scrollIntoView({block:"end"}))},[U.length,b]),!r)return t.jsxs("div",{className:"log-empty-state",children:[t.jsx("p",{className:"log-empty-title",children:"Live logs are not available here"}),t.jsx("p",{className:"log-empty-subtitle",children:"Streaming is wired up for Android (logcat) and iOS (os_trace), not for this device's platform."})]});const ke=x?"DENIED":g?"OFFLINE":u?"LIVE":"CONNECTING",Y=!u&&(!!x||g);return t.jsxs("div",{className:"logcat-root",children:[t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-filter-group",children:[t.jsxs("div",{className:"log-stat-pill",title:x??void 0,children:[t.jsx("span",{className:`log-live-dot ${u?"active":""} ${Y?"is-error":""}`}),ke]}),t.jsxs("div",{className:"log-stat-pill logcat-count",children:[U.length," / ",o.length]}),t.jsxs(Jt,{selectSize:"sm",value:ye,onChange:P=>c(Tc(a,P.target.value)),"aria-label":"Minimum log level",children:[t.jsx("option",{value:"",children:"All levels"}),un.map(P=>t.jsx("option",{value:P.value,children:P.label},P.value))]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-query",placeholder:"tag:Wifi package:com.android.systemui free text",value:a,onChange:P=>c(P.target.value),"aria-label":"Filter logs"}),a&&t.jsx("button",{type:"button",className:"logcat-input-btn",onClick:()=>c(""),"aria-label":"Clear filter",title:"Clear filter",children:t.jsx(fn,{size:12})})]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-find",placeholder:"Find…",value:j,onChange:P=>{D(P.target.value),I(0)},onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),oe(P.shiftKey?-1:1))},"aria-label":"Find in logs"}),j&&t.jsx("span",{className:"logcat-hit-count","aria-live":"polite",children:p.length?`${Q+1}/${p.length}`:"0/0"})]}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>oe(-1),disabled:!p.length,"aria-label":"Previous match",title:"Previous match (Shift+Enter)",children:t.jsx(Ni,{size:14})}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>oe(1),disabled:!p.length,"aria-label":"Next match",title:"Next match (Enter)",children:t.jsx(wi,{size:14})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${v?"active":""}`,onClick:()=>k(!v),"aria-pressed":v,"aria-label":"Match case",title:"Match case",children:t.jsx(_i,{size:15})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${C?"active":""}`,onClick:()=>N(!C),"aria-pressed":C,"aria-label":"Soft wrap",title:"Soft wrap long messages",children:t.jsx(Ar,{size:14})})]}),t.jsxs("div",{className:"log-actions-group",children:[(x||g)&&t.jsxs("button",{className:"btn-secondary btn-sm",onClick:f,children:[t.jsx(yt,{size:14})," RECONNECT"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${b?"active":""}`,onClick:()=>w(!b),children:[t.jsx(_r,{size:14})," ",b?"FREEZE":"FOLLOW"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${O?"is-recording":""}`,onClick:ve,"aria-pressed":O,title:O?"Stop recording and download the capture":"Record the raw log stream to a file",children:[O?t.jsx(jn,{size:12}):t.jsx(Bi,{size:12})," ",O?`STOP · ${G.toLocaleString()}`:"RECORD"]}),t.jsxs("button",{className:"btn-premium btn-sm",disabled:U.length===0,onClick:ue,children:[t.jsx(gi,{size:14})," EXPORT"]}),t.jsxs("button",{className:"btn-secondary btn-sm",onClick:m,children:[t.jsx(Ht,{size:14})," CLEAR"]})]})]}),t.jsxs("div",{className:`logcat-rows ${C?"":"no-wrap"}`,ref:H,children:[x&&t.jsxs("div",{className:"logcat-status-banner is-denied",role:"alert",children:[t.jsx(tt,{size:14}),t.jsxs("span",{children:["Access denied — ",x]})]}),!x&&g&&t.jsxs("div",{className:"logcat-status-banner is-exhausted",role:"alert",children:[t.jsx(tt,{size:14}),t.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect above to try again."})]}),U.map((P,Z)=>t.jsx(Bc,{record:P,index:Z,isHit:ie.has(Z),isActiveHit:p.length>0&&p[Q]===Z},P.seq)),t.jsx("div",{ref:$})]})]})}function Wc({device:e,onClose:s}){var L;const{toast:n,removeToast:i}=Zt(),r=ks(),{tab:a}=gn(),c=d.useRef(null),[l,o]=d.useState({width:0,height:0}),[u,m]=d.useState("inspect"),[x,g]=d.useState(null),[f,b]=d.useState(a||"actions"),w=f==="omni"&&u==="inspect",[v,k]=d.useState(""),[C,N]=d.useState(""),[j,D]=d.useState(""),[R,I]=d.useState(!0),[$,H]=d.useState([]),[T,O]=d.useState(null),[z,G]=d.useState(!1),[V,J]=d.useState(!1),[F,U]=d.useState(0),[p,Q]=d.useState(e),[ie,oe]=d.useState([]),[ye,ue]=d.useState(!1),[ve,ke]=d.useState(!1),[Y,P]=d.useState(null),[Z,ne]=d.useState(!1),[se,Ae]=d.useState(!1),Ge=10,[ae,be]=d.useState(!1),[Ue,Ye]=d.useState(!1),Ie=Cc(p==null?void 0:p.udid,!se),lt=()=>{navigator.clipboard.writeText(p.udid).catch(()=>{}),be(!0),setTimeout(()=>be(!1),1500)},he=d.useRef(""),fe=d.useRef(null),[_e,dt]=d.useState(!1);d.useEffect(()=>{f&&(!a||a!==f)&&r(`/devices/${e.udid}/control/${f}`,{replace:!0})},[f,a,e.udid,r]),d.useEffect(()=>((async()=>{try{J(!0),await B.startStream(p.udid);const E=(await B.getDevices()).find(M=>M.udid===p.udid);E&&Q(E)}catch(S){console.error("Auto-start stream failed:",S)}finally{J(!1)}})(),()=>{B.stopStream(p.udid).catch(()=>{})}),[e.udid]);const Be=d.useCallback(async()=>{try{ue(!0);const y=await B.listApps(p.udid);Array.isArray(y)&&oe(y)}catch(y){console.error("Failed to load apps:",y)}finally{ue(!1)}},[p.udid]);d.useEffect(()=>{f==="actions"&&Be()},[f,Be]);const Ct=parseInt(p.screenWidth||"1080",10),St=parseInt(p.screenHeight||"1920",10),Re=Math.min(Ct,St),pe=Math.max(Ct,St),Ze=Re/pe,Je=d.useCallback(()=>{const y=!R,S=y?window.innerHeight*.55:window.innerHeight*.7,E=620,q=window.innerWidth>900;let _;y?_=q?Math.min(window.innerWidth*.8,window.innerWidth-E):window.innerWidth*.8:_=window.innerWidth*.45;const ee=R?Ze:1/Ze;let X,K;R?(X=S,K=X*ee,K>_&&(K=_,X=K/ee)):(K=_,X=K/ee,X>S&&(X=S,K=X*ee)),o({width:K,height:X})},[Ze,R]);d.useEffect(()=>(Je(),window.addEventListener("resize",Je),()=>window.removeEventListener("resize",Je)),[Je]),d.useEffect(()=>{const y=async()=>{if(he.current.length>0){const E=he.current;he.current="";try{await B.typeText(p.udid,E)}catch(M){console.error("Keyboard buffering flush failed:",M)}}},S=E=>{const M=document.activeElement;if(M&&(M.tagName==="INPUT"||M.tagName==="TEXTAREA"||M.isContentEditable)||!_e&&f!=="terminal")return;const _=E.key;_==="Enter"?(fe.current&&clearTimeout(fe.current),y(),B.pressKey(p.udid,p.platform==="android"?66:"enter")):_==="Backspace"?(fe.current&&clearTimeout(fe.current),y(),B.pressKey(p.udid,p.platform==="android"?67:"backspace")):_.length===1&&(he.current+=_,fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>{y()},50))};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S),fe.current&&clearTimeout(fe.current)}},[p.udid,p.platform,_e,f]);const[kt,At]=d.useState(Date.now()),ut=()=>{const y=F>0?`r=${F}&`:"";return p.session_id&&!String(p.session_id).startsWith("manual_")?`/xenon/api/session/${p.session_id}/live_video?${y}t=${kt}`:`/xenon/api/control/${p.udid}/stream?${y}t=${kt}`};d.useEffect(()=>{F>0&&At(Date.now())},[F]),d.useEffect(()=>{if(Z||se)return;const y=setTimeout(()=>Ae(!0),3e4);return()=>clearTimeout(y)},[Z,se,F]);const He=d.useRef(null),mt=y=>{const S=y.currentTarget.getBoundingClientRect();return{x:y.clientX-S.left,y:y.clientY-S.top}},Qe=y=>{const S=mt(y);He.current={x:S.x,y:S.y,time:Date.now()}},ht=async y=>{var Oe;if(!He.current)return;const S=He.current,E=mt(y),M=Date.now()-S.time,q=(Oe=c.current)==null?void 0:Oe.getBoundingClientRect(),_=(q==null?void 0:q.width)||l.width,ee=(q==null?void 0:q.height)||l.height;let X,K,te,we;R?(X=S.x/_*Re,K=S.y/ee*pe,te=E.x/_*Re,we=E.y/ee*pe):(X=S.x/_*pe,K=S.y/ee*Re,te=E.x/_*pe,we=E.y/ee*Re);const Ee=Math.abs(te-X),me=Math.abs(we-K);try{M<500&&Ee<10&&me<10?await B.tap(p.udid,Math.round(X),Math.round(K)):M>=500&&Ee<10&&me<10?await B.touchAndHold(p.udid,Math.round(X),Math.round(K),M):await B.swipe(p.udid,Math.round(X),Math.round(K),Math.round(te),Math.round(we))}catch(Ve){console.error("Action failed:",Ve)}He.current=null},ce=()=>B.pressKey(p.udid,p.platform==="android"?xt.HOME:as.HOME),ft=()=>B.pressKey(p.udid,xt.BACK),ns=()=>B.pressKey(p.udid,xt.APP_SWITCH),Rt=()=>B.pressKey(p.udid,p.platform==="android"?xt.VOLUME_UP:as.VOLUME_UP),Et=()=>B.pressKey(p.udid,p.platform==="android"?xt.VOLUME_DOWN:as.VOLUME_DOWN),$t=()=>B.lock(p.udid),pt=async()=>{Ye(!0);try{await B.unlock(p.udid)}finally{setTimeout(()=>Ye(!1),2500)}},Dt=async()=>{v.trim()&&(await B.typeText(p.udid,v),k(""))},Tt=async()=>{try{N("Fetching...");const y=await B.getClipboard(p.udid);y&&y.content!==void 0?N(y.content||"(Clipboard is empty)"):N("No content received")}catch{N("Error: Check Appium Settings app")}},Mt=async()=>{G(!0);try{const y=await B.getScreenshot(p.udid);if(y!=null&&y.screenshot){const S={id:mc(),base64:y.screenshot,timestamp:Date.now()};H(E=>[S,...E]),O(0)}}catch(y){console.error("Failed to take screenshot:",y)}finally{G(!1)}},gt=y=>{H(S=>{const E=S.filter(M=>M.id!==y);return E.length===0?O(null):T!==null&&T>=E.length&&O(0),E})},Lt=()=>{H([]),O(null),n("Cleared all captured evidence.","success")},It=y=>{const S=document.createElement("a");S.href=`data:image/png;base64,${y}`,S.download=`screenshot-${p.udid}-${Date.now()}.png`,S.click()},We=async y=>{const S=Re/2,E=pe/2,M=Re*.4,q=pe*.4;let _,ee,X,K;switch(y){case"left":_=S+M,ee=E,X=S-M,K=E;break;case"right":_=S-M,ee=E,X=S+M,K=E;break;case"up":_=S,ee=E+q,X=S,K=E-q;break;case"down":_=S,ee=E-q,X=S,K=E+q;break}try{await B.swipe(p.udid,Math.round(_),Math.round(ee),Math.round(X),Math.round(K))}catch(te){console.error(`Quick swipe ${y} failed:`,te)}},h=async()=>{if(j.trim()){const y=n(`Uninstalling ${j}...`,"loading",0);try{ue(!0),await B.uninstallApp(p.udid,j),D(""),n(`Request sent for ${j}`,"success"),setTimeout(Be,3e3)}catch{n("Uninstall failed. Check logs.","error")}finally{ue(!1),i(y)}}},A=async()=>{if(!Y)return;let y;try{ke(!0),y=n(`Installing app to ${p.udid}...`,"loading",0);const S=await B.uploadAndInstallApp(p.udid,Y);S.success?(n(S.message||"App installed successfully","success"),P(null),setTimeout(Be,5e3)):n("Installation failed: "+(S.error||"Unknown error"),"error")}catch(S){n("Installation failed: "+S.message,"error")}finally{y&&i(y),ke(!1)}};return t.jsxs("div",{className:"device-control-view",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"control-view-top-bar",children:[t.jsxs("button",{className:"back-to-devices-btn",onClick:s,children:[t.jsx(os,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${p.platform}`,children:p.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",p.sdk]}),p.reservedUntil&&Date.now()<p.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${p.reservedBy}${p.reservationReason?`: ${p.reservationReason}`:""}`,children:["RESERVED BY ",((L=p.reservedBy)==null?void 0:L.toUpperCase())||"ANONYMOUS"]}),t.jsx("h2",{className:"device-name-text",children:p.name}),t.jsxs("span",{className:"udid-chip",title:p.udid,children:[t.jsx("span",{className:"udid-chip__value",children:p.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:lt,"aria-label":"Copy UDID",title:ae?"Copied!":"Copy UDID",children:ae?t.jsx(Bt,{size:12}):t.jsx(Xe,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${R?"":"is-landscape"} ${f==="omni"?"omni-mode":""}`,children:[t.jsxs("div",{className:"device-preview-column",children:[t.jsx("div",{className:"device-screen-wrapper",children:t.jsxs("div",{ref:y=>{c.current=y,g(y)},className:`device-stream-canvas ${R?"":"landscape"} ${_e?"focused":""} ${w?"is-inspecting":""}`,style:{width:l.width,height:l.height,background:"#000"},tabIndex:0,onFocus:()=>dt(!0),onBlur:()=>dt(!1),onMouseDown:w?void 0:Qe,onMouseUp:w?void 0:ht,children:[se?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(tt,{size:40,color:"var(--red, #f87171)"}),t.jsx("p",{style:{marginTop:16},children:"Stream unavailable"}),t.jsx("button",{className:"btn-premium btn-sm",style:{marginTop:12},onClick:()=>{Ae(!1),U(0)},children:"Retry"})]}):(V||!Z)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(yt,{size:40,className:"animate-spin",color:"var(--green)"}),t.jsx("p",{style:{marginTop:16},children:V?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!se&&t.jsx("img",{src:ut(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>ne(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),ne(!1),F>=Ge){Ae(!0);return}setTimeout(()=>U(y=>y+1),2e3)}}),Ie==="off"&&!se&&t.jsxs("div",{className:"device-screen-off",role:"status",children:[t.jsx(lr,{size:32}),t.jsx("p",{children:"Display is off"}),t.jsx("span",{children:"The stream is fine — the device is asleep."}),t.jsx("button",{type:"button",className:"btn-premium btn-sm",onClick:pt,disabled:Ue,children:Ue?"Waking…":"Wake device"})]})]})}),t.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":R?"vertical":"horizontal",children:[t.jsx("button",{className:`footer-action-btn ${R?"active":""}`,onClick:()=>I(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":R,children:t.jsx(xr,{size:18})}),t.jsx("button",{className:`footer-action-btn ${R?"":"active"}`,onClick:()=>I(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!R,children:t.jsx(pr,{size:18})}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:ce,title:"Home","aria-label":"Home",children:t.jsx(Qi,{size:18})}),p.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"footer-action-btn",onClick:ft,title:"Back","aria-label":"Back",children:t.jsx(os,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:ns,title:"App Switcher","aria-label":"App switcher",children:t.jsx(jn,{size:18})})]}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:Rt,title:"Volume Up","aria-label":"Volume up",children:t.jsx(Lr,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Et,title:"Volume Down","aria-label":"Volume down",children:t.jsx(Tr,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:$t,title:"Lock Device","aria-label":"Lock device",children:t.jsx(xi,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:pt,title:"Unlock Device","aria-label":"Unlock device",children:t.jsx(nr,{size:18})})]})]}),t.jsxs("div",{className:"device-interactions-column",children:[t.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[t.jsxs("button",{className:`tab-btn ${f==="actions"?"active":""}`,onClick:()=>b("actions"),role:"tab","aria-selected":f==="actions",children:[t.jsx(xs,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${f==="screenshot"?"active":""}`,onClick:()=>b("screenshot"),role:"tab","aria-selected":f==="screenshot",children:[t.jsx(cs,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${f==="logs"?"active":""}`,onClick:()=>b("logs"),role:"tab","aria-selected":f==="logs",children:[t.jsx(br,{size:13}),t.jsx("span",{children:"Debug Logs"})]}),t.jsxs("button",{className:`tab-btn ${f==="terminal"?"active":""}`,onClick:()=>b("terminal"),role:"tab","aria-selected":f==="terminal",children:[t.jsx(bn,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${f==="omni"?"active":""}`,onClick:()=>b("omni"),role:"tab","aria-selected":f==="omni",children:[t.jsx(ys,{size:13}),t.jsx("span",{children:"Omni-Vision"})]})]}),t.jsx("div",{className:`interactions-scroll-area ${f==="terminal"?"terminal-mode":""} ${f==="screenshot"||f==="logs"?"screenshot-mode":""}`,children:t.jsxs("div",{className:"tab-content",children:[f==="omni"&&t.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:t.jsx(Nc,{sessionId:p.session_id?String(p.session_id):null,udid:p.udid,streamUrl:ut(),embedded:!0,overlayTarget:x,onModeChange:m})}),f==="actions"&&t.jsxs("div",{className:"actions-grid",children:[t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(fi,{size:18,color:"var(--green)"})," Smart Input"]}),t.jsx("p",{className:"action-card-hint",children:"Relay keystrokes to the focused element on the device."}),t.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Type and press Enter to send…",value:v,onChange:y=>k(y.target.value),onKeyDown:y=>y.key==="Enter"&&Dt()})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(ui,{size:18,color:"var(--green)"})," App Management"]}),t.jsxs("div",{className:"app-mgmt-content",children:[t.jsxs("div",{className:"install-section",children:[t.jsx("p",{className:"compact-label",children:"Install Package"}),t.jsxs("div",{className:"upload-box-row",children:[t.jsxs("label",{className:"file-upload-launcher",title:Y?Y.name:"Select an .apk, .ipa or .app file",children:[t.jsx(mi,{size:14}),t.jsx("span",{children:Y?Y.name:"Select File"}),t.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:y=>{var S;return P(((S=y.target.files)==null?void 0:S[0])||null)},hidden:!0})]}),t.jsx("button",{className:"btn-premium btn-sm",disabled:!Y||ve,onClick:A,children:ve?t.jsx(is,{className:"animate-spin",size:14}):"INSTALL"})]}),t.jsx("p",{className:"hint-text",children:"Accepts .apk, .ipa or .app"})]}),t.jsx("div",{className:"divider-v"}),t.jsxs("div",{className:"uninstall-section",children:[t.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),t.jsxs("div",{className:"uninstall-controls-row",children:[t.jsxs("div",{className:"select-wrapper",children:[t.jsxs(Jt,{selectSize:"sm",className:"w-full",value:j,onChange:y=>D(y.target.value),disabled:ye,children:[t.jsx("option",{value:"",children:ye?"Loading apps...":"-- Select App to Remove --"}),ie.map(y=>t.jsx("option",{value:y,children:y},y))]}),ye&&t.jsx(is,{className:"animate-spin select-loader",size:12})]}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:h,disabled:!j||ye,children:[t.jsx(Ht,{size:14})," UNINSTALL"]})]}),t.jsxs("div",{className:"manual-input-box",children:[t.jsx("p",{className:"hint-text",children:"Or enter manually:"}),t.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:j,onChange:y=>D(y.target.value)})]})]})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Wi,{size:18,color:"var(--green)"})," Clipboard"]}),t.jsxs("div",{className:"clipboard-row",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:Tt,children:"FETCH VALUE"}),t.jsx("div",{className:"clipboard-display compact",children:C})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(ur,{size:18,color:"var(--green)"})," Directional Gestures"]}),t.jsxs("div",{className:"gestures-grid-container",children:[t.jsxs("div",{className:"gestures-dpad",children:[t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("up"),children:t.jsx(Pi,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("left"),children:t.jsx(os,{size:24})}),t.jsx("div",{className:"dpad-center"}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("right"),children:t.jsx(wn,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("down"),children:t.jsx(pn,{size:24})}),t.jsx("div",{})]}),t.jsx("p",{className:"compact-label dpad-caption",children:"Quick swipe in a direction"})]})]})]}),f==="screenshot"&&t.jsxs("div",{className:"action-card screenshot-card",children:[$.length>0&&t.jsx("header",{className:"action-card-header",children:t.jsx("button",{className:"btn-text-only",onClick:Lt,children:"CLEAR ALL"})}),t.jsxs("div",{className:`screenshot-workspace ${$.length===0?"is-empty":""}`,children:[t.jsxs("div",{className:"screenshot-gallery-sidebar",children:[t.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:Mt,disabled:z,children:[z?t.jsx(is,{className:"animate-spin",size:16}):t.jsx(cs,{size:16}),t.jsx("span",{children:z?"CAPTURING...":"NEW CAPTURE"})]}),t.jsxs("div",{className:"screenshot-thumbnails-list",children:[$.length===0&&!z&&t.jsxs("div",{className:"empty-gallery-state",children:[t.jsx(cs,{size:20,className:"empty-gallery-icon"}),t.jsx("p",{className:"empty-gallery-title",children:"No captures yet"}),t.jsx("p",{className:"empty-gallery-hint",children:"Grab a screenshot of the device to begin analysis."})]}),$.map((y,S)=>t.jsxs("div",{className:`screenshot-thumb-item ${T===S?"active":""}`,onClick:()=>O(S),children:[t.jsx("img",{src:`data:image/png;base64,${y.base64}`,alt:"Thumb"}),t.jsx("span",{className:"thumb-time",children:new Date(y.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t.jsx("button",{className:"thumb-delete-btn",onClick:E=>{E.stopPropagation(),gt(y.id)},children:t.jsx(Ht,{size:12})})]},y.id))]})]}),t.jsx("div",{className:"screenshot-main-preview",children:T!==null&&$[T]?t.jsxs("div",{className:"preview-container",children:[t.jsx("div",{className:"preview-image-wrapper",children:t.jsx("img",{src:`data:image/png;base64,${$[T].base64}`,alt:"Selected Evidence"})}),t.jsxs("footer",{className:"preview-footer",children:[t.jsxs("div",{className:"preview-meta",children:[t.jsx("span",{className:"meta-label",children:"ID:"}),t.jsx("span",{className:"meta-value",children:$[T].id.substring(0,8)}),t.jsx("span",{className:"meta-divider",children:"|"}),t.jsx("span",{className:"meta-value",children:hi($[T].timestamp)})]}),t.jsxs("div",{className:"preview-actions",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:()=>It($[T].base64),children:"DOWNLOAD PNG"}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>gt($[T].id),children:[t.jsx(Ht,{size:14})," DELETE"]})]})]})]}):null})]})]}),f==="logs"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(Hc,{udid:p.udid,platform:p.platform})}),f==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(hc,{platform:(p.platform||"").toLowerCase(),prompt:`${(p.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${p.name} (${p.udid}).
|
|
254
|
+
`),`logcat-${e}-${Date.now()}.txt`)},[U,e]);d.useEffect(()=>{const P=T.current;if(!P||!o.length)return;const Z=o.filter(se=>se.seq>J.current);if(!Z.length)return;const ne=J.current+1;J.current>=0&&Z[0].seq>ne&&(P.dropped+=Z[0].seq-ne),Pc(P,Z),J.current=Z[Z.length-1].seq,V(P.lines.length)},[o]);const ve=d.useCallback(()=>{const P=T.current;if(!P){J.current=o.length?o[o.length-1].seq:-1,T.current=Oc(Date.now()),V(0),z(!0);return}const Z=zc(P,Date.now(),e);T.current=null,z(!1),V(0),mn(Z,Fc(e,P.startedAt))},[o,e]);if(d.useEffect(()=>{var P;b&&((P=$.current)==null||P.scrollIntoView({block:"end"}))},[U.length,b]),!r)return t.jsxs("div",{className:"log-empty-state",children:[t.jsx("p",{className:"log-empty-title",children:"Live logs are not available here"}),t.jsx("p",{className:"log-empty-subtitle",children:"Streaming is wired up for Android (logcat) and iOS (os_trace), not for this device's platform."})]});const ke=x?"DENIED":g?"OFFLINE":u?"LIVE":"CONNECTING",Y=!u&&(!!x||g);return t.jsxs("div",{className:"logcat-root",children:[t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-filter-group",children:[t.jsxs("div",{className:"log-stat-pill",title:x??void 0,children:[t.jsx("span",{className:`log-live-dot ${u?"active":""} ${Y?"is-error":""}`}),ke]}),t.jsxs("div",{className:"log-stat-pill logcat-count",children:[U.length," / ",o.length]}),t.jsxs(Jt,{selectSize:"sm",value:ye,onChange:P=>c(Tc(a,P.target.value)),"aria-label":"Minimum log level",children:[t.jsx("option",{value:"",children:"All levels"}),un.map(P=>t.jsx("option",{value:P.value,children:P.label},P.value))]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-query",placeholder:"tag:Wifi package:com.android.systemui free text",value:a,onChange:P=>c(P.target.value),"aria-label":"Filter logs"}),a&&t.jsx("button",{type:"button",className:"logcat-input-btn",onClick:()=>c(""),"aria-label":"Clear filter",title:"Clear filter",children:t.jsx(fn,{size:12})})]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-find",placeholder:"Find…",value:j,onChange:P=>{D(P.target.value),I(0)},onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),oe(P.shiftKey?-1:1))},"aria-label":"Find in logs"}),j&&t.jsx("span",{className:"logcat-hit-count","aria-live":"polite",children:p.length?`${Q+1}/${p.length}`:"0/0"})]}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>oe(-1),disabled:!p.length,"aria-label":"Previous match",title:"Previous match (Shift+Enter)",children:t.jsx(Ni,{size:14})}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>oe(1),disabled:!p.length,"aria-label":"Next match",title:"Next match (Enter)",children:t.jsx(wi,{size:14})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${v?"active":""}`,onClick:()=>k(!v),"aria-pressed":v,"aria-label":"Match case",title:"Match case",children:t.jsx(_i,{size:15})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${C?"active":""}`,onClick:()=>N(!C),"aria-pressed":C,"aria-label":"Soft wrap",title:"Soft wrap long messages",children:t.jsx(Ar,{size:14})})]}),t.jsxs("div",{className:"log-actions-group",children:[(x||g)&&t.jsxs("button",{className:"btn-secondary btn-sm",onClick:f,children:[t.jsx(yt,{size:14})," RECONNECT"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${b?"active":""}`,onClick:()=>w(!b),children:[t.jsx(_r,{size:14})," ",b?"FREEZE":"FOLLOW"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${O?"is-recording":""}`,onClick:ve,"aria-pressed":O,title:O?"Stop recording and download the capture":"Record the raw log stream to a file",children:[O?t.jsx(jn,{size:12}):t.jsx(Bi,{size:12})," ",O?`STOP · ${G.toLocaleString()}`:"RECORD"]}),t.jsxs("button",{className:"btn-premium btn-sm",disabled:U.length===0,onClick:ue,children:[t.jsx(gi,{size:14})," EXPORT"]}),t.jsxs("button",{className:"btn-secondary btn-sm",onClick:m,children:[t.jsx(Ht,{size:14})," CLEAR"]})]})]}),t.jsxs("div",{className:`logcat-rows ${C?"":"no-wrap"}`,ref:H,children:[x&&t.jsxs("div",{className:"logcat-status-banner is-denied",role:"alert",children:[t.jsx(tt,{size:14}),t.jsxs("span",{children:["Access denied — ",x]})]}),!x&&g&&t.jsxs("div",{className:"logcat-status-banner is-exhausted",role:"alert",children:[t.jsx(tt,{size:14}),t.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect above to try again."})]}),U.map((P,Z)=>t.jsx(Bc,{record:P,index:Z,isHit:ie.has(Z),isActiveHit:p.length>0&&p[Q]===Z},P.seq)),t.jsx("div",{ref:$})]})]})}function Wc({device:e,onClose:s}){var L;const{toast:n,removeToast:i}=Zt(),r=ks(),{tab:a}=gn(),c=d.useRef(null),[l,o]=d.useState({width:0,height:0}),[u,m]=d.useState("inspect"),[x,g]=d.useState(null),[f,b]=d.useState(a||"actions"),w=f==="omni"&&u==="inspect",[v,k]=d.useState(""),[C,N]=d.useState(""),[j,D]=d.useState(""),[R,I]=d.useState(!0),[$,H]=d.useState([]),[T,O]=d.useState(null),[z,G]=d.useState(!1),[V,J]=d.useState(!1),[F,U]=d.useState(0),[p,Q]=d.useState(e),[ie,oe]=d.useState([]),[ye,ue]=d.useState(!1),[ve,ke]=d.useState(!1),[Y,P]=d.useState(null),[Z,ne]=d.useState(!1),[se,Ae]=d.useState(!1),Ge=10,[ae,be]=d.useState(!1),[Ue,Ye]=d.useState(!1),Ie=Cc(p==null?void 0:p.udid,!se),lt=()=>{navigator.clipboard.writeText(p.udid).catch(()=>{}),be(!0),setTimeout(()=>be(!1),1500)},he=d.useRef(""),fe=d.useRef(null),[_e,dt]=d.useState(!1);d.useEffect(()=>{f&&(!a||a!==f)&&r(`/devices/${e.udid}/control/${f}`,{replace:!0})},[f,a,e.udid,r]),d.useEffect(()=>((async()=>{try{J(!0),await B.startStream(p.udid);const E=(await B.getDevices()).find(M=>M.udid===p.udid);E&&Q(E)}catch(S){console.error("Auto-start stream failed:",S)}finally{J(!1)}})(),()=>{B.stopStream(p.udid).catch(()=>{})}),[e.udid]);const Be=d.useCallback(async()=>{try{ue(!0);const y=await B.listApps(p.udid);Array.isArray(y)&&oe(y)}catch(y){console.error("Failed to load apps:",y)}finally{ue(!1)}},[p.udid]);d.useEffect(()=>{f==="actions"&&Be()},[f,Be]);const Ct=parseInt(p.screenWidth||"1080",10),St=parseInt(p.screenHeight||"1920",10),Re=Math.min(Ct,St),pe=Math.max(Ct,St),Ze=Re/pe,Je=d.useCallback(()=>{const y=!R,S=y?window.innerHeight*.55:window.innerHeight*.7,E=620,q=window.innerWidth>900;let _;y?_=q?Math.min(window.innerWidth*.8,window.innerWidth-E):window.innerWidth*.8:_=window.innerWidth*.45;const ee=R?Ze:1/Ze;let X,K;R?(X=S,K=X*ee,K>_&&(K=_,X=K/ee)):(K=_,X=K/ee,X>S&&(X=S,K=X*ee)),o({width:K,height:X})},[Ze,R]);d.useEffect(()=>(Je(),window.addEventListener("resize",Je),()=>window.removeEventListener("resize",Je)),[Je]),d.useEffect(()=>{const y=async()=>{if(he.current.length>0){const E=he.current;he.current="";try{await B.typeText(p.udid,E)}catch(M){console.error("Keyboard buffering flush failed:",M)}}},S=E=>{const M=document.activeElement;if(M&&(M.tagName==="INPUT"||M.tagName==="TEXTAREA"||M.isContentEditable)||!_e&&f!=="terminal")return;const _=E.key;_==="Enter"?(fe.current&&clearTimeout(fe.current),y(),B.pressKey(p.udid,p.platform==="android"?66:"enter")):_==="Backspace"?(fe.current&&clearTimeout(fe.current),y(),B.pressKey(p.udid,p.platform==="android"?67:"backspace")):_.length===1&&(he.current+=_,fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>{y()},50))};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S),fe.current&&clearTimeout(fe.current)}},[p.udid,p.platform,_e,f]);const[kt,At]=d.useState(Date.now()),ut=()=>{const y=F>0?`r=${F}&`:"";return p.session_id&&!String(p.session_id).startsWith("manual_")?`/xenon/api/session/${p.session_id}/live_video?${y}t=${kt}`:`/xenon/api/control/${p.udid}/stream?${y}t=${kt}`};d.useEffect(()=>{F>0&&At(Date.now())},[F]),d.useEffect(()=>{if(Z||se)return;const y=setTimeout(()=>Ae(!0),3e4);return()=>clearTimeout(y)},[Z,se,F]);const He=d.useRef(null),mt=y=>{const S=y.currentTarget.getBoundingClientRect();return{x:y.clientX-S.left,y:y.clientY-S.top}},Qe=y=>{const S=mt(y);He.current={x:S.x,y:S.y,time:Date.now()}},ht=async y=>{var Oe;if(!He.current)return;const S=He.current,E=mt(y),M=Date.now()-S.time,q=(Oe=c.current)==null?void 0:Oe.getBoundingClientRect(),_=(q==null?void 0:q.width)||l.width,ee=(q==null?void 0:q.height)||l.height;let X,K,te,we;R?(X=S.x/_*Re,K=S.y/ee*pe,te=E.x/_*Re,we=E.y/ee*pe):(X=S.x/_*pe,K=S.y/ee*Re,te=E.x/_*pe,we=E.y/ee*Re);const Ee=Math.abs(te-X),me=Math.abs(we-K);try{M<500&&Ee<10&&me<10?await B.tap(p.udid,Math.round(X),Math.round(K)):M>=500&&Ee<10&&me<10?await B.touchAndHold(p.udid,Math.round(X),Math.round(K),M):await B.swipe(p.udid,Math.round(X),Math.round(K),Math.round(te),Math.round(we))}catch(Ve){console.error("Action failed:",Ve)}He.current=null},ce=()=>B.pressKey(p.udid,p.platform==="android"?xt.HOME:as.HOME),ft=()=>B.pressKey(p.udid,xt.BACK),ns=()=>B.pressKey(p.udid,xt.APP_SWITCH),Rt=()=>B.pressKey(p.udid,p.platform==="android"?xt.VOLUME_UP:as.VOLUME_UP),Et=()=>B.pressKey(p.udid,p.platform==="android"?xt.VOLUME_DOWN:as.VOLUME_DOWN),$t=()=>B.lock(p.udid),pt=async()=>{Ye(!0);try{await B.unlock(p.udid)}finally{setTimeout(()=>Ye(!1),2500)}},Dt=async()=>{v.trim()&&(await B.typeText(p.udid,v),k(""))},Tt=async()=>{try{N("Fetching...");const y=await B.getClipboard(p.udid);y&&y.content!==void 0?N(y.content||"(Clipboard is empty)"):N("No content received")}catch{N("Error: Check Appium Settings app")}},Mt=async()=>{G(!0);try{const y=await B.getScreenshot(p.udid);if(y!=null&&y.screenshot){const S={id:mc(),base64:y.screenshot,timestamp:Date.now()};H(E=>[S,...E]),O(0)}}catch(y){console.error("Failed to take screenshot:",y)}finally{G(!1)}},gt=y=>{H(S=>{const E=S.filter(M=>M.id!==y);return E.length===0?O(null):T!==null&&T>=E.length&&O(0),E})},Lt=()=>{H([]),O(null),n("Cleared all captured evidence.","success")},It=y=>{const S=document.createElement("a");S.href=`data:image/png;base64,${y}`,S.download=`screenshot-${p.udid}-${Date.now()}.png`,S.click()},We=async y=>{const S=Re/2,E=pe/2,M=Re*.4,q=pe*.4;let _,ee,X,K;switch(y){case"left":_=S+M,ee=E,X=S-M,K=E;break;case"right":_=S-M,ee=E,X=S+M,K=E;break;case"up":_=S,ee=E+q,X=S,K=E-q;break;case"down":_=S,ee=E-q,X=S,K=E+q;break}try{await B.swipe(p.udid,Math.round(_),Math.round(ee),Math.round(X),Math.round(K))}catch(te){console.error(`Quick swipe ${y} failed:`,te)}},h=async()=>{if(j.trim()){const y=n(`Uninstalling ${j}...`,"loading",0);try{ue(!0),await B.uninstallApp(p.udid,j),D(""),n(`Request sent for ${j}`,"success"),setTimeout(Be,3e3)}catch{n("Uninstall failed. Check logs.","error")}finally{ue(!1),i(y)}}},A=async()=>{if(!Y)return;let y;try{ke(!0),y=n(`Installing app to ${p.udid}...`,"loading",0);const S=await B.uploadAndInstallApp(p.udid,Y);S.success?(n(S.message||"App installed successfully","success"),P(null),setTimeout(Be,5e3)):n("Installation failed: "+(S.error||"Unknown error"),"error")}catch(S){n("Installation failed: "+S.message,"error")}finally{y&&i(y),ke(!1)}};return t.jsxs("div",{className:"device-control-view",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"control-view-top-bar",children:[t.jsxs("button",{className:"back-to-devices-btn",onClick:s,children:[t.jsx(os,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${p.platform}`,children:p.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",p.sdk]}),p.reservedUntil&&Date.now()<p.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${p.reservedBy}${p.reservationReason?`: ${p.reservationReason}`:""}`,children:["RESERVED BY ",((L=p.reservedBy)==null?void 0:L.toUpperCase())||"ANONYMOUS"]}),t.jsx("h2",{className:"device-name-text",children:p.name}),t.jsxs("span",{className:"udid-chip",title:p.udid,children:[t.jsx("span",{className:"udid-chip__value",children:p.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:lt,"aria-label":"Copy UDID",title:ae?"Copied!":"Copy UDID",children:ae?t.jsx(Bt,{size:12}):t.jsx(Xe,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${R?"":"is-landscape"} ${f==="omni"?"omni-mode":""}`,children:[t.jsxs("div",{className:"device-preview-column",children:[t.jsx("div",{className:"device-screen-wrapper",children:t.jsxs("div",{ref:y=>{c.current=y,g(y)},className:`device-stream-canvas ${R?"":"landscape"} ${_e?"focused":""} ${w?"is-inspecting":""}`,style:{width:l.width,height:l.height,background:"#000"},tabIndex:0,onFocus:()=>dt(!0),onBlur:()=>dt(!1),onMouseDown:w?void 0:Qe,onMouseUp:w?void 0:ht,children:[se?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(tt,{size:40,color:"var(--red, #f87171)"}),t.jsx("p",{style:{marginTop:16},children:"Stream unavailable"}),t.jsx("button",{className:"btn-premium btn-sm",style:{marginTop:12},onClick:()=>{Ae(!1),U(0)},children:"Retry"})]}):(V||!Z)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(yt,{size:40,className:"animate-spin",color:"var(--green)"}),t.jsx("p",{style:{marginTop:16},children:V?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!se&&t.jsx("img",{src:ut(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>ne(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),ne(!1),F>=Ge){Ae(!0);return}setTimeout(()=>U(y=>y+1),2e3)}}),Ie==="off"&&!se&&t.jsxs("div",{className:"device-screen-off",role:"status",children:[t.jsx(lr,{size:32}),t.jsx("p",{children:"Display is off"}),t.jsx("span",{children:"The stream is fine — the device is asleep."}),t.jsx("button",{type:"button",className:"btn-premium btn-sm",onClick:pt,disabled:Ue,children:Ue?"Waking…":"Wake device"})]})]})}),t.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":R?"vertical":"horizontal",children:[t.jsx("button",{className:`footer-action-btn ${R?"active":""}`,onClick:()=>I(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":R,children:t.jsx(xr,{size:18})}),t.jsx("button",{className:`footer-action-btn ${R?"":"active"}`,onClick:()=>I(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!R,children:t.jsx(pr,{size:18})}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:ce,title:"Home","aria-label":"Home",children:t.jsx(Qi,{size:18})}),p.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"footer-action-btn",onClick:ft,title:"Back","aria-label":"Back",children:t.jsx(os,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:ns,title:"App Switcher","aria-label":"App switcher",children:t.jsx(jn,{size:18})})]}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:Rt,title:"Volume Up","aria-label":"Volume up",children:t.jsx(Lr,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Et,title:"Volume Down","aria-label":"Volume down",children:t.jsx(Tr,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:$t,title:"Lock Device","aria-label":"Lock device",children:t.jsx(xi,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:pt,title:"Unlock Device","aria-label":"Unlock device",children:t.jsx(nr,{size:18})})]})]}),t.jsxs("div",{className:"device-interactions-column",children:[t.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[t.jsxs("button",{className:`tab-btn ${f==="actions"?"active":""}`,onClick:()=>b("actions"),role:"tab","aria-selected":f==="actions",children:[t.jsx(xs,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${f==="screenshot"?"active":""}`,onClick:()=>b("screenshot"),role:"tab","aria-selected":f==="screenshot",children:[t.jsx(cs,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${f==="logs"?"active":""}`,onClick:()=>b("logs"),role:"tab","aria-selected":f==="logs",children:[t.jsx(br,{size:13}),t.jsx("span",{children:"Logs"})]}),t.jsxs("button",{className:`tab-btn ${f==="terminal"?"active":""}`,onClick:()=>b("terminal"),role:"tab","aria-selected":f==="terminal",children:[t.jsx(bn,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${f==="omni"?"active":""}`,onClick:()=>b("omni"),role:"tab","aria-selected":f==="omni",children:[t.jsx(ys,{size:13}),t.jsx("span",{children:"Omni-Vision"})]})]}),t.jsx("div",{className:`interactions-scroll-area ${f==="terminal"?"terminal-mode":""} ${f==="screenshot"||f==="logs"?"screenshot-mode":""}`,children:t.jsxs("div",{className:"tab-content",children:[f==="omni"&&t.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:t.jsx(Nc,{sessionId:p.session_id?String(p.session_id):null,udid:p.udid,streamUrl:ut(),embedded:!0,overlayTarget:x,onModeChange:m})}),f==="actions"&&t.jsxs("div",{className:"actions-grid",children:[t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(fi,{size:18,color:"var(--green)"})," Smart Input"]}),t.jsx("p",{className:"action-card-hint",children:"Relay keystrokes to the focused element on the device."}),t.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Type and press Enter to send…",value:v,onChange:y=>k(y.target.value),onKeyDown:y=>y.key==="Enter"&&Dt()})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(ui,{size:18,color:"var(--green)"})," App Management"]}),t.jsxs("div",{className:"app-mgmt-content",children:[t.jsxs("div",{className:"install-section",children:[t.jsx("p",{className:"compact-label",children:"Install Package"}),t.jsxs("div",{className:"upload-box-row",children:[t.jsxs("label",{className:"file-upload-launcher",title:Y?Y.name:"Select an .apk, .ipa or .app file",children:[t.jsx(mi,{size:14}),t.jsx("span",{children:Y?Y.name:"Select File"}),t.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:y=>{var S;return P(((S=y.target.files)==null?void 0:S[0])||null)},hidden:!0})]}),t.jsx("button",{className:"btn-premium btn-sm",disabled:!Y||ve,onClick:A,children:ve?t.jsx(is,{className:"animate-spin",size:14}):"INSTALL"})]}),t.jsx("p",{className:"hint-text",children:"Accepts .apk, .ipa or .app"})]}),t.jsx("div",{className:"divider-v"}),t.jsxs("div",{className:"uninstall-section",children:[t.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),t.jsxs("div",{className:"uninstall-controls-row",children:[t.jsxs("div",{className:"select-wrapper",children:[t.jsxs(Jt,{selectSize:"sm",className:"w-full",value:j,onChange:y=>D(y.target.value),disabled:ye,children:[t.jsx("option",{value:"",children:ye?"Loading apps...":"-- Select App to Remove --"}),ie.map(y=>t.jsx("option",{value:y,children:y},y))]}),ye&&t.jsx(is,{className:"animate-spin select-loader",size:12})]}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:h,disabled:!j||ye,children:[t.jsx(Ht,{size:14})," UNINSTALL"]})]}),t.jsxs("div",{className:"manual-input-box",children:[t.jsx("p",{className:"hint-text",children:"Or enter manually:"}),t.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:j,onChange:y=>D(y.target.value)})]})]})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Wi,{size:18,color:"var(--green)"})," Clipboard"]}),t.jsxs("div",{className:"clipboard-row",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:Tt,children:"FETCH VALUE"}),t.jsx("div",{className:"clipboard-display compact",children:C})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(ur,{size:18,color:"var(--green)"})," Directional Gestures"]}),t.jsxs("div",{className:"gestures-grid-container",children:[t.jsxs("div",{className:"gestures-dpad",children:[t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("up"),children:t.jsx(Pi,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("left"),children:t.jsx(os,{size:24})}),t.jsx("div",{className:"dpad-center"}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("right"),children:t.jsx(wn,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>We("down"),children:t.jsx(pn,{size:24})}),t.jsx("div",{})]}),t.jsx("p",{className:"compact-label dpad-caption",children:"Quick swipe in a direction"})]})]})]}),f==="screenshot"&&t.jsxs("div",{className:"action-card screenshot-card",children:[$.length>0&&t.jsx("header",{className:"action-card-header",children:t.jsx("button",{className:"btn-text-only",onClick:Lt,children:"CLEAR ALL"})}),t.jsxs("div",{className:`screenshot-workspace ${$.length===0?"is-empty":""}`,children:[t.jsxs("div",{className:"screenshot-gallery-sidebar",children:[t.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:Mt,disabled:z,children:[z?t.jsx(is,{className:"animate-spin",size:16}):t.jsx(cs,{size:16}),t.jsx("span",{children:z?"CAPTURING...":"NEW CAPTURE"})]}),t.jsxs("div",{className:"screenshot-thumbnails-list",children:[$.length===0&&!z&&t.jsxs("div",{className:"empty-gallery-state",children:[t.jsx(cs,{size:20,className:"empty-gallery-icon"}),t.jsx("p",{className:"empty-gallery-title",children:"No captures yet"}),t.jsx("p",{className:"empty-gallery-hint",children:"Grab a screenshot of the device to begin analysis."})]}),$.map((y,S)=>t.jsxs("div",{className:`screenshot-thumb-item ${T===S?"active":""}`,onClick:()=>O(S),children:[t.jsx("img",{src:`data:image/png;base64,${y.base64}`,alt:"Thumb"}),t.jsx("span",{className:"thumb-time",children:new Date(y.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t.jsx("button",{className:"thumb-delete-btn",onClick:E=>{E.stopPropagation(),gt(y.id)},children:t.jsx(Ht,{size:12})})]},y.id))]})]}),t.jsx("div",{className:"screenshot-main-preview",children:T!==null&&$[T]?t.jsxs("div",{className:"preview-container",children:[t.jsx("div",{className:"preview-image-wrapper",children:t.jsx("img",{src:`data:image/png;base64,${$[T].base64}`,alt:"Selected Evidence"})}),t.jsxs("footer",{className:"preview-footer",children:[t.jsxs("div",{className:"preview-meta",children:[t.jsx("span",{className:"meta-label",children:"ID:"}),t.jsx("span",{className:"meta-value",children:$[T].id.substring(0,8)}),t.jsx("span",{className:"meta-divider",children:"|"}),t.jsx("span",{className:"meta-value",children:hi($[T].timestamp)})]}),t.jsxs("div",{className:"preview-actions",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:()=>It($[T].base64),children:"DOWNLOAD PNG"}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>gt($[T].id),children:[t.jsx(Ht,{size:14})," DELETE"]})]})]})]}):null})]})]}),f==="logs"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(Hc,{udid:p.udid,platform:p.platform})}),f==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(hc,{platform:(p.platform||"").toLowerCase(),prompt:`${(p.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${p.name} (${p.udid}).
|
|
255
255
|
Internal Shell Environment.`,onCommand:async y=>{const S=await B.executeShell(p.udid,y);if(S.error)throw new Error(S.error);return S.output}})})]})})]})]}),p.session_id&&!String(p.session_id).startsWith("manual_")&&t.jsx(ii,{sessionId:String(p.session_id),mode:"slice",windowSec:60,variant:"floating"})]})}class Vc extends je.Component{constructor(s){super(s),this.socketCleanups=[],this.refreshTimeout=null,this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,statusFilter:"all",search:"",loaded:!1}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const s=this.props.onSocketEvent("device_unblocked",()=>{this.fetchDevicesDebounced()}),n=this.props.onSocketEvent("device_blocked",()=>{this.fetchDevicesDebounced()});this.socketCleanups.push(s,n)}componentWillUnmount(){this.devicePolling&&(clearInterval(this.devicePolling),this.devicePolling=void 0),this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null),this.socketCleanups.forEach(s=>s())}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(s){return s.filter(n=>n.busy).length}async fetchDevices(){try{const s=await B.getDevices(),n=this.getBusyDevicesCount(s),i=await B.getPendingSessionsCount(),r=await B.getQueueSummary();this.setState({devices:s,activeSessionsCount:n,pendingSessionsCount:i,queueSummary:r,loaded:!0})}catch(s){console.log(s),this.setState({loaded:!0})}}getFiltered(){const s=Date.now(),n=r=>!!(r.reservedUntil&&s<r.reservedUntil),i=this.state.search.trim().toLowerCase();return this.state.devices.filter(r=>{if(i&&!`${r.name} ${r.udid}`.toLowerCase().includes(i))return!1;switch(this.state.statusFilter){case"all":return!0;case"offline":return r.offline;case"busy":return r.busy&&!r.offline;case"reserved":return n(r)&&!r.busy&&!r.offline;case"ready":return!r.offline&&!r.busy&&!n(r)&&!r.userBlocked;default:return!0}})}statusCount(s){const n=Date.now(),i=r=>!!(r.reservedUntil&&n<r.reservedUntil);switch(s){case"all":return this.state.devices.length;case"offline":return this.state.devices.filter(r=>r.offline).length;case"busy":return this.state.devices.filter(r=>r.busy&&!r.offline).length;case"reserved":return this.state.devices.filter(r=>i(r)&&!r.busy&&!r.offline).length;case"ready":return this.state.devices.filter(r=>!r.offline&&!r.busy&&!i(r)&&!r.userBlocked).length}}render(){const s=this.getFiltered(),{udid:n}=this.props.params,i=n?this.state.devices.find(r=>r.udid===n):null;return t.jsxs("div",{className:"device-explorer-container",children:[t.jsxs("div",{className:"de2-sticky-group",children:[t.jsx(ni,{icon:Ps,title:"Devices",subtitle:`${this.state.devices.length} device${this.state.devices.length===1?"":"s"} registered across the global pool.`}),t.jsxs("div",{className:"de2-toolbar",children:[t.jsx(yi,{size:"sm",value:this.state.statusFilter,onChange:r=>this.setState({statusFilter:r}),segments:[{value:"all",label:"All",count:this.statusCount("all")},{value:"ready",label:"Ready",count:this.statusCount("ready")},{value:"busy",label:"Busy",count:this.statusCount("busy")},{value:"reserved",label:"Reserved",count:this.statusCount("reserved")},{value:"offline",label:"Offline",count:this.statusCount("offline")}]}),t.jsx("input",{type:"text",className:"de2-search",placeholder:"Search by name or UDID…",value:this.state.search,onChange:r=>this.setState({search:r.target.value})}),t.jsxs(st,{variant:"secondary",size:"sm",onClick:()=>this.fetchDevices(),children:[t.jsx(rs,{size:12})," Refresh"]})]})]}),s.length>0?t.jsx(oc,{devices:s,reloadDevices:()=>this.fetchDevices()}):t.jsxs("div",{className:"device-explorer-empty stagger-1",children:[t.jsx("div",{className:"device-explorer-empty-icon",children:this.state.loaded?t.jsx(Ps,{size:32}):t.jsx(rs,{size:32,className:"animate-spin"})}),this.state.loaded?this.state.devices.length===0?t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Global Device Registry Empty"}),t.jsx("p",{children:"Xenon hasn't detected any active device nodes in your infrastructure. Ensure your device farm is connected and heartbeat signals are active."}),t.jsxs(st,{variant:"primary",onClick:()=>this.fetchDevices(),children:[t.jsx(rs,{size:14}),"Manual Sync"]})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"No Devices Found"}),t.jsx("p",{children:"Deployment configuration mismatch. Adjust your platform or state filters to find the appropriate testing target."}),t.jsx(st,{variant:"secondary",onClick:()=>this.setState({statusFilter:"all",search:""}),children:"Reset filters"})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Loading devices…"}),t.jsx("p",{children:"Syncing the global device registry."})]})]}),i&&t.jsx("div",{className:"device-control-modal-overlay",children:t.jsx("div",{className:"device-control-modal",children:t.jsx(Wc,{device:i,onClose:()=>this.props.navigate("/devices")})})})]})}}function yl(){const e=gn(),s=ks(),{on:n}=vi();return t.jsx(Vc,{params:e,navigate:s,onSocketEvent:n})}export{Vc as DeviceExplorer,yl as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,j as e,L as c,f as b}from"./index-
|
|
1
|
+
import{r as t,j as e,L as c,f as b}from"./index-D9hpVxoi.js";import{A as f}from"./auth-shell-Bzztd971.js";function v(){const[s,o]=t.useState(""),[a,i]=t.useState(!1),[m,d]=t.useState(!1),[l,n]=t.useState(null);async function u(r){r.preventDefault(),i(!0),n(null);try{await b(s),d(!0)}catch(x){n(x.message||"Request failed")}finally{i(!1)}}return e.jsx(f,{children:e.jsxs("form",{onSubmit:u,children:[e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:"Forgot password?"}),e.jsx("p",{className:"text-sm text-[var(--text-dim)] mb-6",children:"Enter your email and we'll send you a reset link if your account exists."}),m?e.jsx("div",{className:"text-sm text-[var(--text)] mb-6",children:"If your email is registered, you'll receive a reset link shortly. Check your spam folder if you don't see it within a minute."}):e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Email"}),e.jsx("input",{type:"email",value:s,onChange:r=>o(r.target.value),autoFocus:!0,required:!0,className:"w-full mb-4 h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm focus:border-[var(--green)] outline-none"}),l&&e.jsx("div",{className:"text-xs text-[var(--red)] mb-3",children:l}),e.jsx("button",{type:"submit",disabled:a||!s,className:"mt-5 w-full h-10 rounded-md bg-[var(--green)] text-black font-medium text-sm disabled:opacity-50",children:a?"Sending…":"Send reset link"})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx(c,{to:"/login",className:"text-xs text-[var(--text-dim)] hover:text-[var(--text)]",children:"Back to sign in"})})]})})}export{v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-C6ZfEbkx.js","assets/useSocket-DsmPkV7G.js","assets/funnel-_KldywHh.js","assets/tablet-D8v87f0D.js","assets/activity-C8kSwV4x.js","assets/device-explorer-wIzpD8uj.js","assets/page-header-B4fWZ7PA.js","assets/button-BD0qp0wO.js","assets/utils-CDN07tui.js","assets/button-DtC0WGPu.css","assets/select-BscNeBV4.js","assets/select-BrbMzFJu.css","assets/BugReportButton-CXMTmp4u.js","assets/BugReportButton-DeF8gwF1.css","assets/Modal-BeDHd61x.js","assets/Modal-qvYudaqQ.css","assets/FieldGroup-CeFDx8aU.js","assets/FieldGroup-trY-2qmW.css","assets/clock-Y9Spj4eZ.js","assets/plus-D6xpkCEm.js","assets/copy-D2H_l8Za.js","assets/upload-BLZQPsul.js","assets/time-B8FIgwPE.js","assets/mouse-pointer-2-x4iFczMu.js","assets/layers-y9zk6puF.js","assets/shield-alert-BIv3SNUv.js","assets/zap-o6UsCI-y.js","assets/check-DfuIwbk5.js","assets/chevron-right-Bnhlh4jC.js","assets/keycodes-bIEJfQzr.js","assets/download-DXRyWZTc.js","assets/trash-2-B3JVmViZ.js","assets/lock-D8MCyBaM.js","assets/SegmentedControl-ClGNBJqP.js","assets/SegmentedControl-M7StbYAD.css","assets/device-explorer-B-VTi-kT.css","assets/builds-page-uchHuZzS.js","assets/status-pill-outline-CkiBdQ0F.js","assets/circle-x-D0e-HLLy.js","assets/circle-check-BYavFzCx.js","assets/input-DNFrhBhx.js","assets/input-9Hi18BMC.css","assets/session-detail-page-BgRonRhj.js","assets/arrow-left-Bx1-ExQr.js","assets/arrow-up-right-C06pFukR.js","assets/EmptyState-DdKOWe90.js","assets/EmptyState-BSDHFxd1.css","assets/Table-CVoYIFrV.js","assets/Table-BIjXN_-_.css","assets/session-detail-page-Bzzc3bMl.css","assets/runbook-page-81jN3TdY.js","assets/runbook-page-BcfSJRZ-.css","assets/apps--1DGQgSd.js","assets/apps-CTrGClro.css","assets/webhook-settings-BlK9CsG0.js","assets/webhook-settings-tW1oXXrJ.css","assets/settings-Cxx_aYWT.css","assets/settings-CUtTT1jN.js","assets/SettingCard-D5Ljar8F.js","assets/SettingCard-C7wPlNh9.css","assets/shield-CexzwYTz.js","assets/ai-settings-mZn3VsgO.js","assets/maintenance-settings-CjVfi491.js","assets/api-keys-BN4ZdSKI.js","assets/teams-B-H7q6dd.js","assets/users-cwrwUhwo.js","assets/selector-health-page-BNqjAYVM.js","assets/selector-health-rV92V-Zl.js","assets/selector-health-C4Sv_nTk.css","assets/selector-detail-page-RO6D6fu3.js","assets/DeviceMosaicView-D18a1AYh.js","assets/profile-page-C5a037Qf.js","assets/users-CQh4bnF2.js","assets/login-DKWKvs3G.js","assets/auth-shell-Bzztd971.js","assets/forgot-password-D1hanmCa.js","assets/reset-password-C4Ive_lM.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function zc(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const l in r)if(l!=="default"&&!(l in e)){const o=Object.getOwnPropertyDescriptor(r,l);o&&Object.defineProperty(e,l,o.get?o:{enumerable:!0,get:()=>r[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Ca(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pa={exports:{}},rr={};/*
|
|
3
3
|
object-assign
|
|
4
4
|
(c) Sindre Sorhus
|
|
@@ -206,4 +206,4 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
|
|
|
206
206
|
*
|
|
207
207
|
* This source code is licensed under the ISC license.
|
|
208
208
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
-
*/const Kh=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xh=B("x",Kh),Pt="/xenon/api/auth";async function qm(e,t){const n=await fetch(`${Pt}/login`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Login failed (${n.status})`)}}async function Yh(){await fetch(`${Pt}/logout`,{method:"POST",credentials:"include"})}async function Jh(){const e=await fetch(`${Pt}/me`,{credentials:"include"});if(e.status===401)return null;if(!e.ok)throw new Error(`Failed to fetch /me (${e.status})`);return e.json()}async function Gm(e,t){const n=await fetch(`${Pt}/change-password`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPassword:e,newPassword:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Change password failed (${n.status})`)}}async function Qm(e){const t=await fetch(`${Pt}/forgot-password`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok&&t.status!==204)throw t.status===429?new Error("Too many attempts — try again later."):new Error(`Request failed (${t.status})`)}async function Km(e){return(await fetch(`${Pt}/reset-password/check/${encodeURIComponent(e)}`)).ok}async function Xm(e,t){const n=await fetch(`${Pt}/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,newPassword:t})});if(!n.ok&&n.status!==204){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Reset failed (${n.status})`)}}const Mc=y.createContext(null);function Zh({children:e}){const[t,n]=y.useState(!0),[r,l]=y.useState(null);async function o(){try{l(await Jh())}finally{n(!1)}}async function i(){await Yh(),l(null),window.location.href="/xenon/login"}return y.useEffect(()=>{o()},[]),p.jsx(Mc.Provider,{value:{loading:t,me:r,refresh:o,signOut:i},children:e})}function Bi(){const e=y.useContext(Mc);if(!e)throw new Error("useAuth must be used inside AuthProvider");return e}function bh(){const[e,t]=y.useState(0),[n]=y.useState(()=>Date.now());y.useEffect(()=>{const a=setInterval(()=>t(u=>u+1),5e3);return()=>clearInterval(a)},[]);const r=Math.floor((Date.now()-n)/1e3)+e*0,l=Math.floor(r/60),o=Math.floor(l/60),i=r<10?"Updated just now":r<60?`Updated ${r}s ago`:l<60?`Updated ${l}m ago`:`Updated ${o}h ago`,s=l>=10?"stale":l>=2?"aging":"fresh";return{label:i,staleness:s}}const em=()=>{const e=an(),{me:t,signOut:n}=Bi(),{label:r,staleness:l}=bh(),[o,i]=y.useState(!1),s=y.useRef(null),a=((t==null?void 0:t.name)??"A").split(" ").map(g=>g[0]).slice(0,2).join("").toUpperCase(),u=(t==null?void 0:t.role)==="SUPER_ADMIN"?"Super Admin":(t==null?void 0:t.role)==="ADMIN"?"Admin":"Member";y.useEffect(()=>{const g=h=>{s.current&&!s.current.contains(h.target)&&i(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]);const v=()=>window.dispatchEvent(new CustomEvent("xenon.open-command-palette"));return p.jsx("header",{className:"fixed top-0 left-14 right-0 z-20 h-14 border-b border-[var(--border)] bg-[var(--bg)]/80 backdrop-blur-md",children:p.jsxs("div",{className:"flex items-center h-full px-4 gap-4",children:[p.jsx("button",{type:"button",onClick:()=>e("/overview"),className:"flex items-center gap-3 min-w-0 cursor-pointer","aria-label":"Xenon home",children:p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("img",{src:"/xenon/logo.svg",alt:"Xenon Logo",className:"h-8 w-auto object-contain"})})}),p.jsx("div",{className:"flex-1 max-w-xl mx-auto",children:p.jsxs("button",{type:"button",onClick:v,className:"relative w-full h-9 flex items-center text-left","aria-label":"Open command palette",children:[p.jsx("div",{className:"w-full h-9 pl-9 pr-14 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm text-[var(--text-dim)] hover:border-[var(--border-strong)] hover:text-[var(--text)] transition-colors flex items-center",children:"Search devices, sessions, settings…"}),p.jsx(Ic,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--text-dim)]"}),p.jsx("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 font-mono text-[10px] text-[var(--text-dim)] border border-[var(--border)] rounded px-1.5 py-0.5",children:"⌘K"})]})}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:`hidden md:inline text-xs font-mono transition-colors ${l==="stale"?"text-[var(--red)]":l==="aging"?"text-[var(--amber)]":"text-[var(--text-dim)]"}`,title:l==="stale"?"Data is stale — reconnection may be needed.":l==="aging"?"Data hasn’t updated in a while.":"Live data.",children:r}),p.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-[var(--green)]/10 border border-[var(--green)]/20",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--green)] pulse-dot"}),p.jsx("span",{className:"text-[11px] font-medium text-[var(--green)]",children:"Online"})]}),p.jsxs("div",{className:"relative",ref:s,children:[p.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 pl-1.5 pr-2.5 rounded-md border border-[var(--border)] hover:border-[var(--border-strong)] hover:bg-[var(--surface)] transition-colors",onClick:()=>i(g=>!g),"aria-haspopup":"true","aria-expanded":o,children:[p.jsx("span",{className:"h-6 w-6 rounded-full bg-[var(--green)]/15 text-[var(--green)] text-[11px] font-semibold flex items-center justify-center",children:a}),p.jsxs("span",{className:"flex flex-col items-start leading-tight",children:[p.jsx("span",{className:"text-xs text-[var(--text)]",children:(t==null?void 0:t.name)??"Account"}),p.jsx("span",{className:"text-[10px] text-[var(--text-dim)]",children:u})]}),p.jsx(hh,{className:"h-3.5 w-3.5 text-[var(--text-dim)]"})]}),o&&p.jsxs("div",{className:"absolute top-full right-0 mt-2 w-64 rounded-md border border-[var(--border)] bg-[var(--surface)] shadow-lg overflow-hidden",children:[p.jsxs("div",{className:"px-3 py-2",children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-dim)] mb-1",children:"Workspace"}),p.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--text)]",children:[p.jsx("span",{className:"text-[var(--text-muted)]",children:"Registry"}),p.jsx("span",{children:"Default"})]}),p.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--text)] mt-1",children:[p.jsx("span",{className:"text-[var(--text-muted)]",children:"Node"}),p.jsx("span",{children:"Root · Primary"})]})]}),p.jsx("div",{className:"h-px bg-[var(--border)]"}),p.jsxs("div",{className:"px-3 py-2",children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-dim)] mb-1",children:"System"}),p.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--text)]",children:[p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--green)]"}),"Stable"]}),p.jsxs("span",{className:"font-mono text-[var(--text-muted)]",children:["v","0.3.0"]})]})]}),p.jsx("div",{className:"h-px bg-[var(--border)]"}),p.jsxs("button",{type:"button",onClick:()=>{i(!1),e("/profile")},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--text)] hover:bg-[var(--bg)] text-left",children:[p.jsx(Gh,{className:"h-3.5 w-3.5 text-[var(--text-dim)]"}),"Profile"]}),p.jsxs("button",{type:"button",onClick:()=>{i(!1),n()},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--red)] hover:bg-[var(--bg)] text-left",children:[p.jsx(Nh,{className:"h-3.5 w-3.5"}),"Logout"]})]})]})]})]})})};class tm extends y.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReset=()=>{this.setState({hasError:!1}),window.location.reload()}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?this.props.fallback||p.jsxs("div",{className:"error-boundary-container",style:{padding:"4rem 2rem",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",color:"var(--text)",background:"var(--bg-main)",minHeight:"100vh"},children:[p.jsx("div",{style:{color:"var(--accent-red)",filter:"drop-shadow(0 0 10px rgba(239, 68, 68, 0.3))"},children:p.jsx(Vh,{size:64})}),p.jsx("h2",{style:{fontSize:"2rem",fontWeight:700,margin:0},children:"Component Exception Detected"}),p.jsx("p",{style:{color:"var(--text-muted)",maxWidth:"500px",lineHeight:1.6},children:"An unexpected error occurred while rendering this section. Xenon's isolation engine has contained the fault to prevent a total system crash."}),this.state.error&&p.jsx("pre",{style:{background:"rgba(0,0,0,0.3)",padding:"1rem",borderRadius:"8px",fontSize:"0.8rem",color:"var(--accent-red)",maxWidth:"80%",overflowX:"auto"},children:this.state.error.message}),p.jsxs("button",{onClick:this.handleReset,style:{background:"var(--green)",color:"var(--secondary)",border:"none",padding:"0.75rem 2rem",borderRadius:"8px",fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",transition:"all 0.2s"},onMouseOver:t=>t.currentTarget.style.transform="translateY(-2px)",onMouseOut:t=>t.currentTarget.style.transform="translateY(0)",children:[p.jsx(Lc,{size:18}),"Reload Application"]})]}):this.props.children}}const nm=y.lazy(()=>Q(()=>import("./overview-C1R2UQl1.js"),__vite__mapDeps([0,1,2,3,4]))),ga=y.lazy(()=>Q(()=>import("./device-explorer-BXkLeHOo.js"),__vite__mapDeps([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,4,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,1,35]))),wa=y.lazy(()=>Q(()=>import("./builds-page-Dg7iuOE4.js"),__vite__mapDeps([36,37,1,22,4,38,39,40,8,41,10,11,18,7,9,30,28,3,6]))),rm=y.lazy(()=>Q(()=>import("./session-detail-page-CqA1LWms.js"),__vite__mapDeps([42,37,1,22,12,13,43,28,20,44,45,46,47,48,14,15,30,49]))),lm=y.lazy(()=>Q(()=>import("./runbook-page-CccKo_ux.js"),__vite__mapDeps([50,43,51]))),om=y.lazy(()=>Q(()=>import("./apps-C4yIXLri.js"),__vite__mapDeps([52,22,7,8,9,6,10,11,21,27,20,26,30,31,53]))),im=y.lazy(()=>Q(()=>import("./webhook-settings-7uAwLEYD.js"),__vite__mapDeps([54,16,17,6,31,19,38,39,26,4,55,56])).then(e=>({default:e.WebhookSettings}))),sm=y.lazy(()=>Q(()=>import("./settings-Dx_rptOw.js"),__vite__mapDeps([57,58,7,8,9,59,6,1,60,39,18,23,27,4,44,56])).then(e=>({default:e.Settings}))),am=y.lazy(()=>Q(()=>import("./ai-settings-C8sncqu3.js"),__vite__mapDeps([61,58,7,8,9,59,6,32,39,4,56])).then(e=>({default:e.AISettings}))),um=y.lazy(()=>Q(()=>import("./maintenance-settings-CAh7HUZ-.js"),__vite__mapDeps([62,58,7,8,9,59,6,60,31,27,56])).then(e=>({default:e.MaintenanceSettings}))),cm=y.lazy(()=>Q(()=>import("./api-keys-BMHuU8Dr.js"),__vite__mapDeps([63,22,47,48,16,17,6,14,15,7,8,9,40,41,10,11,25,19,31,27,20,56])).then(e=>({default:e.ApiKeys}))),fm=y.lazy(()=>Q(()=>import("./teams-DSbeLNCv.js"),__vite__mapDeps([64,22,47,48,16,17,6,14,15,7,8,9,40,41,10,11,65,25,19,43,31,56])).then(e=>({default:e.Teams}))),dm=y.lazy(()=>Q(()=>import("./selector-health-page-Y-aKtKUI.js"),__vite__mapDeps([66,26,67,68,39,14,15,27,20,22,1,45,46,6,33,34,2,28,44]))),pm=y.lazy(()=>Q(()=>import("./selector-detail-page-Clqvo8sX.js"),__vite__mapDeps([69,22,6,67,68,24,39,26,27,20]))),hm=y.lazy(()=>Q(()=>import("./DeviceMosaicView-FwTyGhoV.js"),__vite__mapDeps([70,29]))),mm=y.lazy(()=>Q(()=>import("./profile-page-Du1DxpAU.js"),__vite__mapDeps([71,6,22,10,8,11,20,31]))),vm=y.lazy(()=>Q(()=>import("./users-DWiAFkSA.js"),__vite__mapDeps([72,65,22,6,7,8,9,40,41,10,11,19,31]))),ym=()=>p.jsxs("div",{className:"flex items-center justify-center gap-2 h-full text-xs text-[var(--text-dim)]",children:[p.jsx(Lc,{className:"animate-spin",size:14}),p.jsx("span",{children:"Hydrating view…"})]}),gm=()=>p.jsx(tm,{children:p.jsx(y.Suspense,{fallback:p.jsx(ym,{}),children:p.jsxs(Nc,{children:[p.jsx($,{path:"/",element:p.jsx(zt,{to:"/overview",replace:!0})}),p.jsx($,{path:"/overview",element:p.jsx(nm,{})}),p.jsx($,{path:"/devices",element:p.jsx(ga,{})}),p.jsx($,{path:"/devices/:udid/control/:tab?",element:p.jsx(ga,{})}),p.jsx($,{path:"/apps",element:p.jsx(om,{})}),p.jsx($,{path:"/sessions",element:p.jsx(zt,{to:"/builds",replace:!0})}),p.jsx($,{path:"/sessions/*",element:p.jsx(zt,{to:"/builds",replace:!0})}),p.jsx($,{path:"/builds",element:p.jsx(wa,{})}),p.jsx($,{path:"/builds/:buildId",element:p.jsx(wa,{})}),p.jsx($,{path:"/builds/:buildId/sessions/:sessionId",element:p.jsx(rm,{})}),p.jsx($,{path:"/notifications",element:p.jsx(im,{})}),p.jsx($,{path:"/settings",element:p.jsx(sm,{})}),p.jsx($,{path:"/ai-settings",element:p.jsx(am,{})}),p.jsx($,{path:"/maintenance",element:p.jsx(um,{})}),p.jsx($,{path:"/api-keys",element:p.jsx(cm,{})}),p.jsx($,{path:"/teams",element:p.jsx(fm,{})}),p.jsx($,{path:"/users",element:p.jsx(vm,{})}),p.jsx($,{path:"/selector-health",element:p.jsx(dm,{})}),p.jsx($,{path:"/selector-health/detail",element:p.jsx(pm,{})}),p.jsx($,{path:"/devices/live",element:p.jsx(hm,{})}),p.jsx($,{path:"/runbooks/:category",element:p.jsx(lm,{})}),p.jsx($,{path:"/profile",element:p.jsx(mm,{})}),p.jsx($,{path:"*",element:p.jsx(zt,{to:"/overview",replace:!0})})]})})});let nr=null;function xa(e){nr=e}const wm=new Set(["device_held_by_another_user","device_in_use_by_session"]);function xm(e){return!e||typeof e!="object"?!1:wm.has(e.error??"")}const km=5e3,ka=new Map;function Em(e){if(!nr)return;const t=Date.now(),n=ka.get(e)??0;t-n<km||(ka.set(e,t),nr(e,"error"))}class Sm{makeGETRequest(t){return fetch(this.formatUrl(t)).then(this.jsonResult)}makePOSTRequest(t,n,r,l={}){return fetch(this.formatUrl(t),{method:"POST",body:JSON.stringify(r||{}),headers:{"Content-Type":"application/json"},...l}).then(this.jsonResult)}makeDELETERequest(t){return fetch(this.formatUrl(t),{method:"DELETE"}).then(this.jsonResult)}formatUrl(t){return`/xenon/api${t}`}async jsonResult(t){if(t.status===403){const n=await t.clone().json().catch(()=>({})),r=n&&(n.error||n.message)||"You do not have permission for this action.";nr&&nr(r,"error")}if(t.status===409){const n=await t.clone().json().catch(()=>({}));xm(n)&&Em(n.message||"This device is in use by another user.")}return t.json()}}const j=new Sm,Dc=y.createContext(void 0),Ym=()=>{const e=y.useContext(Dc);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},_m=({children:e})=>{const[t,n]=y.useState([]),r=y.useCallback(o=>{n(i=>i.filter(s=>s.id!==o))},[]),l=y.useCallback((o,i="info",s=4e3)=>{const a=Math.random().toString(36).substring(2,9);return n(u=>[...u,{id:a,message:o,type:i,duration:s}]),i!=="loading"&&s>0&&setTimeout(()=>{r(a)},s),a},[r]);return y.useEffect(()=>(xa((o,i="info")=>l(o,i)),()=>xa(null)),[l]),p.jsxs(Dc.Provider,{value:{toast:l,removeToast:r},children:[e,p.jsx("div",{className:"toast-container","aria-live":"polite","aria-atomic":"true",role:"status",children:t.map(o=>p.jsxs("div",{className:`toast-item toast-${o.type} animate-slide-in`,children:[p.jsxs("div",{className:"toast-icon",children:[o.type==="success"&&p.jsx(gh,{size:18}),o.type==="error"&&p.jsx(vh,{size:18}),o.type==="info"&&p.jsx(Eh,{size:18}),o.type==="loading"&&p.jsx(Rh,{size:18,className:"animate-spin"})]}),p.jsx("div",{className:"toast-message",children:o.message}),p.jsx("button",{className:"toast-close",onClick:()=>r(o.id),"aria-label":`Close ${o.type} notification`,children:p.jsx(Xh,{size:14})})]},o.id))})]})},Cm=[{id:"overview",label:"Overview",icon:Ph,path:"/overview"},{id:"devices",label:"Devices",icon:Fh,path:"/devices"},{id:"live-devices",label:"Live Devices",icon:Hh,path:"/devices/live"},{id:"apps",label:"Apps",icon:ih,path:"/apps"},{id:"sessions",label:"Sessions",icon:Lh,path:"/builds"},{id:"selector-health",label:"Selector Health",icon:xh,path:"/selector-health"},{id:"notifications",label:"Notifications",icon:ah,path:"/notifications"},{id:"settings",label:"Settings",icon:$h,path:"/settings",minRole:"ADMIN"},{id:"ai",label:"AI Engine",icon:dh,path:"/ai-settings",minRole:"ADMIN"},{id:"maintenance",label:"Maintenance",icon:Ah,path:"/maintenance",minRole:"ADMIN"},{id:"teams",label:"Teams",icon:ya,path:"/teams",minRole:"ADMIN"},{id:"users",label:"Users",icon:ya,path:"/users",minRole:"ADMIN"},{id:"apikeys",label:"API Keys",icon:_h,path:"/api-keys",minRole:"ADMIN"}],Ea={SUPER_ADMIN:3,ADMIN:2,MEMBER:1};function Pm(e,t){return t?(e?Ea[e]??0:0)>=Ea[t]:!0}const jm=()=>{const e=an(),t=at(),{me:n}=Bi(),r=Cm.filter(s=>Pm(n==null?void 0:n.role,s.minRole)),l=t.pathname.replace(/\/$/,"")||"/",o=r.filter(s=>l===s.path||l.startsWith(s.path+"/")).sort((s,a)=>a.path.length-s.path.length)[0],i=s=>(o==null?void 0:o.path)===s;return p.jsxs("aside",{className:"fixed inset-y-0 left-0 z-30 w-14 border-r border-[var(--border)] bg-[var(--surface)] flex flex-col items-center py-3",children:[p.jsx("nav",{className:"flex-1 flex flex-col gap-1 w-full items-center",children:r.map(s=>{const a=s.icon,u=i(s.path);return p.jsxs("button",{type:"button",onClick:()=>e(s.path),className:`group relative w-full flex justify-center py-2.5 mx-1 rounded-md transition-colors ${u?"bg-[var(--surface-2)]":"hover:bg-[var(--surface-2)]/60"}`,"aria-label":s.label,"aria-current":u?"page":void 0,children:[p.jsx("span",{className:`absolute left-0 top-1 bottom-1 w-[3px] rounded-r transition-all ${u?"bg-[var(--green)]":"bg-transparent"}`}),p.jsx(a,{className:`h-[18px] w-[18px] transition-colors ${u?"text-[var(--green)]":"text-[var(--text-dim)] group-hover:text-[var(--text)]"}`,strokeWidth:u?2.25:2}),p.jsx("span",{className:"pointer-events-none absolute left-full ml-2 top-1/2 -translate-y-1/2 whitespace-nowrap rounded-md bg-[var(--surface-2)] border border-[var(--border-strong)] px-2 py-1 text-xs text-[var(--text)] opacity-0 group-hover:opacity-100 transition-opacity z-50 shadow-lg",children:s.label})]},s.id)})}),p.jsxs("button",{type:"button",className:"group relative w-full flex justify-center py-2.5 mt-2","aria-label":"API Docs",onClick:()=>window.open(window.location.origin+"/xenon/api-docs","_blank"),children:[p.jsx(ch,{className:"h-[18px] w-[18px] text-[var(--text-dim)] group-hover:text-[var(--text)] transition-colors"}),p.jsx("span",{className:"pointer-events-none absolute left-full ml-2 top-1/2 -translate-y-1/2 whitespace-nowrap rounded-md bg-[var(--surface-2)] border border-[var(--border-strong)] px-2 py-1 text-xs text-[var(--text)] opacity-0 group-hover:opacity-100 transition-opacity z-50 shadow-lg",children:"API Docs"})]})]})};class Sr{static getDevices(){return j.makeGETRequest(`/device?t=${Date.now()}`)}static getPendingSessionsCount(){return j.makeGETRequest("/queue/length")}static getPendingSessions(){return j.makeGETRequest("/queue")}static getQueueSummary(){return j.makeGETRequest("/queue/summary")}static getQueueStatus(t){return j.makeGETRequest(`/queue/status/${t}`)}static getBuilds(){return j.makeGETRequest("/build")}static getSessions(t={}){let r=`/session?t=${Date.now()}`;return t.buildId&&(r+=`&buildId=${encodeURIComponent(t.buildId)}`),t.query&&(r+=`&query=${encodeURIComponent(t.query)}`),t.status&&(r+=`&status=${encodeURIComponent(t.status)}`),t.platform&&(r+=`&platform=${encodeURIComponent(t.platform)}`),j.makeGETRequest(r)}static getSession(t){return j.makeGETRequest(`/session/${t}`)}static getSessionLogs(t){return j.makeGETRequest(`/session/${t}/session_log`)}static getDeviceLogs(t){return j.makeGETRequest(`/session/${t}/logs/device`)}static getDebugLogs(t){return j.makeGETRequest(`/session/${t}/logs/debug`)}static getProfilingData(t){return j.makeGETRequest(`/session/${t}/profiling`)}static omniScan(t){return j.makeGETRequest(`/session/${t}/xenon/omni-scan`)}static omniScanControl(t){return j.makeGETRequest(`/control/${t}/omni-scan`)}static testAiLocator(t,n,r){return j.makePOSTRequest(`/session/${t}/xenon/test-locator`,{},{strategy:n,selector:r})}static getDisplayState(t){return j.makeGETRequest(`/control/${t}/display`)}static getAppiumSession(t){return j.makeGETRequest(`/control/${t}/appium-session`)}static async verifyLocator(t,n,r){const l=t.startsWith("/")?t:`/${t}`,i=await(await fetch(`${l}/session/${n}/xenon/verify-locator`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json().catch(()=>({}));return(i==null?void 0:i.value)??i}static testAiLocatorControl(t,n,r){return j.makePOSTRequest(`/control/${t}/test-locator`,{},{strategy:n,selector:r})}static blockDevice(t,n){return j.makePOSTRequest("/block",{},{udid:t,host:n})}static unblockDevice(t,n){return j.makePOSTRequest("/unblock",{},{udid:t,host:n})}static updateDeviceTags(t,n,r){return j.makePOSTRequest("/device/tags",{},{udid:t,host:n,tags:r})}static async listTeams(){const t=await fetch("/xenon/api/teams",{credentials:"include"});if(!t.ok)throw new Error(`listTeams failed (${t.status})`);return(await t.json()).map(r=>({id:r.id,name:r.name}))}static async setDeviceTeam(t,n){const r=await fetch(`/xenon/api/grid/device/${encodeURIComponent(t)}/team`,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:n})});if(!r.ok&&r.status!==204){const l=await r.json().catch(()=>({}));throw new Error(l.error||`setDeviceTeam failed (${r.status})`)}}static getSessionLiveVideoUrl(t){return j.formatUrl(`/session/${t}/live_video`)}static getReservations(){return j.makeGETRequest("/reservation")}static reserveDevice(t,n,r,l,o){return j.makePOSTRequest("/reservation",{},{udid:t,host:n,reservedBy:r,duration:l,reason:o})}static releaseReservation(t,n){return j.makeDELETERequest(`/reservation/${t}/${encodeURIComponent(n)}`)}static extendReservation(t,n,r){return j.makePOSTRequest(`/reservation/${t}/${encodeURIComponent(n)}/extend`,{},{duration:r})}static getAssetUrl(t){return t?`/xenon/assets/${t.replace(/^\//,"")}`:""}static tap(t,n,r){return j.makePOSTRequest(`/control/${t}/tap`,{},{x:n,y:r})}static swipe(t,n,r,l,o){return j.makePOSTRequest(`/control/${t}/swipe`,{},{x:n,y:r,endX:l,endY:o})}static typeText(t,n){return j.makePOSTRequest(`/control/${t}/text`,{},{text:n})}static pressKey(t,n){return j.makePOSTRequest(`/control/${t}/keyevent`,{},{keyCode:n})}static getClipboard(t){return j.makeGETRequest(`/control/${t}/clipboard`)}static setClipboard(t,n){return j.makePOSTRequest(`/control/${t}/clipboard`,{},{content:n})}static getScreenshot(t){return j.makeGETRequest(`/control/${t}/screenshot`)}static touchAndHold(t,n,r,l){return j.makePOSTRequest(`/control/${t}/touchAndHold`,{},{x:n,y:r,duration:l})}static lock(t){return j.makePOSTRequest(`/control/${t}/lock`,{},{})}static unlock(t){return j.makePOSTRequest(`/control/${t}/unlock`,{},{})}static installApp(t,n){return j.makePOSTRequest(`/control/${t}/install`,{},{appPath:n})}static startStream(t){return j.makePOSTRequest(`/control/${t}/stream/start`,{},{})}static stopStream(t){return j.makePOSTRequest(`/control/${t}/stream/stop`,{},{},{keepalive:!0})}static uninstallApp(t,n){return j.makePOSTRequest(`/control/${t}/uninstall`,{},{bundleId:n})}static uploadAndInstallApp(t,n){const r=new FormData;return r.append("app",n),fetch(`/xenon/api/control/${t}/upload-install`,{method:"POST",body:r}).then(l=>l.json())}static listApps(t){return j.makeGETRequest(`/control/${t}/apps`)}static getLogs(t){return j.makeGETRequest(`/control/${t}/logs`)}static getApps(){return j.makeGETRequest("/apps")}static uploadApp(t){const n=new FormData;return n.append("app",t),fetch("/xenon/api/apps/upload",{method:"POST",body:n}).then(r=>r.json())}static deleteApp(t){return j.makeDELETERequest(`/apps/${t}`)}static installRepositoryApp(t,n){return j.makePOSTRequest(`/control/${t}/install-repository-app`,{},{appId:n})}static executeShell(t,n){return j.makePOSTRequest(`/control/${t}/shell`,{},{command:n})}static getInspectorSnapshot(t){return j.makeGETRequest(`/control/${t}/inspector/snapshot`)}static getWebhookConfigs(){return j.makeGETRequest("/webhook")}static addWebhookConfig(t,n,r,l){return j.makePOSTRequest("/webhook",{},{url:t,events:n,type:r,payloadTemplate:l})}static deleteWebhookConfig(t){return j.makeDELETERequest(`/webhook/${t}`)}static testWebhook(t,n){return j.makePOSTRequest("/webhook/test",{},{url:t,type:n})}static getGlobalConfig(){return j.makeGETRequest("/config")}static updateGlobalConfig(t){return j.makePOSTRequest("/config",{},t)}static testAIConfig(t){return j.makePOSTRequest("/config/test-ai",{},t)}static resetMetrics(){return j.makePOSTRequest("/config/reset-metrics",{},{})}static getRecentHealingEvents(t=50){return j.makeGETRequest(`/healing/events?limit=${t}&t=${Date.now()}`)}static getHealingSummary(t=30){return j.makeGETRequest(`/healing/summary?windowDays=${t}&t=${Date.now()}`)}static getHealingHotspots(t={}){const{windowDays:n=30,limit:r=20,tier:l,platform:o,status:i="active"}=t;let s=`/healing/hotspots?windowDays=${n}&limit=${r}&status=${i}&t=${Date.now()}`;return l&&(s+=`&tier=${encodeURIComponent(l)}`),o&&(s+=`&platform=${encodeURIComponent(o)}`),j.makeGETRequest(s)}static getMutedSelectors(t={}){const{limit:n=50,offset:r=0}=t;return j.makeGETRequest(`/healing/state/muted?limit=${n}&offset=${r}&t=${Date.now()}`)}static getSelectorState(t,n){return j.makeGETRequest(`/healing/state/${encodeURIComponent(t)}/${encodeURIComponent(n)}?t=${Date.now()}`)}static async postSelectorStateAction(t){const n=await fetch("/xenon/api/healing/selector/state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),l=new Error(r.error??`Selector state action failed (${n.status})`);throw l.status=n.status,l.currentStatus=r.currentStatus??null,l}return n.json()}static getHealingSelectorDetail(t,n=30){return j.makeGETRequest(`/healing/selector?value=${encodeURIComponent(t)}&windowDays=${n}&t=${Date.now()}`)}static sendHealingDigest(t={}){return j.makePOSTRequest("/healing/digest/send",{},t)}static async exportBuild(t,n,r){const l=await fetch(`/xenon/api/build/${encodeURIComponent(t)}/export`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({format:n,...r?{sessionIds:r}:{}})});if(!l.ok){const u=await l.text().catch(()=>l.statusText);throw new Error(`Export failed (${l.status}): ${u||l.statusText}`)}const o=l.headers.get("Content-Disposition")||"",i=/filename="?([^";]+)"?/.exec(o),s=i?i[1]:`build-${t}-sessions.${n}`;return{blob:await l.blob(),filename:s}}}function Rm(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"}function Tm(){const[e,t]=y.useState(!1);return y.useEffect(()=>{const n=l=>{(l.metaKey||l.ctrlKey)&&l.key.toLowerCase()==="k"&&!Rm(l.target)&&(l.preventDefault(),t(o=>!o)),l.key==="Escape"&&t(!1)},r=()=>t(!0);return window.addEventListener("keydown",n),window.addEventListener("xenon.open-command-palette",r),()=>{window.removeEventListener("keydown",n),window.removeEventListener("xenon.open-command-palette",r)}},[]),{open:e,setOpen:t}}function Sa(e,t){if(!e)return 0;const n=e.toLowerCase(),r=t.toLowerCase();if(r===n)return 1e4;if(r.startsWith(n))return 5e3-(r.length-n.length);let l=0,o=0,i=0;for(let s=0;s<n.length;s++){const a=n[s],u=r.indexOf(a,l);if(u===-1)return 0;u===l?(i+=1,o+=20+i*5):(i=0,o+=10-Math.min(u-l,10)),l=u+1}return Math.max(o,1)}const _a=[{id:"nav:overview",kind:"nav",label:"Overview",path:"/overview"},{id:"nav:devices",kind:"nav",label:"Devices",path:"/devices"},{id:"nav:builds",kind:"nav",label:"Sessions",path:"/builds"},{id:"nav:apps",kind:"nav",label:"Apps",path:"/apps"},{id:"nav:notifications",kind:"nav",label:"Notifications",path:"/notifications"},{id:"nav:settings",kind:"nav",label:"Settings",path:"/settings"},{id:"nav:ai-settings",kind:"nav",label:"AI Engine",path:"/ai-settings"},{id:"nav:maintenance",kind:"nav",label:"Maintenance",path:"/maintenance"},{id:"nav:teams",kind:"nav",label:"Teams",path:"/teams"},{id:"nav:api-keys",kind:"nav",label:"API Keys",path:"/api-keys"}];class Nm{constructor(){this.devices=[],this.sessions=[],this.teams=[],this.keys=[],this.apps=[]}setDevices(t){this.devices=t.map(n=>({id:`device:${n.udid}`,kind:"device",label:n.name||n.udid,sub:n.udid,path:`/devices/${n.udid}/control`}))}setSessions(t){this.sessions=t.map(n=>({id:`session:${n.id}`,kind:"session",label:n.name||n.id,sub:n.id,path:`/builds?session=${encodeURIComponent(n.id)}`}))}setTeams(t){this.teams=t.map(n=>({id:`team:${n.id}`,kind:"team",label:n.name||n.id,sub:n.id,path:`/teams?team=${encodeURIComponent(n.id)}`}))}setKeys(t){this.keys=t.map(n=>({id:`key:${n.id}`,kind:"key",label:n.name||n.id,sub:n.id,path:`/api-keys?key=${encodeURIComponent(n.id)}`}))}setApps(t){this.apps=t.map(n=>({id:`app:${n.id}`,kind:"app",label:n.name||n.id,sub:n.id,path:`/apps?app=${encodeURIComponent(n.id)}`}))}search(t,n=8){return t.trim()?[..._a,...this.devices,...this.sessions,...this.teams,...this.keys,...this.apps].map(l=>{const o=Sa(t,l.label),i=l.sub?Sa(t,l.sub):0;return{it:l,score:Math.max(o,i)}}).filter(l=>l.score>0).sort((l,o)=>o.score-l.score).slice(0,n).map(l=>l.it):_a.slice(0,n)}}const Om={nav:"Navigation",device:"Devices",session:"Sessions",team:"Teams",key:"API Keys",app:"Apps"},Lm=["nav","device","session","team","key","app"],Im=()=>{const{open:e,setOpen:t}=Tm(),[n,r]=y.useState(""),[l,o]=y.useState(0),i=an(),s=y.useRef(new Nm),a=y.useRef(null);y.useEffect(()=>{if(!e)return;Promise.all([Sr.getDevices().catch(()=>[]),Sr.getSessions().catch(()=>[]),Sr.getApps().catch(()=>[]),Sr.listTeams().catch(()=>[])]).then(([x,c,f,d])=>{Array.isArray(x)&&s.current.setDevices(x),Array.isArray(c)&&s.current.setSessions(c),Array.isArray(f)&&s.current.setApps(f),Array.isArray(d)&&s.current.setTeams(d)});const k=setTimeout(()=>{var x;return(x=a.current)==null?void 0:x.focus()},0);return()=>clearTimeout(k)},[e]),y.useEffect(()=>{e||(r(""),o(0))},[e]);const u=y.useMemo(()=>s.current.search(n,8),[n,e]),v=y.useMemo(()=>{const k=new Map;return u.forEach(x=>{const c=k.get(x.kind)||[];c.push(x),k.set(x.kind,c)}),k},[u]),g=y.useCallback(k=>{i(k.path),t(!1)},[i,t]),h=k=>{k.key==="ArrowDown"?(k.preventDefault(),o(x=>Math.min(x+1,Math.max(u.length-1,0)))):k.key==="ArrowUp"?(k.preventDefault(),o(x=>Math.max(x-1,0))):k.key==="Enter"&&(k.preventDefault(),u[l]&&g(u[l]))};if(!e)return null;let S=-1;return p.jsx("div",{className:"cp-overlay",onClick:()=>t(!1),children:p.jsxs("div",{className:"cp",role:"dialog","aria-modal":!0,"aria-label":"Command palette",onClick:k=>k.stopPropagation(),children:[p.jsxs("div",{className:"cp-input-row",children:[p.jsx(Ic,{size:14}),p.jsx("input",{ref:a,className:"cp-input",placeholder:"Search devices, sessions, settings…",value:n,onChange:k=>{r(k.target.value),o(0)},onKeyDown:h}),p.jsx("span",{className:"cp-esc",children:"ESC"})]}),p.jsxs("div",{className:"cp-results",children:[u.length===0&&p.jsx("div",{className:"cp-empty",children:"No results."}),Lm.filter(k=>v.has(k)).map(k=>p.jsxs("div",{className:"cp-group",children:[p.jsx("div",{className:"cp-group-head",children:Om[k]}),v.get(k).map(x=>{S+=1;const c=S===l;return p.jsxs("button",{type:"button",className:`cp-item${c?" cp-item-active":""}`,onMouseEnter:()=>{o(S)},onClick:()=>g(x),children:[p.jsx("span",{className:"cp-item-label",children:x.label}),x.sub&&p.jsx("span",{className:"cp-item-sub",children:x.sub})]},x.id)})]},k))]})]})})};function Mm({children:e}){const{loading:t,me:n}=Bi(),r=at();if(t)return p.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-dim)"},children:"Loading…"});if(!n){const l=encodeURIComponent(r.pathname+r.search);return p.jsx(zt,{to:`/login?next=${l}`,replace:!0})}return p.jsx(p.Fragment,{children:e})}const Dm=y.lazy(()=>Q(()=>import("./login-DHJeq8S7.js"),__vite__mapDeps([73,74]))),$m=y.lazy(()=>Q(()=>import("./forgot-password-CT5p3biH.js"),__vite__mapDeps([75,74]))),zm=y.lazy(()=>Q(()=>import("./reset-password-B9XZ2maL.js"),__vite__mapDeps([76,74]))),Am=y.lazy(()=>Q(()=>import("./ApiKeyGate-DvGX2jRA.js"),[]).then(e=>({default:e.ApiKeyGate})));function Um(){return p.jsx(_m,{children:p.jsxs("div",{className:"min-h-screen w-full bg-[var(--bg)] text-[var(--text)]",children:[p.jsx(jm,{}),p.jsx(em,{}),p.jsx("main",{className:"pl-14 pt-14 h-screen overflow-y-auto",children:p.jsx(gm,{})}),p.jsx(Im,{})]})})}function Fm(){return p.jsx(Yp,{basename:"/xenon",children:p.jsx(Zh,{children:p.jsx(y.Suspense,{fallback:p.jsx("div",{style:{padding:40},children:"Loading…"}),children:p.jsxs(Nc,{children:[p.jsx($,{path:"/login",element:p.jsx(Dm,{})}),p.jsx($,{path:"/forgot-password",element:p.jsx($m,{})}),p.jsx($,{path:"/reset-password/:token",element:p.jsx(zm,{})}),p.jsx($,{path:"/api-key-gate",element:p.jsx(Am,{children:p.jsx(zt,{to:"/overview",replace:!0})})}),p.jsx($,{path:"*",element:p.jsx(Mm,{children:p.jsx(Um,{})})})]})})})})}xc.render(p.jsx(y.StrictMode,{children:p.jsx(Fm,{})}),document.getElementById("root"));export{Hm as A,ch as B,vh as C,xm as D,Gm as E,xh as H,Eh as I,_h as K,Wm as L,Lh as M,Kc as R,Fh as S,Hh as T,Gh as U,Sr as X,at as a,Bi as b,Vm as c,Km as d,Xm as e,Qm as f,B as g,xc as h,Bm as i,p as j,Qc as k,qm as l,Ym as m,Xh as n,Ic as o,Vh as p,Ah as q,y as r,hh as s,Rh as t,an as u,Lc as v,Ca as w,ah as x,dh as y,ya as z};
|
|
209
|
+
*/const Kh=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xh=B("x",Kh),Pt="/xenon/api/auth";async function qm(e,t){const n=await fetch(`${Pt}/login`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Login failed (${n.status})`)}}async function Yh(){await fetch(`${Pt}/logout`,{method:"POST",credentials:"include"})}async function Jh(){const e=await fetch(`${Pt}/me`,{credentials:"include"});if(e.status===401)return null;if(!e.ok)throw new Error(`Failed to fetch /me (${e.status})`);return e.json()}async function Gm(e,t){const n=await fetch(`${Pt}/change-password`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPassword:e,newPassword:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Change password failed (${n.status})`)}}async function Qm(e){const t=await fetch(`${Pt}/forgot-password`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok&&t.status!==204)throw t.status===429?new Error("Too many attempts — try again later."):new Error(`Request failed (${t.status})`)}async function Km(e){return(await fetch(`${Pt}/reset-password/check/${encodeURIComponent(e)}`)).ok}async function Xm(e,t){const n=await fetch(`${Pt}/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,newPassword:t})});if(!n.ok&&n.status!==204){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Reset failed (${n.status})`)}}const Mc=y.createContext(null);function Zh({children:e}){const[t,n]=y.useState(!0),[r,l]=y.useState(null);async function o(){try{l(await Jh())}finally{n(!1)}}async function i(){await Yh(),l(null),window.location.href="/xenon/login"}return y.useEffect(()=>{o()},[]),p.jsx(Mc.Provider,{value:{loading:t,me:r,refresh:o,signOut:i},children:e})}function Bi(){const e=y.useContext(Mc);if(!e)throw new Error("useAuth must be used inside AuthProvider");return e}function bh(){const[e,t]=y.useState(0),[n]=y.useState(()=>Date.now());y.useEffect(()=>{const a=setInterval(()=>t(u=>u+1),5e3);return()=>clearInterval(a)},[]);const r=Math.floor((Date.now()-n)/1e3)+e*0,l=Math.floor(r/60),o=Math.floor(l/60),i=r<10?"Updated just now":r<60?`Updated ${r}s ago`:l<60?`Updated ${l}m ago`:`Updated ${o}h ago`,s=l>=10?"stale":l>=2?"aging":"fresh";return{label:i,staleness:s}}const em=()=>{const e=an(),{me:t,signOut:n}=Bi(),{label:r,staleness:l}=bh(),[o,i]=y.useState(!1),s=y.useRef(null),a=((t==null?void 0:t.name)??"A").split(" ").map(g=>g[0]).slice(0,2).join("").toUpperCase(),u=(t==null?void 0:t.role)==="SUPER_ADMIN"?"Super Admin":(t==null?void 0:t.role)==="ADMIN"?"Admin":"Member";y.useEffect(()=>{const g=h=>{s.current&&!s.current.contains(h.target)&&i(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]);const v=()=>window.dispatchEvent(new CustomEvent("xenon.open-command-palette"));return p.jsx("header",{className:"fixed top-0 left-14 right-0 z-20 h-14 border-b border-[var(--border)] bg-[var(--bg)]/80 backdrop-blur-md",children:p.jsxs("div",{className:"flex items-center h-full px-4 gap-4",children:[p.jsx("button",{type:"button",onClick:()=>e("/overview"),className:"flex items-center gap-3 min-w-0 cursor-pointer","aria-label":"Xenon home",children:p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("img",{src:"/xenon/logo.svg",alt:"Xenon Logo",className:"h-8 w-auto object-contain"})})}),p.jsx("div",{className:"flex-1 max-w-xl mx-auto",children:p.jsxs("button",{type:"button",onClick:v,className:"relative w-full h-9 flex items-center text-left","aria-label":"Open command palette",children:[p.jsx("div",{className:"w-full h-9 pl-9 pr-14 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm text-[var(--text-dim)] hover:border-[var(--border-strong)] hover:text-[var(--text)] transition-colors flex items-center",children:"Search devices, sessions, settings…"}),p.jsx(Ic,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--text-dim)]"}),p.jsx("kbd",{className:"absolute right-3 top-1/2 -translate-y-1/2 font-mono text-[10px] text-[var(--text-dim)] border border-[var(--border)] rounded px-1.5 py-0.5",children:"⌘K"})]})}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:`hidden md:inline text-xs font-mono transition-colors ${l==="stale"?"text-[var(--red)]":l==="aging"?"text-[var(--amber)]":"text-[var(--text-dim)]"}`,title:l==="stale"?"Data is stale — reconnection may be needed.":l==="aging"?"Data hasn’t updated in a while.":"Live data.",children:r}),p.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-[var(--green)]/10 border border-[var(--green)]/20",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--green)] pulse-dot"}),p.jsx("span",{className:"text-[11px] font-medium text-[var(--green)]",children:"Online"})]}),p.jsxs("div",{className:"relative",ref:s,children:[p.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 pl-1.5 pr-2.5 rounded-md border border-[var(--border)] hover:border-[var(--border-strong)] hover:bg-[var(--surface)] transition-colors",onClick:()=>i(g=>!g),"aria-haspopup":"true","aria-expanded":o,children:[p.jsx("span",{className:"h-6 w-6 rounded-full bg-[var(--green)]/15 text-[var(--green)] text-[11px] font-semibold flex items-center justify-center",children:a}),p.jsxs("span",{className:"flex flex-col items-start leading-tight",children:[p.jsx("span",{className:"text-xs text-[var(--text)]",children:(t==null?void 0:t.name)??"Account"}),p.jsx("span",{className:"text-[10px] text-[var(--text-dim)]",children:u})]}),p.jsx(hh,{className:"h-3.5 w-3.5 text-[var(--text-dim)]"})]}),o&&p.jsxs("div",{className:"absolute top-full right-0 mt-2 w-64 rounded-md border border-[var(--border)] bg-[var(--surface)] shadow-lg overflow-hidden",children:[p.jsxs("div",{className:"px-3 py-2",children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-dim)] mb-1",children:"Workspace"}),p.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--text)]",children:[p.jsx("span",{className:"text-[var(--text-muted)]",children:"Registry"}),p.jsx("span",{children:"Default"})]}),p.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--text)] mt-1",children:[p.jsx("span",{className:"text-[var(--text-muted)]",children:"Node"}),p.jsx("span",{children:"Root · Primary"})]})]}),p.jsx("div",{className:"h-px bg-[var(--border)]"}),p.jsxs("div",{className:"px-3 py-2",children:[p.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-dim)] mb-1",children:"System"}),p.jsxs("div",{className:"flex items-center justify-between text-xs text-[var(--text)]",children:[p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--green)]"}),"Stable"]}),p.jsxs("span",{className:"font-mono text-[var(--text-muted)]",children:["v","0.3.0"]})]})]}),p.jsx("div",{className:"h-px bg-[var(--border)]"}),p.jsxs("button",{type:"button",onClick:()=>{i(!1),e("/profile")},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--text)] hover:bg-[var(--bg)] text-left",children:[p.jsx(Gh,{className:"h-3.5 w-3.5 text-[var(--text-dim)]"}),"Profile"]}),p.jsxs("button",{type:"button",onClick:()=>{i(!1),n()},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--red)] hover:bg-[var(--bg)] text-left",children:[p.jsx(Nh,{className:"h-3.5 w-3.5"}),"Logout"]})]})]})]})]})})};class tm extends y.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReset=()=>{this.setState({hasError:!1}),window.location.reload()}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?this.props.fallback||p.jsxs("div",{className:"error-boundary-container",style:{padding:"4rem 2rem",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",color:"var(--text)",background:"var(--bg-main)",minHeight:"100vh"},children:[p.jsx("div",{style:{color:"var(--accent-red)",filter:"drop-shadow(0 0 10px rgba(239, 68, 68, 0.3))"},children:p.jsx(Vh,{size:64})}),p.jsx("h2",{style:{fontSize:"2rem",fontWeight:700,margin:0},children:"Component Exception Detected"}),p.jsx("p",{style:{color:"var(--text-muted)",maxWidth:"500px",lineHeight:1.6},children:"An unexpected error occurred while rendering this section. Xenon's isolation engine has contained the fault to prevent a total system crash."}),this.state.error&&p.jsx("pre",{style:{background:"rgba(0,0,0,0.3)",padding:"1rem",borderRadius:"8px",fontSize:"0.8rem",color:"var(--accent-red)",maxWidth:"80%",overflowX:"auto"},children:this.state.error.message}),p.jsxs("button",{onClick:this.handleReset,style:{background:"var(--green)",color:"var(--secondary)",border:"none",padding:"0.75rem 2rem",borderRadius:"8px",fontWeight:700,cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",transition:"all 0.2s"},onMouseOver:t=>t.currentTarget.style.transform="translateY(-2px)",onMouseOut:t=>t.currentTarget.style.transform="translateY(0)",children:[p.jsx(Lc,{size:18}),"Reload Application"]})]}):this.props.children}}const nm=y.lazy(()=>Q(()=>import("./overview-C6ZfEbkx.js"),__vite__mapDeps([0,1,2,3,4]))),ga=y.lazy(()=>Q(()=>import("./device-explorer-wIzpD8uj.js"),__vite__mapDeps([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,4,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,1,35]))),wa=y.lazy(()=>Q(()=>import("./builds-page-uchHuZzS.js"),__vite__mapDeps([36,37,1,22,4,38,39,40,8,41,10,11,18,7,9,30,28,3,6]))),rm=y.lazy(()=>Q(()=>import("./session-detail-page-BgRonRhj.js"),__vite__mapDeps([42,37,1,22,12,13,43,28,20,44,45,46,47,48,14,15,30,49]))),lm=y.lazy(()=>Q(()=>import("./runbook-page-81jN3TdY.js"),__vite__mapDeps([50,43,51]))),om=y.lazy(()=>Q(()=>import("./apps--1DGQgSd.js"),__vite__mapDeps([52,22,7,8,9,6,10,11,21,27,20,26,30,31,53]))),im=y.lazy(()=>Q(()=>import("./webhook-settings-BlK9CsG0.js"),__vite__mapDeps([54,16,17,6,31,19,38,39,26,4,55,56])).then(e=>({default:e.WebhookSettings}))),sm=y.lazy(()=>Q(()=>import("./settings-CUtTT1jN.js"),__vite__mapDeps([57,58,7,8,9,59,6,1,60,39,18,23,27,4,44,56])).then(e=>({default:e.Settings}))),am=y.lazy(()=>Q(()=>import("./ai-settings-mZn3VsgO.js"),__vite__mapDeps([61,58,7,8,9,59,6,32,39,4,56])).then(e=>({default:e.AISettings}))),um=y.lazy(()=>Q(()=>import("./maintenance-settings-CjVfi491.js"),__vite__mapDeps([62,58,7,8,9,59,6,60,31,27,56])).then(e=>({default:e.MaintenanceSettings}))),cm=y.lazy(()=>Q(()=>import("./api-keys-BN4ZdSKI.js"),__vite__mapDeps([63,22,47,48,16,17,6,14,15,7,8,9,40,41,10,11,25,19,31,27,20,56])).then(e=>({default:e.ApiKeys}))),fm=y.lazy(()=>Q(()=>import("./teams-B-H7q6dd.js"),__vite__mapDeps([64,22,47,48,16,17,6,14,15,7,8,9,40,41,10,11,65,25,19,43,31,56])).then(e=>({default:e.Teams}))),dm=y.lazy(()=>Q(()=>import("./selector-health-page-BNqjAYVM.js"),__vite__mapDeps([66,26,67,68,39,14,15,27,20,22,1,45,46,6,33,34,2,28,44]))),pm=y.lazy(()=>Q(()=>import("./selector-detail-page-RO6D6fu3.js"),__vite__mapDeps([69,22,6,67,68,24,39,26,27,20]))),hm=y.lazy(()=>Q(()=>import("./DeviceMosaicView-D18a1AYh.js"),__vite__mapDeps([70,29]))),mm=y.lazy(()=>Q(()=>import("./profile-page-C5a037Qf.js"),__vite__mapDeps([71,6,22,10,8,11,20,31]))),vm=y.lazy(()=>Q(()=>import("./users-CQh4bnF2.js"),__vite__mapDeps([72,65,22,6,7,8,9,40,41,10,11,19,31]))),ym=()=>p.jsxs("div",{className:"flex items-center justify-center gap-2 h-full text-xs text-[var(--text-dim)]",children:[p.jsx(Lc,{className:"animate-spin",size:14}),p.jsx("span",{children:"Hydrating view…"})]}),gm=()=>p.jsx(tm,{children:p.jsx(y.Suspense,{fallback:p.jsx(ym,{}),children:p.jsxs(Nc,{children:[p.jsx($,{path:"/",element:p.jsx(zt,{to:"/overview",replace:!0})}),p.jsx($,{path:"/overview",element:p.jsx(nm,{})}),p.jsx($,{path:"/devices",element:p.jsx(ga,{})}),p.jsx($,{path:"/devices/:udid/control/:tab?",element:p.jsx(ga,{})}),p.jsx($,{path:"/apps",element:p.jsx(om,{})}),p.jsx($,{path:"/sessions",element:p.jsx(zt,{to:"/builds",replace:!0})}),p.jsx($,{path:"/sessions/*",element:p.jsx(zt,{to:"/builds",replace:!0})}),p.jsx($,{path:"/builds",element:p.jsx(wa,{})}),p.jsx($,{path:"/builds/:buildId",element:p.jsx(wa,{})}),p.jsx($,{path:"/builds/:buildId/sessions/:sessionId",element:p.jsx(rm,{})}),p.jsx($,{path:"/notifications",element:p.jsx(im,{})}),p.jsx($,{path:"/settings",element:p.jsx(sm,{})}),p.jsx($,{path:"/ai-settings",element:p.jsx(am,{})}),p.jsx($,{path:"/maintenance",element:p.jsx(um,{})}),p.jsx($,{path:"/api-keys",element:p.jsx(cm,{})}),p.jsx($,{path:"/teams",element:p.jsx(fm,{})}),p.jsx($,{path:"/users",element:p.jsx(vm,{})}),p.jsx($,{path:"/selector-health",element:p.jsx(dm,{})}),p.jsx($,{path:"/selector-health/detail",element:p.jsx(pm,{})}),p.jsx($,{path:"/devices/live",element:p.jsx(hm,{})}),p.jsx($,{path:"/runbooks/:category",element:p.jsx(lm,{})}),p.jsx($,{path:"/profile",element:p.jsx(mm,{})}),p.jsx($,{path:"*",element:p.jsx(zt,{to:"/overview",replace:!0})})]})})});let nr=null;function xa(e){nr=e}const wm=new Set(["device_held_by_another_user","device_in_use_by_session"]);function xm(e){return!e||typeof e!="object"?!1:wm.has(e.error??"")}const km=5e3,ka=new Map;function Em(e){if(!nr)return;const t=Date.now(),n=ka.get(e)??0;t-n<km||(ka.set(e,t),nr(e,"error"))}class Sm{makeGETRequest(t){return fetch(this.formatUrl(t)).then(this.jsonResult)}makePOSTRequest(t,n,r,l={}){return fetch(this.formatUrl(t),{method:"POST",body:JSON.stringify(r||{}),headers:{"Content-Type":"application/json"},...l}).then(this.jsonResult)}makeDELETERequest(t){return fetch(this.formatUrl(t),{method:"DELETE"}).then(this.jsonResult)}formatUrl(t){return`/xenon/api${t}`}async jsonResult(t){if(t.status===403){const n=await t.clone().json().catch(()=>({})),r=n&&(n.error||n.message)||"You do not have permission for this action.";nr&&nr(r,"error")}if(t.status===409){const n=await t.clone().json().catch(()=>({}));xm(n)&&Em(n.message||"This device is in use by another user.")}return t.json()}}const j=new Sm,Dc=y.createContext(void 0),Ym=()=>{const e=y.useContext(Dc);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},_m=({children:e})=>{const[t,n]=y.useState([]),r=y.useCallback(o=>{n(i=>i.filter(s=>s.id!==o))},[]),l=y.useCallback((o,i="info",s=4e3)=>{const a=Math.random().toString(36).substring(2,9);return n(u=>[...u,{id:a,message:o,type:i,duration:s}]),i!=="loading"&&s>0&&setTimeout(()=>{r(a)},s),a},[r]);return y.useEffect(()=>(xa((o,i="info")=>l(o,i)),()=>xa(null)),[l]),p.jsxs(Dc.Provider,{value:{toast:l,removeToast:r},children:[e,p.jsx("div",{className:"toast-container","aria-live":"polite","aria-atomic":"true",role:"status",children:t.map(o=>p.jsxs("div",{className:`toast-item toast-${o.type} animate-slide-in`,children:[p.jsxs("div",{className:"toast-icon",children:[o.type==="success"&&p.jsx(gh,{size:18}),o.type==="error"&&p.jsx(vh,{size:18}),o.type==="info"&&p.jsx(Eh,{size:18}),o.type==="loading"&&p.jsx(Rh,{size:18,className:"animate-spin"})]}),p.jsx("div",{className:"toast-message",children:o.message}),p.jsx("button",{className:"toast-close",onClick:()=>r(o.id),"aria-label":`Close ${o.type} notification`,children:p.jsx(Xh,{size:14})})]},o.id))})]})},Cm=[{id:"overview",label:"Overview",icon:Ph,path:"/overview"},{id:"devices",label:"Devices",icon:Fh,path:"/devices"},{id:"live-devices",label:"Live Devices",icon:Hh,path:"/devices/live"},{id:"apps",label:"Apps",icon:ih,path:"/apps"},{id:"sessions",label:"Sessions",icon:Lh,path:"/builds"},{id:"selector-health",label:"Selector Health",icon:xh,path:"/selector-health"},{id:"notifications",label:"Notifications",icon:ah,path:"/notifications"},{id:"settings",label:"Settings",icon:$h,path:"/settings",minRole:"ADMIN"},{id:"ai",label:"AI Engine",icon:dh,path:"/ai-settings",minRole:"ADMIN"},{id:"maintenance",label:"Maintenance",icon:Ah,path:"/maintenance",minRole:"ADMIN"},{id:"teams",label:"Teams",icon:ya,path:"/teams",minRole:"ADMIN"},{id:"users",label:"Users",icon:ya,path:"/users",minRole:"ADMIN"},{id:"apikeys",label:"API Keys",icon:_h,path:"/api-keys",minRole:"ADMIN"}],Ea={SUPER_ADMIN:3,ADMIN:2,MEMBER:1};function Pm(e,t){return t?(e?Ea[e]??0:0)>=Ea[t]:!0}const jm=()=>{const e=an(),t=at(),{me:n}=Bi(),r=Cm.filter(s=>Pm(n==null?void 0:n.role,s.minRole)),l=t.pathname.replace(/\/$/,"")||"/",o=r.filter(s=>l===s.path||l.startsWith(s.path+"/")).sort((s,a)=>a.path.length-s.path.length)[0],i=s=>(o==null?void 0:o.path)===s;return p.jsxs("aside",{className:"fixed inset-y-0 left-0 z-30 w-14 border-r border-[var(--border)] bg-[var(--surface)] flex flex-col items-center py-3",children:[p.jsx("nav",{className:"flex-1 flex flex-col gap-1 w-full items-center",children:r.map(s=>{const a=s.icon,u=i(s.path);return p.jsxs("button",{type:"button",onClick:()=>e(s.path),className:`group relative w-full flex justify-center py-2.5 mx-1 rounded-md transition-colors ${u?"bg-[var(--surface-2)]":"hover:bg-[var(--surface-2)]/60"}`,"aria-label":s.label,"aria-current":u?"page":void 0,children:[p.jsx("span",{className:`absolute left-0 top-1 bottom-1 w-[3px] rounded-r transition-all ${u?"bg-[var(--green)]":"bg-transparent"}`}),p.jsx(a,{className:`h-[18px] w-[18px] transition-colors ${u?"text-[var(--green)]":"text-[var(--text-dim)] group-hover:text-[var(--text)]"}`,strokeWidth:u?2.25:2}),p.jsx("span",{className:"pointer-events-none absolute left-full ml-2 top-1/2 -translate-y-1/2 whitespace-nowrap rounded-md bg-[var(--surface-2)] border border-[var(--border-strong)] px-2 py-1 text-xs text-[var(--text)] opacity-0 group-hover:opacity-100 transition-opacity z-50 shadow-lg",children:s.label})]},s.id)})}),p.jsxs("button",{type:"button",className:"group relative w-full flex justify-center py-2.5 mt-2","aria-label":"API Docs",onClick:()=>window.open(window.location.origin+"/xenon/api-docs","_blank"),children:[p.jsx(ch,{className:"h-[18px] w-[18px] text-[var(--text-dim)] group-hover:text-[var(--text)] transition-colors"}),p.jsx("span",{className:"pointer-events-none absolute left-full ml-2 top-1/2 -translate-y-1/2 whitespace-nowrap rounded-md bg-[var(--surface-2)] border border-[var(--border-strong)] px-2 py-1 text-xs text-[var(--text)] opacity-0 group-hover:opacity-100 transition-opacity z-50 shadow-lg",children:"API Docs"})]})]})};class Sr{static getDevices(){return j.makeGETRequest(`/device?t=${Date.now()}`)}static getPendingSessionsCount(){return j.makeGETRequest("/queue/length")}static getPendingSessions(){return j.makeGETRequest("/queue")}static getQueueSummary(){return j.makeGETRequest("/queue/summary")}static getQueueStatus(t){return j.makeGETRequest(`/queue/status/${t}`)}static getBuilds(){return j.makeGETRequest("/build")}static getSessions(t={}){let r=`/session?t=${Date.now()}`;return t.buildId&&(r+=`&buildId=${encodeURIComponent(t.buildId)}`),t.query&&(r+=`&query=${encodeURIComponent(t.query)}`),t.status&&(r+=`&status=${encodeURIComponent(t.status)}`),t.platform&&(r+=`&platform=${encodeURIComponent(t.platform)}`),j.makeGETRequest(r)}static getSession(t){return j.makeGETRequest(`/session/${t}`)}static getSessionLogs(t){return j.makeGETRequest(`/session/${t}/session_log`)}static getDeviceLogs(t){return j.makeGETRequest(`/session/${t}/logs/device`)}static getDebugLogs(t){return j.makeGETRequest(`/session/${t}/logs/debug`)}static getProfilingData(t){return j.makeGETRequest(`/session/${t}/profiling`)}static omniScan(t){return j.makeGETRequest(`/session/${t}/xenon/omni-scan`)}static omniScanControl(t){return j.makeGETRequest(`/control/${t}/omni-scan`)}static testAiLocator(t,n,r){return j.makePOSTRequest(`/session/${t}/xenon/test-locator`,{},{strategy:n,selector:r})}static getDisplayState(t){return j.makeGETRequest(`/control/${t}/display`)}static getAppiumSession(t){return j.makeGETRequest(`/control/${t}/appium-session`)}static async verifyLocator(t,n,r){const l=t.startsWith("/")?t:`/${t}`,i=await(await fetch(`${l}/session/${n}/xenon/verify-locator`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json().catch(()=>({}));return(i==null?void 0:i.value)??i}static testAiLocatorControl(t,n,r){return j.makePOSTRequest(`/control/${t}/test-locator`,{},{strategy:n,selector:r})}static blockDevice(t,n){return j.makePOSTRequest("/block",{},{udid:t,host:n})}static unblockDevice(t,n){return j.makePOSTRequest("/unblock",{},{udid:t,host:n})}static updateDeviceTags(t,n,r){return j.makePOSTRequest("/device/tags",{},{udid:t,host:n,tags:r})}static async listTeams(){const t=await fetch("/xenon/api/teams",{credentials:"include"});if(!t.ok)throw new Error(`listTeams failed (${t.status})`);return(await t.json()).map(r=>({id:r.id,name:r.name}))}static async setDeviceTeam(t,n){const r=await fetch(`/xenon/api/grid/device/${encodeURIComponent(t)}/team`,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({teamId:n})});if(!r.ok&&r.status!==204){const l=await r.json().catch(()=>({}));throw new Error(l.error||`setDeviceTeam failed (${r.status})`)}}static getSessionLiveVideoUrl(t){return j.formatUrl(`/session/${t}/live_video`)}static getReservations(){return j.makeGETRequest("/reservation")}static reserveDevice(t,n,r,l,o){return j.makePOSTRequest("/reservation",{},{udid:t,host:n,reservedBy:r,duration:l,reason:o})}static releaseReservation(t,n){return j.makeDELETERequest(`/reservation/${t}/${encodeURIComponent(n)}`)}static extendReservation(t,n,r){return j.makePOSTRequest(`/reservation/${t}/${encodeURIComponent(n)}/extend`,{},{duration:r})}static getAssetUrl(t){return t?`/xenon/assets/${t.replace(/^\//,"")}`:""}static tap(t,n,r){return j.makePOSTRequest(`/control/${t}/tap`,{},{x:n,y:r})}static swipe(t,n,r,l,o){return j.makePOSTRequest(`/control/${t}/swipe`,{},{x:n,y:r,endX:l,endY:o})}static typeText(t,n){return j.makePOSTRequest(`/control/${t}/text`,{},{text:n})}static pressKey(t,n){return j.makePOSTRequest(`/control/${t}/keyevent`,{},{keyCode:n})}static getClipboard(t){return j.makeGETRequest(`/control/${t}/clipboard`)}static setClipboard(t,n){return j.makePOSTRequest(`/control/${t}/clipboard`,{},{content:n})}static getScreenshot(t){return j.makeGETRequest(`/control/${t}/screenshot`)}static touchAndHold(t,n,r,l){return j.makePOSTRequest(`/control/${t}/touchAndHold`,{},{x:n,y:r,duration:l})}static lock(t){return j.makePOSTRequest(`/control/${t}/lock`,{},{})}static unlock(t){return j.makePOSTRequest(`/control/${t}/unlock`,{},{})}static installApp(t,n){return j.makePOSTRequest(`/control/${t}/install`,{},{appPath:n})}static startStream(t){return j.makePOSTRequest(`/control/${t}/stream/start`,{},{})}static stopStream(t){return j.makePOSTRequest(`/control/${t}/stream/stop`,{},{},{keepalive:!0})}static uninstallApp(t,n){return j.makePOSTRequest(`/control/${t}/uninstall`,{},{bundleId:n})}static uploadAndInstallApp(t,n){const r=new FormData;return r.append("app",n),fetch(`/xenon/api/control/${t}/upload-install`,{method:"POST",body:r}).then(l=>l.json())}static listApps(t){return j.makeGETRequest(`/control/${t}/apps`)}static getLogs(t){return j.makeGETRequest(`/control/${t}/logs`)}static getApps(){return j.makeGETRequest("/apps")}static uploadApp(t){const n=new FormData;return n.append("app",t),fetch("/xenon/api/apps/upload",{method:"POST",body:n}).then(r=>r.json())}static deleteApp(t){return j.makeDELETERequest(`/apps/${t}`)}static installRepositoryApp(t,n){return j.makePOSTRequest(`/control/${t}/install-repository-app`,{},{appId:n})}static executeShell(t,n){return j.makePOSTRequest(`/control/${t}/shell`,{},{command:n})}static getInspectorSnapshot(t){return j.makeGETRequest(`/control/${t}/inspector/snapshot`)}static getWebhookConfigs(){return j.makeGETRequest("/webhook")}static addWebhookConfig(t,n,r,l){return j.makePOSTRequest("/webhook",{},{url:t,events:n,type:r,payloadTemplate:l})}static deleteWebhookConfig(t){return j.makeDELETERequest(`/webhook/${t}`)}static testWebhook(t,n){return j.makePOSTRequest("/webhook/test",{},{url:t,type:n})}static getGlobalConfig(){return j.makeGETRequest("/config")}static updateGlobalConfig(t){return j.makePOSTRequest("/config",{},t)}static testAIConfig(t){return j.makePOSTRequest("/config/test-ai",{},t)}static resetMetrics(){return j.makePOSTRequest("/config/reset-metrics",{},{})}static getRecentHealingEvents(t=50){return j.makeGETRequest(`/healing/events?limit=${t}&t=${Date.now()}`)}static getHealingSummary(t=30){return j.makeGETRequest(`/healing/summary?windowDays=${t}&t=${Date.now()}`)}static getHealingHotspots(t={}){const{windowDays:n=30,limit:r=20,tier:l,platform:o,status:i="active"}=t;let s=`/healing/hotspots?windowDays=${n}&limit=${r}&status=${i}&t=${Date.now()}`;return l&&(s+=`&tier=${encodeURIComponent(l)}`),o&&(s+=`&platform=${encodeURIComponent(o)}`),j.makeGETRequest(s)}static getMutedSelectors(t={}){const{limit:n=50,offset:r=0}=t;return j.makeGETRequest(`/healing/state/muted?limit=${n}&offset=${r}&t=${Date.now()}`)}static getSelectorState(t,n){return j.makeGETRequest(`/healing/state/${encodeURIComponent(t)}/${encodeURIComponent(n)}?t=${Date.now()}`)}static async postSelectorStateAction(t){const n=await fetch("/xenon/api/healing/selector/state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),l=new Error(r.error??`Selector state action failed (${n.status})`);throw l.status=n.status,l.currentStatus=r.currentStatus??null,l}return n.json()}static getHealingSelectorDetail(t,n=30){return j.makeGETRequest(`/healing/selector?value=${encodeURIComponent(t)}&windowDays=${n}&t=${Date.now()}`)}static sendHealingDigest(t={}){return j.makePOSTRequest("/healing/digest/send",{},t)}static async exportBuild(t,n,r){const l=await fetch(`/xenon/api/build/${encodeURIComponent(t)}/export`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({format:n,...r?{sessionIds:r}:{}})});if(!l.ok){const u=await l.text().catch(()=>l.statusText);throw new Error(`Export failed (${l.status}): ${u||l.statusText}`)}const o=l.headers.get("Content-Disposition")||"",i=/filename="?([^";]+)"?/.exec(o),s=i?i[1]:`build-${t}-sessions.${n}`;return{blob:await l.blob(),filename:s}}}function Rm(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"}function Tm(){const[e,t]=y.useState(!1);return y.useEffect(()=>{const n=l=>{(l.metaKey||l.ctrlKey)&&l.key.toLowerCase()==="k"&&!Rm(l.target)&&(l.preventDefault(),t(o=>!o)),l.key==="Escape"&&t(!1)},r=()=>t(!0);return window.addEventListener("keydown",n),window.addEventListener("xenon.open-command-palette",r),()=>{window.removeEventListener("keydown",n),window.removeEventListener("xenon.open-command-palette",r)}},[]),{open:e,setOpen:t}}function Sa(e,t){if(!e)return 0;const n=e.toLowerCase(),r=t.toLowerCase();if(r===n)return 1e4;if(r.startsWith(n))return 5e3-(r.length-n.length);let l=0,o=0,i=0;for(let s=0;s<n.length;s++){const a=n[s],u=r.indexOf(a,l);if(u===-1)return 0;u===l?(i+=1,o+=20+i*5):(i=0,o+=10-Math.min(u-l,10)),l=u+1}return Math.max(o,1)}const _a=[{id:"nav:overview",kind:"nav",label:"Overview",path:"/overview"},{id:"nav:devices",kind:"nav",label:"Devices",path:"/devices"},{id:"nav:builds",kind:"nav",label:"Sessions",path:"/builds"},{id:"nav:apps",kind:"nav",label:"Apps",path:"/apps"},{id:"nav:notifications",kind:"nav",label:"Notifications",path:"/notifications"},{id:"nav:settings",kind:"nav",label:"Settings",path:"/settings"},{id:"nav:ai-settings",kind:"nav",label:"AI Engine",path:"/ai-settings"},{id:"nav:maintenance",kind:"nav",label:"Maintenance",path:"/maintenance"},{id:"nav:teams",kind:"nav",label:"Teams",path:"/teams"},{id:"nav:api-keys",kind:"nav",label:"API Keys",path:"/api-keys"}];class Nm{constructor(){this.devices=[],this.sessions=[],this.teams=[],this.keys=[],this.apps=[]}setDevices(t){this.devices=t.map(n=>({id:`device:${n.udid}`,kind:"device",label:n.name||n.udid,sub:n.udid,path:`/devices/${n.udid}/control`}))}setSessions(t){this.sessions=t.map(n=>({id:`session:${n.id}`,kind:"session",label:n.name||n.id,sub:n.id,path:`/builds?session=${encodeURIComponent(n.id)}`}))}setTeams(t){this.teams=t.map(n=>({id:`team:${n.id}`,kind:"team",label:n.name||n.id,sub:n.id,path:`/teams?team=${encodeURIComponent(n.id)}`}))}setKeys(t){this.keys=t.map(n=>({id:`key:${n.id}`,kind:"key",label:n.name||n.id,sub:n.id,path:`/api-keys?key=${encodeURIComponent(n.id)}`}))}setApps(t){this.apps=t.map(n=>({id:`app:${n.id}`,kind:"app",label:n.name||n.id,sub:n.id,path:`/apps?app=${encodeURIComponent(n.id)}`}))}search(t,n=8){return t.trim()?[..._a,...this.devices,...this.sessions,...this.teams,...this.keys,...this.apps].map(l=>{const o=Sa(t,l.label),i=l.sub?Sa(t,l.sub):0;return{it:l,score:Math.max(o,i)}}).filter(l=>l.score>0).sort((l,o)=>o.score-l.score).slice(0,n).map(l=>l.it):_a.slice(0,n)}}const Om={nav:"Navigation",device:"Devices",session:"Sessions",team:"Teams",key:"API Keys",app:"Apps"},Lm=["nav","device","session","team","key","app"],Im=()=>{const{open:e,setOpen:t}=Tm(),[n,r]=y.useState(""),[l,o]=y.useState(0),i=an(),s=y.useRef(new Nm),a=y.useRef(null);y.useEffect(()=>{if(!e)return;Promise.all([Sr.getDevices().catch(()=>[]),Sr.getSessions().catch(()=>[]),Sr.getApps().catch(()=>[]),Sr.listTeams().catch(()=>[])]).then(([x,c,f,d])=>{Array.isArray(x)&&s.current.setDevices(x),Array.isArray(c)&&s.current.setSessions(c),Array.isArray(f)&&s.current.setApps(f),Array.isArray(d)&&s.current.setTeams(d)});const k=setTimeout(()=>{var x;return(x=a.current)==null?void 0:x.focus()},0);return()=>clearTimeout(k)},[e]),y.useEffect(()=>{e||(r(""),o(0))},[e]);const u=y.useMemo(()=>s.current.search(n,8),[n,e]),v=y.useMemo(()=>{const k=new Map;return u.forEach(x=>{const c=k.get(x.kind)||[];c.push(x),k.set(x.kind,c)}),k},[u]),g=y.useCallback(k=>{i(k.path),t(!1)},[i,t]),h=k=>{k.key==="ArrowDown"?(k.preventDefault(),o(x=>Math.min(x+1,Math.max(u.length-1,0)))):k.key==="ArrowUp"?(k.preventDefault(),o(x=>Math.max(x-1,0))):k.key==="Enter"&&(k.preventDefault(),u[l]&&g(u[l]))};if(!e)return null;let S=-1;return p.jsx("div",{className:"cp-overlay",onClick:()=>t(!1),children:p.jsxs("div",{className:"cp",role:"dialog","aria-modal":!0,"aria-label":"Command palette",onClick:k=>k.stopPropagation(),children:[p.jsxs("div",{className:"cp-input-row",children:[p.jsx(Ic,{size:14}),p.jsx("input",{ref:a,className:"cp-input",placeholder:"Search devices, sessions, settings…",value:n,onChange:k=>{r(k.target.value),o(0)},onKeyDown:h}),p.jsx("span",{className:"cp-esc",children:"ESC"})]}),p.jsxs("div",{className:"cp-results",children:[u.length===0&&p.jsx("div",{className:"cp-empty",children:"No results."}),Lm.filter(k=>v.has(k)).map(k=>p.jsxs("div",{className:"cp-group",children:[p.jsx("div",{className:"cp-group-head",children:Om[k]}),v.get(k).map(x=>{S+=1;const c=S===l;return p.jsxs("button",{type:"button",className:`cp-item${c?" cp-item-active":""}`,onMouseEnter:()=>{o(S)},onClick:()=>g(x),children:[p.jsx("span",{className:"cp-item-label",children:x.label}),x.sub&&p.jsx("span",{className:"cp-item-sub",children:x.sub})]},x.id)})]},k))]})]})})};function Mm({children:e}){const{loading:t,me:n}=Bi(),r=at();if(t)return p.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-dim)"},children:"Loading…"});if(!n){const l=encodeURIComponent(r.pathname+r.search);return p.jsx(zt,{to:`/login?next=${l}`,replace:!0})}return p.jsx(p.Fragment,{children:e})}const Dm=y.lazy(()=>Q(()=>import("./login-DKWKvs3G.js"),__vite__mapDeps([73,74]))),$m=y.lazy(()=>Q(()=>import("./forgot-password-D1hanmCa.js"),__vite__mapDeps([75,74]))),zm=y.lazy(()=>Q(()=>import("./reset-password-C4Ive_lM.js"),__vite__mapDeps([76,74]))),Am=y.lazy(()=>Q(()=>import("./ApiKeyGate-DZb6NwEl.js"),[]).then(e=>({default:e.ApiKeyGate})));function Um(){return p.jsx(_m,{children:p.jsxs("div",{className:"min-h-screen w-full bg-[var(--bg)] text-[var(--text)]",children:[p.jsx(jm,{}),p.jsx(em,{}),p.jsx("main",{className:"pl-14 pt-14 h-screen overflow-y-auto",children:p.jsx(gm,{})}),p.jsx(Im,{})]})})}function Fm(){return p.jsx(Yp,{basename:"/xenon",children:p.jsx(Zh,{children:p.jsx(y.Suspense,{fallback:p.jsx("div",{style:{padding:40},children:"Loading…"}),children:p.jsxs(Nc,{children:[p.jsx($,{path:"/login",element:p.jsx(Dm,{})}),p.jsx($,{path:"/forgot-password",element:p.jsx($m,{})}),p.jsx($,{path:"/reset-password/:token",element:p.jsx(zm,{})}),p.jsx($,{path:"/api-key-gate",element:p.jsx(Am,{children:p.jsx(zt,{to:"/overview",replace:!0})})}),p.jsx($,{path:"*",element:p.jsx(Mm,{children:p.jsx(Um,{})})})]})})})})}xc.render(p.jsx(y.StrictMode,{children:p.jsx(Fm,{})}),document.getElementById("root"));export{Hm as A,ch as B,vh as C,xm as D,Gm as E,xh as H,Eh as I,_h as K,Wm as L,Lh as M,Kc as R,Fh as S,Hh as T,Gh as U,Sr as X,at as a,Bi as b,Vm as c,Km as d,Xm as e,Qm as f,B as g,xc as h,Bm as i,p as j,Qc as k,qm as l,Ym as m,Xh as n,Ic as o,Vh as p,Ah as q,y as r,hh as s,Rh as t,an as u,Lc as v,Ca as w,ah as x,dh as y,ya as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,j as o}from"./index-
|
|
1
|
+
import{r as p,j as o}from"./index-D9hpVxoi.js";import{c as e}from"./utils-CDN07tui.js";const n=p.forwardRef(({className:r,type:s,...t},a)=>o.jsx("input",{type:s,className:e("input-base",r),ref:a,...t}));n.displayName="Input";export{n as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as v,a as p,b as f,r as s,j as e,L as j,l as w}from"./index-
|
|
1
|
+
import{u as v,a as p,b as f,r as s,j as e,L as j,l as w}from"./index-D9hpVxoi.js";import{A as N}from"./auth-shell-Bzztd971.js";function k(){const u=v(),c=p(),{refresh:m}=f(),d=new URLSearchParams(c.search).get("next")||"/overview",[a,x]=s.useState(""),[r,b]=s.useState(""),[o,n]=s.useState(!1),[l,i]=s.useState(null);async function g(t){t.preventDefault(),n(!0),i(null);try{await w(a,r),await m(),u(d,{replace:!0})}catch(h){i(h.message||"Login failed")}finally{n(!1)}}return e.jsx(N,{children:e.jsxs("form",{onSubmit:g,children:[e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:"Welcome back!"}),e.jsx("p",{className:"text-sm text-[var(--text-dim)] mb-6",children:"Sign in to your account"}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Email"}),e.jsx("input",{type:"email",value:a,onChange:t=>x(t.target.value),autoFocus:!0,required:!0,className:"w-full mb-4 h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm focus:border-[var(--green)] outline-none"}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Password"}),e.jsx("input",{type:"password",value:r,onChange:t=>b(t.target.value),required:!0,className:"w-full mb-2 h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm focus:border-[var(--green)] outline-none"}),e.jsx("div",{className:"text-right mb-4",children:e.jsx(j,{to:"/forgot-password",className:"text-[11px] text-[var(--text-dim)] hover:text-[var(--text)]",children:"Forgot password?"})}),l&&e.jsx("div",{className:"mt-3 text-xs text-[var(--red)]",children:l}),e.jsx("button",{type:"submit",disabled:o,className:"mt-5 w-full h-10 rounded-md bg-[var(--green)] text-black font-medium text-sm disabled:opacity-50",children:o?"Signing in…":"Sign in"})]})})}export{k as default};
|
package/lib/public/assets/{maintenance-settings-CAh7HUZ-.js → maintenance-settings-CjVfi491.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as S,m as N,r as d,X as C,j as e,v as D,q as M,I as A}from"./index-
|
|
1
|
+
import{g as S,m as N,r as d,X as C,j as e,v as D,q as M,I as A}from"./index-D9hpVxoi.js";/* empty css */import{S as o,A as B}from"./SettingCard-D5Ljar8F.js";import{P as w}from"./page-header-B4fWZ7PA.js";import{S as k,C as z}from"./shield-CexzwYTz.js";import{T as E}from"./trash-2-B3JVmViZ.js";import{C as L}from"./check-DfuIwbk5.js";import"./button-BD0qp0wO.js";import"./utils-CDN07tui.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as R,r as h,X as p,j as e,u as q,T as M,S as T}from"./index-
|
|
1
|
+
import{g as R,r as h,X as p,j as e,u as q,T as M,S as T}from"./index-D9hpVxoi.js";import{u as y}from"./useSocket-DsmPkV7G.js";import{F as U}from"./funnel-_KldywHh.js";import{T as H,M as L}from"./tablet-D8v87f0D.js";import{A as O}from"./activity-C8kSwV4x.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-D9hpVxoi.js";const m=({icon:s,eyebrow:t,title:x,subtitle:a,action:r})=>e.jsx("header",{className:"px-6 pt-6 pb-4 border-b border-[var(--border)]",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("div",{className:"text-[10px] font-mono font-semibold uppercase tracking-widest text-[var(--text-dim)] mb-1.5",children:t}),e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight text-[var(--text)]",children:[s&&e.jsx(s,{className:"h-5 w-5 text-[var(--green)] shrink-0"}),e.jsx("span",{className:"truncate",children:x})]}),a&&e.jsx("p",{className:"mt-1.5 text-sm text-[var(--text-muted)] max-w-3xl",children:a})]}),r&&e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:r})]})});export{m as P};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as S,b as k,r as o,j as e,E as T,v as E}from"./index-
|
|
1
|
+
import{g as S,b as k,r as o,j as e,E as T,v as E}from"./index-D9hpVxoi.js";import{P as C}from"./page-header-B4fWZ7PA.js";import{a as y,f as w}from"./time-B8FIgwPE.js";import{S as A}from"./select-BscNeBV4.js";import{C as $}from"./copy-D2H_l8Za.js";import{T as D}from"./trash-2-B3JVmViZ.js";import"./utils-CDN07tui.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,u as g,r as n,d as p,j as e,L as v,e as w}from"./index-
|
|
1
|
+
import{c as f,u as g,r as n,d as p,j as e,L as v,e as w}from"./index-D9hpVxoi.js";import{A as o}from"./auth-shell-Bzztd971.js";function k(){const{token:i}=f(),m=g(),[s,r]=n.useState("checking"),[a,u]=n.useState(""),[l,x]=n.useState(""),[c,d]=n.useState(null);n.useEffect(()=>{if(!i){r("invalid");return}p(i).then(t=>r(t?"ready":"invalid"))},[i]);async function h(t){if(t.preventDefault(),d(null),a!==l){d("Passwords do not match.");return}if(a.length<8){d("Password must be at least 8 characters.");return}r("submitting");try{await w(i,a),r("done"),setTimeout(()=>m("/login",{replace:!0}),1500)}catch(b){d(b.message||"Reset failed"),r("ready")}}return s==="checking"?e.jsx(o,{children:e.jsx("div",{className:"text-sm text-[var(--text-dim)] text-center",children:"Checking link…"})}):s==="invalid"?e.jsx(o,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"This link is invalid or expired"}),e.jsx("p",{className:"text-sm text-[var(--text-dim)] mb-6",children:"Reset links are good for 1 hour and single-use. Request a new one."}),e.jsx(v,{to:"/forgot-password",className:"inline-block h-10 px-4 rounded-md bg-[var(--green)] text-black text-sm font-medium leading-10",children:"Request a new link"})]})}):s==="done"?e.jsx(o,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"Password updated"}),e.jsx("p",{className:"text-sm text-[var(--text-dim)]",children:"Redirecting to sign in…"})]})}):e.jsx(o,{children:e.jsxs("form",{onSubmit:h,children:[e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:"Reset your password"}),e.jsx("p",{className:"text-sm text-[var(--text-dim)] mb-6",children:"Choose a new password to sign in with."}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"New password"}),e.jsx("input",{type:"password",value:a,onChange:t=>u(t.target.value),autoFocus:!0,required:!0,className:"w-full mb-3 h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm focus:border-[var(--green)] outline-none"}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Confirm new password"}),e.jsx("input",{type:"password",value:l,onChange:t=>x(t.target.value),required:!0,className:"w-full mb-3 h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm focus:border-[var(--green)] outline-none"}),c&&e.jsx("div",{className:"text-xs text-[var(--red)] mb-3",children:c}),e.jsx("button",{type:"submit",disabled:s==="submitting"||a.length<8,className:"mt-5 w-full h-10 rounded-md bg-[var(--green)] text-black font-medium text-sm disabled:opacity-50",children:s==="submitting"?"Updating…":"Update password"})]})})}export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as Me,k as Ie,c as Ir,u as Tr,j as J,B as Or}from"./index-
|
|
1
|
+
import{w as Me,k as Ie,c as Ir,u as Tr,j as J,B as Or}from"./index-D9hpVxoi.js";import{A as vr}from"./arrow-left-Bx1-ExQr.js";const qn=["http","https","mailto","tel"];function Lr(e){const n=(e||"").trim(),t=n.charAt(0);if(t==="#"||t==="/")return n;const r=n.indexOf(":");if(r===-1)return n;let i=-1;for(;++i<qn.length;){const l=qn[i];if(r===l.length&&n.slice(0,l.length).toLowerCase()===l)return n}return i=n.indexOf("?"),i!==-1&&r>i||(i=n.indexOf("#"),i!==-1&&r>i)?n:"javascript:void(0)"}/*!
|
|
2
2
|
* Determine if an object is a Buffer
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as m}from"./index-
|
|
1
|
+
import{r as c,j as m}from"./index-D9hpVxoi.js";import{c as o}from"./utils-CDN07tui.js";const l=c.forwardRef(({className:s,selectSize:e="md",children:t,...a},r)=>m.jsx("select",{ref:r,className:o("select-base",e==="sm"&&"select-sm",s),...a,children:t}));l.displayName="Select";export{l as S};
|