@xenon-device-management/xenon 2.13.0 → 2.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +223 -488
- package/lib/package.json +1 -1
- package/lib/public/assets/{AnnotationOverlay-CzbFYtPI.js → AnnotationOverlay-BXruClDk.js} +1 -1
- package/lib/public/assets/{ApiKeyGate-CA5KFHHJ.js → ApiKeyGate-qTS4LPLC.js} +1 -1
- package/lib/public/assets/{BugReportButton-D-DSGg8C.js → BugReportButton-BoGhlI7F.js} +1 -1
- package/lib/public/assets/{DeviceMosaicView-paDEFU4B.js → DeviceMosaicView-8J0oYqMM.js} +1 -1
- package/lib/public/assets/{EmptyState-BE_5f8Vw.js → EmptyState-Cr17PdDv.js} +1 -1
- package/lib/public/assets/{FieldGroup-DqMf7Rf3.js → FieldGroup-Bvn08svv.js} +1 -1
- package/lib/public/assets/{FilterMenu-BQY75Su3.js → FilterMenu-DDSO8aDf.js} +1 -1
- package/lib/public/assets/{Menu-BiW3os9u.js → Menu-B-Qn2X3T.js} +1 -1
- package/lib/public/assets/{Modal-DfawTxih.js → Modal-Cg9V5JYU.js} +1 -1
- package/lib/public/assets/{RecordingPage-BvemyRiy.js → RecordingPage-BTUs9VTW.js} +1 -1
- package/lib/public/assets/{RecordingsPage-CXfw7wpd.js → RecordingsPage-DYcfxITK.js} +2 -2
- package/lib/public/assets/{SegmentedControl-B7m9kpom.js → SegmentedControl-Zy7suhT5.js} +1 -1
- package/lib/public/assets/{SettingCard-Cw6lDD0l.js → SettingCard-CWYmycoe.js} +1 -1
- package/lib/public/assets/{Table-DlEuFgv-.js → Table-io9fwa98.js} +1 -1
- package/lib/public/assets/{activity-CnLvNwae.js → activity-Bdf_uIWl.js} +1 -1
- package/lib/public/assets/ai-settings-Bce5SJob.js +21 -0
- package/lib/public/assets/{api-keys-DphSVzBr.js → api-keys-CPqtVpm3.js} +1 -1
- package/lib/public/assets/{apps-vUfu15lX.js → apps-BgZan0H9.js} +2 -2
- package/lib/public/assets/{arrow-left-CLQWAiCY.js → arrow-left-B27ckB31.js} +1 -1
- package/lib/public/assets/{arrow-right-K6A5e_Ee.js → arrow-right-DOF8ITCz.js} +1 -1
- package/lib/public/assets/{arrow-up-right-DUA_lq6f.js → arrow-up-right-eFG5KTFS.js} +1 -1
- package/lib/public/assets/{auth-shell-BYRHcZd6.js → auth-shell-DlC3_27j.js} +2 -2
- package/lib/public/assets/{builds-page-C0fTvIG8.js → builds-page-BuXpPfKo.js} +1 -1
- package/lib/public/assets/{button-BxnHCCsX.js → button-fIW8owMI.js} +1 -1
- package/lib/public/assets/{calendar-CqVsn28A.js → calendar-WNjmrF-a.js} +1 -1
- package/lib/public/assets/{check-R6V3bot0.js → check-BdTh1Sq7.js} +1 -1
- package/lib/public/assets/{chevron-right-BA2Fntu-.js → chevron-right-B4BKlsqk.js} +1 -1
- package/lib/public/assets/{circle-check-D4EzyGzs.js → circle-check-zJU80_EF.js} +1 -1
- package/lib/public/assets/{circle-x-Cf6AF2B2.js → circle-x-5Uwquo0h.js} +1 -1
- package/lib/public/assets/{clock-EZfet0sS.js → clock-BtUprDsZ.js} +1 -1
- package/lib/public/assets/{copy-Bc6P8v9V.js → copy-DGSbZI3u.js} +1 -1
- package/lib/public/assets/device-explorer-C-KnhMHI.js +279 -0
- package/lib/public/assets/{download-Bd8OGLzi.js → download-WG6l7BgD.js} +1 -1
- package/lib/public/assets/{forgot-password-CoE7Ugtx.js → forgot-password-DnudqFFo.js} +1 -1
- package/lib/public/assets/{index-BTYMAqNW.css → index-Bxoxt9sV.css} +1 -1
- package/lib/public/assets/{index-CHOr4JCs.js → index-DI1fGIyj.js} +43 -43
- package/lib/public/assets/{index-BiL0Enl_.js → index-HDQVe1gi.js} +1 -1
- package/lib/public/assets/{input-CJ8z3IO5.js → input-BjDRKCea.js} +1 -1
- package/lib/public/assets/{line-chart-CPK0ObjV.js → line-chart-C0zdgd0v.js} +1 -1
- package/lib/public/assets/{list-checks-mXGHUVbB.js → list-checks-BdW5CjM8.js} +1 -1
- package/lib/public/assets/{lock-BSXM1xvq.js → lock-Dy3L4I8E.js} +1 -1
- package/lib/public/assets/{login-Ct2iW066.js → login-BHbY9CLG.js} +1 -1
- package/lib/public/assets/maintenance-settings-zDVlOMVK.js +6 -0
- package/lib/public/assets/{monitor-D8WQK8md.js → monitor-8xjkeHHi.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-Cw2tWzDX.js → mouse-pointer-2-CXdKMXQ8.js} +1 -1
- package/lib/public/assets/{network-Ba_uFxWo.js → network-Cj8JOKON.js} +1 -1
- package/lib/public/assets/{overview-CxrZ7_6k.js → overview-CTg7F0im.js} +1 -1
- package/lib/public/assets/{page-header-Cm1XL49f.js → page-header--aTyJXq6.js} +1 -1
- package/lib/public/assets/{play-C0CuKLXj.js → play-B-FodgHV.js} +1 -1
- package/lib/public/assets/{plus-CIIvR_6Z.js → plus-CsIk10Cq.js} +1 -1
- package/lib/public/assets/{profile-page-BZ_e-Bgw.js → profile-page-DkFKkMfl.js} +1 -1
- package/lib/public/assets/{recording-group-store-BWeeNs2_.js → recording-group-store-WVM3hoXn.js} +1 -1
- package/lib/public/assets/{reset-password-lfNz8Rm1.js → reset-password-I2-zqLlI.js} +1 -1
- package/lib/public/assets/{runbook-page-Cnec3VSx.js → runbook-page-DJTVCJX7.js} +1 -1
- package/lib/public/assets/{select-CZuCnold.js → select-DvCSv25z.js} +1 -1
- package/lib/public/assets/{selector-detail-redirect-BG3pxFLw.js → selector-detail-redirect-BLVfMJs_.js} +1 -1
- package/lib/public/assets/{selector-health-page-DsyL58tb.js → selector-health-page-oqadRokn.js} +2 -2
- package/lib/public/assets/session-detail-page-CGn55Pvl.js +4 -0
- package/lib/public/assets/settings-MsVU2ukE.js +6 -0
- package/lib/public/assets/{stat-tile-DFhv8JoI.js → stat-tile-DV9Ix-4O.js} +1 -1
- package/lib/public/assets/{tablet-68J5f6zh.js → tablet-6b_SEN2X.js} +1 -1
- package/lib/public/assets/{teams-eHSyEpbD.js → teams-BjZyfuHh.js} +1 -1
- package/lib/public/assets/{trash-2-CcSsv4fS.js → trash-2-CTZpPSdd.js} +1 -1
- package/lib/public/assets/{upload-BYf26K71.js → upload-P3XzwQUb.js} +1 -1
- package/lib/public/assets/{use-builds-data-CHW-MhaP.js → use-builds-data-1cOCMf-z.js} +1 -1
- package/lib/public/assets/{use-password-reset-mode-DozShXkk.js → use-password-reset-mode-DgF9w088.js} +1 -1
- package/lib/public/assets/{users-CcSQRoK9.js → users-CiNTKUiz.js} +1 -1
- package/lib/public/assets/{users-BpYnpOl2.js → users-DMF9Mk5H.js} +1 -1
- package/lib/public/assets/{video-off-dFKgps73.js → video-off-CHp1KU_T.js} +1 -1
- package/lib/public/assets/webhook-settings-DiS8geIm.js +1 -0
- package/lib/public/assets/{zap-COC2tZaH.js → zap-DRz0tDq5.js} +1 -1
- package/lib/public/index.html +2 -2
- package/lib/schema.json +0 -25
- package/lib/src/app/routers/control.js +19 -4
- package/lib/src/app/routers/streamStartConflict.js +3 -0
- package/lib/src/data-service/device-service.js +40 -0
- package/lib/src/data-service/device-store.js +4 -1
- package/lib/src/data-service/prisma-store.js +2 -1
- package/lib/src/device-managers/ios/WDAClient.js +128 -16
- package/lib/src/device-utils.js +63 -13
- package/lib/src/middleware/deviceAccessGuard.js +63 -9
- package/lib/src/services/ServerManager.js +3 -0
- package/lib/src/services/SessionLifecycleService.js +16 -4
- package/lib/src/services/device-access/SessionOwnerResolver.js +26 -0
- package/lib/src/services/device-access/deviceAccessPolicy.js +38 -6
- package/lib/src/services/device-access/leaseHold.js +26 -0
- package/lib/src/services/device-access/ticketActorAccess.js +6 -0
- package/lib/src/services/lease/activeLeases.js +37 -0
- package/lib/src/services/recording/busy-precheck.js +24 -3
- package/lib/test/unit/device-access-lease.spec.js +270 -0
- package/lib/test/unit/lease/allocate-lease-branch.spec.js +22 -0
- package/lib/test/unit/lease/session-lease-proof.spec.js +59 -0
- package/lib/test/unit/lease-held-phone.spec.js +196 -0
- package/lib/test/unit/partial-config-file.spec.js +100 -0
- package/lib/test/unit/schema-required-args.spec.js +21 -16
- package/lib/test/unit/wda-client-session.spec.js +128 -0
- package/lib/test/unit/wda-clipboard-write.spec.js +135 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/schema.json +0 -25
- package/scripts/dev/readme-screenshots.js +231 -0
- package/scripts/generate-types-from-schema.js +6 -0
- package/scripts/lib/always-present-plugin-args.js +39 -0
- package/lib/public/assets/ai-settings-D7Te8o-a.js +0 -21
- package/lib/public/assets/device-explorer-BFXpRq6d.js +0 -279
- package/lib/public/assets/maintenance-settings-DaOs00P6.js +0 -6
- package/lib/public/assets/session-detail-page-ZZyGM413.js +0 -4
- package/lib/public/assets/settings-DGZ7B_AR.js +0 -6
- package/lib/public/assets/webhook-settings-DD1XjiOD.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as h,x as U,
|
|
1
|
+
import{r as o,j as h,x as U,a3 as N}from"./index-DI1fGIyj.js";function T(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function B(...e){return t=>{let r=!1;const s=e.map(n=>{const i=T(n,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let n=0;n<s.length;n++){const i=s[n];typeof i=="function"?i():T(e[n],null)}}}}function W(...e){return o.useCallback(B(...e),e)}function V(e){const t=z(e),r=o.forwardRef((s,n)=>{const{children:i,...u}=s,c=o.Children.toArray(i),f=c.find(X);if(f){const a=f.props.children,l=c.map(v=>v===f?o.Children.count(a)>1?o.Children.only(null):o.isValidElement(a)?a.props.children:null:v);return h.jsx(t,{...u,ref:n,children:o.isValidElement(a)?o.cloneElement(a,void 0,l):null})}return h.jsx(t,{...u,ref:n,children:i})});return r.displayName=`${e}.Slot`,r}function z(e){const t=o.forwardRef((r,s)=>{const{children:n,...i}=r;if(o.isValidElement(n)){const u=Z(n),c=Y(i,n.props);return n.type!==o.Fragment&&(c.ref=s?B(s,u):u),o.cloneElement(n,c)}return o.Children.count(n)>1?o.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var K=Symbol("radix.slottable");function X(e){return o.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===K}function Y(e,t){const r={...t};for(const s in t){const n=e[s],i=t[s];/^on[A-Z]/.test(s)?n&&i?r[s]=(...c)=>{const f=i(...c);return n(...c),f}:n&&(r[s]=n):s==="style"?r[s]={...n,...i}:s==="className"&&(r[s]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}function Z(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var q=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=q.reduce((e,t)=>{const r=V(`Primitive.${t}`),s=o.forwardRef((n,i)=>{const{asChild:u,...c}=n,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(f,{...c,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function G(e,t){e&&U.flushSync(()=>e.dispatchEvent(t))}function pe(e,t){const r=o.createContext(t),s=i=>{const{children:u,...c}=i,f=o.useMemo(()=>c,Object.values(c));return h.jsx(r.Provider,{value:f,children:u})};s.displayName=e+"Provider";function n(i){const u=o.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,n]}function ve(e,t=[]){let r=[];function s(i,u){const c=o.createContext(u),f=r.length;r=[...r,u];const a=v=>{var b;const{scope:d,children:m,...E}=v,y=((b=d==null?void 0:d[e])==null?void 0:b[f])||c,P=o.useMemo(()=>E,Object.values(E));return h.jsx(y.Provider,{value:P,children:m})};a.displayName=i+"Provider";function l(v,d){var y;const m=((y=d==null?void 0:d[e])==null?void 0:y[f])||c,E=o.useContext(m);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${i}\``)}return[a,l]}const n=()=>{const i=r.map(u=>o.createContext(u));return function(c){const f=(c==null?void 0:c[e])||i;return o.useMemo(()=>({[`__scope${e}`]:{...c,[e]:f}}),[c,f])}};return n.scopeName=e,[s,J(n,...t)]}function J(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(i){const u=s.reduce((c,{useScope:f,scopeName:a})=>{const v=f(i)[`__scope${a}`];return{...c,...v}},{});return o.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function g(e){const t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}var j=globalThis!=null&&globalThis.document?o.useLayoutEffect:()=>{};function S(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}function Q(e,t=globalThis==null?void 0:globalThis.document){const r=g(e);o.useEffect(()=>{const s=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var H="DismissableLayer",w="dismissableLayer.update",ee="dismissableLayer.pointerDownOutside",te="dismissableLayer.focusOutside",I,A=o.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ne=o.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:n,onFocusOutside:i,onInteractOutside:u,onDismiss:c,...f}=e,a=o.useContext(A),[l,v]=o.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=o.useState({}),E=W(t,p=>v(p)),y=Array.from(a.layers),[P]=[...a.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(P),D=l?y.indexOf(l):-1,k=a.layersWithOutsidePointerEventsDisabled.size>0,R=D>=b,M=oe(p=>{const C=p.target,O=[...a.branches].some(x=>x.contains(C));!R||O||(n==null||n(p),u==null||u(p),p.defaultPrevented||c==null||c())},d),L=ie(p=>{const C=p.target;[...a.branches].some(x=>x.contains(C))||(i==null||i(p),u==null||u(p),p.defaultPrevented||c==null||c())},d);return Q(p=>{D===a.layers.size-1&&(s==null||s(p),!p.defaultPrevented&&c&&(p.preventDefault(),c()))},d),o.useEffect(()=>{if(l)return r&&(a.layersWithOutsidePointerEventsDisabled.size===0&&(I=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),a.layersWithOutsidePointerEventsDisabled.add(l)),a.layers.add(l),_(),()=>{r&&a.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=I)}},[l,d,r,a]),o.useEffect(()=>()=>{l&&(a.layers.delete(l),a.layersWithOutsidePointerEventsDisabled.delete(l),_())},[l,a]),o.useEffect(()=>{const p=()=>m({});return document.addEventListener(w,p),()=>document.removeEventListener(w,p)},[]),h.jsx($.div,{...f,ref:E,style:{pointerEvents:k?R?"auto":"none":void 0,...e.style},onFocusCapture:S(e.onFocusCapture,L.onFocusCapture),onBlurCapture:S(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:S(e.onPointerDownCapture,M.onPointerDownCapture)})});ne.displayName=H;var re="DismissableLayerBranch",se=o.forwardRef((e,t)=>{const r=o.useContext(A),s=o.useRef(null),n=W(t,s);return o.useEffect(()=>{const i=s.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),h.jsx($.div,{...e,ref:n})});se.displayName=re;function oe(e,t=globalThis==null?void 0:globalThis.document){const r=g(e),s=o.useRef(!1),n=o.useRef(()=>{});return o.useEffect(()=>{const i=c=>{if(c.target&&!s.current){let f=function(){F(ee,r,a,{discrete:!0})};const a={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=f,t.addEventListener("click",n.current,{once:!0})):f()}else t.removeEventListener("click",n.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",i),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function ie(e,t=globalThis==null?void 0:globalThis.document){const r=g(e),s=o.useRef(!1);return o.useEffect(()=>{const n=i=>{i.target&&!s.current&&F(te,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function _(){const e=new CustomEvent(w);document.dispatchEvent(e)}function F(e,t,r,{discrete:s}){const n=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),s?G(n,i):n.dispatchEvent(i)}var ce=N[" useId ".trim().toString()]||(()=>{}),ue=0;function Ee(e){const[t,r]=o.useState(ce());return j(()=>{r(s=>s??String(ue++))},[e]),e||(t?`radix-${t}`:"")}var ae=N[" useInsertionEffect ".trim().toString()]||j;function ye({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[n,i,u]=le({defaultProp:t,onChange:r}),c=e!==void 0,f=c?e:n;{const l=o.useRef(e!==void 0);o.useEffect(()=>{const v=l.current;v!==c&&console.warn(`${s} is changing from ${v?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=c},[c,s])}const a=o.useCallback(l=>{var v;if(c){const d=fe(l)?l(e):l;d!==e&&((v=u.current)==null||v.call(u,d))}else i(l)},[c,e,i,u]);return[f,a]}function le({defaultProp:e,onChange:t}){const[r,s]=o.useState(e),n=o.useRef(r),i=o.useRef(t);return ae(()=>{i.current=t},[t]),o.useEffect(()=>{var u;n.current!==r&&((u=i.current)==null||u.call(i,r),n.current=r)},[r,n]),[r,s,i]}function fe(e){return typeof e=="function"}export{ne as D,$ as P,W as a,j as b,ye as c,Ee as d,S as e,ve as f,V as g,pe as h,B as i,g as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,j as o}from"./index-
|
|
1
|
+
import{r as p,j as o}from"./index-DI1fGIyj.js";import{c as e}from"./utils-CDN07tui.js";const n=p.forwardRef(({className:r,type:s,...t},a)=>o.jsx("input",{type:s,className:e("input-base",r),ref:a,...t}));n.displayName="Input";export{n as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,r as g}from"./index-
|
|
1
|
+
import{j as a,r as g}from"./index-DI1fGIyj.js";const I=({header:e,footer:t,action:n,padded:o=!0,className:s,children:x})=>a.jsxs("div",{className:`card${s?" "+s:""}`,children:[(e||n)&&a.jsxs("div",{className:"card-header",children:[a.jsx("div",{className:"card-header-title",children:e}),n&&a.jsx("div",{className:"card-header-action",children:n})]}),a.jsx("div",{className:o?"card-body":"card-body-flush",children:x}),t&&a.jsx("div",{className:"card-footer",children:t})]});function E(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return!Array.isArray(t.samples)||!t.series||typeof t.series!="object"?null:{platform:String(t.platform??""),intervalMs:Number(t.intervalMs)||2e3,appId:typeof t.appId=="string"?t.appId:null,series:{deviceCpu:!!t.series.deviceCpu,deviceMem:!!t.series.deviceMem,appCpu:!!t.series.appCpu,appMem:!!t.series.appMem},recording:t.recording==="sampling"||t.recording==="stopped"||t.recording==="off"?t.recording:null,samples:t.samples}}function L(e){let t=-1/0,n=0,o=0;for(const s of e)s===null||!Number.isFinite(s)||(t=Math.max(t,s),n+=s,o+=1);return o===0?null:{peak:t,average:n/o}}function k(e){const t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),s=String(t%60).padStart(2,"0");return n>0?`${n}:${String(o).padStart(2,"0")}:${s}`:`${o}:${s}`}function R(e){return e===0?"0%":`${e<10?e.toFixed(1):Math.round(e)}%`}function W(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const M=1e3,N=600;function $(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e));for(const n of[1,1.5,2,2.5,3,4,5,6,8,10])if(n*t>=e)return n*t;return 10*t}function w(e,t){if(e.length===0)return-1;let n=0,o=e.length-1;for(;n<o;){const s=n+o>>1;e[s]<t?n=s+1:o=s}return n>0&&t-e[n-1]<=e[n]-t?n-1:n}function S(e,t=N){const n=e.length;if(n<=t)return Array.from({length:n},(l,u)=>u);const o=Math.floor((t-2)/3),s=n/o,x=new Set([0,n-1]);for(let l=0;l<o;l+=1){const u=Math.min(n,Math.floor((l+1)*s));let i=-1,p=-1,f=-1;for(let c=Math.floor(l*s);c<u;c+=1){const h=e[c];if(h==null){f<0&&(f=c);continue}(i<0||h<e[i])&&(i=c),(p<0||h>e[p])&&(p=c)}for(const c of[i,p,f])c>=0&&x.add(c)}return Array.from(x).sort((l,u)=>l-u)}const b=e=>Math.round(e*100)/100;function A(e,t,n,o,s,x,l){const u=[];let i=!1;for(const p of n){const f=e[p];if(f==null){i=!1;continue}const c=t[p]/o*x,h=l-Math.min(f,s)/s*l;u.push(`${i?"L":"M"}${b(c)} ${b(h)}`),i=!0}return u.join(" ")}const B=({times:e,series:t,yMax:n,formatValue:o,formatTime:s,ariaLabel:x,height:l=140})=>{const u=g.useRef(null),[i,p]=g.useState(null),f=Math.max(e.length?e[e.length-1]:0,1),c=g.useMemo(()=>{if(n!==void 0)return n;let r=0;for(const d of t)for(const v of d.values)v!==null&&v>r&&(r=v);return $(r)},[t,n]),h=g.useMemo(()=>t.map(r=>S(r.values)),[t]),y=r=>{var j;const d=(j=u.current)==null?void 0:j.getBoundingClientRect();if(!d||d.width<=0||e.length===0)return;const v=Math.min(1,Math.max(0,(r.clientX-d.left)/d.width));p(w(e,v*f))},m=i!==null?e[i]/f*100:0;return a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex w-14 flex-col justify-between text-right text-[10px] tabular-nums text-[var(--text-dim)]",style:{height:l},children:[a.jsx("span",{children:o(c)}),a.jsx("span",{children:o(0)})]}),a.jsxs("div",{ref:u,"data-testid":"line-chart",className:"relative min-w-0 flex-1",style:{height:l},onMouseMove:y,onMouseLeave:()=>p(null),children:[a.jsxs("svg",{role:"img","aria-label":x,viewBox:`0 0 ${M} ${l}`,preserveAspectRatio:"none",className:"absolute inset-0 h-full w-full overflow-visible",children:[[0,.5,1].map(r=>a.jsx("line",{x1:0,x2:M,y1:r*l,y2:r*l,stroke:"var(--border)",strokeWidth:1,vectorEffect:"non-scaling-stroke"},r)),t.map((r,d)=>a.jsx("path",{"data-series":r.key,d:A(r.values,e,h[d],f,c,M,l),fill:"none",stroke:r.color,strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:r.dashed?"4 3":void 0,vectorEffect:"non-scaling-stroke"},r.key)),i!==null&&a.jsx("line",{x1:m/100*M,x2:m/100*M,y1:0,y2:l,stroke:"var(--text-muted)",strokeWidth:1,vectorEffect:"non-scaling-stroke"})]}),i!==null&&a.jsxs("div",{role:"tooltip",className:"pointer-events-none absolute top-1 z-10 whitespace-nowrap rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1 text-[11px] text-[var(--text)]",style:m>60?{right:`${100-m}%`,marginRight:8}:{left:`${m}%`,marginLeft:8},children:[a.jsx("div",{className:"tabular-nums text-[var(--text-dim)]",children:(s??k)(e[i])}),t.map(r=>{var v;const d=r.values[i];return a.jsxs("div",{className:"flex items-center gap-1.5 tabular-nums",children:[a.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:r.color}}),a.jsx("span",{className:"text-[var(--text-muted)]",children:((v=r.pointLabels)==null?void 0:v[i])??r.label}),a.jsx("span",{className:"ml-auto pl-3",children:d==null?"—":o(d)})]},r.key)})]})]})]})};export{I as C,B as L,W as a,E as b,R as f,$ as n,L as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as g,L as X,u as z,a as H,b as K,r as a,d as O,j as e,N as B,I as W,e as Y,C as _,f as G,l as J}from"./index-
|
|
1
|
+
import{c as g,L as X,u as z,a as H,b as K,r as a,d as O,j as e,N as B,I as W,e as Y,C as _,f as G,l as J}from"./index-DI1fGIyj.js";import{c as Q}from"./utils-CDN07tui.js";import{u as V}from"./use-password-reset-mode-DgF9w088.js";import{A as Z}from"./auth-shell-DlC3_27j.js";import{L as ee}from"./lock-Dy3L4I8E.js";import{C as te}from"./clock-BtUprDsZ.js";import{A as se}from"./arrow-right-DOF8ITCz.js";import"./network-Cj8JOKON.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as N,t as M,r as d,X as C,j as e,A as D,S as y,I as w,W as A}from"./index-DI1fGIyj.js";/* empty css */import{S as o,A as k}from"./SettingCard-CWYmycoe.js";import{P as B}from"./page-header--aTyJXq6.js";import{T as z}from"./trash-2-CTZpPSdd.js";import{C as E}from"./check-BdTh1Sq7.js";import{C as R}from"./calendar-WNjmrF-a.js";import"./button-fIW8owMI.js";import"./utils-CDN07tui.js";/**
|
|
2
|
+
* @license lucide-react v0.555.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const I=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],L=N("history",I),c={buildCleanupDays:30,buildCleanupMaxCount:100,buildCleanupSchedule:"0 0 * * *",deleteBuildAssets:!0},T=[{label:"Daily (midnight)",value:"0 0 * * *"},{label:"Weekly (Sunday)",value:"0 0 * * 0"},{label:"Every 12 hours",value:"0 */12 * * *"}],P=(n,s)=>n.buildCleanupDays===s.buildCleanupDays&&n.buildCleanupMaxCount===s.buildCleanupMaxCount&&n.buildCleanupSchedule===s.buildCleanupSchedule&&n.deleteBuildAssets===s.deleteBuildAssets,J=()=>{const{toast:n}=M(),[s,i]=d.useState(c),[l,u]=d.useState(c),[f,p]=d.useState(!0),[h,m]=d.useState(!1);d.useEffect(()=>{j()},[]);const j=async()=>{p(!0);try{const a=await C.getGlobalConfig(),t={buildCleanupDays:a.buildCleanupDays||30,buildCleanupMaxCount:a.buildCleanupMaxCount||100,buildCleanupSchedule:a.buildCleanupSchedule||"0 0 * * *",deleteBuildAssets:a.deleteBuildAssets!==void 0?a.deleteBuildAssets:!0};i(t),u(t)}catch(a){console.error("Failed to load maintenance settings",a),n("Failed to access maintenance parameters.","error")}finally{p(!1)}},g=async a=>{const t=a??s;m(!0);try{await C.updateGlobalConfig(t),u(t),i(t),n("Maintenance parameters synchronized across fleet.","success")}catch(b){console.error("Failed to save maintenance settings",b),A(n,b)}finally{m(!1)}},v=async()=>{i(c),await g(c)},S=()=>{i(l)},x=!P(s,l),r={days:s.buildCleanupDays!==l.buildCleanupDays,max:s.buildCleanupMaxCount!==l.buildCleanupMaxCount,purge:s.deleteBuildAssets!==l.deleteBuildAssets,schedule:s.buildCleanupSchedule!==l.buildCleanupSchedule};return f?e.jsxs("div",{className:"settings-loading",children:[e.jsx(D,{className:"animate-spin",size:32}),e.jsx("span",{children:"Synchronizing Maintenance Parameters..."})]}):e.jsxs("div",{className:"settings-container",children:[e.jsx(B,{icon:y,title:"Maintenance",subtitle:"Manage the lifecycle of test artifacts, automated purging schedules, and storage optimization across the global registry."}),e.jsxs("div",{className:"settings-content",children:[e.jsxs("div",{className:"settings-grid settings-grid--two-equal",children:[e.jsx(o,{icon:e.jsx(L,{size:16}),title:e.jsxs("span",{className:"card-title-row",children:["Retention window",r.days&&e.jsx("span",{className:"modified-dot","aria-label":"Modified"})]}),description:"Number of days to preserve builds and sessions before automatic purging from the system.",hint:"Standard enterprise retention is typically 30-90 days.",children:e.jsxs("div",{className:"input-group",children:[e.jsx("input",{type:"number",value:s.buildCleanupDays,onChange:a=>i({...s,buildCleanupDays:parseInt(a.target.value,10)}),min:1}),e.jsx("span",{className:"code-font",children:"days"})]})}),e.jsx(o,{icon:e.jsx(z,{size:16}),title:e.jsxs("span",{className:"card-title-row",children:["Max build capacity",r.max&&e.jsx("span",{className:"modified-dot","aria-label":"Modified"})]}),description:"Cap the maximum number of historical builds stored in the primary database.",hint:"Protects against database bloat during high-frequency CI bursts.",children:e.jsxs("div",{className:"input-group",children:[e.jsx("input",{type:"number",value:s.buildCleanupMaxCount,onChange:a=>i({...s,buildCleanupMaxCount:parseInt(a.target.value,10)}),min:1}),e.jsx("span",{className:"code-font",children:"builds"})]})}),e.jsx(o,{icon:e.jsx(y,{size:16}),title:e.jsxs("span",{className:"card-title-row",children:["Asset purge strategy",r.purge&&e.jsx("span",{className:"modified-dot","aria-label":"Modified"})]}),description:"Automatically remove binary artifacts (videos, screenshots) when build records are purged.",hint:"Disabling this will leave orphaned files on disk—use with caution.",children:e.jsxs("div",{className:"toggle-group",children:[e.jsxs("label",{className:"switch",children:[e.jsx("input",{type:"checkbox",checked:s.deleteBuildAssets,onChange:a=>i({...s,deleteBuildAssets:a.target.checked})}),e.jsx("span",{className:"slider round"})]}),e.jsx("span",{className:"toggle-label",children:s.deleteBuildAssets?"Enabled":"Disabled"})]})}),e.jsxs(o,{icon:e.jsx(R,{size:16}),title:e.jsxs("span",{className:"card-title-row",children:["Cleanup orchestration",r.schedule&&e.jsx("span",{className:"modified-dot","aria-label":"Modified"})]}),description:"Standardized Cron syntax for scheduling the automated cleanup engine.",children:[e.jsx("div",{className:"setting-input-wrapper",children:e.jsx("input",{type:"text",placeholder:"e.g. 0 0 * * * (Midnight)",value:s.buildCleanupSchedule,onChange:a=>i({...s,buildCleanupSchedule:a.target.value})})}),e.jsx("div",{className:"cron-presets",children:e.jsx("div",{className:"presets-grid",children:T.map(a=>{const t=s.buildCleanupSchedule===a.value;return e.jsxs("button",{type:"button",className:`preset-chip ${t?"active":""}`,onClick:()=>i({...s,buildCleanupSchedule:a.value}),"aria-pressed":t,children:[t&&e.jsx(E,{size:11,className:"preset-chip__check"}),e.jsx("span",{children:a.label})]},a.label)})})})]})]}),e.jsxs("div",{className:"health-monitor-alert maintenance-notice",children:[e.jsx(w,{size:18}),e.jsxs("span",{children:[e.jsx("strong",{children:"Resource Notice:"})," Bulk purging operations are non-blocking and execute at low priority to ensure zero interference with active test execution."]})]})]}),(x||h)&&e.jsx(k,{onSave:()=>g(),onDiscard:S,onRestoreDefaults:v,isSaving:h,isDirty:x,saveLabel:"Save configuration"})]})};export{J as MaintenanceSettings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as y,r as h,p as E,X as p,j as e,u as R,T as H,q as L,s as M}from"./index-
|
|
1
|
+
import{c as y,r as h,p as E,X as p,j as e,u as R,T as H,q as L,s as M}from"./index-DI1fGIyj.js";import{p as T}from"./labels-C21SA4JG.js";import{A as O}from"./arrow-right-DOF8ITCz.js";import{T as B}from"./tablet-6b_SEN2X.js";import{M as P}from"./monitor-8xjkeHHi.js";import{A as U}from"./activity-Bdf_uIWl.js";import{P as X}from"./page-header--aTyJXq6.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-DI1fGIyj.js";const i=({icon:s,children:t})=>e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight text-[var(--text)]",children:[s&&e.jsx(s,{className:"h-5 w-5 text-[var(--color-accent)] shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:t})]}),l=({icon:s,eyebrow:t,title:x,subtitle:a,action:r})=>e.jsx("header",{className:"px-6 pt-6 pb-4 border-b border-[var(--border)]",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("div",{className:"text-[11px] font-semibold text-[var(--text-dim)] mb-1.5",children:t}),e.jsx(i,{icon:s,children:x}),a&&e.jsx("p",{className:"mt-1.5 text-sm text-[var(--text-muted)] max-w-3xl",children:a})]}),r&&e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:r})]})});export{l as P,i as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as S,b as N,r as n,j as e
|
|
1
|
+
import{c as S,b as N,r as n,j as e,a0 as E,A as T}from"./index-DI1fGIyj.js";import{P as A}from"./page-header--aTyJXq6.js";import{a as y,f as w}from"./time-D-gjmE1o.js";import{S as C}from"./select-DvCSv25z.js";import{C as $}from"./copy-DGSbZI3u.js";import{T as D}from"./trash-2-CTZpPSdd.js";import"./utils-CDN07tui.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as f,r as s,u as w,k as v,j as e,e as g,m as j}from"./index-
|
|
1
|
+
import{i as f,r as s,u as w,k as v,j as e,e as g,m as j}from"./index-DI1fGIyj.js";import{A as d}from"./auth-shell-DlC3_27j.js";import"./network-Cj8JOKON.js";function k(i){return window.location.hash.replace(/^#/,"")||i||void 0}function S(){const i=f(),[r]=s.useState(()=>k(i.token)),u=w(),[a,o]=s.useState("checking"),[n,x]=s.useState(""),[c,h]=s.useState(""),[m,l]=s.useState(null);s.useEffect(()=>{(window.location.hash||i.token)&&window.history.replaceState(null,"","/xenon/reset-password")},[]),s.useEffect(()=>{if(!r){o("invalid");return}v(r).then(t=>o(t?"ready":"invalid"))},[r]);async function p(t){if(t.preventDefault(),l(null),n!==c){l("Passwords do not match.");return}if(n.length<8){l("Password must be at least 8 characters.");return}o("submitting");try{await j(r,n),o("done"),setTimeout(()=>u("/login",{replace:!0}),1500)}catch(b){l(b.message||"Reset failed"),o("ready")}}return a==="checking"?e.jsx(d,{children:e.jsx("div",{className:"text-sm text-[var(--text-muted)] text-center",children:"Checking link…"})}):a==="invalid"?e.jsx(d,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"This link is invalid or expired"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Reset links are good for 1 hour and single-use. Request a new one."}),e.jsx(g,{to:"/forgot-password",className:"inline-block h-10 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium leading-10",children:"Request a new link"})]})}):a==="done"?e.jsx(d,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"Password updated"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Redirecting to sign in…"})]})}):e.jsx(d,{children:e.jsxs("form",{onSubmit:p,children:[e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:"Reset your password"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Choose a new password to sign in with."}),e.jsx("label",{htmlFor:"reset-password",className:"block text-sm font-medium text-[var(--text)] mb-1.5",children:"New password"}),e.jsx("input",{id:"reset-password",type:"password",autoComplete:"new-password",value:n,onChange:t=>x(t.target.value),autoFocus:!0,required:!0,className:"w-full mb-3 h-10 px-3 rounded-lg bg-[var(--bg)] border border-[var(--border-strong)] text-sm text-[var(--text)] outline-none focus:border-[var(--color-accent)] focus:shadow-[0_0_0_3px_var(--accent-subtle)]"}),e.jsx("label",{htmlFor:"reset-confirm",className:"block text-sm font-medium text-[var(--text)] mb-1.5",children:"Confirm new password"}),e.jsx("input",{id:"reset-confirm",type:"password",autoComplete:"new-password",value:c,onChange:t=>h(t.target.value),required:!0,className:"w-full mb-3 h-10 px-3 rounded-lg bg-[var(--bg)] border border-[var(--border-strong)] text-sm text-[var(--text)] outline-none focus:border-[var(--color-accent)] focus:shadow-[0_0_0_3px_var(--accent-subtle)]"}),m&&e.jsx("div",{role:"alert",className:"text-sm text-[var(--red)] mb-3",children:m}),e.jsx("button",{type:"submit",disabled:a==="submitting"||n.length<8,className:"mt-5 w-full h-10 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] font-medium text-sm disabled:opacity-50",children:a==="submitting"?"Updating…":"Update password"})]})})}export{S as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{H as Me,R as Ie,i as Ir,u as Tr,j as J,J as Or}from"./index-DI1fGIyj.js";import{A as vr}from"./arrow-left-B27ckB31.js";const qn=["http","https","mailto","tel"];function Lr(e){const n=(e||"").trim(),t=n.charAt(0);if(t==="#"||t==="/")return n;const r=n.indexOf(":");if(r===-1)return n;let i=-1;for(;++i<qn.length;){const l=qn[i];if(r===l.length&&n.slice(0,l.length).toLowerCase()===l)return n}return i=n.indexOf("?"),i!==-1&&r>i||(i=n.indexOf("#"),i!==-1&&r>i)?n:"javascript:void(0)"}/*!
|
|
2
2
|
* Determine if an object is a Buffer
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as m}from"./index-
|
|
1
|
+
import{r as c,j as m}from"./index-DI1fGIyj.js";import{c as o}from"./utils-CDN07tui.js";const l=c.forwardRef(({className:s,selectSize:e="md",children:t,...a},r)=>m.jsx("select",{ref:r,className:o("select-base",e==="sm"&&"select-sm",s),...a,children:t}));l.displayName="Select";export{l as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{G as e,j as t,N as r}from"./index-DI1fGIyj.js";import{l as s}from"./view-state-83Z1gFME.js";const i=()=>{const[a]=e();return t.jsx(r,{to:s(a),replace:!0})};export{i as SelectorDetailRedirect,i as default};
|
package/lib/public/assets/{selector-health-page-DsyL58tb.js → selector-health-page-oqadRokn.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ae,p as ne,r as d,j as t,A as fe,v as re,z as ve,w as ge,t as le,X as I,e as be,
|
|
1
|
+
import{c as ae,p as ne,r as d,j as t,A as fe,v as re,z as ve,w as ge,t as le,X as I,e as be,G as ye,b as je,P as Ne}from"./index-DI1fGIyj.js";import{P as Se}from"./page-header--aTyJXq6.js";import{a as ke}from"./SegmentedControl-Zy7suhT5.js";import{B as N}from"./button-fIW8owMI.js";import{S as we}from"./stat-tile-DV9Ix-4O.js";import{L as ie,n as Ce,C as Ae}from"./line-chart-C0zdgd0v.js";import{E as $e}from"./EmptyState-Cr17PdDv.js";import{I as Me}from"./input-BjDRKCea.js";import{S as O}from"./select-DvCSv25z.js";import{s as _,r as Y,w as Ee,P as Te,b as _e}from"./view-state-83Z1gFME.js";import{p as Le}from"./labels-C21SA4JG.js";import{M as R}from"./Modal-Cg9V5JYU.js";import{C as Ie}from"./check-BdTh1Sq7.js";import{C as oe}from"./copy-DGSbZI3u.js";import"./utils-CDN07tui.js";import"./index-HDQVe1gi.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{c as ae,p as ne,r as d,j as t,A as fe,v as re,z as ve,w as ge,t as le,X a
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Re=ae("send",Pe),Fe=3e4,Oe=5*6e4;function ze({onShow:e}){const{on:n}=ne(),[s,l]=d.useState([]);if(d.useEffect(()=>{const o=n("selector_regressed",r=>{l(i=>{const u=Date.now()-Oe;return[...i.filter(b=>b.receivedAt>=u),{strategy:(r==null?void 0:r.original_strategy)??"",selector:(r==null?void 0:r.original_selector)??"",receivedAt:Date.now()}]})});return()=>{o&&o()}},[n]),d.useEffect(()=>{if(s.length===0)return;const o=setTimeout(()=>l([]),Fe);return()=>clearTimeout(o)},[s]),s.length===0)return null;const c=s.length===1?s[0]:null;return t.jsxs("div",{role:"alert",className:"flex items-center gap-3 rounded-lg border border-[var(--color-warning)] bg-[var(--surface)] px-4 py-2.5 text-sm text-[var(--text)]",children:[t.jsx(fe,{size:14,className:"shrink-0 text-[var(--color-warning)]","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:c?t.jsxs(t.Fragment,{children:["A selector you fixed broke again:"," ",t.jsx("code",{className:"font-mono text-xs",title:c.selector,children:c.selector})]}):`${s.length} selectors you fixed broke again in the last 5 minutes.`}),t.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{e(s.map(({strategy:o,selector:r})=>({strategy:o,selector:r}))),l([])},children:"Show selectors to fix"}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>l([]),className:"rounded p-1 text-[var(--text-muted)] hover:text-[var(--text)]",children:t.jsx(re,{size:13})})]})}const He={"accessibility id":"Accessibility ID",xpath:"XPath",id:"ID",name:"Name","class name":"Class Name","-android uiautomator":"UiAutomator","-ios predicate string":"iOS Predicate","-ios class chain":"iOS Class Chain","xenon:visual":"Visual AI (coords)"};function Ue(e){return e?He[e]??e:"(unknown strategy)"}const Xe={fix:"To fix",verifying:"Being verified",fixed:"Fixed",muted:"Muted"},qe={heals:"Most heals",recent:"Most recent",time:"Most time spent healing"},Ve=["Resilio","Native","Fuzzy XML","OCR","Visual AI","LLM"],P={Resilio:"Found it from its saved fingerprint",Native:"Found it again with the original selector","Fuzzy XML":"Found the closest match in the screen's structure",OCR:"Found it by reading the text on screen","Visual AI":"Found it in a screenshot with AI",LLM:"Asked a language model to find it"},Ke=[{value:"android",label:"Android"},{value:"ios",label:"iOS"},{value:"tvos",label:"tvOS"}];function J(e){if(!(e>0))return"0 s";const n=e/1e3;if(n<1)return"<1 s";if(Math.round(n)<60)return`${Math.round(n)} s`;const s=n/60;if(Math.round(s)<60)return`${Math.round(s)} min`;const l=s/60;return`${l<10?l.toFixed(1):Math.round(l)} h`}function q(e,n=Date.now()){if(!e)return"—";const s=Date.parse(e);if(!Number.isFinite(s))return"—";const l=Math.floor(Math.max(0,n-s)/6e4);if(l<1)return"just now";if(l<60)return`${l} min ago`;const c=Math.floor(l/60);if(c<24)return`${c} h ago`;const o=Math.floor(c/24);return o===1?"yesterday":`${o} days ago`}function ce(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function V(e){if(!e)return"—";const n=Date.parse(e);return Number.isFinite(n)?new Date(n).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—"}function Ge(e,n,s,l){const c=`the ${s} days before`;if(e===n)return{text:`Same as ${c}`,tone:"neutral"};if(n===0)return{text:`None ${c}`,tone:"bad"};const o=e>n,r=o?"bad":"good";if(l==="count")return{text:`${Math.abs(e-n)} ${o?"more":"fewer"} than ${c}`,tone:r};if(l==="duration")return{text:`${J(Math.abs(e-n))} ${o?"more":"less"} than ${c}`,tone:r};const i=Math.round(Math.abs(e-n)/n*100);return i===0?{text:`About the same as ${c}`,tone:"neutral"}:{text:`${i}% ${o?"more":"fewer"} than ${c}`,tone:r}}function de(e){return`${Math.round(e*100)}% of heals`}function K(e){return e?Ue(e):"Unknown type"}function Je(e){switch(e==null?void 0:e.status){case"pending":return`Being verified, ${e.cleanBuilds} of 3 clean builds`;case"resolved":return"Fixed";case"muted":return"Muted";default:return"To fix"}}function G(e){return e!=null&&e.name?` by ${e.name}`:""}const We={marked_fixed:"Marked fixed",verification_cancelled:"Verification cancelled",verified:"Verified after 3 clean builds",broke_again:"Broke again",muted:"Muted",unmuted:"Unmuted"};function Ye(e){return`${We[e.action]??"Changed"}${G(e.by)}`}const H=e=>e.toLocaleString(),Qe=({summary:e,days:n})=>{const s=e==null?void 0:e.current,l=e==null?void 0:e.prior,c=[{label:"Selectors that needed healing",value:s==null?void 0:s.distinctSelectors,before:l==null?void 0:l.distinctSelectors,kind:"count",show:H},{label:"Heals",value:s==null?void 0:s.totalHeals,before:l==null?void 0:l.totalHeals,kind:"percent",show:H},{label:"Sessions affected",value:s==null?void 0:s.sessionsTouched,before:l==null?void 0:l.sessionsTouched,kind:"percent",show:H},{label:"Time spent healing",value:s==null?void 0:s.timeSpentMs,before:l==null?void 0:l.timeSpentMs,kind:"duration",show:J}];return t.jsx("div",{className:"grid grid-cols-4 gap-3",children:c.map(o=>{const r=o.value!==void 0&&o.before!==void 0?Ge(o.value,o.before,n,o.kind):null;return t.jsx(we,{label:o.label,value:o.value!==void 0?o.show(o.value):"—",note:r==null?void 0:r.text,noteTone:(r==null?void 0:r.tone)??"neutral"},o.label)})})},Q="var(--color-info)",Z="var(--color-warning)",ee=({color:e,label:n,total:s})=>t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:e}}),t.jsx("span",{children:n}),t.jsx("span",{className:"tabular-nums text-[var(--text)]",children:s.toLocaleString()})]}),Ze=({trend:e,days:n,failed:s})=>{var h;const l=d.useMemo(()=>e??[],[e]),c=((h=l[0])==null?void 0:h.t)??0,o=l.reduce((m,y)=>m+y.heals,0),r=l.reduce((m,y)=>m+y.aiHeals,0),i=d.useMemo(()=>l.map(m=>m.t-c),[l,c]),u=d.useMemo(()=>[{key:"heals",label:"All heals",color:Q,values:l.map(m=>m.heals)},{key:"ai",label:"Heals that used AI",color:Z,values:l.map(m=>m.aiHeals)}],[l]),b=l.reduce((m,y)=>Math.max(m,y.heals),0);let p;return e===null&&s?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Couldn't load heals per day. Try again in a moment."}):e===null?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}):o===0?p=t.jsxs("div",{className:"text-xs text-[var(--text-dim)]",children:["No heals in the last ",n," days."]}):p=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-[var(--text-muted)]",children:[t.jsx(ee,{color:Q,label:"All heals",total:o}),t.jsx(ee,{color:Z,label:"Heals that used AI",total:r})]}),t.jsx(ie,{times:i,series:u,yMax:Ce(b),formatValue:m=>String(Math.round(m)),formatTime:m=>ce(c+m),ariaLabel:"Heals per day",height:120})]}),t.jsx(Ae,{header:"Heals per day",children:p})},D=({title:e,tone:n="neutral",children:s})=>t.jsx("span",{title:e,className:`inline-block max-w-full truncate rounded px-1.5 py-px text-[10px] font-medium ${n==="warning"?"border border-[var(--color-warning)] text-[var(--color-warning)]":"bg-[rgb(var(--rgb-fg)/0.06)] text-[var(--text-muted)]"}`,children:s}),te=({strategy:e,text:n,extra:s})=>t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-0.5 flex min-w-0 items-center gap-1.5",children:[t.jsx(D,{children:K(e)}),s]}),t.jsx("code",{className:"line-clamp-2 break-all font-mono text-[11px] leading-snug text-[var(--text)]",title:n,children:n})]}),et=300,tt=["fix","verifying","fixed","muted"],st=["heals","recent","time"],E=e=>t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:e});function at(e,n,s){const l={key:"selector",label:"Selector",cell:r=>t.jsx(te,{strategy:r.strategy,text:r.selector,extra:e==="fix"&&r.state&&r.state.brokeAgain>0?t.jsx(D,{tone:"warning",children:"Broke again"}):null})},c=r=>({key:"heals",label:r,width:"96px",cell:i=>t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold tabular-nums text-[var(--text)]",children:i.heals.toLocaleString()}),t.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.sessions," ",i.sessions===1?"session":"sessions"]})]})}),o={key:"last",label:"Last healed",width:"104px",cell:r=>E(q(r.lastHealedAt))};switch(e){case"fix":return n?[l,c("Heals"),o]:[l,c("Heals"),o,{key:"method",label:"Healed by",width:"112px",cell:r=>r.topMethod?t.jsx(D,{title:P[r.topMethod],children:r.topMethod}):E("—")},{key:"fix",label:"Suggested fix",width:"34%",cell:r=>r.suggestion?t.jsx(te,{strategy:r.suggestion.strategy,text:r.suggestion.selector,extra:t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:de(r.suggestion.share)})}):E("None yet")}];case"verifying":{const r={key:"progress",label:"Progress",width:"150px",cell:i=>{var u;return t.jsxs("span",{className:"text-xs text-[var(--text)]",children:[((u=i.state)==null?void 0:u.cleanBuilds)??0," of 3 clean builds"]})}};return n?[l,r]:[l,r,{key:"marked",label:"Marked fixed",width:"180px",cell:i=>{var u,b;return E(`${q(((u=i.state)==null?void 0:u.fixedAt)??null)}${G(((b=i.state)==null?void 0:b.fixedBy)??null)}`)}},c(`Heals, ${s} days`)]}case"fixed":{const r={key:"verified",label:"Verified",width:"140px",cell:i=>{var u;return E(V(((u=i.state)==null?void 0:u.resolvedAt)??null))}};return n?[l,r]:[l,r,c(`Heals, ${s} days`)]}case"muted":{const r={key:"muted",label:"Muted",width:"180px",cell:i=>{var u,b;return E(`${V(((u=i.state)==null?void 0:u.mutedAt)??null)}${G(((b=i.state)==null?void 0:b.mutedBy)??null)}`)}};return n?[l,r]:[l,r,{key:"reason",label:"Reason",width:"26%",cell:i=>{var u;return(u=i.state)!=null&&u.muteReason?t.jsx("span",{className:"line-clamp-2 text-xs text-[var(--text)]",children:i.state.muteReason}):E("No reason given")}},c(`Heals, ${s} days`)]}}}function nt(e,n,s){if(n)return{title:`No selectors match “${n}”`,description:"Try fewer or different words."};switch(e){case"fix":return{title:`Nothing to fix in the last ${s} days`,description:"Every selector your tests used was found without healing."};case"verifying":return{title:"Nothing being verified",description:"When you mark a selector fixed, Xenon watches its next 3 clean builds here."};case"fixed":return{title:`Nothing fixed in the last ${s} days`,description:"Selectors that pass 3 clean builds after being marked fixed show here."};case"muted":return{title:"Nothing muted",description:"A muted selector is left out of this list, the CI gate and the digest."}}}const rt=({view:e,data:n,loading:s,compact:l,selectedKey:c,onView:o,onOpen:r,error:i})=>{const[u,b]=d.useState(e.q);d.useEffect(()=>b(e.q),[e.q]),d.useEffect(()=>{if(u===e.q)return;const a=setTimeout(()=>o({q:u,page:1}),et);return()=>clearTimeout(a)},[u,e.q,o]);const p=at(e.tab,l,e.days),h=n&&n.tab===e.tab?n:null,m=(h==null?void 0:h.items)??[],y=(h==null?void 0:h.total)??0,k=(h==null?void 0:h.page)??e.page,w=(h==null?void 0:h.pageSize)??50,T=Math.max(1,Math.ceil(y/w)),A=y===0?0:(k-1)*w+1,C=Math.min(y,k*w),$=nt(e.tab,e.q,e.days);return t.jsxs("section",{"aria-label":"Selectors",className:"rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsx("div",{role:"tablist","aria-label":"Selector status",className:"flex gap-1 border-b border-[var(--border)] px-3",children:tt.map(a=>{var j;const g=e.tab===a,f=(j=n==null?void 0:n.counts)==null?void 0:j[a];return t.jsxs("button",{type:"button",role:"tab","aria-selected":g,onClick:()=>{g||o({tab:a,page:1})},className:`-mb-px flex items-center gap-2 border-b-2 px-3 py-2.5 text-sm ${g?"border-[var(--color-accent)] font-medium text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:[Xe[a],t.jsx("span",{className:"rounded-full bg-[rgb(var(--rgb-fg)/0.08)] px-1.5 text-[11px] tabular-nums",children:typeof f=="number"?f.toLocaleString():"–"})]},a)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--border)] px-3 py-2.5",children:[t.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[t.jsx(ve,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-dim)]"}),t.jsx(Me,{type:"search","aria-label":"Search",value:u,onChange:a=>b(a.target.value),placeholder:e.tab==="fix"?"Search selectors and fixes":"Search selectors",className:"h-8 w-full pl-8 pr-2 text-xs"})]}),e.tab==="fix"&&t.jsxs(t.Fragment,{children:[t.jsxs(z,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Platform",value:e.platform,onChange:a=>o({platform:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All platforms"}),Ke.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))]}),t.jsxs(z,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Healing method",value:e.method,onChange:a=>o({method:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All healing methods"}),Ve.map(a=>t.jsx("option",{value:a,title:P[a],children:a},a))]}),t.jsx(z,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Sort",value:e.sort,onChange:a=>o({sort:a.target.value,page:1}),children:st.map(a=>t.jsx("option",{value:a,children:qe[a]},a))})]})]}),h?m.length===0?t.jsx($e,{title:$.title,description:$.description}):t.jsxs("table",{className:"w-full table-fixed text-left",children:[t.jsx("colgroup",{children:p.map(a=>t.jsx("col",{style:a.width?{width:a.width}:void 0},a.key))}),t.jsx("thead",{children:t.jsx("tr",{children:p.map(a=>t.jsx("th",{scope:"col",className:"px-3 py-2 text-[11px] font-medium text-[var(--text-muted)]",children:a.label},a.key))})}),t.jsx("tbody",{children:m.map(a=>{const g=_(a),f=g===c,j=()=>r({strategy:a.strategy,selector:a.selector});return t.jsx("tr",{tabIndex:0,"data-selector-row":"","data-key":g,"aria-current":f?"true":void 0,onClick:j,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),j())},className:`cursor-pointer border-t border-[var(--border)] align-top outline-none hover:bg-[rgb(var(--rgb-fg)/0.03)] focus-visible:bg-[rgb(var(--rgb-fg)/0.05)] ${f?"bg-[rgb(var(--rgb-fg)/0.06)]":""}`,children:p.map(M=>t.jsx("td",{className:"px-3 py-2.5 text-xs",children:M.cell(a)},M.key))},g)})})]}):t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:i&&!s?"Couldn't load selectors. Try again in a moment.":"Loading selectors…"}),y>0&&t.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] px-3 py-2 text-xs text-[var(--text-muted)]",children:[t.jsxs("span",{className:"tabular-nums",children:[A,"–",C," of ",y.toLocaleString()]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{variant:"secondary",size:"sm",disabled:k<=1,onClick:()=>o({page:k-1}),children:"Previous"}),t.jsx(N,{variant:"secondary",size:"sm",disabled:k>=T,onClick:()=>o({page:k+1}),children:"Next"})]})]})]})},lt={javascript:{"accessibility id":e=>`await driver.findElement('accessibility id', '${e}')`,xpath:e=>`await driver.findElement('xpath', '${e}')`,id:e=>`await driver.findElement('id', '${e}')`,name:e=>`await driver.findElement('name', '${e}')`,"class name":e=>`await driver.findElement('class name', '${e}')`,"-android uiautomator":e=>`await driver.findElement('-android uiautomator', '${e}')`,"-ios predicate string":e=>`await driver.findElement('-ios predicate string', '${e}')`,"-ios class chain":e=>`await driver.findElement('-ios class chain', '${e}')`},java:{"accessibility id":e=>`driver.findElement(AppiumBy.accessibilityId("${e}"))`,xpath:e=>`driver.findElement(AppiumBy.xpath("${e}"))`,id:e=>`driver.findElement(AppiumBy.id("${e}"))`,name:e=>`driver.findElement(AppiumBy.name("${e}"))`,"class name":e=>`driver.findElement(AppiumBy.className("${e}"))`,"-android uiautomator":e=>`driver.findElement(AppiumBy.androidUIAutomator("${e}"))`,"-ios predicate string":e=>`driver.findElement(AppiumBy.iOSNsPredicateString("${e}"))`,"-ios class chain":e=>`driver.findElement(AppiumBy.iOSClassChain("${e}"))`},python:{"accessibility id":e=>`driver.find_element(AppiumBy.ACCESSIBILITY_ID, '${e}')`,xpath:e=>`driver.find_element(AppiumBy.XPATH, '${e}')`,id:e=>`driver.find_element(AppiumBy.ID, '${e}')`,name:e=>`driver.find_element(AppiumBy.NAME, '${e}')`,"class name":e=>`driver.find_element(AppiumBy.CLASS_NAME, '${e}')`,"-android uiautomator":e=>`driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, '${e}')`,"-ios predicate string":e=>`driver.find_element(AppiumBy.IOS_PREDICATE, '${e}')`,"-ios class chain":e=>`driver.find_element(AppiumBy.IOS_CLASS_CHAIN, '${e}')`},csharp:{"accessibility id":e=>`driver.FindElement(MobileBy.AccessibilityId("${e}"))`,xpath:e=>`driver.FindElement(By.XPath("${e}"))`,id:e=>`driver.FindElement(By.Id("${e}"))`,name:e=>`driver.FindElement(By.Name("${e}"))`,"class name":e=>`driver.FindElement(By.ClassName("${e}"))`},ruby:{"accessibility id":e=>`driver.find_element(:accessibility_id, '${e}')`,xpath:e=>`driver.find_element(:xpath, '${e}')`,id:e=>`driver.find_element(:id, '${e}')`,name:e=>`driver.find_element(:name, '${e}')`,"class name":e=>`driver.find_element(:class_name, '${e}')`}};function it(e,n){const s=e==="java"||e==="csharp",l=n.replace(/\\/g,"\\\\");return s?l.replace(/"/g,'\\"'):l.replace(/'/g,"\\'")}function ue(e,n,s){var c;if(n==="xenon:visual")return"/* Visual AI (coordinates) — no portable Appium snippet. Use snapshot view to find a stable native locator. */";const l=(c=lt[e])==null?void 0:c[n];return l?l(it(e,s)):`${(n??"").toString().toUpperCase()}: ${s}`}const W=[{value:"javascript",short:"JS",label:"JavaScript (WebdriverIO)"},{value:"java",short:"Java",label:"Java (Appium-Java)"},{value:"python",short:"Py",label:"Python (Appium-Python)"},{value:"csharp",short:"C#",label:"C# (.NET)"},{value:"ruby",short:"Rb",label:"Ruby"}],me="xenon.copyLang";function ot(){try{const e=localStorage.getItem(me);return e&&W.find(n=>n.value===e)?e:null}catch{return null}}function ct(e){try{localStorage.setItem(me,e)}catch{}}function xe(e){var n;return((n=W.find(s=>s.value===e))==null?void 0:n.short)??e}function dt({open:e,initialLang:n,strategy:s,value:l,onCopy:c,onClose:o}){const[r,i]=d.useState(n??"javascript"),[u,b]=d.useState(!0),p=ue(r,s,l),h=async()=>{try{await navigator.clipboard.writeText(p)}catch{}u&&ct(r),c(r,p),o()};return t.jsxs(R,{open:e,onClose:o,title:"Choose your default copy language",width:520,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:o,children:"Cancel"}),t.jsxs(N,{onClick:h,children:["Copy as ",xe(r)]})]}),children:[t.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"Snippets will be copied in this language until you change it."}),t.jsx("ul",{className:"mb-3 space-y-1",children:W.map(m=>t.jsx("li",{children:t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text)]",children:[t.jsx("input",{type:"radio",name:"copy-lang",value:m.value,checked:r===m.value,onChange:()=>i(m.value)}),m.label]})},m.value))}),t.jsx("div",{className:"mb-1 text-[11px] font-semibold text-[var(--text-dim)]",children:"Preview"}),t.jsx("pre",{className:"mb-3 overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--surface-sunken)] p-3 font-mono text-[11px] text-[var(--text)]",children:t.jsx("code",{children:p})}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-muted)]",children:[t.jsx("input",{type:"checkbox",checked:u,onChange:m=>b(m.target.checked)}),"Remember my choice"]})]})}function ut({strategy:e,value:n,onCopied:s}){const[l,c]=d.useState(!1),[o,r]=d.useState(!1),i=ot(),u=e==="xenon:visual",b=async()=>{if(!i){c(!0);return}try{await navigator.clipboard.writeText(ue(i,e,n))}catch{}r(!0),s(i),setTimeout(()=>r(!1),1500)},p=i?`Copy as ${xe(i)}`:"Copy as code";return t.jsxs("span",{className:"inline-flex shrink-0",children:[t.jsxs(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-r-none",onClick:h=>{h.stopPropagation(),b()},disabled:u&&!n,"aria-label":p,title:u?"Found by its place on screen: there is no selector to copy":p,children:[o?t.jsx(Ie,{size:12}):t.jsx(oe,{size:12}),t.jsx("span",{children:o?"Copied":i?p:"Copy as…"})]}),t.jsx(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-l-none border-l-0 px-1.5",onClick:h=>{h.stopPropagation(),c(!0)},title:"Choose copy language","aria-label":"Choose copy language",children:t.jsx(ge,{size:12})}),t.jsx(dt,{open:l,initialLang:i??void 0,strategy:e,value:n,onCopy:h=>{r(!0),s(h),setTimeout(()=>r(!1),1500)},onClose:()=>c(!1)})]})}const se=500,mt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Mark this selector fixed?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:l,disabled:n,children:"Mark fixed"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Xenon watches the next 3 clean builds. If this selector heals again, it goes back to To fix."})}),xt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Cancel verification?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Keep verifying"}),t.jsx(N,{onClick:l,disabled:n,children:"Cancel verification"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"The selector goes back to To fix, and its clean builds start again from zero."})}),ht=({open:e,busy:n,onClose:s,onConfirm:l})=>{const[c,o]=d.useState("");return d.useEffect(()=>{e&&o("")},[e]),t.jsxs(R,{open:e,onClose:s,title:"Mute this selector?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:()=>l(c.trim()),disabled:n,children:"Mute"})]}),children:[t.jsx("p",{className:"mb-3 text-sm text-[var(--text-muted)]",children:"A muted selector is left out of this list, the CI gate and the digest, for everyone, until someone unmutes it."}),t.jsx("label",{htmlFor:"mute-reason",className:"block text-xs font-medium text-[var(--text)]",children:"Reason (optional)"}),t.jsx("textarea",{id:"mute-reason",value:c,maxLength:se,rows:3,placeholder:"Screen being redesigned",onChange:r=>o(r.target.value),className:"mt-1 w-full rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1.5 text-sm text-[var(--text)]"}),t.jsxs("div",{className:"mt-1 text-right text-[11px] tabular-nums text-[var(--text-dim)]",children:[c.length,"/",se]})]})},pt={mark_fixed:"Marked fixed. Xenon is watching the next 3 clean builds.",mute:"Muted.",unmute:"Unmuted.",cancel_verification:"Verification cancelled."},ft={pending:"border-[var(--color-info)] text-[var(--color-info)]",resolved:"border-[var(--color-success)] text-[var(--color-success)]",muted:"border-[var(--border-strong)] text-[var(--text-muted)]"},vt=({state:e})=>t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[11px] font-medium ${ft[(e==null?void 0:e.status)??""]??"border-[var(--color-danger)] text-[var(--color-danger)]"}`,children:Je(e)}),U=({label:e,onClick:n,children:s})=>t.jsx("button",{type:"button","aria-label":e,title:e,onClick:n,className:"rounded p-1.5 text-[var(--text-muted)] hover:bg-[rgb(var(--rgb-fg)/0.06)] hover:text-[var(--text)]",children:s}),L=({title:e,children:n})=>t.jsxs("section",{"aria-label":e,children:[t.jsx("h3",{className:"mb-2 text-xs font-semibold text-[var(--text)]",children:e}),n]}),X=({title:e,rows:n})=>n.length===0?null:t.jsxs("div",{className:"mb-3",children:[t.jsx("div",{className:"mb-1 text-[11px] text-[var(--text-dim)]",children:e}),n.map(s=>t.jsxs("div",{className:"flex justify-between gap-3 py-0.5 text-xs",children:[t.jsx("span",{className:"min-w-0 truncate text-[var(--text)]",title:s.label,children:s.label}),t.jsx("span",{className:"shrink-0 tabular-nums text-[var(--text-muted)]",children:s.count.toLocaleString()})]},s.key))]}),gt=({activity:e})=>t.jsx(L,{title:"Activity",children:e.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No changes recorded yet."}):t.jsx("ul",{children:e.map((n,s)=>t.jsxs("li",{className:"flex justify-between gap-3 py-1 text-[11px]",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"text-[var(--text)]",children:Ye(n)}),n.reason&&t.jsxs("span",{className:"text-[var(--text-muted)]",children:[": “",n.reason,"”"]})]}),t.jsx("span",{className:"shrink-0 text-[var(--text-dim)]",children:V(n.at)})]},`${n.at}-${s}`))})}),bt=({target:e,days:n,tz:s,refreshKey:l,onClose:c,onChanged:o})=>{var $;const{toast:r}=le(),[i,u]=d.useState(null),[b,p]=d.useState("loading"),[h,m]=d.useState(null),[y,k]=d.useState(!1);d.useEffect(()=>{u(null),p("loading")},[e.strategy,e.selector]),d.useEffect(()=>{let a=!0;return I.getSelectorPanel(e.strategy,e.selector,n,s).then(({status:g,body:f})=>{a&&(g===404?(u(null),p("missing")):g===200&&f?(u(f),p("ready")):p("failed"))}).catch(()=>{a&&p("failed")}),()=>{a=!1}},[e.strategy,e.selector,n,s,l]);const w=async(a,g)=>{k(!0);try{await I.postSelectorStateAction({original_strategy:e.strategy,original_selector:e.selector,action:a,...g?{reason:g}:{}}),r(pt[a],"success")}catch(f){const j=f.status;r(j===409?"Someone changed this selector just now. It has been refreshed.":j===404?"This selector isn't available any more.":"That didn't work. Try again.","error")}finally{k(!1),m(null),o()}},T=async(a,g)=>{try{await navigator.clipboard.writeText(a),r(g,"success")}catch{r("Couldn't copy: your browser blocked it.","error")}},A=(($=i==null?void 0:i.state)==null?void 0:$.status)??"active",C=d.useMemo(()=>{var f;const a=(i==null?void 0:i.daily)??[],g=((f=a[0])==null?void 0:f.t)??0;return{start:g,times:a.map(j=>j.t-g),values:a.map(j=>j.heals)}},[i]);return t.jsxs("aside",{"aria-label":"Selector details",className:"sticky top-4 flex max-h-[calc(100vh-7rem)] w-[480px] shrink-0 flex-col overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs("header",{className:"border-b border-[var(--border)] p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(D,{children:K(e.strategy)}),i&&t.jsx(vt,{state:i.state}),t.jsxs("span",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx(U,{label:"Copy selector",onClick:()=>void T(e.selector,"Selector copied"),children:t.jsx(oe,{size:14})}),t.jsx(U,{label:"Copy link to this selector",onClick:()=>void T(window.location.href,"Link copied"),children:t.jsx(Be,{size:14})}),t.jsx(U,{label:"Close",onClick:c,children:t.jsx(re,{size:14})})]})]}),t.jsx("code",{className:"mt-2 block break-all font-mono text-xs leading-relaxed text-[var(--text)]",children:e.selector}),(i==null?void 0:i.canAct)&&t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[A==="active"&&e.strategy!==""&&t.jsx(N,{size:"sm",onClick:()=>m("mark_fixed"),children:"Mark fixed"}),A==="pending"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("cancel_verification"),children:"Cancel verification"}),A!=="muted"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("mute"),children:"Mute…"}),A==="muted"&&t.jsx(N,{size:"sm",variant:"secondary",disabled:y,onClick:()=>void w("unmute"),children:"Unmute"})]})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-4",children:[b==="loading"&&t.jsx("p",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}),b==="missing"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"This selector isn't available. It may belong to another team, or Xenon has no heals on record for it."}),b==="failed"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Couldn't load this selector. Try again in a moment."}),i&&i.heals===0&&t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["No heals in the last ",n," days."]}),i&&i.heals>0&&t.jsxs(t.Fragment,{children:[t.jsx(L,{title:"Suggested fix",children:i.suggestions.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Xenon found the element without a selector it can suggest."}):t.jsx("ul",{className:"space-y-2",children:i.suggestions.map((a,g)=>t.jsx("li",{className:`rounded-md border p-2.5 ${g===0?"border-[var(--color-success)]":"border-[var(--border)]"}`,children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[t.jsx(D,{children:K(a.strategy)}),t.jsx("span",{children:de(a.share)}),a.methods.length>0&&t.jsxs("span",{title:a.methods.map(f=>P[f]??f).join(". "),children:["· ",a.methods.join(", ")]}),a.averageConfidence!==null&&t.jsxs("span",{children:["· ",Math.round(a.averageConfidence*100),"% confidence"]})]}),t.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--text)]",children:a.selector})]}),t.jsx(ut,{strategy:a.strategy??e.strategy,value:a.selector,onCopied:f=>r(`Copied as ${f}`,"success")})]})},`${a.strategy??""}\0${a.selector}`))})}),t.jsxs(L,{title:`In the last ${n} days`,children:[t.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:i.heals===1?"heal":"heals",value:i.heals.toLocaleString()},{label:i.sessions===1?"session":"sessions",value:i.sessions.toLocaleString()},{label:"spent healing",value:J(i.timeSpentMs)}].map(a=>t.jsxs("div",{className:"rounded-md bg-[rgb(var(--rgb-fg)/0.04)] px-2.5 py-2",children:[t.jsx("div",{className:"text-sm font-semibold tabular-nums text-[var(--text)]",children:a.value}),t.jsx("div",{className:"text-[11px] text-[var(--text-muted)]",children:a.label})]},a.label))}),C.times.length>1&&t.jsx("div",{className:"mt-3",children:t.jsx(ie,{times:C.times,series:[{key:"heals",label:"Heals",color:"var(--color-info)",values:C.values}],formatValue:a=>String(Math.round(a)),formatTime:a=>ce(C.start+a),ariaLabel:"Heals per day for this selector",height:56})})]}),t.jsxs(L,{title:"Where it happens",children:[t.jsx(X,{title:"Platforms",rows:i.platforms.map(a=>({key:a.name,label:Le(a.name),count:a.count}))}),t.jsx(X,{title:"Builds",rows:i.builds.map(a=>({key:a.id??"",label:a.name,count:a.count}))}),t.jsx(X,{title:"Devices",rows:i.devices.map(a=>({key:a.udid,label:a.name,count:a.count}))})]}),t.jsx(L,{title:"Recent heals",children:t.jsx("ul",{className:"divide-y divide-[var(--border)]",children:i.recent.map(a=>t.jsxs("li",{className:"py-2 text-[11px]",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[var(--text-muted)]",children:[t.jsx("span",{children:q(a.at)}),a.device&&t.jsxs("span",{className:"min-w-0 truncate",children:["· ",a.device]}),a.method&&t.jsxs("span",{title:P[a.method],children:["· ",a.method,a.confidence!==null?` ${Math.round(a.confidence*100)}%`:""]}),t.jsx(be,{className:"ml-auto shrink-0 text-[var(--color-accent)] hover:underline",to:`/builds/${encodeURIComponent(a.buildId??"none")}/sessions/${encodeURIComponent(a.sessionId)}`,children:"Session"})]}),a.healedSelector&&t.jsx("code",{className:"mt-0.5 block truncate font-mono text-[var(--text)]",title:a.healedSelector,children:a.healedSelector})]},a.id))})})]}),i&&t.jsx(gt,{activity:i.activity})]}),t.jsx(mt,{open:h==="mark_fixed",busy:y,onClose:()=>m(null),onConfirm:()=>void w("mark_fixed")}),t.jsx(xt,{open:h==="cancel_verification",busy:y,onClose:()=>m(null),onConfirm:()=>void w("cancel_verification")}),t.jsx(ht,{open:h==="mute",busy:y,onClose:()=>m(null),onConfirm:a=>void w("mute",a||void 0)})]})},yt=1e3,jt=["healing_event","selector_fixed","selector_resolved","selector_regressed","selector_cancelled","selector_muted","selector_unmuted","selector_progress"],Nt=e=>!!e&&(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.isContentEditable),Ft=()=>{const[e,n]=ye(),s=d.useMemo(()=>Y(e),[e]),l=d.useMemo(()=>-new Date().getTimezoneOffset(),[]),{on:c}=ne(),{toast:o}=le(),{me:r}=je(),i=!!r&&(r.role==="ADMIN"||r.role==="SUPER_ADMIN"||!!r.authDisabled),[u,b]=d.useState(null),[p,h]=d.useState(null),[m,y]=d.useState(!1),[k,w]=d.useState(!1),[T,A]=d.useState(!0),[C,$]=d.useState(0),[a,g]=d.useState(!1),f=d.useCallback((x,v=!1)=>n(Ee({...Y(e),...x}),{replace:v}),[e,n]);d.useEffect(()=>{let x=!0;return I.getHealingSummary(s.days,l).then(v=>{x&&(b(v??null),w(!1))}).catch(()=>{x&&w(!0)}),()=>{x=!1}},[s.days,l,C]),d.useEffect(()=>{let x=!0;return A(!0),I.getHealingSelectors({tab:s.tab,days:s.days,q:s.q,platform:s.platform,method:s.method,sort:s.sort,page:s.page}).then(v=>{x&&(h(v??null),y(!1))}).catch(()=>{x&&y(!0)}).finally(()=>{x&&A(!1)}),()=>{x=!1}},[s.tab,s.days,s.q,s.platform,s.method,s.sort,s.page,C]);const j=d.useRef(null);d.useEffect(()=>{const x=()=>{j.current||(j.current=setTimeout(()=>{j.current=null,$(S=>S+1)},yt))},v=jt.map(S=>c(S,x));return()=>{v.forEach(S=>S&&S()),j.current&&clearTimeout(j.current),j.current=null}},[c]);const M=d.useCallback(x=>f({open:x}),[f]),F=d.useCallback(()=>{const x=s.open?_(s.open):null;f({open:null}),setTimeout(()=>{var S;(S=Array.from(document.querySelectorAll("[data-selector-row]")).find(B=>B.dataset.key===x))==null||S.focus()},0)},[s.open,f]),O=d.useCallback(x=>{const v=(p==null?void 0:p.items)??[];if(v.length===0)return;const S=s.open?v.findIndex(pe=>_(pe)===_(s.open)):-1,B=v[S<0?0:Math.min(v.length-1,Math.max(0,S+x))];f({open:{strategy:B.strategy,selector:B.selector}},!0)},[p,s.open,f]);d.useEffect(()=>{if(!s.open)return;const x=v=>{v.defaultPrevented||Nt(document.activeElement)||document.querySelector('[role="dialog"]')||(v.key==="Escape"?(v.preventDefault(),F()):v.key==="ArrowDown"?(v.preventDefault(),O(1)):v.key==="ArrowUp"&&(v.preventDefault(),O(-1)))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[s.open,F,O]);const he=async()=>{g(!0);try{const x=await I.sendHealingDigest({windowDays:s.days,limit:5,minHealCount:2}),v=(x==null?void 0:x.sent)??0;v===0?o("No webhook gets the digest yet. Add one in Notifications.","error"):o(`Digest sent to ${v} webhook${v===1?"":"s"}.`,"success")}catch{o("Couldn't send the digest. Try again.","error")}finally{g(!1)}};return t.jsxs("div",{children:[t.jsx(Se,{icon:Ne,eyebrow:"Test quality",title:"Selector health",subtitle:"Selectors your tests could only find with self-healing. Fix the ones that heal most.",action:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ke,{size:"sm",label:"Period",value:String(s.days),onChange:x=>f({days:Number(x),page:1}),segments:Te.map(x=>({value:String(x),label:`${x} days`}))}),i&&t.jsxs(N,{variant:"secondary",size:"sm",onClick:()=>void he(),disabled:a,children:[t.jsx(Re,{size:14})," Send digest"]})]})}),t.jsxs("div",{className:"space-y-4 px-6 pb-8 pt-4",children:[t.jsx(ze,{onShow:x=>f(_e(x))}),t.jsx(Qe,{summary:u,days:s.days}),t.jsx(Ze,{trend:u?u.trend??[]:null,days:s.days,failed:k&&!u}),t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(rt,{view:s,data:p,loading:T,compact:!!s.open,selectedKey:s.open?_(s.open):null,onView:f,onOpen:M,error:m})}),s.open&&t.jsx(bt,{target:s.open,days:s.days,tz:l,refreshKey:C,onClose:F,onChanged:()=>$(x=>x+1)})]})]})]})};export{yt as LIVE_REFRESH_MS,Ft as default};
|
|
11
|
+
*/const Pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Re=ae("send",Pe),Fe=3e4,ze=5*6e4;function Oe({onShow:e}){const{on:n}=ne(),[s,l]=d.useState([]);if(d.useEffect(()=>{const o=n("selector_regressed",r=>{l(i=>{const u=Date.now()-ze;return[...i.filter(b=>b.receivedAt>=u),{strategy:(r==null?void 0:r.original_strategy)??"",selector:(r==null?void 0:r.original_selector)??"",receivedAt:Date.now()}]})});return()=>{o&&o()}},[n]),d.useEffect(()=>{if(s.length===0)return;const o=setTimeout(()=>l([]),Fe);return()=>clearTimeout(o)},[s]),s.length===0)return null;const c=s.length===1?s[0]:null;return t.jsxs("div",{role:"alert",className:"flex items-center gap-3 rounded-lg border border-[var(--color-warning)] bg-[var(--surface)] px-4 py-2.5 text-sm text-[var(--text)]",children:[t.jsx(fe,{size:14,className:"shrink-0 text-[var(--color-warning)]","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:c?t.jsxs(t.Fragment,{children:["A selector you fixed broke again:"," ",t.jsx("code",{className:"font-mono text-xs",title:c.selector,children:c.selector})]}):`${s.length} selectors you fixed broke again in the last 5 minutes.`}),t.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{e(s.map(({strategy:o,selector:r})=>({strategy:o,selector:r}))),l([])},children:"Show selectors to fix"}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>l([]),className:"rounded p-1 text-[var(--text-muted)] hover:text-[var(--text)]",children:t.jsx(re,{size:13})})]})}const He={"accessibility id":"Accessibility ID",xpath:"XPath",id:"ID",name:"Name","class name":"Class Name","-android uiautomator":"UiAutomator","-ios predicate string":"iOS Predicate","-ios class chain":"iOS Class Chain","xenon:visual":"Visual AI (coords)"};function Ue(e){return e?He[e]??e:"(unknown strategy)"}const Xe={fix:"To fix",verifying:"Being verified",fixed:"Fixed",muted:"Muted"},qe={heals:"Most heals",recent:"Most recent",time:"Most time spent healing"},Ve=["Resilio","Native","Fuzzy XML","OCR","Visual AI","LLM"],P={Resilio:"Found it from its saved fingerprint",Native:"Found it again with the original selector","Fuzzy XML":"Found the closest match in the screen's structure",OCR:"Found it by reading the text on screen","Visual AI":"Found it in a screenshot with AI",LLM:"Asked a language model to find it"},Ke=[{value:"android",label:"Android"},{value:"ios",label:"iOS"},{value:"tvos",label:"tvOS"}];function J(e){if(!(e>0))return"0 s";const n=e/1e3;if(n<1)return"<1 s";if(Math.round(n)<60)return`${Math.round(n)} s`;const s=n/60;if(Math.round(s)<60)return`${Math.round(s)} min`;const l=s/60;return`${l<10?l.toFixed(1):Math.round(l)} h`}function q(e,n=Date.now()){if(!e)return"—";const s=Date.parse(e);if(!Number.isFinite(s))return"—";const l=Math.floor(Math.max(0,n-s)/6e4);if(l<1)return"just now";if(l<60)return`${l} min ago`;const c=Math.floor(l/60);if(c<24)return`${c} h ago`;const o=Math.floor(c/24);return o===1?"yesterday":`${o} days ago`}function ce(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function V(e){if(!e)return"—";const n=Date.parse(e);return Number.isFinite(n)?new Date(n).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—"}function Ge(e,n,s,l){const c=`the ${s} days before`;if(e===n)return{text:`Same as ${c}`,tone:"neutral"};if(n===0)return{text:`None ${c}`,tone:"bad"};const o=e>n,r=o?"bad":"good";if(l==="count")return{text:`${Math.abs(e-n)} ${o?"more":"fewer"} than ${c}`,tone:r};if(l==="duration")return{text:`${J(Math.abs(e-n))} ${o?"more":"less"} than ${c}`,tone:r};const i=Math.round(Math.abs(e-n)/n*100);return i===0?{text:`About the same as ${c}`,tone:"neutral"}:{text:`${i}% ${o?"more":"fewer"} than ${c}`,tone:r}}function de(e){return`${Math.round(e*100)}% of heals`}function K(e){return e?Ue(e):"Unknown type"}function Je(e){switch(e==null?void 0:e.status){case"pending":return`Being verified, ${e.cleanBuilds} of 3 clean builds`;case"resolved":return"Fixed";case"muted":return"Muted";default:return"To fix"}}function G(e){return e!=null&&e.name?` by ${e.name}`:""}const We={marked_fixed:"Marked fixed",verification_cancelled:"Verification cancelled",verified:"Verified after 3 clean builds",broke_again:"Broke again",muted:"Muted",unmuted:"Unmuted"};function Ye(e){return`${We[e.action]??"Changed"}${G(e.by)}`}const H=e=>e.toLocaleString(),Qe=({summary:e,days:n})=>{const s=e==null?void 0:e.current,l=e==null?void 0:e.prior,c=[{label:"Selectors that needed healing",value:s==null?void 0:s.distinctSelectors,before:l==null?void 0:l.distinctSelectors,kind:"count",show:H},{label:"Heals",value:s==null?void 0:s.totalHeals,before:l==null?void 0:l.totalHeals,kind:"percent",show:H},{label:"Sessions affected",value:s==null?void 0:s.sessionsTouched,before:l==null?void 0:l.sessionsTouched,kind:"percent",show:H},{label:"Time spent healing",value:s==null?void 0:s.timeSpentMs,before:l==null?void 0:l.timeSpentMs,kind:"duration",show:J}];return t.jsx("div",{className:"grid grid-cols-4 gap-3",children:c.map(o=>{const r=o.value!==void 0&&o.before!==void 0?Ge(o.value,o.before,n,o.kind):null;return t.jsx(we,{label:o.label,value:o.value!==void 0?o.show(o.value):"—",note:r==null?void 0:r.text,noteTone:(r==null?void 0:r.tone)??"neutral"},o.label)})})},Q="var(--color-info)",Z="var(--color-warning)",ee=({color:e,label:n,total:s})=>t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:e}}),t.jsx("span",{children:n}),t.jsx("span",{className:"tabular-nums text-[var(--text)]",children:s.toLocaleString()})]}),Ze=({trend:e,days:n,failed:s})=>{var h;const l=d.useMemo(()=>e??[],[e]),c=((h=l[0])==null?void 0:h.t)??0,o=l.reduce((m,y)=>m+y.heals,0),r=l.reduce((m,y)=>m+y.aiHeals,0),i=d.useMemo(()=>l.map(m=>m.t-c),[l,c]),u=d.useMemo(()=>[{key:"heals",label:"All heals",color:Q,values:l.map(m=>m.heals)},{key:"ai",label:"Heals that used AI",color:Z,values:l.map(m=>m.aiHeals)}],[l]),b=l.reduce((m,y)=>Math.max(m,y.heals),0);let p;return e===null&&s?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Couldn't load heals per day. Try again in a moment."}):e===null?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}):o===0?p=t.jsxs("div",{className:"text-xs text-[var(--text-dim)]",children:["No heals in the last ",n," days."]}):p=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-[var(--text-muted)]",children:[t.jsx(ee,{color:Q,label:"All heals",total:o}),t.jsx(ee,{color:Z,label:"Heals that used AI",total:r})]}),t.jsx(ie,{times:i,series:u,yMax:Ce(b),formatValue:m=>String(Math.round(m)),formatTime:m=>ce(c+m),ariaLabel:"Heals per day",height:120})]}),t.jsx(Ae,{header:"Heals per day",children:p})},D=({title:e,tone:n="neutral",children:s})=>t.jsx("span",{title:e,className:`inline-block max-w-full truncate rounded px-1.5 py-px text-[10px] font-medium ${n==="warning"?"border border-[var(--color-warning)] text-[var(--color-warning)]":"bg-[rgb(var(--rgb-fg)/0.06)] text-[var(--text-muted)]"}`,children:s}),te=({strategy:e,text:n,extra:s})=>t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-0.5 flex min-w-0 items-center gap-1.5",children:[t.jsx(D,{children:K(e)}),s]}),t.jsx("code",{className:"line-clamp-2 break-all font-mono text-[11px] leading-snug text-[var(--text)]",title:n,children:n})]}),et=300,tt=["fix","verifying","fixed","muted"],st=["heals","recent","time"],E=e=>t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:e});function at(e,n,s){const l={key:"selector",label:"Selector",cell:r=>t.jsx(te,{strategy:r.strategy,text:r.selector,extra:e==="fix"&&r.state&&r.state.brokeAgain>0?t.jsx(D,{tone:"warning",children:"Broke again"}):null})},c=r=>({key:"heals",label:r,width:"96px",cell:i=>t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold tabular-nums text-[var(--text)]",children:i.heals.toLocaleString()}),t.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.sessions," ",i.sessions===1?"session":"sessions"]})]})}),o={key:"last",label:"Last healed",width:"104px",cell:r=>E(q(r.lastHealedAt))};switch(e){case"fix":return n?[l,c("Heals"),o]:[l,c("Heals"),o,{key:"method",label:"Healed by",width:"112px",cell:r=>r.topMethod?t.jsx(D,{title:P[r.topMethod],children:r.topMethod}):E("—")},{key:"fix",label:"Suggested fix",width:"34%",cell:r=>r.suggestion?t.jsx(te,{strategy:r.suggestion.strategy,text:r.suggestion.selector,extra:t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:de(r.suggestion.share)})}):E("None yet")}];case"verifying":{const r={key:"progress",label:"Progress",width:"150px",cell:i=>{var u;return t.jsxs("span",{className:"text-xs text-[var(--text)]",children:[((u=i.state)==null?void 0:u.cleanBuilds)??0," of 3 clean builds"]})}};return n?[l,r]:[l,r,{key:"marked",label:"Marked fixed",width:"180px",cell:i=>{var u,b;return E(`${q(((u=i.state)==null?void 0:u.fixedAt)??null)}${G(((b=i.state)==null?void 0:b.fixedBy)??null)}`)}},c(`Heals, ${s} days`)]}case"fixed":{const r={key:"verified",label:"Verified",width:"140px",cell:i=>{var u;return E(V(((u=i.state)==null?void 0:u.resolvedAt)??null))}};return n?[l,r]:[l,r,c(`Heals, ${s} days`)]}case"muted":{const r={key:"muted",label:"Muted",width:"180px",cell:i=>{var u,b;return E(`${V(((u=i.state)==null?void 0:u.mutedAt)??null)}${G(((b=i.state)==null?void 0:b.mutedBy)??null)}`)}};return n?[l,r]:[l,r,{key:"reason",label:"Reason",width:"26%",cell:i=>{var u;return(u=i.state)!=null&&u.muteReason?t.jsx("span",{className:"line-clamp-2 text-xs text-[var(--text)]",children:i.state.muteReason}):E("No reason given")}},c(`Heals, ${s} days`)]}}}function nt(e,n,s){if(n)return{title:`No selectors match “${n}”`,description:"Try fewer or different words."};switch(e){case"fix":return{title:`Nothing to fix in the last ${s} days`,description:"Every selector your tests used was found without healing."};case"verifying":return{title:"Nothing being verified",description:"When you mark a selector fixed, Xenon watches its next 3 clean builds here."};case"fixed":return{title:`Nothing fixed in the last ${s} days`,description:"Selectors that pass 3 clean builds after being marked fixed show here."};case"muted":return{title:"Nothing muted",description:"A muted selector is left out of this list, the CI gate and the digest."}}}const rt=({view:e,data:n,loading:s,compact:l,selectedKey:c,onView:o,onOpen:r,error:i})=>{const[u,b]=d.useState(e.q);d.useEffect(()=>b(e.q),[e.q]),d.useEffect(()=>{if(u===e.q)return;const a=setTimeout(()=>o({q:u,page:1}),et);return()=>clearTimeout(a)},[u,e.q,o]);const p=at(e.tab,l,e.days),h=n&&n.tab===e.tab?n:null,m=(h==null?void 0:h.items)??[],y=(h==null?void 0:h.total)??0,k=(h==null?void 0:h.page)??e.page,w=(h==null?void 0:h.pageSize)??50,T=Math.max(1,Math.ceil(y/w)),A=y===0?0:(k-1)*w+1,C=Math.min(y,k*w),$=nt(e.tab,e.q,e.days);return t.jsxs("section",{"aria-label":"Selectors",className:"rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsx("div",{role:"tablist","aria-label":"Selector status",className:"flex gap-1 border-b border-[var(--border)] px-3",children:tt.map(a=>{var j;const g=e.tab===a,f=(j=n==null?void 0:n.counts)==null?void 0:j[a];return t.jsxs("button",{type:"button",role:"tab","aria-selected":g,onClick:()=>{g||o({tab:a,page:1})},className:`-mb-px flex items-center gap-2 border-b-2 px-3 py-2.5 text-sm ${g?"border-[var(--color-accent)] font-medium text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:[Xe[a],t.jsx("span",{className:"rounded-full bg-[rgb(var(--rgb-fg)/0.08)] px-1.5 text-[11px] tabular-nums",children:typeof f=="number"?f.toLocaleString():"–"})]},a)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--border)] px-3 py-2.5",children:[t.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[t.jsx(ve,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-dim)]"}),t.jsx(Me,{type:"search","aria-label":"Search",value:u,onChange:a=>b(a.target.value),placeholder:e.tab==="fix"?"Search selectors and fixes":"Search selectors",className:"h-8 w-full pl-8 pr-2 text-xs"})]}),e.tab==="fix"&&t.jsxs(t.Fragment,{children:[t.jsxs(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Platform",value:e.platform,onChange:a=>o({platform:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All platforms"}),Ke.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))]}),t.jsxs(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Healing method",value:e.method,onChange:a=>o({method:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All healing methods"}),Ve.map(a=>t.jsx("option",{value:a,title:P[a],children:a},a))]}),t.jsx(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Sort",value:e.sort,onChange:a=>o({sort:a.target.value,page:1}),children:st.map(a=>t.jsx("option",{value:a,children:qe[a]},a))})]})]}),h?m.length===0?t.jsx($e,{title:$.title,description:$.description}):t.jsxs("table",{className:"w-full table-fixed text-left",children:[t.jsx("colgroup",{children:p.map(a=>t.jsx("col",{style:a.width?{width:a.width}:void 0},a.key))}),t.jsx("thead",{children:t.jsx("tr",{children:p.map(a=>t.jsx("th",{scope:"col",className:"px-3 py-2 text-[11px] font-medium text-[var(--text-muted)]",children:a.label},a.key))})}),t.jsx("tbody",{children:m.map(a=>{const g=_(a),f=g===c,j=()=>r({strategy:a.strategy,selector:a.selector});return t.jsx("tr",{tabIndex:0,"data-selector-row":"","data-key":g,"aria-current":f?"true":void 0,onClick:j,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),j())},className:`cursor-pointer border-t border-[var(--border)] align-top outline-none hover:bg-[rgb(var(--rgb-fg)/0.03)] focus-visible:bg-[rgb(var(--rgb-fg)/0.05)] ${f?"bg-[rgb(var(--rgb-fg)/0.06)]":""}`,children:p.map(M=>t.jsx("td",{className:"px-3 py-2.5 text-xs",children:M.cell(a)},M.key))},g)})})]}):t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:i&&!s?"Couldn't load selectors. Try again in a moment.":"Loading selectors…"}),y>0&&t.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] px-3 py-2 text-xs text-[var(--text-muted)]",children:[t.jsxs("span",{className:"tabular-nums",children:[A,"–",C," of ",y.toLocaleString()]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{variant:"secondary",size:"sm",disabled:k<=1,onClick:()=>o({page:k-1}),children:"Previous"}),t.jsx(N,{variant:"secondary",size:"sm",disabled:k>=T,onClick:()=>o({page:k+1}),children:"Next"})]})]})]})},lt={javascript:{"accessibility id":e=>`await driver.findElement('accessibility id', '${e}')`,xpath:e=>`await driver.findElement('xpath', '${e}')`,id:e=>`await driver.findElement('id', '${e}')`,name:e=>`await driver.findElement('name', '${e}')`,"class name":e=>`await driver.findElement('class name', '${e}')`,"-android uiautomator":e=>`await driver.findElement('-android uiautomator', '${e}')`,"-ios predicate string":e=>`await driver.findElement('-ios predicate string', '${e}')`,"-ios class chain":e=>`await driver.findElement('-ios class chain', '${e}')`},java:{"accessibility id":e=>`driver.findElement(AppiumBy.accessibilityId("${e}"))`,xpath:e=>`driver.findElement(AppiumBy.xpath("${e}"))`,id:e=>`driver.findElement(AppiumBy.id("${e}"))`,name:e=>`driver.findElement(AppiumBy.name("${e}"))`,"class name":e=>`driver.findElement(AppiumBy.className("${e}"))`,"-android uiautomator":e=>`driver.findElement(AppiumBy.androidUIAutomator("${e}"))`,"-ios predicate string":e=>`driver.findElement(AppiumBy.iOSNsPredicateString("${e}"))`,"-ios class chain":e=>`driver.findElement(AppiumBy.iOSClassChain("${e}"))`},python:{"accessibility id":e=>`driver.find_element(AppiumBy.ACCESSIBILITY_ID, '${e}')`,xpath:e=>`driver.find_element(AppiumBy.XPATH, '${e}')`,id:e=>`driver.find_element(AppiumBy.ID, '${e}')`,name:e=>`driver.find_element(AppiumBy.NAME, '${e}')`,"class name":e=>`driver.find_element(AppiumBy.CLASS_NAME, '${e}')`,"-android uiautomator":e=>`driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, '${e}')`,"-ios predicate string":e=>`driver.find_element(AppiumBy.IOS_PREDICATE, '${e}')`,"-ios class chain":e=>`driver.find_element(AppiumBy.IOS_CLASS_CHAIN, '${e}')`},csharp:{"accessibility id":e=>`driver.FindElement(MobileBy.AccessibilityId("${e}"))`,xpath:e=>`driver.FindElement(By.XPath("${e}"))`,id:e=>`driver.FindElement(By.Id("${e}"))`,name:e=>`driver.FindElement(By.Name("${e}"))`,"class name":e=>`driver.FindElement(By.ClassName("${e}"))`},ruby:{"accessibility id":e=>`driver.find_element(:accessibility_id, '${e}')`,xpath:e=>`driver.find_element(:xpath, '${e}')`,id:e=>`driver.find_element(:id, '${e}')`,name:e=>`driver.find_element(:name, '${e}')`,"class name":e=>`driver.find_element(:class_name, '${e}')`}};function it(e,n){const s=e==="java"||e==="csharp",l=n.replace(/\\/g,"\\\\");return s?l.replace(/"/g,'\\"'):l.replace(/'/g,"\\'")}function ue(e,n,s){var c;if(n==="xenon:visual")return"/* Visual AI (coordinates) — no portable Appium snippet. Use snapshot view to find a stable native locator. */";const l=(c=lt[e])==null?void 0:c[n];return l?l(it(e,s)):`${(n??"").toString().toUpperCase()}: ${s}`}const W=[{value:"javascript",short:"JS",label:"JavaScript (WebdriverIO)"},{value:"java",short:"Java",label:"Java (Appium-Java)"},{value:"python",short:"Py",label:"Python (Appium-Python)"},{value:"csharp",short:"C#",label:"C# (.NET)"},{value:"ruby",short:"Rb",label:"Ruby"}],me="xenon.copyLang";function ot(){try{const e=localStorage.getItem(me);return e&&W.find(n=>n.value===e)?e:null}catch{return null}}function ct(e){try{localStorage.setItem(me,e)}catch{}}function xe(e){var n;return((n=W.find(s=>s.value===e))==null?void 0:n.short)??e}function dt({open:e,initialLang:n,strategy:s,value:l,onCopy:c,onClose:o}){const[r,i]=d.useState(n??"javascript"),[u,b]=d.useState(!0),p=ue(r,s,l),h=async()=>{try{await navigator.clipboard.writeText(p)}catch{}u&&ct(r),c(r,p),o()};return t.jsxs(R,{open:e,onClose:o,title:"Choose your default copy language",width:520,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:o,children:"Cancel"}),t.jsxs(N,{onClick:h,children:["Copy as ",xe(r)]})]}),children:[t.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"Snippets will be copied in this language until you change it."}),t.jsx("ul",{className:"mb-3 space-y-1",children:W.map(m=>t.jsx("li",{children:t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text)]",children:[t.jsx("input",{type:"radio",name:"copy-lang",value:m.value,checked:r===m.value,onChange:()=>i(m.value)}),m.label]})},m.value))}),t.jsx("div",{className:"mb-1 text-[11px] font-semibold text-[var(--text-dim)]",children:"Preview"}),t.jsx("pre",{className:"mb-3 overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--surface-sunken)] p-3 font-mono text-[11px] text-[var(--text)]",children:t.jsx("code",{children:p})}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-muted)]",children:[t.jsx("input",{type:"checkbox",checked:u,onChange:m=>b(m.target.checked)}),"Remember my choice"]})]})}function ut({strategy:e,value:n,onCopied:s}){const[l,c]=d.useState(!1),[o,r]=d.useState(!1),i=ot(),u=e==="xenon:visual",b=async()=>{if(!i){c(!0);return}try{await navigator.clipboard.writeText(ue(i,e,n))}catch{}r(!0),s(i),setTimeout(()=>r(!1),1500)},p=i?`Copy as ${xe(i)}`:"Copy as code";return t.jsxs("span",{className:"inline-flex shrink-0",children:[t.jsxs(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-r-none",onClick:h=>{h.stopPropagation(),b()},disabled:u&&!n,"aria-label":p,title:u?"Found by its place on screen: there is no selector to copy":p,children:[o?t.jsx(Ie,{size:12}):t.jsx(oe,{size:12}),t.jsx("span",{children:o?"Copied":i?p:"Copy as…"})]}),t.jsx(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-l-none border-l-0 px-1.5",onClick:h=>{h.stopPropagation(),c(!0)},title:"Choose copy language","aria-label":"Choose copy language",children:t.jsx(ge,{size:12})}),t.jsx(dt,{open:l,initialLang:i??void 0,strategy:e,value:n,onCopy:h=>{r(!0),s(h),setTimeout(()=>r(!1),1500)},onClose:()=>c(!1)})]})}const se=500,mt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Mark this selector fixed?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:l,disabled:n,children:"Mark fixed"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Xenon watches the next 3 clean builds. If this selector heals again, it goes back to To fix."})}),xt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Cancel verification?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Keep verifying"}),t.jsx(N,{onClick:l,disabled:n,children:"Cancel verification"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"The selector goes back to To fix, and its clean builds start again from zero."})}),ht=({open:e,busy:n,onClose:s,onConfirm:l})=>{const[c,o]=d.useState("");return d.useEffect(()=>{e&&o("")},[e]),t.jsxs(R,{open:e,onClose:s,title:"Mute this selector?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:()=>l(c.trim()),disabled:n,children:"Mute"})]}),children:[t.jsx("p",{className:"mb-3 text-sm text-[var(--text-muted)]",children:"A muted selector is left out of this list, the CI gate and the digest, for everyone, until someone unmutes it."}),t.jsx("label",{htmlFor:"mute-reason",className:"block text-xs font-medium text-[var(--text)]",children:"Reason (optional)"}),t.jsx("textarea",{id:"mute-reason",value:c,maxLength:se,rows:3,placeholder:"Screen being redesigned",onChange:r=>o(r.target.value),className:"mt-1 w-full rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1.5 text-sm text-[var(--text)]"}),t.jsxs("div",{className:"mt-1 text-right text-[11px] tabular-nums text-[var(--text-dim)]",children:[c.length,"/",se]})]})},pt={mark_fixed:"Marked fixed. Xenon is watching the next 3 clean builds.",mute:"Muted.",unmute:"Unmuted.",cancel_verification:"Verification cancelled."},ft={pending:"border-[var(--color-info)] text-[var(--color-info)]",resolved:"border-[var(--color-success)] text-[var(--color-success)]",muted:"border-[var(--border-strong)] text-[var(--text-muted)]"},vt=({state:e})=>t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[11px] font-medium ${ft[(e==null?void 0:e.status)??""]??"border-[var(--color-danger)] text-[var(--color-danger)]"}`,children:Je(e)}),U=({label:e,onClick:n,children:s})=>t.jsx("button",{type:"button","aria-label":e,title:e,onClick:n,className:"rounded p-1.5 text-[var(--text-muted)] hover:bg-[rgb(var(--rgb-fg)/0.06)] hover:text-[var(--text)]",children:s}),L=({title:e,children:n})=>t.jsxs("section",{"aria-label":e,children:[t.jsx("h3",{className:"mb-2 text-xs font-semibold text-[var(--text)]",children:e}),n]}),X=({title:e,rows:n})=>n.length===0?null:t.jsxs("div",{className:"mb-3",children:[t.jsx("div",{className:"mb-1 text-[11px] text-[var(--text-dim)]",children:e}),n.map(s=>t.jsxs("div",{className:"flex justify-between gap-3 py-0.5 text-xs",children:[t.jsx("span",{className:"min-w-0 truncate text-[var(--text)]",title:s.label,children:s.label}),t.jsx("span",{className:"shrink-0 tabular-nums text-[var(--text-muted)]",children:s.count.toLocaleString()})]},s.key))]}),gt=({activity:e})=>t.jsx(L,{title:"Activity",children:e.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No changes recorded yet."}):t.jsx("ul",{children:e.map((n,s)=>t.jsxs("li",{className:"flex justify-between gap-3 py-1 text-[11px]",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"text-[var(--text)]",children:Ye(n)}),n.reason&&t.jsxs("span",{className:"text-[var(--text-muted)]",children:[": “",n.reason,"”"]})]}),t.jsx("span",{className:"shrink-0 text-[var(--text-dim)]",children:V(n.at)})]},`${n.at}-${s}`))})}),bt=({target:e,days:n,tz:s,refreshKey:l,onClose:c,onChanged:o})=>{var $;const{toast:r}=le(),[i,u]=d.useState(null),[b,p]=d.useState("loading"),[h,m]=d.useState(null),[y,k]=d.useState(!1);d.useEffect(()=>{u(null),p("loading")},[e.strategy,e.selector]),d.useEffect(()=>{let a=!0;return I.getSelectorPanel(e.strategy,e.selector,n,s).then(({status:g,body:f})=>{a&&(g===404?(u(null),p("missing")):g===200&&f?(u(f),p("ready")):p("failed"))}).catch(()=>{a&&p("failed")}),()=>{a=!1}},[e.strategy,e.selector,n,s,l]);const w=async(a,g)=>{k(!0);try{await I.postSelectorStateAction({original_strategy:e.strategy,original_selector:e.selector,action:a,...g?{reason:g}:{}}),r(pt[a],"success")}catch(f){const j=f.status;r(j===409?"Someone changed this selector just now. It has been refreshed.":j===404?"This selector isn't available any more.":"That didn't work. Try again.","error")}finally{k(!1),m(null),o()}},T=async(a,g)=>{try{await navigator.clipboard.writeText(a),r(g,"success")}catch{r("Couldn't copy: your browser blocked it.","error")}},A=(($=i==null?void 0:i.state)==null?void 0:$.status)??"active",C=d.useMemo(()=>{var f;const a=(i==null?void 0:i.daily)??[],g=((f=a[0])==null?void 0:f.t)??0;return{start:g,times:a.map(j=>j.t-g),values:a.map(j=>j.heals)}},[i]);return t.jsxs("aside",{"aria-label":"Selector details",className:"sticky top-4 flex max-h-[calc(100vh-7rem)] w-[480px] shrink-0 flex-col overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs("header",{className:"border-b border-[var(--border)] p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(D,{children:K(e.strategy)}),i&&t.jsx(vt,{state:i.state}),t.jsxs("span",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx(U,{label:"Copy selector",onClick:()=>void T(e.selector,"Selector copied"),children:t.jsx(oe,{size:14})}),t.jsx(U,{label:"Copy link to this selector",onClick:()=>void T(window.location.href,"Link copied"),children:t.jsx(Be,{size:14})}),t.jsx(U,{label:"Close",onClick:c,children:t.jsx(re,{size:14})})]})]}),t.jsx("code",{className:"mt-2 block break-all font-mono text-xs leading-relaxed text-[var(--text)]",children:e.selector}),(i==null?void 0:i.canAct)&&t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[A==="active"&&e.strategy!==""&&t.jsx(N,{size:"sm",onClick:()=>m("mark_fixed"),children:"Mark fixed"}),A==="pending"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("cancel_verification"),children:"Cancel verification"}),A!=="muted"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("mute"),children:"Mute…"}),A==="muted"&&t.jsx(N,{size:"sm",variant:"secondary",disabled:y,onClick:()=>void w("unmute"),children:"Unmute"})]})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-4",children:[b==="loading"&&t.jsx("p",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}),b==="missing"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"This selector isn't available. It may belong to another team, or Xenon has no heals on record for it."}),b==="failed"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Couldn't load this selector. Try again in a moment."}),i&&i.heals===0&&t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["No heals in the last ",n," days."]}),i&&i.heals>0&&t.jsxs(t.Fragment,{children:[t.jsx(L,{title:"Suggested fix",children:i.suggestions.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Xenon found the element without a selector it can suggest."}):t.jsx("ul",{className:"space-y-2",children:i.suggestions.map((a,g)=>t.jsx("li",{className:`rounded-md border p-2.5 ${g===0?"border-[var(--color-success)]":"border-[var(--border)]"}`,children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[t.jsx(D,{children:K(a.strategy)}),t.jsx("span",{children:de(a.share)}),a.methods.length>0&&t.jsxs("span",{title:a.methods.map(f=>P[f]??f).join(". "),children:["· ",a.methods.join(", ")]}),a.averageConfidence!==null&&t.jsxs("span",{children:["· ",Math.round(a.averageConfidence*100),"% confidence"]})]}),t.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--text)]",children:a.selector})]}),t.jsx(ut,{strategy:a.strategy??e.strategy,value:a.selector,onCopied:f=>r(`Copied as ${f}`,"success")})]})},`${a.strategy??""}\0${a.selector}`))})}),t.jsxs(L,{title:`In the last ${n} days`,children:[t.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:i.heals===1?"heal":"heals",value:i.heals.toLocaleString()},{label:i.sessions===1?"session":"sessions",value:i.sessions.toLocaleString()},{label:"spent healing",value:J(i.timeSpentMs)}].map(a=>t.jsxs("div",{className:"rounded-md bg-[rgb(var(--rgb-fg)/0.04)] px-2.5 py-2",children:[t.jsx("div",{className:"text-sm font-semibold tabular-nums text-[var(--text)]",children:a.value}),t.jsx("div",{className:"text-[11px] text-[var(--text-muted)]",children:a.label})]},a.label))}),C.times.length>1&&t.jsx("div",{className:"mt-3",children:t.jsx(ie,{times:C.times,series:[{key:"heals",label:"Heals",color:"var(--color-info)",values:C.values}],formatValue:a=>String(Math.round(a)),formatTime:a=>ce(C.start+a),ariaLabel:"Heals per day for this selector",height:56})})]}),t.jsxs(L,{title:"Where it happens",children:[t.jsx(X,{title:"Platforms",rows:i.platforms.map(a=>({key:a.name,label:Le(a.name),count:a.count}))}),t.jsx(X,{title:"Builds",rows:i.builds.map(a=>({key:a.id??"",label:a.name,count:a.count}))}),t.jsx(X,{title:"Devices",rows:i.devices.map(a=>({key:a.udid,label:a.name,count:a.count}))})]}),t.jsx(L,{title:"Recent heals",children:t.jsx("ul",{className:"divide-y divide-[var(--border)]",children:i.recent.map(a=>t.jsxs("li",{className:"py-2 text-[11px]",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[var(--text-muted)]",children:[t.jsx("span",{children:q(a.at)}),a.device&&t.jsxs("span",{className:"min-w-0 truncate",children:["· ",a.device]}),a.method&&t.jsxs("span",{title:P[a.method],children:["· ",a.method,a.confidence!==null?` ${Math.round(a.confidence*100)}%`:""]}),t.jsx(be,{className:"ml-auto shrink-0 text-[var(--color-accent)] hover:underline",to:`/builds/${encodeURIComponent(a.buildId??"none")}/sessions/${encodeURIComponent(a.sessionId)}`,children:"Session"})]}),a.healedSelector&&t.jsx("code",{className:"mt-0.5 block truncate font-mono text-[var(--text)]",title:a.healedSelector,children:a.healedSelector})]},a.id))})})]}),i&&t.jsx(gt,{activity:i.activity})]}),t.jsx(mt,{open:h==="mark_fixed",busy:y,onClose:()=>m(null),onConfirm:()=>void w("mark_fixed")}),t.jsx(xt,{open:h==="cancel_verification",busy:y,onClose:()=>m(null),onConfirm:()=>void w("cancel_verification")}),t.jsx(ht,{open:h==="mute",busy:y,onClose:()=>m(null),onConfirm:a=>void w("mute",a||void 0)})]})},yt=1e3,jt=["healing_event","selector_fixed","selector_resolved","selector_regressed","selector_cancelled","selector_muted","selector_unmuted","selector_progress"],Nt=e=>!!e&&(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.isContentEditable),Ft=()=>{const[e,n]=ye(),s=d.useMemo(()=>Y(e),[e]),l=d.useMemo(()=>-new Date().getTimezoneOffset(),[]),{on:c}=ne(),{toast:o}=le(),{me:r}=je(),i=!!r&&(r.role==="ADMIN"||r.role==="SUPER_ADMIN"||!!r.authDisabled),[u,b]=d.useState(null),[p,h]=d.useState(null),[m,y]=d.useState(!1),[k,w]=d.useState(!1),[T,A]=d.useState(!0),[C,$]=d.useState(0),[a,g]=d.useState(!1),f=d.useCallback((x,v=!1)=>n(Ee({...Y(e),...x}),{replace:v}),[e,n]);d.useEffect(()=>{let x=!0;return I.getHealingSummary(s.days,l).then(v=>{x&&(b(v??null),w(!1))}).catch(()=>{x&&w(!0)}),()=>{x=!1}},[s.days,l,C]),d.useEffect(()=>{let x=!0;return A(!0),I.getHealingSelectors({tab:s.tab,days:s.days,q:s.q,platform:s.platform,method:s.method,sort:s.sort,page:s.page}).then(v=>{x&&(h(v??null),y(!1))}).catch(()=>{x&&y(!0)}).finally(()=>{x&&A(!1)}),()=>{x=!1}},[s.tab,s.days,s.q,s.platform,s.method,s.sort,s.page,C]);const j=d.useRef(null);d.useEffect(()=>{const x=()=>{j.current||(j.current=setTimeout(()=>{j.current=null,$(S=>S+1)},yt))},v=jt.map(S=>c(S,x));return()=>{v.forEach(S=>S&&S()),j.current&&clearTimeout(j.current),j.current=null}},[c]);const M=d.useCallback(x=>f({open:x}),[f]),F=d.useCallback(()=>{const x=s.open?_(s.open):null;f({open:null}),setTimeout(()=>{var S;(S=Array.from(document.querySelectorAll("[data-selector-row]")).find(B=>B.dataset.key===x))==null||S.focus()},0)},[s.open,f]),z=d.useCallback(x=>{const v=(p==null?void 0:p.items)??[];if(v.length===0)return;const S=s.open?v.findIndex(pe=>_(pe)===_(s.open)):-1,B=v[S<0?0:Math.min(v.length-1,Math.max(0,S+x))];f({open:{strategy:B.strategy,selector:B.selector}},!0)},[p,s.open,f]);d.useEffect(()=>{if(!s.open)return;const x=v=>{v.defaultPrevented||Nt(document.activeElement)||document.querySelector('[role="dialog"]')||(v.key==="Escape"?(v.preventDefault(),F()):v.key==="ArrowDown"?(v.preventDefault(),z(1)):v.key==="ArrowUp"&&(v.preventDefault(),z(-1)))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[s.open,F,z]);const he=async()=>{g(!0);try{const x=await I.sendHealingDigest({windowDays:s.days,limit:5,minHealCount:2}),v=(x==null?void 0:x.sent)??0;v===0?o("No webhook gets the digest yet. Add one in Notifications.","error"):o(`Digest sent to ${v} webhook${v===1?"":"s"}.`,"success")}catch{o("Couldn't send the digest. Try again.","error")}finally{g(!1)}};return t.jsxs("div",{children:[t.jsx(Se,{icon:Ne,eyebrow:"Test quality",title:"Selector health",subtitle:"Selectors your tests could only find with self-healing. Fix the ones that heal most.",action:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ke,{size:"sm",label:"Period",value:String(s.days),onChange:x=>f({days:Number(x),page:1}),segments:Te.map(x=>({value:String(x),label:`${x} days`}))}),i&&t.jsxs(N,{variant:"secondary",size:"sm",onClick:()=>void he(),disabled:a,children:[t.jsx(Re,{size:14})," Send digest"]})]})}),t.jsxs("div",{className:"space-y-4 px-6 pb-8 pt-4",children:[t.jsx(Oe,{onShow:x=>f(_e(x))}),t.jsx(Qe,{summary:u,days:s.days}),t.jsx(Ze,{trend:u?u.trend??[]:null,days:s.days,failed:k&&!u}),t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(rt,{view:s,data:p,loading:T,compact:!!s.open,selectedKey:s.open?_(s.open):null,onView:f,onOpen:M,error:m})}),s.open&&t.jsx(bt,{target:s.open,days:s.days,tz:l,refreshKey:C,onClose:F,onChanged:()=>$(x=>x+1)})]})]})]})};export{yt as LIVE_REFRESH_MS,Ft as default};
|