@xenon-device-management/xenon 1.20.1 → 1.20.3
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/lib/src/app/routers/apps.js +39 -13
- package/lib/test/unit/apps-download.spec.js +107 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e}from"./index-
|
|
1
|
+
import{r as n,j as e}from"./index-D9hpVxoi.js";function x({children:c}){const[i,s]=n.useState(null),[o,l]=n.useState(""),[r,a]=n.useState(null);if(n.useEffect(()=>{fetch("/xenon/api/health").then(()=>fetch("/xenon/api/sessions",{credentials:"include"})).then(t=>s(t.status!==401)).catch(()=>s(!1))},[]),i===null)return e.jsx("div",{style:{padding:40},children:"Loading…"});if(i)return e.jsx(e.Fragment,{children:c});async function u(t){t.preventDefault(),a(null);const d=await fetch("/xenon/api/auth/dashboard-session",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({apiKey:o.trim()})});if(d.ok)s(!0);else{const p=await d.json().catch(()=>({}));a(p.error||"Invalid key")}}return e.jsxs("div",{style:{maxWidth:420,margin:"120px auto",padding:24},children:[e.jsx("h2",{children:"Sign in to Xenon"}),e.jsxs("p",{children:["Paste an API key. First-time setup: the bootstrap key is in"," ",e.jsx("code",{children:"~/.cache/xenon/bootstrap-key.txt"})," on the server."]}),e.jsxs("form",{onSubmit:u,children:[e.jsx("input",{type:"password",value:o,onChange:t=>l(t.target.value),placeholder:"API key",style:{width:"100%",padding:8,boxSizing:"border-box"},autoFocus:!0}),e.jsx("button",{type:"submit",style:{marginTop:12,padding:"8px 16px"},children:"Continue"})]}),r&&e.jsx("p",{style:{color:"crimson",marginTop:12},children:r})]})}export{x as ApiKeyGate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as u,j as r,X as D,D as Se}from"./index-Cz4zmgOc.js";import{A as K,I as je}from"./keycodes-bIEJfQzr.js";function Te(e,t){return e!=="auto"?e:t<=1?"1":t===2?"2x1":t<=4?"2x2":"3x2"}const Ce={selected:new Set,layout:"2x2",tiles:[],groupId:null,compositeEnabled:!1,downloadableVideoCount:0,recordingPhase:"idle",recording:!1,startedAt:null,annotateMode:!1,shape:"RECT",color:"#ff3333",overlayAnnotations:{},errorBanner:null,banner:null};function Ae(e,t){var n;switch(t.type){case"SET_LAYOUT":return{...e,layout:t.layout};case"TOGGLE_SELECTED":{const o=new Set(e.selected);return o.has(t.udid)?o.delete(t.udid):o.add(t.udid),{...e,selected:o}}case"CLEAR_SELECTED":return{...e,selected:new Set};case"SET_TILES":return{...e,tiles:t.tiles};case"ADD_TILE":return e.tiles.some(o=>o.udid===t.tile.udid)?e:{...e,tiles:[...e.tiles,t.tile]};case"PATCH_TILE_DIMS":{let o=!1;const i=e.tiles.map(f=>f.udid!==t.udid||f.screenWidth&&f.screenHeight?f:(o=!0,{...f,screenWidth:t.screenWidth,screenHeight:t.screenHeight,aspect:f.aspect??t.aspect}));return o?{...e,tiles:i}:e}case"REMOVE_TILE":return e.recordingPhase!=="idle"?e:{...e,tiles:e.tiles.filter(o=>o.udid!==t.udid)};case"BIND_RECORDING_IDS":{const o=e.tiles.map(i=>({...i,recordingId:t.map[i.udid]??i.recordingId}));return{...e,tiles:o}}case"SET_RECORDING_PHASE":{const o=t.phase;return{...e,recordingPhase:o,recording:o==="recording"||o==="stopping"}}case"START_RECORDING":{const o=e.tiles.map(i=>({...i,recordingId:t.tileIds[i.udid]??i.recordingId}));return{...e,groupId:t.groupId,compositeEnabled:t.compositeEnabled===!0,downloadableVideoCount:0,recordingPhase:"recording",recording:!0,annotateMode:!0,startedAt:t.startedAt,overlayAnnotations:{},tiles:o}}case"STOP_RECORDING":{const o=e.tiles.map(i=>({...i,recordingId:void 0}));return{...e,recording:!1,recordingPhase:"idle",annotateMode:!1,overlayAnnotations:{},downloadableVideoCount:t.downloadableVideoCount??e.downloadableVideoCount,compositeEnabled:t.compositeEnabled!==void 0?t.compositeEnabled:e.compositeEnabled,tiles:o}}case"SET_ANNOTATE_MODE":return{...e,annotateMode:t.enabled};case"SET_SHAPE":return{...e,shape:t.shape};case"SET_COLOR":return{...e,color:t.color};case"SET_OVERLAY_ANNOTATIONS":return{...e,overlayAnnotations:{...e.overlayAnnotations,[t.recordingId]:t.annotations}};case"CLEAR_OVERLAY_ANNOTATIONS":return{...e,overlayAnnotations:{}};case"SET_ERROR_BANNER":return{...e,errorBanner:t.message,banner:t.message?{tone:"error",message:t.message}:null};case"SET_BANNER":return{...e,banner:t.banner,errorBanner:((n=t.banner)==null?void 0:n.tone)==="error"?t.banner.message:null};default:return e}}const le=u.createContext(null);function ke(){const e=u.useContext(le);if(!e)throw new Error("useMosaic must be used inside <MosaicContext.Provider>");return e}function Ie(){return u.useReducer(Ae,Ce)}function De(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}`:`${o}:${String(i).padStart(2,"0")}`}function _e(e){switch(e){case"automation":return"In automation";case"manual_other":return"Manual control by another user";case"manual_self":return"In your mosaic";case"recording_other_group":return"Recording in another group";default:return e?"Busy":null}}const re=[{id:"ios",label:"iOS",match:e=>e==="ios"},{id:"android",label:"Android",match:e=>e==="android"},{id:"tvos",label:"tvOS",match:e=>e==="tvos"},{id:"androidtv",label:"Android TV",match:e=>e==="androidtv"||e==="android-tv"},{id:"other",label:"Other",match:()=>!0}];function Me(e){return e?e==="androidtv"||e==="android-tv"?"ANDROID TV":e.toUpperCase():""}function $e({devices:e,inMosaic:t,onToggle:n}){const[o,i]=u.useState(""),[f,x]=u.useState({}),S=u.useMemo(()=>{const h=o.trim().toLowerCase();return h?e.filter(y=>y.udid.toLowerCase().includes(h)||(y.name??"").toLowerCase().includes(h)||(y.platform??"").toLowerCase().includes(h)):e},[e,o]),v=u.useMemo(()=>{const h=re.map(c=>({id:c.id,label:c.label,rows:[]})),y=c=>h.find((j,w)=>re[w].match(c))??h[h.length-1];for(const c of S)y((c.platform??"").toLowerCase()).rows.push(c);return h.filter(c=>c.rows.length>0)},[S]);return e.length===0?r.jsx("div",{className:"text-xs text-[var(--text-dim)] p-3",children:"No devices online."}):r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx("span",{"aria-hidden":!0,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-dim)] text-xs",children:"⌕"}),r.jsx("input",{type:"text",value:o,placeholder:"Filter devices...",onChange:h=>i(h.target.value),className:"w-full pl-7 pr-2 py-1.5 text-xs rounded border border-[var(--border)] bg-transparent placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--accent,#3b82f6)]"})]}),v.map(h=>{const y=f[h.id];return r.jsxs("section",{className:"flex flex-col gap-1",children:[r.jsxs("button",{type:"button",onClick:()=>x(c=>({...c,[h.id]:!c[h.id]})),className:"flex items-center justify-between w-full text-[10px] uppercase tracking-wider text-[var(--text-dim)] hover:text-white px-1 py-0.5",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{"aria-hidden":!0,className:`inline-block transition-transform ${y?"-rotate-90":"rotate-0"}`,children:"▾"}),h.label]}),r.jsx("span",{children:h.rows.length})]}),!y&&r.jsx("ul",{className:"flex flex-col gap-1 text-sm",children:h.rows.map(c=>{const j=c.busyReason==="manual_self",w=t.has(c.udid),m=!!c.busy&&!j&&!w||!!c.offline,g=c.offline?"Offline":_e(c.busyReason),T=!m;return r.jsx("li",{children:r.jsxs("button",{type:"button",disabled:m,draggable:!m,onDragStart:s=>{s.dataTransfer.effectAllowed="copy",s.dataTransfer.setData("application/x-xenon-udid",c.udid),s.dataTransfer.setData("text/plain",c.udid)},onClick:()=>n(c.udid),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded text-left border transition-colors ${m?"opacity-60 cursor-not-allowed border-transparent":w?"border-emerald-500/40 bg-emerald-500/5 hover:bg-emerald-500/10":"border-transparent hover:border-[var(--border)] hover:bg-[var(--surface-2,rgba(255,255,255,0.04))]"}`,title:m?`${g} — release first`:w?"Click to remove from mosaic (or drag to a cell)":"Click to add to mosaic (or drag to a cell)",children:[r.jsx("span",{"aria-hidden":!0,className:`inline-flex items-center justify-center w-4 h-4 text-xs ${w?"text-emerald-400":"text-[var(--text-dim)]"}`,children:w?"●":"○"}),r.jsx("span",{"aria-hidden":!0,className:`inline-block w-1.5 h-1.5 rounded-full ${c.offline?"bg-zinc-600":T?"bg-emerald-400 shadow-[0_0_4px_rgba(52,211,153,0.7)]":"bg-yellow-500"}`}),r.jsx("span",{className:"font-medium flex-1 truncate text-[13px]",children:c.name??c.udid}),c.platform&&r.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-[var(--surface-2,rgba(255,255,255,0.06))] text-[var(--text-dim)]",children:Me(c.platform)})]})},c.udid)})})]},h.id)}),o&&v.length===0&&r.jsxs("div",{className:"text-xs text-[var(--text-dim)] px-1 py-2",children:['No devices match "',o,'".']}),r.jsxs("div",{className:"text-[10px] text-[var(--text-dim)] px-1 pt-2 flex items-center gap-3",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 inline-block"})," available"]}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-500 inline-block"})," in use"]}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-600 inline-block"})," offline"]})]})]})}const Oe=[{id:"1",label:"1",icon:r.jsx(Le,{})},{id:"2x1",label:"2×1",icon:r.jsx(Be,{})},{id:"2x2",label:"2×2",icon:r.jsx(Ue,{})},{id:"3x2",label:"3×2",icon:r.jsx(Ye,{})},{id:"auto",label:"Auto",icon:r.jsx(We,{})}];function Pe({value:e,onChange:t}){return r.jsx("div",{role:"tablist",className:"inline-flex border border-[var(--border)] rounded-md overflow-hidden text-xs bg-[var(--surface-1,rgba(255,255,255,0.02))]",children:Oe.map(n=>{const o=e===n.id;return r.jsxs("button",{role:"tab","aria-selected":o,onClick:()=>t(n.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 border-r border-[var(--border)] last:border-r-0 transition-colors ${o?"bg-[var(--surface-2,#2a2a2a)] text-white":"text-[var(--text-dim)] hover:bg-[var(--surface-2,rgba(255,255,255,0.04))] hover:text-white"}`,title:`Layout: ${n.label}`,children:[r.jsx("span",{className:"w-3.5 h-3.5 inline-flex items-center justify-center",children:n.icon}),r.jsx("span",{children:n.label})]},n.id)})})}function O(e){return r.jsx("rect",{rx:1.2,ry:1.2,fill:"currentColor",...e})}function Le(){return r.jsx("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:O({x:2,y:2,width:10,height:10})})}function Be(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[O({x:1.5,y:3,width:5,height:8}),O({x:7.5,y:3,width:5,height:8})]})}function Ue(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[O({x:1.5,y:1.5,width:5,height:5}),O({x:7.5,y:1.5,width:5,height:5}),O({x:1.5,y:7.5,width:5,height:5}),O({x:7.5,y:7.5,width:5,height:5})]})}function Ye(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[O({x:1,y:1.5,width:3.3,height:5}),O({x:5.35,y:1.5,width:3.3,height:5}),O({x:9.7,y:1.5,width:3.3,height:5}),O({x:1,y:7.5,width:3.3,height:5}),O({x:5.35,y:7.5,width:3.3,height:5}),O({x:9.7,y:7.5,width:3.3,height:5})]})}function We(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[r.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"1.5"}),r.jsx("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor",stroke:"none"})]})}function ne(e,t){const n=(e||"#ff3333").trim();if(/^#[0-9a-fA-F]{6}$/.test(n)){const o=parseInt(n.slice(1,3),16),i=parseInt(n.slice(3,5),16),f=parseInt(n.slice(5,7),16);return`rgba(${o},${i},${f},${t})`}return n}function oe(e,t,n,o){const i=o.geometry,f=o.color||"#ff3333",x=Math.max(4,Math.round(Math.min(t,n)*.008));if(e.lineCap="round",e.lineJoin="round",o.shape==="CIRCLE"){const c=(i.x??0)*t,j=(i.y??0)*n,w=Math.max(2,(i.w??0)*t),m=Math.max(2,(i.h??0)*n);e.beginPath(),e.ellipse(c,j,w,m,0,0,Math.PI*2),e.fillStyle=ne(f,.22),e.fill(),e.lineWidth=x+2,e.strokeStyle="rgba(0,0,0,0.55)",e.stroke(),e.beginPath(),e.ellipse(c,j,w,m,0,0,Math.PI*2),e.lineWidth=x,e.strokeStyle=f,e.stroke();return}if(o.shape==="ARROW"){const c=(i.x??0)*t,j=(i.y??0)*n,w=c+(i.w??0)*t,m=j+(i.h??0)*n;e.lineWidth=x+2,e.strokeStyle="rgba(0,0,0,0.55)",e.beginPath(),e.moveTo(c,j),e.lineTo(w,m),e.stroke(),e.lineWidth=x,e.strokeStyle=f,e.beginPath(),e.moveTo(c,j),e.lineTo(w,m),e.stroke();const g=Math.atan2(m-j,w-c),T=Math.max(14,x*3);e.fillStyle=f,e.beginPath(),e.moveTo(w,m),e.lineTo(w-T*Math.cos(g-.4),m-T*Math.sin(g-.4)),e.lineTo(w-T*Math.cos(g+.4),m-T*Math.sin(g+.4)),e.closePath(),e.fill();return}if(o.shape==="TEXT"&&o.text){const c=Math.max(16,Math.round(Math.min(t,n)*.035));e.font=`bold ${c}px sans-serif`,e.lineWidth=3,e.strokeStyle="rgba(0,0,0,0.65)",e.strokeText(o.text,(i.x??0)*t,(i.y??0)*n),e.fillStyle=f,e.fillText(o.text,(i.x??0)*t,(i.y??0)*n);return}const S=(i.x??0)*t,v=(i.y??0)*n,h=Math.max(2,(i.w??0)*t),y=Math.max(2,(i.h??0)*n);e.fillStyle=ne(f,.22),e.fillRect(S,v,h,y),e.lineWidth=x+2,e.strokeStyle="rgba(0,0,0,0.55)",e.strokeRect(S,v,h,y),e.lineWidth=x,e.strokeStyle=f,e.strokeRect(S,v,h,y)}function se(e,t,n,o,i){if(o<=0||i<=0)return null;if(e==="CIRCLE"){const h=Math.hypot(n.curX-n.startX,n.curY-n.startY);return h<=4?null:{shape:e,color:t,geometry:{x:n.startX/o,y:n.startY/i,w:h/o,h:h/i}}}if(e==="ARROW"){const h=n.curX-n.startX,y=n.curY-n.startY;return Math.hypot(h,y)<=6?null:{shape:e,color:t,geometry:{x:n.startX/o,y:n.startY/i,w:h/o,h:y/i}}}const f=Math.min(n.startX,n.curX)/o,x=Math.min(n.startY,n.curY)/i,S=Math.abs(n.curX-n.startX)/o,v=Math.abs(n.curY-n.startY)/i;return S<=.005||v<=.005?null:{shape:e,color:t,geometry:{x:f,y:x,w:S,h:v}}}function Ve({enabled:e,shape:t,color:n,onCommit:o,committed:i,onCommittedChange:f}){const x=u.useRef(null),[S,v]=u.useState(null),[h,y]=u.useState([]),c=i??h,j=u.useRef(c),w=u.useRef(S),m=u.useRef(t),g=u.useRef(n),T=u.useRef(e);j.current=c,w.current=S,m.current=t,g.current=n,T.current=e;const s=u.useCallback(a=>{const p=a(j.current);j.current=p,f?f(p):y(p)},[f]),d=u.useCallback(()=>{const a=x.current;if(!a)return;const p=a.getContext("2d");if(!p)return;p.clearRect(0,0,a.width,a.height);for(const M of j.current)oe(p,a.width,a.height,M);const C=w.current;if(C){const M=se(m.current,g.current,C,a.width,a.height);M&&oe(p,a.width,a.height,M)}},[]);u.useEffect(()=>{const a=x.current;if(!a)return;const p=()=>{const M=Math.max(1,Math.round(a.clientWidth)),B=Math.max(1,Math.round(a.clientHeight));(a.width!==M||a.height!==B)&&(a.width=M,a.height=B),d()};p();const C=new ResizeObserver(p);return C.observe(a),()=>C.disconnect()},[d]),u.useEffect(()=>{d()},[S,c,d]),u.useEffect(()=>{var p;if(e)return;v(null);const a=x.current;if(a&&a.hasPointerCapture)try{for(let C=0;C<8;C++)(p=a.hasPointerCapture)!=null&&p.call(a,C)&&a.releasePointerCapture(C)}catch{}},[e]);const N=a=>{const C=x.current.getBoundingClientRect();return{px:a.clientX-C.left,py:a.clientY-C.top,w:C.width,h:C.height}},k=a=>{const p=w.current;if(!p||!T.current){v(null);return}const C=x.current;if(!C||C.width<=0){v(null);return}const M=N(a),B=se(m.current,g.current,{...p,curX:M.px,curY:M.py},M.w,M.h);B&&(s(U=>[...U,B]),o(B)),v(null)},A=a=>{if(!e||a.button!==0)return;a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId);const p=N(a);v({startX:p.px,startY:p.py,curX:p.px,curY:p.py})},R=a=>{if(!w.current)return;const p=N(a);v(C=>C&&{...C,curX:p.px,curY:p.py})},b=a=>{try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}k(a)};return r.jsx("canvas",{ref:x,style:{position:"absolute",inset:0,pointerEvents:e?"auto":"none",cursor:e?"crosshair":"default",zIndex:e?40:25},onPointerDown:A,onPointerMove:R,onPointerUp:b,onPointerCancel:b})}const Fe=3,Xe=45e3,ie=[2e3,5e3,1e4];function He(e){const t=Math.max(0,Math.min(e,ie.length-1));return ie[t]}function Ge(e){return e<Fe}function ae(e){const t=(e.lastError||"").toLowerCase();return/did not find test app|not installed|webdriveragentrunner|applicationverification/.test(t)?"WebDriverAgent is not installed on this device. Install and trust WDA, then retry.":/unsupported ios version|manualpairingtunnelstart/.test(t)?"This device’s iOS version is not supported for live streaming on this host.":/econnrefused|econnreset|connection reset|tunnel/.test(t)?"Lost the connection to the device tunnel. Reconnect the device, then retry.":e.lastError&&e.lastError.trim()?e.lastError.trim():"We couldn’t start the live stream for this device."}function Ke(e){for(let t=0;t+4<e.length;t++){const n=e[t]===0&&e[t+1]===0&&e[t+2]===0&&e[t+3]===1,o=e[t]===0&&e[t+1]===0&&e[t+2]===1;if(!n&&!o)continue;const i=t+(n?4:3);if((e[i]&31)===7){const f=x=>x.toString(16).padStart(2,"0");return`avc1.${f(e[i+1])}${f(e[i+2])}${f(e[i+3])}`}}return"avc1.42e01e"}const ze=({wsUrl:e,onFatal:t,onReady:n,className:o})=>{const i=u.useRef(null),f=u.useRef(t);f.current=t;const x=u.useRef(n);return x.current=n,u.useEffect(()=>{var T;const S=window,v=i.current;if(typeof S.VideoDecoder>"u"||!v){(T=f.current)==null||T.call(f);return}const h=v.getContext("2d");let y=!1,c=!1,j=!0,w=0;const m=new S.VideoDecoder({output:s=>{var d;if(y){s.close();return}v.width!==s.displayWidth&&(v.width=s.displayWidth,v.height=s.displayHeight),h==null||h.drawImage(s,0,0),s.close(),j&&(j=!1,(d=x.current)==null||d.call(x))},error:()=>{var s;return(s=f.current)==null?void 0:s.call(f)}}),g=new WebSocket(e);return g.binaryType="arraybuffer",g.onerror=()=>{var s;return(s=f.current)==null?void 0:s.call(f)},g.onclose=()=>{var s;y||(s=f.current)==null||s.call(f)},g.onmessage=s=>{var A;const d=s.data,N=new DataView(d).getUint8(0),k=new Uint8Array(d,1);if(N===0){if(c)return;try{m.configure({codec:Ke(k),optimizeForLatency:!0}),c=!0}catch{(A=f.current)==null||A.call(f)}return}if(!(!c||m.state!=="configured"))try{m.decode(new S.EncodedVideoChunk({type:N===1?"key":"delta",timestamp:w,data:k})),w+=11111}catch{}},()=>{y=!0;try{g.close()}catch{}try{m.state!=="closed"&&m.close()}catch{}}},[e]),r.jsx("canvas",{ref:i,className:o,style:{width:"100%",height:"100%",objectFit:"contain",display:"block"}})};function Je(e,t,n){return(e==="android"||e==="androidtv"||e==="android-tv")&&t==="h264"&&n?"h264":"mjpeg"}const qe=10,Ze=500;function Qe({udid:e,name:t,recordingId:n,annotateMode:o,shape:i,color:f,aspect:x="9 / 16",screenWidth:S,screenHeight:v,platform:h,onAnnotation:y,overlayAnnotations:c,onOverlayAnnotationsChange:j,onRemove:w}){const[m,g]=u.useState("connecting"),[T,s]=u.useState(0),[d,N]=u.useState(null),k=u.useRef(0),A=u.useRef(null),[R,b]=u.useState(""),[a,p]=u.useState([]),[C,M]=u.useState(!1),B=u.useRef(null),U=u.useRef(null),W=h==="android"||h==="androidtv"||h==="android-tv",he=h==="ios"||h==="tvos";u.useEffect(()=>{let l=!1;if(n){N(null),g("connecting"),s(Date.now()),D.startStream(e).catch(()=>{});return}const E=typeof window.VideoDecoder<"u";return(async()=>{try{const _=encodeURIComponent(e),P=await fetch(`/xenon/api/control/${_}/stream/status`);if(!P.ok)return;const I=await P.json();if(Je(h||"",I==null?void 0:I.type,E)!=="h264"||!(I!=null&&I.h264Path))return;const L=await fetch(`/xenon/api/control/${_}/stream/ticket`,{method:"POST"});if(!L.ok)return;const{ticket:$}=await L.json();if(l||!$)return;const H=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}${I.h264Path}?ticket=${encodeURIComponent($)}`;N(H)}catch{}})(),()=>{l=!0}},[e,h,n]);const X=!o&&!!S&&!!v,Q=(l,E,_)=>{const P=S,I=v,L=Math.min(1,Math.max(0,(l-_.left)/_.width)),$=Math.min(1,Math.max(0,(E-_.top)/_.height));return{x:Math.round(L*P),y:Math.round($*I)}},pe=(l,E,_)=>{const P=Date.now()+Math.random(),I=l-_.left,L=E-_.top;p($=>[...$,{id:P,x:I,y:L}]),window.setTimeout(()=>{p($=>$.filter(F=>F.id!==P))},500)},me=l=>{if(!X||m==="unavailable"||l.button!==0)return;const E=l.currentTarget;E.setPointerCapture(l.pointerId),U.current={startX:l.clientX,startY:l.clientY,startTime:Date.now(),rect:E.getBoundingClientRect()},pe(l.clientX,l.clientY,U.current.rect),E.focus()},xe=async l=>{var H,te;const E=U.current;if(U.current=null,!E||!X)return;try{l.currentTarget.releasePointerCapture(l.pointerId)}catch{}const _=l.clientX-E.startX,P=l.clientY-E.startY,I=Math.hypot(_,P),L=Date.now()-E.startTime,$=Q(E.startX,E.startY,E.rect),F=I<qe;try{if(F&&L<Ze)await D.tap(e,$.x,$.y);else if(F)await((te=(H=D).touchAndHold)==null?void 0:te.call(H,e,$.x,$.y,L));else{const G=Q(l.clientX,l.clientY,E.rect);await D.swipe(e,$.x,$.y,G.x,G.y)}}catch(G){console.error(`[DeviceTile] gesture failed for ${e}`,G)}},ge=()=>{U.current=null},be=async l=>{if(!X||m==="unavailable"||l.metaKey||l.ctrlKey||l.altKey)return;const E=l.key;try{if(E.length===1){l.preventDefault(),await D.typeText(e,E);return}if(E==="Backspace"){l.preventDefault(),W?await D.pressKey(e,67):await D.typeText(e,"\b");return}if(E==="Enter"){l.preventDefault(),W?await D.pressKey(e,66):await D.typeText(e,`
|
|
1
|
+
import{r as u,j as r,X as D,D as Se}from"./index-D9hpVxoi.js";import{A as K,I as je}from"./keycodes-bIEJfQzr.js";function Te(e,t){return e!=="auto"?e:t<=1?"1":t===2?"2x1":t<=4?"2x2":"3x2"}const Ce={selected:new Set,layout:"2x2",tiles:[],groupId:null,compositeEnabled:!1,downloadableVideoCount:0,recordingPhase:"idle",recording:!1,startedAt:null,annotateMode:!1,shape:"RECT",color:"#ff3333",overlayAnnotations:{},errorBanner:null,banner:null};function Ae(e,t){var n;switch(t.type){case"SET_LAYOUT":return{...e,layout:t.layout};case"TOGGLE_SELECTED":{const o=new Set(e.selected);return o.has(t.udid)?o.delete(t.udid):o.add(t.udid),{...e,selected:o}}case"CLEAR_SELECTED":return{...e,selected:new Set};case"SET_TILES":return{...e,tiles:t.tiles};case"ADD_TILE":return e.tiles.some(o=>o.udid===t.tile.udid)?e:{...e,tiles:[...e.tiles,t.tile]};case"PATCH_TILE_DIMS":{let o=!1;const i=e.tiles.map(f=>f.udid!==t.udid||f.screenWidth&&f.screenHeight?f:(o=!0,{...f,screenWidth:t.screenWidth,screenHeight:t.screenHeight,aspect:f.aspect??t.aspect}));return o?{...e,tiles:i}:e}case"REMOVE_TILE":return e.recordingPhase!=="idle"?e:{...e,tiles:e.tiles.filter(o=>o.udid!==t.udid)};case"BIND_RECORDING_IDS":{const o=e.tiles.map(i=>({...i,recordingId:t.map[i.udid]??i.recordingId}));return{...e,tiles:o}}case"SET_RECORDING_PHASE":{const o=t.phase;return{...e,recordingPhase:o,recording:o==="recording"||o==="stopping"}}case"START_RECORDING":{const o=e.tiles.map(i=>({...i,recordingId:t.tileIds[i.udid]??i.recordingId}));return{...e,groupId:t.groupId,compositeEnabled:t.compositeEnabled===!0,downloadableVideoCount:0,recordingPhase:"recording",recording:!0,annotateMode:!0,startedAt:t.startedAt,overlayAnnotations:{},tiles:o}}case"STOP_RECORDING":{const o=e.tiles.map(i=>({...i,recordingId:void 0}));return{...e,recording:!1,recordingPhase:"idle",annotateMode:!1,overlayAnnotations:{},downloadableVideoCount:t.downloadableVideoCount??e.downloadableVideoCount,compositeEnabled:t.compositeEnabled!==void 0?t.compositeEnabled:e.compositeEnabled,tiles:o}}case"SET_ANNOTATE_MODE":return{...e,annotateMode:t.enabled};case"SET_SHAPE":return{...e,shape:t.shape};case"SET_COLOR":return{...e,color:t.color};case"SET_OVERLAY_ANNOTATIONS":return{...e,overlayAnnotations:{...e.overlayAnnotations,[t.recordingId]:t.annotations}};case"CLEAR_OVERLAY_ANNOTATIONS":return{...e,overlayAnnotations:{}};case"SET_ERROR_BANNER":return{...e,errorBanner:t.message,banner:t.message?{tone:"error",message:t.message}:null};case"SET_BANNER":return{...e,banner:t.banner,errorBanner:((n=t.banner)==null?void 0:n.tone)==="error"?t.banner.message:null};default:return e}}const le=u.createContext(null);function ke(){const e=u.useContext(le);if(!e)throw new Error("useMosaic must be used inside <MosaicContext.Provider>");return e}function Ie(){return u.useReducer(Ae,Ce)}function De(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}`:`${o}:${String(i).padStart(2,"0")}`}function _e(e){switch(e){case"automation":return"In automation";case"manual_other":return"Manual control by another user";case"manual_self":return"In your mosaic";case"recording_other_group":return"Recording in another group";default:return e?"Busy":null}}const re=[{id:"ios",label:"iOS",match:e=>e==="ios"},{id:"android",label:"Android",match:e=>e==="android"},{id:"tvos",label:"tvOS",match:e=>e==="tvos"},{id:"androidtv",label:"Android TV",match:e=>e==="androidtv"||e==="android-tv"},{id:"other",label:"Other",match:()=>!0}];function Me(e){return e?e==="androidtv"||e==="android-tv"?"ANDROID TV":e.toUpperCase():""}function $e({devices:e,inMosaic:t,onToggle:n}){const[o,i]=u.useState(""),[f,x]=u.useState({}),S=u.useMemo(()=>{const h=o.trim().toLowerCase();return h?e.filter(y=>y.udid.toLowerCase().includes(h)||(y.name??"").toLowerCase().includes(h)||(y.platform??"").toLowerCase().includes(h)):e},[e,o]),v=u.useMemo(()=>{const h=re.map(c=>({id:c.id,label:c.label,rows:[]})),y=c=>h.find((j,w)=>re[w].match(c))??h[h.length-1];for(const c of S)y((c.platform??"").toLowerCase()).rows.push(c);return h.filter(c=>c.rows.length>0)},[S]);return e.length===0?r.jsx("div",{className:"text-xs text-[var(--text-dim)] p-3",children:"No devices online."}):r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx("span",{"aria-hidden":!0,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-dim)] text-xs",children:"⌕"}),r.jsx("input",{type:"text",value:o,placeholder:"Filter devices...",onChange:h=>i(h.target.value),className:"w-full pl-7 pr-2 py-1.5 text-xs rounded border border-[var(--border)] bg-transparent placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--accent,#3b82f6)]"})]}),v.map(h=>{const y=f[h.id];return r.jsxs("section",{className:"flex flex-col gap-1",children:[r.jsxs("button",{type:"button",onClick:()=>x(c=>({...c,[h.id]:!c[h.id]})),className:"flex items-center justify-between w-full text-[10px] uppercase tracking-wider text-[var(--text-dim)] hover:text-white px-1 py-0.5",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{"aria-hidden":!0,className:`inline-block transition-transform ${y?"-rotate-90":"rotate-0"}`,children:"▾"}),h.label]}),r.jsx("span",{children:h.rows.length})]}),!y&&r.jsx("ul",{className:"flex flex-col gap-1 text-sm",children:h.rows.map(c=>{const j=c.busyReason==="manual_self",w=t.has(c.udid),m=!!c.busy&&!j&&!w||!!c.offline,g=c.offline?"Offline":_e(c.busyReason),T=!m;return r.jsx("li",{children:r.jsxs("button",{type:"button",disabled:m,draggable:!m,onDragStart:s=>{s.dataTransfer.effectAllowed="copy",s.dataTransfer.setData("application/x-xenon-udid",c.udid),s.dataTransfer.setData("text/plain",c.udid)},onClick:()=>n(c.udid),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded text-left border transition-colors ${m?"opacity-60 cursor-not-allowed border-transparent":w?"border-emerald-500/40 bg-emerald-500/5 hover:bg-emerald-500/10":"border-transparent hover:border-[var(--border)] hover:bg-[var(--surface-2,rgba(255,255,255,0.04))]"}`,title:m?`${g} — release first`:w?"Click to remove from mosaic (or drag to a cell)":"Click to add to mosaic (or drag to a cell)",children:[r.jsx("span",{"aria-hidden":!0,className:`inline-flex items-center justify-center w-4 h-4 text-xs ${w?"text-emerald-400":"text-[var(--text-dim)]"}`,children:w?"●":"○"}),r.jsx("span",{"aria-hidden":!0,className:`inline-block w-1.5 h-1.5 rounded-full ${c.offline?"bg-zinc-600":T?"bg-emerald-400 shadow-[0_0_4px_rgba(52,211,153,0.7)]":"bg-yellow-500"}`}),r.jsx("span",{className:"font-medium flex-1 truncate text-[13px]",children:c.name??c.udid}),c.platform&&r.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-[var(--surface-2,rgba(255,255,255,0.06))] text-[var(--text-dim)]",children:Me(c.platform)})]})},c.udid)})})]},h.id)}),o&&v.length===0&&r.jsxs("div",{className:"text-xs text-[var(--text-dim)] px-1 py-2",children:['No devices match "',o,'".']}),r.jsxs("div",{className:"text-[10px] text-[var(--text-dim)] px-1 pt-2 flex items-center gap-3",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 inline-block"})," available"]}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-500 inline-block"})," in use"]}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-600 inline-block"})," offline"]})]})]})}const Oe=[{id:"1",label:"1",icon:r.jsx(Le,{})},{id:"2x1",label:"2×1",icon:r.jsx(Be,{})},{id:"2x2",label:"2×2",icon:r.jsx(Ue,{})},{id:"3x2",label:"3×2",icon:r.jsx(Ye,{})},{id:"auto",label:"Auto",icon:r.jsx(We,{})}];function Pe({value:e,onChange:t}){return r.jsx("div",{role:"tablist",className:"inline-flex border border-[var(--border)] rounded-md overflow-hidden text-xs bg-[var(--surface-1,rgba(255,255,255,0.02))]",children:Oe.map(n=>{const o=e===n.id;return r.jsxs("button",{role:"tab","aria-selected":o,onClick:()=>t(n.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 border-r border-[var(--border)] last:border-r-0 transition-colors ${o?"bg-[var(--surface-2,#2a2a2a)] text-white":"text-[var(--text-dim)] hover:bg-[var(--surface-2,rgba(255,255,255,0.04))] hover:text-white"}`,title:`Layout: ${n.label}`,children:[r.jsx("span",{className:"w-3.5 h-3.5 inline-flex items-center justify-center",children:n.icon}),r.jsx("span",{children:n.label})]},n.id)})})}function O(e){return r.jsx("rect",{rx:1.2,ry:1.2,fill:"currentColor",...e})}function Le(){return r.jsx("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:O({x:2,y:2,width:10,height:10})})}function Be(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[O({x:1.5,y:3,width:5,height:8}),O({x:7.5,y:3,width:5,height:8})]})}function Ue(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[O({x:1.5,y:1.5,width:5,height:5}),O({x:7.5,y:1.5,width:5,height:5}),O({x:1.5,y:7.5,width:5,height:5}),O({x:7.5,y:7.5,width:5,height:5})]})}function Ye(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[O({x:1,y:1.5,width:3.3,height:5}),O({x:5.35,y:1.5,width:3.3,height:5}),O({x:9.7,y:1.5,width:3.3,height:5}),O({x:1,y:7.5,width:3.3,height:5}),O({x:5.35,y:7.5,width:3.3,height:5}),O({x:9.7,y:7.5,width:3.3,height:5})]})}function We(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[r.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"1.5"}),r.jsx("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor",stroke:"none"})]})}function ne(e,t){const n=(e||"#ff3333").trim();if(/^#[0-9a-fA-F]{6}$/.test(n)){const o=parseInt(n.slice(1,3),16),i=parseInt(n.slice(3,5),16),f=parseInt(n.slice(5,7),16);return`rgba(${o},${i},${f},${t})`}return n}function oe(e,t,n,o){const i=o.geometry,f=o.color||"#ff3333",x=Math.max(4,Math.round(Math.min(t,n)*.008));if(e.lineCap="round",e.lineJoin="round",o.shape==="CIRCLE"){const c=(i.x??0)*t,j=(i.y??0)*n,w=Math.max(2,(i.w??0)*t),m=Math.max(2,(i.h??0)*n);e.beginPath(),e.ellipse(c,j,w,m,0,0,Math.PI*2),e.fillStyle=ne(f,.22),e.fill(),e.lineWidth=x+2,e.strokeStyle="rgba(0,0,0,0.55)",e.stroke(),e.beginPath(),e.ellipse(c,j,w,m,0,0,Math.PI*2),e.lineWidth=x,e.strokeStyle=f,e.stroke();return}if(o.shape==="ARROW"){const c=(i.x??0)*t,j=(i.y??0)*n,w=c+(i.w??0)*t,m=j+(i.h??0)*n;e.lineWidth=x+2,e.strokeStyle="rgba(0,0,0,0.55)",e.beginPath(),e.moveTo(c,j),e.lineTo(w,m),e.stroke(),e.lineWidth=x,e.strokeStyle=f,e.beginPath(),e.moveTo(c,j),e.lineTo(w,m),e.stroke();const g=Math.atan2(m-j,w-c),T=Math.max(14,x*3);e.fillStyle=f,e.beginPath(),e.moveTo(w,m),e.lineTo(w-T*Math.cos(g-.4),m-T*Math.sin(g-.4)),e.lineTo(w-T*Math.cos(g+.4),m-T*Math.sin(g+.4)),e.closePath(),e.fill();return}if(o.shape==="TEXT"&&o.text){const c=Math.max(16,Math.round(Math.min(t,n)*.035));e.font=`bold ${c}px sans-serif`,e.lineWidth=3,e.strokeStyle="rgba(0,0,0,0.65)",e.strokeText(o.text,(i.x??0)*t,(i.y??0)*n),e.fillStyle=f,e.fillText(o.text,(i.x??0)*t,(i.y??0)*n);return}const S=(i.x??0)*t,v=(i.y??0)*n,h=Math.max(2,(i.w??0)*t),y=Math.max(2,(i.h??0)*n);e.fillStyle=ne(f,.22),e.fillRect(S,v,h,y),e.lineWidth=x+2,e.strokeStyle="rgba(0,0,0,0.55)",e.strokeRect(S,v,h,y),e.lineWidth=x,e.strokeStyle=f,e.strokeRect(S,v,h,y)}function se(e,t,n,o,i){if(o<=0||i<=0)return null;if(e==="CIRCLE"){const h=Math.hypot(n.curX-n.startX,n.curY-n.startY);return h<=4?null:{shape:e,color:t,geometry:{x:n.startX/o,y:n.startY/i,w:h/o,h:h/i}}}if(e==="ARROW"){const h=n.curX-n.startX,y=n.curY-n.startY;return Math.hypot(h,y)<=6?null:{shape:e,color:t,geometry:{x:n.startX/o,y:n.startY/i,w:h/o,h:y/i}}}const f=Math.min(n.startX,n.curX)/o,x=Math.min(n.startY,n.curY)/i,S=Math.abs(n.curX-n.startX)/o,v=Math.abs(n.curY-n.startY)/i;return S<=.005||v<=.005?null:{shape:e,color:t,geometry:{x:f,y:x,w:S,h:v}}}function Ve({enabled:e,shape:t,color:n,onCommit:o,committed:i,onCommittedChange:f}){const x=u.useRef(null),[S,v]=u.useState(null),[h,y]=u.useState([]),c=i??h,j=u.useRef(c),w=u.useRef(S),m=u.useRef(t),g=u.useRef(n),T=u.useRef(e);j.current=c,w.current=S,m.current=t,g.current=n,T.current=e;const s=u.useCallback(a=>{const p=a(j.current);j.current=p,f?f(p):y(p)},[f]),d=u.useCallback(()=>{const a=x.current;if(!a)return;const p=a.getContext("2d");if(!p)return;p.clearRect(0,0,a.width,a.height);for(const M of j.current)oe(p,a.width,a.height,M);const C=w.current;if(C){const M=se(m.current,g.current,C,a.width,a.height);M&&oe(p,a.width,a.height,M)}},[]);u.useEffect(()=>{const a=x.current;if(!a)return;const p=()=>{const M=Math.max(1,Math.round(a.clientWidth)),B=Math.max(1,Math.round(a.clientHeight));(a.width!==M||a.height!==B)&&(a.width=M,a.height=B),d()};p();const C=new ResizeObserver(p);return C.observe(a),()=>C.disconnect()},[d]),u.useEffect(()=>{d()},[S,c,d]),u.useEffect(()=>{var p;if(e)return;v(null);const a=x.current;if(a&&a.hasPointerCapture)try{for(let C=0;C<8;C++)(p=a.hasPointerCapture)!=null&&p.call(a,C)&&a.releasePointerCapture(C)}catch{}},[e]);const N=a=>{const C=x.current.getBoundingClientRect();return{px:a.clientX-C.left,py:a.clientY-C.top,w:C.width,h:C.height}},k=a=>{const p=w.current;if(!p||!T.current){v(null);return}const C=x.current;if(!C||C.width<=0){v(null);return}const M=N(a),B=se(m.current,g.current,{...p,curX:M.px,curY:M.py},M.w,M.h);B&&(s(U=>[...U,B]),o(B)),v(null)},A=a=>{if(!e||a.button!==0)return;a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId);const p=N(a);v({startX:p.px,startY:p.py,curX:p.px,curY:p.py})},R=a=>{if(!w.current)return;const p=N(a);v(C=>C&&{...C,curX:p.px,curY:p.py})},b=a=>{try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}k(a)};return r.jsx("canvas",{ref:x,style:{position:"absolute",inset:0,pointerEvents:e?"auto":"none",cursor:e?"crosshair":"default",zIndex:e?40:25},onPointerDown:A,onPointerMove:R,onPointerUp:b,onPointerCancel:b})}const Fe=3,Xe=45e3,ie=[2e3,5e3,1e4];function He(e){const t=Math.max(0,Math.min(e,ie.length-1));return ie[t]}function Ge(e){return e<Fe}function ae(e){const t=(e.lastError||"").toLowerCase();return/did not find test app|not installed|webdriveragentrunner|applicationverification/.test(t)?"WebDriverAgent is not installed on this device. Install and trust WDA, then retry.":/unsupported ios version|manualpairingtunnelstart/.test(t)?"This device’s iOS version is not supported for live streaming on this host.":/econnrefused|econnreset|connection reset|tunnel/.test(t)?"Lost the connection to the device tunnel. Reconnect the device, then retry.":e.lastError&&e.lastError.trim()?e.lastError.trim():"We couldn’t start the live stream for this device."}function Ke(e){for(let t=0;t+4<e.length;t++){const n=e[t]===0&&e[t+1]===0&&e[t+2]===0&&e[t+3]===1,o=e[t]===0&&e[t+1]===0&&e[t+2]===1;if(!n&&!o)continue;const i=t+(n?4:3);if((e[i]&31)===7){const f=x=>x.toString(16).padStart(2,"0");return`avc1.${f(e[i+1])}${f(e[i+2])}${f(e[i+3])}`}}return"avc1.42e01e"}const ze=({wsUrl:e,onFatal:t,onReady:n,className:o})=>{const i=u.useRef(null),f=u.useRef(t);f.current=t;const x=u.useRef(n);return x.current=n,u.useEffect(()=>{var T;const S=window,v=i.current;if(typeof S.VideoDecoder>"u"||!v){(T=f.current)==null||T.call(f);return}const h=v.getContext("2d");let y=!1,c=!1,j=!0,w=0;const m=new S.VideoDecoder({output:s=>{var d;if(y){s.close();return}v.width!==s.displayWidth&&(v.width=s.displayWidth,v.height=s.displayHeight),h==null||h.drawImage(s,0,0),s.close(),j&&(j=!1,(d=x.current)==null||d.call(x))},error:()=>{var s;return(s=f.current)==null?void 0:s.call(f)}}),g=new WebSocket(e);return g.binaryType="arraybuffer",g.onerror=()=>{var s;return(s=f.current)==null?void 0:s.call(f)},g.onclose=()=>{var s;y||(s=f.current)==null||s.call(f)},g.onmessage=s=>{var A;const d=s.data,N=new DataView(d).getUint8(0),k=new Uint8Array(d,1);if(N===0){if(c)return;try{m.configure({codec:Ke(k),optimizeForLatency:!0}),c=!0}catch{(A=f.current)==null||A.call(f)}return}if(!(!c||m.state!=="configured"))try{m.decode(new S.EncodedVideoChunk({type:N===1?"key":"delta",timestamp:w,data:k})),w+=11111}catch{}},()=>{y=!0;try{g.close()}catch{}try{m.state!=="closed"&&m.close()}catch{}}},[e]),r.jsx("canvas",{ref:i,className:o,style:{width:"100%",height:"100%",objectFit:"contain",display:"block"}})};function Je(e,t,n){return(e==="android"||e==="androidtv"||e==="android-tv")&&t==="h264"&&n?"h264":"mjpeg"}const qe=10,Ze=500;function Qe({udid:e,name:t,recordingId:n,annotateMode:o,shape:i,color:f,aspect:x="9 / 16",screenWidth:S,screenHeight:v,platform:h,onAnnotation:y,overlayAnnotations:c,onOverlayAnnotationsChange:j,onRemove:w}){const[m,g]=u.useState("connecting"),[T,s]=u.useState(0),[d,N]=u.useState(null),k=u.useRef(0),A=u.useRef(null),[R,b]=u.useState(""),[a,p]=u.useState([]),[C,M]=u.useState(!1),B=u.useRef(null),U=u.useRef(null),W=h==="android"||h==="androidtv"||h==="android-tv",he=h==="ios"||h==="tvos";u.useEffect(()=>{let l=!1;if(n){N(null),g("connecting"),s(Date.now()),D.startStream(e).catch(()=>{});return}const E=typeof window.VideoDecoder<"u";return(async()=>{try{const _=encodeURIComponent(e),P=await fetch(`/xenon/api/control/${_}/stream/status`);if(!P.ok)return;const I=await P.json();if(Je(h||"",I==null?void 0:I.type,E)!=="h264"||!(I!=null&&I.h264Path))return;const L=await fetch(`/xenon/api/control/${_}/stream/ticket`,{method:"POST"});if(!L.ok)return;const{ticket:$}=await L.json();if(l||!$)return;const H=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}${I.h264Path}?ticket=${encodeURIComponent($)}`;N(H)}catch{}})(),()=>{l=!0}},[e,h,n]);const X=!o&&!!S&&!!v,Q=(l,E,_)=>{const P=S,I=v,L=Math.min(1,Math.max(0,(l-_.left)/_.width)),$=Math.min(1,Math.max(0,(E-_.top)/_.height));return{x:Math.round(L*P),y:Math.round($*I)}},pe=(l,E,_)=>{const P=Date.now()+Math.random(),I=l-_.left,L=E-_.top;p($=>[...$,{id:P,x:I,y:L}]),window.setTimeout(()=>{p($=>$.filter(F=>F.id!==P))},500)},me=l=>{if(!X||m==="unavailable"||l.button!==0)return;const E=l.currentTarget;E.setPointerCapture(l.pointerId),U.current={startX:l.clientX,startY:l.clientY,startTime:Date.now(),rect:E.getBoundingClientRect()},pe(l.clientX,l.clientY,U.current.rect),E.focus()},xe=async l=>{var H,te;const E=U.current;if(U.current=null,!E||!X)return;try{l.currentTarget.releasePointerCapture(l.pointerId)}catch{}const _=l.clientX-E.startX,P=l.clientY-E.startY,I=Math.hypot(_,P),L=Date.now()-E.startTime,$=Q(E.startX,E.startY,E.rect),F=I<qe;try{if(F&&L<Ze)await D.tap(e,$.x,$.y);else if(F)await((te=(H=D).touchAndHold)==null?void 0:te.call(H,e,$.x,$.y,L));else{const G=Q(l.clientX,l.clientY,E.rect);await D.swipe(e,$.x,$.y,G.x,G.y)}}catch(G){console.error(`[DeviceTile] gesture failed for ${e}`,G)}},ge=()=>{U.current=null},be=async l=>{if(!X||m==="unavailable"||l.metaKey||l.ctrlKey||l.altKey)return;const E=l.key;try{if(E.length===1){l.preventDefault(),await D.typeText(e,E);return}if(E==="Backspace"){l.preventDefault(),W?await D.pressKey(e,67):await D.typeText(e,"\b");return}if(E==="Enter"){l.preventDefault(),W?await D.pressKey(e,66):await D.typeText(e,`
|
|
2
2
|
`);return}if(E==="Tab"){l.preventDefault(),await D.typeText(e," ");return}E==="Escape"&&W&&(l.preventDefault(),await D.pressKey(e,K.BACK))}catch(_){console.error(`[DeviceTile] keystroke "${E}" failed for ${e}`,_)}},ye=()=>D.pressKey(e,W?K.HOME:je.HOME).catch(l=>console.error(`[DeviceTile] home failed for ${e}`,l)),ve=()=>D.pressKey(e,K.BACK).catch(l=>console.error(`[DeviceTile] back failed for ${e}`,l)),we=()=>D.pressKey(e,K.APP_SWITCH).catch(l=>console.error(`[DeviceTile] app-switch failed for ${e}`,l)),Ne=async()=>{try{const l=await D.getScreenshot(e),E=(l==null?void 0:l.screenshot)??(l==null?void 0:l.value)??l;if(!E)return;const _=await fetch(`data:image/png;base64,${E}`).then(L=>L.blob()),P=URL.createObjectURL(_),I=document.createElement("a");I.href=P,I.download=`${t||e}-${Date.now()}.png`,document.body.appendChild(I),I.click(),I.remove(),setTimeout(()=>URL.revokeObjectURL(P),1e3)}catch(l){console.error(`[DeviceTile] screenshot failed for ${e}`,l)}};u.useEffect(()=>{console.log(`[DeviceTile] Rendering ${e} in state: ${m}`)},[e,m]);const Ee=`/xenon/api/control/${encodeURIComponent(e)}/stream?t=${T}`,ee=u.useCallback(async()=>{try{const l=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/status`);if(!l.ok)throw new Error(String(l.status));const E=await l.json();b(ae({lastError:E==null?void 0:E.lastError,status:E==null?void 0:E.status}))}catch{b(ae({}))}},[e]),J=u.useCallback(()=>{const l=k.current;Ge(l)?(k.current=l+1,A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{g("connecting"),s(Date.now())},He(l))):(g("unavailable"),ee())},[ee]);u.useEffect(()=>{if(m!=="connecting")return;const l=setTimeout(J,Xe);return()=>clearTimeout(l)},[m,T,J]),u.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const Re=()=>{A.current&&clearTimeout(A.current),k.current=0,b(""),g("connecting"),s(Date.now())},V=!!n,q=t||e.slice(0,16)+"…";return r.jsxs("div",{className:"flex items-stretch justify-center w-full h-full min-h-0 min-w-0 gap-2",children:[r.jsxs("div",{className:"relative bg-[#000] rounded-lg overflow-hidden border border-[var(--border)] group max-h-full max-w-full self-center",style:{aspectRatio:x,height:"100%"},children:[m==="connecting"&&r.jsxs("div",{className:"flex flex-col items-center justify-center bg-neutral-900/80 text-neutral-400 absolute inset-0 z-20 pointer-events-none",children:[r.jsx("div",{className:"relative flex items-center justify-center",children:r.jsx("div",{className:"w-12 h-12 border-4 border-neutral-800 border-t-neutral-400 rounded-full animate-spin"})}),r.jsx("div",{className:"mt-4 font-bold text-neutral-200",children:"Starting Stream…"}),r.jsx("div",{className:"text-[10px] mt-1 text-neutral-500 opacity-60 font-mono",children:e}),r.jsx("div",{className:"text-[10px] mt-4 text-neutral-400 bg-white/5 px-2 py-1 rounded",children:"Waiting for device connection..."})]}),m==="unavailable"&&r.jsx("div",{className:"flex items-center justify-center bg-black text-neutral-400 absolute inset-0 z-20",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx("div",{className:"text-5xl mb-4 opacity-20",children:"📵"}),r.jsx("div",{className:"font-bold text-white text-lg",children:"Connection Failed"}),r.jsx("p",{className:"text-xs mt-2 text-neutral-500 leading-relaxed max-w-[240px] mx-auto",children:R||"We couldn’t start the live stream for this device."}),r.jsx("button",{className:"mt-6 text-sm font-semibold px-6 py-2.5 rounded-full bg-red-600 hover:bg-red-500 text-white transition-all shadow-[0_0_20px_rgba(220,38,38,0.3)] active:scale-95",onClick:Re,children:"Retry Connection"})]})}),d?r.jsx(ze,{wsUrl:d,className:"absolute inset-0 w-full h-full object-contain bg-black select-none pointer-events-none",onReady:()=>g("live"),onFatal:()=>{console.warn(`[DeviceTile] H.264 fatal for ${e}; falling back to MJPEG`),N(null),g("connecting"),s(Date.now())}}):r.jsx("img",{src:Ee,alt:q,className:"absolute inset-0 w-full h-full object-contain bg-black select-none pointer-events-none",draggable:!1,style:{opacity:m==="live"?1:0,transition:"opacity 0.3s ease-in-out"},onLoad:()=>{console.log(`[DeviceTile] Image LOADED for ${e}`),k.current=0,A.current&&clearTimeout(A.current),g("live")},onError:l=>{console.error(`[DeviceTile] Image ERROR for ${e}`,l),J()}},T),X&&m!=="unavailable"&&r.jsx("div",{ref:B,className:`absolute inset-0 z-[35] touch-none outline-none ${C?"ring-2 ring-emerald-400/60 ring-inset rounded-lg":""}`,tabIndex:0,onPointerDown:me,onPointerUp:xe,onPointerCancel:ge,onKeyDown:be,onFocus:()=>M(!0),onBlur:()=>M(!1)}),r.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none overflow-hidden",children:a.map(l=>r.jsx("span",{className:"absolute block w-10 h-10 rounded-full border-2 border-emerald-300/80 animate-ping",style:{left:l.x-20,top:l.y-20}},l.id))}),V&&r.jsx(Ve,{enabled:o,shape:i,color:f,committed:c,onCommittedChange:j,onCommit:l=>y(n,l)}),V&&o&&m==="live"&&r.jsx("div",{className:"absolute bottom-3 left-3 right-3 z-30 pointer-events-none",children:r.jsx("div",{className:"px-2 py-1 rounded bg-black/70 text-[10px] text-amber-100 border border-amber-500/40 text-center",children:"Annotate on — drag on the preview. Shapes stay on screen and appear in Download video from that moment. Toggle Annotate off to tap the device."})}),V&&r.jsx("div",{className:"absolute top-3 left-3 z-30 pointer-events-none",children:r.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-red-600 text-white text-[9px] font-black shadow-lg",children:"REC"})}),r.jsxs("div",{className:"absolute top-3 left-3 z-30 flex flex-col gap-1.5 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:[m==="live"&&r.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-emerald-500 text-black text-[9px] font-black shadow-lg w-fit",children:"LIVE"}),r.jsx("span",{className:"px-2 py-1 rounded bg-black/80 text-white text-[11px] font-medium backdrop-blur-md border border-white/10 shadow-xl truncate max-w-[180px]",children:q})]})]}),r.jsx(et,{streamState:m,recording:V,isIOS:he,isAndroid:W,platform:h,onClose:!V&&w?()=>w(e):void 0,sendHome:ye,sendBack:ve,sendAppSwitch:we,captureScreenshot:Ne,displayName:q})]})}function et({streamState:e,recording:t,isIOS:n,isAndroid:o,platform:i,onClose:f,sendHome:x,sendBack:S,sendAppSwitch:v,captureScreenshot:h,displayName:y}){const c=e==="live";return!f&&!c?null:r.jsxs("div",{className:"self-stretch w-9 flex flex-col items-center justify-between gap-1 py-2 rounded-lg bg-black/40 border border-white/10 backdrop-blur-md text-white",children:[r.jsx("div",{className:"flex flex-col items-center gap-1",children:f&&r.jsx("button",{type:"button","aria-label":`Remove ${y} from mosaic`,title:"Remove from mosaic",onClick:f,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-red-600/70 transition-colors text-base leading-none",children:"×"})}),c&&r.jsxs("div",{className:"flex flex-col items-center gap-1.5 my-auto",children:[(o||n)&&r.jsx("button",{type:"button",title:`Home${i?` (${i})`:""}`,onClick:x,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"⌂"}),o&&r.jsx("button",{type:"button",title:"Back",onClick:S,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"‹"}),o&&r.jsx("button",{type:"button",title:"Recent apps",onClick:v,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"▢"})]}),c&&r.jsx("div",{className:"flex flex-col items-center gap-1",children:r.jsx("button",{type:"button",title:"Screenshot",onClick:h,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"⎙"})})]})}const tt={1:"1fr","2x1":"1fr 1fr","2x2":"1fr 1fr","3x2":"1fr 1fr 1fr"},rt={1:"1fr","2x1":"1fr","2x2":"1fr 1fr","3x2":"1fr 1fr"},nt={1:1,"2x1":2,"2x2":4,"3x2":6};function ot({layout:e,tiles:t,annotateMode:n,shape:o,color:i,onAnnotation:f,overlayAnnotationsByRecording:x,onOverlayAnnotationsChange:S,onRemove:v,onDropDevice:h}){const y=Te(e,t.length),c=nt[y];t.length;const j=t.length,w=e==="auto"?Math.max(j,1):c,m=Math.max(0,w-j);return r.jsxs("div",{style:{display:"grid",gap:8,gridTemplateColumns:tt[y],gridTemplateRows:rt[y]},className:"h-full",children:[t.map(g=>r.jsx(Qe,{udid:g.udid,name:g.name,mjpegPort:g.mjpegPort,recordingId:g.recordingId,aspect:g.aspect,screenWidth:g.screenWidth,screenHeight:g.screenHeight,platform:g.platform,annotateMode:n,shape:o,color:i,overlayAnnotations:g.recordingId?x==null?void 0:x[g.recordingId]:void 0,onOverlayAnnotationsChange:g.recordingId&&S?T=>S(g.recordingId,T):void 0,onAnnotation:f,onRemove:v},g.udid)),Array.from({length:m},(g,T)=>r.jsx(st,{onDropDevice:h},`empty-${T}`))]})}function st({onDropDevice:e}){const[t,n]=u.useState(!1);return r.jsxs("div",{onDragOver:o=>{e&&(o.preventDefault(),o.dataTransfer.dropEffect="copy",t||n(!0))},onDragLeave:()=>n(!1),onDrop:o=>{if(n(!1),!e)return;o.preventDefault();const i=o.dataTransfer.getData("application/x-xenon-udid")||o.dataTransfer.getData("text/plain");i&&e(i)},className:`flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed transition-colors ${t?"border-emerald-500/60 bg-emerald-500/5":"border-[var(--border)] bg-[var(--surface-1,rgba(255,255,255,0.02))]"} text-[var(--text-dim)] min-h-[120px]`,children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-xl ${t?"bg-emerald-500/15 text-emerald-300":"bg-white/5 text-white/60"}`,children:"+"}),r.jsx("div",{className:"text-xs font-medium",children:"Drag device here"}),r.jsx("div",{className:"text-[10px] opacity-70",children:"or click one in the panel"})]})}const Y="/xenon/api/recordings";class de extends Error{constructor(t){super(t.message??t.error),this.body=t}}async function z(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:t?JSON.stringify(t):void 0});if(n.status===409)throw new de(await n.json());if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}function it(e,t){return z(Y,{udids:e,...t})}function at(e){return z(`${Y}/${encodeURIComponent(e)}/stop`)}function ue(e,t,n,o,i){return z(`${Y}/${encodeURIComponent(e)}/bookmark`,{recordingId:t,timecodeMs:n,label:o,note:i})}function ct(e,t){return z(`${Y}/${encodeURIComponent(e)}/annotation`,t)}function lt(e){return`${Y}/${encodeURIComponent(e)}/videos.zip`}function dt(e,t){return`${Y}/${encodeURIComponent(e)}/video.mp4`}function ut(e){return`${Y}/${encodeURIComponent(e)}/composite.mp4`}function ft(e,t){return t==="starting"?"Starting…":e<=0?"Record":e===1?"● Record":`● Record ${e} devices`}function ht({selectedUdids:e}){const{state:t,dispatch:n}=ke(),[o,i]=u.useState(()=>Date.now());u.useEffect(()=>{if(t.recordingPhase!=="recording"&&t.recordingPhase!=="stopping")return;i(Date.now());const R=window.setInterval(()=>i(Date.now()),250);return()=>window.clearInterval(R)},[t.recordingPhase]);const f=t.startedAt&&(t.recordingPhase==="recording"||t.recordingPhase==="stopping")?o-t.startedAt:0,x=t.recordingPhase==="starting"||t.recordingPhase==="stopping",S=t.recordingPhase==="idle"&&e.length>0&&!x,h=(t.recordingPhase==="recording"||t.recording&&t.tiles.some(R=>!!R.recordingId))&&!x,y=h,c=!!t.groupId&&t.recordingPhase==="idle",j=e.length>1||t.downloadableVideoCount>1,w=c&&t.compositeEnabled,m=c&&!t.compositeEnabled&&(t.downloadableVideoCount===1||t.downloadableVideoCount===0&&e.length<=1),g=async()=>{var R;if(S){n({type:"SET_RECORDING_PHASE",phase:"starting"}),n({type:"SET_BANNER",banner:null});try{const b=await it(e);if(!((R=b.recordings)!=null&&R.length)){n({type:"SET_RECORDING_PHASE",phase:"idle"}),n({type:"SET_BANNER",banner:{tone:"error",message:"Recording did not start. Check that live preview is working, then try again."}});return}const a={};for(const C of b.recordings)a[C.udid]=C.id;const p=e.length-b.recordings.length;n({type:"START_RECORDING",groupId:b.groupId,startedAt:Date.now(),tileIds:a,compositeEnabled:b.compositeEnabled===!0}),p>0?n({type:"SET_BANNER",banner:{tone:"error",message:`Recording started on ${b.recordings.length} of ${e.length} devices (${p} failed).`}}):n({type:"SET_BANNER",banner:null})}catch(b){if(n({type:"SET_RECORDING_PHASE",phase:"idle"}),b instanceof de)if(b.body.error==="device_busy"){const a=(b.body.busyDevices??[]).map(p=>`${p.udid} (${p.reason})`).join(", ");n({type:"SET_BANNER",banner:{tone:"error",message:`Cannot start — these devices are busy: ${a}`}})}else n({type:"SET_BANNER",banner:{tone:"error",message:`Server-wide recording cap reached (${b.body.active}/${b.body.limit}).`}});else n({type:"SET_BANNER",banner:{tone:"error",message:`Recording failed: ${b.message}`}})}}},T=async()=>{if(!(!t.groupId||t.recordingPhase!=="recording")){n({type:"SET_RECORDING_PHASE",phase:"stopping"});try{const R=await at(t.groupId),b=(R.recordings??[]).filter(p=>p.status==="STOPPED"&&(p.sizeBytes??0)>=1024),a=(R.recordings??[]).filter(p=>p.status!=="STOPPED");n({type:"STOP_RECORDING",downloadableVideoCount:b.length,compositeEnabled:t.compositeEnabled}),b.length===0?n({type:"SET_BANNER",banner:{tone:"error",message:a.length>0?`Recording failed on ${a.length} device(s). Nothing to download.`:"Recording stopped but no playable video was produced."}}):a.length>0?n({type:"SET_BANNER",banner:{tone:"info",message:`${b.length} video(s) ready · ${a.length} failed. Use Download below.`}}):n({type:"SET_BANNER",banner:{tone:"info",message:b.length===1?"Video ready — download below.":`${b.length} videos ready — download below.`}})}catch(R){n({type:"STOP_RECORDING"}),n({type:"SET_BANNER",banner:{tone:"error",message:`Stop failed: ${R.message}`}})}}},s=async()=>{var p;if(!t.groupId||t.recordingPhase!=="recording")return;const R=window.prompt("Bookmark label?");if(!R)return;const b=t.startedAt?Date.now()-t.startedAt:0,a=(p=t.tiles.find(C=>C.recordingId))==null?void 0:p.recordingId;if(a)try{await ue(t.groupId,a,b,R)}catch(C){n({type:"SET_BANNER",banner:{tone:"error",message:`Bookmark failed: ${C.message}`}})}},d=()=>{y&&n({type:"SET_ANNOTATE_MODE",enabled:!t.annotateMode})},N=()=>{y&&n({type:"CLEAR_OVERLAY_ANNOTATIONS"})},k=Object.values(t.overlayAnnotations).some(R=>((R==null?void 0:R.length)??0)>0),A=[{id:"RECT",label:"Rect"},{id:"CIRCLE",label:"Circle"},{id:"ARROW",label:"Arrow"},{id:"FREEHAND",label:"Draw"}];return r.jsxs("div",{className:"flex items-center gap-2 flex-wrap justify-end",children:[(t.recordingPhase==="recording"||t.recordingPhase==="stopping")&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-mono tabular-nums bg-red-600/20 text-red-200 border border-red-500/40",title:"Recording elapsed time",children:[r.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse"}),"REC ",De(f),t.recordingPhase==="stopping"?" · Stopping…":""]}),r.jsx("button",{type:"button",onClick:g,disabled:!S,title:e.length===0?"Add a device to the mosaic first":"Record every device currently in the mosaic",className:"px-3 py-1.5 text-sm rounded bg-red-600 text-white disabled:opacity-40 disabled:cursor-not-allowed",children:ft(e.length,t.recordingPhase)}),r.jsx("button",{type:"button",onClick:T,disabled:!h,className:"px-3 py-1.5 text-sm rounded border border-[var(--border)] disabled:opacity-40 disabled:cursor-not-allowed",children:t.recordingPhase==="stopping"?"Stopping…":"⏹ Stop"}),r.jsx("button",{type:"button",onClick:s,disabled:!h,className:"px-3 py-1.5 text-sm rounded border border-[var(--border)] disabled:opacity-40 disabled:cursor-not-allowed",children:"🔖 Bookmark"}),r.jsx("button",{type:"button",onClick:d,disabled:!y,title:y?t.annotateMode?"Exit annotate mode (tap/swipe resumes)":"Draw on the live screen — saved with the recording":"Start recording to annotate",className:`px-3 py-1.5 text-sm rounded border ${t.annotateMode?"bg-[var(--accent,#3b82f6)] text-white border-transparent":"border-[var(--border)]"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"✎ Annotate"}),t.annotateMode&&y&&r.jsxs("div",{className:"flex items-center gap-1 ml-1 pl-2 border-l border-[var(--border)]",children:[A.map(R=>r.jsx("button",{type:"button",onClick:()=>n({type:"SET_SHAPE",shape:R.id}),className:`px-2 py-1 text-xs rounded border ${t.shape===R.id?"bg-[var(--surface-2,#1a1a1a)] border-[var(--accent,#3b82f6)] text-white":"border-[var(--border)] opacity-80 hover:opacity-100"}`,children:R.label},R.id)),r.jsx("input",{type:"color",value:t.color,onChange:R=>n({type:"SET_COLOR",color:R.target.value}),title:"Annotation color",className:"w-7 h-7 rounded border border-[var(--border)] bg-transparent cursor-pointer"})]}),y&&k&&r.jsx("button",{type:"button",onClick:N,title:"Clear drawn annotations from the live preview",className:"px-2 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2,#1a1a1a)]",children:"Clear marks"}),c&&m&&r.jsx("a",{href:dt(t.groupId),className:"ml-1 px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2,#1a1a1a)]",download:!0,children:"⤓ Download video"}),c&&!m&&r.jsxs("a",{href:lt(t.groupId),className:"ml-1 px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2,#1a1a1a)]",download:`videos-${t.groupId}.zip`,title:"ZIP of mp4 files only (no JSON extras)",children:["⤓ Download ",j?"videos":"video"]}),w&&r.jsx("a",{href:ut(t.groupId),className:"px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2,#1a1a1a)]",download:`side-by-side-${t.groupId}.mp4`,title:"All devices in one side-by-side video",children:"⤓ Side-by-side"})]})}function pt({remainingSec:e,onContinue:t,onReleaseNow:n}){return r.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"idle-warning-title",className:"fixed inset-0 z-40 bg-black/60 flex items-center justify-center",children:r.jsxs("div",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-lg w-full max-w-md p-6",children:[r.jsx("h3",{id:"idle-warning-title",className:"text-base font-semibold mb-2",children:"Are you still there?"}),r.jsxs("p",{className:"text-sm text-[var(--text-dim)] mb-4",children:["Your devices will be released in"," ",r.jsxs("span",{className:"text-[var(--text)] font-mono font-semibold",children:[e,"s"]})," due to inactivity. Click ",r.jsx("strong",{children:"Continue Session"})," to keep them locked."]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:n,className:"h-9 px-3 rounded-md border border-[var(--border)] text-sm text-[var(--text-dim)] hover:text-[var(--text)]",children:"Release now"}),r.jsx("button",{type:"button",autoFocus:!0,onClick:t,className:"h-9 px-4 rounded-md bg-[var(--green)] text-black text-sm font-medium",children:"Continue Session"})]})]})})}function fe(e,t,n){return!n||!e?!1:e===`manual_${n}_${t}`}function mt(e,t){return e.busy?fe(e.session_id,e.udid,t):!1}const ce=["mousemove","mousedown","keydown","touchstart","wheel"];function xt({idleAfterMs:e,warningSec:t,onWarning:n,onTimeout:o,enabled:i}){const[f,x]=u.useState(!1),[S,v]=u.useState(null),h=u.useRef(null),y=u.useRef(null),c=u.useRef(!1),j=u.useRef(n),w=u.useRef(o);j.current=n,w.current=o;function m(){h.current&&(clearTimeout(h.current),h.current=null),y.current&&(clearInterval(y.current),y.current=null)}function g(){c.current=!0,x(!0),v(t),j.current(t);let d=t;y.current=setInterval(()=>{d-=1,d<=0?(m(),c.current=!1,x(!1),v(null),w.current()):v(d)},1e3)}function T(){m(),c.current=!1,x(!1),v(null);const d=e-t*1e3;h.current=setTimeout(g,Math.max(0,d))}function s(){i&&T()}return u.useEffect(()=>{if(!i){m(),c.current=!1,x(!1),v(null);return}function d(){c.current||T()}return ce.forEach(N=>window.addEventListener(N,d,{passive:!0})),T(),()=>{ce.forEach(N=>window.removeEventListener(N,d)),m()}},[i,e,t]),{warning:f,remainingSec:S,reset:s}}const gt=5*60*1e3,bt=30;function Z(e){if(!e)return"9 / 16";const t=Number(e.screenWidth),n=Number(e.screenHeight);if(Number.isFinite(t)&&Number.isFinite(n)&&t>0&&n>0)return`${t} / ${n}`;const o=(e.platform||"").toLowerCase();return o==="tvos"||o==="androidtv"||o==="android-tv"?"16 / 9":"9 / 16"}function yt(e,t){if(e.busy)return e.session_id?e.session_id.startsWith("manual_")?fe(e.session_id,e.udid,t)?"manual_self":"manual_other":"automation":"unknown"}function vt(e,t){return{udid:e.udid,name:e.name,platform:e.platform,busy:e.busy,busyReason:yt(e,t),mjpegServerPort:e.mjpegServerPort,offline:!!e.offline}}function Et(){const[e,t]=Ie(),[n,o]=u.useState([]),[i,f]=u.useState(0),[x,S]=u.useState(null),v=u.useRef(!1);u.useEffect(()=>{let s=!1;return fetch("/xenon/api/auth/me",{credentials:"include"}).then(d=>d.ok?d.json():null).then(d=>{!s&&(d!=null&&d.userId)&&S(d.userId)}).catch(()=>{}),()=>{s=!0}},[]),u.useEffect(()=>{let s=!1;const d=async()=>{try{const k=await D.getDevices();s||o(Array.isArray(k)?k:[])}catch{}};d();const N=window.setInterval(d,5e3);return()=>{s=!0,window.clearInterval(N)}},[i]),u.useEffect(()=>{let s=!1;if(!(!x||v.current))return v.current=!0,(async()=>{try{const d=await D.getDevices(),N=(Array.isArray(d)?d:[]).filter(b=>mt(b,x));if(N.length===0)return;const A=(await Promise.all(N.map(async b=>{try{const a=await fetch(`/xenon/api/control/${encodeURIComponent(b.udid)}/stream/status`);if(!a.ok)return null;const p=await a.json();return(p==null?void 0:p.status)==="running"?b:null}catch{return null}}))).filter(b=>b!==null);if(s||A.length===0)return;const R=A.map(b=>{const a=Number(b.screenWidth),p=Number(b.screenHeight);return{udid:b.udid,name:b.name,mjpegPort:0,aspect:Z(b),screenWidth:Number.isFinite(a)&&a>0?a:void 0,screenHeight:Number.isFinite(p)&&p>0?p:void 0,platform:b.platform}});t({type:"SET_TILES",tiles:R})}catch{}})(),()=>{s=!0}},[x,t]),u.useEffect(()=>{for(const s of e.tiles){if(s.screenWidth&&s.screenHeight)continue;const d=n.find(A=>A.udid===s.udid);if(!d)continue;const N=Number(d.screenWidth),k=Number(d.screenHeight);Number.isFinite(N)&&N>0&&Number.isFinite(k)&&k>0&&t({type:"PATCH_TILE_DIMS",udid:s.udid,screenWidth:N,screenHeight:k,aspect:Z(d)})}},[n,e.tiles,t]),u.useEffect(()=>{const s=async d=>{var b,a;if(d.key!=="b"&&d.key!=="B")return;const N=(b=d.target)==null?void 0:b.tagName;if(N==="INPUT"||N==="TEXTAREA"||N==="SELECT"||!e.recording||!e.groupId)return;const k=window.prompt("Bookmark label?");if(!k)return;const A=e.startedAt?Date.now()-e.startedAt:0,R=(a=e.tiles.find(p=>p.recordingId))==null?void 0:a.recordingId;if(R)try{await ue(e.groupId,R,A,k)}catch(p){t({type:"SET_ERROR_BANNER",message:`Bookmark failed: ${p.message}`})}};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e.recording,e.groupId,e.startedAt,e.tiles,t]);const h=u.useMemo(()=>new Set(e.tiles.map(s=>s.udid)),[e.tiles]),y=u.useMemo(()=>n.map(s=>vt(s,x)),[n,x]),c=s=>{const d=Number(s.screenWidth),N=Number(s.screenHeight);return{udid:s.udid,name:s.name,mjpegPort:0,aspect:Z(s),screenWidth:Number.isFinite(d)&&d>0?d:void 0,screenHeight:Number.isFinite(N)&&N>0?N:void 0,platform:s.platform}},j=async s=>{if(e.tiles.some(A=>A.udid===s)){await w(s);return}if(e.recording){t({type:"SET_ERROR_BANNER",message:"Stop recording before changing the mosaic layout."});return}const N=n.find(A=>A.udid===s);if(!N)return;t({type:"ADD_TILE",tile:c(N)});const k=await D.startStream(s).catch(()=>null);Se(k)&&t({type:"REMOVE_TILE",udid:s})},w=async s=>{t({type:"REMOVE_TILE",udid:s});try{await fetch(`/xenon/api/control/${encodeURIComponent(s)}/stream/stop`,{method:"POST"})}catch{}f(d=>d+1)},m=async(s,d)=>{if(e.groupId)try{await ct(e.groupId,{recordingId:s,timecodeMs:e.startedAt?Date.now()-e.startedAt:0,shape:d.shape,geometry:JSON.stringify(d.geometry),color:d.color,text:d.text})}catch(N){t({type:"SET_ERROR_BANNER",message:`Annotation failed: ${N.message}`})}},g=()=>{for(const s of e.tiles){const d=`/xenon/api/control/${encodeURIComponent(s.udid)}/stream/stop`;try{navigator.sendBeacon?navigator.sendBeacon(d):fetch(d,{method:"POST",keepalive:!0}).catch(()=>{})}catch{}}e.tiles.forEach(s=>t({type:"REMOVE_TILE",udid:s.udid}))},T=xt({idleAfterMs:gt,warningSec:bt,enabled:e.tiles.length>0,onWarning:()=>{},onTimeout:()=>{g()}});return r.jsxs(le.Provider,{value:{state:e,dispatch:t},children:[r.jsxs("div",{className:"flex flex-col h-full p-4 gap-3",children:[r.jsxs("header",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-base font-semibold",children:"Live Devices"}),r.jsx(Pe,{value:e.layout,onChange:s=>t({type:"SET_LAYOUT",layout:s})})]}),r.jsx(ht,{selectedUdids:e.tiles.map(s=>s.udid)})]}),e.banner&&r.jsxs("div",{role:"alert",className:`text-sm rounded border px-3 py-2 flex items-center gap-2 ${e.banner.tone==="error"?"border-red-500/40 bg-red-500/10 text-red-100":"border-emerald-500/40 bg-emerald-500/10 text-emerald-100"}`,children:[r.jsx("span",{className:"flex-1",children:e.banner.message}),r.jsx("button",{type:"button",className:"text-xs opacity-80 hover:opacity-100",onClick:()=>t({type:"SET_BANNER",banner:null}),children:"Dismiss"})]}),r.jsxs("div",{className:"grid grid-cols-[260px_1fr] gap-3 flex-1 min-h-0",children:[r.jsxs("aside",{className:"flex flex-col gap-2 border border-[var(--border)] rounded p-3 overflow-y-auto min-h-0",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs uppercase tracking-wide text-[var(--text-dim)]",children:"Devices"}),r.jsx("button",{className:"text-xs underline opacity-70 hover:opacity-100",onClick:()=>f(s=>s+1),children:"Refresh"})]}),r.jsx($e,{devices:y,inMosaic:h,onToggle:j}),r.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-dim)] leading-relaxed",children:"Click a device to add it to the mosaic. Record captures every device in the mosaic. After Stop, download the video (mp4) — not a proof bundle."})]}),r.jsx("main",{className:"border border-[var(--border)] rounded p-2 overflow-y-auto h-full min-h-0",children:r.jsx(ot,{layout:e.layout,tiles:e.tiles,annotateMode:e.annotateMode,shape:e.shape,color:e.color,overlayAnnotationsByRecording:e.overlayAnnotations,onOverlayAnnotationsChange:(s,d)=>t({type:"SET_OVERLAY_ANNOTATIONS",recordingId:s,annotations:d}),onAnnotation:m,onRemove:w,onDropDevice:j})})]})]}),T.warning&&T.remainingSec!==null&&r.jsx(pt,{remainingSec:T.remainingSec,onContinue:T.reset,onReleaseNow:g})]})}export{Et as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./index-
|
|
1
|
+
import{j as s}from"./index-D9hpVxoi.js";const i=({icon:e,title:m,description:t,action:a})=>s.jsxs("div",{className:"empty-state",children:[e&&s.jsx("div",{className:"empty-state-icon",children:e}),s.jsx("div",{className:"empty-state-title",children:m}),t&&s.jsx("div",{className:"empty-state-desc",children:t}),a&&s.jsx("div",{className:"empty-state-action",children:a})]});export{i as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./index-
|
|
1
|
+
import{j as s}from"./index-D9hpVxoi.js";const r=({label:e,description:l,children:c,error:a,htmlFor:d})=>s.jsxs("div",{className:"fg",children:[s.jsx("label",{className:"fg-label",htmlFor:d,children:e}),l&&s.jsx("div",{className:"fg-desc",children:l}),s.jsx("div",{className:"fg-control",children:c}),a&&s.jsx("div",{className:"fg-error",children:a})]});export{r as F};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,j as h,h as at,R as xe,i as it,n as st}from"./index-Cz4zmgOc.js";function me(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function De(...e){return t=>{let n=!1;const r=e.map(o=>{const a=me(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():me(e[o],null)}}}}function I(...e){return i.useCallback(De(...e),e)}function Oe(e){const t=ct(e),n=i.forwardRef((r,o)=>{const{children:a,...c}=r,s=i.Children.toArray(a),d=s.find(lt);if(d){const u=d.props.children,f=s.map(v=>v===d?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:v);return h.jsx(t,{...c,ref:o,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return h.jsx(t,{...c,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function ct(e){const t=i.forwardRef((n,r)=>{const{children:o,...a}=n;if(i.isValidElement(o)){const c=ft(o),s=dt(a,o.props);return o.type!==i.Fragment&&(s.ref=r?De(r,c):c),i.cloneElement(o,s)}return i.Children.count(o)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ut=Symbol("radix.slottable");function lt(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ut}function dt(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...s)=>{const d=a(...s);return o(...s),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function ft(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=vt.reduce((e,t)=>{const n=Oe(`Primitive.${t}`),r=i.forwardRef((o,a)=>{const{asChild:c,...s}=o,d=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(d,{...s,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function mt(e,t){e&&at.flushSync(()=>e.dispatchEvent(t))}function ht(e,t){const n=i.createContext(t),r=a=>{const{children:c,...s}=a,d=i.useMemo(()=>s,Object.values(s));return h.jsx(n.Provider,{value:d,children:c})};r.displayName=e+"Provider";function o(a){const c=i.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,o]}function pt(e,t=[]){let n=[];function r(a,c){const s=i.createContext(c),d=n.length;n=[...n,c];const u=v=>{var y;const{scope:m,children:g,...w}=v,l=((y=m==null?void 0:m[e])==null?void 0:y[d])||s,p=i.useMemo(()=>w,Object.values(w));return h.jsx(l.Provider,{value:p,children:g})};u.displayName=a+"Provider";function f(v,m){var l;const g=((l=m==null?void 0:m[e])==null?void 0:l[d])||s,w=i.useContext(g);if(w)return w;if(c!==void 0)return c;throw new Error(`\`${v}\` must be used within \`${a}\``)}return[u,f]}const o=()=>{const a=n.map(c=>i.createContext(c));return function(s){const d=(s==null?void 0:s[e])||a;return i.useMemo(()=>({[`__scope${e}`]:{...s,[e]:d}}),[s,d])}};return o.scopeName=e,[r,gt(o,...t)]}function gt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const c=r.reduce((s,{useScope:d,scopeName:u})=>{const v=d(a)[`__scope${u}`];return{...s,...v}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}function B(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var U=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{};function A(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function yt(e,t=globalThis==null?void 0:globalThis.document){const n=B(e);i.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Et="DismissableLayer",ce="dismissableLayer.update",bt="dismissableLayer.pointerDownOutside",Ct="dismissableLayer.focusOutside",he,Ae=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Te=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:c,onDismiss:s,...d}=e,u=i.useContext(Ae),[f,v]=i.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=i.useState({}),w=I(t,E=>v(E)),l=Array.from(u.layers),[p]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=l.indexOf(p),b=f?l.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,R=Rt(E=>{const T=E.target,L=[...u.branches].some(W=>W.contains(T));!S||L||(o==null||o(E),c==null||c(E),E.defaultPrevented||s==null||s())},m),N=Nt(E=>{const T=E.target;[...u.branches].some(W=>W.contains(T))||(a==null||a(E),c==null||c(E),E.defaultPrevented||s==null||s())},m);return yt(E=>{b===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},m),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(he=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),pe(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=he)}},[f,m,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),pe())},[f,u]),i.useEffect(()=>{const E=()=>g({});return document.addEventListener(ce,E),()=>document.removeEventListener(ce,E)},[]),h.jsx(D.div,{...d,ref:w,style:{pointerEvents:C?S?"auto":"none":void 0,...e.style},onFocusCapture:A(e.onFocusCapture,N.onFocusCapture),onBlurCapture:A(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:A(e.onPointerDownCapture,R.onPointerDownCapture)})});Te.displayName=Et;var St="DismissableLayerBranch",wt=i.forwardRef((e,t)=>{const n=i.useContext(Ae),r=i.useRef(null),o=I(t,r);return i.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),h.jsx(D.div,{...e,ref:o})});wt.displayName=St;function Rt(e,t=globalThis==null?void 0:globalThis.document){const n=B(e),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let d=function(){Me(bt,n,u,{discrete:!0})};const u={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);r.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Nt(e,t=globalThis==null?void 0:globalThis.document){const n=B(e),r=i.useRef(!1);return i.useEffect(()=>{const o=a=>{a.target&&!r.current&&Me(Ct,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pe(){const e=new CustomEvent(ce);document.dispatchEvent(e)}function Me(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?mt(o,a):o.dispatchEvent(a)}var Pt=xe[" useId ".trim().toString()]||(()=>{}),xt=0;function ee(e){const[t,n]=i.useState(Pt());return U(()=>{n(r=>r??String(xt++))},[e]),e||(t?`radix-${t}`:"")}var Dt=xe[" useInsertionEffect ".trim().toString()]||U;function Ot({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,c]=At({defaultProp:t,onChange:n}),s=e!==void 0,d=s?e:o;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const v=f.current;v!==s&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=s},[s,r])}const u=i.useCallback(f=>{var v;if(s){const m=Tt(f)?f(e):f;m!==e&&((v=c.current)==null||v.call(c,m))}else a(f)},[s,e,a,c]);return[d,u]}function At({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return Dt(()=>{a.current=t},[t]),i.useEffect(()=>{var c;o.current!==n&&((c=a.current)==null||c.call(a,n),o.current=n)},[n,o]),[n,r,a]}function Tt(e){return typeof e=="function"}var te="focusScope.autoFocusOnMount",ne="focusScope.autoFocusOnUnmount",ge={bubbles:!1,cancelable:!0},Mt="FocusScope",Ie=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...c}=e,[s,d]=i.useState(null),u=B(o),f=B(a),v=i.useRef(null),m=I(t,l=>d(l)),g=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let l=function(C){if(g.paused||!s)return;const S=C.target;s.contains(S)?v.current=S:O(v.current,{select:!0})},p=function(C){if(g.paused||!s)return;const S=C.relatedTarget;S!==null&&(s.contains(S)||O(v.current,{select:!0}))},y=function(C){if(document.activeElement===document.body)for(const R of C)R.removedNodes.length>0&&O(s)};document.addEventListener("focusin",l),document.addEventListener("focusout",p);const b=new MutationObserver(y);return s&&b.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",l),document.removeEventListener("focusout",p),b.disconnect()}}},[r,s,g.paused]),i.useEffect(()=>{if(s){Ee.add(g);const l=document.activeElement;if(!s.contains(l)){const y=new CustomEvent(te,ge);s.addEventListener(te,u),s.dispatchEvent(y),y.defaultPrevented||(It(jt(Le(s)),{select:!0}),document.activeElement===l&&O(s))}return()=>{s.removeEventListener(te,u),setTimeout(()=>{const y=new CustomEvent(ne,ge);s.addEventListener(ne,f),s.dispatchEvent(y),y.defaultPrevented||O(l??document.body,{select:!0}),s.removeEventListener(ne,f),Ee.remove(g)},0)}}},[s,u,f,g]);const w=i.useCallback(l=>{if(!n&&!r||g.paused)return;const p=l.key==="Tab"&&!l.altKey&&!l.ctrlKey&&!l.metaKey,y=document.activeElement;if(p&&y){const b=l.currentTarget,[C,S]=Lt(b);C&&S?!l.shiftKey&&y===S?(l.preventDefault(),n&&O(C,{select:!0})):l.shiftKey&&y===C&&(l.preventDefault(),n&&O(S,{select:!0})):y===b&&l.preventDefault()}},[n,r,g.paused]);return h.jsx(D.div,{tabIndex:-1,...c,ref:m,onKeyDown:w})});Ie.displayName=Mt;function It(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(O(r,{select:t}),document.activeElement!==n)return}function Lt(e){const t=Le(e),n=ye(t,e),r=ye(t.reverse(),e);return[n,r]}function Le(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ye(e,t){for(const n of e)if(!_t(n,{upTo:t}))return n}function _t(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Ft(e){return e instanceof HTMLInputElement&&"select"in e}function O(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ft(e)&&t&&e.select()}}var Ee=kt();function kt(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=be(e,t),e.unshift(t)},remove(t){var n;e=be(e,t),(n=e[0])==null||n.resume()}}}function be(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jt(e){return e.filter(t=>t.tagName!=="A")}var Wt="Portal",_e=i.forwardRef((e,t)=>{var s;const{container:n,...r}=e,[o,a]=i.useState(!1);U(()=>a(!0),[]);const c=n||o&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return c?it.createPortal(h.jsx(D.div,{...r,ref:t}),c):null});_e.displayName=Wt;function Bt(e,t){return i.useReducer((n,r)=>t[n][r]??n,e)}var q=e=>{const{present:t,children:n}=e,r=Ut(t),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),a=I(r.ref,$t(o));return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:a}):null};q.displayName="Presence";function Ut(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),c=e?"mounted":"unmounted",[s,d]=Bt(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=V(r.current);a.current=s==="mounted"?u:"none"},[s]),U(()=>{const u=r.current,f=o.current;if(f!==e){const m=a.current,g=V(u);e?d("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?d("UNMOUNT"):d(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),U(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,v=g=>{const l=V(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&l&&(d("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=g=>{g.target===t&&(a.current=V(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:i.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function V(e){return(e==null?void 0:e.animationName)||"none"}function $t(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var re=0;function Vt(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ce()),document.body.insertAdjacentElement("beforeend",e[1]??Ce()),re++,()=>{re===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),re--}},[])}function Ce(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var x=function(){return x=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},x.apply(this,arguments)};function Fe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Kt(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var H="right-scroll-bar-position",z="width-before-scroll-bar",Gt="with-scroll-bars-hidden",Xt="--removed-body-scroll-bar-size";function oe(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Yt(e,t){var n=i.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ht=typeof window<"u"?i.useLayoutEffect:i.useEffect,Se=new WeakMap;function zt(e,t){var n=Yt(null,function(r){return e.forEach(function(o){return oe(o,r)})});return Ht(function(){var r=Se.get(n);if(r){var o=new Set(r),a=new Set(e),c=n.current;o.forEach(function(s){a.has(s)||oe(s,null)}),a.forEach(function(s){o.has(s)||oe(s,c)})}Se.set(n,e)},[e]),n}function Zt(e){return e}function qt(e,t){t===void 0&&(t=Zt);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var c=t(a,r);return n.push(c),function(){n=n.filter(function(s){return s!==c})}},assignSyncMedium:function(a){for(r=!0;n.length;){var c=n;n=[],c.forEach(a)}n={push:function(s){return a(s)},filter:function(){return n}}},assignMedium:function(a){r=!0;var c=[];if(n.length){var s=n;n=[],s.forEach(a),c=n}var d=function(){var f=c;c=[],f.forEach(a)},u=function(){return Promise.resolve().then(d)};u(),n={push:function(f){c.push(f),u()},filter:function(f){return c=c.filter(f),n}}}};return o}function Qt(e){e===void 0&&(e={});var t=qt(null);return t.options=x({async:!0,ssr:!1},e),t}var ke=function(e){var t=e.sideCar,n=Fe(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,x({},n))};ke.isSideCarExport=!0;function Jt(e,t){return e.useMedium(t),ke}var je=Qt(),ae=function(){},Q=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:ae,onWheelCapture:ae,onTouchMoveCapture:ae}),o=r[0],a=r[1],c=e.forwardProps,s=e.children,d=e.className,u=e.removeScrollBar,f=e.enabled,v=e.shards,m=e.sideCar,g=e.noRelative,w=e.noIsolation,l=e.inert,p=e.allowPinchZoom,y=e.as,b=y===void 0?"div":y,C=e.gapMode,S=Fe(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=m,N=zt([n,t]),E=x(x({},S),o);return i.createElement(i.Fragment,null,f&&i.createElement(R,{sideCar:je,removeScrollBar:u,shards:v,noRelative:g,noIsolation:w,inert:l,setCallbacks:a,allowPinchZoom:!!p,lockRef:n,gapMode:C}),c?i.cloneElement(i.Children.only(s),x(x({},E),{ref:N})):i.createElement(b,x({},E,{className:d,ref:N}),s))});Q.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Q.classNames={fullWidth:z,zeroRight:H};var en=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function tn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=en();return t&&e.setAttribute("nonce",t),e}function nn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function rn(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var on=function(){var e=0,t=null;return{add:function(n){e==0&&(t=tn())&&(nn(t,n),rn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},an=function(){var e=on();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},We=function(){var e=an(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},sn={left:0,top:0,right:0,gap:0},ie=function(e){return parseInt(e||"",10)||0},cn=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[ie(n),ie(r),ie(o)]},un=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return sn;var t=cn(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ln=We(),j="data-scroll-locked",dn=function(e,t,n,r){var o=e.left,a=e.top,c=e.right,s=e.gap;return n===void 0&&(n="margin"),`
|
|
1
|
+
import{r as i,j as h,h as at,R as xe,i as it,n as st}from"./index-D9hpVxoi.js";function me(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function De(...e){return t=>{let n=!1;const r=e.map(o=>{const a=me(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():me(e[o],null)}}}}function I(...e){return i.useCallback(De(...e),e)}function Oe(e){const t=ct(e),n=i.forwardRef((r,o)=>{const{children:a,...c}=r,s=i.Children.toArray(a),d=s.find(lt);if(d){const u=d.props.children,f=s.map(v=>v===d?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:v);return h.jsx(t,{...c,ref:o,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return h.jsx(t,{...c,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function ct(e){const t=i.forwardRef((n,r)=>{const{children:o,...a}=n;if(i.isValidElement(o)){const c=ft(o),s=dt(a,o.props);return o.type!==i.Fragment&&(s.ref=r?De(r,c):c),i.cloneElement(o,s)}return i.Children.count(o)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ut=Symbol("radix.slottable");function lt(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ut}function dt(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...s)=>{const d=a(...s);return o(...s),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function ft(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=vt.reduce((e,t)=>{const n=Oe(`Primitive.${t}`),r=i.forwardRef((o,a)=>{const{asChild:c,...s}=o,d=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(d,{...s,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function mt(e,t){e&&at.flushSync(()=>e.dispatchEvent(t))}function ht(e,t){const n=i.createContext(t),r=a=>{const{children:c,...s}=a,d=i.useMemo(()=>s,Object.values(s));return h.jsx(n.Provider,{value:d,children:c})};r.displayName=e+"Provider";function o(a){const c=i.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,o]}function pt(e,t=[]){let n=[];function r(a,c){const s=i.createContext(c),d=n.length;n=[...n,c];const u=v=>{var y;const{scope:m,children:g,...w}=v,l=((y=m==null?void 0:m[e])==null?void 0:y[d])||s,p=i.useMemo(()=>w,Object.values(w));return h.jsx(l.Provider,{value:p,children:g})};u.displayName=a+"Provider";function f(v,m){var l;const g=((l=m==null?void 0:m[e])==null?void 0:l[d])||s,w=i.useContext(g);if(w)return w;if(c!==void 0)return c;throw new Error(`\`${v}\` must be used within \`${a}\``)}return[u,f]}const o=()=>{const a=n.map(c=>i.createContext(c));return function(s){const d=(s==null?void 0:s[e])||a;return i.useMemo(()=>({[`__scope${e}`]:{...s,[e]:d}}),[s,d])}};return o.scopeName=e,[r,gt(o,...t)]}function gt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const c=r.reduce((s,{useScope:d,scopeName:u})=>{const v=d(a)[`__scope${u}`];return{...s,...v}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}function B(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var U=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{};function A(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function yt(e,t=globalThis==null?void 0:globalThis.document){const n=B(e);i.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Et="DismissableLayer",ce="dismissableLayer.update",bt="dismissableLayer.pointerDownOutside",Ct="dismissableLayer.focusOutside",he,Ae=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Te=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:c,onDismiss:s,...d}=e,u=i.useContext(Ae),[f,v]=i.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=i.useState({}),w=I(t,E=>v(E)),l=Array.from(u.layers),[p]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=l.indexOf(p),b=f?l.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,R=Rt(E=>{const T=E.target,L=[...u.branches].some(W=>W.contains(T));!S||L||(o==null||o(E),c==null||c(E),E.defaultPrevented||s==null||s())},m),N=Nt(E=>{const T=E.target;[...u.branches].some(W=>W.contains(T))||(a==null||a(E),c==null||c(E),E.defaultPrevented||s==null||s())},m);return yt(E=>{b===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},m),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(he=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),pe(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=he)}},[f,m,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),pe())},[f,u]),i.useEffect(()=>{const E=()=>g({});return document.addEventListener(ce,E),()=>document.removeEventListener(ce,E)},[]),h.jsx(D.div,{...d,ref:w,style:{pointerEvents:C?S?"auto":"none":void 0,...e.style},onFocusCapture:A(e.onFocusCapture,N.onFocusCapture),onBlurCapture:A(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:A(e.onPointerDownCapture,R.onPointerDownCapture)})});Te.displayName=Et;var St="DismissableLayerBranch",wt=i.forwardRef((e,t)=>{const n=i.useContext(Ae),r=i.useRef(null),o=I(t,r);return i.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),h.jsx(D.div,{...e,ref:o})});wt.displayName=St;function Rt(e,t=globalThis==null?void 0:globalThis.document){const n=B(e),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let d=function(){Me(bt,n,u,{discrete:!0})};const u={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);r.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Nt(e,t=globalThis==null?void 0:globalThis.document){const n=B(e),r=i.useRef(!1);return i.useEffect(()=>{const o=a=>{a.target&&!r.current&&Me(Ct,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pe(){const e=new CustomEvent(ce);document.dispatchEvent(e)}function Me(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?mt(o,a):o.dispatchEvent(a)}var Pt=xe[" useId ".trim().toString()]||(()=>{}),xt=0;function ee(e){const[t,n]=i.useState(Pt());return U(()=>{n(r=>r??String(xt++))},[e]),e||(t?`radix-${t}`:"")}var Dt=xe[" useInsertionEffect ".trim().toString()]||U;function Ot({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,c]=At({defaultProp:t,onChange:n}),s=e!==void 0,d=s?e:o;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const v=f.current;v!==s&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=s},[s,r])}const u=i.useCallback(f=>{var v;if(s){const m=Tt(f)?f(e):f;m!==e&&((v=c.current)==null||v.call(c,m))}else a(f)},[s,e,a,c]);return[d,u]}function At({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return Dt(()=>{a.current=t},[t]),i.useEffect(()=>{var c;o.current!==n&&((c=a.current)==null||c.call(a,n),o.current=n)},[n,o]),[n,r,a]}function Tt(e){return typeof e=="function"}var te="focusScope.autoFocusOnMount",ne="focusScope.autoFocusOnUnmount",ge={bubbles:!1,cancelable:!0},Mt="FocusScope",Ie=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...c}=e,[s,d]=i.useState(null),u=B(o),f=B(a),v=i.useRef(null),m=I(t,l=>d(l)),g=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let l=function(C){if(g.paused||!s)return;const S=C.target;s.contains(S)?v.current=S:O(v.current,{select:!0})},p=function(C){if(g.paused||!s)return;const S=C.relatedTarget;S!==null&&(s.contains(S)||O(v.current,{select:!0}))},y=function(C){if(document.activeElement===document.body)for(const R of C)R.removedNodes.length>0&&O(s)};document.addEventListener("focusin",l),document.addEventListener("focusout",p);const b=new MutationObserver(y);return s&&b.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",l),document.removeEventListener("focusout",p),b.disconnect()}}},[r,s,g.paused]),i.useEffect(()=>{if(s){Ee.add(g);const l=document.activeElement;if(!s.contains(l)){const y=new CustomEvent(te,ge);s.addEventListener(te,u),s.dispatchEvent(y),y.defaultPrevented||(It(jt(Le(s)),{select:!0}),document.activeElement===l&&O(s))}return()=>{s.removeEventListener(te,u),setTimeout(()=>{const y=new CustomEvent(ne,ge);s.addEventListener(ne,f),s.dispatchEvent(y),y.defaultPrevented||O(l??document.body,{select:!0}),s.removeEventListener(ne,f),Ee.remove(g)},0)}}},[s,u,f,g]);const w=i.useCallback(l=>{if(!n&&!r||g.paused)return;const p=l.key==="Tab"&&!l.altKey&&!l.ctrlKey&&!l.metaKey,y=document.activeElement;if(p&&y){const b=l.currentTarget,[C,S]=Lt(b);C&&S?!l.shiftKey&&y===S?(l.preventDefault(),n&&O(C,{select:!0})):l.shiftKey&&y===C&&(l.preventDefault(),n&&O(S,{select:!0})):y===b&&l.preventDefault()}},[n,r,g.paused]);return h.jsx(D.div,{tabIndex:-1,...c,ref:m,onKeyDown:w})});Ie.displayName=Mt;function It(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(O(r,{select:t}),document.activeElement!==n)return}function Lt(e){const t=Le(e),n=ye(t,e),r=ye(t.reverse(),e);return[n,r]}function Le(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ye(e,t){for(const n of e)if(!_t(n,{upTo:t}))return n}function _t(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Ft(e){return e instanceof HTMLInputElement&&"select"in e}function O(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ft(e)&&t&&e.select()}}var Ee=kt();function kt(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=be(e,t),e.unshift(t)},remove(t){var n;e=be(e,t),(n=e[0])==null||n.resume()}}}function be(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jt(e){return e.filter(t=>t.tagName!=="A")}var Wt="Portal",_e=i.forwardRef((e,t)=>{var s;const{container:n,...r}=e,[o,a]=i.useState(!1);U(()=>a(!0),[]);const c=n||o&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return c?it.createPortal(h.jsx(D.div,{...r,ref:t}),c):null});_e.displayName=Wt;function Bt(e,t){return i.useReducer((n,r)=>t[n][r]??n,e)}var q=e=>{const{present:t,children:n}=e,r=Ut(t),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),a=I(r.ref,$t(o));return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:a}):null};q.displayName="Presence";function Ut(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),c=e?"mounted":"unmounted",[s,d]=Bt(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=V(r.current);a.current=s==="mounted"?u:"none"},[s]),U(()=>{const u=r.current,f=o.current;if(f!==e){const m=a.current,g=V(u);e?d("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?d("UNMOUNT"):d(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),U(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,v=g=>{const l=V(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&l&&(d("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=g=>{g.target===t&&(a.current=V(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:i.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function V(e){return(e==null?void 0:e.animationName)||"none"}function $t(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var re=0;function Vt(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ce()),document.body.insertAdjacentElement("beforeend",e[1]??Ce()),re++,()=>{re===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),re--}},[])}function Ce(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var x=function(){return x=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},x.apply(this,arguments)};function Fe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Kt(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var H="right-scroll-bar-position",z="width-before-scroll-bar",Gt="with-scroll-bars-hidden",Xt="--removed-body-scroll-bar-size";function oe(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Yt(e,t){var n=i.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ht=typeof window<"u"?i.useLayoutEffect:i.useEffect,Se=new WeakMap;function zt(e,t){var n=Yt(null,function(r){return e.forEach(function(o){return oe(o,r)})});return Ht(function(){var r=Se.get(n);if(r){var o=new Set(r),a=new Set(e),c=n.current;o.forEach(function(s){a.has(s)||oe(s,null)}),a.forEach(function(s){o.has(s)||oe(s,c)})}Se.set(n,e)},[e]),n}function Zt(e){return e}function qt(e,t){t===void 0&&(t=Zt);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var c=t(a,r);return n.push(c),function(){n=n.filter(function(s){return s!==c})}},assignSyncMedium:function(a){for(r=!0;n.length;){var c=n;n=[],c.forEach(a)}n={push:function(s){return a(s)},filter:function(){return n}}},assignMedium:function(a){r=!0;var c=[];if(n.length){var s=n;n=[],s.forEach(a),c=n}var d=function(){var f=c;c=[],f.forEach(a)},u=function(){return Promise.resolve().then(d)};u(),n={push:function(f){c.push(f),u()},filter:function(f){return c=c.filter(f),n}}}};return o}function Qt(e){e===void 0&&(e={});var t=qt(null);return t.options=x({async:!0,ssr:!1},e),t}var ke=function(e){var t=e.sideCar,n=Fe(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,x({},n))};ke.isSideCarExport=!0;function Jt(e,t){return e.useMedium(t),ke}var je=Qt(),ae=function(){},Q=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:ae,onWheelCapture:ae,onTouchMoveCapture:ae}),o=r[0],a=r[1],c=e.forwardProps,s=e.children,d=e.className,u=e.removeScrollBar,f=e.enabled,v=e.shards,m=e.sideCar,g=e.noRelative,w=e.noIsolation,l=e.inert,p=e.allowPinchZoom,y=e.as,b=y===void 0?"div":y,C=e.gapMode,S=Fe(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=m,N=zt([n,t]),E=x(x({},S),o);return i.createElement(i.Fragment,null,f&&i.createElement(R,{sideCar:je,removeScrollBar:u,shards:v,noRelative:g,noIsolation:w,inert:l,setCallbacks:a,allowPinchZoom:!!p,lockRef:n,gapMode:C}),c?i.cloneElement(i.Children.only(s),x(x({},E),{ref:N})):i.createElement(b,x({},E,{className:d,ref:N}),s))});Q.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Q.classNames={fullWidth:z,zeroRight:H};var en=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function tn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=en();return t&&e.setAttribute("nonce",t),e}function nn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function rn(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var on=function(){var e=0,t=null;return{add:function(n){e==0&&(t=tn())&&(nn(t,n),rn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},an=function(){var e=on();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},We=function(){var e=an(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},sn={left:0,top:0,right:0,gap:0},ie=function(e){return parseInt(e||"",10)||0},cn=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[ie(n),ie(r),ie(o)]},un=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return sn;var t=cn(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ln=We(),j="data-scroll-locked",dn=function(e,t,n,r){var o=e.left,a=e.top,c=e.right,s=e.gap;return n===void 0&&(n="margin"),`
|
|
2
2
|
.`.concat(Gt,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(s,"px ").concat(r,`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./index-
|
|
1
|
+
import{j as t}from"./index-D9hpVxoi.js";function r({segments:a,value:n,onChange:l,size:s="md"}){return t.jsx("div",{className:`seg seg-${s}`,role:"tablist",children:a.map(e=>t.jsxs("button",{role:"tab","aria-selected":e.value===n,className:`seg-btn${e.value===n?" seg-btn-active":""}`,onClick:()=>l(e.value),type:"button",children:[t.jsx("span",{children:e.label}),typeof e.count=="number"&&t.jsx("span",{className:"seg-count",children:e.count})]},e.value))})}export{r as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as n,j as s,v as h}from"./index-
|
|
1
|
+
import{g as n,j as s,v as h}from"./index-D9hpVxoi.js";import{B as r}from"./button-BD0qp0wO.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 t}from"./index-
|
|
1
|
+
import{j as t}from"./index-D9hpVxoi.js";const x=({className:s,...a})=>t.jsx("table",{className:`tbl${s?" "+s:""}`,...a}),j=s=>t.jsx("thead",{...s}),c=s=>t.jsx("tbody",{...s}),e=s=>t.jsx("tr",{...s}),n=s=>t.jsx("th",{...s}),T=s=>t.jsx("td",{...s});export{x as T,j as a,e as b,n as c,c as d,T as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as p,m as E,r as d,X as m,j as e,q as N,v as k,y as z}from"./index-
|
|
1
|
+
import{g as p,m as E,r as d,X as m,j as e,q as N,v as k,y as z}from"./index-D9hpVxoi.js";/* empty css */import{S as T,A as I}from"./SettingCard-D5Ljar8F.js";import{P as F}from"./page-header-B4fWZ7PA.js";import{L as S}from"./lock-D8MCyBaM.js";import{C as b}from"./circle-check-BYavFzCx.js";import{A as U}from"./activity-C8kSwV4x.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 +1 @@
|
|
|
1
|
-
import{m as le,r as t,j as e,v as F,K as $,p as oe}from"./index-Cz4zmgOc.js";/* empty css */import{a as L}from"./time-B8FIgwPE.js";import{T as ce,a as de,b as z,c as l,d as me,e as o}from"./Table-CnJZG7Tr.js";import{F as m}from"./FieldGroup-C0fVhQC6.js";import{P as O}from"./page-header-DMEJCtqt.js";import{M as B}from"./Modal-CbQKnS9E.js";import{B as u}from"./button-DqHN9g-N.js";import{I as H}from"./input-CKlF0GHd.js";import{S as M}from"./select-BN67cHdi.js";import{S as pe}from"./shield-alert-C5C7eS3d.js";import{P as g}from"./plus-BxyD47mK.js";import{T as he}from"./trash-2-DSomvDBz.js";import{C as xe}from"./check-ZT6Urlsn.js";import{C as ue}from"./copy-CYRQVVgz.js";import"./utils-CDN07tui.js";const U=["read","sessions","devices","admin"],W={"7d":"7 days","30d":"30 days","90d":"90 days","1y":"1 year",never:"No expiry"},ye={"7d":7,"30d":30,"90d":90,"1y":365};function Y(i){return i==="never"?null:new Date(Date.now()+ye[i]*864e5).toISOString()}function q(i){if(!i)return"Never";const n=Date.now()-new Date(i).getTime();return n<6e4?"Just now":n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}const Ke=()=>{const{toast:i}=le(),[n,v]=t.useState([]),[w,J]=t.useState([]),[X,b]=t.useState(!0),[G,N]=t.useState(!1),[Q,d]=t.useState(!1),[r,y]=t.useState(null),[k,C]=t.useState(null),[S,T]=t.useState(!1),[p,_]=t.useState(""),[j,A]=t.useState({read:!0,sessions:!0,devices:!1,admin:!1}),[I,R]=t.useState(300),[P,E]=t.useState(""),[h,K]=t.useState("30d"),[x,D]=t.useState(!1),V=s=>{var a;return s?((a=w.find(c=>c.id===s))==null?void 0:a.name)||s.slice(0,8):"Shared"},f=async()=>{b(!0);try{const[s,a]=await Promise.all([fetch("/xenon/api/apikeys",{credentials:"include"}),fetch("/xenon/api/teams",{credentials:"include"})]);if(s.status===403){N(!0),v([]);return}if(!s.ok)throw new Error(`HTTP ${s.status}`);v(await s.json()),a.ok&&J(await a.json()),N(!1)}catch(s){i(`Failed to load API keys: ${s.message}`,"error")}finally{b(!1)}};t.useEffect(()=>{f()},[]);const Z=()=>{_(""),A({read:!0,sessions:!0,devices:!1,admin:!1}),R(300),E(""),K("30d")},ee=async()=>{const s=U.filter(a=>j[a]);if(!p.trim()){i("Key name is required","error");return}if(s.length===0){i("Select at least one scope","error");return}D(!0);try{const a=await fetch("/xenon/api/apikeys",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),scopes:s,rateLimit:I,teamId:P||null,expiresAt:Y(h)})});if(!a.ok)throw new Error(`HTTP ${a.status}`);const c=await a.json();d(!1),Z(),y({name:p.trim(),raw:c.key}),await f()}catch(a){i(`Create failed: ${a.message}`,"error")}finally{D(!1)}},se=async s=>{C(s);try{const a=await fetch(`/xenon/api/apikeys/${s}`,{method:"DELETE",credentials:"include"});if(!a.ok)throw new Error(`HTTP ${a.status}`);i("Key revoked","success"),await f()}catch(a){i(`Revoke failed: ${a.message}`,"error")}finally{C(null)}},ae=async s=>{try{await navigator.clipboard.writeText(s),T(!0),setTimeout(()=>T(!1),1500)}catch{i("Copy failed — select the text manually","error")}};if(X)return e.jsxs("div",{className:"settings-loading",children:[e.jsx(F,{className:"animate-spin",size:32}),e.jsx("span",{children:"Loading API keys…"})]});if(G)return e.jsx("div",{className:"settings-container",children:e.jsx(O,{icon:pe,title:"API Keys",subtitle:e.jsxs(e.Fragment,{children:["Your key lacks the ",e.jsx("code",{children:"admin"})," scope. Ask an administrator to issue an admin key so you can manage access for other users."]})})});const te=n.length,ie=n.filter(s=>s.scopes.includes("admin")).length,ne=n.filter(s=>s.lastUsedAt&&Date.now()-new Date(s.lastUsedAt).getTime()<864e5).length;return e.jsxs("div",{className:"settings-container",children:[e.jsx(O,{icon:$,title:"API Keys",subtitle:e.jsxs(e.Fragment,{children:["Issue scoped credentials for humans (dashboard login) and machines (CI, WebDriver clients via ",e.jsx("code",{children:"xenon:accessKey"}),"). Keys are shown only once at creation — copy the value before closing the dialog."]}),action:e.jsxs("button",{type:"button",className:"page-header-action",onClick:()=>d(!0),children:[e.jsx(g,{size:16}),e.jsx("span",{children:"Create new key"})]})}),e.jsxs("div",{className:"settings-content",children:[n.length>0&&e.jsxs("div",{className:"stat-strip",children:[e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:te}),e.jsx("div",{className:"stat-strip__label",children:"Total keys"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value stat-strip__value--accent",children:ie}),e.jsx("div",{className:"stat-strip__label",children:"Admin scope"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:ne}),e.jsx("div",{className:"stat-strip__label",children:"Active in last 24h"})]})]}),n.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx("div",{className:"empty-state__icon",children:e.jsx($,{size:28})}),e.jsx("h3",{className:"empty-state__title",children:"No API keys yet"}),e.jsx("p",{className:"empty-state__copy",children:"Issue your first key to authenticate WebDriver clients or CI pipelines. Keys are shown only once at creation — copy the value before closing the dialog."}),e.jsxs("button",{type:"button",className:"page-header-action empty-state__action",onClick:()=>d(!0),children:[e.jsx(g,{size:16}),e.jsx("span",{children:"Create your first key"})]})]}):e.jsx("div",{className:"data-card",children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsxs(z,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Team"}),e.jsx(l,{children:"Scopes"}),e.jsx(l,{children:"Rate limit"}),e.jsx(l,{children:"Last used"}),e.jsx(l,{children:"Created"}),e.jsx(l,{children:"Expires"}),e.jsx(l,{style:{textAlign:"right"},children:"Actions"})]})}),e.jsx(me,{children:n.map(s=>e.jsxs(z,{children:[e.jsxs(o,{children:[e.jsx("strong",{children:s.name}),e.jsx("div",{className:"row-meta-mono",children:s.id.slice(0,8)})]}),e.jsx(o,{children:e.jsx("span",{className:`pill-chip ${s.teamId?"pill-chip--team":"pill-chip--shared"}`,children:V(s.teamId)})}),e.jsx(o,{children:e.jsx("div",{className:"scope-chips",children:s.scopes.split(",").map(a=>{const c=a.trim(),re=c==="admin";return e.jsx("span",{className:`pill-chip ${re?"pill-chip--admin":"pill-chip--scope"}`,children:c},a)})})}),e.jsxs(o,{className:"row-mono",children:[s.rateLimit,"/min"]}),e.jsx(o,{className:"row-mono",children:q(s.lastUsedAt)}),e.jsx(o,{className:"row-mono",children:q(s.createdAt)}),e.jsx(o,{className:"row-mono",children:s.expiresAt?new Date(s.expiresAt).getTime()<=Date.now()?e.jsx("span",{style:{color:"var(--red)"},children:"expired"}):L(s.expiresAt):"Never"}),e.jsx(o,{style:{textAlign:"right"},children:e.jsxs("button",{type:"button",className:"row-action row-action--danger",disabled:k===s.id,onClick:()=>{window.confirm(`Revoke "${s.name}"? Any client using this key will immediately fail.`)&&se(s.id)},children:[e.jsx(he,{size:13}),k===s.id?"Revoking…":"Revoke"]})})]},s.id))})]})})]}),e.jsx(B,{open:Q,title:"Create API key",width:520,onClose:()=>d(!1),footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",onClick:()=>d(!1),disabled:x,children:"Cancel"}),e.jsxs(u,{variant:"primary",onClick:ee,disabled:x,children:[x?e.jsx(F,{className:"animate-spin",size:18}):e.jsx(g,{size:18}),x?"Creating…":"Create key"]})]}),children:e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx(m,{label:"Name",htmlFor:"apikey-name",children:e.jsx(H,{id:"apikey-name",type:"text",value:p,onChange:s=>_(s.target.value),placeholder:"alice-laptop, ci-main, etc.",className:"w-full",autoFocus:!0})}),e.jsx(m,{label:"Scopes",description:e.jsxs(e.Fragment,{children:[e.jsx("code",{children:"admin"})," grants full access including API-key management."," ",e.jsx("code",{children:"sessions"})," is required for WebDriver ",e.jsx("code",{children:"xenon:accessKey"}),"."]}),children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:U.map(s=>e.jsxs("label",{style:je,children:[e.jsx("input",{type:"checkbox",checked:j[s],onChange:a=>A({...j,[s]:a.target.checked})}),e.jsx("span",{children:s})]},s))})}),e.jsx(m,{label:"Rate limit (requests/min)",htmlFor:"apikey-ratelimit",children:e.jsx(H,{id:"apikey-ratelimit",type:"number",min:10,step:10,value:I,onChange:s=>R(parseInt(s.target.value)||300),className:"w-full"})}),e.jsx(m,{label:"Default team",description:e.jsxs(e.Fragment,{children:["Keys without a team can only reach shared-pool devices. Admins can override at session time via ",e.jsx("code",{children:"xenon:team"}),"."]}),htmlFor:"apikey-team",children:e.jsxs(M,{id:"apikey-team",value:P,onChange:s=>E(s.target.value),className:"w-full",children:[e.jsx("option",{value:"",children:"No team (shared pool only)"}),w.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})}),e.jsx(m,{label:"Expires after",description:h==="never"?"Key never expires. Rotate manually when needed.":`Key will stop working on ${L(Y(h))}.`,htmlFor:"apikey-expiry",children:e.jsx(M,{id:"apikey-expiry",value:h,onChange:s=>K(s.target.value),className:"w-full",children:Object.keys(W).map(s=>e.jsx("option",{value:s,children:W[s]},s))})})]})}),e.jsx(B,{open:!!r,title:r?`Key created: ${r.name}`:"",width:560,onClose:()=>y(null),closeOnOverlayClick:!1,footer:e.jsxs(e.Fragment,{children:[e.jsxs(u,{variant:"primary",onClick:()=>r&&ae(r.raw),disabled:!r,children:[S?e.jsx(xe,{size:18}):e.jsx(ue,{size:18}),S?"Copied":"Copy to clipboard"]}),e.jsx(u,{variant:"secondary",onClick:()=>y(null),children:"I've saved it"})]}),children:r&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{background:"var(--status-busy-bg)",border:"1px solid var(--status-busy-border)",borderRadius:6,padding:12,display:"flex",gap:8,alignItems:"flex-start"},children:[e.jsx(oe,{size:18,style:{flexShrink:0,marginTop:2}}),e.jsxs("div",{children:[e.jsx("strong",{children:"This key will not be shown again."})," Copy it now and store it in your password manager, CI secret store, or client config."]})]}),e.jsx("div",{style:{fontFamily:"monospace",padding:12,background:"rgba(0,0,0,0.3)",borderRadius:6,wordBreak:"break-all",fontSize:"0.9em"},children:r.raw})]})})]})},je={display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"rgba(255,255,255,0.04)",borderRadius:6,cursor:"pointer",fontFamily:"monospace",fontSize:"0.9em"};export{Ke as ApiKeys};
|
|
1
|
+
import{m as le,r as t,j as e,v as F,K as $,p as oe}from"./index-D9hpVxoi.js";/* empty css */import{a as L}from"./time-B8FIgwPE.js";import{T as ce,a as de,b as z,c as l,d as me,e as o}from"./Table-CVoYIFrV.js";import{F as m}from"./FieldGroup-CeFDx8aU.js";import{P as O}from"./page-header-B4fWZ7PA.js";import{M as B}from"./Modal-BeDHd61x.js";import{B as u}from"./button-BD0qp0wO.js";import{I as H}from"./input-DNFrhBhx.js";import{S as M}from"./select-BscNeBV4.js";import{S as pe}from"./shield-alert-BIv3SNUv.js";import{P as g}from"./plus-D6xpkCEm.js";import{T as he}from"./trash-2-B3JVmViZ.js";import{C as xe}from"./check-DfuIwbk5.js";import{C as ue}from"./copy-D2H_l8Za.js";import"./utils-CDN07tui.js";const U=["read","sessions","devices","admin"],W={"7d":"7 days","30d":"30 days","90d":"90 days","1y":"1 year",never:"No expiry"},ye={"7d":7,"30d":30,"90d":90,"1y":365};function Y(i){return i==="never"?null:new Date(Date.now()+ye[i]*864e5).toISOString()}function q(i){if(!i)return"Never";const n=Date.now()-new Date(i).getTime();return n<6e4?"Just now":n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}const Ke=()=>{const{toast:i}=le(),[n,v]=t.useState([]),[w,J]=t.useState([]),[X,b]=t.useState(!0),[G,N]=t.useState(!1),[Q,d]=t.useState(!1),[r,y]=t.useState(null),[k,C]=t.useState(null),[S,T]=t.useState(!1),[p,_]=t.useState(""),[j,A]=t.useState({read:!0,sessions:!0,devices:!1,admin:!1}),[I,R]=t.useState(300),[P,E]=t.useState(""),[h,K]=t.useState("30d"),[x,D]=t.useState(!1),V=s=>{var a;return s?((a=w.find(c=>c.id===s))==null?void 0:a.name)||s.slice(0,8):"Shared"},f=async()=>{b(!0);try{const[s,a]=await Promise.all([fetch("/xenon/api/apikeys",{credentials:"include"}),fetch("/xenon/api/teams",{credentials:"include"})]);if(s.status===403){N(!0),v([]);return}if(!s.ok)throw new Error(`HTTP ${s.status}`);v(await s.json()),a.ok&&J(await a.json()),N(!1)}catch(s){i(`Failed to load API keys: ${s.message}`,"error")}finally{b(!1)}};t.useEffect(()=>{f()},[]);const Z=()=>{_(""),A({read:!0,sessions:!0,devices:!1,admin:!1}),R(300),E(""),K("30d")},ee=async()=>{const s=U.filter(a=>j[a]);if(!p.trim()){i("Key name is required","error");return}if(s.length===0){i("Select at least one scope","error");return}D(!0);try{const a=await fetch("/xenon/api/apikeys",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),scopes:s,rateLimit:I,teamId:P||null,expiresAt:Y(h)})});if(!a.ok)throw new Error(`HTTP ${a.status}`);const c=await a.json();d(!1),Z(),y({name:p.trim(),raw:c.key}),await f()}catch(a){i(`Create failed: ${a.message}`,"error")}finally{D(!1)}},se=async s=>{C(s);try{const a=await fetch(`/xenon/api/apikeys/${s}`,{method:"DELETE",credentials:"include"});if(!a.ok)throw new Error(`HTTP ${a.status}`);i("Key revoked","success"),await f()}catch(a){i(`Revoke failed: ${a.message}`,"error")}finally{C(null)}},ae=async s=>{try{await navigator.clipboard.writeText(s),T(!0),setTimeout(()=>T(!1),1500)}catch{i("Copy failed — select the text manually","error")}};if(X)return e.jsxs("div",{className:"settings-loading",children:[e.jsx(F,{className:"animate-spin",size:32}),e.jsx("span",{children:"Loading API keys…"})]});if(G)return e.jsx("div",{className:"settings-container",children:e.jsx(O,{icon:pe,title:"API Keys",subtitle:e.jsxs(e.Fragment,{children:["Your key lacks the ",e.jsx("code",{children:"admin"})," scope. Ask an administrator to issue an admin key so you can manage access for other users."]})})});const te=n.length,ie=n.filter(s=>s.scopes.includes("admin")).length,ne=n.filter(s=>s.lastUsedAt&&Date.now()-new Date(s.lastUsedAt).getTime()<864e5).length;return e.jsxs("div",{className:"settings-container",children:[e.jsx(O,{icon:$,title:"API Keys",subtitle:e.jsxs(e.Fragment,{children:["Issue scoped credentials for humans (dashboard login) and machines (CI, WebDriver clients via ",e.jsx("code",{children:"xenon:accessKey"}),"). Keys are shown only once at creation — copy the value before closing the dialog."]}),action:e.jsxs("button",{type:"button",className:"page-header-action",onClick:()=>d(!0),children:[e.jsx(g,{size:16}),e.jsx("span",{children:"Create new key"})]})}),e.jsxs("div",{className:"settings-content",children:[n.length>0&&e.jsxs("div",{className:"stat-strip",children:[e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:te}),e.jsx("div",{className:"stat-strip__label",children:"Total keys"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value stat-strip__value--accent",children:ie}),e.jsx("div",{className:"stat-strip__label",children:"Admin scope"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:ne}),e.jsx("div",{className:"stat-strip__label",children:"Active in last 24h"})]})]}),n.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx("div",{className:"empty-state__icon",children:e.jsx($,{size:28})}),e.jsx("h3",{className:"empty-state__title",children:"No API keys yet"}),e.jsx("p",{className:"empty-state__copy",children:"Issue your first key to authenticate WebDriver clients or CI pipelines. Keys are shown only once at creation — copy the value before closing the dialog."}),e.jsxs("button",{type:"button",className:"page-header-action empty-state__action",onClick:()=>d(!0),children:[e.jsx(g,{size:16}),e.jsx("span",{children:"Create your first key"})]})]}):e.jsx("div",{className:"data-card",children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsxs(z,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Team"}),e.jsx(l,{children:"Scopes"}),e.jsx(l,{children:"Rate limit"}),e.jsx(l,{children:"Last used"}),e.jsx(l,{children:"Created"}),e.jsx(l,{children:"Expires"}),e.jsx(l,{style:{textAlign:"right"},children:"Actions"})]})}),e.jsx(me,{children:n.map(s=>e.jsxs(z,{children:[e.jsxs(o,{children:[e.jsx("strong",{children:s.name}),e.jsx("div",{className:"row-meta-mono",children:s.id.slice(0,8)})]}),e.jsx(o,{children:e.jsx("span",{className:`pill-chip ${s.teamId?"pill-chip--team":"pill-chip--shared"}`,children:V(s.teamId)})}),e.jsx(o,{children:e.jsx("div",{className:"scope-chips",children:s.scopes.split(",").map(a=>{const c=a.trim(),re=c==="admin";return e.jsx("span",{className:`pill-chip ${re?"pill-chip--admin":"pill-chip--scope"}`,children:c},a)})})}),e.jsxs(o,{className:"row-mono",children:[s.rateLimit,"/min"]}),e.jsx(o,{className:"row-mono",children:q(s.lastUsedAt)}),e.jsx(o,{className:"row-mono",children:q(s.createdAt)}),e.jsx(o,{className:"row-mono",children:s.expiresAt?new Date(s.expiresAt).getTime()<=Date.now()?e.jsx("span",{style:{color:"var(--red)"},children:"expired"}):L(s.expiresAt):"Never"}),e.jsx(o,{style:{textAlign:"right"},children:e.jsxs("button",{type:"button",className:"row-action row-action--danger",disabled:k===s.id,onClick:()=>{window.confirm(`Revoke "${s.name}"? Any client using this key will immediately fail.`)&&se(s.id)},children:[e.jsx(he,{size:13}),k===s.id?"Revoking…":"Revoke"]})})]},s.id))})]})})]}),e.jsx(B,{open:Q,title:"Create API key",width:520,onClose:()=>d(!1),footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",onClick:()=>d(!1),disabled:x,children:"Cancel"}),e.jsxs(u,{variant:"primary",onClick:ee,disabled:x,children:[x?e.jsx(F,{className:"animate-spin",size:18}):e.jsx(g,{size:18}),x?"Creating…":"Create key"]})]}),children:e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx(m,{label:"Name",htmlFor:"apikey-name",children:e.jsx(H,{id:"apikey-name",type:"text",value:p,onChange:s=>_(s.target.value),placeholder:"alice-laptop, ci-main, etc.",className:"w-full",autoFocus:!0})}),e.jsx(m,{label:"Scopes",description:e.jsxs(e.Fragment,{children:[e.jsx("code",{children:"admin"})," grants full access including API-key management."," ",e.jsx("code",{children:"sessions"})," is required for WebDriver ",e.jsx("code",{children:"xenon:accessKey"}),"."]}),children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:U.map(s=>e.jsxs("label",{style:je,children:[e.jsx("input",{type:"checkbox",checked:j[s],onChange:a=>A({...j,[s]:a.target.checked})}),e.jsx("span",{children:s})]},s))})}),e.jsx(m,{label:"Rate limit (requests/min)",htmlFor:"apikey-ratelimit",children:e.jsx(H,{id:"apikey-ratelimit",type:"number",min:10,step:10,value:I,onChange:s=>R(parseInt(s.target.value)||300),className:"w-full"})}),e.jsx(m,{label:"Default team",description:e.jsxs(e.Fragment,{children:["Keys without a team can only reach shared-pool devices. Admins can override at session time via ",e.jsx("code",{children:"xenon:team"}),"."]}),htmlFor:"apikey-team",children:e.jsxs(M,{id:"apikey-team",value:P,onChange:s=>E(s.target.value),className:"w-full",children:[e.jsx("option",{value:"",children:"No team (shared pool only)"}),w.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})}),e.jsx(m,{label:"Expires after",description:h==="never"?"Key never expires. Rotate manually when needed.":`Key will stop working on ${L(Y(h))}.`,htmlFor:"apikey-expiry",children:e.jsx(M,{id:"apikey-expiry",value:h,onChange:s=>K(s.target.value),className:"w-full",children:Object.keys(W).map(s=>e.jsx("option",{value:s,children:W[s]},s))})})]})}),e.jsx(B,{open:!!r,title:r?`Key created: ${r.name}`:"",width:560,onClose:()=>y(null),closeOnOverlayClick:!1,footer:e.jsxs(e.Fragment,{children:[e.jsxs(u,{variant:"primary",onClick:()=>r&&ae(r.raw),disabled:!r,children:[S?e.jsx(xe,{size:18}):e.jsx(ue,{size:18}),S?"Copied":"Copy to clipboard"]}),e.jsx(u,{variant:"secondary",onClick:()=>y(null),children:"I've saved it"})]}),children:r&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{background:"var(--status-busy-bg)",border:"1px solid var(--status-busy-border)",borderRadius:6,padding:12,display:"flex",gap:8,alignItems:"flex-start"},children:[e.jsx(oe,{size:18,style:{flexShrink:0,marginTop:2}}),e.jsxs("div",{children:[e.jsx("strong",{children:"This key will not be shown again."})," Copy it now and store it in your password manager, CI secret store, or client config."]})]}),e.jsx("div",{style:{fontFamily:"monospace",padding:12,background:"rgba(0,0,0,0.3)",borderRadius:6,wordBreak:"break-all",fontSize:"0.9em"},children:r.raw})]})})]})},je={display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"rgba(255,255,255,0.04)",borderRadius:6,cursor:"pointer",fontFamily:"monospace",fontSize:"0.9em"};export{Ke as ApiKeys};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as x,j as e,m as q,r,X as l,S as z,o as W,v as H,n as X}from"./index-
|
|
1
|
+
import{g as x,j as e,m as q,r,X as l,S as z,o as W,v as H,n as X}from"./index-D9hpVxoi.js";import{f as K}from"./time-B8FIgwPE.js";import{c as Z,B as D}from"./button-BD0qp0wO.js";import{c as J}from"./utils-CDN07tui.js";import{P as Q}from"./page-header-B4fWZ7PA.js";import{S as ee}from"./select-BscNeBV4.js";import{P as se,U as ae,T as te}from"./upload-BLZQPsul.js";import{C as re}from"./check-DfuIwbk5.js";import{C as ie}from"./copy-D2H_l8Za.js";import{Z as ne}from"./zap-o6UsCI-y.js";import{D as ce}from"./download-DXRyWZTc.js";import{T as le}from"./trash-2-B3JVmViZ.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";function i({children:s}){return e.jsxs("div",{className:"min-h-screen w-full grid grid-cols-1 md:grid-cols-2 bg-[var(--bg)] text-[var(--text)]",children:[e.jsxs("aside",{className:"relative hidden md:flex flex-col justify-center px-12 overflow-hidden bg-gradient-to-br from-[#0a0e1a] via-[#131a2e] to-[#1a2548]",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(circle at 80% 20%, rgba(99,102,241,0.18), transparent 60%)"}}),e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:"/xenon/logo.svg",alt:"Xenon Logo",className:"h-8 w-auto object-contain mb-4"}),e.jsx("div",{className:"text-3xl font-semibold tracking-tight mb-2",children:"Xenon"}),e.jsx("p",{className:"text-sm text-[var(--text-dim)] max-w-sm leading-relaxed mb-8",children:"Enterprise-grade Appium device lab orchestration with AI self-healing, live device streaming, and proof-pack recording."}),e.jsx("div",{className:"flex flex-wrap gap-2 max-w-sm",children:["Self-healing tests","Live device streaming","Hub-node scaling","Proof-pack recording"].map(a=>e.jsx("span",{className:"text-[11px] px-2.5 py-1 rounded-full bg-white/5 border border-white/10 text-[var(--text-muted)]",children:a},a))})]})]}),e.jsx("main",{className:"flex items-center justify-center",children:e.jsx("div",{className:"w-full max-w-sm px-6",children:s})})]})}export{i as A};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as z,j as e,o as E,k as y,T as G,S as H,r as v,u as X,c as Q,m as V,M as q,X as J}from"./index-
|
|
1
|
+
import{g as z,j as e,o as E,k as y,T as G,S as H,r as v,u as X,c as Q,m as V,M as q,X as J}from"./index-D9hpVxoi.js";import{f as R,s as $,b as A,a as T,d as K,p as W,o as Y,S as Z,h as ee,c as te,e as D,u as se}from"./status-pill-outline-CkiBdQ0F.js";import{A as ae}from"./activity-C8kSwV4x.js";import{C as re}from"./circle-x-D0e-HLLy.js";import{C as ne}from"./circle-check-BYavFzCx.js";import{I as P}from"./input-DNFrhBhx.js";import{S as le}from"./select-BscNeBV4.js";import{C as ie}from"./clock-Y9Spj4eZ.js";import{B as I}from"./button-BD0qp0wO.js";import{D as oe}from"./download-DXRyWZTc.js";import{C as ce}from"./chevron-right-Bnhlh4jC.js";import{T as de,M as xe}from"./tablet-D8v87f0D.js";import{P as ue}from"./page-header-B4fWZ7PA.js";import"./useSocket-DsmPkV7G.js";import"./time-B8FIgwPE.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{r as x,j as z}from"./index-
|
|
1
|
+
import{r as x,j as z}from"./index-D9hpVxoi.js";import{a as j,c as g}from"./utils-CDN07tui.js";const v=a=>typeof a=="boolean"?`${a}`:a===0?"0":a,b=j,k=(a,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return b(a,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:o,defaultVariants:l}=e,y=Object.keys(o).map(n=>{const s=t==null?void 0:t[n],d=l==null?void 0:l[n];if(s===null)return null;const i=v(s)||v(d);return o[n][i]}),c=t&&Object.entries(t).reduce((n,s)=>{let[d,i]=s;return i===void 0||(n[d]=i),n},{}),f=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((n,s)=>{let{class:d,className:i,...V}=s;return Object.entries(V).every(N=>{let[m,u]=N;return Array.isArray(u)?u.includes({...l,...c}[m]):{...l,...c}[m]===u})?[...n,d,i]:n},[]);return b(a,y,f,t==null?void 0:t.class,t==null?void 0:t.className)},C=k("btn-base",{variants:{variant:{default:"btn-primary",primary:"btn-primary",secondary:"btn-secondary",outline:"btn-secondary",ghost:"btn-ghost",link:"btn-link",destructive:"btn-danger",danger:"btn-danger"},size:{default:"btn-size-md",md:"btn-size-md",sm:"btn-size-sm",lg:"btn-size-lg",icon:"btn-size-icon"}},defaultVariants:{variant:"primary",size:"md"}}),O=x.forwardRef(({className:a,variant:e,size:t,...r},o)=>z.jsx("button",{className:g(C({variant:e,size:t,className:a})),ref:o,...r}));O.displayName="Button";export{O as B,k as c};
|