@xenon-device-management/xenon 2.6.1 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/lib/package.json +1 -1
  2. package/lib/public/assets/{AnnotationOverlay-BR2MSqZq.js → AnnotationOverlay-U9aJANVi.js} +1 -1
  3. package/lib/public/assets/{ApiKeyGate-B-kYDgwU.js → ApiKeyGate-6265m84B.js} +1 -1
  4. package/lib/public/assets/{BugReportButton-B5AX_Hq6.js → BugReportButton-CGeVEuQ-.js} +1 -1
  5. package/lib/public/assets/{DeviceMosaicView-wL6hPElQ.js → DeviceMosaicView-C_3HwhVZ.js} +1 -1
  6. package/lib/public/assets/{EmptyState-DMkfqTdS.js → EmptyState-D5BTZSIa.js} +1 -1
  7. package/lib/public/assets/{FieldGroup-C48fEQ2R.js → FieldGroup-CDBhSDsT.js} +1 -1
  8. package/lib/public/assets/{FilterMenu-BEQWiqgS.js → FilterMenu-7JEhwNEM.js} +1 -1
  9. package/lib/public/assets/{Menu-ChzfRWa3.js → Menu-DWl5uJ9E.js} +1 -1
  10. package/lib/public/assets/{Modal-D4LAJuLk.js → Modal-BZEfRpq8.js} +1 -1
  11. package/lib/public/assets/{RecordingPage-CErhVVhI.js → RecordingPage-B_EK9yKX.js} +1 -1
  12. package/lib/public/assets/{RecordingsPage-CiwOgvEu.js → RecordingsPage-CptMr6IM.js} +1 -1
  13. package/lib/public/assets/{SegmentedControl-CEGbL4Og.js → SegmentedControl-D7BBuUDP.js} +1 -1
  14. package/lib/public/assets/{SettingCard-Ixm55gZS.js → SettingCard-W3QrpCyh.js} +1 -1
  15. package/lib/public/assets/{Table-C7osPLTJ.js → Table-BthtE6KF.js} +1 -1
  16. package/lib/public/assets/{activity-B6i2UUaG.js → activity-CdoCkXe1.js} +1 -1
  17. package/lib/public/assets/{ai-settings-D7gK7P2L.js → ai-settings-CkGIJyKN.js} +1 -1
  18. package/lib/public/assets/{api-keys-DrBdSosA.js → api-keys-2lHmq44B.js} +1 -1
  19. package/lib/public/assets/{apps-BWEUuoIK.js → apps-BCHpRvo_.js} +1 -1
  20. package/lib/public/assets/{arrow-left-DcJsqErm.js → arrow-left-CpaUvzcV.js} +1 -1
  21. package/lib/public/assets/{arrow-right-_g7OIFHi.js → arrow-right-TCqk2-9N.js} +1 -1
  22. package/lib/public/assets/{arrow-up-right-Bn6qC1nH.js → arrow-up-right-B6JBqR-t.js} +1 -1
  23. package/lib/public/assets/{auth-shell-DslyrtGF.js → auth-shell-BSyFjCa8.js} +2 -2
  24. package/lib/public/assets/builds-page-D0RnbdGV.js +11 -0
  25. package/lib/public/assets/{button-C8WXV74W.js → button-CB1ehl9z.js} +1 -1
  26. package/lib/public/assets/{calendar-D6zwX5yt.js → calendar-DXZ0-sa6.js} +1 -1
  27. package/lib/public/assets/{check-DHCAmQzm.js → check-Bq0QWhtG.js} +1 -1
  28. package/lib/public/assets/{chevron-left-DAjBpmZL.js → chevron-left-BMI8J11V.js} +1 -1
  29. package/lib/public/assets/{chevron-right-CXeI6N1r.js → chevron-right-tbezHlhW.js} +1 -1
  30. package/lib/public/assets/{circle-check-CXNkbyeD.js → circle-check-BgkLodxU.js} +1 -1
  31. package/lib/public/assets/{circle-x-5wGBLvP4.js → circle-x-DuFD0enL.js} +1 -1
  32. package/lib/public/assets/{clock-B6D_VfTn.js → clock-C7AhkXMm.js} +1 -1
  33. package/lib/public/assets/{copy-B01YbVjr.js → copy-CiNhxJMO.js} +1 -1
  34. package/lib/public/assets/{device-explorer-BJYJi3-I.js → device-explorer-BFWU04bT.js} +1 -1
  35. package/lib/public/assets/{download-CYOnymUH.js → download-Di_q2qj5.js} +1 -1
  36. package/lib/public/assets/{forgot-password-ChGJEfSH.js → forgot-password-gtciaIez.js} +1 -1
  37. package/lib/public/assets/{funnel-Bsf-_RST.js → funnel-BY1R0ydM.js} +1 -1
  38. package/lib/public/assets/{index-rullcuA-.js → index-B1iJx0w1.js} +2 -2
  39. package/lib/public/assets/{index-DC1NFStQ.js → index-Bgx65Mb_.js} +1 -1
  40. package/lib/public/assets/{input-DAFtgyoC.js → input-B83lhHJ_.js} +1 -1
  41. package/lib/public/assets/{keycodes-0UtDeccx.js → keycodes-BjiWgQik.js} +1 -1
  42. package/lib/public/assets/{layers-C9QEszDA.js → layers-CxMkF86z.js} +1 -1
  43. package/lib/public/assets/{list-checks-BDs_WJqC.js → list-checks-2GnUUcTR.js} +1 -1
  44. package/lib/public/assets/{lock-Wfb-mfRt.js → lock-BRKQ_6ix.js} +1 -1
  45. package/lib/public/assets/{login-7ukAAXMQ.js → login-Chmwsz_d.js} +1 -1
  46. package/lib/public/assets/{maintenance-settings-HJVTzD1e.js → maintenance-settings-DEb0LrBA.js} +1 -1
  47. package/lib/public/assets/{monitor-CdNmIwjG.js → monitor-ClL-76V7.js} +1 -1
  48. package/lib/public/assets/{mouse-pointer-2-qVSJPuaG.js → mouse-pointer-2-C815rsZl.js} +1 -1
  49. package/lib/public/assets/{network-BdrZxJP7.js → network-CBd_S-GU.js} +1 -1
  50. package/lib/public/assets/{overview-C0JVQ10q.js → overview-B0paJ7DP.js} +1 -1
  51. package/lib/public/assets/{page-header-BNgF7qLO.js → page-header-D9FkEgQm.js} +1 -1
  52. package/lib/public/assets/{plus-bjDKJLSM.js → plus-DF-cFokG.js} +1 -1
  53. package/lib/public/assets/{profile-page-Dgqh9iFO.js → profile-page-BrdnJBRA.js} +1 -1
  54. package/lib/public/assets/{reset-password-BKkG0r19.js → reset-password-DJFBWJnT.js} +1 -1
  55. package/lib/public/assets/{runbook-page-CMhZZJVm.js → runbook-page-D5SIpqrf.js} +1 -1
  56. package/lib/public/assets/{select-C563Otbb.js → select-Wc_B9XUe.js} +1 -1
  57. package/lib/public/assets/{selector-detail-page-DhnD3eaZ.js → selector-detail-page-q7-lRo_l.js} +1 -1
  58. package/lib/public/assets/{selector-health-B7Oe-x9R.js → selector-health-Qe-NusTk.js} +1 -1
  59. package/lib/public/assets/{selector-health-page-BzP4CuGG.js → selector-health-page-Dw2WUlDJ.js} +1 -1
  60. package/lib/public/assets/{session-detail-page-DYccmo6I.js → session-detail-page-bZpHxz1l.js} +3 -3
  61. package/lib/public/assets/{settings-BtiYwsCN.js → settings-DA_CIMVB.js} +1 -1
  62. package/lib/public/assets/stat-tile-CxsAGcDU.js +8 -0
  63. package/lib/public/assets/{tablet-Dt9_zCsE.js → tablet-_Uwg1m0t.js} +1 -1
  64. package/lib/public/assets/{teams-C-TH1VHJ.js → teams-ZTGk8Wky.js} +1 -1
  65. package/lib/public/assets/{trash-2-Cy3hmCGn.js → trash-2-BcWlaBK8.js} +1 -1
  66. package/lib/public/assets/{upload-BzeSfIf5.js → upload-47Lf5U7r.js} +1 -1
  67. package/lib/public/assets/{use-password-reset-mode-CFPUu_Pu.js → use-password-reset-mode-B3cWCSu5.js} +1 -1
  68. package/lib/public/assets/{users-CZwclIT8.js → users-DGHET-4G.js} +1 -1
  69. package/lib/public/assets/{users-ByGYDd3w.js → users-IiOEsNnr.js} +1 -1
  70. package/lib/public/assets/{video-off-soegR0jK.js → video-off-D-jBA0at.js} +1 -1
  71. package/lib/public/assets/{webhook-settings-DHkmj77L.js → webhook-settings-HqV4V6_J.js} +1 -1
  72. package/lib/public/assets/{zap-4ACghMsl.js → zap-iAfVTWG0.js} +1 -1
  73. package/lib/public/index.html +1 -1
  74. package/package.json +1 -1
  75. package/lib/public/assets/builds-page-CEZ9IZ9S.js +0 -11
  76. package/lib/public/assets/stat-tile-BlmNnQFY.js +0 -6
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenon-device-management/xenon",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "Xenon - Intelligent Mobile Infrastructure. A self-healing device orchestration platform for Appium.",
5
5
  "main": "./lib/src/index.js",
6
6
  "exports": {
@@ -1 +1 @@
1
- import{r as w,j as _}from"./index-rullcuA-.js";const F=1600;function j(t,r){const e=F/Math.max(t,r);return{w:Math.round(t*e),h:Math.round(r*e)}}function B(t,r,e,s=document){if(r<=0||e<=0)return null;const{w:o,h:f}=j(r,e),l=s.createElement("canvas");l.width=o,l.height=f;const y=l.getContext("2d");if(!y)return null;y.scale(o/r,f/e),Y(y,r,e,t);try{return l.toDataURL("image/png")}catch{return null}}function U(t,r,e){const s={left:0,top:0,width:t,height:r};if(!e||!(e>0)||t<=0||r<=0)return s;const o=t/r;if(Math.abs(o-e)<1e-6)return s;if(e>o){const l=t/e;return{left:0,top:(r-l)/2,width:t,height:l}}const f=r*e;return{left:(t-f)/2,top:0,width:f,height:r}}const G=(t,r)=>t===r||!!t&&!!r&&t.left===r.left&&t.top===r.top&&t.width===r.width&&t.height===r.height,J=2,q=2e3;function D(t,r,e){if(t.length>=q)return t;const s=t[t.length-1];return s&&Math.hypot(r-s[0],e-s[1])<J?t:[...t,[r,e]]}function $(t,r){const e=(t||"#ff3333").trim();if(/^#[0-9a-fA-F]{6}$/.test(e)){const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),f=parseInt(e.slice(5,7),16);return`rgba(${s},${o},${f},${r})`}return e}function Y(t,r,e,s){var S;const o=s.geometry,f=s.color||"#ff3333",l=Math.max(4,Math.round(Math.min(r,e)*.008));if(t.lineCap="round",t.lineJoin="round",s.shape==="CIRCLE"){const h=(o.x??0)*r,M=(o.y??0)*e,p=Math.max(2,(o.w??0)*r),a=Math.max(2,(o.h??0)*e);t.beginPath(),t.ellipse(h,M,p,a,0,0,Math.PI*2),t.fillStyle=$(f,.22),t.fill(),t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",t.stroke(),t.beginPath(),t.ellipse(h,M,p,a,0,0,Math.PI*2),t.lineWidth=l,t.strokeStyle=f,t.stroke();return}if(s.shape==="ARROW"){const h=(o.x??0)*r,M=(o.y??0)*e,p=h+(o.w??0)*r,a=M+(o.h??0)*e;t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",t.beginPath(),t.moveTo(h,M),t.lineTo(p,a),t.stroke(),t.lineWidth=l,t.strokeStyle=f,t.beginPath(),t.moveTo(h,M),t.lineTo(p,a),t.stroke();const P=Math.atan2(a-M,p-h),k=Math.max(14,l*3);t.fillStyle=f,t.beginPath(),t.moveTo(p,a),t.lineTo(p-k*Math.cos(P-.4),a-k*Math.sin(P-.4)),t.lineTo(p-k*Math.cos(P+.4),a-k*Math.sin(P+.4)),t.closePath(),t.fill();return}if(s.shape==="TEXT"&&s.text){const h=Math.max(16,Math.round(Math.min(r,e)*.035));t.font=`bold ${h}px sans-serif`,t.lineWidth=3,t.strokeStyle="rgba(0,0,0,0.65)",t.strokeText(s.text,(o.x??0)*r,(o.y??0)*e),t.fillStyle=f,t.fillText(s.text,(o.x??0)*r,(o.y??0)*e);return}if(s.shape==="FREEHAND"&&(((S=o.points)==null?void 0:S.length)??0)>=2){const h=o.points,M=()=>{t.beginPath(),t.moveTo(h[0][0]*r,h[0][1]*e);for(let p=1;p<h.length;p++)t.lineTo(h[p][0]*r,h[p][1]*e)};t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",M(),t.stroke(),t.lineWidth=l,t.strokeStyle=f,M(),t.stroke();return}const y=(o.x??0)*r,R=(o.y??0)*e,c=Math.max(2,(o.w??0)*r),g=Math.max(2,(o.h??0)*e);t.fillStyle=$(f,.22),t.fillRect(y,R,c,g),t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",t.strokeRect(y,R,c,g),t.lineWidth=l,t.strokeStyle=f,t.strokeRect(y,R,c,g)}function O(t,r,e,s,o){if(s<=0||o<=0)return null;if(t==="CIRCLE"){const c=Math.hypot(e.curX-e.startX,e.curY-e.startY);return c<=4?null:{shape:t,color:r,geometry:{x:e.startX/s,y:e.startY/o,w:c/s,h:c/o}}}if(t==="ARROW"){const c=e.curX-e.startX,g=e.curY-e.startY;return Math.hypot(c,g)<=6?null:{shape:t,color:r,geometry:{x:e.startX/s,y:e.startY/o,w:c/s,h:g/o}}}if(t==="FREEHAND"){if(e.points.length<2)return null;const c=e.points.map(M=>M[0]),g=e.points.map(M=>M[1]),S=Math.min(...c),h=Math.min(...g);return{shape:t,color:r,geometry:{x:S/s,y:h/o,w:Math.max(.005,(Math.max(...c)-S)/s),h:Math.max(.005,(Math.max(...g)-h)/o),points:e.points.map(([M,p])=>[M/s,p/o])}}}const f=Math.min(e.startX,e.curX)/s,l=Math.min(e.startY,e.curY)/o,y=Math.abs(e.curX-e.startX)/s,R=Math.abs(e.curY-e.startY)/o;return y<=.005||R<=.005?null:{shape:t,color:r,geometry:{x:f,y:l,w:y,h:R}}}function K({enabled:t,shape:r,color:e,onCommit:s,committed:o,onCommittedChange:f,mediaAspect:l}){const y=w.useRef(null),[R,c]=w.useState(null),[g,S]=w.useState([]),[h,M]=w.useState(null),p=o??g,a=w.useRef(p),P=w.useRef(R),k=w.useRef(r),X=w.useRef(e),I=w.useRef(t);a.current=p,P.current=R,k.current=r,X.current=e,I.current=t;const b=w.useCallback(n=>{const i=n(a.current);a.current=i,f?f(i):S(i)},[f]),T=w.useCallback(()=>{const n=y.current;if(!n)return;const i=n.getContext("2d");if(!i)return;i.clearRect(0,0,n.width,n.height);for(const m of a.current)Y(i,n.width,n.height,m);const u=P.current;if(u){const m=O(k.current,X.current,u,n.width,n.height);m&&Y(i,n.width,n.height,m)}},[]);w.useEffect(()=>{const n=y.current;if(!n)return;const i=()=>{const m=Math.max(1,Math.round(n.clientWidth)),d=Math.max(1,Math.round(n.clientHeight));(n.width!==m||n.height!==d)&&(n.width=m,n.height=d),T()};i();const u=new ResizeObserver(i);return u.observe(n),()=>u.disconnect()},[T]),w.useEffect(()=>{T()},[R,p,T]),w.useEffect(()=>{var m;const n=(m=y.current)==null?void 0:m.parentElement;if(!n)return;const i=()=>{const d=l?U(n.clientWidth,n.clientHeight,l):null;M(E=>G(E,d)?E:d)};i();const u=new ResizeObserver(i);return u.observe(n),()=>u.disconnect()},[l]),w.useEffect(()=>{var i;if(t)return;c(null);const n=y.current;if(n&&n.hasPointerCapture)try{for(let u=0;u<8;u++)(i=n.hasPointerCapture)!=null&&i.call(n,u)&&n.releasePointerCapture(u)}catch{}},[t]);const C=n=>{const u=y.current.getBoundingClientRect();return{px:n.clientX-u.left,py:n.clientY-u.top,w:u.width,h:u.height}},z=n=>{const i=P.current;if(!i||!I.current){c(null);return}const u=y.current;if(!u||u.width<=0){c(null);return}const m=C(n),d=O(k.current,X.current,{...i,curX:m.px,curY:m.py,points:D(i.points,m.px,m.py)},m.w,m.h);d&&(b(E=>[...E,d]),s(d,B(d,m.w,m.h))),c(null)},N=n=>{if(!t||n.button!==0)return;n.preventDefault(),n.currentTarget.setPointerCapture(n.pointerId);const i=C(n);c({startX:i.px,startY:i.py,curX:i.px,curY:i.py,points:[[i.px,i.py]]})},L=n=>{if(!P.current)return;const i=C(n);c(u=>u&&{...u,curX:i.px,curY:i.py,points:D(u.points,i.px,i.py)})},A=n=>{try{n.currentTarget.releasePointerCapture(n.pointerId)}catch{}z(n)};return _.jsx("canvas",{ref:y,style:{position:"absolute",...h?{left:`${h.left}px`,top:`${h.top}px`,width:`${h.width}px`,height:`${h.height}px`}:{inset:0,width:"100%",height:"100%"},pointerEvents:t?"auto":"none",cursor:t?"crosshair":"default",zIndex:t?40:25},onPointerDown:N,onPointerMove:L,onPointerUp:A,onPointerCancel:A})}export{K as A,U as f};
1
+ import{r as w,j as _}from"./index-B1iJx0w1.js";const F=1600;function j(t,r){const e=F/Math.max(t,r);return{w:Math.round(t*e),h:Math.round(r*e)}}function B(t,r,e,s=document){if(r<=0||e<=0)return null;const{w:o,h:f}=j(r,e),l=s.createElement("canvas");l.width=o,l.height=f;const y=l.getContext("2d");if(!y)return null;y.scale(o/r,f/e),Y(y,r,e,t);try{return l.toDataURL("image/png")}catch{return null}}function U(t,r,e){const s={left:0,top:0,width:t,height:r};if(!e||!(e>0)||t<=0||r<=0)return s;const o=t/r;if(Math.abs(o-e)<1e-6)return s;if(e>o){const l=t/e;return{left:0,top:(r-l)/2,width:t,height:l}}const f=r*e;return{left:(t-f)/2,top:0,width:f,height:r}}const G=(t,r)=>t===r||!!t&&!!r&&t.left===r.left&&t.top===r.top&&t.width===r.width&&t.height===r.height,J=2,q=2e3;function D(t,r,e){if(t.length>=q)return t;const s=t[t.length-1];return s&&Math.hypot(r-s[0],e-s[1])<J?t:[...t,[r,e]]}function $(t,r){const e=(t||"#ff3333").trim();if(/^#[0-9a-fA-F]{6}$/.test(e)){const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),f=parseInt(e.slice(5,7),16);return`rgba(${s},${o},${f},${r})`}return e}function Y(t,r,e,s){var S;const o=s.geometry,f=s.color||"#ff3333",l=Math.max(4,Math.round(Math.min(r,e)*.008));if(t.lineCap="round",t.lineJoin="round",s.shape==="CIRCLE"){const h=(o.x??0)*r,M=(o.y??0)*e,p=Math.max(2,(o.w??0)*r),a=Math.max(2,(o.h??0)*e);t.beginPath(),t.ellipse(h,M,p,a,0,0,Math.PI*2),t.fillStyle=$(f,.22),t.fill(),t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",t.stroke(),t.beginPath(),t.ellipse(h,M,p,a,0,0,Math.PI*2),t.lineWidth=l,t.strokeStyle=f,t.stroke();return}if(s.shape==="ARROW"){const h=(o.x??0)*r,M=(o.y??0)*e,p=h+(o.w??0)*r,a=M+(o.h??0)*e;t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",t.beginPath(),t.moveTo(h,M),t.lineTo(p,a),t.stroke(),t.lineWidth=l,t.strokeStyle=f,t.beginPath(),t.moveTo(h,M),t.lineTo(p,a),t.stroke();const P=Math.atan2(a-M,p-h),k=Math.max(14,l*3);t.fillStyle=f,t.beginPath(),t.moveTo(p,a),t.lineTo(p-k*Math.cos(P-.4),a-k*Math.sin(P-.4)),t.lineTo(p-k*Math.cos(P+.4),a-k*Math.sin(P+.4)),t.closePath(),t.fill();return}if(s.shape==="TEXT"&&s.text){const h=Math.max(16,Math.round(Math.min(r,e)*.035));t.font=`bold ${h}px sans-serif`,t.lineWidth=3,t.strokeStyle="rgba(0,0,0,0.65)",t.strokeText(s.text,(o.x??0)*r,(o.y??0)*e),t.fillStyle=f,t.fillText(s.text,(o.x??0)*r,(o.y??0)*e);return}if(s.shape==="FREEHAND"&&(((S=o.points)==null?void 0:S.length)??0)>=2){const h=o.points,M=()=>{t.beginPath(),t.moveTo(h[0][0]*r,h[0][1]*e);for(let p=1;p<h.length;p++)t.lineTo(h[p][0]*r,h[p][1]*e)};t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",M(),t.stroke(),t.lineWidth=l,t.strokeStyle=f,M(),t.stroke();return}const y=(o.x??0)*r,R=(o.y??0)*e,c=Math.max(2,(o.w??0)*r),g=Math.max(2,(o.h??0)*e);t.fillStyle=$(f,.22),t.fillRect(y,R,c,g),t.lineWidth=l+2,t.strokeStyle="rgba(0,0,0,0.55)",t.strokeRect(y,R,c,g),t.lineWidth=l,t.strokeStyle=f,t.strokeRect(y,R,c,g)}function O(t,r,e,s,o){if(s<=0||o<=0)return null;if(t==="CIRCLE"){const c=Math.hypot(e.curX-e.startX,e.curY-e.startY);return c<=4?null:{shape:t,color:r,geometry:{x:e.startX/s,y:e.startY/o,w:c/s,h:c/o}}}if(t==="ARROW"){const c=e.curX-e.startX,g=e.curY-e.startY;return Math.hypot(c,g)<=6?null:{shape:t,color:r,geometry:{x:e.startX/s,y:e.startY/o,w:c/s,h:g/o}}}if(t==="FREEHAND"){if(e.points.length<2)return null;const c=e.points.map(M=>M[0]),g=e.points.map(M=>M[1]),S=Math.min(...c),h=Math.min(...g);return{shape:t,color:r,geometry:{x:S/s,y:h/o,w:Math.max(.005,(Math.max(...c)-S)/s),h:Math.max(.005,(Math.max(...g)-h)/o),points:e.points.map(([M,p])=>[M/s,p/o])}}}const f=Math.min(e.startX,e.curX)/s,l=Math.min(e.startY,e.curY)/o,y=Math.abs(e.curX-e.startX)/s,R=Math.abs(e.curY-e.startY)/o;return y<=.005||R<=.005?null:{shape:t,color:r,geometry:{x:f,y:l,w:y,h:R}}}function K({enabled:t,shape:r,color:e,onCommit:s,committed:o,onCommittedChange:f,mediaAspect:l}){const y=w.useRef(null),[R,c]=w.useState(null),[g,S]=w.useState([]),[h,M]=w.useState(null),p=o??g,a=w.useRef(p),P=w.useRef(R),k=w.useRef(r),X=w.useRef(e),I=w.useRef(t);a.current=p,P.current=R,k.current=r,X.current=e,I.current=t;const b=w.useCallback(n=>{const i=n(a.current);a.current=i,f?f(i):S(i)},[f]),T=w.useCallback(()=>{const n=y.current;if(!n)return;const i=n.getContext("2d");if(!i)return;i.clearRect(0,0,n.width,n.height);for(const m of a.current)Y(i,n.width,n.height,m);const u=P.current;if(u){const m=O(k.current,X.current,u,n.width,n.height);m&&Y(i,n.width,n.height,m)}},[]);w.useEffect(()=>{const n=y.current;if(!n)return;const i=()=>{const m=Math.max(1,Math.round(n.clientWidth)),d=Math.max(1,Math.round(n.clientHeight));(n.width!==m||n.height!==d)&&(n.width=m,n.height=d),T()};i();const u=new ResizeObserver(i);return u.observe(n),()=>u.disconnect()},[T]),w.useEffect(()=>{T()},[R,p,T]),w.useEffect(()=>{var m;const n=(m=y.current)==null?void 0:m.parentElement;if(!n)return;const i=()=>{const d=l?U(n.clientWidth,n.clientHeight,l):null;M(E=>G(E,d)?E:d)};i();const u=new ResizeObserver(i);return u.observe(n),()=>u.disconnect()},[l]),w.useEffect(()=>{var i;if(t)return;c(null);const n=y.current;if(n&&n.hasPointerCapture)try{for(let u=0;u<8;u++)(i=n.hasPointerCapture)!=null&&i.call(n,u)&&n.releasePointerCapture(u)}catch{}},[t]);const C=n=>{const u=y.current.getBoundingClientRect();return{px:n.clientX-u.left,py:n.clientY-u.top,w:u.width,h:u.height}},z=n=>{const i=P.current;if(!i||!I.current){c(null);return}const u=y.current;if(!u||u.width<=0){c(null);return}const m=C(n),d=O(k.current,X.current,{...i,curX:m.px,curY:m.py,points:D(i.points,m.px,m.py)},m.w,m.h);d&&(b(E=>[...E,d]),s(d,B(d,m.w,m.h))),c(null)},N=n=>{if(!t||n.button!==0)return;n.preventDefault(),n.currentTarget.setPointerCapture(n.pointerId);const i=C(n);c({startX:i.px,startY:i.py,curX:i.px,curY:i.py,points:[[i.px,i.py]]})},L=n=>{if(!P.current)return;const i=C(n);c(u=>u&&{...u,curX:i.px,curY:i.py,points:D(u.points,i.px,i.py)})},A=n=>{try{n.currentTarget.releasePointerCapture(n.pointerId)}catch{}z(n)};return _.jsx("canvas",{ref:y,style:{position:"absolute",...h?{left:`${h.left}px`,top:`${h.top}px`,width:`${h.width}px`,height:`${h.height}px`}:{inset:0,width:"100%",height:"100%"},pointerEvents:t?"auto":"none",cursor:t?"crosshair":"default",zIndex:t?40:25},onPointerDown:N,onPointerMove:L,onPointerUp:A,onPointerCancel:A})}export{K as A,U as f};
@@ -1 +1 @@
1
- import{r as n,j as e,o as h}from"./index-rullcuA-.js";function y({children:c}){const[i,s]=n.useState(null),[o,l]=n.useState(""),[a,r]=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(),r(null);const d=await fetch("/xenon/api/auth/dashboard-session",{method:"POST",headers:{"Content-Type":"application/json",...h},credentials:"include",body:JSON.stringify({apiKey:o.trim()})});if(d.ok)s(!0);else{const p=await d.json().catch(()=>({}));r(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"})]}),a&&e.jsx("p",{style:{color:"crimson",marginTop:12},children:a})]})}export{y as ApiKeyGate};
1
+ import{r as n,j as e,o as h}from"./index-B1iJx0w1.js";function y({children:c}){const[i,s]=n.useState(null),[o,l]=n.useState(""),[a,r]=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(),r(null);const d=await fetch("/xenon/api/auth/dashboard-session",{method:"POST",headers:{"Content-Type":"application/json",...h},credentials:"include",body:JSON.stringify({apiKey:o.trim()})});if(d.ok)s(!0);else{const p=await d.json().catch(()=>({}));r(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"})]}),a&&e.jsx("p",{style:{color:"crimson",marginTop:12},children:a})]})}export{y as ApiKeyGate};
@@ -1,4 +1,4 @@
1
- import{c as g,j as o,r as f,t as m,f as b}from"./index-rullcuA-.js";/**
1
+ import{c as g,j as o,r as f,t as m,f as b}from"./index-B1iJx0w1.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,2 +1,2 @@
1
- import{r as d,j as r,z as $e,w as Me,X as D,v as Pe,e as Le,Y as Be,T as He,Z as We}from"./index-rullcuA-.js";import{p as Ve}from"./labels-C21SA4JG.js";import{C as ze}from"./circle-check-CXNkbyeD.js";import{C as xe,A as ee,H as Ue,S as be,a as Fe,I as Ge,h as ve}from"./keycodes-0UtDeccx.js";import{f as Ke,A as Ye}from"./AnnotationOverlay-BR2MSqZq.js";import{V as Xe}from"./video-off-soegR0jK.js";import{C as qe}from"./chevron-left-DAjBpmZL.js";import{P as Je}from"./plus-bjDKJLSM.js";import{a as Ze}from"./SegmentedControl-CEGbL4Og.js";import{v as Qe,a as et,c as tt,s as rt,R as nt,b as ot,g as st,d as le,e as at}from"./recordings-BWe1ydXm.js";import{D as oe}from"./download-CYOnymUH.js";import{B as de}from"./button-C8WXV74W.js";import{C as it}from"./clock-B6D_VfTn.js";import{a as ct}from"./page-header-BNgF7qLO.js";import"./utils-CDN07tui.js";function lt(e,t){return e!=="auto"?e:t<=1?"1":t===2?"2x1":t<=4?"2x2":"3x2"}const dt={selected:new Set,layout:"auto",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 ut(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(g=>g.udid!==t.udid||g.screenWidth&&g.screenHeight?g:(o=!0,{...g,screenWidth:t.screenWidth,screenHeight:t.screenHeight,aspect:t.aspect??g.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:!1,startedAt:t.startedAt,overlayAnnotations:{},tiles:o}}case"REHYDRATE_RECORDING":{const o=e.tiles.map(i=>({...i,recordingId:t.tileIds[i.udid]??i.recordingId}));return{...e,groupId:t.groupId,compositeEnabled:t.compositeEnabled,downloadableVideoCount:0,recordingPhase:"recording",recording:!0,annotateMode:!1,startedAt:t.startedAt,overlayAnnotations:t.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 ye=d.createContext(null);function ft(){const e=d.useContext(ye);if(!e)throw new Error("useMosaic must be used inside <MosaicContext.Provider>");return e}function ht(){return d.useReducer(ut,dt)}function pt(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 mt(e){switch(e){case"automation":return"In automation";case"manual_other":return"Manual control by another user";case"manual_self":return"On your grid";case"recording_other_group":return"Recording in another group";default:return e?"Busy":null}}const ue=[{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}],Y={available:"bg-[var(--color-success)]",inUse:"bg-[var(--color-warning)]",offline:"bg-[rgb(var(--rgb-offline))]"},gt=[["available",Y.available],["in use",Y.inUse],["offline",Y.offline]];function fe(e){return Ve(e)}function xt({devices:e,inMosaic:t,onToggle:n,status:o="ready"}){const[i,g]=d.useState(""),[u,N]=d.useState({}),p=d.useMemo(()=>{const l=i.trim().toLowerCase();return l?e.filter(v=>v.udid.toLowerCase().includes(l)||(v.name??"").toLowerCase().includes(l)||(v.altName??"").toLowerCase().includes(l)||(v.platform??"").toLowerCase().includes(l)):e},[e,i]),E=d.useMemo(()=>{const l=ue.map(f=>({id:f.id,label:f.label,rows:[]})),v=f=>l.find((j,y)=>ue[y].match(f))??l[l.length-1];for(const f of p)v((f.platform??"").toLowerCase()).rows.push(f);return l.filter(f=>f.rows.length>0)},[p]);if(e.length===0){const l=o==="loading"?"Loading devices…":o==="error"?"Couldn’t load devices. Retrying…":"No devices online.";return r.jsx("div",{role:"status",className:"text-xs text-[var(--text-dim)] p-3",children:l})}return r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx($e,{"aria-hidden":!0,size:12,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-dim)]"}),r.jsx("input",{type:"text",value:i,placeholder:"Filter devices...",onChange:l=>g(l.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(--color-info)]"})]}),E.map(l=>{const v=u[l.id];return r.jsxs("section",{className:"flex flex-col gap-1",children:[r.jsxs("button",{type:"button","aria-expanded":!v,onClick:()=>N(f=>({...f,[l.id]:!f[l.id]})),className:"flex items-center justify-between w-full text-[11px] text-[var(--text-dim)] hover:text-[rgb(var(--rgb-fg))] px-1 py-0.5",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Me,{"aria-hidden":!0,size:12,className:`transition-transform ${v?"-rotate-90":"rotate-0"}`}),l.label]}),r.jsx("span",{children:l.rows.length})]}),!v&&r.jsx("ul",{className:"flex flex-col gap-1 text-sm",children:l.rows.map(f=>{const j=f.busyReason==="manual_self",y=t.has(f.udid),x=!!f.busy&&!j&&!y||!!f.offline,R=f.offline?"Offline":mt(f.busyReason),O=!x,T=[f.name??f.udid,f.platform&&fe(f.platform)].concat(x&&R?[R]:[]).filter(Boolean).join(", ");return r.jsx("li",{children:r.jsxs("button",{type:"button",disabled:x,draggable:!x,onDragStart:w=>{w.dataTransfer.effectAllowed="copy",w.dataTransfer.setData("application/x-xenon-udid",f.udid),w.dataTransfer.setData("text/plain",f.udid)},onClick:()=>n(f.udid),"aria-label":T,"aria-pressed":y,className:`w-full flex items-center gap-2 px-2 py-1.5 rounded text-left border transition-colors ${x?"opacity-60 cursor-not-allowed border-transparent":y?"border-[rgb(var(--rgb-accent)/0.4)] bg-[rgb(var(--rgb-accent)/0.05)] hover:bg-[rgb(var(--rgb-accent)/0.1)]":"border-transparent hover:border-[var(--border)] hover:bg-[var(--surface-2)]"}`,title:x?`${R} — release first`:y?"Click to remove from the grid":"Click to add to the grid (or drag to a cell)",children:[y?r.jsx(ze,{"aria-hidden":!0,size:14,className:"shrink-0 text-[var(--color-accent-soft)]"}):r.jsx(xe,{"aria-hidden":!0,size:14,className:"shrink-0 text-[var(--text-dim)]"}),r.jsx("span",{"aria-hidden":!0,className:`inline-block w-1.5 h-1.5 rounded-full ${f.offline?Y.offline:O?Y.available:Y.inUse}`}),r.jsx("span",{className:"font-medium flex-1 truncate text-[13px]",children:f.name??f.udid}),f.platform&&r.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded bg-[var(--surface-2)] text-[var(--text-dim)]",children:fe(f.platform)})]})},f.udid)})})]},l.id)}),i&&E.length===0&&r.jsxs("div",{className:"text-xs text-[var(--text-dim)] px-1 py-2",children:['No devices match "',i,'".']}),r.jsx("div",{className:"text-[10px] text-[var(--text-dim)] px-1 pt-2 flex items-center gap-3",children:gt.map(([l,v])=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full inline-block ${v}`}),l]},l))})]})}const bt=[{id:"1",label:"1",icon:r.jsx(yt,{})},{id:"2x1",label:"2×1",icon:r.jsx(wt,{})},{id:"2x2",label:"2×2",icon:r.jsx(Et,{})},{id:"3x2",label:"3×2",icon:r.jsx(Nt,{})},{id:"auto",label:"Auto",icon:r.jsx(Rt,{})}];function vt({value:e,onChange:t}){return r.jsx("div",{role:"tablist",className:"inline-flex border border-[var(--border)] rounded-md overflow-hidden text-xs bg-[rgb(var(--rgb-white)/0.02)]",children:bt.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)] text-[rgb(var(--rgb-fg))]":"text-[var(--text-dim)] hover:bg-[var(--surface-2)] hover:text-[rgb(var(--rgb-fg))]"}`,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 B(e){return r.jsx("rect",{rx:1.2,ry:1.2,fill:"currentColor",...e})}function yt(){return r.jsx("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:B({x:2,y:2,width:10,height:10})})}function wt(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[B({x:1.5,y:3,width:5,height:8}),B({x:7.5,y:3,width:5,height:8})]})}function Et(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[B({x:1.5,y:1.5,width:5,height:5}),B({x:7.5,y:1.5,width:5,height:5}),B({x:1.5,y:7.5,width:5,height:5}),B({x:7.5,y:7.5,width:5,height:5})]})}function Nt(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[B({x:1,y:1.5,width:3.3,height:5}),B({x:5.35,y:1.5,width:3.3,height:5}),B({x:9.7,y:1.5,width:3.3,height:5}),B({x:1,y:7.5,width:3.3,height:5}),B({x:5.35,y:7.5,width:3.3,height:5}),B({x:9.7,y:7.5,width:3.3,height:5})]})}function Rt(){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 St(e,t,n,o,i,g,u=!1){const N=Ke(n.width,n.height,g);let p=(e-n.left-N.left)/N.width,E=(t-n.top-N.top)/N.height;return!(p>=0&&p<=1&&E>=0&&E<=1)&&!u?null:(p=Math.min(1,Math.max(0,p)),E=Math.min(1,Math.max(0,E)),{x:Math.round(p*o),y:Math.round(E*i)})}const jt=5e3;function Tt(e,t){if(e.httpStatus===404)return{ended:!0,startedAt:t};if(e.httpStatus!==200)return{ended:!1,startedAt:t};const n=e.body??{};return n.status!=="running"?{ended:!0,startedAt:t}:t&&n.startedAt&&n.startedAt!==t?{ended:!0,startedAt:t}:{ended:!1,startedAt:t??n.startedAt}}function Ct(e,t,n,o=jt){const i=d.useRef(n);i.current=n,d.useEffect(()=>{if(!t)return;let g=!1,u=!1,N;const p=async()=>{if(!(u||g)){u=!0;try{const l=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/status`),v=l.ok?await l.json().catch(()=>{}):void 0;if(g)return;const f=Tt({httpStatus:l.status,body:v},N);N=f.startedAt,f.ended&&(g=!0,i.current())}catch{}finally{u=!1}}};p();const E=setInterval(p,o);return()=>{g=!0,clearInterval(E)}},[e,t,o])}const At=3,Dt=45e3,he=[2e3,5e3,1e4];function It(e){const t=Math.max(0,Math.min(e,he.length-1));return he[t]}function _t(e){return e<At}function pe(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 kt(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 g=u=>u.toString(16).padStart(2,"0");return`avc1.${g(e[i+1])}${g(e[i+2])}${g(e[i+3])}`}}return"avc1.42e01e"}const Ot=({wsUrl:e,onFatal:t,onReady:n,onFrameSize:o,className:i})=>{const g=d.useRef(null),u=d.useRef(t);u.current=t;const N=d.useRef(n);N.current=n;const p=d.useRef(o);return p.current=o,d.useEffect(()=>{var T;const E=window,l=g.current;if(typeof E.VideoDecoder>"u"||!l){(T=u.current)==null||T.call(u);return}const v=l.getContext("2d");let f=!1,j=!1,y=!0,x=0;const R=new E.VideoDecoder({output:w=>{var C,$;if(f){w.close();return}(l.width!==w.displayWidth||l.height!==w.displayHeight)&&(l.width=w.displayWidth,l.height=w.displayHeight,(C=p.current)==null||C.call(p,w.displayWidth,w.displayHeight)),v==null||v.drawImage(w,0,0),w.close(),y&&(y=!1,($=N.current)==null||$.call(N))},error:()=>{var w;return(w=u.current)==null?void 0:w.call(u)}}),O=new WebSocket(e);return O.binaryType="arraybuffer",O.onerror=()=>{var w;return(w=u.current)==null?void 0:w.call(u)},O.onclose=()=>{var w;f||(w=u.current)==null||w.call(u)},O.onmessage=w=>{var m;const C=w.data,$=new DataView(C).getUint8(0),V=new Uint8Array(C,1);if($===0){if(j)return;try{R.configure({codec:kt(V),optimizeForLatency:!0}),j=!0}catch{(m=u.current)==null||m.call(u)}return}if(!(!j||R.state!=="configured"))try{R.decode(new E.EncodedVideoChunk({type:$===1?"key":"delta",timestamp:x,data:V})),x+=11111}catch{}},()=>{f=!0;try{O.close()}catch{}try{R.state!=="closed"&&R.close()}catch{}}},[e]),r.jsx("canvas",{ref:g,className:i,style:{width:"100%",height:"100%",objectFit:"contain",display:"block"}})};function $t(e,t,n){return(e==="android"||e==="androidtv"||e==="android-tv")&&t==="h264"&&n?"h264":"mjpeg"}const Mt=10,Pt=500;function Lt({udid:e,name:t,recordingId:n,annotateMode:o,shape:i,color:g,aspect:u="9 / 16",screenWidth:N,screenHeight:p,platform:E,onAnnotation:l,overlayAnnotations:v,onOverlayAnnotationsChange:f,onRemove:j}){const[y,x]=d.useState("connecting"),[R,O]=d.useState(),T=d.useCallback((a,h)=>{if(!(a>0)||!(h>0))return;const _=a/h;O(k=>k!==void 0&&Math.abs(k-_)<.001?k:_)},[]),[w,C]=d.useState(0),[$,V]=d.useState(null),m=d.useRef(0),s=d.useRef(null),[c,b]=d.useState(""),[S,H]=d.useState([]),[U,M]=d.useState(!1),z=d.useRef(null),W=d.useRef(null),P=E==="android"||E==="androidtv"||E==="android-tv",A=E==="ios"||E==="tvos";d.useEffect(()=>{let a=!1;if(n){V(null),x("connecting"),C(Date.now()),D.startStream(e).catch(()=>{});return}const h=typeof window.VideoDecoder<"u";return(async()=>{try{const _=encodeURIComponent(e),k=await fetch(`/xenon/api/control/${_}/stream/status`);if(!k.ok)return;const I=await k.json();if($t(E||"",I==null?void 0:I.type,h)!=="h264"||!(I!=null&&I.h264Path))return;const G=await fetch(`/xenon/api/control/${_}/stream/ticket`,{method:"POST"});if(!G.ok)return;const{ticket:L}=await G.json();if(a||!L)return;const Z=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}${I.h264Path}?ticket=${encodeURIComponent(L)}`;V(Z)}catch{}})(),()=>{a=!0}},[e,E,n]);const F=!o&&!!N&&!!p,re=(a,h,_,k=!1)=>St(a,h,_,N,p,R,k),Re=(a,h,_)=>{const k=Date.now()+Math.random(),I=a-_.left,G=h-_.top;H(L=>[...L,{id:k,x:I,y:G}]),window.setTimeout(()=>{H(L=>L.filter(q=>q.id!==k))},500)},Se=a=>{if(!F||y==="unavailable"||a.button!==0)return;const h=a.currentTarget;h.focus(),re(a.clientX,a.clientY,h.getBoundingClientRect())&&(h.setPointerCapture(a.pointerId),W.current={startX:a.clientX,startY:a.clientY,startTime:Date.now(),rect:h.getBoundingClientRect()},Re(a.clientX,a.clientY,W.current.rect))},je=async a=>{var Z,ce;const h=W.current;if(W.current=null,!h||!F)return;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}const _=a.clientX-h.startX,k=a.clientY-h.startY,I=Math.hypot(_,k),G=Date.now()-h.startTime,L=re(h.startX,h.startY,h.rect,!0),q=I<Mt;try{if(q&&G<Pt)await D.tap(e,L.x,L.y);else if(q)await((ce=(Z=D).touchAndHold)==null?void 0:ce.call(Z,e,L.x,L.y,G));else{const Q=re(a.clientX,a.clientY,h.rect,!0);await D.swipe(e,L.x,L.y,Q.x,Q.y)}}catch(Q){console.error(`[DeviceTile] gesture failed for ${e}`,Q)}},Te=()=>{W.current=null},Ce=async a=>{if(!F||y==="unavailable"||a.metaKey||a.ctrlKey||a.altKey)return;const h=a.key;try{if(h.length===1){a.preventDefault(),await D.typeText(e,h);return}if(h==="Backspace"){a.preventDefault(),P?await D.pressKey(e,67):await D.typeText(e,"\b");return}if(h==="Enter"){a.preventDefault(),P?await D.pressKey(e,66):await D.typeText(e,`
1
+ import{r as d,j as r,z as $e,w as Me,X as D,v as Pe,e as Le,Y as Be,T as He,Z as We}from"./index-B1iJx0w1.js";import{p as Ve}from"./labels-C21SA4JG.js";import{C as ze}from"./circle-check-BgkLodxU.js";import{C as xe,A as ee,H as Ue,S as be,a as Fe,I as Ge,h as ve}from"./keycodes-BjiWgQik.js";import{f as Ke,A as Ye}from"./AnnotationOverlay-U9aJANVi.js";import{V as Xe}from"./video-off-D-jBA0at.js";import{C as qe}from"./chevron-left-BMI8J11V.js";import{P as Je}from"./plus-DF-cFokG.js";import{a as Ze}from"./SegmentedControl-D7BBuUDP.js";import{v as Qe,a as et,c as tt,s as rt,R as nt,b as ot,g as st,d as le,e as at}from"./recordings-BWe1ydXm.js";import{D as oe}from"./download-Di_q2qj5.js";import{B as de}from"./button-CB1ehl9z.js";import{C as it}from"./clock-C7AhkXMm.js";import{a as ct}from"./page-header-D9FkEgQm.js";import"./utils-CDN07tui.js";function lt(e,t){return e!=="auto"?e:t<=1?"1":t===2?"2x1":t<=4?"2x2":"3x2"}const dt={selected:new Set,layout:"auto",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 ut(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(g=>g.udid!==t.udid||g.screenWidth&&g.screenHeight?g:(o=!0,{...g,screenWidth:t.screenWidth,screenHeight:t.screenHeight,aspect:t.aspect??g.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:!1,startedAt:t.startedAt,overlayAnnotations:{},tiles:o}}case"REHYDRATE_RECORDING":{const o=e.tiles.map(i=>({...i,recordingId:t.tileIds[i.udid]??i.recordingId}));return{...e,groupId:t.groupId,compositeEnabled:t.compositeEnabled,downloadableVideoCount:0,recordingPhase:"recording",recording:!0,annotateMode:!1,startedAt:t.startedAt,overlayAnnotations:t.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 ye=d.createContext(null);function ft(){const e=d.useContext(ye);if(!e)throw new Error("useMosaic must be used inside <MosaicContext.Provider>");return e}function ht(){return d.useReducer(ut,dt)}function pt(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 mt(e){switch(e){case"automation":return"In automation";case"manual_other":return"Manual control by another user";case"manual_self":return"On your grid";case"recording_other_group":return"Recording in another group";default:return e?"Busy":null}}const ue=[{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}],Y={available:"bg-[var(--color-success)]",inUse:"bg-[var(--color-warning)]",offline:"bg-[rgb(var(--rgb-offline))]"},gt=[["available",Y.available],["in use",Y.inUse],["offline",Y.offline]];function fe(e){return Ve(e)}function xt({devices:e,inMosaic:t,onToggle:n,status:o="ready"}){const[i,g]=d.useState(""),[u,N]=d.useState({}),p=d.useMemo(()=>{const l=i.trim().toLowerCase();return l?e.filter(v=>v.udid.toLowerCase().includes(l)||(v.name??"").toLowerCase().includes(l)||(v.altName??"").toLowerCase().includes(l)||(v.platform??"").toLowerCase().includes(l)):e},[e,i]),E=d.useMemo(()=>{const l=ue.map(f=>({id:f.id,label:f.label,rows:[]})),v=f=>l.find((j,y)=>ue[y].match(f))??l[l.length-1];for(const f of p)v((f.platform??"").toLowerCase()).rows.push(f);return l.filter(f=>f.rows.length>0)},[p]);if(e.length===0){const l=o==="loading"?"Loading devices…":o==="error"?"Couldn’t load devices. Retrying…":"No devices online.";return r.jsx("div",{role:"status",className:"text-xs text-[var(--text-dim)] p-3",children:l})}return r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx($e,{"aria-hidden":!0,size:12,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-dim)]"}),r.jsx("input",{type:"text",value:i,placeholder:"Filter devices...",onChange:l=>g(l.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(--color-info)]"})]}),E.map(l=>{const v=u[l.id];return r.jsxs("section",{className:"flex flex-col gap-1",children:[r.jsxs("button",{type:"button","aria-expanded":!v,onClick:()=>N(f=>({...f,[l.id]:!f[l.id]})),className:"flex items-center justify-between w-full text-[11px] text-[var(--text-dim)] hover:text-[rgb(var(--rgb-fg))] px-1 py-0.5",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Me,{"aria-hidden":!0,size:12,className:`transition-transform ${v?"-rotate-90":"rotate-0"}`}),l.label]}),r.jsx("span",{children:l.rows.length})]}),!v&&r.jsx("ul",{className:"flex flex-col gap-1 text-sm",children:l.rows.map(f=>{const j=f.busyReason==="manual_self",y=t.has(f.udid),x=!!f.busy&&!j&&!y||!!f.offline,R=f.offline?"Offline":mt(f.busyReason),O=!x,T=[f.name??f.udid,f.platform&&fe(f.platform)].concat(x&&R?[R]:[]).filter(Boolean).join(", ");return r.jsx("li",{children:r.jsxs("button",{type:"button",disabled:x,draggable:!x,onDragStart:w=>{w.dataTransfer.effectAllowed="copy",w.dataTransfer.setData("application/x-xenon-udid",f.udid),w.dataTransfer.setData("text/plain",f.udid)},onClick:()=>n(f.udid),"aria-label":T,"aria-pressed":y,className:`w-full flex items-center gap-2 px-2 py-1.5 rounded text-left border transition-colors ${x?"opacity-60 cursor-not-allowed border-transparent":y?"border-[rgb(var(--rgb-accent)/0.4)] bg-[rgb(var(--rgb-accent)/0.05)] hover:bg-[rgb(var(--rgb-accent)/0.1)]":"border-transparent hover:border-[var(--border)] hover:bg-[var(--surface-2)]"}`,title:x?`${R} — release first`:y?"Click to remove from the grid":"Click to add to the grid (or drag to a cell)",children:[y?r.jsx(ze,{"aria-hidden":!0,size:14,className:"shrink-0 text-[var(--color-accent-soft)]"}):r.jsx(xe,{"aria-hidden":!0,size:14,className:"shrink-0 text-[var(--text-dim)]"}),r.jsx("span",{"aria-hidden":!0,className:`inline-block w-1.5 h-1.5 rounded-full ${f.offline?Y.offline:O?Y.available:Y.inUse}`}),r.jsx("span",{className:"font-medium flex-1 truncate text-[13px]",children:f.name??f.udid}),f.platform&&r.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded bg-[var(--surface-2)] text-[var(--text-dim)]",children:fe(f.platform)})]})},f.udid)})})]},l.id)}),i&&E.length===0&&r.jsxs("div",{className:"text-xs text-[var(--text-dim)] px-1 py-2",children:['No devices match "',i,'".']}),r.jsx("div",{className:"text-[10px] text-[var(--text-dim)] px-1 pt-2 flex items-center gap-3",children:gt.map(([l,v])=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full inline-block ${v}`}),l]},l))})]})}const bt=[{id:"1",label:"1",icon:r.jsx(yt,{})},{id:"2x1",label:"2×1",icon:r.jsx(wt,{})},{id:"2x2",label:"2×2",icon:r.jsx(Et,{})},{id:"3x2",label:"3×2",icon:r.jsx(Nt,{})},{id:"auto",label:"Auto",icon:r.jsx(Rt,{})}];function vt({value:e,onChange:t}){return r.jsx("div",{role:"tablist",className:"inline-flex border border-[var(--border)] rounded-md overflow-hidden text-xs bg-[rgb(var(--rgb-white)/0.02)]",children:bt.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)] text-[rgb(var(--rgb-fg))]":"text-[var(--text-dim)] hover:bg-[var(--surface-2)] hover:text-[rgb(var(--rgb-fg))]"}`,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 B(e){return r.jsx("rect",{rx:1.2,ry:1.2,fill:"currentColor",...e})}function yt(){return r.jsx("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:B({x:2,y:2,width:10,height:10})})}function wt(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[B({x:1.5,y:3,width:5,height:8}),B({x:7.5,y:3,width:5,height:8})]})}function Et(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[B({x:1.5,y:1.5,width:5,height:5}),B({x:7.5,y:1.5,width:5,height:5}),B({x:1.5,y:7.5,width:5,height:5}),B({x:7.5,y:7.5,width:5,height:5})]})}function Nt(){return r.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[B({x:1,y:1.5,width:3.3,height:5}),B({x:5.35,y:1.5,width:3.3,height:5}),B({x:9.7,y:1.5,width:3.3,height:5}),B({x:1,y:7.5,width:3.3,height:5}),B({x:5.35,y:7.5,width:3.3,height:5}),B({x:9.7,y:7.5,width:3.3,height:5})]})}function Rt(){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 St(e,t,n,o,i,g,u=!1){const N=Ke(n.width,n.height,g);let p=(e-n.left-N.left)/N.width,E=(t-n.top-N.top)/N.height;return!(p>=0&&p<=1&&E>=0&&E<=1)&&!u?null:(p=Math.min(1,Math.max(0,p)),E=Math.min(1,Math.max(0,E)),{x:Math.round(p*o),y:Math.round(E*i)})}const jt=5e3;function Tt(e,t){if(e.httpStatus===404)return{ended:!0,startedAt:t};if(e.httpStatus!==200)return{ended:!1,startedAt:t};const n=e.body??{};return n.status!=="running"?{ended:!0,startedAt:t}:t&&n.startedAt&&n.startedAt!==t?{ended:!0,startedAt:t}:{ended:!1,startedAt:t??n.startedAt}}function Ct(e,t,n,o=jt){const i=d.useRef(n);i.current=n,d.useEffect(()=>{if(!t)return;let g=!1,u=!1,N;const p=async()=>{if(!(u||g)){u=!0;try{const l=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/status`),v=l.ok?await l.json().catch(()=>{}):void 0;if(g)return;const f=Tt({httpStatus:l.status,body:v},N);N=f.startedAt,f.ended&&(g=!0,i.current())}catch{}finally{u=!1}}};p();const E=setInterval(p,o);return()=>{g=!0,clearInterval(E)}},[e,t,o])}const At=3,Dt=45e3,he=[2e3,5e3,1e4];function It(e){const t=Math.max(0,Math.min(e,he.length-1));return he[t]}function _t(e){return e<At}function pe(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 kt(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 g=u=>u.toString(16).padStart(2,"0");return`avc1.${g(e[i+1])}${g(e[i+2])}${g(e[i+3])}`}}return"avc1.42e01e"}const Ot=({wsUrl:e,onFatal:t,onReady:n,onFrameSize:o,className:i})=>{const g=d.useRef(null),u=d.useRef(t);u.current=t;const N=d.useRef(n);N.current=n;const p=d.useRef(o);return p.current=o,d.useEffect(()=>{var T;const E=window,l=g.current;if(typeof E.VideoDecoder>"u"||!l){(T=u.current)==null||T.call(u);return}const v=l.getContext("2d");let f=!1,j=!1,y=!0,x=0;const R=new E.VideoDecoder({output:w=>{var C,$;if(f){w.close();return}(l.width!==w.displayWidth||l.height!==w.displayHeight)&&(l.width=w.displayWidth,l.height=w.displayHeight,(C=p.current)==null||C.call(p,w.displayWidth,w.displayHeight)),v==null||v.drawImage(w,0,0),w.close(),y&&(y=!1,($=N.current)==null||$.call(N))},error:()=>{var w;return(w=u.current)==null?void 0:w.call(u)}}),O=new WebSocket(e);return O.binaryType="arraybuffer",O.onerror=()=>{var w;return(w=u.current)==null?void 0:w.call(u)},O.onclose=()=>{var w;f||(w=u.current)==null||w.call(u)},O.onmessage=w=>{var m;const C=w.data,$=new DataView(C).getUint8(0),V=new Uint8Array(C,1);if($===0){if(j)return;try{R.configure({codec:kt(V),optimizeForLatency:!0}),j=!0}catch{(m=u.current)==null||m.call(u)}return}if(!(!j||R.state!=="configured"))try{R.decode(new E.EncodedVideoChunk({type:$===1?"key":"delta",timestamp:x,data:V})),x+=11111}catch{}},()=>{f=!0;try{O.close()}catch{}try{R.state!=="closed"&&R.close()}catch{}}},[e]),r.jsx("canvas",{ref:g,className:i,style:{width:"100%",height:"100%",objectFit:"contain",display:"block"}})};function $t(e,t,n){return(e==="android"||e==="androidtv"||e==="android-tv")&&t==="h264"&&n?"h264":"mjpeg"}const Mt=10,Pt=500;function Lt({udid:e,name:t,recordingId:n,annotateMode:o,shape:i,color:g,aspect:u="9 / 16",screenWidth:N,screenHeight:p,platform:E,onAnnotation:l,overlayAnnotations:v,onOverlayAnnotationsChange:f,onRemove:j}){const[y,x]=d.useState("connecting"),[R,O]=d.useState(),T=d.useCallback((a,h)=>{if(!(a>0)||!(h>0))return;const _=a/h;O(k=>k!==void 0&&Math.abs(k-_)<.001?k:_)},[]),[w,C]=d.useState(0),[$,V]=d.useState(null),m=d.useRef(0),s=d.useRef(null),[c,b]=d.useState(""),[S,H]=d.useState([]),[U,M]=d.useState(!1),z=d.useRef(null),W=d.useRef(null),P=E==="android"||E==="androidtv"||E==="android-tv",A=E==="ios"||E==="tvos";d.useEffect(()=>{let a=!1;if(n){V(null),x("connecting"),C(Date.now()),D.startStream(e).catch(()=>{});return}const h=typeof window.VideoDecoder<"u";return(async()=>{try{const _=encodeURIComponent(e),k=await fetch(`/xenon/api/control/${_}/stream/status`);if(!k.ok)return;const I=await k.json();if($t(E||"",I==null?void 0:I.type,h)!=="h264"||!(I!=null&&I.h264Path))return;const G=await fetch(`/xenon/api/control/${_}/stream/ticket`,{method:"POST"});if(!G.ok)return;const{ticket:L}=await G.json();if(a||!L)return;const Z=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}${I.h264Path}?ticket=${encodeURIComponent(L)}`;V(Z)}catch{}})(),()=>{a=!0}},[e,E,n]);const F=!o&&!!N&&!!p,re=(a,h,_,k=!1)=>St(a,h,_,N,p,R,k),Re=(a,h,_)=>{const k=Date.now()+Math.random(),I=a-_.left,G=h-_.top;H(L=>[...L,{id:k,x:I,y:G}]),window.setTimeout(()=>{H(L=>L.filter(q=>q.id!==k))},500)},Se=a=>{if(!F||y==="unavailable"||a.button!==0)return;const h=a.currentTarget;h.focus(),re(a.clientX,a.clientY,h.getBoundingClientRect())&&(h.setPointerCapture(a.pointerId),W.current={startX:a.clientX,startY:a.clientY,startTime:Date.now(),rect:h.getBoundingClientRect()},Re(a.clientX,a.clientY,W.current.rect))},je=async a=>{var Z,ce;const h=W.current;if(W.current=null,!h||!F)return;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}const _=a.clientX-h.startX,k=a.clientY-h.startY,I=Math.hypot(_,k),G=Date.now()-h.startTime,L=re(h.startX,h.startY,h.rect,!0),q=I<Mt;try{if(q&&G<Pt)await D.tap(e,L.x,L.y);else if(q)await((ce=(Z=D).touchAndHold)==null?void 0:ce.call(Z,e,L.x,L.y,G));else{const Q=re(a.clientX,a.clientY,h.rect,!0);await D.swipe(e,L.x,L.y,Q.x,Q.y)}}catch(Q){console.error(`[DeviceTile] gesture failed for ${e}`,Q)}},Te=()=>{W.current=null},Ce=async a=>{if(!F||y==="unavailable"||a.metaKey||a.ctrlKey||a.altKey)return;const h=a.key;try{if(h.length===1){a.preventDefault(),await D.typeText(e,h);return}if(h==="Backspace"){a.preventDefault(),P?await D.pressKey(e,67):await D.typeText(e,"\b");return}if(h==="Enter"){a.preventDefault(),P?await D.pressKey(e,66):await D.typeText(e,`
2
2
  `);return}if(h==="Tab"){a.preventDefault(),await D.typeText(e," ");return}h==="Escape"&&P&&(a.preventDefault(),await D.pressKey(e,ee.BACK))}catch(_){console.error(`[DeviceTile] keystroke "${h}" failed for ${e}`,_)}},Ae=()=>D.pressKey(e,P?ee.HOME:Ge.HOME).catch(a=>console.error(`[DeviceTile] home failed for ${e}`,a)),De=()=>D.pressKey(e,ee.BACK).catch(a=>console.error(`[DeviceTile] back failed for ${e}`,a)),Ie=()=>D.pressKey(e,ee.APP_SWITCH).catch(a=>console.error(`[DeviceTile] app-switch failed for ${e}`,a)),_e=async()=>{try{const a=await D.getScreenshot(e),h=(a==null?void 0:a.screenshot)??(a==null?void 0:a.value)??a;if(!h)return;const _=await fetch(`data:image/png;base64,${h}`).then(G=>G.blob()),k=URL.createObjectURL(_),I=document.createElement("a");I.href=k,I.download=`${t||e}-${Date.now()}.png`,document.body.appendChild(I),I.click(),I.remove(),setTimeout(()=>URL.revokeObjectURL(k),1e3)}catch(a){console.error(`[DeviceTile] screenshot failed for ${e}`,a)}};d.useEffect(()=>{console.log(`[DeviceTile] Rendering ${e} in state: ${y}`)},[e,y]);const ke=`/xenon/api/control/${encodeURIComponent(e)}/stream?t=${w}`,ie=d.useCallback(async()=>{try{const a=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/status`);if(!a.ok)throw new Error(String(a.status));const h=await a.json();b(pe({lastError:h==null?void 0:h.lastError,status:h==null?void 0:h.status}))}catch{b(pe({}))}},[e]),ne=d.useCallback(()=>{const a=m.current;_t(a)?(m.current=a+1,s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{x("connecting"),C(Date.now())},It(a))):(x("unavailable"),ie())},[ie]);d.useEffect(()=>{if(y!=="connecting")return;const a=setTimeout(ne,Dt);return()=>clearTimeout(a)},[y,w,ne]),Ct(e,y==="live"&&!$,()=>{console.warn(`[DeviceTile] MJPEG stream ended for ${e}; reconnecting`),x("connecting"),C(Date.now())}),d.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const Oe=()=>{s.current&&clearTimeout(s.current),m.current=0,b(""),x("connecting"),C(Date.now())},X=!!n,J=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:"theme-dark relative bg-[var(--black)] rounded-lg overflow-hidden border border-[var(--border)] group max-h-full max-w-full self-center",style:{aspectRatio:u,height:"100%"},children:[y==="connecting"&&r.jsxs("div",{role:"status","aria-live":"polite",className:"flex flex-col items-center justify-center gap-1 px-4 text-center bg-[rgb(var(--rgb-well)/0.8)] text-[var(--text-dim)] absolute inset-0 z-20 pointer-events-none",children:[r.jsx("div",{"aria-hidden":!0,className:"w-10 h-10 mb-3 border-4 border-[var(--border)] border-t-[var(--text-dim)] rounded-full animate-spin"}),r.jsx("div",{className:"font-semibold text-[var(--text)]",children:"Starting stream…"}),r.jsx("div",{className:"text-xs text-[var(--text-dim)] truncate max-w-full",children:J}),r.jsx("div",{className:"text-[11px] mt-3 text-[var(--text-dim)] leading-snug",children:A?"iPhone streams can take up to 20 seconds to start.":"Connecting to the device…"})]}),y==="unavailable"&&r.jsx("div",{role:"alert",className:"flex items-center justify-center bg-[var(--black)] text-[var(--text-dim)] absolute inset-0 z-20",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx(Xe,{"aria-hidden":!0,size:36,className:"mx-auto mb-3 text-[var(--text-dim)]"}),r.jsx("div",{className:"font-semibold text-[var(--text)]",children:"Connection failed"}),r.jsx("p",{className:"text-xs mt-2 text-[var(--text-dim)] leading-relaxed max-w-[240px] mx-auto",children:c||"We couldn’t start the live stream for this device."}),r.jsx("button",{type:"button",className:"mt-5 text-sm font-semibold px-4 py-2 rounded bg-[var(--color-accent)] hover:bg-[var(--color-accent-strong)] text-[var(--color-on-accent)] transition-colors",onClick:Oe,children:"Retry"})]})}),$?r.jsx(Ot,{wsUrl:$,className:"absolute inset-0 w-full h-full object-contain bg-black select-none pointer-events-none",onReady:()=>x("live"),onFrameSize:T,onFatal:()=>{console.warn(`[DeviceTile] H.264 fatal for ${e}; falling back to MJPEG`),V(null),x("connecting"),C(Date.now())}}):r.jsx("img",{src:ke,alt:J,className:"absolute inset-0 w-full h-full object-contain bg-black select-none pointer-events-none",draggable:!1,style:{opacity:y==="live"?1:0,transition:"opacity 0.3s ease-in-out"},onLoad:a=>{console.log(`[DeviceTile] Image LOADED for ${e}`),T(a.currentTarget.naturalWidth,a.currentTarget.naturalHeight),m.current=0,s.current&&clearTimeout(s.current),x("live")},onError:a=>{console.error(`[DeviceTile] Image ERROR for ${e}`,a),ne()}},w),F&&y!=="unavailable"&&r.jsx("div",{ref:z,className:`absolute inset-0 z-[35] touch-none outline-none ${U?"ring-2 ring-[rgb(var(--rgb-accent)/0.6)] ring-inset rounded-lg":""}`,tabIndex:0,onPointerDown:Se,onPointerUp:je,onPointerCancel:Te,onKeyDown:Ce,onFocus:()=>M(!0),onBlur:()=>M(!1)}),r.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none overflow-hidden",children:S.map(a=>r.jsx("span",{className:"absolute block w-10 h-10 rounded-full border-2 border-[var(--color-accent-soft)] animate-ping",style:{left:a.x-20,top:a.y-20}},a.id))}),X&&r.jsx(Ye,{enabled:o,shape:i,color:g,committed:v,mediaAspect:R,onCommittedChange:f,onCommit:(a,h)=>l(n,a,h)}),X&&o&&y==="live"&&r.jsx("div",{className:"absolute top-3 left-14 right-3 z-30 flex justify-end pointer-events-none",children:r.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-[var(--color-info)] text-white text-[10px] font-semibold shadow-lg whitespace-nowrap overflow-hidden text-ellipsis",children:"Annotating · Esc to stop"})}),X&&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-[var(--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:[y==="live"&&r.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-[var(--color-success)] text-[var(--color-on-success)] text-[11px] font-semibold shadow-lg w-fit",children:"Live"}),r.jsx("span",{className:"px-2 py-1 rounded bg-[rgb(var(--rgb-well)/0.8)] text-[var(--text)] text-[11px] font-medium backdrop-blur-md border border-[rgb(var(--rgb-fg)/0.1)] shadow-xl truncate max-w-[180px]",children:J})]})]}),r.jsx(Bt,{streamState:y,recording:X,isIOS:A,isAndroid:P,onClose:!X&&j?()=>j(e):void 0,sendHome:Ae,sendBack:De,sendAppSwitch:Ie,captureScreenshot:_e,displayName:J})]})}const te="w-7 h-7 flex items-center justify-center rounded-md hover:bg-[var(--surface-2)] hover:text-[var(--text)] transition-colors";function Bt({streamState:e,recording:t,isIOS:n,isAndroid:o,onClose:i,sendHome:g,sendBack:u,sendAppSwitch:N,captureScreenshot:p,displayName:E}){const l=e==="live";return!i&&!l?null:r.jsxs("div",{className:"self-stretch w-9 flex flex-col items-center justify-between gap-1 py-2 rounded-lg bg-[var(--surface)] border border-[var(--border)] text-[var(--text-dim)]",children:[r.jsx("div",{className:"flex flex-col items-center gap-1",children:i&&r.jsx("button",{type:"button","aria-label":`Remove ${E}`,title:"Remove from the grid",onClick:i,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-[rgb(var(--rgb-red)/0.15)] hover:text-[var(--color-danger)] transition-colors",children:r.jsx(Pe,{"aria-hidden":!0,size:16})})}),l&&r.jsxs("div",{className:"flex flex-col items-center gap-1.5 my-auto",children:[(o||n)&&r.jsx("button",{type:"button","aria-label":"Home",title:"Home",onClick:g,className:te,children:r.jsx(Ue,{"aria-hidden":!0,size:15})}),o&&r.jsx("button",{type:"button","aria-label":"Back",title:"Back",onClick:u,className:te,children:r.jsx(qe,{"aria-hidden":!0,size:16})}),o&&r.jsx("button",{type:"button","aria-label":"Recent apps",title:"Recent apps",onClick:N,className:te,children:r.jsx(be,{"aria-hidden":!0,size:13})})]}),l&&r.jsx("div",{className:"flex flex-col items-center gap-1",children:r.jsx("button",{type:"button","aria-label":"Screenshot",title:"Screenshot",onClick:p,className:te,children:r.jsx(Fe,{"aria-hidden":!0,size:15})})})]})}const Ht={1:"1fr","2x1":"1fr 1fr","2x2":"1fr 1fr","3x2":"1fr 1fr 1fr"},Wt={1:"1fr","2x1":"1fr","2x2":"1fr 1fr","3x2":"1fr 1fr"},Vt={1:1,"2x1":2,"2x2":4,"3x2":6};function zt({layout:e,tiles:t,annotateMode:n,shape:o,color:i,onAnnotation:g,overlayAnnotationsByRecording:u,onOverlayAnnotationsChange:N,onRemove:p,onDropDevice:E}){const l=lt(e,t.length),v=Vt[l];t.length;const f=t.length,j=e==="auto"?Math.max(f,1):v,y=Math.max(0,j-f);return r.jsxs("div",{style:{display:"grid",gap:8,gridTemplateColumns:Ht[l],gridTemplateRows:Wt[l]},className:"h-full",children:[t.map(x=>r.jsx(Lt,{udid:x.udid,name:x.name,mjpegPort:x.mjpegPort,recordingId:x.recordingId,aspect:x.aspect,screenWidth:x.screenWidth,screenHeight:x.screenHeight,platform:x.platform,annotateMode:n,shape:o,color:i,overlayAnnotations:x.recordingId?u==null?void 0:u[x.recordingId]:void 0,onOverlayAnnotationsChange:x.recordingId&&N?R=>N(x.recordingId,R):void 0,onAnnotation:g,onRemove:p},x.udid)),Array.from({length:y},(x,R)=>r.jsx(Ut,{onDropDevice:E},`empty-${R}`))]})}function Ut({onDropDevice:e}){const[t,n]=d.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-[rgb(var(--rgb-accent)/0.6)] bg-[rgb(var(--rgb-accent)/0.05)]":"border-[var(--border)] bg-[rgb(var(--rgb-fg)/0.02)]"} text-[var(--text-dim)] min-h-[120px]`,children:[r.jsx("div",{"aria-hidden":"true",className:`w-8 h-8 rounded-full flex items-center justify-center ${t?"bg-[rgb(var(--rgb-accent)/0.15)] text-[var(--color-accent-soft)]":"bg-[rgb(var(--rgb-fg)/0.05)] text-[rgb(var(--rgb-fg)/0.6)]"}`,children:r.jsx(Je,{size:16})}),r.jsx("div",{className:"text-xs font-medium",children:"Drag a device here"}),r.jsx("div",{className:"text-[10px] opacity-70",children:"or click one in the list"})]})}function Ft(e,t){return t==="starting"?"Starting…":e<=1?"Record":`Record ${e} devices`}const K={"aria-hidden":!0,size:14,className:"shrink-0"};function Gt({selectedUdids:e,onClearMarks:t}){const{state:n,dispatch:o}=ft(),[i,g]=d.useState(()=>Date.now());d.useEffect(()=>{if(n.recordingPhase!=="recording"&&n.recordingPhase!=="stopping")return;g(Date.now());const m=window.setInterval(()=>g(Date.now()),250);return()=>window.clearInterval(m)},[n.recordingPhase]);const u=n.startedAt&&(n.recordingPhase==="recording"||n.recordingPhase==="stopping")?i-n.startedAt:0,N=n.recordingPhase==="starting"||n.recordingPhase==="stopping",p=n.recordingPhase==="idle"&&e.length>0&&!N,E=n.recordingPhase==="recording"||n.recording&&n.tiles.some(m=>!!m.recordingId),l=E&&!N,v=l,f=v&&n.annotateMode,j=!!n.groupId&&n.recordingPhase==="idle",y=e.length>1||n.downloadableVideoCount>1,x=j&&n.compositeEnabled,R=j&&!n.compositeEnabled&&(n.downloadableVideoCount===1||n.downloadableVideoCount===0&&e.length<=1),O=async()=>{var m;if(p){o({type:"SET_RECORDING_PHASE",phase:"starting"}),o({type:"SET_BANNER",banner:null});try{const s=await rt(e);if(!((m=s.recordings)!=null&&m.length)){o({type:"SET_RECORDING_PHASE",phase:"idle"}),o({type:"SET_BANNER",banner:{tone:"error",message:"Recording did not start. Check that live preview is working, then try again."}});return}const c={};for(const S of s.recordings)c[S.udid]=S.id;const b=e.length-s.recordings.length;o({type:"START_RECORDING",groupId:s.groupId,startedAt:Date.now(),tileIds:c,compositeEnabled:s.compositeEnabled===!0}),b>0?o({type:"SET_BANNER",banner:{tone:"error",message:`Recording started on ${s.recordings.length} of ${e.length} devices (${b} failed).`}}):o({type:"SET_BANNER",banner:null})}catch(s){if(o({type:"SET_RECORDING_PHASE",phase:"idle"}),s instanceof nt)if(s.body.error==="device_busy"){const c=(s.body.busyDevices??[]).map(b=>`${b.udid} (${b.reason})`).join(", ");o({type:"SET_BANNER",banner:{tone:"error",message:`Cannot start — these devices are busy: ${c}`}})}else o({type:"SET_BANNER",banner:{tone:"error",message:`Server-wide recording cap reached (${s.body.active}/${s.body.limit}).`}});else o({type:"SET_BANNER",banner:{tone:"error",message:`Recording failed: ${s.message}`}})}}},T=async()=>{if(!(!n.groupId||n.recordingPhase!=="recording")){o({type:"SET_RECORDING_PHASE",phase:"stopping"});try{const m=await ot(n.groupId),s=(m.recordings??[]).filter(b=>b.status==="STOPPED"&&(b.sizeBytes??0)>=1024),c=(m.recordings??[]).filter(b=>b.status!=="STOPPED");o({type:"STOP_RECORDING",downloadableVideoCount:s.length,compositeEnabled:n.compositeEnabled}),s.length===0?o({type:"SET_BANNER",banner:{tone:"error",message:c.length>0?`Recording failed on ${c.length} device(s). Nothing to download.`:"Recording stopped but no playable video was produced."}}):c.length>0?o({type:"SET_BANNER",banner:{tone:"info",message:`${s.length} ready, ${c.length} failed. Download with the button above.`}}):o({type:"SET_BANNER",banner:{tone:"info",message:s.length===1?"Video ready. Download it with the button above.":`${s.length} videos ready. Download them with the button above.`}})}catch(m){o({type:"STOP_RECORDING"}),o({type:"SET_BANNER",banner:{tone:"error",message:`Stop failed: ${m.message}`}})}}},w=m=>{const s=m==="annotate";s&&!v||s!==n.annotateMode&&o({type:"SET_ANNOTATE_MODE",enabled:s})};d.useEffect(()=>{if(!n.annotateMode)return;const m=s=>{var b;if(s.key!=="Escape"||s.repeat)return;const c=s.target;c&&((b=c.closest)!=null&&b.call(c,"input, textarea, select")||c.isContentEditable)||o({type:"SET_ANNOTATE_MODE",enabled:!1})};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n.annotateMode,o]);const C=()=>{v&&t()},$=Object.values(n.overlayAnnotations).some(m=>((m==null?void 0:m.length)??0)>0),V=[{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:[n.recordingPhase==="recording"||n.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-[rgb(var(--rgb-red-600)/0.2)] text-[var(--red-200)] border border-[rgb(var(--rgb-red)/0.4)]",title:"Recording elapsed time",children:[r.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-[var(--red)] animate-pulse"}),"REC ",pt(u),n.recordingPhase==="stopping"?" · Stopping…":""]}):r.jsxs("button",{type:"button",onClick:O,disabled:!p,title:e.length===0?"Add a device to the grid first":"Record every device on the grid",className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-[var(--red-600)] text-white disabled:opacity-40 disabled:cursor-not-allowed light:disabled:bg-transparent light:disabled:text-[var(--text)] light:disabled:ring-1 light:disabled:ring-inset light:disabled:ring-[color:var(--border)]",children:[r.jsx(xe,{...K,size:10,fill:"currentColor"}),Ft(e.length,n.recordingPhase)]}),r.jsxs("button",{type:"button",onClick:T,disabled:!l,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded border border-[var(--border)] disabled:opacity-40 disabled:cursor-not-allowed",children:[r.jsx(be,{...K,size:12}),n.recordingPhase==="stopping"?"Stopping…":"Stop"]}),r.jsx(Ze,{size:"sm",value:n.annotateMode?"annotate":"interact",onChange:w,segments:[{value:"interact",label:"Interact",title:"Tap, swipe and type on the devices (Esc)",keyShortcuts:"Escape"},{value:"annotate",label:"Annotate",title:v?"Draw marks on the recording":"Start recording to annotate",disabled:!v}]}),E&&r.jsxs("div",{className:"flex items-center gap-1 ml-1 pl-2 border-l border-[var(--border)]",children:[V.map(m=>r.jsx("button",{type:"button",disabled:!f,"aria-pressed":n.shape===m.id,onClick:()=>o({type:"SET_SHAPE",shape:m.id}),className:`px-2 py-1 text-xs rounded border disabled:opacity-40 disabled:cursor-not-allowed ${n.shape===m.id?"bg-[var(--surface-2)] border-[var(--color-info)] text-[rgb(var(--rgb-fg))]":"border-[var(--border)] opacity-80 hover:opacity-100"}`,children:m.label},m.id)),r.jsx("input",{type:"color",value:n.color,disabled:!f,onChange:m=>o({type:"SET_COLOR",color:m.target.value}),title:"Annotation color","aria-label":"Annotation color",className:"w-7 h-7 rounded border border-[var(--border)] bg-transparent cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed"}),r.jsx("button",{type:"button",onClick:C,disabled:!v||!$,title:"Clear marks from the preview and the recording",className:"px-2 py-1 text-xs rounded border border-[var(--border)] hover:bg-[var(--surface-2)] disabled:opacity-40 disabled:cursor-not-allowed",children:"Clear marks"})]}),j&&R&&r.jsxs("a",{href:Qe(n.groupId),className:"ml-1 inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2)]",download:!0,children:[r.jsx(oe,{...K}),"Download video"]}),j&&!R&&r.jsxs("a",{href:et(n.groupId),className:"ml-1 inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2)]",download:`videos-${n.groupId}.zip`,title:"ZIP of mp4 files only (no JSON extras)",children:[r.jsx(oe,{...K}),"Download ",y?"videos":"video"]}),x&&r.jsxs("a",{href:tt(n.groupId),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2)]",download:`side-by-side-${n.groupId}.mp4`,title:"All devices in one side-by-side video",children:[r.jsx(oe,{...K}),"Side-by-side"]}),j&&n.groupId&&r.jsxs(Le,{to:`/recordings/${encodeURIComponent(n.groupId)}`,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2)]",children:[r.jsx(Be,{...K}),"Open in Recordings"]})]})}function Kt({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(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium",children:"Continue session"})]})]})})}function Yt({message:e,onRestore:t,onDismiss:n}){return r.jsxs("div",{role:"status",className:"text-sm rounded border border-[var(--border)] bg-[var(--surface-2)] text-[var(--text)] px-3 py-2 flex items-center gap-2",children:[r.jsx(it,{"aria-hidden":!0,size:14,className:"shrink-0 text-[var(--text-dim)]"}),r.jsx("span",{className:"flex-1",children:e}),t&&r.jsx(de,{variant:"tonal",size:"sm",onClick:t,children:"Restore devices"}),r.jsx(de,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"})]})}function we(e){var t;return((t=e.marketingName)==null?void 0:t.trim())||e.name||e.udid}function Ee(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 se(e){const t=Number(e.screenWidth),n=Number(e.screenHeight);return{udid:e.udid,name:we(e),mjpegPort:0,aspect:Ee(e),screenWidth:Number.isFinite(t)&&t>0?t:void 0,screenHeight:Number.isFinite(n)&&n>0?n:void 0,platform:e.platform}}function Xt(e,t){return t?"blocked":e?"remove":"add"}function ae(e,t,n){return!n||!e?!1:e===`manual_${n}_${t}`}function qt(e,t){if(!e.busy)return;const n=ve(e);return n?n.startsWith("manual_")?ae(n,e.udid,t)?"manual_self":"manual_other":"automation":"unknown"}function Jt(e,t){return e.busy?ae(ve(e),e.udid,t):!1}function Zt(e,t){return e>0&&t==="idle"}function Qt(e,t,n){const o=[],i=[];for(const g of e){const u=t.find(p=>p.udid===g.udid),N=(u==null?void 0:u.name)||g.name||g.udid;u?u.offline?i.push({name:N,reason:"offline"}):u.busy&&!ae(u.session_id,u.udid,n)?i.push({name:N,reason:"in_use"}):o.push(u):i.push({name:N,reason:"gone"})}return{restore:o,skipped:i}}const Ne=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function er(e,t){return`Released ${Ne(e,"device")} after ${t} minutes without activity.`}const tr={in_use:"is now in use by someone else.",offline:"is offline.",gone:"is no longer connected."};function rr(e,t){return t.length===0?null:[e>0?`Restored ${Ne(e,"device")}.`:"No devices restored.",...t.map(o=>`${o.name} ${tr[o.reason]}`)].join(" ")}function nr(){let e=Promise.resolve();return{enqueue(t){const n=e.then(t,t);return e=n.then(()=>{},()=>{}),n}}}const me=["mousemove","mousedown","keydown","touchstart","wheel"];function or({idleAfterMs:e,warningSec:t,onWarning:n,onTimeout:o,enabled:i}){const[g,u]=d.useState(!1),[N,p]=d.useState(null),E=d.useRef(null),l=d.useRef(null),v=d.useRef(!1),f=d.useRef(n),j=d.useRef(o);f.current=n,j.current=o;function y(){E.current&&(clearTimeout(E.current),E.current=null),l.current&&(clearInterval(l.current),l.current=null)}function x(){v.current=!0,u(!0),p(t),f.current(t);let T=t;l.current=setInterval(()=>{T-=1,T<=0?(y(),v.current=!1,u(!1),p(null),j.current()):p(T)},1e3)}function R(){y(),v.current=!1,u(!1),p(null);const T=e-t*1e3;E.current=setTimeout(x,Math.max(0,T))}function O(){i&&R()}return d.useEffect(()=>{if(!i){y(),v.current=!1,u(!1),p(null);return}function T(){v.current||R()}return me.forEach(w=>window.addEventListener(w,T,{passive:!0})),R(),()=>{me.forEach(w=>window.removeEventListener(w,T)),y()}},[i,e,t]),{warning:g,remainingSec:N,reset:O}}const ge=5*60*1e3,sr=30;function ar(e,t){return{udid:e.udid,name:we(e),altName:e.name,platform:e.platform,busy:e.busy,busyReason:qt(e,t),mjpegServerPort:e.mjpegServerPort,offline:!!e.offline}}function Er(){const[e,t]=ht(),[n,o]=d.useState([]),[i,g]=d.useState("loading"),[u,N]=d.useState(0),[p,E]=d.useState(null),l=d.useRef(!1),v=d.useRef(nr());d.useEffect(()=>{let s=!1;return fetch("/xenon/api/auth/me",{credentials:"include"}).then(c=>c.ok?c.json():null).then(c=>{!s&&(c!=null&&c.userId)&&E(c.userId)}).catch(()=>{}),()=>{s=!0}},[]),d.useEffect(()=>{let s=!1;const c=async()=>{try{const S=await D.getDevices();if(s)return;o(Array.isArray(S)?S:[]),g("ready")}catch{s||g("error")}};c();const b=window.setInterval(c,5e3);return()=>{s=!0,window.clearInterval(b)}},[u]),d.useEffect(()=>{let s=!1;if(!(!p||l.current))return l.current=!0,(async()=>{var S;let c=[],b=[];try{const H=await D.getDevices();c=Array.isArray(H)?H:[];const U=c.filter(z=>Jt(z,p));if(b=(await Promise.all(U.map(async z=>{try{const W=await fetch(`/xenon/api/control/${encodeURIComponent(z.udid)}/stream/status`);if(!W.ok)return null;const P=await W.json();return(P==null?void 0:P.status)==="running"?z:null}catch{return null}}))).filter(z=>z!==null).map(se),s)return;b.length>0&&t({type:"SET_TILES",tiles:b})}catch{}try{const{serverNow:H,groups:U}=await st(),M=U[0];if(s||!M)return;const z=new Set(b.map(A=>A.udid)),W=M.recordings.filter(A=>!z.has(A.udid)).map(A=>c.find(F=>F.udid===A.udid)).filter(A=>!!A).map(se);W.length>0&&t({type:"SET_TILES",tiles:[...b,...W]});const P={};for(const A of M.annotations){let F;try{F=JSON.parse(A.geometry)}catch{continue}(P[S=A.recordingId]??(P[S]=[])).push({shape:A.shape,color:A.color,geometry:F,text:A.text??void 0})}t({type:"REHYDRATE_RECORDING",groupId:M.groupId,startedAt:Date.now()-(H-Date.parse(M.startedAt)),tileIds:Object.fromEntries(M.recordings.map(A=>[A.udid,A.id])),compositeEnabled:M.compositeEnabled,overlayAnnotations:P})}catch{}})(),()=>{s=!0}},[p,t]),d.useEffect(()=>{for(const s of e.tiles){if(s.screenWidth&&s.screenHeight)continue;const c=n.find(H=>H.udid===s.udid);if(!c)continue;const b=Number(c.screenWidth),S=Number(c.screenHeight);Number.isFinite(b)&&b>0&&Number.isFinite(S)&&S>0&&t({type:"PATCH_TILE_DIMS",udid:s.udid,screenWidth:b,screenHeight:S,aspect:Ee(c)})}},[n,e.tiles,t]);const f=d.useMemo(()=>new Set(e.tiles.map(s=>s.udid)),[e.tiles]),j=d.useMemo(()=>n.map(s=>ar(s,p)),[n,p]),y=async s=>{t({type:"ADD_TILE",tile:se(s)});const c=await D.startStream(s.udid).catch(()=>null);We(c)&&t({type:"REMOVE_TILE",udid:s.udid})},x=async s=>{const c=Xt(e.tiles.some(S=>S.udid===s),e.recording);if(c==="blocked"){t({type:"SET_ERROR_BANNER",message:"Stop recording before changing the devices on the grid."});return}if(c==="remove"){await R(s);return}const b=n.find(S=>S.udid===s);b&&await y(b)},R=async s=>{t({type:"REMOVE_TILE",udid:s});try{await fetch(`/xenon/api/control/${encodeURIComponent(s)}/stream/leave`,{method:"POST"})}catch{}N(c=>c+1)},O=(s,c,b)=>{if(!e.groupId)return;const S=e.groupId,H=e.startedAt?Date.now()-e.startedAt:0,U={recordingId:s,timecodeMs:H,shape:c.shape,geometry:JSON.stringify(c.geometry),color:c.color,text:c.text};v.current.enqueue(async()=>{try{return await le(S,b?{...U,image:b}:U)}catch(M){if(!b)throw M;return le(S,U)}}).catch(M=>t({type:"SET_ERROR_BANNER",message:`Annotation failed: ${M.message}`}))},T=()=>{if(!e.groupId)return;const s=e.groupId,c=e.startedAt?Date.now()-e.startedAt:0;t({type:"CLEAR_OVERLAY_ANNOTATIONS"}),v.current.enqueue(()=>at(s,c)).catch(()=>t({type:"SET_ERROR_BANNER",message:"Couldn't clear marks from the recording. They will still appear in the video."}))},w=()=>{for(const s of e.tiles){const c=`/xenon/api/control/${encodeURIComponent(s.udid)}/stream/leave`;try{navigator.sendBeacon?navigator.sendBeacon(c):fetch(c,{method:"POST",keepalive:!0}).catch(()=>{})}catch{}}e.tiles.forEach(s=>t({type:"REMOVE_TILE",udid:s.udid}))},[C,$]=d.useState(null),V=async()=>{const s=C==null?void 0:C.tiles;if(!s)return;const c=Qt(s,n,p);for(const S of c.restore)await y(S);const b=rr(c.restore.length,c.skipped);$(b?{message:b,tiles:null}:null),N(S=>S+1)},m=or({idleAfterMs:ge,warningSec:sr,enabled:Zt(e.tiles.length,e.recordingPhase),onWarning:()=>{},onTimeout:()=>{const s=e.tiles;w(),$({message:er(s.length,ge/6e4),tiles:s})}});return r.jsxs(ye.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(ct,{icon:He,children:"Live devices"}),r.jsx(vt,{value:e.layout,onChange:s=>t({type:"SET_LAYOUT",layout:s})})]}),r.jsx(Gt,{selectedUdids:e.tiles.map(s=>s.udid),onClearMarks:T})]}),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-[rgb(var(--rgb-red)/0.4)] bg-[rgb(var(--rgb-red)/0.1)] text-[var(--red-100)]":"border-[rgb(var(--rgb-success)/0.4)] bg-[rgb(var(--rgb-success)/0.1)] text-[var(--text)]"}`,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"})]}),C&&r.jsx(Yt,{message:C.message,onRestore:C.tiles&&!e.recording?V:void 0,onDismiss:()=>$(null)}),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 text-[var(--text-dim)]",children:"Devices"}),r.jsx("button",{className:"text-xs underline opacity-70 hover:opacity-100",onClick:()=>N(s=>s+1),children:"Refresh"})]}),r.jsx(xt,{devices:j,inMosaic:f,onToggle:x,status:i}),r.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-dim)] leading-relaxed",children:"Click a device to add it to the grid. Record captures every device on the grid; after Stop, download the video."})]}),r.jsx("main",{className:"border border-[var(--border)] rounded p-2 overflow-y-auto h-full min-h-0",children:r.jsx(zt,{layout:e.layout,tiles:e.tiles,annotateMode:e.annotateMode,shape:e.shape,color:e.color,overlayAnnotationsByRecording:e.overlayAnnotations,onOverlayAnnotationsChange:(s,c)=>t({type:"SET_OVERLAY_ANNOTATIONS",recordingId:s,annotations:c}),onAnnotation:O,onRemove:R,onDropDevice:x})})]})]}),m.warning&&m.remainingSec!==null&&r.jsx(Kt,{remainingSec:m.remainingSec,onContinue:m.reset,onReleaseNow:w})]})}export{Er as default};
@@ -1 +1 @@
1
- import{j as s}from"./index-rullcuA-.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
+ import{j as s}from"./index-B1iJx0w1.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-rullcuA-.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
+ import{j as s}from"./index-B1iJx0w1.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 +1 @@
1
- import{r as t,j as s,v as d}from"./index-rullcuA-.js";import{P as b,M as C,a as g}from"./Menu-ChzfRWa3.js";import{P as k}from"./plus-bjDKJLSM.js";function F({name:a,value:r,anyValue:o,options:u,onChange:f}){const[m,p]=t.useState(!1),x=t.useRef(null),h=t.useRef(null),c=r!==o,l=u.find(e=>e.value===r),n=()=>{var e;p(!1),(e=h.current)==null||e.focus()},j=t.useCallback(e=>{const i=(e==null?void 0:e.querySelector('[aria-checked="true"]'))??(e==null?void 0:e.querySelector('[role="menuitemradio"]'));i==null||i.focus()},[]);return s.jsxs("span",{ref:x,className:`fm${c?" fm-set":""}`,children:[s.jsx("button",{ref:h,type:"button",className:"fm-trigger","aria-haspopup":"menu","aria-expanded":m,onClick:()=>p(e=>!e),children:c?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"fm-name",children:[a,":"]})," ",(l==null?void 0:l.label)??r]}):s.jsxs(s.Fragment,{children:[s.jsx(k,{size:12,"aria-hidden":"true"}),a]})}),c&&s.jsx("button",{type:"button",className:"fm-clear","aria-label":`Clear ${a.toLowerCase()} filter`,onClick:()=>{f(o),n()},children:s.jsx(d,{size:12,"aria-hidden":"true"})}),s.jsx(b,{open:m,onClose:n,anchorRef:x,placement:"bottom-start",children:s.jsx("div",{ref:j,children:s.jsx(C,{children:u.map(e=>s.jsx(g,{checked:e.value===r,note:e.note,trailing:s.jsx("span",{className:"fm-count",children:e.count}),onClick:()=>{f(e.value),n()},children:e.label},e.value))})})})]})}export{F};
1
+ import{r as t,j as s,v as d}from"./index-B1iJx0w1.js";import{P as b,M as C,a as g}from"./Menu-DWl5uJ9E.js";import{P as k}from"./plus-DF-cFokG.js";function F({name:a,value:r,anyValue:o,options:u,onChange:f}){const[m,p]=t.useState(!1),x=t.useRef(null),h=t.useRef(null),c=r!==o,l=u.find(e=>e.value===r),n=()=>{var e;p(!1),(e=h.current)==null||e.focus()},j=t.useCallback(e=>{const i=(e==null?void 0:e.querySelector('[aria-checked="true"]'))??(e==null?void 0:e.querySelector('[role="menuitemradio"]'));i==null||i.focus()},[]);return s.jsxs("span",{ref:x,className:`fm${c?" fm-set":""}`,children:[s.jsx("button",{ref:h,type:"button",className:"fm-trigger","aria-haspopup":"menu","aria-expanded":m,onClick:()=>p(e=>!e),children:c?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"fm-name",children:[a,":"]})," ",(l==null?void 0:l.label)??r]}):s.jsxs(s.Fragment,{children:[s.jsx(k,{size:12,"aria-hidden":"true"}),a]})}),c&&s.jsx("button",{type:"button",className:"fm-clear","aria-label":`Clear ${a.toLowerCase()} filter`,onClick:()=>{f(o),n()},children:s.jsx(d,{size:12,"aria-hidden":"true"})}),s.jsx(b,{open:m,onClose:n,anchorRef:x,placement:"bottom-start",children:s.jsx("div",{ref:j,children:s.jsx(C,{children:u.map(e=>s.jsx(g,{checked:e.value===r,note:e.note,trailing:s.jsx("span",{className:"fm-count",children:e.count}),onClick:()=>{f(e.value),n()},children:e.label},e.value))})})})]})}export{F};
@@ -1 +1 @@
1
- import{r as x,x as Ve,j as C,a1 as Ye,a0 as Ke,R as Z}from"./index-rullcuA-.js";import{P as lt,b as ht,a as st,u as ce,f as Nt,i as Xe,D as Ge,g as Ut,d as Ue,e as tt,c as qe}from"./index-DC1NFStQ.js";import{C as Ze}from"./check-DHCAmQzm.js";const Je=["top","right","bottom","left"],U=Math.min,j=Math.max,gt=Math.round,mt=Math.floor,V=t=>({x:t,y:t}),Qe={left:"right",right:"left",bottom:"top",top:"bottom"};function Tt(t,e,n){return j(t,U(e,n))}function K(t,e){return typeof t=="function"?t(e):t}function X(t){return t.split("-")[0]}function ot(t){return t.split("-")[1]}function Ft(t){return t==="x"?"y":"x"}function Lt(t){return t==="y"?"height":"width"}function z(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function _t(t){return Ft(z(t))}function tn(t,e,n){n===void 0&&(n=!1);const o=ot(t),r=_t(t),i=Lt(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=wt(s)),[s,wt(s)]}function en(t){const e=wt(t);return[Dt(t),e,Dt(e)]}function Dt(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const qt=["left","right"],Zt=["right","left"],nn=["top","bottom"],on=["bottom","top"];function rn(t,e,n){switch(t){case"top":case"bottom":return n?e?Zt:qt:e?qt:Zt;case"left":case"right":return e?nn:on;default:return[]}}function sn(t,e,n,o){const r=ot(t);let i=rn(X(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Dt)))),i}function wt(t){const e=X(t);return Qe[e]+t.slice(e.length)}function cn(t){return{top:0,right:0,bottom:0,left:0,...t}}function le(t){return typeof t!="number"?cn(t):{top:t,right:t,bottom:t,left:t}}function xt(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function Jt(t,e,n){let{reference:o,floating:r}=t;const i=z(e),s=_t(e),c=Lt(s),a=X(e),f=i==="y",l=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,m=o[c]/2-r[c]/2;let d;switch(a){case"top":d={x:l,y:o.y-r.height};break;case"bottom":d={x:l,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-r.width,y:u};break;default:d={x:o.x,y:o.y}}switch(ot(e)){case"start":d[s]-=m*(n&&f?-1:1);break;case"end":d[s]+=m*(n&&f?-1:1);break}return d}async function ln(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:a}=t,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:u="floating",altBoundary:m=!1,padding:d=0}=K(e,t),p=le(d),h=c[m?u==="floating"?"reference":"floating":u],w=xt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:f,rootBoundary:l,strategy:a})),b=u==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),v=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},A=xt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:y,strategy:a}):b);return{top:(w.top-A.top+p.top)/v.y,bottom:(A.bottom-w.bottom+p.bottom)/v.y,left:(w.left-A.left+p.left)/v.x,right:(A.right-w.right+p.right)/v.x}}const an=50,fn=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:ln},a=await(s.isRTL==null?void 0:s.isRTL(e));let f=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:l,y:u}=Jt(f,o,a),m=o,d=0;const p={};for(let g=0;g<i.length;g++){const h=i[g];if(!h)continue;const{name:w,fn:b}=h,{x:y,y:v,data:A,reset:R}=await b({x:l,y:u,initialPlacement:o,placement:m,strategy:r,middlewareData:p,rects:f,platform:c,elements:{reference:t,floating:e}});l=y??l,u=v??u,p[w]={...p[w],...A},R&&d<an&&(d++,typeof R=="object"&&(R.placement&&(m=R.placement),R.rects&&(f=R.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):R.rects),{x:l,y:u}=Jt(f,m,a)),g=-1)}return{x:l,y:u,placement:m,strategy:r,middlewareData:p}},un=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:i,platform:s,elements:c,middlewareData:a}=e,{element:f,padding:l=0}=K(t,e)||{};if(f==null)return{};const u=le(l),m={x:n,y:o},d=_t(r),p=Lt(d),g=await s.getDimensions(f),h=d==="y",w=h?"top":"left",b=h?"bottom":"right",y=h?"clientHeight":"clientWidth",v=i.reference[p]+i.reference[d]-m[d]-i.floating[p],A=m[d]-i.reference[d],R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let P=R?R[y]:0;(!P||!await(s.isElement==null?void 0:s.isElement(R)))&&(P=c.floating[y]||i.floating[p]);const O=v/2-A/2,L=P/2-g[p]/2-1,D=U(u[w],L),M=U(u[b],L),F=D,I=P-g[p]-M,T=P/2-g[p]/2+O,$=Tt(F,T,I),E=!a.arrow&&ot(r)!=null&&T!==$&&i.reference[p]/2-(T<F?D:M)-g[p]/2<0,N=E?T<F?T-F:T-I:0;return{[d]:m[d]+N,data:{[d]:$,centerOffset:T-$-N,...E&&{alignmentOffset:N}},reset:E}}}),dn=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:a,elements:f}=e,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...h}=K(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=X(r),b=z(c),y=X(c)===c,v=await(a.isRTL==null?void 0:a.isRTL(f.floating)),A=m||(y||!g?[wt(c)]:en(c)),R=p!=="none";!m&&R&&A.push(...sn(c,g,p,v));const P=[c,...A],O=await a.detectOverflow(e,h),L=[];let D=((o=i.flip)==null?void 0:o.overflows)||[];if(l&&L.push(O[w]),u){const T=tn(r,s,v);L.push(O[T[0]],O[T[1]])}if(D=[...D,{placement:r,overflows:L}],!L.every(T=>T<=0)){var M,F;const T=(((M=i.flip)==null?void 0:M.index)||0)+1,$=P[T];if($&&(!(u==="alignment"?b!==z($):!1)||D.every(S=>z(S.placement)===b?S.overflows[0]>0:!0)))return{data:{index:T,overflows:D},reset:{placement:$}};let E=(F=D.filter(N=>N.overflows[0]<=0).sort((N,S)=>N.overflows[1]-S.overflows[1])[0])==null?void 0:F.placement;if(!E)switch(d){case"bestFit":{var I;const N=(I=D.filter(S=>{if(R){const _=z(S.placement);return _===b||_==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(_=>_>0).reduce((_,B)=>_+B,0)]).sort((S,_)=>S[1]-_[1])[0])==null?void 0:I[0];N&&(E=N);break}case"initialPlacement":E=c;break}if(r!==E)return{reset:{placement:E}}}return{}}}};function Qt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function te(t){return Je.some(e=>t[e]>=0)}const mn=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...i}=K(t,e);switch(r){case"referenceHidden":{const s=await o.detectOverflow(e,{...i,elementContext:"reference"}),c=Qt(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:te(c)}}}case"escaped":{const s=await o.detectOverflow(e,{...i,altBoundary:!0}),c=Qt(s,n.floating);return{data:{escapedOffsets:c,escaped:te(c)}}}default:return{}}}}},ae=new Set(["left","top"]);async function pn(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=X(n),c=ot(n),a=z(n)==="y",f=ae.has(s)?-1:1,l=i&&a?-1:1,u=K(e,t);let{mainAxis:m,crossAxis:d,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),a?{x:d*l,y:m*f}:{x:m*f,y:d*l}}const hn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=e,a=await pn(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:s}}}}},gn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:i}=e,{mainAxis:s=!0,crossAxis:c=!1,limiter:a={fn:w=>{let{x:b,y}=w;return{x:b,y}}},...f}=K(t,e),l={x:n,y:o},u=await i.detectOverflow(e,f),m=z(X(r)),d=Ft(m);let p=l[d],g=l[m];if(s){const w=d==="y"?"top":"left",b=d==="y"?"bottom":"right",y=p+u[w],v=p-u[b];p=Tt(y,p,v)}if(c){const w=m==="y"?"top":"left",b=m==="y"?"bottom":"right",y=g+u[w],v=g-u[b];g=Tt(y,g,v)}const h=a.fn({...e,[d]:p,[m]:g});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:s,[m]:c}}}}}},wn=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:i,middlewareData:s}=e,{offset:c=0,mainAxis:a=!0,crossAxis:f=!0}=K(t,e),l={x:n,y:o},u=z(r),m=Ft(u);let d=l[m],p=l[u];const g=K(c,e),h=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const y=m==="y"?"height":"width",v=i.reference[m]-i.floating[y]+h.mainAxis,A=i.reference[m]+i.reference[y]-h.mainAxis;d<v?d=v:d>A&&(d=A)}if(f){var w,b;const y=m==="y"?"width":"height",v=ae.has(X(r)),A=i.reference[u]-i.floating[y]+(v&&((w=s.offset)==null?void 0:w[u])||0)+(v?0:h.crossAxis),R=i.reference[u]+i.reference[y]+(v?0:((b=s.offset)==null?void 0:b[u])||0)-(v?h.crossAxis:0);p<A?p=A:p>R&&(p=R)}return{[m]:d,[u]:p}}}},xn=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:s,elements:c}=e,{apply:a=()=>{},...f}=K(t,e),l=await s.detectOverflow(e,f),u=X(r),m=ot(r),d=z(r)==="y",{width:p,height:g}=i.floating;let h,w;u==="top"||u==="bottom"?(h=u,w=m===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(w=u,h=m==="end"?"top":"bottom");const b=g-l.top-l.bottom,y=p-l.left-l.right,v=U(g-l[h],b),A=U(p-l[w],y),R=!e.middlewareData.shift;let P=v,O=A;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(O=y),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(P=b),R&&!m){const D=j(l.left,0),M=j(l.right,0),F=j(l.top,0),I=j(l.bottom,0);d?O=p-2*(D!==0||M!==0?D+M:j(l.left,l.right)):P=g-2*(F!==0||I!==0?F+I:j(l.top,l.bottom))}await a({...e,availableWidth:O,availableHeight:P});const L=await s.getDimensions(c.floating);return p!==L.width||g!==L.height?{reset:{rects:!0}}:{}}}};function bt(){return typeof window<"u"}function rt(t){return fe(t)?(t.nodeName||"").toLowerCase():"#document"}function k(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Y(t){var e;return(e=(fe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function fe(t){return bt()?t instanceof Node||t instanceof k(t).Node:!1}function W(t){return bt()?t instanceof Element||t instanceof k(t).Element:!1}function G(t){return bt()?t instanceof HTMLElement||t instanceof k(t).HTMLElement:!1}function ee(t){return!bt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof k(t).ShadowRoot}function at(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&r!=="inline"&&r!=="contents"}function yn(t){return/^(table|td|th)$/.test(rt(t))}function Rt(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const vn=/transform|translate|scale|rotate|perspective|filter/,bn=/paint|layout|strict|content/,J=t=>!!t&&t!=="none";let St;function $t(t){const e=W(t)?H(t):t;return J(e.transform)||J(e.translate)||J(e.scale)||J(e.rotate)||J(e.perspective)||!jt()&&(J(e.backdropFilter)||J(e.filter))||vn.test(e.willChange||"")||bn.test(e.contain||"")}function Rn(t){let e=q(t);for(;G(e)&&!nt(e);){if($t(e))return e;if(Rt(e))return null;e=q(e)}return null}function jt(){return St==null&&(St=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),St}function nt(t){return/^(html|body|#document)$/.test(rt(t))}function H(t){return k(t).getComputedStyle(t)}function At(t){return W(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q(t){if(rt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||ee(t)&&t.host||Y(t);return ee(e)?e.host:e}function ue(t){const e=q(t);return nt(e)?t.ownerDocument?t.ownerDocument.body:t.body:G(e)&&at(e)?e:ue(e)}function ct(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=ue(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=k(r);if(i){const c=It(s);return e.concat(s,s.visualViewport||[],at(r)?r:[],c&&n?ct(c):[])}else return e.concat(r,ct(r,[],n))}function It(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function de(t){const e=H(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=G(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,c=gt(n)!==i||gt(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function kt(t){return W(t)?t:t.contextElement}function et(t){const e=kt(t);if(!G(e))return V(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=de(e);let s=(i?gt(n.width):n.width)/o,c=(i?gt(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const An=V(0);function me(t){const e=k(t);return!jt()||!e.visualViewport?An:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Cn(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==k(t)?!1:e}function Q(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=kt(t);let s=V(1);e&&(o?W(o)&&(s=et(o)):s=et(t));const c=Cn(i,n,o)?me(i):V(0);let a=(r.left+c.x)/s.x,f=(r.top+c.y)/s.y,l=r.width/s.x,u=r.height/s.y;if(i){const m=k(i),d=o&&W(o)?k(o):o;let p=m,g=It(p);for(;g&&o&&d!==p;){const h=et(g),w=g.getBoundingClientRect(),b=H(g),y=w.left+(g.clientLeft+parseFloat(b.paddingLeft))*h.x,v=w.top+(g.clientTop+parseFloat(b.paddingTop))*h.y;a*=h.x,f*=h.y,l*=h.x,u*=h.y,a+=y,f+=v,p=k(g),g=It(p)}}return xt({width:l,height:u,x:a,y:f})}function Ct(t,e){const n=At(t).scrollLeft;return e?e.left+n:Q(Y(t)).left+n}function pe(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Ct(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function Sn(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=Y(o),c=e?Rt(e.floating):!1;if(o===s||c&&i)return n;let a={scrollLeft:0,scrollTop:0},f=V(1);const l=V(0),u=G(o);if((u||!u&&!i)&&((rt(o)!=="body"||at(s))&&(a=At(o)),u)){const d=Q(o);f=et(o),l.x=d.x+o.clientLeft,l.y=d.y+o.clientTop}const m=s&&!u&&!i?pe(s,a):V(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+l.x+m.x,y:n.y*f.y-a.scrollTop*f.y+l.y+m.y}}function On(t){return Array.from(t.getClientRects())}function Pn(t){const e=Y(t),n=At(t),o=t.ownerDocument.body,r=j(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=j(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Ct(t);const c=-n.scrollTop;return H(o).direction==="rtl"&&(s+=j(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}const ne=25;function En(t,e){const n=k(t),o=Y(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,a=0;if(r){i=r.width,s=r.height;const l=jt();(!l||l&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}const f=Ct(o);if(f<=0){const l=o.ownerDocument,u=l.body,m=getComputedStyle(u),d=l.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-u.clientWidth-d);p<=ne&&(i-=p)}else f<=ne&&(i+=f);return{width:i,height:s,x:c,y:a}}function Tn(t,e){const n=Q(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=G(t)?et(t):V(1),s=t.clientWidth*i.x,c=t.clientHeight*i.y,a=r*i.x,f=o*i.y;return{width:s,height:c,x:a,y:f}}function oe(t,e,n){let o;if(e==="viewport")o=En(t,n);else if(e==="document")o=Pn(Y(t));else if(W(e))o=Tn(e,n);else{const r=me(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return xt(o)}function he(t,e){const n=q(t);return n===e||!W(n)||nt(n)?!1:H(n).position==="fixed"||he(n,e)}function Dn(t,e){const n=e.get(t);if(n)return n;let o=ct(t,[],!1).filter(c=>W(c)&&rt(c)!=="body"),r=null;const i=H(t).position==="fixed";let s=i?q(t):t;for(;W(s)&&!nt(s);){const c=H(s),a=$t(s);!a&&c.position==="fixed"&&(r=null),(i?!a&&!r:!a&&c.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||at(s)&&!a&&he(t,s))?o=o.filter(l=>l!==s):r=c,s=q(s)}return e.set(t,o),o}function In(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const s=[...n==="clippingAncestors"?Rt(e)?[]:Dn(e,this._c):[].concat(n),o],c=oe(e,s[0],r);let a=c.top,f=c.right,l=c.bottom,u=c.left;for(let m=1;m<s.length;m++){const d=oe(e,s[m],r);a=j(d.top,a),f=U(d.right,f),l=U(d.bottom,l),u=j(d.left,u)}return{width:f-u,height:l-a,x:u,y:a}}function Mn(t){const{width:e,height:n}=de(t);return{width:e,height:n}}function Nn(t,e,n){const o=G(e),r=Y(e),i=n==="fixed",s=Q(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const a=V(0);function f(){a.x=Ct(r)}if(o||!o&&!i)if((rt(e)!=="body"||at(r))&&(c=At(e)),o){const d=Q(e,!0,i,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else r&&f();i&&!o&&r&&f();const l=r&&!o&&!i?pe(r,c):V(0),u=s.left+c.scrollLeft-a.x-l.x,m=s.top+c.scrollTop-a.y-l.y;return{x:u,y:m,width:s.width,height:s.height}}function Ot(t){return H(t).position==="static"}function re(t,e){if(!G(t)||H(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Y(t)===n&&(n=n.ownerDocument.body),n}function ge(t,e){const n=k(t);if(Rt(t))return n;if(!G(t)){let r=q(t);for(;r&&!nt(r);){if(W(r)&&!Ot(r))return r;r=q(r)}return n}let o=re(t,e);for(;o&&yn(o)&&Ot(o);)o=re(o,e);return o&&nt(o)&&Ot(o)&&!$t(o)?n:o||Rn(t)||n}const Fn=async function(t){const e=this.getOffsetParent||ge,n=this.getDimensions,o=await n(t.floating);return{reference:Nn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ln(t){return H(t).direction==="rtl"}const _n={convertOffsetParentRelativeRectToViewportRelativeRect:Sn,getDocumentElement:Y,getClippingRect:In,getOffsetParent:ge,getElementRects:Fn,getClientRects:On,getDimensions:Mn,getScale:et,isElement:W,isRTL:Ln};function we(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function $n(t,e){let n=null,o;const r=Y(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),i();const f=t.getBoundingClientRect(),{left:l,top:u,width:m,height:d}=f;if(c||e(),!m||!d)return;const p=mt(u),g=mt(r.clientWidth-(l+m)),h=mt(r.clientHeight-(u+d)),w=mt(l),y={rootMargin:-p+"px "+-g+"px "+-h+"px "+-w+"px",threshold:j(0,U(1,a))||1};let v=!0;function A(R){const P=R[0].intersectionRatio;if(P!==a){if(!v)return s();P?s(!1,P):o=setTimeout(()=>{s(!1,1e-7)},1e3)}P===1&&!we(f,t.getBoundingClientRect())&&s(),v=!1}try{n=new IntersectionObserver(A,{...y,root:r.ownerDocument})}catch{n=new IntersectionObserver(A,y)}n.observe(t)}return s(!0),i}function jn(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,f=kt(t),l=r||i?[...f?ct(f):[],...e?ct(e):[]]:[];l.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const u=f&&c?$n(f,n):null;let m=-1,d=null;s&&(d=new ResizeObserver(w=>{let[b]=w;b&&b.target===f&&d&&e&&(d.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=d)==null||y.observe(e)})),n()}),f&&!a&&d.observe(f),e&&d.observe(e));let p,g=a?Q(t):null;a&&h();function h(){const w=Q(t);g&&!we(g,w)&&n(),g=w,p=requestAnimationFrame(h)}return n(),()=>{var w;l.forEach(b=>{r&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),u==null||u(),(w=d)==null||w.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const kn=hn,Wn=gn,Hn=dn,Bn=xn,zn=mn,ie=un,Vn=wn,Yn=(t,e,n)=>{const o=new Map,r={platform:_n,...n},i={...r.platform,_c:o};return fn(t,e,{...r,platform:i})};var Kn=typeof document<"u",Xn=function(){},pt=Kn?x.useLayoutEffect:Xn;function yt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!yt(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&t.$$typeof)&&!yt(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function xe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function se(t,e){const n=xe(t);return Math.round(e*n)/n}function Pt(t){const e=x.useRef(t);return pt(()=>{e.current=t}),e}function Gn(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:a,open:f}=t,[l,u]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,d]=x.useState(o);yt(m,o)||d(o);const[p,g]=x.useState(null),[h,w]=x.useState(null),b=x.useCallback(S=>{S!==R.current&&(R.current=S,g(S))},[]),y=x.useCallback(S=>{S!==P.current&&(P.current=S,w(S))},[]),v=i||p,A=s||h,R=x.useRef(null),P=x.useRef(null),O=x.useRef(l),L=a!=null,D=Pt(a),M=Pt(r),F=Pt(f),I=x.useCallback(()=>{if(!R.current||!P.current)return;const S={placement:e,strategy:n,middleware:m};M.current&&(S.platform=M.current),Yn(R.current,P.current,S).then(_=>{const B={..._,isPositioned:F.current!==!1};T.current&&!yt(O.current,B)&&(O.current=B,Ve.flushSync(()=>{u(B)}))})},[m,e,n,M,F]);pt(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,u(S=>({...S,isPositioned:!1})))},[f]);const T=x.useRef(!1);pt(()=>(T.current=!0,()=>{T.current=!1}),[]),pt(()=>{if(v&&(R.current=v),A&&(P.current=A),v&&A){if(D.current)return D.current(v,A,I);I()}},[v,A,I,D,L]);const $=x.useMemo(()=>({reference:R,floating:P,setReference:b,setFloating:y}),[b,y]),E=x.useMemo(()=>({reference:v,floating:A}),[v,A]),N=x.useMemo(()=>{const S={position:n,left:0,top:0};if(!E.floating)return S;const _=se(E.floating,l.x),B=se(E.floating,l.y);return c?{...S,transform:"translate("+_+"px, "+B+"px)",...xe(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:B}},[n,c,E.floating,l.x,l.y]);return x.useMemo(()=>({...l,update:I,refs:$,elements:E,floatingStyles:N}),[l,I,$,E,N])}const Un=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:r}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?ie({element:o.current,padding:r}).fn(n):{}:o?ie({element:o,padding:r}).fn(n):{}}}},qn=(t,e)=>{const n=kn(t);return{name:n.name,fn:n.fn,options:[t,e]}},Zn=(t,e)=>{const n=Wn(t);return{name:n.name,fn:n.fn,options:[t,e]}},Jn=(t,e)=>({fn:Vn(t).fn,options:[t,e]}),Qn=(t,e)=>{const n=Hn(t);return{name:n.name,fn:n.fn,options:[t,e]}},to=(t,e)=>{const n=Bn(t);return{name:n.name,fn:n.fn,options:[t,e]}},eo=(t,e)=>{const n=zn(t);return{name:n.name,fn:n.fn,options:[t,e]}},no=(t,e)=>{const n=Un(t);return{name:n.name,fn:n.fn,options:[t,e]}};var oo="Arrow",ye=x.forwardRef((t,e)=>{const{children:n,width:o=10,height:r=5,...i}=t;return C.jsx(lt.svg,{...i,ref:e,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:C.jsx("polygon",{points:"0,0 30,0 15,10"})})});ye.displayName=oo;var ro=ye;function io(t){const[e,n]=x.useState(void 0);return ht(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let s,c;if("borderBoxSize"in i){const a=i.borderBoxSize,f=Array.isArray(a)?a[0]:a;s=f.inlineSize,c=f.blockSize}else s=t.offsetWidth,c=t.offsetHeight;n({width:s,height:c})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}var Wt="Popper",[ve]=Nt(Wt),[so,be]=ve(Wt),Re=t=>{const{__scopePopper:e,children:n}=t,[o,r]=x.useState(null);return C.jsx(so,{scope:e,anchor:o,onAnchorChange:r,children:n})};Re.displayName=Wt;var Ae="PopperAnchor",Ce=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...r}=t,i=be(Ae,n),s=x.useRef(null),c=st(e,s),a=x.useRef(null);return x.useEffect(()=>{const f=a.current;a.current=(o==null?void 0:o.current)||s.current,f!==a.current&&i.onAnchorChange(a.current)}),o?null:C.jsx(lt.div,{...r,ref:c})});Ce.displayName=Ae;var Ht="PopperContent",[co,lo]=ve(Ht),Se=x.forwardRef((t,e)=>{var Bt,zt,Vt,Yt,Kt,Xt;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:i="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:a=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:u="partial",hideWhenDetached:m=!1,updatePositionStrategy:d="optimized",onPlaced:p,...g}=t,h=be(Ht,n),[w,b]=x.useState(null),y=st(e,it=>b(it)),[v,A]=x.useState(null),R=io(v),P=(R==null?void 0:R.width)??0,O=(R==null?void 0:R.height)??0,L=o+(i!=="center"?"-"+i:""),D=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},M=Array.isArray(f)?f:[f],F=M.length>0,I={padding:D,boundary:M.filter(uo),altBoundary:F},{refs:T,floatingStyles:$,placement:E,isPositioned:N,middlewareData:S}=Gn({strategy:"fixed",placement:L,whileElementsMounted:(...it)=>jn(...it,{animationFrame:d==="always"}),elements:{reference:h.anchor},middleware:[qn({mainAxis:r+O,alignmentAxis:s}),a&&Zn({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Jn():void 0,...I}),a&&Qn({...I}),to({...I,apply:({elements:it,rects:Gt,availableWidth:We,availableHeight:He})=>{const{width:Be,height:ze}=Gt.reference,dt=it.floating.style;dt.setProperty("--radix-popper-available-width",`${We}px`),dt.setProperty("--radix-popper-available-height",`${He}px`),dt.setProperty("--radix-popper-anchor-width",`${Be}px`),dt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),v&&no({element:v,padding:c}),mo({arrowWidth:P,arrowHeight:O}),m&&eo({strategy:"referenceHidden",...I})]}),[_,B]=Pe(E),ut=ce(p);ht(()=>{N&&(ut==null||ut())},[N,ut]);const Le=(Bt=S.arrow)==null?void 0:Bt.x,_e=(zt=S.arrow)==null?void 0:zt.y,$e=((Vt=S.arrow)==null?void 0:Vt.centerOffset)!==0,[je,ke]=x.useState();return ht(()=>{w&&ke(window.getComputedStyle(w).zIndex)},[w]),C.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:N?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:je,"--radix-popper-transform-origin":[(Yt=S.transformOrigin)==null?void 0:Yt.x,(Kt=S.transformOrigin)==null?void 0:Kt.y].join(" "),...((Xt=S.hide)==null?void 0:Xt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:C.jsx(co,{scope:n,placedSide:_,onArrowChange:A,arrowX:Le,arrowY:_e,shouldHideArrow:$e,children:C.jsx(lt.div,{"data-side":_,"data-align":B,...g,ref:y,style:{...g.style,animation:N?void 0:"none"}})})})});Se.displayName=Ht;var Oe="PopperArrow",ao={top:"bottom",right:"left",bottom:"top",left:"right"},fo=x.forwardRef(function(e,n){const{__scopePopper:o,...r}=e,i=lo(Oe,o),s=ao[i.placedSide];return C.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:C.jsx(ro,{...r,ref:n,style:{...r.style,display:"block"}})})});fo.displayName=Oe;function uo(t){return t!==null}var mo=t=>({name:"transformOrigin",options:t,fn(e){var h,w,b;const{placement:n,rects:o,middlewareData:r}=e,s=((h=r.arrow)==null?void 0:h.centerOffset)!==0,c=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[f,l]=Pe(n),u={start:"0%",center:"50%",end:"100%"}[l],m=(((w=r.arrow)==null?void 0:w.x)??0)+c/2,d=(((b=r.arrow)==null?void 0:b.y)??0)+a/2;let p="",g="";return f==="bottom"?(p=s?u:`${m}px`,g=`${-a}px`):f==="top"?(p=s?u:`${m}px`,g=`${o.floating.height+a}px`):f==="right"?(p=`${-a}px`,g=s?u:`${d}px`):f==="left"&&(p=`${o.floating.width+a}px`,g=s?u:`${d}px`),{data:{x:p,y:g}}}});function Pe(t){const[e,n="center"]=t.split("-");return[e,n]}var po=Re,ho=Ce,go=Se,wo=Symbol.for("react.lazy"),vt=Ye[" use ".trim().toString()];function xo(t){return typeof t=="object"&&t!==null&&"then"in t}function Ee(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===wo&&"_payload"in t&&xo(t._payload)}function yo(t){const e=vo(t),n=x.forwardRef((o,r)=>{let{children:i,...s}=o;Ee(i)&&typeof vt=="function"&&(i=vt(i._payload));const c=x.Children.toArray(i),a=c.find(Ro);if(a){const f=a.props.children,l=c.map(u=>u===a?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:u);return C.jsx(e,{...s,ref:r,children:x.isValidElement(f)?x.cloneElement(f,void 0,l):null})}return C.jsx(e,{...s,ref:r,children:i})});return n.displayName=`${t}.Slot`,n}function vo(t){const e=x.forwardRef((n,o)=>{let{children:r,...i}=n;if(Ee(r)&&typeof vt=="function"&&(r=vt(r._payload)),x.isValidElement(r)){const s=Co(r),c=Ao(i,r.props);return r.type!==x.Fragment&&(c.ref=o?Xe(o,s):s),x.cloneElement(r,c)}return x.Children.count(r)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var bo=Symbol("radix.slottable");function Ro(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bo}function Ao(t,e){const n={...e};for(const o in e){const r=t[o],i=e[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...c)=>{const a=i(...c);return r(...c),a}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...t,...n}}function Co(t){var o,r;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var So=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oo=So.reduce((t,e)=>{const n=yo(`Primitive.${e}`),o=x.forwardRef((r,i)=>{const{asChild:s,...c}=r,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(a,{...c,ref:i})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{}),Po="Portal",Te=x.forwardRef((t,e)=>{var c;const{container:n,...o}=t,[r,i]=x.useState(!1);ht(()=>i(!0),[]);const s=n||r&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return s?Ke.createPortal(C.jsx(Oo.div,{...o,ref:e}),s):null});Te.displayName=Po;const Ko=({open:t,onClose:e,anchorRef:n,placement:o="bottom-end",children:r})=>{const i=x.useRef(null);if(x.useEffect(()=>{if(!t)return;const f=l=>{var u,m;t&&((u=i.current)!=null&&u.contains(l.target)||(m=n.current)!=null&&m.contains(l.target)||e())};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[t,e,n]),!t)return null;const s=o.startsWith("top")?"top":"bottom",c=o.endsWith("end")?"end":"start",a=o.startsWith("top")?8:4;return C.jsxs(po,{children:[C.jsx(ho,{virtualRef:n}),C.jsx(Te,{children:C.jsx(Ge,{onEscapeKeyDown:f=>{f.preventDefault(),e()},onPointerDownOutside:f=>{var l;if((l=n.current)!=null&&l.contains(f.target)){f.preventDefault();return}e()},children:C.jsx(go,{ref:i,side:s,align:c,sideOffset:a,className:`popover popover-${o}`,role:"dialog",children:r})})})]})};function Eo(t){const e=t+"CollectionProvider",[n,o]=Nt(e),[r,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:h,children:w}=g,b=Z.useRef(null),y=Z.useRef(new Map).current;return C.jsx(r,{scope:h,itemMap:y,collectionRef:b,children:w})};s.displayName=e;const c=t+"CollectionSlot",a=Ut(c),f=Z.forwardRef((g,h)=>{const{scope:w,children:b}=g,y=i(c,w),v=st(h,y.collectionRef);return C.jsx(a,{ref:v,children:b})});f.displayName=c;const l=t+"CollectionItemSlot",u="data-radix-collection-item",m=Ut(l),d=Z.forwardRef((g,h)=>{const{scope:w,children:b,...y}=g,v=Z.useRef(null),A=st(h,v),R=i(l,w);return Z.useEffect(()=>(R.itemMap.set(v,{ref:v,...y}),()=>void R.itemMap.delete(v))),C.jsx(m,{[u]:"",ref:A,children:b})});d.displayName=l;function p(g){const h=i(t+"CollectionConsumer",g);return Z.useCallback(()=>{const b=h.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(h.itemMap.values()).sort((R,P)=>y.indexOf(R.ref.current)-y.indexOf(P.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:s,Slot:f,ItemSlot:d},p,o]}var To=x.createContext(void 0);function Do(t){const e=x.useContext(To);return t||e||"ltr"}var Et="rovingFocusGroup.onEntryFocus",Io={bubbles:!1,cancelable:!0},ft="RovingFocusGroup",[Mt,De,Mo]=Eo(ft),[No]=Nt(ft,[Mo]),[Fo,Lo]=No(ft),Ie=x.forwardRef((t,e)=>C.jsx(Mt.Provider,{scope:t.__scopeRovingFocusGroup,children:C.jsx(Mt.Slot,{scope:t.__scopeRovingFocusGroup,children:C.jsx(_o,{...t,ref:e})})}));Ie.displayName=ft;var _o=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:a,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...u}=t,m=x.useRef(null),d=st(e,m),p=Do(i),[g,h]=qe({prop:s,defaultProp:c??null,onChange:a,caller:ft}),[w,b]=x.useState(!1),y=ce(f),v=De(n),A=x.useRef(!1),[R,P]=x.useState(0);return x.useEffect(()=>{const O=m.current;if(O)return O.addEventListener(Et,y),()=>O.removeEventListener(Et,y)},[y]),C.jsx(Fo,{scope:n,orientation:o,dir:p,loop:r,currentTabStopId:g,onItemFocus:x.useCallback(O=>h(O),[h]),onItemShiftTab:x.useCallback(()=>b(!0),[]),onFocusableItemAdd:x.useCallback(()=>P(O=>O+1),[]),onFocusableItemRemove:x.useCallback(()=>P(O=>O-1),[]),children:C.jsx(lt.div,{tabIndex:w||R===0?-1:0,"data-orientation":o,...u,ref:d,style:{outline:"none",...t.style},onMouseDown:tt(t.onMouseDown,()=>{A.current=!0}),onFocus:tt(t.onFocus,O=>{const L=!A.current;if(O.target===O.currentTarget&&L&&!w){const D=new CustomEvent(Et,Io);if(O.currentTarget.dispatchEvent(D),!D.defaultPrevented){const M=v().filter(E=>E.focusable),F=M.find(E=>E.active),I=M.find(E=>E.id===g),$=[F,I,...M].filter(Boolean).map(E=>E.ref.current);Fe($,l)}}A.current=!1}),onBlur:tt(t.onBlur,()=>b(!1))})})}),Me="RovingFocusGroupItem",Ne=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:i,children:s,...c}=t,a=Ue(),f=i||a,l=Lo(Me,n),u=l.currentTabStopId===f,m=De(n),{onFocusableItemAdd:d,onFocusableItemRemove:p,currentTabStopId:g}=l;return x.useEffect(()=>{if(o)return d(),()=>p()},[o,d,p]),C.jsx(Mt.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:C.jsx(lt.span,{tabIndex:u?0:-1,"data-orientation":l.orientation,...c,ref:e,onMouseDown:tt(t.onMouseDown,h=>{o?l.onItemFocus(f):h.preventDefault()}),onFocus:tt(t.onFocus,()=>l.onItemFocus(f)),onKeyDown:tt(t.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const w=ko(h,l.orientation,l.dir);if(w!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let y=m().filter(v=>v.focusable).map(v=>v.ref.current);if(w==="last")y.reverse();else if(w==="prev"||w==="next"){w==="prev"&&y.reverse();const v=y.indexOf(h.currentTarget);y=l.loop?Wo(y,v+1):y.slice(v+1)}setTimeout(()=>Fe(y))}}),children:typeof s=="function"?s({isCurrentTabStop:u,hasTabStop:g!=null}):s})})});Ne.displayName=Me;var $o={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function jo(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function ko(t,e,n){const o=jo(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return $o[o]}function Fe(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}function Wo(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Ho=Ie,Bo=Ne;const Xo=({icon:t,children:e,onClick:n,danger:o,disabled:r,checked:i,note:s,trailing:c})=>C.jsx(Bo,{asChild:!0,focusable:!r,active:!1,children:C.jsxs("button",{type:"button",role:i===void 0?"menuitem":"menuitemradio","aria-checked":i,className:`menu-item${o?" menu-item-danger":""}`,onClick:n,disabled:r,children:[i!==void 0&&C.jsx("span",{className:"menu-item-check","aria-hidden":"true",children:i&&C.jsx(Ze,{size:12})}),t&&C.jsx("span",{className:"menu-item-icon",children:t}),C.jsxs("span",{className:"menu-item-label",children:[e,s&&C.jsx("span",{className:"menu-item-note",children:s})]}),c!==void 0&&C.jsx("span",{className:"menu-item-trailing",children:c})]})}),Go=()=>C.jsx("div",{className:"menu-divider",role:"separator"}),Uo=({children:t})=>C.jsx(Ho,{asChild:!0,orientation:"vertical",loop:!0,children:C.jsx("div",{className:"menu",role:"menu",children:t})});export{Uo as M,Ko as P,Xo as a,Go as b};
1
+ import{r as x,x as Ve,j as C,a1 as Ye,a0 as Ke,R as Z}from"./index-B1iJx0w1.js";import{P as lt,b as ht,a as st,u as ce,f as Nt,i as Xe,D as Ge,g as Ut,d as Ue,e as tt,c as qe}from"./index-Bgx65Mb_.js";import{C as Ze}from"./check-Bq0QWhtG.js";const Je=["top","right","bottom","left"],U=Math.min,j=Math.max,gt=Math.round,mt=Math.floor,V=t=>({x:t,y:t}),Qe={left:"right",right:"left",bottom:"top",top:"bottom"};function Tt(t,e,n){return j(t,U(e,n))}function K(t,e){return typeof t=="function"?t(e):t}function X(t){return t.split("-")[0]}function ot(t){return t.split("-")[1]}function Ft(t){return t==="x"?"y":"x"}function Lt(t){return t==="y"?"height":"width"}function z(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function _t(t){return Ft(z(t))}function tn(t,e,n){n===void 0&&(n=!1);const o=ot(t),r=_t(t),i=Lt(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=wt(s)),[s,wt(s)]}function en(t){const e=wt(t);return[Dt(t),e,Dt(e)]}function Dt(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const qt=["left","right"],Zt=["right","left"],nn=["top","bottom"],on=["bottom","top"];function rn(t,e,n){switch(t){case"top":case"bottom":return n?e?Zt:qt:e?qt:Zt;case"left":case"right":return e?nn:on;default:return[]}}function sn(t,e,n,o){const r=ot(t);let i=rn(X(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Dt)))),i}function wt(t){const e=X(t);return Qe[e]+t.slice(e.length)}function cn(t){return{top:0,right:0,bottom:0,left:0,...t}}function le(t){return typeof t!="number"?cn(t):{top:t,right:t,bottom:t,left:t}}function xt(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function Jt(t,e,n){let{reference:o,floating:r}=t;const i=z(e),s=_t(e),c=Lt(s),a=X(e),f=i==="y",l=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,m=o[c]/2-r[c]/2;let d;switch(a){case"top":d={x:l,y:o.y-r.height};break;case"bottom":d={x:l,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-r.width,y:u};break;default:d={x:o.x,y:o.y}}switch(ot(e)){case"start":d[s]-=m*(n&&f?-1:1);break;case"end":d[s]+=m*(n&&f?-1:1);break}return d}async function ln(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:a}=t,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:u="floating",altBoundary:m=!1,padding:d=0}=K(e,t),p=le(d),h=c[m?u==="floating"?"reference":"floating":u],w=xt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:f,rootBoundary:l,strategy:a})),b=u==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),v=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},A=xt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:y,strategy:a}):b);return{top:(w.top-A.top+p.top)/v.y,bottom:(A.bottom-w.bottom+p.bottom)/v.y,left:(w.left-A.left+p.left)/v.x,right:(A.right-w.right+p.right)/v.x}}const an=50,fn=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:ln},a=await(s.isRTL==null?void 0:s.isRTL(e));let f=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:l,y:u}=Jt(f,o,a),m=o,d=0;const p={};for(let g=0;g<i.length;g++){const h=i[g];if(!h)continue;const{name:w,fn:b}=h,{x:y,y:v,data:A,reset:R}=await b({x:l,y:u,initialPlacement:o,placement:m,strategy:r,middlewareData:p,rects:f,platform:c,elements:{reference:t,floating:e}});l=y??l,u=v??u,p[w]={...p[w],...A},R&&d<an&&(d++,typeof R=="object"&&(R.placement&&(m=R.placement),R.rects&&(f=R.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):R.rects),{x:l,y:u}=Jt(f,m,a)),g=-1)}return{x:l,y:u,placement:m,strategy:r,middlewareData:p}},un=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:i,platform:s,elements:c,middlewareData:a}=e,{element:f,padding:l=0}=K(t,e)||{};if(f==null)return{};const u=le(l),m={x:n,y:o},d=_t(r),p=Lt(d),g=await s.getDimensions(f),h=d==="y",w=h?"top":"left",b=h?"bottom":"right",y=h?"clientHeight":"clientWidth",v=i.reference[p]+i.reference[d]-m[d]-i.floating[p],A=m[d]-i.reference[d],R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let P=R?R[y]:0;(!P||!await(s.isElement==null?void 0:s.isElement(R)))&&(P=c.floating[y]||i.floating[p]);const O=v/2-A/2,L=P/2-g[p]/2-1,D=U(u[w],L),M=U(u[b],L),F=D,I=P-g[p]-M,T=P/2-g[p]/2+O,$=Tt(F,T,I),E=!a.arrow&&ot(r)!=null&&T!==$&&i.reference[p]/2-(T<F?D:M)-g[p]/2<0,N=E?T<F?T-F:T-I:0;return{[d]:m[d]+N,data:{[d]:$,centerOffset:T-$-N,...E&&{alignmentOffset:N}},reset:E}}}),dn=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:a,elements:f}=e,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...h}=K(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=X(r),b=z(c),y=X(c)===c,v=await(a.isRTL==null?void 0:a.isRTL(f.floating)),A=m||(y||!g?[wt(c)]:en(c)),R=p!=="none";!m&&R&&A.push(...sn(c,g,p,v));const P=[c,...A],O=await a.detectOverflow(e,h),L=[];let D=((o=i.flip)==null?void 0:o.overflows)||[];if(l&&L.push(O[w]),u){const T=tn(r,s,v);L.push(O[T[0]],O[T[1]])}if(D=[...D,{placement:r,overflows:L}],!L.every(T=>T<=0)){var M,F;const T=(((M=i.flip)==null?void 0:M.index)||0)+1,$=P[T];if($&&(!(u==="alignment"?b!==z($):!1)||D.every(S=>z(S.placement)===b?S.overflows[0]>0:!0)))return{data:{index:T,overflows:D},reset:{placement:$}};let E=(F=D.filter(N=>N.overflows[0]<=0).sort((N,S)=>N.overflows[1]-S.overflows[1])[0])==null?void 0:F.placement;if(!E)switch(d){case"bestFit":{var I;const N=(I=D.filter(S=>{if(R){const _=z(S.placement);return _===b||_==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(_=>_>0).reduce((_,B)=>_+B,0)]).sort((S,_)=>S[1]-_[1])[0])==null?void 0:I[0];N&&(E=N);break}case"initialPlacement":E=c;break}if(r!==E)return{reset:{placement:E}}}return{}}}};function Qt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function te(t){return Je.some(e=>t[e]>=0)}const mn=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...i}=K(t,e);switch(r){case"referenceHidden":{const s=await o.detectOverflow(e,{...i,elementContext:"reference"}),c=Qt(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:te(c)}}}case"escaped":{const s=await o.detectOverflow(e,{...i,altBoundary:!0}),c=Qt(s,n.floating);return{data:{escapedOffsets:c,escaped:te(c)}}}default:return{}}}}},ae=new Set(["left","top"]);async function pn(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=X(n),c=ot(n),a=z(n)==="y",f=ae.has(s)?-1:1,l=i&&a?-1:1,u=K(e,t);let{mainAxis:m,crossAxis:d,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),a?{x:d*l,y:m*f}:{x:m*f,y:d*l}}const hn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=e,a=await pn(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:s}}}}},gn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:i}=e,{mainAxis:s=!0,crossAxis:c=!1,limiter:a={fn:w=>{let{x:b,y}=w;return{x:b,y}}},...f}=K(t,e),l={x:n,y:o},u=await i.detectOverflow(e,f),m=z(X(r)),d=Ft(m);let p=l[d],g=l[m];if(s){const w=d==="y"?"top":"left",b=d==="y"?"bottom":"right",y=p+u[w],v=p-u[b];p=Tt(y,p,v)}if(c){const w=m==="y"?"top":"left",b=m==="y"?"bottom":"right",y=g+u[w],v=g-u[b];g=Tt(y,g,v)}const h=a.fn({...e,[d]:p,[m]:g});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:s,[m]:c}}}}}},wn=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:i,middlewareData:s}=e,{offset:c=0,mainAxis:a=!0,crossAxis:f=!0}=K(t,e),l={x:n,y:o},u=z(r),m=Ft(u);let d=l[m],p=l[u];const g=K(c,e),h=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const y=m==="y"?"height":"width",v=i.reference[m]-i.floating[y]+h.mainAxis,A=i.reference[m]+i.reference[y]-h.mainAxis;d<v?d=v:d>A&&(d=A)}if(f){var w,b;const y=m==="y"?"width":"height",v=ae.has(X(r)),A=i.reference[u]-i.floating[y]+(v&&((w=s.offset)==null?void 0:w[u])||0)+(v?0:h.crossAxis),R=i.reference[u]+i.reference[y]+(v?0:((b=s.offset)==null?void 0:b[u])||0)-(v?h.crossAxis:0);p<A?p=A:p>R&&(p=R)}return{[m]:d,[u]:p}}}},xn=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:s,elements:c}=e,{apply:a=()=>{},...f}=K(t,e),l=await s.detectOverflow(e,f),u=X(r),m=ot(r),d=z(r)==="y",{width:p,height:g}=i.floating;let h,w;u==="top"||u==="bottom"?(h=u,w=m===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(w=u,h=m==="end"?"top":"bottom");const b=g-l.top-l.bottom,y=p-l.left-l.right,v=U(g-l[h],b),A=U(p-l[w],y),R=!e.middlewareData.shift;let P=v,O=A;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(O=y),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(P=b),R&&!m){const D=j(l.left,0),M=j(l.right,0),F=j(l.top,0),I=j(l.bottom,0);d?O=p-2*(D!==0||M!==0?D+M:j(l.left,l.right)):P=g-2*(F!==0||I!==0?F+I:j(l.top,l.bottom))}await a({...e,availableWidth:O,availableHeight:P});const L=await s.getDimensions(c.floating);return p!==L.width||g!==L.height?{reset:{rects:!0}}:{}}}};function bt(){return typeof window<"u"}function rt(t){return fe(t)?(t.nodeName||"").toLowerCase():"#document"}function k(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Y(t){var e;return(e=(fe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function fe(t){return bt()?t instanceof Node||t instanceof k(t).Node:!1}function W(t){return bt()?t instanceof Element||t instanceof k(t).Element:!1}function G(t){return bt()?t instanceof HTMLElement||t instanceof k(t).HTMLElement:!1}function ee(t){return!bt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof k(t).ShadowRoot}function at(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&r!=="inline"&&r!=="contents"}function yn(t){return/^(table|td|th)$/.test(rt(t))}function Rt(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const vn=/transform|translate|scale|rotate|perspective|filter/,bn=/paint|layout|strict|content/,J=t=>!!t&&t!=="none";let St;function $t(t){const e=W(t)?H(t):t;return J(e.transform)||J(e.translate)||J(e.scale)||J(e.rotate)||J(e.perspective)||!jt()&&(J(e.backdropFilter)||J(e.filter))||vn.test(e.willChange||"")||bn.test(e.contain||"")}function Rn(t){let e=q(t);for(;G(e)&&!nt(e);){if($t(e))return e;if(Rt(e))return null;e=q(e)}return null}function jt(){return St==null&&(St=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),St}function nt(t){return/^(html|body|#document)$/.test(rt(t))}function H(t){return k(t).getComputedStyle(t)}function At(t){return W(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q(t){if(rt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||ee(t)&&t.host||Y(t);return ee(e)?e.host:e}function ue(t){const e=q(t);return nt(e)?t.ownerDocument?t.ownerDocument.body:t.body:G(e)&&at(e)?e:ue(e)}function ct(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=ue(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=k(r);if(i){const c=It(s);return e.concat(s,s.visualViewport||[],at(r)?r:[],c&&n?ct(c):[])}else return e.concat(r,ct(r,[],n))}function It(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function de(t){const e=H(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=G(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,c=gt(n)!==i||gt(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function kt(t){return W(t)?t:t.contextElement}function et(t){const e=kt(t);if(!G(e))return V(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=de(e);let s=(i?gt(n.width):n.width)/o,c=(i?gt(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const An=V(0);function me(t){const e=k(t);return!jt()||!e.visualViewport?An:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Cn(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==k(t)?!1:e}function Q(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=kt(t);let s=V(1);e&&(o?W(o)&&(s=et(o)):s=et(t));const c=Cn(i,n,o)?me(i):V(0);let a=(r.left+c.x)/s.x,f=(r.top+c.y)/s.y,l=r.width/s.x,u=r.height/s.y;if(i){const m=k(i),d=o&&W(o)?k(o):o;let p=m,g=It(p);for(;g&&o&&d!==p;){const h=et(g),w=g.getBoundingClientRect(),b=H(g),y=w.left+(g.clientLeft+parseFloat(b.paddingLeft))*h.x,v=w.top+(g.clientTop+parseFloat(b.paddingTop))*h.y;a*=h.x,f*=h.y,l*=h.x,u*=h.y,a+=y,f+=v,p=k(g),g=It(p)}}return xt({width:l,height:u,x:a,y:f})}function Ct(t,e){const n=At(t).scrollLeft;return e?e.left+n:Q(Y(t)).left+n}function pe(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Ct(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function Sn(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=Y(o),c=e?Rt(e.floating):!1;if(o===s||c&&i)return n;let a={scrollLeft:0,scrollTop:0},f=V(1);const l=V(0),u=G(o);if((u||!u&&!i)&&((rt(o)!=="body"||at(s))&&(a=At(o)),u)){const d=Q(o);f=et(o),l.x=d.x+o.clientLeft,l.y=d.y+o.clientTop}const m=s&&!u&&!i?pe(s,a):V(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+l.x+m.x,y:n.y*f.y-a.scrollTop*f.y+l.y+m.y}}function On(t){return Array.from(t.getClientRects())}function Pn(t){const e=Y(t),n=At(t),o=t.ownerDocument.body,r=j(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=j(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Ct(t);const c=-n.scrollTop;return H(o).direction==="rtl"&&(s+=j(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}const ne=25;function En(t,e){const n=k(t),o=Y(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,a=0;if(r){i=r.width,s=r.height;const l=jt();(!l||l&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}const f=Ct(o);if(f<=0){const l=o.ownerDocument,u=l.body,m=getComputedStyle(u),d=l.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-u.clientWidth-d);p<=ne&&(i-=p)}else f<=ne&&(i+=f);return{width:i,height:s,x:c,y:a}}function Tn(t,e){const n=Q(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=G(t)?et(t):V(1),s=t.clientWidth*i.x,c=t.clientHeight*i.y,a=r*i.x,f=o*i.y;return{width:s,height:c,x:a,y:f}}function oe(t,e,n){let o;if(e==="viewport")o=En(t,n);else if(e==="document")o=Pn(Y(t));else if(W(e))o=Tn(e,n);else{const r=me(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return xt(o)}function he(t,e){const n=q(t);return n===e||!W(n)||nt(n)?!1:H(n).position==="fixed"||he(n,e)}function Dn(t,e){const n=e.get(t);if(n)return n;let o=ct(t,[],!1).filter(c=>W(c)&&rt(c)!=="body"),r=null;const i=H(t).position==="fixed";let s=i?q(t):t;for(;W(s)&&!nt(s);){const c=H(s),a=$t(s);!a&&c.position==="fixed"&&(r=null),(i?!a&&!r:!a&&c.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||at(s)&&!a&&he(t,s))?o=o.filter(l=>l!==s):r=c,s=q(s)}return e.set(t,o),o}function In(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const s=[...n==="clippingAncestors"?Rt(e)?[]:Dn(e,this._c):[].concat(n),o],c=oe(e,s[0],r);let a=c.top,f=c.right,l=c.bottom,u=c.left;for(let m=1;m<s.length;m++){const d=oe(e,s[m],r);a=j(d.top,a),f=U(d.right,f),l=U(d.bottom,l),u=j(d.left,u)}return{width:f-u,height:l-a,x:u,y:a}}function Mn(t){const{width:e,height:n}=de(t);return{width:e,height:n}}function Nn(t,e,n){const o=G(e),r=Y(e),i=n==="fixed",s=Q(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const a=V(0);function f(){a.x=Ct(r)}if(o||!o&&!i)if((rt(e)!=="body"||at(r))&&(c=At(e)),o){const d=Q(e,!0,i,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else r&&f();i&&!o&&r&&f();const l=r&&!o&&!i?pe(r,c):V(0),u=s.left+c.scrollLeft-a.x-l.x,m=s.top+c.scrollTop-a.y-l.y;return{x:u,y:m,width:s.width,height:s.height}}function Ot(t){return H(t).position==="static"}function re(t,e){if(!G(t)||H(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Y(t)===n&&(n=n.ownerDocument.body),n}function ge(t,e){const n=k(t);if(Rt(t))return n;if(!G(t)){let r=q(t);for(;r&&!nt(r);){if(W(r)&&!Ot(r))return r;r=q(r)}return n}let o=re(t,e);for(;o&&yn(o)&&Ot(o);)o=re(o,e);return o&&nt(o)&&Ot(o)&&!$t(o)?n:o||Rn(t)||n}const Fn=async function(t){const e=this.getOffsetParent||ge,n=this.getDimensions,o=await n(t.floating);return{reference:Nn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ln(t){return H(t).direction==="rtl"}const _n={convertOffsetParentRelativeRectToViewportRelativeRect:Sn,getDocumentElement:Y,getClippingRect:In,getOffsetParent:ge,getElementRects:Fn,getClientRects:On,getDimensions:Mn,getScale:et,isElement:W,isRTL:Ln};function we(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function $n(t,e){let n=null,o;const r=Y(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),i();const f=t.getBoundingClientRect(),{left:l,top:u,width:m,height:d}=f;if(c||e(),!m||!d)return;const p=mt(u),g=mt(r.clientWidth-(l+m)),h=mt(r.clientHeight-(u+d)),w=mt(l),y={rootMargin:-p+"px "+-g+"px "+-h+"px "+-w+"px",threshold:j(0,U(1,a))||1};let v=!0;function A(R){const P=R[0].intersectionRatio;if(P!==a){if(!v)return s();P?s(!1,P):o=setTimeout(()=>{s(!1,1e-7)},1e3)}P===1&&!we(f,t.getBoundingClientRect())&&s(),v=!1}try{n=new IntersectionObserver(A,{...y,root:r.ownerDocument})}catch{n=new IntersectionObserver(A,y)}n.observe(t)}return s(!0),i}function jn(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,f=kt(t),l=r||i?[...f?ct(f):[],...e?ct(e):[]]:[];l.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const u=f&&c?$n(f,n):null;let m=-1,d=null;s&&(d=new ResizeObserver(w=>{let[b]=w;b&&b.target===f&&d&&e&&(d.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=d)==null||y.observe(e)})),n()}),f&&!a&&d.observe(f),e&&d.observe(e));let p,g=a?Q(t):null;a&&h();function h(){const w=Q(t);g&&!we(g,w)&&n(),g=w,p=requestAnimationFrame(h)}return n(),()=>{var w;l.forEach(b=>{r&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),u==null||u(),(w=d)==null||w.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const kn=hn,Wn=gn,Hn=dn,Bn=xn,zn=mn,ie=un,Vn=wn,Yn=(t,e,n)=>{const o=new Map,r={platform:_n,...n},i={...r.platform,_c:o};return fn(t,e,{...r,platform:i})};var Kn=typeof document<"u",Xn=function(){},pt=Kn?x.useLayoutEffect:Xn;function yt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!yt(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&t.$$typeof)&&!yt(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function xe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function se(t,e){const n=xe(t);return Math.round(e*n)/n}function Pt(t){const e=x.useRef(t);return pt(()=>{e.current=t}),e}function Gn(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:a,open:f}=t,[l,u]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,d]=x.useState(o);yt(m,o)||d(o);const[p,g]=x.useState(null),[h,w]=x.useState(null),b=x.useCallback(S=>{S!==R.current&&(R.current=S,g(S))},[]),y=x.useCallback(S=>{S!==P.current&&(P.current=S,w(S))},[]),v=i||p,A=s||h,R=x.useRef(null),P=x.useRef(null),O=x.useRef(l),L=a!=null,D=Pt(a),M=Pt(r),F=Pt(f),I=x.useCallback(()=>{if(!R.current||!P.current)return;const S={placement:e,strategy:n,middleware:m};M.current&&(S.platform=M.current),Yn(R.current,P.current,S).then(_=>{const B={..._,isPositioned:F.current!==!1};T.current&&!yt(O.current,B)&&(O.current=B,Ve.flushSync(()=>{u(B)}))})},[m,e,n,M,F]);pt(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,u(S=>({...S,isPositioned:!1})))},[f]);const T=x.useRef(!1);pt(()=>(T.current=!0,()=>{T.current=!1}),[]),pt(()=>{if(v&&(R.current=v),A&&(P.current=A),v&&A){if(D.current)return D.current(v,A,I);I()}},[v,A,I,D,L]);const $=x.useMemo(()=>({reference:R,floating:P,setReference:b,setFloating:y}),[b,y]),E=x.useMemo(()=>({reference:v,floating:A}),[v,A]),N=x.useMemo(()=>{const S={position:n,left:0,top:0};if(!E.floating)return S;const _=se(E.floating,l.x),B=se(E.floating,l.y);return c?{...S,transform:"translate("+_+"px, "+B+"px)",...xe(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:B}},[n,c,E.floating,l.x,l.y]);return x.useMemo(()=>({...l,update:I,refs:$,elements:E,floatingStyles:N}),[l,I,$,E,N])}const Un=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:r}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?ie({element:o.current,padding:r}).fn(n):{}:o?ie({element:o,padding:r}).fn(n):{}}}},qn=(t,e)=>{const n=kn(t);return{name:n.name,fn:n.fn,options:[t,e]}},Zn=(t,e)=>{const n=Wn(t);return{name:n.name,fn:n.fn,options:[t,e]}},Jn=(t,e)=>({fn:Vn(t).fn,options:[t,e]}),Qn=(t,e)=>{const n=Hn(t);return{name:n.name,fn:n.fn,options:[t,e]}},to=(t,e)=>{const n=Bn(t);return{name:n.name,fn:n.fn,options:[t,e]}},eo=(t,e)=>{const n=zn(t);return{name:n.name,fn:n.fn,options:[t,e]}},no=(t,e)=>{const n=Un(t);return{name:n.name,fn:n.fn,options:[t,e]}};var oo="Arrow",ye=x.forwardRef((t,e)=>{const{children:n,width:o=10,height:r=5,...i}=t;return C.jsx(lt.svg,{...i,ref:e,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:C.jsx("polygon",{points:"0,0 30,0 15,10"})})});ye.displayName=oo;var ro=ye;function io(t){const[e,n]=x.useState(void 0);return ht(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let s,c;if("borderBoxSize"in i){const a=i.borderBoxSize,f=Array.isArray(a)?a[0]:a;s=f.inlineSize,c=f.blockSize}else s=t.offsetWidth,c=t.offsetHeight;n({width:s,height:c})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}var Wt="Popper",[ve]=Nt(Wt),[so,be]=ve(Wt),Re=t=>{const{__scopePopper:e,children:n}=t,[o,r]=x.useState(null);return C.jsx(so,{scope:e,anchor:o,onAnchorChange:r,children:n})};Re.displayName=Wt;var Ae="PopperAnchor",Ce=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...r}=t,i=be(Ae,n),s=x.useRef(null),c=st(e,s),a=x.useRef(null);return x.useEffect(()=>{const f=a.current;a.current=(o==null?void 0:o.current)||s.current,f!==a.current&&i.onAnchorChange(a.current)}),o?null:C.jsx(lt.div,{...r,ref:c})});Ce.displayName=Ae;var Ht="PopperContent",[co,lo]=ve(Ht),Se=x.forwardRef((t,e)=>{var Bt,zt,Vt,Yt,Kt,Xt;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:i="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:a=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:u="partial",hideWhenDetached:m=!1,updatePositionStrategy:d="optimized",onPlaced:p,...g}=t,h=be(Ht,n),[w,b]=x.useState(null),y=st(e,it=>b(it)),[v,A]=x.useState(null),R=io(v),P=(R==null?void 0:R.width)??0,O=(R==null?void 0:R.height)??0,L=o+(i!=="center"?"-"+i:""),D=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},M=Array.isArray(f)?f:[f],F=M.length>0,I={padding:D,boundary:M.filter(uo),altBoundary:F},{refs:T,floatingStyles:$,placement:E,isPositioned:N,middlewareData:S}=Gn({strategy:"fixed",placement:L,whileElementsMounted:(...it)=>jn(...it,{animationFrame:d==="always"}),elements:{reference:h.anchor},middleware:[qn({mainAxis:r+O,alignmentAxis:s}),a&&Zn({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Jn():void 0,...I}),a&&Qn({...I}),to({...I,apply:({elements:it,rects:Gt,availableWidth:We,availableHeight:He})=>{const{width:Be,height:ze}=Gt.reference,dt=it.floating.style;dt.setProperty("--radix-popper-available-width",`${We}px`),dt.setProperty("--radix-popper-available-height",`${He}px`),dt.setProperty("--radix-popper-anchor-width",`${Be}px`),dt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),v&&no({element:v,padding:c}),mo({arrowWidth:P,arrowHeight:O}),m&&eo({strategy:"referenceHidden",...I})]}),[_,B]=Pe(E),ut=ce(p);ht(()=>{N&&(ut==null||ut())},[N,ut]);const Le=(Bt=S.arrow)==null?void 0:Bt.x,_e=(zt=S.arrow)==null?void 0:zt.y,$e=((Vt=S.arrow)==null?void 0:Vt.centerOffset)!==0,[je,ke]=x.useState();return ht(()=>{w&&ke(window.getComputedStyle(w).zIndex)},[w]),C.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:N?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:je,"--radix-popper-transform-origin":[(Yt=S.transformOrigin)==null?void 0:Yt.x,(Kt=S.transformOrigin)==null?void 0:Kt.y].join(" "),...((Xt=S.hide)==null?void 0:Xt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:C.jsx(co,{scope:n,placedSide:_,onArrowChange:A,arrowX:Le,arrowY:_e,shouldHideArrow:$e,children:C.jsx(lt.div,{"data-side":_,"data-align":B,...g,ref:y,style:{...g.style,animation:N?void 0:"none"}})})})});Se.displayName=Ht;var Oe="PopperArrow",ao={top:"bottom",right:"left",bottom:"top",left:"right"},fo=x.forwardRef(function(e,n){const{__scopePopper:o,...r}=e,i=lo(Oe,o),s=ao[i.placedSide];return C.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:C.jsx(ro,{...r,ref:n,style:{...r.style,display:"block"}})})});fo.displayName=Oe;function uo(t){return t!==null}var mo=t=>({name:"transformOrigin",options:t,fn(e){var h,w,b;const{placement:n,rects:o,middlewareData:r}=e,s=((h=r.arrow)==null?void 0:h.centerOffset)!==0,c=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[f,l]=Pe(n),u={start:"0%",center:"50%",end:"100%"}[l],m=(((w=r.arrow)==null?void 0:w.x)??0)+c/2,d=(((b=r.arrow)==null?void 0:b.y)??0)+a/2;let p="",g="";return f==="bottom"?(p=s?u:`${m}px`,g=`${-a}px`):f==="top"?(p=s?u:`${m}px`,g=`${o.floating.height+a}px`):f==="right"?(p=`${-a}px`,g=s?u:`${d}px`):f==="left"&&(p=`${o.floating.width+a}px`,g=s?u:`${d}px`),{data:{x:p,y:g}}}});function Pe(t){const[e,n="center"]=t.split("-");return[e,n]}var po=Re,ho=Ce,go=Se,wo=Symbol.for("react.lazy"),vt=Ye[" use ".trim().toString()];function xo(t){return typeof t=="object"&&t!==null&&"then"in t}function Ee(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===wo&&"_payload"in t&&xo(t._payload)}function yo(t){const e=vo(t),n=x.forwardRef((o,r)=>{let{children:i,...s}=o;Ee(i)&&typeof vt=="function"&&(i=vt(i._payload));const c=x.Children.toArray(i),a=c.find(Ro);if(a){const f=a.props.children,l=c.map(u=>u===a?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:u);return C.jsx(e,{...s,ref:r,children:x.isValidElement(f)?x.cloneElement(f,void 0,l):null})}return C.jsx(e,{...s,ref:r,children:i})});return n.displayName=`${t}.Slot`,n}function vo(t){const e=x.forwardRef((n,o)=>{let{children:r,...i}=n;if(Ee(r)&&typeof vt=="function"&&(r=vt(r._payload)),x.isValidElement(r)){const s=Co(r),c=Ao(i,r.props);return r.type!==x.Fragment&&(c.ref=o?Xe(o,s):s),x.cloneElement(r,c)}return x.Children.count(r)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var bo=Symbol("radix.slottable");function Ro(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bo}function Ao(t,e){const n={...e};for(const o in e){const r=t[o],i=e[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...c)=>{const a=i(...c);return r(...c),a}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...t,...n}}function Co(t){var o,r;let e=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var So=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oo=So.reduce((t,e)=>{const n=yo(`Primitive.${e}`),o=x.forwardRef((r,i)=>{const{asChild:s,...c}=r,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(a,{...c,ref:i})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{}),Po="Portal",Te=x.forwardRef((t,e)=>{var c;const{container:n,...o}=t,[r,i]=x.useState(!1);ht(()=>i(!0),[]);const s=n||r&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return s?Ke.createPortal(C.jsx(Oo.div,{...o,ref:e}),s):null});Te.displayName=Po;const Ko=({open:t,onClose:e,anchorRef:n,placement:o="bottom-end",children:r})=>{const i=x.useRef(null);if(x.useEffect(()=>{if(!t)return;const f=l=>{var u,m;t&&((u=i.current)!=null&&u.contains(l.target)||(m=n.current)!=null&&m.contains(l.target)||e())};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[t,e,n]),!t)return null;const s=o.startsWith("top")?"top":"bottom",c=o.endsWith("end")?"end":"start",a=o.startsWith("top")?8:4;return C.jsxs(po,{children:[C.jsx(ho,{virtualRef:n}),C.jsx(Te,{children:C.jsx(Ge,{onEscapeKeyDown:f=>{f.preventDefault(),e()},onPointerDownOutside:f=>{var l;if((l=n.current)!=null&&l.contains(f.target)){f.preventDefault();return}e()},children:C.jsx(go,{ref:i,side:s,align:c,sideOffset:a,className:`popover popover-${o}`,role:"dialog",children:r})})})]})};function Eo(t){const e=t+"CollectionProvider",[n,o]=Nt(e),[r,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:h,children:w}=g,b=Z.useRef(null),y=Z.useRef(new Map).current;return C.jsx(r,{scope:h,itemMap:y,collectionRef:b,children:w})};s.displayName=e;const c=t+"CollectionSlot",a=Ut(c),f=Z.forwardRef((g,h)=>{const{scope:w,children:b}=g,y=i(c,w),v=st(h,y.collectionRef);return C.jsx(a,{ref:v,children:b})});f.displayName=c;const l=t+"CollectionItemSlot",u="data-radix-collection-item",m=Ut(l),d=Z.forwardRef((g,h)=>{const{scope:w,children:b,...y}=g,v=Z.useRef(null),A=st(h,v),R=i(l,w);return Z.useEffect(()=>(R.itemMap.set(v,{ref:v,...y}),()=>void R.itemMap.delete(v))),C.jsx(m,{[u]:"",ref:A,children:b})});d.displayName=l;function p(g){const h=i(t+"CollectionConsumer",g);return Z.useCallback(()=>{const b=h.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(h.itemMap.values()).sort((R,P)=>y.indexOf(R.ref.current)-y.indexOf(P.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:s,Slot:f,ItemSlot:d},p,o]}var To=x.createContext(void 0);function Do(t){const e=x.useContext(To);return t||e||"ltr"}var Et="rovingFocusGroup.onEntryFocus",Io={bubbles:!1,cancelable:!0},ft="RovingFocusGroup",[Mt,De,Mo]=Eo(ft),[No]=Nt(ft,[Mo]),[Fo,Lo]=No(ft),Ie=x.forwardRef((t,e)=>C.jsx(Mt.Provider,{scope:t.__scopeRovingFocusGroup,children:C.jsx(Mt.Slot,{scope:t.__scopeRovingFocusGroup,children:C.jsx(_o,{...t,ref:e})})}));Ie.displayName=ft;var _o=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:a,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...u}=t,m=x.useRef(null),d=st(e,m),p=Do(i),[g,h]=qe({prop:s,defaultProp:c??null,onChange:a,caller:ft}),[w,b]=x.useState(!1),y=ce(f),v=De(n),A=x.useRef(!1),[R,P]=x.useState(0);return x.useEffect(()=>{const O=m.current;if(O)return O.addEventListener(Et,y),()=>O.removeEventListener(Et,y)},[y]),C.jsx(Fo,{scope:n,orientation:o,dir:p,loop:r,currentTabStopId:g,onItemFocus:x.useCallback(O=>h(O),[h]),onItemShiftTab:x.useCallback(()=>b(!0),[]),onFocusableItemAdd:x.useCallback(()=>P(O=>O+1),[]),onFocusableItemRemove:x.useCallback(()=>P(O=>O-1),[]),children:C.jsx(lt.div,{tabIndex:w||R===0?-1:0,"data-orientation":o,...u,ref:d,style:{outline:"none",...t.style},onMouseDown:tt(t.onMouseDown,()=>{A.current=!0}),onFocus:tt(t.onFocus,O=>{const L=!A.current;if(O.target===O.currentTarget&&L&&!w){const D=new CustomEvent(Et,Io);if(O.currentTarget.dispatchEvent(D),!D.defaultPrevented){const M=v().filter(E=>E.focusable),F=M.find(E=>E.active),I=M.find(E=>E.id===g),$=[F,I,...M].filter(Boolean).map(E=>E.ref.current);Fe($,l)}}A.current=!1}),onBlur:tt(t.onBlur,()=>b(!1))})})}),Me="RovingFocusGroupItem",Ne=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:i,children:s,...c}=t,a=Ue(),f=i||a,l=Lo(Me,n),u=l.currentTabStopId===f,m=De(n),{onFocusableItemAdd:d,onFocusableItemRemove:p,currentTabStopId:g}=l;return x.useEffect(()=>{if(o)return d(),()=>p()},[o,d,p]),C.jsx(Mt.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:C.jsx(lt.span,{tabIndex:u?0:-1,"data-orientation":l.orientation,...c,ref:e,onMouseDown:tt(t.onMouseDown,h=>{o?l.onItemFocus(f):h.preventDefault()}),onFocus:tt(t.onFocus,()=>l.onItemFocus(f)),onKeyDown:tt(t.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const w=ko(h,l.orientation,l.dir);if(w!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let y=m().filter(v=>v.focusable).map(v=>v.ref.current);if(w==="last")y.reverse();else if(w==="prev"||w==="next"){w==="prev"&&y.reverse();const v=y.indexOf(h.currentTarget);y=l.loop?Wo(y,v+1):y.slice(v+1)}setTimeout(()=>Fe(y))}}),children:typeof s=="function"?s({isCurrentTabStop:u,hasTabStop:g!=null}):s})})});Ne.displayName=Me;var $o={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function jo(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function ko(t,e,n){const o=jo(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return $o[o]}function Fe(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}function Wo(t,e){return t.map((n,o)=>t[(e+o)%t.length])}var Ho=Ie,Bo=Ne;const Xo=({icon:t,children:e,onClick:n,danger:o,disabled:r,checked:i,note:s,trailing:c})=>C.jsx(Bo,{asChild:!0,focusable:!r,active:!1,children:C.jsxs("button",{type:"button",role:i===void 0?"menuitem":"menuitemradio","aria-checked":i,className:`menu-item${o?" menu-item-danger":""}`,onClick:n,disabled:r,children:[i!==void 0&&C.jsx("span",{className:"menu-item-check","aria-hidden":"true",children:i&&C.jsx(Ze,{size:12})}),t&&C.jsx("span",{className:"menu-item-icon",children:t}),C.jsxs("span",{className:"menu-item-label",children:[e,s&&C.jsx("span",{className:"menu-item-note",children:s})]}),c!==void 0&&C.jsx("span",{className:"menu-item-trailing",children:c})]})}),Go=()=>C.jsx("div",{className:"menu-divider",role:"separator"}),Uo=({children:t})=>C.jsx(Ho,{asChild:!0,orientation:"vertical",loop:!0,children:C.jsx("div",{className:"menu",role:"menu",children:t})});export{Uo as M,Ko as P,Xo as a,Go as b};
@@ -1,4 +1,4 @@
1
- import{r as c,j as f,a0 as ze,v as Ze}from"./index-rullcuA-.js";import{u as de,a as k,P,b as oe,c as qe,d as Z,e as _,f as Qe,g as Je,D as et,h as tt}from"./index-DC1NFStQ.js";var q="focusScope.autoFocusOnMount",Q="focusScope.autoFocusOnUnmount",fe={bubbles:!1,cancelable:!0},nt="FocusScope",Se=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[i,d]=c.useState(null),l=de(o),h=de(a),v=c.useRef(null),p=k(t,u=>d(u)),g=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(g.paused||!i)return;const C=b.target;i.contains(C)?v.current=C:D(v.current,{select:!0})},m=function(b){if(g.paused||!i)return;const C=b.relatedTarget;C!==null&&(i.contains(C)||D(v.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&D(i)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const E=new MutationObserver(y);return i&&E.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),E.disconnect()}}},[r,i,g.paused]),c.useEffect(()=>{if(i){me.add(g);const u=document.activeElement;if(!i.contains(u)){const y=new CustomEvent(q,fe);i.addEventListener(q,l),i.dispatchEvent(y),y.defaultPrevented||(rt(ut(we(i)),{select:!0}),document.activeElement===u&&D(i))}return()=>{i.removeEventListener(q,l),setTimeout(()=>{const y=new CustomEvent(Q,fe);i.addEventListener(Q,h),i.dispatchEvent(y),y.defaultPrevented||D(u??document.body,{select:!0}),i.removeEventListener(Q,h),me.remove(g)},0)}}},[i,l,h,g]);const w=c.useCallback(u=>{if(!n&&!r||g.paused)return;const m=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,y=document.activeElement;if(m&&y){const E=u.currentTarget,[b,C]=ot(E);b&&C?!u.shiftKey&&y===C?(u.preventDefault(),n&&D(b,{select:!0})):u.shiftKey&&y===b&&(u.preventDefault(),n&&D(C,{select:!0})):y===E&&u.preventDefault()}},[n,r,g.paused]);return f.jsx(P.div,{tabIndex:-1,...s,ref:p,onKeyDown:w})});Se.displayName=nt;function rt(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(D(r,{select:t}),document.activeElement!==n)return}function ot(e){const t=we(e),n=ve(t,e),r=ve(t.reverse(),e);return[n,r]}function we(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 ve(e,t){for(const n of e)if(!at(n,{upTo:t}))return n}function at(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 it(e){return e instanceof HTMLInputElement&&"select"in e}function D(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&it(e)&&t&&e.select()}}var me=ct();function ct(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=he(e,t),e.unshift(t)},remove(t){var n;e=he(e,t),(n=e[0])==null||n.resume()}}}function he(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ut(e){return e.filter(t=>t.tagName!=="A")}var st="Portal",Ne=c.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[o,a]=c.useState(!1);oe(()=>a(!0),[]);const s=n||o&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return s?ze.createPortal(f.jsx(P.div,{...r,ref:t}),s):null});Ne.displayName=st;function lt(e,t){return c.useReducer((n,r)=>t[n][r]??n,e)}var X=e=>{const{present:t,children:n}=e,r=dt(t),o=typeof n=="function"?n({present:r.isPresent}):c.Children.only(n),a=k(r.ref,ft(o));return typeof n=="function"||r.isPresent?c.cloneElement(o,{ref:a}):null};X.displayName="Presence";function dt(e){const[t,n]=c.useState(),r=c.useRef(null),o=c.useRef(e),a=c.useRef("none"),s=e?"mounted":"unmounted",[i,d]=lt(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{const l=L(r.current);a.current=i==="mounted"?l:"none"},[i]),oe(()=>{const l=r.current,h=o.current;if(h!==e){const p=a.current,g=L(l);e?d("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),oe(()=>{if(t){let l;const h=t.ownerDocument.defaultView??window,v=g=>{const u=L(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&u&&(d("ANIMATION_END"),!o.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",l=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},p=g=>{g.target===t&&(a.current=L(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{h.clearTimeout(l),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:c.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function L(e){return(e==null?void 0:e.animationName)||"none"}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 J=0;function vt(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ge()),document.body.insertAdjacentElement("beforeend",e[1]??ge()),J++,()=>{J===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),J--}},[])}function ge(){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 R=function(){return R=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},R.apply(this,arguments)};function Re(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 mt(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 G="right-scroll-bar-position",H="width-before-scroll-bar",ht="with-scroll-bars-hidden",gt="--removed-body-scroll-bar-size";function ee(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pt(e,t){var n=c.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 yt=typeof window<"u"?c.useLayoutEffect:c.useEffect,pe=new WeakMap;function Et(e,t){var n=pt(null,function(r){return e.forEach(function(o){return ee(o,r)})});return yt(function(){var r=pe.get(n);if(r){var o=new Set(r),a=new Set(e),s=n.current;o.forEach(function(i){a.has(i)||ee(i,null)}),a.forEach(function(i){o.has(i)||ee(i,s)})}pe.set(n,e)},[e]),n}function bt(e){return e}function Ct(e,t){t===void 0&&(t=bt);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 s=t(a,r);return n.push(s),function(){n=n.filter(function(i){return i!==s})}},assignSyncMedium:function(a){for(r=!0;n.length;){var s=n;n=[],s.forEach(a)}n={push:function(i){return a(i)},filter:function(){return n}}},assignMedium:function(a){r=!0;var s=[];if(n.length){var i=n;n=[],i.forEach(a),s=n}var d=function(){var h=s;s=[],h.forEach(a)},l=function(){return Promise.resolve().then(d)};l(),n={push:function(h){s.push(h),l()},filter:function(h){return s=s.filter(h),n}}}};return o}function St(e){e===void 0&&(e={});var t=Ct(null);return t.options=R({async:!0,ssr:!1},e),t}var Ae=function(e){var t=e.sideCar,n=Re(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 c.createElement(r,R({},n))};Ae.isSideCarExport=!0;function wt(e,t){return e.useMedium(t),Ae}var xe=St(),te=function(){},Y=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:te,onWheelCapture:te,onTouchMoveCapture:te}),o=r[0],a=r[1],s=e.forwardProps,i=e.children,d=e.className,l=e.removeScrollBar,h=e.enabled,v=e.shards,p=e.sideCar,g=e.noRelative,w=e.noIsolation,u=e.inert,m=e.allowPinchZoom,y=e.as,E=y===void 0?"div":y,b=e.gapMode,C=Re(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,A=Et([n,t]),x=R(R({},C),o);return c.createElement(c.Fragment,null,h&&c.createElement(S,{sideCar:xe,removeScrollBar:l,shards:v,noRelative:g,noIsolation:w,inert:u,setCallbacks:a,allowPinchZoom:!!m,lockRef:n,gapMode:b}),s?c.cloneElement(c.Children.only(i),R(R({},x),{ref:A})):c.createElement(E,R({},x,{className:d,ref:A}),i))});Y.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Y.classNames={fullWidth:H,zeroRight:G};var Nt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Rt(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Nt();return t&&e.setAttribute("nonce",t),e}function At(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Dt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Rt())&&(At(t,n),xt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ot=function(){var e=Dt();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},De=function(){var e=Ot(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Pt={left:0,top:0,right:0,gap:0},ne=function(e){return parseInt(e||"",10)||0},Tt=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[ne(n),ne(r),ne(o)]},Mt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Pt;var t=Tt(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])}},It=De(),F="data-scroll-locked",Ft=function(e,t,n,r){var o=e.left,a=e.top,s=e.right,i=e.gap;return n===void 0&&(n="margin"),`
1
+ import{r as c,j as f,a0 as ze,v as Ze}from"./index-B1iJx0w1.js";import{u as de,a as k,P,b as oe,c as qe,d as Z,e as _,f as Qe,g as Je,D as et,h as tt}from"./index-Bgx65Mb_.js";var q="focusScope.autoFocusOnMount",Q="focusScope.autoFocusOnUnmount",fe={bubbles:!1,cancelable:!0},nt="FocusScope",Se=c.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[i,d]=c.useState(null),l=de(o),h=de(a),v=c.useRef(null),p=k(t,u=>d(u)),g=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let u=function(b){if(g.paused||!i)return;const C=b.target;i.contains(C)?v.current=C:D(v.current,{select:!0})},m=function(b){if(g.paused||!i)return;const C=b.relatedTarget;C!==null&&(i.contains(C)||D(v.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&D(i)};document.addEventListener("focusin",u),document.addEventListener("focusout",m);const E=new MutationObserver(y);return i&&E.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m),E.disconnect()}}},[r,i,g.paused]),c.useEffect(()=>{if(i){me.add(g);const u=document.activeElement;if(!i.contains(u)){const y=new CustomEvent(q,fe);i.addEventListener(q,l),i.dispatchEvent(y),y.defaultPrevented||(rt(ut(we(i)),{select:!0}),document.activeElement===u&&D(i))}return()=>{i.removeEventListener(q,l),setTimeout(()=>{const y=new CustomEvent(Q,fe);i.addEventListener(Q,h),i.dispatchEvent(y),y.defaultPrevented||D(u??document.body,{select:!0}),i.removeEventListener(Q,h),me.remove(g)},0)}}},[i,l,h,g]);const w=c.useCallback(u=>{if(!n&&!r||g.paused)return;const m=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,y=document.activeElement;if(m&&y){const E=u.currentTarget,[b,C]=ot(E);b&&C?!u.shiftKey&&y===C?(u.preventDefault(),n&&D(b,{select:!0})):u.shiftKey&&y===b&&(u.preventDefault(),n&&D(C,{select:!0})):y===E&&u.preventDefault()}},[n,r,g.paused]);return f.jsx(P.div,{tabIndex:-1,...s,ref:p,onKeyDown:w})});Se.displayName=nt;function rt(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(D(r,{select:t}),document.activeElement!==n)return}function ot(e){const t=we(e),n=ve(t,e),r=ve(t.reverse(),e);return[n,r]}function we(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 ve(e,t){for(const n of e)if(!at(n,{upTo:t}))return n}function at(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 it(e){return e instanceof HTMLInputElement&&"select"in e}function D(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&it(e)&&t&&e.select()}}var me=ct();function ct(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=he(e,t),e.unshift(t)},remove(t){var n;e=he(e,t),(n=e[0])==null||n.resume()}}}function he(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ut(e){return e.filter(t=>t.tagName!=="A")}var st="Portal",Ne=c.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[o,a]=c.useState(!1);oe(()=>a(!0),[]);const s=n||o&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return s?ze.createPortal(f.jsx(P.div,{...r,ref:t}),s):null});Ne.displayName=st;function lt(e,t){return c.useReducer((n,r)=>t[n][r]??n,e)}var X=e=>{const{present:t,children:n}=e,r=dt(t),o=typeof n=="function"?n({present:r.isPresent}):c.Children.only(n),a=k(r.ref,ft(o));return typeof n=="function"||r.isPresent?c.cloneElement(o,{ref:a}):null};X.displayName="Presence";function dt(e){const[t,n]=c.useState(),r=c.useRef(null),o=c.useRef(e),a=c.useRef("none"),s=e?"mounted":"unmounted",[i,d]=lt(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{const l=L(r.current);a.current=i==="mounted"?l:"none"},[i]),oe(()=>{const l=r.current,h=o.current;if(h!==e){const p=a.current,g=L(l);e?d("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),oe(()=>{if(t){let l;const h=t.ownerDocument.defaultView??window,v=g=>{const u=L(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&u&&(d("ANIMATION_END"),!o.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",l=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},p=g=>{g.target===t&&(a.current=L(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{h.clearTimeout(l),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:c.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function L(e){return(e==null?void 0:e.animationName)||"none"}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 J=0;function vt(){c.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ge()),document.body.insertAdjacentElement("beforeend",e[1]??ge()),J++,()=>{J===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),J--}},[])}function ge(){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 R=function(){return R=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},R.apply(this,arguments)};function Re(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 mt(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 G="right-scroll-bar-position",H="width-before-scroll-bar",ht="with-scroll-bars-hidden",gt="--removed-body-scroll-bar-size";function ee(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pt(e,t){var n=c.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 yt=typeof window<"u"?c.useLayoutEffect:c.useEffect,pe=new WeakMap;function Et(e,t){var n=pt(null,function(r){return e.forEach(function(o){return ee(o,r)})});return yt(function(){var r=pe.get(n);if(r){var o=new Set(r),a=new Set(e),s=n.current;o.forEach(function(i){a.has(i)||ee(i,null)}),a.forEach(function(i){o.has(i)||ee(i,s)})}pe.set(n,e)},[e]),n}function bt(e){return e}function Ct(e,t){t===void 0&&(t=bt);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 s=t(a,r);return n.push(s),function(){n=n.filter(function(i){return i!==s})}},assignSyncMedium:function(a){for(r=!0;n.length;){var s=n;n=[],s.forEach(a)}n={push:function(i){return a(i)},filter:function(){return n}}},assignMedium:function(a){r=!0;var s=[];if(n.length){var i=n;n=[],i.forEach(a),s=n}var d=function(){var h=s;s=[],h.forEach(a)},l=function(){return Promise.resolve().then(d)};l(),n={push:function(h){s.push(h),l()},filter:function(h){return s=s.filter(h),n}}}};return o}function St(e){e===void 0&&(e={});var t=Ct(null);return t.options=R({async:!0,ssr:!1},e),t}var Ae=function(e){var t=e.sideCar,n=Re(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 c.createElement(r,R({},n))};Ae.isSideCarExport=!0;function wt(e,t){return e.useMedium(t),Ae}var xe=St(),te=function(){},Y=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:te,onWheelCapture:te,onTouchMoveCapture:te}),o=r[0],a=r[1],s=e.forwardProps,i=e.children,d=e.className,l=e.removeScrollBar,h=e.enabled,v=e.shards,p=e.sideCar,g=e.noRelative,w=e.noIsolation,u=e.inert,m=e.allowPinchZoom,y=e.as,E=y===void 0?"div":y,b=e.gapMode,C=Re(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,A=Et([n,t]),x=R(R({},C),o);return c.createElement(c.Fragment,null,h&&c.createElement(S,{sideCar:xe,removeScrollBar:l,shards:v,noRelative:g,noIsolation:w,inert:u,setCallbacks:a,allowPinchZoom:!!m,lockRef:n,gapMode:b}),s?c.cloneElement(c.Children.only(i),R(R({},x),{ref:A})):c.createElement(E,R({},x,{className:d,ref:A}),i))});Y.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Y.classNames={fullWidth:H,zeroRight:G};var Nt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Rt(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Nt();return t&&e.setAttribute("nonce",t),e}function At(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Dt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Rt())&&(At(t,n),xt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ot=function(){var e=Dt();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},De=function(){var e=Ot(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Pt={left:0,top:0,right:0,gap:0},ne=function(e){return parseInt(e||"",10)||0},Tt=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[ne(n),ne(r),ne(o)]},Mt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Pt;var t=Tt(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])}},It=De(),F="data-scroll-locked",Ft=function(e,t,n,r){var o=e.left,a=e.top,s=e.right,i=e.gap;return n===void 0&&(n="margin"),`
2
2
  .`.concat(ht,` {
3
3
  overflow: hidden `).concat(r,`;
4
4
  padding-right: `).concat(i,"px ").concat(r,`;
@@ -1,4 +1,4 @@
1
- import{c as q,r as c,i as Q,u as X,b as ee,t as te,j as e,e as B,A as ne,Y as re}from"./index-rullcuA-.js";import{f as Z,a as se,c as ae,h as ie,i as G,j as oe,k as ce,m as le}from"./recordings-BWe1ydXm.js";import{P as ue}from"./page-header-BNgF7qLO.js";import{B as C}from"./button-C8WXV74W.js";import{E as $}from"./EmptyState-DMkfqTdS.js";import{M as de}from"./Modal-D4LAJuLk.js";import{P as fe,M as me,a as ge}from"./Menu-ChzfRWa3.js";import{A as pe}from"./AnnotationOverlay-BR2MSqZq.js";import{t as O,v as he,R as ye,P as be,n as ke,c as z,o as ve,a as R,f as xe,p as je,S as V,b as Me,d as we}from"./recordings-n-GTW3aT.js";import{A as Re}from"./arrow-left-DcJsqErm.js";import{T as Ne}from"./trash-2-Cy3hmCGn.js";import{D as Se}from"./download-CYOnymUH.js";import"./utils-CDN07tui.js";import"./index-DC1NFStQ.js";import"./check-DHCAmQzm.js";/**
1
+ import{c as q,r as c,i as Q,u as X,b as ee,t as te,j as e,e as B,A as ne,Y as re}from"./index-B1iJx0w1.js";import{f as Z,a as se,c as ae,h as ie,i as G,j as oe,k as ce,m as le}from"./recordings-BWe1ydXm.js";import{P as ue}from"./page-header-D9FkEgQm.js";import{B as C}from"./button-CB1ehl9z.js";import{E as $}from"./EmptyState-D5BTZSIa.js";import{M as de}from"./Modal-BZEfRpq8.js";import{P as fe,M as me,a as ge}from"./Menu-DWl5uJ9E.js";import{A as pe}from"./AnnotationOverlay-U9aJANVi.js";import{t as O,v as he,R as ye,P as be,n as ke,c as z,o as ve,a as R,f as xe,p as je,S as V,b as Me,d as we}from"./recordings-n-GTW3aT.js";import{A as Re}from"./arrow-left-CpaUvzcV.js";import{T as Ne}from"./trash-2-BcWlaBK8.js";import{D as Se}from"./download-Di_q2qj5.js";import"./utils-CDN07tui.js";import"./index-Bgx65Mb_.js";import"./check-Bq0QWhtG.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,2 +1,2 @@
1
- import{u as V,E as Y,r as l,j as n,Y as z,A as G,e as q}from"./index-rullcuA-.js";import{P as Q}from"./page-header-BNgF7qLO.js";import{T as Z,a as J,b as T,c as h,d as X,e as m}from"./Table-C7osPLTJ.js";import{B as v}from"./button-C8WXV74W.js";import{E as y}from"./EmptyState-DMkfqTdS.js";import{I as ee}from"./input-DAFtgyoC.js";import{F as f}from"./FilterMenu-BEQWiqgS.js";import{l as A}from"./recordings-BWe1ydXm.js";import{f as ne,a as te}from"./recordings-n-GTW3aT.js";import"./utils-CDN07tui.js";import"./Menu-ChzfRWa3.js";import"./index-DC1NFStQ.js";import"./check-DHCAmQzm.js";import"./plus-bjDKJLSM.js";const re={phone:"",by:"",when:"any",q:""},oe=["any","24h","7d","30d"],R=864e5,se={"24h":R,"7d":7*R,"30d":30*R},ae={any:"Any time","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days"};function ce(t){const r=t.get("when");return{phone:t.get("phone")??"",by:t.get("by")??"",when:r&&oe.includes(r)?r:"any",q:t.get("q")??""}}function F(t){const r=new URLSearchParams;return t.phone&&r.set("phone",t.phone),t.by&&r.set("by",t.by),t.when!=="any"&&r.set("when",t.when),t.q.trim()&&r.set("q",t.q),r}function ie(t){return!!(t.phone||t.by||t.when!=="any"||t.q.trim())}function P(t,r){return{udid:t.phone||void 0,startedBy:t.by||void 0,since:t.when==="any"?void 0:new Date(r-se[t.when]).toISOString(),q:t.q.trim()||void 0}}const B=50,le=250;function de(t){const r=t.phones.map(g=>g.name);return{text:r.length>2?`${r.slice(0,2).join(", ")} +${r.length-2}`:r.join(", "),title:r.join(`
1
+ import{u as V,E as Y,r as l,j as n,Y as z,A as G,e as q}from"./index-B1iJx0w1.js";import{P as Q}from"./page-header-D9FkEgQm.js";import{T as Z,a as J,b as T,c as h,d as X,e as m}from"./Table-BthtE6KF.js";import{B as v}from"./button-CB1ehl9z.js";import{E as y}from"./EmptyState-D5BTZSIa.js";import{I as ee}from"./input-B83lhHJ_.js";import{F as f}from"./FilterMenu-7JEhwNEM.js";import{l as A}from"./recordings-BWe1ydXm.js";import{f as ne,a as te}from"./recordings-n-GTW3aT.js";import"./utils-CDN07tui.js";import"./Menu-DWl5uJ9E.js";import"./index-Bgx65Mb_.js";import"./check-Bq0QWhtG.js";import"./plus-DF-cFokG.js";const re={phone:"",by:"",when:"any",q:""},oe=["any","24h","7d","30d"],R=864e5,se={"24h":R,"7d":7*R,"30d":30*R},ae={any:"Any time","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days"};function ce(t){const r=t.get("when");return{phone:t.get("phone")??"",by:t.get("by")??"",when:r&&oe.includes(r)?r:"any",q:t.get("q")??""}}function F(t){const r=new URLSearchParams;return t.phone&&r.set("phone",t.phone),t.by&&r.set("by",t.by),t.when!=="any"&&r.set("when",t.when),t.q.trim()&&r.set("q",t.q),r}function ie(t){return!!(t.phone||t.by||t.when!=="any"||t.q.trim())}function P(t,r){return{udid:t.phone||void 0,startedBy:t.by||void 0,since:t.when==="any"?void 0:new Date(r-se[t.when]).toISOString(),q:t.q.trim()||void 0}}const B=50,le=250;function de(t){const r=t.phones.map(g=>g.name);return{text:r.length>2?`${r.slice(0,2).join(", ")} +${r.length-2}`:r.join(", "),title:r.join(`
2
2
  `)}}const ue=t=>t.status==="recording"?"/devices/live":`/recordings/${encodeURIComponent(t.groupId)}`;function Ne(){const t=V(),[r,g]=Y(),a=ce(r),x=F(a).toString(),[s,S]=l.useState(null),[I,D]=l.useState(null),[j,C]=l.useState([]),[N,w]=l.useState(null),[M,k]=l.useState(!1),[H,O]=l.useState(0),u=l.useRef(0),d=l.useRef(!0),p=e=>g(F(e),{replace:!0});l.useEffect(()=>{d.current=!0;const e=++u.current,c=window.setTimeout(()=>{A({...P(a,Date.now()),limit:B}).then(i=>{!d.current||e!==u.current||(S(i),C(i.recordings),w(null),D(x))}).catch(i=>{!d.current||e!==u.current||w(i instanceof Error?i.message:String(i))})},le);return()=>{window.clearTimeout(c),d.current=!1}},[x,H]);const b=I===x?(s==null?void 0:s.nextCursor)??null:null,_=async()=>{if(!b)return;const e=u.current;k(!0);try{const c=await A({...P(a,Date.now()),limit:B,cursor:b});if(!d.current||e!==u.current)return;S(c),C(i=>i.concat(c.recordings))}catch(c){if(!d.current||e!==u.current)return;w(c instanceof Error?c.message:String(c))}finally{d.current&&k(!1)}},o=s==null?void 0:s.facets,W=[{value:"",label:"Any phone",count:(o==null?void 0:o.when.any)??0},...((o==null?void 0:o.phones)??[]).map(e=>({value:e.udid,label:e.name,count:e.count}))],K=[{value:"",label:"Anyone",count:(o==null?void 0:o.when.any)??0},...((o==null?void 0:o.people)??[]).map(e=>({value:e.id,label:e.name,count:e.count})),...o&&o.unknownCount>0?[{value:"unknown",label:"Unknown",count:o.unknownCount}]:[]],U=["any","24h","7d","30d"].map(e=>({value:e,label:ae[e],count:(o==null?void 0:o.when[e])??0})),E=(s==null?void 0:s.total)??0;return n.jsxs("div",{className:"rec-page",children:[n.jsx(Q,{icon:z,title:"Recordings",subtitle:s?`${E} recording${E===1?"":"s"}`:void 0}),n.jsxs("div",{className:"rec-toolbar",children:[n.jsx(ee,{type:"text",className:"rec-search","aria-label":"Search recordings",placeholder:"Search phones and bookmarks",value:a.q,onChange:e=>p({...a,q:e.target.value})}),n.jsx(f,{name:"Phone",value:a.phone,anyValue:"",options:W,onChange:e=>p({...a,phone:e})}),n.jsx(f,{name:"Recorded by",value:a.by,anyValue:"",options:K,onChange:e=>p({...a,by:e})}),n.jsx(f,{name:"When",value:a.when,anyValue:"any",options:U,onChange:e=>p({...a,when:e})})]}),N?n.jsx(y,{title:"Couldn't load recordings",description:N,action:n.jsxs(v,{variant:"secondary",onClick:()=>O(e=>e+1),children:[n.jsx(G,{size:14,"aria-hidden":"true"}),"Retry"]})}):s?j.length===0?ie(a)?n.jsx(y,{title:"No recordings match",action:n.jsx(v,{variant:"secondary",onClick:()=>p(re),children:"Clear filters"})}):n.jsx(y,{title:"No recordings yet",description:"Record phones from Live devices.",action:n.jsx(q,{className:"rec-link",to:"/devices/live",children:"Open Live devices"})}):n.jsxs(n.Fragment,{children:[n.jsxs(Z,{className:"rec-table",children:[n.jsxs("caption",{className:"sr-only",children:["Recordings, ",j.length," shown"]}),n.jsx(J,{children:n.jsxs(T,{children:[n.jsx(h,{scope:"col",children:"When"}),n.jsx(h,{scope:"col",children:"Phones"}),n.jsx(h,{scope:"col",children:"Length"}),n.jsx(h,{scope:"col",children:"Recorded by"}),n.jsx(h,{scope:"col",children:"Bookmarks"}),n.jsx(h,{scope:"col",children:"Status"})]})}),n.jsx(X,{children:j.map(e=>{var L;const c=de(e),i=ue(e);return n.jsxs(T,{className:"rec-row",onClick:$=>{$.target.closest("a")||t(i)},children:[n.jsx(m,{children:n.jsx(q,{to:i,className:"rec-link",children:ne(e.startedAt)})}),n.jsx(m,{title:c.title,children:c.text}),n.jsx(m,{className:"rec-num",children:e.durationMs===null?"—":te(e.durationMs)}),n.jsx(m,{children:((L=e.startedBy)==null?void 0:L.name)??"Unknown"}),n.jsx(m,{className:"rec-num",children:e.bookmarkCount}),n.jsx(m,{children:e.status==="recording"?"Recording…":e.status==="failed"?"Failed":""})]},e.groupId)})})]}),b&&n.jsx("div",{className:"rec-more",children:n.jsx(v,{variant:"secondary",onClick:_,disabled:M,children:"Load more"})})]}):n.jsx(y,{title:"Loading recordings…"}),s&&n.jsxs("p",{className:"rec-footnote",children:["Recordings are kept for ",s.retention.days," days, up to the newest"," ",s.retention.maxCount,"."]})]})}export{Ne as default,de as phoneNames};
@@ -1 +1 @@
1
- import{j as e}from"./index-rullcuA-.js";const s=({kind:n,size:a=6,className:l})=>e.jsx("span",{className:`status-dot status-dot-${n}${l?" "+l:""}`,style:{width:a,height:a},"aria-hidden":!0});function d({segments:n,value:a,onChange:l,size:o="md",label:i}){return e.jsx("div",{className:`seg seg-${o}`,role:"tablist","aria-label":i,children:n.map(t=>e.jsxs("button",{role:"tab","aria-selected":t.value===a,"aria-label":t.title&&typeof t.label=="string"?t.label:void 0,"aria-keyshortcuts":t.keyShortcuts,title:t.title,disabled:t.disabled,className:`seg-btn${t.value===a?" seg-btn-active":""}`,onClick:()=>{t.disabled||l(t.value)},type:"button",children:[t.tone&&e.jsx(s,{kind:t.tone}),e.jsx("span",{children:t.label}),typeof t.count=="number"&&e.jsx("span",{className:`seg-count${t.count===0?" seg-count-zero":""}`,children:t.count})]},t.value))})}export{s as S,d as a};
1
+ import{j as e}from"./index-B1iJx0w1.js";const s=({kind:n,size:a=6,className:l})=>e.jsx("span",{className:`status-dot status-dot-${n}${l?" "+l:""}`,style:{width:a,height:a},"aria-hidden":!0});function d({segments:n,value:a,onChange:l,size:o="md",label:i}){return e.jsx("div",{className:`seg seg-${o}`,role:"tablist","aria-label":i,children:n.map(t=>e.jsxs("button",{role:"tab","aria-selected":t.value===a,"aria-label":t.title&&typeof t.label=="string"?t.label:void 0,"aria-keyshortcuts":t.keyShortcuts,title:t.title,disabled:t.disabled,className:`seg-btn${t.value===a?" seg-btn-active":""}`,onClick:()=>{t.disabled||l(t.value)},type:"button",children:[t.tone&&e.jsx(s,{kind:t.tone}),e.jsx("span",{children:t.label}),typeof t.count=="number"&&e.jsx("span",{className:`seg-count${t.count===0?" seg-count-zero":""}`,children:t.count})]},t.value))})}export{s as S,d as a};
@@ -1,4 +1,4 @@
1
- import{c as n,j as s,A as h}from"./index-rullcuA-.js";import{B as r}from"./button-C8WXV74W.js";/**
1
+ import{c as n,j as s,A as h}from"./index-B1iJx0w1.js";import{B as r}from"./button-CB1ehl9z.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-rullcuA-.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
+ import{j as t}from"./index-B1iJx0w1.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};