everyscreen 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +241 -2
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.mjs +2958 -0
  5. package/dist/commands-logic-DVWfSe3O.mjs +217 -0
  6. package/dist/dashboard/assets/button-N-Nucq_K.js +1 -0
  7. package/dist/dashboard/assets/cn-DMYzmXtt.js +1 -0
  8. package/dist/dashboard/assets/device-status-logic-Silf3YXA.js +1 -0
  9. package/dist/dashboard/assets/devices-5pEUg6rA.js +1 -0
  10. package/dist/dashboard/assets/dist-CnPFbxes.js +1 -0
  11. package/dist/dashboard/assets/focus._deviceId-DGel-kWw.js +1 -0
  12. package/dist/dashboard/assets/frame-layout-logic-H_x71NvW.js +1 -0
  13. package/dist/dashboard/assets/index-DNHZ-i1B.css +2 -0
  14. package/dist/dashboard/assets/index-DwPQ0eY_.js +10 -0
  15. package/dist/dashboard/assets/modal-dialog-BaO9xkRr.js +1 -0
  16. package/dist/dashboard/assets/rolldown-runtime-WkwZ5CU-.js +1 -0
  17. package/dist/dashboard/assets/routes-CUFa9tL0.js +1 -0
  18. package/dist/dashboard/assets/run-origin-badge-BeFqg0AC.js +1 -0
  19. package/dist/dashboard/assets/runs-queries-BYBE7R9S.js +2 -0
  20. package/dist/dashboard/assets/runs._runId-CokpJ1Rr.js +1 -0
  21. package/dist/dashboard/assets/runs.index-ZsynzkKU.js +1 -0
  22. package/dist/dashboard/assets/schemas-BPFqmBjG.js +55 -0
  23. package/dist/dashboard/assets/screen-boundary-BauyD9pu.js +1 -0
  24. package/dist/dashboard/assets/status-chip-yqTTTuyZ.js +1 -0
  25. package/dist/dashboard/assets/tile-status-chip-DisgbNnH.js +1 -0
  26. package/dist/dashboard/assets/toggle-nciug_di.js +1 -0
  27. package/dist/dashboard/assets/use-run-totals-B3G4yamQ.js +1 -0
  28. package/dist/dashboard/assets/useNavigate-8mkM-ffY.js +1 -0
  29. package/dist/dashboard/assets/useParams-D2lK5BEg.js +1 -0
  30. package/dist/dashboard/index.html +29 -0
  31. package/dist/devices-store-edScJDie.mjs +1228 -0
  32. package/dist/playwright-logic-QFlBFspE.d.mts +138 -0
  33. package/dist/playwright.d.mts +2 -0
  34. package/dist/playwright.mjs +18 -0
  35. package/dist/read-hub-file-N4rZ-6Wr.mjs +180 -0
  36. package/dist/report-hub-trouble-BjbcuK21.d.mts +2 -0
  37. package/dist/report-hub-trouble-CaUiyteI.mjs +41 -0
  38. package/dist/reporter.d.mts +47 -0
  39. package/dist/reporter.mjs +250 -0
  40. package/dist/run-one-at-a-time-BeV_a3Fm.mjs +48 -0
  41. package/dist/runs-store-Bd_ITPFj.mjs +283 -0
  42. package/dist/test.d.mts +11 -0
  43. package/dist/test.mjs +69 -0
  44. package/package.json +106 -4
  45. package/src/dashboard/ui/theme.css +28 -0
  46. package/src/skill/SKILL.md +15 -0
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{N as t,P as n,t as r}from"./cn-DMYzmXtt.js";var i=e(n(),1),a=e=>{let t=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let n=t.current;if(n===null)return;let r=n.open,i=e&&!r,a=!e&&r;i&&n.showModal(),a&&n.close()},[e]),t},o=t(),s=({isOpen:e,label:t,className:n,onClose:i,onKeyDown:s,children:c})=>{let l=a(e);return(0,o.jsx)(`dialog`,{ref:l,"aria-label":t,onClose:()=>{e&&i()},onClick:e=>{e.target===e.currentTarget&&i()},onKeyDown:s??void 0,className:r(`m-auto max-h-[96dvh] max-w-[96vw] rounded-xl border border-line bg-card p-0 text-ink shadow-lift backdrop:bg-ink/60`,n),children:e&&c})};export{s as t};
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));export{c as n,o as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{N as t,P as n,a as r,i,r as a,t as o}from"./cn-DMYzmXtt.js";import{n as s,t as c}from"./button-N-Nucq_K.js";import{f as l}from"./runs-queries-BYBE7R9S.js";import{C as u,S as d,b as f,d as p,f as m,i as h,n as g,o as _,s as v,t as y,v as b,w as x,x as S,y as C}from"./dist-CnPFbxes.js";import{i as w,n as T,o as ee,s as E,t as te}from"./use-run-totals-B3G4yamQ.js";import{t as ne}from"./modal-dialog-BaO9xkRr.js";import{a as re,i as ie,t as D}from"./schemas-BPFqmBjG.js";import{n as O,r as k,t as A}from"./frame-layout-logic-H_x71NvW.js";import{n as ae,t as oe}from"./screen-boundary-BauyD9pu.js";import{a as j,i as se,n as ce,o as le,r as ue,t as de}from"./tile-status-chip-DisgbNnH.js";import{a as fe}from"./device-status-logic-Silf3YXA.js";var pe=2,M=e=>String(e).padStart(pe,`0`),me=e=>{let t=e.split(/(run-\d+)/);return t.map((e,n)=>({key:t.slice(0,n).join(``).length,text:e,isRunId:n%2==1})).filter(e=>e.text!==``)},he=e=>{let t=new Date(e);return`${M(t.getHours())}:${M(t.getMinutes())}:${M(t.getSeconds())}`},ge=e=>e.map(e=>({key:`${e.sentAt}-${e.commandName}-${e.line}`,clock:he(e.sentAt),commandName:e.commandName,segments:me(e.line),isFailed:e.status===`failed`})),N=t(),_e=()=>{let{t:e}=r(),t=ge(h()),n=t.length===0;return(0,N.jsxs)(`aside`,{"aria-label":e(`grid.activity.label`),className:`flex flex-col gap-2 rounded-lg border border-line bg-card p-3`,children:[(0,N.jsx)(`h2`,{className:`m-0 text-xs font-semibold tracking-wide text-ink-2 uppercase`,children:e(`grid.activity.title`)}),n&&(0,N.jsx)(`p`,{className:`m-0 text-xs text-ink-3`,children:e(`grid.activity.empty`)}),(0,N.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:t.map(e=>(0,N.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-line border-t pt-2 first:border-t-0 first:pt-0`,children:[(0,N.jsxs)(`span`,{className:`flex items-center gap-2 font-mono text-[11px] text-ink-2`,children:[(0,N.jsx)(`span`,{children:e.clock}),(0,N.jsx)(`span`,{className:`font-semibold text-ink`,children:e.commandName})]}),(0,N.jsx)(`span`,{className:o(`text-xs leading-4 break-words`,e.isFailed&&`text-failed`,!e.isFailed&&`text-ink-2`),children:e.segments.map(e=>(0,N.jsx)(`span`,{className:o(e.isRunId&&`whitespace-nowrap`),children:e.text},e.key))})]},e.key))})]})},P=e(n(),1),F=e=>(0,P.useSyncExternalStore)(S,()=>p(e)),I=30,L=200,ve=10,R=100,ye=re({sizeMode:D([`fit`,`true-size`]),density:D([`comfortable`,`compact`]),scalePercent:ie().int().min(I).max(L)}),z={sizeMode:`fit`,density:`compact`,scalePercent:100},B={comfortable:{gap:12,tilePadding:8,columnWidth:240,fitHeight:520},compact:{gap:8,tilePadding:4,columnWidth:180,fitHeight:420}},be={smaller:-1,larger:1},xe=e=>{let t=ye.safeParse(e);return t.success?t.data:z},Se=(e,t)=>{let n=e+be[t]*ve;return Math.min(L,Math.max(I,n))},Ce=(e,t)=>{let n=t.scalePercent/R;if(t.sizeMode===`true-size`)return n;let r=B[t.density],i=2*r.tilePadding,a={width:r.columnWidth*n-i,height:r.fitHeight*n-i};return A(e,a)},we=e=>{let t=B[e.density];if(e.sizeMode===`true-size`)return{gap:t.gap,template:null};let n=e.scalePercent/R,r=Math.round(t.columnWidth*n);return{gap:t.gap,template:`repeat(auto-fill, minmax(min(100%, ${r}px), 1fr))`}},Te=e=>B[e.density].tilePadding,V=({deviceLoad:e,browserName:t})=>{let{t:n}=r(),i=se(t),a=e===null;if(a&&!i){let e=n(`tile.engines.${t}`);return(0,N.jsx)(N.Fragment,{children:n(`tile.noEstimateOnEngine`,{engine:e})})}if(a)return(0,N.jsx)(N.Fragment,{children:n(`tile.noEstimate`)});let o=Math.round(e.fps),s=Math.round(e.cpuPercent);return(0,N.jsx)(N.Fragment,{children:n(`tile.estimate`,{fps:o,cpuPercent:s})})},Ee={done:`bg-ok`,current:`bg-pink`,failed:`bg-failed`,pending:`bg-line`},De=({testTitle:e,segments:t})=>(0,N.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 flex h-[3px] gap-0.5`,children:t.map(({stepIndex:t,state:n})=>(0,N.jsx)(`span`,{className:o(`h-full flex-1 rounded-full`,Ee[n])},`${e}:${t}`))}),Oe=e=>e===null?null:b(e),ke=e=>(0,P.useSyncExternalStore)(S,()=>Oe(e)),Ae=e=>(0,P.useSyncExternalStore)(S,()=>C(e)),je=``,Me=e=>{let t=F(e),n=t!==null,r=n?t.testId:je,i=n?t.title:null,a=n?t.status:`running`,o=Ae(r),s=ke(i);return{deviceTest:t,stepProgress:(0,P.useMemo)(()=>u(o,s,a),[o,s,a])}},Ne={running:`text-ink-2`,ok:`text-ok`,failed:`text-failed`},Pe={running:`tile.test.running`,ok:`tile.test.ok`,failed:`tile.test.failed`},Fe=e=>e===null?`tile.test.stepLine`:`tile.test.stepLineOf`,H=({deviceId:e})=>{let{t}=r(),{deviceTest:n,stepProgress:i}=Me(e);if(n===null)return null;let{title:a,status:s,errorLine:c}=n,l=i!==null,u=l&&i.segments.length>0,d=s===`failed`&&c!==null,f=Fe(l?i.totalSteps:null),p=l?t(f,{stepNumber:i.stepNumber,totalSteps:i.totalSteps,stepTitle:i.stepTitle}):null;return(0,N.jsxs)(`div`,{className:`mb-1`,children:[(0,N.jsxs)(`p`,{className:`m-0 flex items-baseline gap-2 font-sans text-xs`,children:[(0,N.jsx)(`span`,{className:o(`flex-none font-semibold`,Ne[s]),children:t(Pe[s])}),(0,N.jsx)(`span`,{className:`truncate text-ink`,title:a,children:a})]}),l&&(0,N.jsx)(`p`,{className:`m-0 mt-0.5 truncate`,children:p}),d&&(0,N.jsx)(`p`,{className:`m-0 truncate text-failed`,title:c,children:c}),u&&(0,N.jsx)(De,{testTitle:a,segments:i.segments})]})},Ie=11,Le={none:`border-line`,ok:`border-line`,warn:`border-warn`,failed:`border-failed`},Re=({device:e,gridView:t,onZoom:n})=>{let{t:i}=r(),{deviceId:s,name:c,browserName:u}=e,{screenWidth:d,screenHeight:f}=e,p=le(s),m=j(s),h=F(s)?.status===`failed`,g=ue(),_=fe(s,g)??`none`,v=p!==null,y=ce(u)===`live`&&v,b=o(`size-1.5 rounded-full bg-pink`,y&&`live-dot`),x=O(e),S=Ce(x,t),C=Te(t),w=t.sizeMode===`true-size`,T=Math.round(Ie/S);return(0,N.jsxs)(`article`,{className:o(`group relative flex min-w-0 flex-col overflow-hidden rounded-lg border bg-card transition-[translate,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-lift`,Le[_],h&&`border-failed bg-failed-soft`,w&&`w-fit flex-none`),children:[(0,N.jsxs)(`header`,{className:`flex flex-col gap-0.5 px-2 py-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-x-2`,children:[(0,N.jsx)(`h3`,{className:`m-0 min-w-0 flex-1 text-xs font-semibold [overflow-wrap:anywhere]`,children:(0,N.jsx)(l,{to:`/focus/$deviceId`,params:{deviceId:s},title:c,className:`-my-1 inline-block py-1 text-ink no-underline`,children:c})}),(0,N.jsx)(de,{deviceId:s,isLabelHidden:!0}),(0,N.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(`tile.expand`,{name:c}),className:`grid size-6 flex-none cursor-pointer place-items-center rounded border-0 bg-transparent p-0 text-ink-2 opacity-0 hover:text-ink focus-visible:opacity-100 group-hover:opacity-100 [@media(hover:none)]:hidden`,children:(0,N.jsx)(a,{name:`expand`,size:14})})]}),(0,N.jsxs)(`p`,{className:`m-0 flex items-center gap-1.5 font-mono text-[10px] text-ink-2`,children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,className:b}),(0,N.jsxs)(`span`,{children:[d,`×`,f,` ·`,` `,i(`tile.engines.${u}`)]})]})]}),(0,N.jsx)(`div`,{className:`flex flex-1 items-start justify-center bg-soft`,style:{padding:C},children:(0,N.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(`tile.zoom`,{name:c}),className:`cursor-zoom-in border-0 bg-transparent p-0`,children:(0,N.jsxs)(k,{layout:x,scale:S,children:[(0,N.jsx)(`p`,{"aria-hidden":v,className:`m-0 grid size-full place-items-center px-4 text-center text-ink-2`,style:{fontSize:T},children:i(`tile.waiting`)}),v&&(0,N.jsx)(`img`,{src:p,alt:c,className:`absolute inset-0 size-full object-cover`})]})})}),(0,N.jsxs)(`footer`,{className:`px-3 pt-2 pb-[9px] font-mono text-[10px] leading-[14px] text-ink-2`,children:[(0,N.jsx)(H,{deviceId:s}),(0,N.jsx)(V,{deviceLoad:m,browserName:u})]})]})},ze=()=>(0,P.useSyncExternalStore)(S,m),Be={warn:`finding`,failed:`close`},Ve={warn:`bg-warn-soft text-warn`,failed:`bg-failed-soft text-failed`},He={warn:`status`,failed:`alert`},Ue=({finding:e,deviceName:t,onDismiss:n})=>{let{t:i}=r(),{severity:s,kind:c,message:l}=e;return(0,N.jsxs)(`div`,{role:He[s],className:`flex gap-3 rounded-xl border border-line bg-card p-3.5 shadow-lift`,children:[(0,N.jsx)(`span`,{className:o(`grid size-8 flex-none place-items-center rounded-full`,Ve[s]),children:(0,N.jsx)(a,{name:Be[s],strokeWidth:2.2})}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[(0,N.jsx)(`span`,{className:`text-sm font-semibold`,children:i(`findings.kinds.${c}`,{deviceName:t})}),(0,N.jsx)(`span`,{className:`text-[13px] leading-[18px] text-ink-2`,children:l}),(0,N.jsx)(`span`,{className:`mt-0.5 font-mono text-[11px] text-ink-3`,children:i(`findings.addedToReport`)})]}),(0,N.jsx)(`button`,{type:`button`,"aria-label":i(`findings.dismiss`),onClick:n,className:`-me-2.5 -mt-2.5 grid size-11 flex-none cursor-pointer place-items-center rounded-full text-ink-3 hover:bg-soft`,children:(0,N.jsx)(a,{name:`close`,size:14,strokeWidth:2})})]})},We=3,Ge=()=>{let e=ze(),t=g().data??[],[n,r]=(0,P.useState)([]),i=e.filter(e=>!n.includes(e)).slice(0,We);return(0,N.jsx)(`div`,{className:`fixed inset-x-4 bottom-4 z-10 flex flex-col gap-2 md:inset-x-auto md:end-5 md:w-95`,children:i.map(e=>(0,N.jsx)(Ue,{finding:e,deviceName:v(t,e.deviceId),onDismiss:()=>r([...n,e])},`${e.deviceId}-${e.kind}-${e.selector}-${e.message}`))})},Ke=1500,qe=e=>{let[t,n]=(0,P.useState)(`idle`);return(0,P.useEffect)(()=>{if(t===`idle`)return;let e=setTimeout(()=>n(`idle`),Ke);return()=>clearTimeout(e)},[t]),{copyStatus:t,copyText:async()=>{try{await navigator.clipboard.writeText(e),n(`copied`)}catch(e){console.error({error:e}),n(`failed`)}}}},U=({command:e,copyLabel:t})=>{let{t:n}=r(),{copyStatus:i,copyText:a}=qe(e);return(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-full bg-ink py-1 pe-1 ps-4 shadow-[inset_0_0_0_1px_rgb(255_255_255/0.14)]`,children:[(0,N.jsxs)(`span`,{className:`min-w-0 overflow-x-auto font-mono text-[13px] whitespace-nowrap text-card`,children:[(0,N.jsx)(`span`,{className:`text-muted`,children:`$ `}),e]}),(0,N.jsx)(c,{icon:`copy`,variant:`accent`,"aria-label":t,onClick:a,className:`h-11 rounded-full px-4 text-sm`,children:n(`grid.copy.${i}`)})]})},Je=`npx everyscreen skill install`,Ye=()=>{let{t:e}=r(),t=ee(),[n,i]=(0,P.useState)(``),o=`everyscreen open --url ${n===``?e(`grid.empty.urlPlaceholder`):n}`,s=t.isError;return(0,N.jsxs)(`section`,{"aria-label":e(`grid.empty.title`),className:`flex w-full max-w-160 flex-col gap-4 rounded-[20px] border border-line bg-card px-4 py-5 md:px-8 md:py-6 shadow-lift`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,N.jsx)(`h1`,{className:`m-0 text-[28px] leading-[34px] font-medium tracking-[-0.025em]`,children:e(`grid.empty.title`)}),(0,N.jsx)(`p`,{className:`m-0 text-sm leading-5 text-ink-2`,children:e(`grid.empty.hubRunning`,{hubUrl:d})})]}),(0,N.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),t.mutate(n)},className:`flex flex-col gap-2 md:flex-row`,children:[(0,N.jsxs)(`label`,{className:`flex h-12 min-w-0 items-center md:flex-1 gap-2.5 rounded-xl border border-line bg-soft px-3.5 text-ink-2`,children:[(0,N.jsx)(a,{name:`open-url`,size:18}),(0,N.jsx)(`input`,{name:`url`,type:`url`,required:!0,value:n,onChange:e=>{i(e.target.value)},placeholder:e(`grid.empty.urlPlaceholder`),"aria-label":e(`grid.empty.urlLabel`),className:`min-w-0 flex-1 border-0 bg-transparent font-mono text-sm text-ink outline-offset-4`})]}),(0,N.jsx)(c,{type:`submit`,icon:`open-url`,variant:`dark`,size:`large`,disabled:t.isPending,children:e(`grid.empty.open`)})]}),s&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-failed`,children:e(`grid.empty.openFailed`)}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:e(`grid.empty.terminalHint`)}),(0,N.jsx)(U,{command:o,copyLabel:e(`grid.empty.copyOpenCommand`)})]}),(0,N.jsx)(`hr`,{className:`m-0 h-px border-0 bg-line`}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,N.jsx)(`h2`,{className:`m-0 text-lg leading-[25px] font-semibold`,children:e(`grid.empty.agentTitle`)}),(0,N.jsx)(U,{command:Je,copyLabel:e(`grid.empty.copySkillCommand`)}),(0,N.jsx)(`p`,{className:`m-0 text-[13.5px] leading-5 text-ink-2`,children:e(`grid.empty.agentHint`)})]})]})},W=`everyscreen.gridView`,G=null,K=new Set,Xe=()=>{try{let e=localStorage.getItem(W);return e===null?z:xe(JSON.parse(e))}catch(e){return console.error({error:e}),z}},Ze=e=>{try{localStorage.setItem(W,JSON.stringify(e))}catch(e){console.error({error:e})}},q=()=>(G===null&&(G=Xe()),G??z),Qe=e=>(K.add(e),()=>{K.delete(e)}),J=e=>{let t={...q(),...e};G=t,Ze(t);for(let e of K)e()},Y=()=>{let e=(0,P.useSyncExternalStore)(Qe,q);return{gridView:e,changeSizeMode:e=>J({sizeMode:e}),changeDensity:e=>J({density:e}),stepScale:t=>J({scalePercent:Se(e.scalePercent,t)})}},X=({label:e,segments:t,selectedId:n,onSelect:r})=>(0,N.jsx)(`fieldset`,{"aria-label":e,className:`m-0 inline-flex min-w-0 rounded-md border border-line bg-card p-0.5`,children:t.map(e=>{let t=e.id===n;return(0,N.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>r(e.id),className:o(`min-h-8 cursor-pointer rounded px-2.5 text-xs font-medium md:min-h-7`,t&&`bg-ink text-card`,!t&&`text-ink-2 hover:text-ink`),children:e.label},e.id)})}),$e=[{id:`fit`,labelKey:`grid.strip.fit`},{id:`true-size`,labelKey:`grid.strip.trueSize`}],et=[{id:`comfortable`,labelKey:`grid.strip.comfortable`},{id:`compact`,labelKey:`grid.strip.compact`}],Z=`grid size-8 cursor-pointer place-items-center rounded border border-line bg-card text-ink md:size-7`,tt=()=>{let{t:e}=r(),{gridView:t,changeSizeMode:n,changeDensity:i,stepScale:o}=Y(),s=$e.map(t=>({id:t.id,label:e(t.labelKey)})),c=et.map(t=>({id:t.id,label:e(t.labelKey)}));return(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line bg-card px-3 py-1.5 md:px-5`,children:[(0,N.jsx)(X,{label:e(`grid.strip.sizeMode`),segments:s,selectedId:t.sizeMode,onSelect:n}),(0,N.jsx)(X,{label:e(`grid.strip.density`),segments:c,selectedId:t.density,onSelect:i}),(0,N.jsxs)(`fieldset`,{"aria-label":e(`grid.strip.scale`),className:`m-0 inline-flex min-w-0 items-center gap-1 border-0 p-0`,children:[(0,N.jsx)(`button`,{type:`button`,"aria-label":e(`grid.strip.smaller`),onClick:()=>o(`smaller`),className:Z,children:(0,N.jsx)(a,{name:`minus`,size:14})}),(0,N.jsxs)(`output`,{"aria-label":e(`grid.strip.scale`),className:`min-w-10 text-center font-mono text-xs text-ink-2`,children:[t.scalePercent,`%`]}),(0,N.jsx)(`button`,{type:`button`,"aria-label":e(`grid.strip.larger`),onClick:()=>o(`larger`),className:Z,children:(0,N.jsx)(a,{name:`plus`,size:14})})]})]})},Q=()=>(0,P.useSyncExternalStore)(S,f),nt=y(`grid size-6 flex-none place-items-center rounded-full text-xs`,{variants:{status:{done:`bg-ok text-card`,now:`bg-cobalt font-semibold text-card`,later:`border-[1.5px] border-muted font-medium text-ink-2`}}}),rt=y(`text-[13.5px] whitespace-nowrap`,{variants:{status:{done:`font-medium text-ink`,now:`font-semibold text-cobalt`,later:`font-medium text-ink-2`}}}),it={done:`grid.empty.stepStates.done`,now:`grid.empty.stepStates.now`},at={done:`text-ok`,now:`text-cobalt`},ot=({stepKey:e,stepNumber:t,status:n})=>{let{t:i}=r(),s=n===`done`,c=n!==`later`,l=s?(0,N.jsx)(a,{name:`tick`,size:14,strokeWidth:2.6}):t;return(0,N.jsxs)(`li`,{className:`flex min-h-11 items-center gap-2 pe-3 ps-2.5`,children:[(0,N.jsx)(`span`,{className:nt({status:n}),children:l}),(0,N.jsx)(`span`,{className:rt({status:n}),children:i(`grid.empty.steps.${e}`)}),c&&(0,N.jsx)(`span`,{className:o(`font-mono text-[11px]`,at[n]),children:i(it[n])})]})},$=(e,t)=>e&&t?`done`:e?`now`:`later`,st=(e,t)=>t?`done`:e?`now`:`later`,ct=(e,t,n)=>{let r=e===`open`,i=r?`done`:`now`,a=$(r,t),o=st(a===`done`,n);return[{stepKey:`startHub`,status:i},{stepKey:`openApp`,status:a},{stepKey:`runTests`,status:o}]},lt=(e,t)=>$(e===`open`,t)!==`done`,ut=e=>!e,dt=()=>{let{t:e}=r(),t=E(),n=Q(),i=te()!==null,a=ct(t,n,i),o=e(`grid.empty.stepsLabel`,{count:a.length});return ut(i)?(0,N.jsxs)(`section`,{"aria-label":o,className:`flex flex-wrap items-center justify-start gap-x-1 rounded-2xl border border-line bg-card px-2 py-1 md:justify-center md:rounded-full md:py-0 md:ps-4 md:pe-2`,children:[(0,N.jsx)(`span`,{className:`w-full px-1.5 pt-2 font-mono text-[11px] tracking-[0.08em] text-ink-3 uppercase md:w-auto md:p-0 md:pe-2`,children:o}),(0,N.jsx)(`ol`,{className:`m-0 flex flex-wrap list-none p-0`,children:a.map((e,t)=>(0,N.jsx)(ot,{stepKey:e.stepKey,stepNumber:t+1,status:e.status},e.stepKey))})]}):null},ft=()=>s({mutationFn:async e=>{let t=await i.api.zoom.$put({json:{deviceId:e,clientId:x}});if(!t.ok)throw Error(`Zoom device: ${t.status}`)}}),pt=()=>{let[e,t]=(0,P.useState)(null),n=(0,P.useRef)(null),{mutate:r}=ft();return(0,P.useEffect)(()=>()=>{n.current!==null&&r(null)},[r]),{zoomedDeviceId:e,changeZoomedDevice:e=>{n.current=e,t(e),r(e)}}},mt=()=>{let e=g(),t=e.data??[],n=E(),r=Q(),{gridView:i}=Y(),{searchQuery:a}=T(),{zoomedDeviceId:o,changeZoomedDevice:s}=pt(),c=t.length===0,l=w(t,a),u=_(l),d=u.flatMap(e=>e.devices),f=!c&&d.length===0;return{deviceGroups:u,shownDeviceViews:d,gridView:i,devicesStatus:ae(e.status,c),isOpenAppCardShown:lt(n,r),isSearchEmpty:f,zoomedDeviceId:o,changeZoomedDevice:s}},ht=()=>({width:window.innerWidth,height:window.innerHeight}),gt=ht(),_t=()=>gt,vt=e=>{let t=()=>{gt=ht(),e()};return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},yt=()=>(0,P.useSyncExternalStore)(vt,_t),bt={width:64,height:230},xt=200,St=1,Ct=-1,wt=e=>({width:Math.max(xt,e.width-bt.width),height:Math.max(xt,e.height-bt.height)}),Tt=(e,t,n)=>{if(n===`true-size`)return 1;let r=wt(t);return A(e,r)},Et=(e,t,n)=>{let r=e.indexOf(t);return r===-1?null:e[(r+n+e.length)%e.length]??null},Dt=e=>{let{key:t,direction:n,isModified:r}=e,i=t===`ArrowRight`;return!i&&t!==`ArrowLeft`||r?null:n===`ltr`===i?St:Ct},Ot=(e,t,n,r)=>{let i=e.find(e=>e.deviceId===t);if(i===void 0)return null;let a=O(i);return{device:i,frameLayout:a,frameScale:Tt(a,n,r)}},kt=e=>{let{deviceViews:t,zoomedDeviceId:n,onZoomChange:i}=e,{i18n:a}=r(),o=yt(),[s,c]=(0,P.useState)(`fit`);return{zoomView:Ot(t,n,o,s),zoomMode:s,changeZoomMode:c,closeZoom:()=>i(null),moveWithArrowKey:e=>{let r=a.dir(),{key:o,altKey:s,metaKey:c,ctrlKey:l,shiftKey:u}=e,d=Dt({key:o,direction:r,isModified:s||c||l||u});if(d===null||n===null)return;let f=Et(t.map(e=>e.deviceId),n,d);f!==null&&(e.preventDefault(),i(f))}}},At=14,jt=[{id:`fit`,labelKey:`zoom.fit`},{id:`true-size`,labelKey:`zoom.trueSize`}],Mt=({zoomView:e,zoomMode:t,onZoomModeChange:n,onClose:i})=>{let{t:o}=r(),{device:s,frameLayout:c,frameScale:l}=e,{deviceId:u,name:d,browserName:f}=s,p=le(u),m=j(u),h=p!==null,g=Math.round(At/l),_=jt.map(e=>({id:e.id,label:o(e.labelKey)}));return(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsxs)(`header`,{className:`flex flex-wrap items-center gap-3 border-b border-line px-4 py-2`,children:[(0,N.jsx)(`h2`,{className:`m-0 text-sm font-semibold`,children:d}),(0,N.jsxs)(`span`,{className:`font-mono text-xs text-ink-2`,children:[s.screenWidth,`×`,s.screenHeight,` ·`,` `,o(`tile.engines.${f}`)]}),(0,N.jsxs)(`span`,{className:`ms-auto flex items-center gap-2`,children:[(0,N.jsx)(X,{label:o(`zoom.sizeMode`),segments:_,selectedId:t,onSelect:n}),(0,N.jsx)(`button`,{type:`button`,"aria-label":o(`zoom.close`),onClick:i,className:`grid size-9 cursor-pointer place-items-center rounded-md border border-line bg-card text-ink`,children:(0,N.jsx)(a,{name:`close`,size:16})})]})]}),(0,N.jsx)(`div`,{className:`flex max-h-[calc(96dvh-9.5rem)] justify-center overflow-auto bg-soft p-4`,children:(0,N.jsx)(`div`,{className:`m-auto`,children:(0,N.jsxs)(k,{layout:c,scale:l,children:[(0,N.jsx)(`p`,{"aria-hidden":h,className:`m-0 grid size-full place-items-center px-4 text-center text-ink-2`,style:{fontSize:g},children:o(`tile.waiting`)}),h&&(0,N.jsx)(`img`,{src:p,alt:d,className:`absolute inset-0 size-full object-cover`})]})})}),(0,N.jsxs)(`footer`,{className:`border-t border-line px-4 py-2 font-mono text-[11px] leading-4 text-ink-2`,children:[(0,N.jsx)(H,{deviceId:u}),(0,N.jsx)(V,{deviceLoad:m,browserName:f})]})]})},Nt=e=>{let{t}=r(),n=kt(e),{zoomView:i,zoomMode:a}=n,o=i!==null;return(0,N.jsx)(ne,{isOpen:o,label:t(`zoom.label`),className:`w-[min(96vw,1600px)]`,onClose:n.closeZoom,onKeyDown:n.moveWithArrowKey,children:o&&(0,N.jsx)(Mt,{zoomView:i,zoomMode:a,onZoomModeChange:n.changeZoomMode,onClose:n.closeZoom})})},Pt=()=>{let{t:e}=r(),{deviceGroups:t,shownDeviceViews:n,gridView:i,devicesStatus:a,isOpenAppCardShown:o,isSearchEmpty:s,zoomedDeviceId:c,changeZoomedDevice:l}=mt(),u=we(i),d=u.template===null,f={gap:u.gap,gridTemplateColumns:u.template??void 0},p=d?`flex flex-wrap items-start`:`grid items-start`;return(0,N.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,N.jsx)(tt,{}),(0,N.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 md:px-5 lg:flex-row`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,N.jsx)(dt,{}),o&&(0,N.jsx)(Ye,{}),(0,N.jsxs)(oe,{status:a,children:[s&&(0,N.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:e(`grid.noMatch`)}),(0,N.jsx)(`section`,{"aria-label":e(`grid.tilesLabel`),className:`flex flex-col gap-4`,children:t.map(t=>(0,N.jsx)(`section`,{"aria-label":e(`devices.groups.${t.group}`),className:p,style:f,children:t.devices.map(e=>(0,N.jsx)(Re,{device:e,gridView:i,onZoom:()=>l(e.deviceId)},e.deviceId))},t.group))})]})]}),(0,N.jsx)(`div`,{className:`lg:w-72 lg:flex-none`,children:(0,N.jsx)(_e,{})})]}),(0,N.jsx)(Ge,{}),(0,N.jsx)(Nt,{deviceViews:n,zoomedDeviceId:c,onZoomChange:l})]})};export{Pt as component};
@@ -0,0 +1 @@
1
+ import{N as e,a as t}from"./cn-DMYzmXtt.js";var n=e(),r=({origin:e})=>{let{t:r}=t();return(0,n.jsx)(`span`,{className:`inline-flex h-6 items-center rounded-full border border-line bg-card px-2.5 text-xs text-ink`,children:r(`runs.origins.${e}`)})};export{r as t};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{N as t,P as n,i as r,u as i}from"./cn-DMYzmXtt.js";function a(e){return e[e.length-1]}function o(e,t){return typeof e==`function`?e(t):e}var s=Object.prototype.hasOwnProperty;function c(e){for(let t in e)if(s.call(e,t))return!0;return!1}var l=()=>Object.create(null),u=(e,t)=>d(e,t,!0);function d(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(f(e)&&f(t)))return t;let o=Object.keys(e),c=o.length,u=Object.keys(t),p=u.length;if(i?c!==e.length||p!==t.length||c&&a(o)!==`${c-1}`||p&&a(u)!==`${p-1}`:c!==Object.getOwnPropertyNames(e).length||p!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let m=0,h,g,_;if(i){for(;m<p&&(_=m,g=e[_],h=t[_],h=g===h?g:typeof g==`object`?d(g,h,n,r):h,h===g);m++);if(m===p&&c===p)return e}else{let i=c===p,a=!0;for(;m<p;m++){_=u[m],g=e[_];let c=t[_];h=g===c?g:typeof g==`object`?d(g,c,n,r):c,i&&=h===g&&(o[m]===_||s.call(e,_)),a&&=Object.is(h,c),o[m]=h}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(a)return t}let v=i?u.fill(0):n?l():{};for(let a=0;a<p;a++)_=i?a:u[a],i?(g=e[_],a>m&&(h=t[_],h=g===h?g:typeof g==`object`?d(g,h,n,r):h),v[_]=a<m?g:h):v[_]=o[a];return v}function f(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function p(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!p(a,o,n,r))return!1}return!0}if(f(e)&&f(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!p(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!p(e[a],t[a],n,r)))return!1;return i===0}return!1}function m(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var h=/[\x00-\x1f\x7f"<>`{}]/g;function g(e){return e.replace(h,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function _(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return g(t)}var v=[`http:`,`https:`,`mailto:`,`tel:`];function y(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var b=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function x(e,t){if(!e)return!1;if(b.test(e))return!0;let n=y(e);return n?!t.has(n):!1}function S(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=_(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=_(r?e.slice(r):e)}return t}function C(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function w(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function T(){throw Error(`Invariant failed`)}function E(e){return e.replace(/\/{2,}/g,`/`)}function D(e){return e===`/`?e:e.replace(/^\/+/,``)}function O(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function k(e){return O(D(e))}function A(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ee(e,t,n=`never`,r){if(t.includes(`//`)&&(t=E(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,o;if(r){o=i?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(i)s=e.split(`/`);else{for(e.includes(`//`)&&(e=E(e)),s=e.split(`/`);s.length>1&&a(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.length>1?s.pop():s=[``]:r===`.`||s.push(r)}}s.length>1&&(a(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=s.join(`/`),l=(i?E(c):c)||`/`;return o&&r&&r.set(o,l),l}function j(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function te(e){return e==null||e===``}function M(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function N(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&te(f)){if(c===`/`&&!d)continue;f=``}o+=c+M(s,f,r)+(d||``)}}return o+a||`/`}function ne(e){return e?.isNotFound===!0}function re(){try{return sessionStorage}catch{return}}var ie=`tsr-scroll-restoration-v1_3`,ae=re();function oe(){try{return JSON.parse(ae?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var P=oe(),se=`data-scroll-restoration-id`,ce=e=>e.state.__TSR_key||e.href;function le(e){let t=e.getAttribute(se);if(t)return`[${se}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var ue=!1,de=`window`;function fe(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function pe(e){let t=new Set;for(let n of e){if(n===de)continue;let e=fe(n);e&&t.add(e)}return t}function me(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||ce,a=new Set,o=e=>{let t=P[e]||={};for(let e of a)e===document?t[de]={scrollX,scrollY}:e.isConnected&&(t[le(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,ue=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{ue||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{ae?.setItem(ie,JSON.stringify(P))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),!r.r&&(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.e&&d&&d!==u){let e=P[d];if(e){let t=P[u];for(let n in e){if(n===de){if(s)continue}else{let e=fe(n);if(!e||s&&o&&(l??=pe(o),l.has(e)))continue}t||=P[u]={},t[n]??=e[n]}}}ue=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=pe(o));let t=e&&i&&c,s=r.e?P[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===de){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=fe(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{ue=!1}}))}function he(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function ge(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function _e(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=ge(r):Array.isArray(t)?t.push(ge(r)):n[e]=[t,ge(r)]}return n}var ve=/^(?:\s|["[{\d-]|fa|nu|tr)/,ye=xe(JSON.parse),be=Se(JSON.stringify,JSON.parse);function xe(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=_e(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!ve.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function Se(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!ve.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=he(e,r);return t?`?${t}`:``}}var Ce=`__root__`;function we(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Te(e){return e instanceof Response&&!!e.options}function Ee(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var F=4,De=5;function Oe(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function ke(e,t,n){let r=e.slice(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.slice(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.slice(s,a);return[o?3:c?1:2,c||`_splat`,r.slice(0,i),e.slice(t+a+1,c?n:e.length)]}}return r}function I(e,t,n,r,i,o){let s=n,c=t.fullPath??t.from,l=t.options,u=c.length,d=c.endsWith(`/`)?u-1:u,f=l?.caseSensitive??e,p=l?.params?.parse??l?.parseParams,m,h=o?n-1:0;if(!r||c.includes(`$`)){m=o?.slice()??[];let e=a(m);e&&typeof e!=`string`&&e[0]===2&&(m[m.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+c.substring(n-(c[n-2]===`/`?2:1),d)],h=u)}for(;s<u;){let e=s,t=c.indexOf(`/`,e),n=t===-1?u:t,a=ke(c,e,n);s=n+1;let o;if(typeof a==`string`){if(!r)continue;let e=a,t;f?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)o=n;else{let n=L(r);o=n,t.set(e,n)}}else{let t=a[0],l=a[2],g=a[3]??``;if(t===2&&(n=u,s=n+1),m&&h<n&&(h<e-1&&m.push(c.slice(h,e-1)),a[2]=`/`+l,t===2&&a[3]!==void 0&&d<u&&(a[3]=g.slice(0,-1)),m.push(a),h=n),!r)continue;let _=f&&!!(l||g);f||(l=l.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!p&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===l&&e.suffix===g);if(y)o=y;else{let e=L(r,t,_,l,g);o=e,v.push(e),v.length===2&&i?.push(v)}}r=o}m&&h<d&&m.push(c.slice(h,d));let g=m?.slice();if(!r)return g;if(p&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=L(r,De);(r.pathless??=[]).push(e),r=e}let _=(t.path||!t.children)&&!t.isRoot;if(_&&d<u){let e=L(r,F);r.index=e,r=e}return r.parse=p??null,r.priority=l?.params?.priority??0,r.route||(r.data=g,_&&(r.route=t)),[r,s,g]}function Ae(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function L(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function je(e,t){let n=L(),r=[];function i(e,t,n,a){let[o,s,c]=I(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(Ae);t.masksTree=n,t.flatCache=Ee(1e3)}function Me(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Ie(e,t.masksTree);return t.flatCache.set(e,r),r}function Ne(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=L(),I(t,{from:e},1,o),i.singleCache.set(a,o)),Ie(r,o,n)}function Pe(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Ie(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Re(a.route)),t.matchCache.set(r,a),a}function Fe(e,t=!1){let n=L(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&T(),i[e.id]=e,o!==0&&e.path){let t=O(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=I(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(Ae);return{processedTree:{segmentTree:n,singleCache:Ee(1e3),matchCache:Ee(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Ie(e,t,n=!1){let r=e.split(`/`),i=Be(e,r,t,n);if(!i)return null;let[a]=Le(e,r,i);return{route:i.node.route,rawParams:a}}function Le(e,t,n){let r=ze(n.node),i=n.node.data&&Oe(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===F)break;if(u.kind===De){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function Re(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ze(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Be(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!a(t),o=i&&e!==`/`,s=t.length-+!!i,c=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],l=null,u=null;for(;c.length;){let n=c.pop(),{node:i,index:a,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!We(u,n))continue;if(i.parse){if(!Ue(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==F&&We(l,n)&&(l=n);let _=a===s;if(_&&(i.route&&(!o||i.kind===F||i.kind===2)&&We(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[a],y;if(_&&i.index){let n={node:i.index,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(Ue(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&He(f,s))return n;We(u,n)&&(u=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:o}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(o){if(_)continue;let e=t.slice(a).join(`/`),i=e.slice(-o.length);if((n.caseSensitive?i:i.toLowerCase())!==o||e.length-o.length<r.length)continue}c.push({node:n,index:s,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];c.push({node:n,index:a,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p,optionals:m+Ve(s,a),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p+Ve(s,a),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&c.push({node:e,index:a+1,skipped:d,statics:f+Ve(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&c.push({node:e,index:a+1,skipped:d,statics:f+Ve(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];c.push({node:t,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(u)return u;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function Ve(e,t){return 2**(e-t-1)}function He(e,t){return e===2**(t-1)-1}function Ue(e,t,n){let r,i;try{[r,i]=Le(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function We(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===F)>(e.node.kind===F)||t.node.kind===F==(e.node.kind===F)&&t.node.depth>e.node.depth)))}function Ge(e,t,n){let r=k(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=E(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>Ke(n,s.input({url:e})),output:({url:e})=>s.output({url:qe(n,e)})}:s}function Ke(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function qe(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Je(e){let t=e;return{get(){return t},set(e){t=o(e,t)}}}function Ye(e){return{get(){return e()}}}function Xe(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{w(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var R=`__TSR_index`,Ze=`popstate`,Qe=`beforeunload`,$e=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function et(e){let t=$e.exec(e);return t?`/`+e.slice(t[0].length):e}function tt(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
2
+ \r`.includes(e)?``:encodeURIComponent(e))),et(e)}function nt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async n=>{let r=n.navigateOpts?.ignoreBlocker?void 0:e.getBlockers?.();if(typeof document<`u`&&r?.length&&(n.type===`PUSH`||n.type===`REPLACE`))for(let i of r){let r=at(n.path,n.state);if(await i.blockerFn({currentLocation:t,nextLocation:r,action:n.type})){e.onBlocked?.();return}}n.task()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[R];i=rt(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[R];i=rt(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[R]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function rt(e,t){let n=ot();return{...t,key:n,__TSR_key:n,[R]:e}}function it(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>tt(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>at(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ot();t.history.replaceState({[R]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=at(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[R]-l.state[R],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=nt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:s,flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Qe,x,{capture:!0}),t.removeEventListener(Ze,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(Qe,x,{capture:!0}),t.addEventListener(Ze,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function at(e,t){let n=tt(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=ot();t={[R]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.slice(0,r>-1?i>-1?Math.min(r,i):r:i>-1?i:n.length),hash:r>-1?n.slice(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function ot(){return(Math.random()+1).toString(36).slice(7)}function st(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function ct(e){return e.pathname+e.search+e.hash}function lt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function ut(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function dt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function ft(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function pt(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var mt=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:it()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&k(n)?Ge(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Xe(this.latestLocation,e),me(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Fe(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&je(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:Ee(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:S(e),external:!1,searchStr:o,search:u(t?.search,i),hash:S(r.slice(1)),state:d(t?.state,a)}}let o=Ke(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:S(et(o.pathname)),external:!!this.rewrite&&st(o,this.origin),searchStr:c,search:u(t?.search,s),hash:S(o.hash.slice(1)),state:d(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Pe(O(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=at(n.href,{});n={...n,to:Ke(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,u=ee(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),d=this.routesByPath[O(u)],f=u.includes(`$`),p;if(d)p=d._branch??=Re(d);else if(f)p=[];else{let[e,t,n]=this.getMatchedRoutes(u);p=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(p=[...p,this.options.notFoundRoute])}let m=f?d?._interpolation??I(!1,{fullPath:u},0):void 0,h;for(let e of p){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(h??=yt(n.params,e),!c(h))break;h===e&&(h=Object.assign(l(),h));try{Object.assign(h,t(h))}catch{}}}h??=yt(n.params,bt(n.params,m)?o()[3]:xt);let g=e.leaveParams?u:et(S(m?N(u,m,h,this.pathParamsDecoder):u)),_=St(p,e._includeValidateSearch),v=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};p.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,vt(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},y=_.length?Ct(_,v(),n):n.search===!0?v():typeof n.search==`function`?n.search(v()):n.search||xt,b=this.options.stringifySearch(y),x=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,w=x?`#${x}`:``,T=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:xt,E=`${g}${b}${w}`,D,k,A=!1;if(this.rewrite){let e=new URL(E,this.origin),t=e.origin,n=qe(this.rewrite,e);D=ct(e),st(n,t)?(k=n.href,A=!0):k=et(ct(n))}else D=C(E),k=D;return{publicHref:k,href:D,pathname:g,search:y,searchStr:b,state:T,hash:x??``,external:A,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=Me(r.pathname,this.processedTree);if(t){let i=Object.assign(l(),t.rawParams),{from:a,params:o,...s}=t.route,c=yt(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return ht(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=O(this.latestLocation.href)===O(n.href)&&p(dt(n.state),dt(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?y(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return ht(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await rn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(ut(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&lt(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(b.test(n)||(r=y(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:st(e,this.origin)||(n=ct(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=z,this.preloadRoute=e=>an(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?ee(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Ne(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!p(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?p(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=j(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??be,parseSearch:e.parseSearch??ye,protocolAllowlist:e.protocolAllowlist??v}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=I(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:O(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?wt(this.options.notFoundMode,a):void 0,c=Array(a.length),f=this._committed,p=(e,t)=>{let n=f[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?f.find(t=>t.routeId===e.id):void 0},m;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],f,h,g;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=vt(i.options.validateSearch,{...n})??void 0;f={...n,...e},h={...r,...e}}catch(e){let r=e;if(e instanceof gt||(r=new gt(e.message,{cause:e})),t?.throwOnError)throw r;f=n,h={},g=r}}let _=``,v=``;try{_=i.options.loaderDeps?.({search:f})??``,v=_&&JSON.stringify(_)||``}catch(e){if(t?.throwOnError)throw e;g??=e}let y=l(),b=i._interpolation?N(i.fullPath,i._interpolation,r,this.pathParamsDecoder,y):i.fullPath,x=i.id+b+v,S=p(i,n),C=this._cache.get(x)??(S?.id===x?S:void 0);m=C?._strictParams??Object.assign(y,m);let w;if(!C)try{Tt(i,m)}catch(e){if(w=ne(e)||Te(e)?e:new _t(e.message,{cause:e}),t?.throwOnError)throw w}let T=S?`stay`:`enter`,E;if(C)E={...C,cause:T,search:u(S?S.search:C.search,f),_strictSearch:h,searchError:g};else{let e=lt(i)?`pending`:`success`;E={id:x,ssr:i.options.ssr,index:n,routeId:i.id,params:S?.params??m,_strictParams:m,pathname:b,updatedAt:Date.now(),search:S?u(S.search,f):f,_strictSearch:h,searchError:g,status:e,isFetching:!1,error:void 0,paramsError:w,context:{},abortController:t?._controller??new AbortController,cause:T,loaderDeps:S?d(S.loaderDeps,_):_,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let D=s===i.id;E._notFound&&!D&&(E.error=void 0),E._notFound=D,c[n]=E}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?u(n.params,m):m,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=a(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[o,s]=this.getMatchedRoutes(e.pathname),c=a(o),l={...e.search};for(let e of o)try{Object.assign(l,vt(e.options.validateSearch,l))}catch{}let u=n&&n.routeId===c.id&&n.pathname===e.pathname,d;if(u)d=n.params;else{let e=s;for(let t of o)try{Tt(t,e)}catch{}d=e}let f=[o,c.fullPath,l,d];return this.lightweightCache.set(e,[r,f]),f}};async function ht(e,t,{replace:n,ignoreBlocker:r}){if(!x(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var gt=class extends Error{},_t=class extends Error{};function vt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new gt(`Async validation not supported`);if(n.issues)throw new gt(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function yt(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function bt(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!s.call(e,t[1]))}var xt=Object.freeze({});function St(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=vt(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function Ct(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=o(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function wt(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Ce}function Tt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Et(e,t){return e.options[t]?.preload?.()}function Dt(e,t){let n=Et(e,`component`),r=Et(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function z(e,t,n){let r=()=>t===!1?void 0:t?Et(e,t):Dt(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function Ot(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function kt(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var B=0,V=1,At=2,H=3,U=[4];function W(e){return typeof e[0]==`number`}function G(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function K(e,t){return e.routesById[t.routeId]}function q(e,t,n){return Te(e)?[H,e]:ne(e)?(e.routeId||=n,[At,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[V,e]):[B,e]}function jt(e,t){let n=q(t,!0,e.id);if(n[0]!==V)return n;try{e.options.onError?.(n[1])}catch(t){n=q(t,!0,e.id)}return n}function J(e,t,n,r,i){return i[0].signal.aborted?U:Wt(e,t,n,jt(n,r),i)}async function Mt(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=K(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Y(e,r),[i,J(e,t,u,a,n)]}if(c.aborted)return[i,U];let p=r.paramsError??r.searchError;if(p!==void 0)return Y(e,r),[i,J(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Ft(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?G(a,c):a);if(c.aborted)return[i,U];let s=Wt(e,t,u,q(o,!1,u.id),n);if(s[0]!==B)return Y(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Y(e,r),[i,J(e,t,u,a,n)]}finally{r.status=h,Ft(e,r,!1,n[0])}}i()}function Nt(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Y(e,t){let n=t._flight;t._flight=void 0,Nt(e,t,n)?.abort()}function X(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Nt(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Pt(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Ft(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function It(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Lt(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return U;if(!i)return[B,void 0];let l=n._flight;Ft(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(It(e,t,n,r,s,a,!!o[3]))).then(e=>q(e,!1,r.id),e=>q(e,!0,r.id)).then(t=>(t[0]!==B&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===V&&l[2]?jt(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Wt(e,t,r,await G(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Y(e,n),U}finally{Ft(e,n,!1,s)}}function Rt(e,t,n){t[0]!==H&&(e.status=`success`,e.error=void 0,t[0]===B?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function zt(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Y(e,r)}function Bt(e,t){return t[0]===V||t[0]===At?{...e,status:t[0]===V?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Vt(e,t,n,r,i,a,o){let s=t[1][n],c=K(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(It(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=U)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Y(e,s),p=J(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Nt(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Lt(e,t,s,c,g,i,a).then(t=>(Rt(s,t,l),t[0]===B&&(m&&!a[0].signal.aborted&&zt(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[B,s.loaderData]),T=(async()=>{try{let e=z(c,void 0,C);e&&await G(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,J(e,t,c,r,a)]}let r=await w;x&&r[0]===B&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>Bt(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=Lt(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,Rt(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>Bt(E,e))}async function Ht(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=K(e,t[n]);try{let e=z(i,!1);e&&await G(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Z(e,t){t[2]&&=(X(e,t[2].map(e=>e[3])),void 0)}async function Ut(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=H)throw[a,t];!i&&t[0]!==B&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===H)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Wt(e,t,n,r,i,a){for(;r[0]===H;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[H,t]:[H,t,a]}return[H,o,n]}catch(e){r=a?[V,e]:jt(n,e),a=!0}}return r}async function Gt(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===At?Ht(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=H)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==B&&t[0]<H&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=H){let n=s[1];if(n[0]!==H||n[1].options.reloadDocument||n[2])return Z(e,t),n;c=!0,s=[0,[V,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===V?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=K(e,u);try{await G(i?Promise.resolve().then(()=>z(m,l===V?`errorComponent`:`notFoundComponent`)):Promise.all([z(m),z(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Z(e,t),U}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Z(e,t),X(e,o),p()):u.status=`success`}return t}async function Kt(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=K(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await G(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function qt(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Ht(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Vt(e,i,t,u,f,r,l)},m=await Mt(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===At){let t=await Ht(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=H&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=Gt(e,i,u,r[0],Ut(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Ut(i[2],void 0,void 0,h.then(e=>W(e)?0:Ot(n).length,()=>0))),o=await h}catch(t){if(Z(e,i),t===a&&a.aborted)return U;throw t}return W(o)?o:Kt(e,o,a,r[6]===n.length?r[6]:0)}function Jt(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=K(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Jt(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Yt(e,t){let n=e._pending;e._tx!==t&&e._tx?.[3].some(e=>e.id===n?.[1])||(clearTimeout(n?.[3]),e._pending=void 0)}async function Xt(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Ot(t[3]).some(e=>e.id===n[1]))return;let i;try{await G(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Zt(e,t){e._committed=t,e.stores.setMatches(t)}function Qt(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=Ot(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=K(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=ft(n);Zt(e,n),X(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),pt(e,i,n,a,l,t)}async function $t(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function en(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function tn(e,t,n,r,i){let a=n.map(e=>({...e}));Pt(a);for(let t of r)Y(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Gt(e,o,r,t[0],i)}catch(t){throw X(e,a),t}if(W(s))X(e,a),s[0]===H&&e._tx===t&&e._committed===n&&await en(e,t,s);else if(await Kt(e,s,t[0].signal),e._tx!==t||e._committed!==n)X(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Y(e,n))}Zt(e,a),X(e,n,a)}}async function nn(e,t,n,r,i,a){let o=await qt(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(W(o)){let n=o[0]===H&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Yt(e,t),X(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Yt(e,t);return}await en(e,t,o);return}let s=o[1];if(e._tx===t&&await Xt(e,t),e._tx!==t){Yt(e,t),X(e,s),Z(e,o);return}let c=t[2],l=ut(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Xt(e,t),e._tx!==t){Yt(e,t),X(e,s),Z(e,o);return}let n=await e.startTransition(()=>{Yt(e,t),Qt(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&tn(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):Z(e,o)})}async function rn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=ut(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await $t(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Pt(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){X(e,m),await $t(e,n);return}e._preflight=void 0;let g,_=()=>nn(e,y,f,()=>Jt(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>$t(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Ft(e,t,!1)}n[0].abort(),X(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Jt(e,y),g?.(_()),await y[5]):(X(e,y[3]),y[3]=[],g?.(),await $t(e,y))}async function an(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Pt(a),o=(e._preloads??=new Map).set(i,a),s=await qt(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),X(e,a)),i.abort()}if(!W(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){ne(e)||console.error(e);return}}}var on=`Error preloading route! ☝️`,Q=e(n(),1),sn=Q.createContext(null);function cn(e){return Q.useContext(sn)}function ln(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{kt(e,t,n)||(i=n,r.forEach(e=>e()))};return[()=>i??n.get(),e=>(r.size||(i=n.get(),a=n.subscribe(o).unsubscribe),r.add(e),()=>{r.delete(e),r.size||(a(),i=void 0)})]}var un=Q.createContext(void 0),dn=Q.createContext(void 0);t();function fn(...e){let t=Q.useRef(e),n=t.current;return e.forEach((e,t)=>{p(n[t],e,!1,!0)||(n[t]=e)}),t.current}function pn(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(on)})}function mn(e,t){let n=typeof e==`string`&&y(e);if(n)return t.has(n)?e:null}function hn(e,t,n,r){let i=A(e.pathname,r),a=A(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!p(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function gn(e,t,n){let r=cn(),i=Q.useRef(null),a=Q.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,disabled:u,target:d,onClick:f,onBlur:p,onFocus:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:_}=e,[v,b,x]=fn(e.search,e.params,o),S=Q.useContext(un),C=(r.stores._linkScopes??={})[S]??=ln(r,S),[w,T,E]=Q.useMemo(()=>{let t=mn(s,r.protocolAllowlist);if(t!==void 0){let n=[t??void 0];return[e,()=>n]}let n={...e},i,a,o,c=()=>{let e=C[0]();if(e!==i){n._fromLocation=e;let t=r.buildLocation(n),o=Cn(t,r,u),s=u||o&&!y(o)?hn(e,t,x,r.basepath):void 0;a&&a[0]===o&&a[1]===s||(a=[o,s]),i=e}return a};return[n,c,x?.includeHash&&(()=>{let e=c();return e[1]?o??=[e[0],!1]:e})]},[r,C,e.from,e.hash,e.href,s,v,b,e.state,e.mask,e.unsafeRelative,x,u]),[D,O]=Q.useSyncExternalStore(C[1],T,E||T),k=O===void 0&&D,A=u||D===void 0,ee=Q.useRef(!1),j=e.reloadDocument||k||A?!1:c??r.options.defaultPreload,te=l??r.options.defaultPreloadDelay??0,M=Q.useCallback(e=>{let t=e?.isIntersecting;t??j===`intent`?te?i.t??=setTimeout(()=>{i.t=void 0,pn(r,w)},te):pn(r,w):t===!1&&Sn(i)},[r,w,i,j,te]);Q.useEffect(()=>{if(!j)return;j===`render`&&!ee.current&&(ee.current=!0,pn(r,w));let e=!0,t;return j===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&M(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),Sn(i)}},[r,w,j,M,i]);let N=bn(e,n);if(N.ref=t?a:i,k)return N.href=k,N;let ne=t=>{let n=d??t.currentTarget.getAttribute(`target`);A||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||n&&n!==`_self`||t.button!==0||(t.preventDefault(),Sn(i),r.navigate({...e,_fromLocation:w._fromLocation}))},re=()=>{j===`intent`&&pn(r,w)},ie=()=>{j===`intent`&&Sn(i)};return N.onClick=$(f,ne),N.onBlur=$(p,ie),N.onFocus=$(m,M),N.onMouseEnter=$(h,M),N.onMouseLeave=$(g,ie),N.onTouchStart=$(_,re),xn(N,e,O,D,A,n)}var _n={},vn={className:`active`},yn=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function bn(e,t){let n={};for(let r in e)yn.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function xn(e,t,n,r,i,a){let{activeProps:s,inactiveProps:c,className:l,style:u,target:d}=t,f=o(n?s:c,{})??(n?vn:_n);Object.assign(e,f),e.href=r,a!==`a`&&(e.disabled=i),e.target=d;let p=f.style;(u||p)&&(e.style=u&&p?{...u,...p}:u||p);let m=f.className;return(l||m)&&(e.className=l?m?`${l} ${m}`:l:m),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var Sn=e=>{clearTimeout(e.t),e.t=void 0},$=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function Cn(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!x(i,t.protocolAllowlist))return i}var wn=Q.memo(Q.forwardRef((e,t)=>{let n=e._asChild||`a`,r=gn(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return Q.createElement(n,r,i)}),Tn);function Tn(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!yn.has(r)||!p(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var En=[`all`,`running`,`failed`,`ok`],Dn=[`all`,`cli`,`flow`,`playwright`],On=1e3,kn=60,An=2,jn=2e3,Mn=(e,t,n)=>{let r=t===`all`||e.status===t,i=n===`all`||e.origin===n;return r&&i},Nn=(e,t,n)=>e.filter(e=>Mn(e,t,n)).reverse(),Pn=(e,t)=>e.filter(e=>Mn(e,t,`all`)).length,Fn=e=>e?.some(e=>e.status===`running`)===!0&&jn,In=e=>e.steps.reduce((e,t)=>{let n=t.deviceAnswers.map(e=>e.durationMs);return e+Math.max(0,...n)},0),Ln=e=>{let t=Math.round(e/On);return`${Math.floor(t/kn)}:${String(t%kn).padStart(An,`0`)}`},Rn=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`},zn=e=>e.steps[0]?.title??null,Bn=e=>{for(let t of e.steps){let e=t.deviceAnswers.find(e=>e.status===`failed`);if(e!==void 0)return e.deviceId}return null},Vn=e=>e.steps.reduce((e,t)=>e+t.findings.length,0),Hn={list:()=>i({queryKey:[`runs`],queryFn:async()=>{let e=await r.api.runs.$get();if(!e.ok)throw Error(`Runs failed: ${e.status}`);return e.json()},refetchInterval:e=>Fn(e.state.data)}),detail:e=>i({queryKey:[`runs`,e],queryFn:async()=>{let t=await r.api.runs[`:runId`].$get({param:{runId:e}});if(!t.ok)throw Error(`Run ${e}: ${t.status}`);return t.json()}})};export{d as A,ne as C,T as D,O as E,c as O,Ce as S,D as T,mt as _,Pn as a,Ye as b,Nn as c,zn as d,wn as f,sn as g,cn as h,Vn as i,m as k,Bn as l,un as m,Dn as n,Ln as o,dn as p,En as r,Rn as s,Hn as t,In as u,ut as v,E as w,we as x,Je as y};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{N as t,P as n,a as r,d as i,i as a,r as o,t as s}from"./cn-DMYzmXtt.js";import{n as c,t as l}from"./button-N-Nucq_K.js";import{d as u,f as d,o as f,s as p,t as m,u as h}from"./runs-queries-BYBE7R9S.js";import{t as g}from"./useParams-D2lK5BEg.js";import{t as _}from"./useNavigate-8mkM-ffY.js";import{n as v,r as y,s as b}from"./dist-CnPFbxes.js";import{t as x}from"./modal-dialog-BaO9xkRr.js";import{t as S}from"./status-chip-yqTTTuyZ.js";import{t as C}from"./toggle-nciug_di.js";import{n as w,r as T,t as ee}from"./frame-layout-logic-H_x71NvW.js";import{n as te,t as E}from"./screen-boundary-BauyD9pu.js";import{a as D,i as O,t as k}from"./device-status-logic-Silf3YXA.js";import{t as A}from"./run-origin-badge-BeFqg0AC.js";var j=`/api/shots/`,M=(e,t)=>D(t,[e])??`none`,N=e=>O(e.steps).map(t=>{let n=e.steps.map(e=>({stepId:e.stepId,status:M(e,t)})),r=e=>n.filter(t=>t.status===e).length;return{deviceId:t,cells:n,okCount:r(`ok`),warnCount:r(`warn`),failedCount:r(`failed`)}}),P=e=>{let t=N(e),{okCount:n,warnCount:r,failedCount:i}=k(e.steps);return{stepCount:e.steps.length,deviceCount:t.length,okDeviceCount:n,warnDeviceCount:r,failedDeviceCount:i}},F=e=>e.steps.flatMap((e,t)=>{let{proof:n}=e;if(n===null)return[];let r=e.deviceAnswers.filter(e=>e.status===`failed`).map(e=>e.deviceId);return[{stepId:e.stepId,stepNumber:t+1,title:e.title,failedDeviceIds:r,proof:n}]}),I=e=>{if(e===null)return null;let t=e.slice(e.lastIndexOf(`/`)+1);return`${j}${encodeURIComponent(t)}`},L=t(),R=({failureProof:e,deviceViews:t})=>{let{t:n}=r(),{proof:i,stepNumber:a}=e,o=e.failedDeviceIds.map(e=>b(t,e)).join(`, `),s=I(i.shotPath),c=s!==null,l=i.codeSnippet!==null,u=n(`runs.report.shotAlt`,{deviceName:o,number:a});return(0,L.jsxs)(`article`,{className:`flex flex-col gap-3 rounded-2xl border border-line bg-card p-4 md:p-5`,children:[(0,L.jsxs)(`header`,{children:[(0,L.jsx)(`h3`,{className:`m-0 text-base font-medium`,children:n(`runs.report.proofStep`,{number:a,title:e.title})}),(0,L.jsx)(`p`,{className:`mt-1 mb-0 text-sm text-failed`,children:n(`runs.report.proofDevices`,{deviceNames:o})})]}),(0,L.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]`,children:[(0,L.jsxs)(`figure`,{className:`m-0 flex items-start justify-center rounded-xl bg-soft p-3`,children:[c&&(0,L.jsx)(`img`,{src:s,alt:u,className:`max-h-130 max-w-full rounded-lg border border-line`}),!c&&(0,L.jsx)(`figcaption`,{className:`py-10 text-sm text-ink-2`,children:n(`runs.report.noShot`)})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,L.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-ink text-card`,children:[(0,L.jsxs)(`p`,{className:`m-0 flex justify-between gap-2 border-b border-white/10 px-4 py-2 font-mono text-xs text-muted`,children:[(0,L.jsx)(`span`,{children:n(`runs.report.codeTitle`)}),(0,L.jsx)(`span`,{children:i.codeLocation})]}),l&&(0,L.jsx)(`pre`,{className:`m-0 overflow-x-auto px-4 py-3 font-mono text-xs leading-5`,children:i.codeSnippet}),!l&&(0,L.jsx)(`p`,{className:`m-0 px-4 py-3 text-sm text-muted`,children:n(`runs.report.noCode`)})]}),(0,L.jsxs)(`div`,{className:`rounded-xl bg-failed-soft px-4 py-3 text-failed`,children:[(0,L.jsx)(`p`,{className:`m-0 mb-1 text-xs font-medium`,children:n(`runs.report.errorTitle`)}),(0,L.jsx)(`p`,{className:`m-0 font-mono text-xs leading-5 break-words whitespace-pre-wrap`,children:i.errorMessage})]})]})]})]})},z=({run:e,deviceViews:t})=>{let{t:n}=r(),i=e.steps.flatMap((e,t)=>e.findings.map(n=>({stepNumber:t+1,stepTitle:e.title,finding:n}))),a=i.length===0;return(0,L.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h2`,{className:`m-0 text-xl font-medium`,children:n(`runs.report.findingsTitle`)}),a&&(0,L.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:n(`runs.report.noFindings`)}),(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-3 p-0`,children:i.map(e=>{let{finding:r}=e;return(0,L.jsxs)(`li`,{className:`rounded-2xl border border-line bg-card p-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`h3`,{className:`m-0 text-base font-medium`,children:n(`checks.${r.kind}`)}),(0,L.jsx)(S,{status:r.severity,label:n(`status.${r.severity}`)})]}),(0,L.jsx)(`p`,{className:`mt-2 mb-1 text-sm`,children:r.message}),(0,L.jsxs)(`p`,{className:`m-0 font-mono text-xs break-words text-ink-2`,children:[r.selector,` ·`,` `,n(`runs.report.findingStep`,{number:e.stepNumber,title:e.stepTitle}),` `,`· `,b(t,r.deviceId)]})]},`${e.stepNumber}-${r.deviceId}-${r.kind}-${r.selector}`)})})]})},B={ok:`tick`,warn:`finding`,failed:`close`,none:null},V={ok:`bg-ok-soft text-ok`,warn:`bg-warn-soft text-warn`,failed:`bg-failed-soft text-failed`,none:`bg-soft text-muted`},H=({run:e,deviceViews:t})=>{let{t:n}=r(),i=N(e);return(0,L.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h2`,{className:`m-0 text-xl font-medium`,children:n(`runs.report.matrixTitle`)}),(0,L.jsx)(`div`,{className:`overflow-x-auto rounded-2xl border border-line bg-card`,children:(0,L.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{className:`text-start text-xs text-ink-2`,children:[(0,L.jsx)(`th`,{scope:`col`,className:`px-4 py-3 text-start font-normal`,children:n(`runs.report.matrixDevice`)}),e.steps.map((e,t)=>(0,L.jsx)(`th`,{scope:`col`,title:e.title,className:`px-2 py-3 text-center font-mono font-normal`,children:t+1},e.stepId)),(0,L.jsx)(`th`,{scope:`col`,className:`px-4 py-3 text-end font-normal`,children:n(`runs.report.matrixVerdict`)})]})}),(0,L.jsx)(`tbody`,{children:i.map(e=>(0,L.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,L.jsx)(`th`,{scope:`row`,className:`px-4 py-3 text-start font-medium`,children:b(t,e.deviceId)}),e.cells.map(e=>{let t=B[e.status],r=t!==null;return(0,L.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,L.jsx)(`span`,{role:`img`,"aria-label":n(`status.${e.status}`),className:s(`inline-grid size-7 place-items-center rounded-md`,V[e.status]),children:r&&(0,L.jsx)(o,{name:t,size:14})})},e.stepId)}),(0,L.jsx)(`td`,{className:`px-4 py-3 text-end font-mono text-xs whitespace-nowrap text-ink-2`,children:n(`runs.report.routeTally`,{okCount:e.okCount,warnCount:e.warnCount,failedCount:e.failedCount})})]},e.deviceId))})]})})]})},U=({run:e})=>{let{t}=r(),n=P(e),i=u(e)??t(`runs.noSteps`),a=n.failedDeviceCount>0,s=n.warnDeviceCount>0,c=f(h(e)),l=p(e.startedAt),m=[{statKey:`steps`,statLabel:String(n.stepCount)},{statKey:`devices`,statLabel:String(n.deviceCount)},{statKey:`duration`,statLabel:c},{statKey:`started`,statLabel:l}];return(0,L.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,L.jsxs)(d,{to:`/runs`,className:`inline-flex min-h-11 items-center gap-1 text-sm text-ink-2 no-underline hover:text-ink`,children:[(0,L.jsx)(o,{name:`chevron-left`,size:14}),t(`runs.report.back`)]}),(0,L.jsxs)(`div`,{className:`rounded-2xl border border-line bg-card p-5 md:p-7`,children:[(0,L.jsx)(`h1`,{className:`m-0 font-mono text-3xl font-medium tracking-[-0.02em]`,children:t(`runs.report.title`,{runId:e.runId})}),(0,L.jsx)(`p`,{className:`mt-2 mb-3 text-base`,children:i}),(0,L.jsx)(A,{origin:e.origin}),(0,L.jsxs)(`dl`,{className:`m-0 mt-5 grid grid-cols-2 gap-4 border-t border-line pt-4 md:grid-cols-5`,children:[m.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`text-xs text-ink-2`,children:t(`runs.report.stats.${e.statKey}`)}),(0,L.jsx)(`dd`,{className:`m-0 mt-1 font-mono text-lg`,children:e.statLabel})]},e.statKey)),(0,L.jsxs)(`div`,{className:`col-span-2 md:col-span-1`,children:[(0,L.jsx)(`dt`,{className:`text-xs text-ink-2`,children:t(`runs.report.stats.verdict`)}),(0,L.jsxs)(`dd`,{className:`m-0 mt-1 flex flex-wrap gap-2`,children:[(0,L.jsx)(S,{status:`ok`,label:t(`runs.report.okDevices`,{count:n.okDeviceCount})}),a&&(0,L.jsx)(S,{status:`failed`,label:t(`runs.report.failedDevices`,{count:n.failedDeviceCount})}),s&&(0,L.jsx)(S,{status:`warn`,label:t(`runs.report.warnDevices`,{count:n.warnDeviceCount})})]})]})]})]})]})},W=()=>{let{runId:e}=g({from:`/runs/$runId`}),t=i(m.detail(e)),n=v().data??[],r=t.data??null,a=r===null?[]:F(r);return{run:r,runStatus:te(t.status,!1),failureProofs:a,deviceViews:n}},G=({runSweep:e})=>{let{t}=r(),n=e.appUrl===null,{isRunning:i,hasFailedToStart:a}=e,o=n||i,s=t(i?`sweep.running`:`sweep.run`),c=n||a;return(0,L.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,L.jsx)(l,{icon:`refresh`,variant:`outline`,size:`small`,disabled:o,"aria-describedby":`sweep-run-note`,onClick:e.startSweep,className:`border-cobalt text-cobalt`,children:s}),c&&(0,L.jsxs)(`p`,{id:`sweep-run-note`,className:`m-0 text-xs text-ink-2`,children:[n&&t(`sweep.needsAppUrl`),a&&(0,L.jsx)(`span`,{role:`alert`,className:`text-failed`,children:t(`sweep.runFailed`)})]})]})},K=`sweep-findings-only`,q=({sweepTotals:e,isFindingsOnly:t,routeFilter:n,runSweep:i,onChangeFindingsOnly:a,onChangeRouteFilter:s})=>{let{t:c}=r(),l=[{status:`ok`,count:e.okCount},{status:`warn`,count:e.warnCount},{status:`failed`,count:e.failedCount}];return(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 border-b border-line bg-card px-4 py-3 md:px-5`,children:[(0,L.jsx)(`h1`,{className:`m-0 text-xl font-semibold tracking-[-0.01em]`,children:c(`sweep.title`)}),(0,L.jsx)(`p`,{className:`m-0 font-mono text-[15px] text-ink-2`,children:c(`sweep.stats`,{...e})}),(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:l.map(e=>(0,L.jsx)(S,{status:e.status,label:c(`sweep.chips.${e.status}`,{count:e.count})},e.status))}),(0,L.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-4`,children:[(0,L.jsxs)(`label`,{htmlFor:K,className:`flex cursor-pointer items-center gap-2 text-[15px] font-medium`,children:[(0,L.jsx)(C,{id:K,checked:t,onChange:a}),c(`sweep.findingsOnly`),(0,L.jsx)(`span`,{className:`rounded-full bg-paper px-2 font-mono text-[13px] text-ink-2`,children:e.findingCount})]}),(0,L.jsxs)(`label`,{className:`flex h-10 w-56 items-center gap-2 rounded-xl border border-line bg-soft px-3 text-ink-2`,children:[(0,L.jsx)(o,{name:`search`,size:16}),(0,L.jsx)(`input`,{type:`search`,value:n??``,onChange:s,placeholder:c(`sweep.filterRoutes`),"aria-label":c(`sweep.filterRoutes`),className:`min-w-0 flex-1 border-0 bg-transparent font-mono text-sm text-ink outline-offset-4`})]}),(0,L.jsx)(G,{runSweep:i})]})]})},J=({openedShot:e,onClose:t})=>{let{t:n}=r(),{routePath:i,deviceView:a,cell:o}=e,{status:s,shotUrl:c,failureMessage:u}=o,d=c!==null,f=s!==`none`,p=u!==null,m=o.findings.length>0,h=!m&&!p,g=n(`sweep.shotAlt`,{route:i,deviceName:a.name});return(0,L.jsxs)(x,{isOpen:!0,label:n(`sweep.dialogLabel`,{route:i,deviceName:a.name}),onClose:t,onKeyDown:null,className:`w-[min(92vw,64rem)] overflow-auto p-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(`h2`,{className:`m-0 font-mono text-xl font-medium`,children:i}),(0,L.jsx)(`p`,{className:`m-0 text-base text-ink-2`,children:a.name}),f&&(0,L.jsx)(S,{status:s,label:n(`sweep.cellStatus.${s}`)}),(0,L.jsx)(`div`,{className:`ms-auto`,children:(0,L.jsx)(l,{icon:`close`,variant:`outline`,size:`small`,onClick:t,children:n(`sweep.dialogClose`)})})]}),(0,L.jsxs)(`div`,{className:`mt-4 grid gap-4 md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]`,children:[(0,L.jsxs)(`figure`,{className:`m-0 flex items-start justify-center rounded-xl bg-soft p-3`,children:[d&&(0,L.jsx)(`img`,{src:c,alt:g,className:`max-h-[70vh] max-w-full rounded-lg border border-line`}),!d&&(0,L.jsx)(`figcaption`,{className:`py-10 text-sm text-ink-2`,children:n(`runs.report.noShot`)})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[p&&(0,L.jsx)(`p`,{className:`m-0 rounded-xl bg-failed-soft px-4 py-3 font-mono text-xs leading-5 text-failed`,children:u}),h&&(0,L.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:n(`sweep.noFindings`)}),m&&(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:o.findings.map(e=>{let t=e.selector!==null;return(0,L.jsxs)(`li`,{className:`rounded-xl bg-warn-soft px-4 py-3`,children:[(0,L.jsx)(`h3`,{className:`m-0 text-sm font-medium text-warn`,children:n(`checks.${e.kind}`)}),(0,L.jsx)(`p`,{className:`mt-1 mb-0 text-sm`,children:e.message}),t&&(0,L.jsx)(`p`,{className:`mt-1 mb-0 font-mono text-xs text-ink-2`,children:e.selector})]},`${e.kind}-${e.selector}-${e.message}`)})})]})]})]})},Y=`sweep `,ne=[`ok`,`warn`,`failed`],X=150,Z=108,re=e=>e?.status===`failed`?e.message:null,ie=(e,t)=>{let{deviceId:n}=t,r=e.deviceAnswers.find(e=>e.deviceId===n),i=re(r),a=r?.shotPath??null;return{deviceView:t,status:M(e,n),shotUrl:I(a),failureMessage:i,findings:e.findings.filter(e=>e.deviceId===n)}},ae=e=>e.includes(`failed`)?`failed`:e.includes(`warn`)?`warn`:`ok`,oe=(e,t)=>{let n=t.map(t=>ie(e,t)),r=n.reduce((e,t)=>e+t.findings.length,0),i=n.map(e=>e.status);return{stepId:e.stepId,path:e.title.replace(Y,``),shotCount:n.filter(e=>e.shotUrl!==null).length,findingCount:r,verdict:ae(i),cells:n}},se=(e,t)=>{let n=O(e.steps),r=t.filter(({deviceId:e})=>n.includes(e));return{columns:r,routes:e.steps.map(e=>oe(e,r))}},ce=e=>{let{routes:t,columns:n}=e,r=t.flatMap(e=>e.cells),i=e=>r.filter(t=>t.status===e).length;return{routeCount:t.length,deviceCount:n.length,shotCount:t.reduce((e,t)=>e+t.shotCount,0),findingCount:t.reduce((e,t)=>e+t.findingCount,0),okCount:i(`ok`),warnCount:i(`warn`),failedCount:i(`failed`)}},le=(e,t)=>{let n=(t.routeFilter??``).trim().toLowerCase();return e.filter(e=>{let r=e.verdict!==`ok`,i=t.isFindingsOnly&&!r,a=e.path.toLowerCase().includes(n);return!i&&a})},ue=e=>{let{cells:t}=e,n=e.verdict===`ok`;return ne.map(e=>({status:e,cellCount:t.filter(t=>t.status===e).length,isRouteClean:n})).filter(e=>e.cellCount>0)},de=e=>{let[t]=e.findings,{failureMessage:n}=e;return n===null?t===void 0?{kind:`status`,status:e.status}:{kind:`finding`,findingKind:t.kind,moreCount:e.findings.length-1}:{kind:`failure`,message:n}},fe=e=>{let t=w(e);return ee(t,{width:X,height:Z})},pe=(e,t)=>{if(t===null)return null;let n=e.routes.find(({stepId:e})=>e===t.stepId),r=n?.cells.find(({deviceView:e})=>e.deviceId===t.deviceId);return n===void 0||r===void 0?null:{routePath:n.path,deviceView:r.deviceView,cell:r}},me=({cell:e})=>{let{t}=r(),n=de(e),i=n.kind===`failure`,a=n.kind===`finding`;if(i)return(0,L.jsx)(L.Fragment,{children:n.message});if(a){let e=n.moreCount>0;return(0,L.jsxs)(L.Fragment,{children:[t(`checks.${n.findingKind}`),e&&(0,L.jsx)(`span`,{className:`ms-1 font-mono`,children:t(`sweep.moreFindings`,{count:n.moreCount})})]})}return(0,L.jsx)(L.Fragment,{children:t(`sweep.cellStatus.${n.status}`)})},Q={ok:`border-line bg-card text-ink-2`,warn:`border-warn bg-warn-soft text-warn`,failed:`border-failed bg-failed-soft text-failed`,none:`border-line bg-soft text-muted`},he=({cell:e,routePath:t,onOpen:n})=>{let{t:i}=r(),{status:a,shotUrl:o,deviceView:c}=e,l=o!==null,u=a!==`none`,d=i(`sweep.openShot`,{route:t,deviceName:c.name}),f=i(`sweep.shotAlt`,{route:t,deviceName:c.name});return(0,L.jsx)(`td`,{className:`w-44 min-w-44 max-w-44 p-1.5 align-top`,children:(0,L.jsxs)(`button`,{type:`button`,"aria-label":d,onClick:n,className:s(`relative flex h-40 w-full cursor-pointer flex-col items-center gap-1 rounded-xl border p-2`,Q[a]),children:[(0,L.jsx)(`span`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,L.jsx)(T,{layout:w(c),scale:fe(c),children:l&&(0,L.jsx)(`img`,{src:o,alt:f,loading:`lazy`,className:`size-full object-cover object-top`})})}),(0,L.jsx)(`span`,{className:`line-clamp-2 min-h-4 text-center text-[13px] leading-4`,children:(0,L.jsx)(me,{cell:e})}),u&&(0,L.jsx)(`span`,{className:`absolute end-1.5 top-1.5`,children:(0,L.jsx)(S,{status:a,label:i(`sweep.cellStatus.${a}`),isLabelHidden:!0})})]})})},ge=({route:e,onOpenShot:t})=>{let{t:n}=r(),i=ue(e).map(e=>{let{isRouteClean:t,status:r,cellCount:i}=e;return{status:r,label:t?n(`sweep.clean`):n(`sweep.chips.${r}`,{count:i})}});return(0,L.jsxs)(`tr`,{children:[(0,L.jsxs)(`th`,{scope:`row`,className:`sticky start-0 z-10 min-w-48 bg-soft px-4 py-2 text-start align-middle font-normal`,children:[(0,L.jsx)(`span`,{className:`block font-mono text-lg font-medium break-all text-ink`,children:e.path}),(0,L.jsx)(`span`,{className:`mt-1 mb-2 block text-sm text-ink-2`,children:n(`sweep.shotCount`,{count:e.shotCount})}),(0,L.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,L.jsx)(S,{status:e.status,label:e.label},e.status))})]}),e.cells.map(n=>(0,L.jsx)(he,{cell:n,routePath:e.path,onOpen:()=>t({stepId:e.stepId,deviceId:n.deviceView.deviceId})},n.deviceView.deviceId))]})},_e=({columns:e,routes:t,onOpenShot:n})=>{let{t:i}=r();return(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto`,children:(0,L.jsxs)(`table`,{className:`w-max border-separate border-spacing-0`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{scope:`col`,className:`sticky start-0 z-10 bg-soft px-4 py-3 text-start text-xs font-normal tracking-wider text-ink-2 uppercase`,children:i(`sweep.routeColumn`)}),e.map(e=>(0,L.jsxs)(`th`,{scope:`col`,className:`px-2.5 py-3 text-start font-normal`,children:[(0,L.jsx)(`span`,{className:`block text-base font-medium`,children:e.name}),(0,L.jsx)(`span`,{className:`block font-mono text-sm text-ink-2`,children:i(`sweep.viewport`,{width:e.viewportWidth,height:e.viewportHeight})})]},e.deviceId))]})}),(0,L.jsx)(`tbody`,{children:t.map(e=>(0,L.jsx)(ge,{route:e,onOpenShot:n},e.stepId))})]})})},$=e(n(),1),ve=async e=>{let t=await a.api.commands.$post({json:{commandName:`sweep`,url:e,deviceIds:null}});if(!t.ok)throw Error(`The hub refused the sweep command: ${t.status}`);let n=await t.json();if(n.runId===null)throw Error(n.line);return n},ye=()=>{let e=y(),t=_(),n=c({mutationFn:ve,onSuccess:async({runId:e})=>{e!==null&&await t({to:`/runs/$runId`,params:{runId:e}})}});return{appUrl:e,isRunning:n.isPending,hasFailedToStart:n.isError,startSweep:()=>{e!==null&&n.mutate(e)}}},be=(e,t)=>{let[n,r]=(0,$.useState)(!1),[i,a]=(0,$.useState)(null),[o,s]=(0,$.useState)(null),c=ye(),l=se(e,t),u=le(l.routes,{isFindingsOnly:n,routeFilter:i});return{columns:l.columns,shownRoutes:u,totalRouteCount:l.routes.length,sweepTotals:ce(l),isFindingsOnly:n,routeFilter:i,openedShot:pe(l,o),runSweep:c,changeFindingsOnly:e=>r(e.target.checked),changeRouteFilter:e=>{let t=e.target.value===``;a(t?null:e.target.value)},openShot:s,closeShot:()=>s(null)}},xe=({run:e,deviceViews:t})=>{let{t:n}=r(),i=be(e,t),{shownRoutes:a,openedShot:o}=i,s=o!==null,c=a.length===0;return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsx)(q,{sweepTotals:i.sweepTotals,isFindingsOnly:i.isFindingsOnly,routeFilter:i.routeFilter,runSweep:i.runSweep,onChangeFindingsOnly:i.changeFindingsOnly,onChangeRouteFilter:i.changeRouteFilter}),(0,L.jsx)(_e,{columns:i.columns,routes:a,onOpenShot:i.openShot}),c&&(0,L.jsx)(`p`,{role:`status`,className:`m-0 px-5 py-6 text-sm text-ink-2`,children:n(`sweep.noRoutes`)}),(0,L.jsxs)(`footer`,{className:`flex flex-wrap justify-between gap-2 border-t border-line bg-card px-4 py-3 font-mono text-sm text-ink-2 md:px-5`,children:[(0,L.jsx)(`span`,{children:n(`sweep.showing`,{shownCount:a.length,totalCount:i.totalRouteCount})}),(0,L.jsx)(`span`,{children:n(`sweep.openHint`)})]}),s&&(0,L.jsx)(J,{openedShot:o,onClose:i.closeShot})]})},Se=()=>{let{t:e}=r(),{run:t,runStatus:n,failureProofs:i,deviceViews:a}=W(),o=t!==null,s=i.length>0;return o&&t.runKind===`sweep`?(0,L.jsx)(xe,{run:t,deviceViews:a}):(0,L.jsx)(`div`,{className:`mx-auto flex w-full max-w-290 flex-col gap-7 p-4 md:p-7`,children:(0,L.jsx)(E,{status:n,children:o&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(U,{run:t}),s&&(0,L.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h2`,{className:`m-0 text-xl font-medium`,children:e(`runs.report.proofTitle`)}),i.map(e=>(0,L.jsx)(R,{failureProof:e,deviceViews:a},e.stepId))]}),(0,L.jsx)(H,{run:t,deviceViews:a}),(0,L.jsx)(z,{run:t,deviceViews:a})]})})})};export{Se as component};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{N as t,P as n,a as r,d as i,r as a,t as o}from"./cn-DMYzmXtt.js";import{a as s,c,d as l,f as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v}from"./runs-queries-BYBE7R9S.js";import{n as y,t as b}from"./screen-boundary-BauyD9pu.js";import{t as x}from"./run-origin-badge-BeFqg0AC.js";var S=t(),C={running:`open-url`,ok:`tick`,failed:`close`},w={running:`text-pink`,ok:`text-ok`,failed:`text-failed`},T=({run:e})=>{let{t}=r(),n=l(e)??t(`runs.noSteps`),i=f(e),s=i!==null,c=d(e),p=c>0,h=e.runKind===`sweep`,_=m(v(e)),y=g(e.startedAt);return(0,S.jsx)(`li`,{className:`border-t border-line first:border-t-0`,children:(0,S.jsxs)(u,{to:`/runs/$runId`,params:{runId:e.runId},"aria-label":t(`runs.openRun`,{runId:e.runId}),className:`flex min-h-14 flex-wrap items-center gap-x-4 gap-y-1 px-4 py-3 text-ink no-underline hover:bg-soft md:px-5`,children:[(0,S.jsx)(`span`,{className:o(`flex-none`,w[e.status]),children:(0,S.jsx)(a,{name:C[e.status],size:16,strokeWidth:2.2})}),(0,S.jsx)(`span`,{className:`w-20 flex-none font-mono text-xs text-ink-2`,children:e.runId}),(0,S.jsxs)(`span`,{className:`min-w-40 flex-1`,children:[(0,S.jsx)(`span`,{className:`block text-sm font-medium`,children:n}),s&&(0,S.jsx)(`span`,{className:`block text-xs text-failed`,children:t(`runs.failedOn`,{deviceId:i})})]}),h&&(0,S.jsx)(`span`,{className:`inline-flex h-6 items-center rounded-full bg-ink px-2.5 text-xs text-card`,children:t(`runs.sweepBadge`)}),(0,S.jsx)(x,{origin:e.origin}),p&&(0,S.jsx)(`span`,{className:`inline-flex h-6 items-center rounded-full bg-warn-soft px-2.5 text-xs text-warn`,children:t(`runs.findingsCount`,{count:c})}),(0,S.jsx)(`span`,{className:`font-mono text-xs text-ink-2`,children:_}),(0,S.jsx)(`span`,{className:`font-mono text-xs text-ink-2`,children:y})]})})},E=e(n(),1),D=()=>{let e=i(_.list()),[t,n]=(0,E.useState)(`all`),[r,a]=(0,E.useState)(`all`),o=e.data??[],s=c(o,t,r),l=o.length===0;return{runsStatus:y(e.status,l),runs:o,shownRuns:s,statusFilter:t,originFilter:r,chooseStatusFilter:n,chooseOriginFilter:a}},O=({label:e,count:t,isSelected:n,onSelect:r})=>{let i=t!==null;return(0,S.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:r,className:o(`inline-flex h-11 cursor-pointer items-center gap-2 rounded-full border px-4 text-sm font-medium md:h-10`,n&&`border-ink bg-ink text-card`,!n&&`border-line bg-card text-ink`),children:[e,i&&(0,S.jsx)(`span`,{className:`font-mono text-xs opacity-70`,children:t})]})},k=()=>{let{t:e}=r(),t=D(),{runsStatus:n,runs:i,shownRuns:a}=t,o=a.length>0,c=!o;return(0,S.jsxs)(`div`,{className:`mx-auto flex w-full max-w-290 flex-col gap-5 p-4 md:p-7`,children:[(0,S.jsxs)(`header`,{children:[(0,S.jsx)(`h1`,{className:`m-0 text-3xl font-medium tracking-[-0.02em]`,children:e(`runs.title`)}),(0,S.jsx)(`p`,{className:`mt-1 mb-0 text-sm text-ink-2`,children:e(`runs.subtitle`)})]}),(0,S.jsxs)(b,{status:n,children:[(0,S.jsx)(`section`,{"aria-label":e(`runs.statusLabel`),className:`flex flex-wrap items-center gap-2`,children:h.map(n=>(0,S.jsx)(O,{label:e(`runs.statusFilters.${n}`),count:s(i,n),isSelected:t.statusFilter===n,onSelect:()=>t.chooseStatusFilter(n)},n))}),(0,S.jsx)(`section`,{"aria-label":e(`runs.sourceLabel`),className:`flex flex-wrap items-center gap-2`,children:p.map(n=>(0,S.jsx)(O,{label:e(`runs.originFilters.${n}`),count:null,isSelected:t.originFilter===n,onSelect:()=>t.chooseOriginFilter(n)},n))}),c&&(0,S.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-ink-2`,children:e(`runs.noRuns`)}),o&&(0,S.jsx)(`ul`,{className:`m-0 list-none overflow-hidden rounded-2xl border border-line bg-card p-0`,children:a.map(e=>(0,S.jsx)(T,{run:e},e.runId))})]})]})};export{k as component};
@@ -0,0 +1,55 @@
1
+ function e(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function t(e,t=`|`){return e.map(e=>se(e)).join(t)}function n(e,t){return typeof t==`bigint`?t.toString():t}var r=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function i(e){return new r(e)}function a(e){return e==null}function o(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function s(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function c(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function l(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function u(e){return l(e._zod.def)??e._zod.def.shape}function d(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return c(this,t,e),e},enumerable:!0,configurable:!0})}function f(e,t,n){t in e?c(e,t,n):e[t]=n}function p(e,t,n,r){let i=u(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?d(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):f(e,a,r?r(n.value,a):n.value))}}function m(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?d(e,n,()=>t[n]):f(e,n,r.value))}}function h(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ee(e){return JSON.stringify(e)}function te(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ne=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var re=i(()=>{if(j.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _(e){if(g(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return g(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ie(e){return _(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ae=new Set([`string`,`number`,`symbol`]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function v(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function y(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var le={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ue={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return p(i,e,b(e,t)),v(e,h(n,{shape:i,checks:[]}))}function b(e,t){let n=u(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function fe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(b(e,t)),a={};return p(a,e,Reflect.ownKeys(u(e)).filter(e=>!i.has(e))),v(e,h(n,{shape:a,checks:[]}))}function pe(e,t){if(!_(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=u(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return v(e,h(e._zod.def,{shape:me(e,t)}))}function me(e,t){let n={};return p(n,e,Reflect.ownKeys(u(e))),m(n,t),n}function he(e,t){if(!_(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return v(e,h(e._zod.def,{shape:me(e,t)}))}function ge(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return p(n,e,Reflect.ownKeys(u(e))),p(n,t,Reflect.ownKeys(u(t))),v(e,h(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function _e(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(b(t,n)):void 0,o={};return p(o,t,Reflect.ownKeys(u(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),v(t,h(t._zod.def,{shape:o,checks:[]}))}function ve(e,t,n){let r=n?new Set(b(t,n)):void 0,i={};return p(i,t,Reflect.ownKeys(u(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),v(t,h(t._zod.def,{shape:i}))}function x(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ye(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function S(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function C(e){return typeof e==`string`?e:e?.message}function be(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function xe(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function w(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:C(e.inst?._zod.def?.error?.(e))??C(a?.(e))??C(t?.error?.(e))??C(n.customError?.(e))??C(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Se=/[\uD800-\uDBFF]/;function Ce(e){let t=e.length;if(!Se.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function we(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Te(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function T(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ee(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):ke(e,n,r.value)}}function E(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function De(e,t,n){return E(e,t,n,!1)}function Oe(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return E(this,n,r(this))},set(e){E(this,n,e)}})}return t}function ke(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:E(this,t,n.bind(this))},set(e){E(this,t,e)}})}function Ae(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var je,D=!1,Me={configurable:!0,get(){D=!0}};function O(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&je!==e._zod?je=void 0:(je=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Me);let e=D;D=!1;try{let r=n(this);return D?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),D||=e,r}catch(n){throw delete this[t],D||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Ne(e,t,n,r){let i=Ae(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Pe=`~constantCatch`;function Fe(e){let t=()=>e;return t[Pe]=!0,t}var Ie,Le={value:void 0,enumerable:!1},Re=`captureStackTrace`in Error?Error:null;function ze(e){let t=Re;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Re=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function k(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Le.value=new a(r);try{Object.defineProperty(n,"_zod",Le)}finally{Le.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Ee(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ze(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var A=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Be=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ie=globalThis).__zod_globalConfig??(Ie.__zod_globalConfig={});var j=globalThis.__zod_globalConfig;function M(e){return e&&Object.assign(j,e),j}function Ve(){let e=this._zod;return e.message??=JSON.stringify(e.def,n,2),e.message}function He(e){this._zod.message=e}var Ue={get:Ve,set:He,enumerable:!0,configurable:!0},We={value:void 0,enumerable:!1},Ge=new WeakSet([Object.prototype,Error.prototype]),Ke=k(`$ZodError`,(e,t)=>{e.name=`$ZodError`,We.value=t,Object.defineProperty(e,"issues",We),We.value=void 0,Object.defineProperty(e,"message",Ue);let n=Object.getPrototypeOf(e);Ge.has(n)||(Ge.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function qe(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Je(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?qe(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ye(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Xe(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ze=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new A;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>w(e,o,M())));throw ne(n,a?.callee??t),n}return s.value};return t},Qe=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>w(e,o,M())));throw ne(n,a?.callee??t),n}return s.value};return t},$e=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new A;return a.issues.length?et(e,a.issues,i):{success:!0,data:a.value}};function et(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>w(e,n,M()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var tt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?et(e,a.issues,i):{success:!0,data:a.value}},nt=Symbol.for(`zod.compile.invalid`),rt=Symbol.for(`zod.compile.fallback`),it=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==nt)return!0;if(r.definite===!0&&n===void 0)return!1}return at(e,t,n)});function at(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[rt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new A;return a.issues.length===0}var ot=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},st=e=>{let t=Ze(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Xe(n,a))};return n},ct=e=>{let t=Ze(e),n=(e,r,i,a)=>t(e,r,i,Xe(n,a));return n},lt=e=>{let t=Qe(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Xe(n,a))};return n},ut=e=>{let t=Qe(e),n=async(e,r,i,a)=>await t(e,r,i,Xe(n,a));return n},dt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return $e(e)(t,n,i)},ft=e=>(t,n,r)=>$e(e)(t,n,r),pt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return tt(e)(t,n,i)},mt=e=>async(t,n,r)=>tt(e)(t,n,r),ht=/^[cC][0-9a-z]{6,}$/,gt=/^[0-9a-z]+$/,_t=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,vt=/^[0-9a-vA-V]{20}$/,yt=/^[A-Za-z0-9]{27}$/,bt=/^[a-zA-Z0-9_-]{21}$/;function xt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var St=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ct=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Tt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Et=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Dt(){return new RegExp(Et,`u`)}var Ot=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,At=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,jt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Nt=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Pt=/^https?$/,Ft=/^\+[1-9]\d{6,14}$/,It=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Lt(e){return RegExp(`^${e}$`)}var Rt=Lt(It);function zt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Bt(e){return RegExp(`^${zt(e)}$`)}function Vt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${zt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${zt({precision:e.precision})}`:n;return RegExp(`^${It}T(?:${r})$`)}var Ht=/^[\s\S]{0,}$/,Ut=/^-?\d+$/,Wt=/^-?\d+(?:\.\d+)?$/,Gt=/^(?:true|false)$/i,Kt=/^[^A-Z]*$/,qt=/^[^a-z]*$/,N=k(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Jt=e=>{let t=e.value;return!a(t)&&t.length!==void 0},P={number:`number`,bigint:`bigint`,object:`date`},Yt=k(`$ZodCheckLessThan`,(e,t)=>{N.init(e,t);let n=P[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:P[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xt=k(`$ZodCheckGreaterThan`,(e,t)=>{N.init(e,t);let n=P[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:P[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zt=k(`$ZodCheckMultipleOf`,(e,t)=>{N.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):s(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Qt=k(`$ZodCheckNumberFormat`,(e,t)=>{N.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=le[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),$t=k(`$ZodCheckMaxLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=Jt),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ce(r):i)<=t.maximum)return;let a=we(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),en=k(`$ZodCheckMinLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=Jt),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ce(r):i)>=t.minimum)return;let a=we(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),tn=k(`$ZodCheckLengthEquals`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=Jt),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ce(r):i;if(a===t.length)return;let o=we(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),nn=k(`$ZodCheckStringFormat`,(e,t)=>{var n,r;N.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),rn=k(`$ZodCheckRegex`,(e,t)=>{nn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),an=k(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Kt,nn.init(e,t)}),on=k(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=qt,nn.init(e,t)}),sn=k(`$ZodCheckIncludes`,(e,t)=>{N.init(e,t);let n=oe(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),cn=k(`$ZodCheckStartsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`^${oe(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ln=k(`$ZodCheckEndsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`.*${oe(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),un=k(`$ZodCheckOverwrite`,(e,t)=>{N.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),dn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
+ `)}\n};`)(...Object.values(this.closed))}},fn={major:4,minor:6,patch:7},F=k(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=x(t),a;for(let o of n){if(o._zod.def.when){if(ye(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new A;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(xe(t.issues,n,e),i||=x(t,n))});else{if(t.issues.length===n)continue;xe(t.issues,n,e),i||=x(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(x(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new A;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new A;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return De(this,`~standard`,hn(this))},set"~standard"(e){E(this,`~standard`,e)}}),pn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>w(e,t,M()))}:{value:e.value};async function mn(e,t){let n={async:!0};return pn(await e._zod.run({value:t,issues:[]},n),n)}function hn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return pn(r,n)}catch{}return mn(e,t)},vendor:`zod`,version:1}}var gn=k(`$ZodString`,(e,t)=>{F.init(e,t),e._zod.pattern=t.pattern??Ht,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),I=k(`$ZodStringFormat`,(e,t)=>{nn.init(e,t),gn.init(e,t)}),_n=k(`$ZodGUID`,(e,t)=>{t.pattern??=Ct,I.init(e,t)}),vn=k(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=wt(e)}else t.pattern??=wt();I.init(e,t)}),yn=k(`$ZodEmail`,(e,t)=>{t.pattern??=Tt,I.init(e,t)});function bn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function xn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?bn(e)||2:Sn(e,t)}function Sn(e,t){if(!t.normalize&&t.protocol?.source===Pt.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Cn=/[\t\n\r]/g;function wn(e){return e.replace(Cn,``)}function Tn(e,t){return t.lastIndex=0,t.test(e.hostname)}function En(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Dn=k(`$ZodURL`,(e,t)=>{I.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=xn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=wn(r);return}t.hostname&&!Tn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!En(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:wn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),On=k(`$ZodEmoji`,(e,t)=>{t.pattern??=Dt(),I.init(e,t)}),kn=k(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?bt:xt(t.length),I.init(e,t)}),An=k(`$ZodCUID`,(e,t)=>{t.pattern??=ht,I.init(e,t)}),jn=k(`$ZodCUID2`,(e,t)=>{t.pattern??=gt,I.init(e,t)}),Mn=k(`$ZodULID`,(e,t)=>{t.pattern??=_t,I.init(e,t)}),Nn=k(`$ZodXID`,(e,t)=>{t.pattern??=vt,I.init(e,t)}),Pn=k(`$ZodKSUID`,(e,t)=>{t.pattern??=yt,I.init(e,t)}),Fn=k(`$ZodISODateTime`,(e,t)=>{t.pattern??=Vt(t),I.init(e,t)}),In=k(`$ZodISODate`,(e,t)=>{t.pattern??=Rt,I.init(e,t)}),Ln=k(`$ZodISOTime`,(e,t)=>{t.pattern??=Bt(t),I.init(e,t)}),Rn=k(`$ZodISODuration`,(e,t)=>{t.pattern??=St,I.init(e,t)}),zn=k(`$ZodIPv4`,(e,t)=>{t.pattern??=Ot,I.init(e,t)}),Bn=/^[0-9a-fA-F:.]+$/;function Vn(e){return Bn.test(e)?bn(`http://[${e}]`):!1}var Hn=k(`$ZodIPv6`,(e,t)=>{t.pattern??=kt,I.init(e,t),e._zod.check=n=>{Vn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Un=k(`$ZodCIDRv4`,(e,t)=>{t.pattern??=At,I.init(e,t)});function Wn(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Vn(n)}var Gn=k(`$ZodCIDRv6`,(e,t)=>{t.pattern??=jt,I.init(e,t),e._zod.check=n=>{Wn(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Kn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var qn=/^[0-9a-zA-Z+/]*={0,2}$/,Jn=k(`$ZodBase64`,(e,t)=>{t.pattern??=qn,I.init(e,t),e._zod.check=n=>{Kn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Yn=/^[A-Za-z0-9_-]*$/;function Xn(e){if(!Yn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Kn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Zn=k(`$ZodBase64URL`,(e,t)=>{t.pattern??=Yn,I.init(e,t),e._zod.check=n=>{Xn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Qn=k(`$ZodE164`,(e,t)=>{t.pattern??=Ft,I.init(e,t)});function $n(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var er=k(`$ZodJWT`,(e,t)=>{I.init(e,t),e._zod.check=n=>{$n(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),tr=k(`$ZodNumber`,(e,t)=>{F.init(e,t),e._zod.pattern=Wt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),nr=k(`$ZodNumberFormat`,(e,t)=>{Qt.init(e,t),tr.init(e,t)}),rr=k(`$ZodBoolean`,(e,t)=>{F.init(e,t),e._zod.pattern=Gt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ir=k(`$ZodUnknown`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),ar=k(`$ZodNever`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function or(e,t){let n=be(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of be(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,xe(n.issues,t,e),n}}return i(n,a)}}var sr=e=>Array.isArray(e)?e.length:-1;function cr(e,t,n){e.issues.length&&t.issues.push(...S(n,e.issues)),t.value[n]=e.value}var lr=k(`$ZodArray`,(e,t)=>{F.init(e,t);let n=j.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>cr(t,r,e)));else if(cr(c,r,e),s&&c.issues.length!==0&&x(c))break}return o.length?Promise.all(o).then(()=>r):r},or(e,sr)});function L(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...S(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var ur=[];function dr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ur,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ce(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function fr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(x(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>L(e,n,i,t,d,f))):L(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var pr=k(`$ZodObject`,(e,t)=>{F.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let a=i(()=>dr(t));O(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||c(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let o=g,s=t.catchall,l,u=j.memoizer;u?.attach(e),e._zod.parse=(t,n)=>{l??=a.value;let r=t.value;if(!o(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=u?u.alloc(e,t,{},n):{};let i=[],c=l.shape,d=n?.abortEarly,f=t.issues.length;for(let e of l.allKeys){if(d&&t.issues.length!==f){if(x(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let a=c[e],o=a._zod.optin,s=a._zod.optout,l=a._zod.run({value:r[e],issues:[]},n);l instanceof Promise?i.push(l.then(n=>L(n,t,e,r,o,s))):L(l,t,e,r,o,s)}return s?fr(i,r,t,n,a.value,e,d===!0):i.length?Promise.all(i).then(()=>t):t}}),mr=k(`$ZodObjectJIT`,(e,t)=>{pr.init(e,t);let n=e._zod.parse,r=i(()=>dr(t)),a=j.memoizer,o=t=>{let n=r.value,i=n.symbolKeys,o=new dn([`payload`,`ctx`],{shape:t,inst:e,memo:a,syms:i}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ let ${e}_ab = false;
5
+ for (let i = 0; i < ${e}.issues.length; i++) {
6
+ const iss = ${e}.issues[i];
7
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
+ payload.issues.push(iss);
9
+ if (iss.continue !== true) ${e}_ab = true;
10
+ }
11
+ if (${e}_ab && ctx && ctx.abortEarly) {
12
+ payload.value = newResult;
13
+ return payload;
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(a?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${i.indexOf(e)}]`:ee(e),a=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
+ const ${n}_present = ${a};
16
+ if (!${n}.issues.length || ${n}_present) {
17
+ if (${n}.issues.length) {${c(n,r)}
18
+ }
19
+
20
+ if (${e}) {
21
+ newResult[${r}] = ${n}.value;
22
+ }
23
+ }
24
+
25
+ `)}else f?(o.write(`
26
+ if (${n}.issues.length) {${c(n,r)}
27
+ }
28
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
+ if (${n}.value !== undefined || ${a}) {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+ `)):o.write(`
33
+ const ${n}_present = ${a};
34
+ if (${n}.issues.length) {${c(n,r)}
35
+ }
36
+ if (!${n}_present && !${n}.issues.length) {
37
+ payload.issues.push({
38
+ code: "invalid_type",
39
+ expected: "nonoptional",
40
+ input: undefined,
41
+ path: [${r}]
42
+ });
43
+ if (ctx && ctx.abortEarly) {
44
+ payload.value = newResult;
45
+ return payload;
46
+ }
47
+ }
48
+
49
+ if (${n}_present) {
50
+ newResult[${r}] = ${n}.value;
51
+ }
52
+
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},s,c=g,l=!j.jitless,u=l&&re.value,d=t.catchall,f;e._zod.parse=(i,a)=>{f??=r.value;let p=i.value;return c(p)?l&&u&&a?.async===!1&&a.jitless!==!0?(s||=o(t.shape),i=s(i,a),d?fr([],p,i,a,f,e,a?.abortEarly===!0):i):n(i,a):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function hr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!x(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>w(e,r,M())))}),t)}var gr=k(`$ZodUnion`,(e,t)=>{F.init(e,t),O(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),O(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),O(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),O(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>o(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>hr(t,r,e,i)):hr(o,r,e,i)}}),_r=k(`$ZodIntersection`,(e,t)=>{F.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>yr(e,t,n)):yr(e,i,a)}});function vr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_(e)&&_(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=vr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=vr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=vr(t.value,n.value);if(!c.valid){if(x(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var br=k(`$ZodRecord`,(e,t)=>{F.init(e,t);let n=j.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!_(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>w(e,i,M())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...S(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...S(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Wt.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>w(e,i,M())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...S(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...S(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),xr=k(`$ZodEnum`,(t,n)=>{F.init(t,n);let r=e(n.entries),i=new Set(r);t._zod.values=i,O(t,`pattern`,t=>{let n=e(t.def.entries).filter(e=>ae.has(typeof e));return RegExp(n.length?`^(${n.map(e=>oe(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),t._zod.parse=(e,n)=>{let a=e.value;return i.has(a)||e.issues.push({code:`invalid_value`,values:r,input:a,inst:t}),e}}),Sr=k(`$ZodTransform`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,j.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Be(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new A;return n.value=i,n}});function Cr(e,t){return e.value=t.issues.length?void 0:t.value,e}var wr=k(`$ZodOptional`,(e,t)=>{F.init(e,t),O(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,O(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),O(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Cr(e,t)):Cr(e,r)}return t.innerType._zod.run(e,n)}}),Tr=k(`$ZodExactOptional`,(e,t)=>{wr.init(e,t),O(e,`values`,e=>e.def.innerType._zod.values),O(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Er=k(`$ZodNullable`,(e,t)=>{F.init(e,t),O(e,`optin`,e=>e.def.innerType._zod.optin),O(e,`optout`,e=>e.def.innerType._zod.optout),O(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(t.source)}|null)$`):void 0}),O(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Dr=k(`$ZodDefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,O(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Or(e,t)):Or(r,t)}});function Or(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var kr=k(`$ZodPrefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,O(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ar=k(`$ZodNonOptional`,(e,t)=>{F.init(e,t),O(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>jr(t,e)):jr(i,e)}});function jr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Mr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>w(e,r,M()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Nr=k(`$ZodCatch`,(e,t)=>{F.init(e,t),O(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),O(e,`optout`,e=>e.def.innerType._zod.optout),O(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Mr(e,r,t,n)):Mr(e,r,t,n)}}),Pr=k(`$ZodPipe`,(e,t)=>{F.init(e,t),O(e,`values`,e=>e.def.in._zod.values),O(e,`optin`,e=>e.def.in._zod.optin),O(e,`optout`,e=>e.def.out._zod.optout),O(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>R(e,t.in,n)):R(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>R(e,t.out,n)):R(r,t.out,n)}});function R(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Fr=k(`$ZodReadonly`,(e,t)=>{F.init(e,t),O(e,`propValues`,e=>e.def.innerType._zod.propValues),O(e,`values`,e=>e.def.innerType._zod.values),O(e,`optin`,e=>e.def.innerType?._zod?.optin),O(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ir):Ir(r)}});function Ir(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Lr=k(`$ZodCustom`,(e,t)=>{N.init(e,t),F.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Rr(t,n,r,e));Rr(i,n,r,e)}});function Rr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(T(e))}}var zr=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Br=`~memo`,Vr=[];function Hr(e){return typeof e==`object`&&!!e}function Ur(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Wr=new WeakMap,z=0,Gr=1,B=2;function Kr(e,t,n){let r=Wr.get(e);if(r!==void 0)return r?B:z;if(t.has(e))return B;t.add(e);let i=z,a=e=>{if(i!==B&&e?._zod){let r=Kr(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=z;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Gr:o.value?._zod?Kr(o.value,t,n):z;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=l(c);s(e?o(e,!0):Gr),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Kr(r,t,!1):Gr);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),qr(e,i)}function qr(e,t){return t!==Gr&&Wr.set(e,t===B),t}function Jr(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Yr,Xr=[],Zr={alloc(e,t,n){let r=Yr;if(!r)return n;Yr=void 0;let i={value:n,issues:null};return r.set(t.value,i),Xr.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&$r(n,e.value))throw new zr;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Kr(e,new Set,!1);if(i===z)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===B||r?n=!0:r=!0}let l=s.value;if(!Hr(l))return t(s,c);let u=c[Br];u||(u={buckets:new WeakMap,backEdges:void 0},c[Br]=u);let d;i===c?d=a:(d=Jr(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Ur(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Yr=d;let p=Xr.length,m=t(s,c);Yr=void 0;let h=Xr.length>p?Xr.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Ur(e.issues):Vr),e)):(h&&(h.issues=m.issues.length?Ur(m.issues):Vr),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Qr(){return Zr}function $r(e,t){let n=e[Br]?.backEdges;return n!==void 0&&Hr(t)&&n.has(t)}var ei=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function n(t){return e[t]??null}let r={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},i={nan:`NaN`};function a(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):i[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${a(e.expected)}, received ${a(Te(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${se(e.values[0])}`:`Invalid option: expected one of ${t(e.values,`|`)}`;case`too_big`:{let t=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=n(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${t}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${t}${e.maximum.toString()}`}case`too_small`:{let t=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=n(e.origin);return r?`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${t(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function ti(){return{localeError:ei()}}var ni,ri=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ii(){return new ri}(ni=globalThis).__zod_globalRegistry??(ni.__zod_globalRegistry=ii());var V=globalThis.__zod_globalRegistry;function ai(e){return e.checks&&=[...e.checks],e}function oi(e,t){return new e(ai({type:`string`,...y(t)}))}function si(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...y(t)})}function ci(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...y(t)})}function li(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...y(t)})}function ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...y(t)})}function di(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...y(t)})}function fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...y(t)})}function pi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...y(t)})}function mi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...y(t)})}function hi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...y(t)})}function gi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...y(t)})}function _i(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...y(t)})}function vi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...y(t)})}function yi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...y(t)})}function bi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...y(t)})}function xi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...y(t)})}function Si(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...y(t)})}function Ci(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...y(t)})}function wi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...y(t)})}function Ti(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...y(t)})}function Ei(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...y(t)})}function Di(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...y(t)})}function Oi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...y(t)})}function ki(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...y(t)})}function Ai(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...y(t)})}function ji(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...y(t)})}function Mi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...y(t)})}function Ni(e,t){return new e(ai({type:`number`,checks:[],...y(t)}))}function Pi(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...y(t)})}function Fi(e,t){return new e({type:`boolean`,...y(t)})}function Ii(e){return new e({type:`unknown`})}function Li(e,t){return new e({type:`never`,...y(t)})}function Ri(e,t){return new Yt({check:`less_than`,...y(t),value:e,inclusive:!1})}function zi(e,t){return new Yt({check:`less_than`,...y(t),value:e,inclusive:!0})}function Bi(e,t){return new Xt({check:`greater_than`,...y(t),value:e,inclusive:!1})}function Vi(e,t){return new Xt({check:`greater_than`,...y(t),value:e,inclusive:!0})}function Hi(e,t){return new Zt({check:`multiple_of`,...y(t),value:e})}function Ui(e,t){return new $t({check:`max_length`,...y(t),maximum:e})}function Wi(e,t){return new en({check:`min_length`,...y(t),minimum:e})}function Gi(e,t){return new tn({check:`length_equals`,...y(t),length:e})}function Ki(e,t){return new rn({check:`string_format`,format:`regex`,...y(t),pattern:e})}function qi(e){return new an({check:`string_format`,format:`lowercase`,...y(e)})}function Ji(e){return new on({check:`string_format`,format:`uppercase`,...y(e)})}function Yi(e,t){return new sn({check:`string_format`,format:`includes`,...y(t),includes:e})}function Xi(e,t){return new cn({check:`string_format`,format:`starts_with`,...y(t),prefix:e})}function Zi(e,t){return new ln({check:`string_format`,format:`ends_with`,...y(t),suffix:e})}function H(e){return new un({check:`overwrite`,tx:e})}function Qi(e){return H(t=>t.normalize(e))}function $i(){return H(e=>e.trim())}function ea(){return H(e=>e.toLowerCase())}function ta(){return H(e=>e.toUpperCase())}function na(){return H(e=>te(e))}function ra(e,t,n){return new e({type:`array`,element:t,...y(n)})}function ia(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...y(n)})}function aa(e,t){let n=oa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(T(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(T(r))}},e(t.value,t)),t);return n}function oa(e,t){let n=new N({check:`custom`,...y(t)});return n._zod.check=e,n}function U(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&c(e,t,n[t]);return e}function sa(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??V,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function W(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function G(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,G(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&U(o.schema,c),t.io===`input`&&K(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ca(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function la(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${ca(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+ca(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
+
55
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function ua(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;ua(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var da=new Set([`type`,`properties`,`required`,`additionalProperties`]),fa=[`oneOf`,`anyOf`];function pa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ma(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!da.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??pa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}c(n,r,e.length===1?e[0]:ma(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=pa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function ha(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of da)if(t in e)return;let n=t.filter(e=>fa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ma(t);else{let e=n[0],i=fa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ma([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,U(e,r))}function ga(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):U(i,s),U(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())ua(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])ha(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}U(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,c(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:va(t,`input`,e.processors),output:va(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function K(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return K(r.element,n);if(r.type===`set`)return K(r.valueType,n);if(r.type===`lazy`)return K(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return K(r.innerType,n);if(r.type===`intersection`)return K(r.left,n)||K(r.right,n);if(r.type===`record`||r.type===`map`)return K(r.keyType,n)||K(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:K(r.in,n)||K(r.out,n);if(r.type===`object`){for(let e in r.shape)if(K(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(K(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(K(e,n))return!0;return!!(r.rest&&K(r.rest,n))}return!1}var _a=(e,t={})=>n=>{let r=sa({...n,processors:t});return G(e,r),la(r,e),ga(r,e)},va=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=sa({...i??{},target:a,io:t,processors:n});return G(e,o),la(o,e),ga(o,e)},q=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},J=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ya=(e,t)=>{q(e,`minimum`,t),J(e,`maximum`,t)},ba=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},xa=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Sa=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Ca=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},wa=(e,t)=>q(e,`minimum`,t.minimum),Ta=(e,t)=>J(e,`maximum`,t.maximum),Ea=e=>(t,n)=>{Ca(t,n.format);let[r,i]=e[n.format];q(t,`minimum`,r),J(t,`maximum`,i)},Da={greater_than:(e,t)=>q(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>J(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>ba(e,t.value),number_format:Ea(le),bigint_format:Ea(ue),min_length:wa,max_length:Ta,length_equals:(e,t)=>ya(e,t.length),min_size:wa,max_size:Ta,size_equals:(e,t)=>ya(e,t.size),string_format:(e,t)=>{Ca(e,t.format),t.pattern&&xa(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Sa(e,t.mime)};function Y(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Da[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&q(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&q(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&J(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&J(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&ba(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Sa(t,i.mime);for(let e of i.patterns??[])xa(t,e);return t}var Oa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ka=new Map([[qn,Mt],[Yn,Nt]]),Aa=e=>ka.get(e)??e,ja=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Y(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Oa[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Aa);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ma=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Y(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):W(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Na=(e,t,n,r)=>{n.type=`boolean`},Pa=(e,t,n,r)=>{n.not={}},Fa=(t,n,r,i)=>{let a=t._zod.def,o=e(a.entries);o.length===0?r.not={}:(o.every(e=>typeof e==`number`)&&(r.type=`number`),o.every(e=>typeof e==`string`)&&(r.type=`string`),r.enum=o)},Ia=(e,t,n,r)=>{W(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},La=(e,t,n,r)=>{W(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ra=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Y(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=G(a.element,t,{...r,path:[...r.path,`items`]})};function za(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?za(t.out):t.type===`catch`?za(t.innerType):e._zod.optin}var Ba=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&W(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)c(i.properties,e,G(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?za(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=G(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Va=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>G(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ha=(e,t,n,r)=>{let i=e._zod.def,a=G(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=G(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Ua(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Ua(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Ua(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Wt:Ut).source)),p}var Wa=new WeakMap;function Ga(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Wa.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Ua(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Ka=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Y(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=G(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)c(i.patternProperties,Aa(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=G(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Wa.get(t);n||(n=[],Wa.set(t,n),t.deferred.push(()=>Ga(t))),n.push(e)}i.additionalProperties=G(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let l=o._zod.values,u=t.io===`input`&&za(a.valueType)!==void 0;if(l&&!a.partial&&!u){let e=[...l].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},qa=(e,t,n,r)=>{let i=e._zod.def,a=G(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ja=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ya=Symbol();function Xa(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(W(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ya):JSON.parse(o)}var Za=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Xa(i.defaultValue,e,t,n,r);o!==Ya&&(n.default=o)},Qa=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Xa(i.defaultValue,e,t,n,r);o!==Ya&&(n._prefault=o)},$a=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{W(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},eo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;G(o,t,r);let s=t.seen.get(e);s.ref=o},to=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},no=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ro=new WeakSet([Object.prototype,Error.prototype]);function io(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var X=k(`ZodError`,(e,t)=>{Ke.init(e,t),e.name=`ZodError`;let r=Object.getPrototypeOf(e);ro.has(r)||(ro.add(r),io(r,`format`,e=>t=>Ye(e,t)),io(r,`flatten`,e=>t=>Je(e,t)),io(r,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,n,2)}),io(r,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,n,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ao=Ze(X),oo=Qe(X),so=$e(X),co=tt(X),lo=st(X),uo=ct(X),fo=lt(X),po=ut(X),mo=dt(X),ho=ft(X),go=pt(X),_o=mt(X);function vo(){j.localeError||M(ti())}function Z(){j.memoizer||M({memoizer:Qr()})}var Q=k(`ZodType`,(e,t)=>(vo(),F.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(h(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return v(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ps(e,t))},superRefine(e,t){return this.check(Fs(e,t))},overwrite(e){return this.check(H(e))},optional(){return gs(this)},exactOptional(){return vs(this)},nullable(){return bs(this)},nullish(){return gs(bs(this))},nonoptional(e){return Es(this,e)},array(){return ns(this)},or(e){return os([this,e])},and(e){return cs(this,e)},transform(e){return As(this,ms(e))},default(e){return Ss(this,e)},prefault(e){return ws(this,e)},catch(e){return Os(this,e)},pipe(e){return As(this,e)},readonly(){return Ms(this)},describe(e){let t=this.clone();return V.add(t,{description:e}),t},meta(...e){if(e.length===0)return V.get(this);let t=this.clone();return V.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return De(this,`~standard`,{...hn(this),jsonSchema:{input:va(this,`input`),output:va(this,`output`)}})},set"~standard"(e){E(this,`~standard`,e)},parse:function e(t,n){return ao(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await oo(this,t,n,{callee:e})},safeParse(e,t){return so(this,e,t)},async safeParseAsync(e,t){return co(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){E(this,`spa`,e)},validate(e,t){return it(this,e,t)},validateAsync(e,t){return ot(this,e,t)},encode:function e(t,n){return lo(this,t,n,{callee:e})},decode:function e(t,n){return uo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await fo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await po(this,t,n,{callee:e})},safeEncode(e,t){return mo(this,e,t)},safeDecode(e,t){return ho(this,e,t)},async safeEncodeAsync(e,t){return go(this,e,t)},async safeDecodeAsync(e,t){return _o(this,e,t)},toJSONSchema(e){return _a(this,{})(e)},get description(){return V.get(this)?.description},get _def(){return this._zod.def}}),yo=k(`_ZodString`,(e,t)=>{gn.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r)},Oe({format:e=>Y(e).format??null,minLength:e=>Y(e).minimum??null,maxLength:e=>Y(e).maximum??null},{regex(...e){return this.check(Ki(...e))},includes(...e){return this.check(Yi(...e))},startsWith(...e){return this.check(Xi(...e))},endsWith(...e){return this.check(Zi(...e))},min(...e){return this.check(Wi(...e))},max(...e){return this.check(Ui(...e))},length(...e){return this.check(Gi(...e))},nonempty(...e){return this.check(Wi(1,...e))},lowercase(e){return this.check(qi(e))},uppercase(e){return this.check(Ji(e))},trim(){return this.check($i())},normalize(...e){return this.check(Qi(...e))},toLowerCase(){return this.check(ea())},toUpperCase(){return this.check(ta())},slugify(){return this.check(na())}})),bo=k(`ZodString`,(e,t)=>{gn.init(e,t),yo.init(e,t)},{email(e){return this.check(si(Eo,e))},url(e){return this.check(pi(ko,e))},jwt(e){return this.check(Oi(Wo,e))},emoji(e){return this.check(mi(Ao,e))},guid(e){return this.check(ci(Do,e))},uuid(e){return this.check(li(Oo,e))},uuidv4(e){return this.check(ui(Oo,e))},uuidv6(e){return this.check(di(Oo,e))},uuidv7(e){return this.check(fi(Oo,e))},nanoid(e){return this.check(hi(jo,e))},cuid(e){return this.check(gi(Mo,e))},cuid2(e){return this.check(_i(No,e))},ulid(e){return this.check(vi(Po,e))},base64(e){return this.check(Ti(Vo,e))},base64url(e){return this.check(Ei(Ho,e))},xid(e){return this.check(yi(Fo,e))},ksuid(e){return this.check(bi(Io,e))},ipv4(e){return this.check(xi(Lo,e))},ipv6(e){return this.check(Si(Ro,e))},cidrv4(e){return this.check(Ci(zo,e))},cidrv6(e){return this.check(wi(Bo,e))},e164(e){return this.check(Di(Uo,e))},datetime(e){return this.check(ki(So,e))},date(e){return this.check(Ai(Co,e))},time(e){return this.check(ji(wo,e))},duration(e){return this.check(Mi(To,e))}});function xo(e){return oi(bo,e)}var $=k(`ZodStringFormat`,(e,t)=>{I.init(e,t),yo.init(e,t)}),So=k(`ZodISODateTime`,(e,t)=>{Fn.init(e,t),$.init(e,t)}),Co=k(`ZodISODate`,(e,t)=>{In.init(e,t),$.init(e,t)}),wo=k(`ZodISOTime`,(e,t)=>{Ln.init(e,t),$.init(e,t)}),To=k(`ZodISODuration`,(e,t)=>{Rn.init(e,t),$.init(e,t)}),Eo=k(`ZodEmail`,(e,t)=>{yn.init(e,t),$.init(e,t)}),Do=k(`ZodGUID`,(e,t)=>{_n.init(e,t),$.init(e,t)}),Oo=k(`ZodUUID`,(e,t)=>{vn.init(e,t),$.init(e,t)}),ko=k(`ZodURL`,(e,t)=>{Dn.init(e,t),$.init(e,t)}),Ao=k(`ZodEmoji`,(e,t)=>{On.init(e,t),$.init(e,t)}),jo=k(`ZodNanoID`,(e,t)=>{kn.init(e,t),$.init(e,t)}),Mo=k(`ZodCUID`,(e,t)=>{An.init(e,t),$.init(e,t)}),No=k(`ZodCUID2`,(e,t)=>{jn.init(e,t),$.init(e,t)}),Po=k(`ZodULID`,(e,t)=>{Mn.init(e,t),$.init(e,t)}),Fo=k(`ZodXID`,(e,t)=>{Nn.init(e,t),$.init(e,t)}),Io=k(`ZodKSUID`,(e,t)=>{Pn.init(e,t),$.init(e,t)}),Lo=k(`ZodIPv4`,(e,t)=>{zn.init(e,t),$.init(e,t)}),Ro=k(`ZodIPv6`,(e,t)=>{Hn.init(e,t),$.init(e,t)}),zo=k(`ZodCIDRv4`,(e,t)=>{Un.init(e,t),$.init(e,t)}),Bo=k(`ZodCIDRv6`,(e,t)=>{Gn.init(e,t),$.init(e,t)}),Vo=k(`ZodBase64`,(e,t)=>{Jn.init(e,t),$.init(e,t)}),Ho=k(`ZodBase64URL`,(e,t)=>{Zn.init(e,t),$.init(e,t)}),Uo=k(`ZodE164`,(e,t)=>{Qn.init(e,t),$.init(e,t)}),Wo=k(`ZodJWT`,(e,t)=>{er.init(e,t),$.init(e,t)}),Go=k(`ZodNumber`,(e,t)=>{tr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.isFinite=!0},Oe({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Y(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Y(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Y(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Y(e).format??null},{gt(e,t){return this.check(Bi(e,t))},gte(e,t){return this.check(Vi(e,t))},min(e,t){return this.check(Vi(e,t))},lt(e,t){return this.check(Ri(e,t))},lte(e,t){return this.check(zi(e,t))},max(e,t){return this.check(zi(e,t))},int(e){return this.check(Jo(e))},safe(e){return this.check(Jo(e))},positive(e){return this.check(Bi(0,e))},nonnegative(e){return this.check(Vi(0,e))},negative(e){return this.check(Ri(0,e))},nonpositive(e){return this.check(zi(0,e))},multipleOf(e,t){return this.check(Hi(e,t))},step(e,t){return this.check(Hi(e,t))},finite(){return this}}));function Ko(e){return Ni(Go,e)}var qo=k(`ZodNumberFormat`,(e,t)=>{nr.init(e,t),Go.init(e,t)});function Jo(e){return Pi(qo,e)}var Yo=k(`ZodBoolean`,(e,t)=>{rr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r)});function Xo(e){return Fi(Yo,e)}var Zo=k(`ZodUnknown`,(e,t)=>{ir.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Qo(){return Ii(Zo)}var $o=k(`ZodNever`,(e,t)=>{ar.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r)});function es(e){return Li($o,e)}var ts=k(`ZodArray`,(e,t)=>{Z(),lr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Wi(e,t))},nonempty(e){return this.check(Wi(1,e))},max(e,t){return this.check(Ui(e,t))},length(e,t){return this.check(Gi(e,t))},unwrap(){return this.element}});function ns(e,t){return ra(ts,e,t)}var rs=k(`ZodObject`,(e,t)=>{Z(),mr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(e,t,n,r),Ne(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return fs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(h(this._zod.def,{catchall:e}))},passthrough(){return this.clone(h(this._zod.def,{catchall:Qo()}))},loose(){return this.clone(h(this._zod.def,{catchall:Qo()}))},strict(){return this.clone(h(this._zod.def,{catchall:es()}))},strip(){return this.clone(h(this._zod.def,{catchall:void 0}))},extend(e){return pe(this,e)},safeExtend(e){return he(this,e)},merge(e){return ge(this,e)},pick(e){return de(this,e)},omit(e){return fe(this,e)},partial(...e){return _e(hs,this,e[0])},exactPartial(...e){return _e(_s,this,e[0],`exactPartial`)},required(...e){return ve(Ts,this,e[0])}});function is(e,t){return new rs({type:`object`,shape:e??{},...y(t)})}var as=k(`ZodUnion`,(e,t)=>{gr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r),e.options=t.options});function os(e,t){return new as({type:`union`,options:e,...y(t)})}var ss=k(`ZodIntersection`,(e,t)=>{_r.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r)});function cs(e,t){return new ss({type:`intersection`,left:e,right:t})}var ls=k(`ZodRecord`,(e,t)=>{Z(),br.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function us(e,t,n){return!t||!t._zod?new ls({type:`record`,keyType:xo(),valueType:e,...y(t)}):new ls({type:`record`,keyType:e,valueType:t,...y(n)})}var ds=k(`ZodEnum`,(e,t)=>{xr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ds({...t,checks:[],...y(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ds({...t,checks:[],...y(r),entries:i})}});function fs(e,t){return new ds({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...y(t)})}var ps=k(`ZodTransform`,(e,t)=>{Z(),Sr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Be(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(T(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(T(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ms(e){return new ps({type:`transform`,transform:e})}var hs=k(`ZodOptional`,(e,t)=>{wr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new hs({type:`optional`,innerType:e})}var _s=k(`ZodExactOptional`,(e,t)=>{Tr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vs(e){return new _s({type:`optional`,innerType:e})}var ys=k(`ZodNullable`,(e,t)=>{Er.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bs(e){return new ys({type:`nullable`,innerType:e})}var xs=k(`ZodDefault`,(e,t)=>{Dr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ss(e,t){return new xs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var Cs=k(`ZodPrefault`,(e,t)=>{kr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ws(e,t){return new Cs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var Ts=k(`ZodNonOptional`,(e,t)=>{Ar.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Es(e,t){return new Ts({type:`nonoptional`,innerType:e,...y(t)})}var Ds=k(`ZodCatch`,(e,t)=>{Nr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Os(e,t){return new Ds({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Fe(t)})}var ks=k(`ZodPipe`,(e,t)=>{Pr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.in=t.in,e.out=t.out});function As(e,t){return new ks({type:`pipe`,in:e,out:t})}var js=k(`ZodReadonly`,(e,t)=>{Fr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ms(e){return new js({type:`readonly`,innerType:e})}var Ns=k(`ZodCustom`,(e,t)=>{Lr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r)});function Ps(e,t={}){return ia(Ns,e,t)}function Fs(e,t){return aa(e,t)}export{is as a,Ko as i,ns as n,us as o,Xo as r,xo as s,fs as t};
@@ -0,0 +1 @@
1
+ import{N as e,a as t}from"./cn-DMYzmXtt.js";var n=(e,t)=>e===`pending`?`loading`:e===`error`?`failed`:t?`empty`:`ready`,r=e(),i=({status:e,children:n})=>{let{t:i}=t();return e===`ready`?n:(0,r.jsx)(`p`,{role:`status`,className:`grid min-h-40 place-items-center text-sm text-ink-2`,children:i(`boundary.${e}`)})};export{n,i as t};
@@ -0,0 +1 @@
1
+ import{N as e,r as t}from"./cn-DMYzmXtt.js";import{t as n}from"./dist-CnPFbxes.js";var r=e(),i={ok:`tick`,warn:`finding`,failed:`close`},a=13,o=2.4,s=n(`inline-flex h-7 items-center gap-1.5 rounded-full text-[12.5px] font-medium`,{variants:{status:{ok:`text-ok`,warn:`text-warn`,failed:`text-failed`},isLabelHidden:{true:`w-7 justify-center`,false:`px-2.5`}},compoundVariants:[{status:`ok`,isLabelHidden:!1,className:`bg-ok-soft`},{status:`warn`,isLabelHidden:!1,className:`bg-warn-soft`},{status:`failed`,isLabelHidden:!1,className:`bg-failed-soft`}]}),c=({status:e,label:n,isLabelHidden:c=!1})=>{let l=c?`sr-only`:void 0;return(0,r.jsxs)(`span`,{className:s({status:e,isLabelHidden:c}),children:[(0,r.jsx)(t,{name:i[e],size:a,strokeWidth:o}),(0,r.jsx)(`span`,{className:l,children:n})]})};export{c as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{N as t,P as n,a as r,d as i}from"./cn-DMYzmXtt.js";import{t as a}from"./runs-queries-BYBE7R9S.js";import{_ as o,u as s,x as c}from"./dist-CnPFbxes.js";import{t as l}from"./status-chip-yqTTTuyZ.js";import{a as u,n as d,r as f}from"./device-status-logic-Silf3YXA.js";var p=e(n(),1),m=e=>(0,p.useSyncExternalStore)(c,()=>o(e)),h=e=>(0,p.useSyncExternalStore)(c,()=>s(e)),g=e=>e===`chromium`,_=e=>{let t=[...e].sort((e,t)=>t.startedAt-e.startedAt).at(0);return t==null?[]:t.steps},v=()=>_(i(a.list()).data??[]),y=e=>e===`chromium`?`live`:`perStep`,b=(e,t)=>t.flatMap(e=>e.deviceAnswers).filter(d).filter(t=>t.deviceId===e).map(e=>({kind:`answer`,message:e.message})),x=(e,t)=>{let n=f(e,t);return[...new Set(n.map(e=>e.kind))].map(e=>({kind:`finding`,findingKind:e,findingCount:n.filter(t=>t.kind===e).length}))},S=(e,t)=>{let n=b(e,t),r=x(e,t);return[...n,...r]},C=t(),w=({deviceId:e,isLabelHidden:t=!1})=>{let{t:n}=r(),i=v(),a=u(e,i);if(a===null)return null;let o=S(e,i).map(e=>e.kind===`answer`?e.message:n(`tile.reasons.${e.findingKind}`,{count:e.findingCount})),s=o.length>0,c=o.join(`, `),d=n(`tile.status.${a}`),f=s?`${d}: ${c}`:d;return(0,C.jsx)(`span`,{title:s?c:void 0,tabIndex:s?0:void 0,className:`inline-flex rounded-full focus-visible:outline-2`,children:(0,C.jsx)(l,{status:a,label:f,isLabelHidden:t})})};export{h as a,g as i,y as n,m as o,v as r,w as t};
@@ -0,0 +1 @@
1
+ import{N as e}from"./cn-DMYzmXtt.js";var t=e(),n=e=>(0,t.jsx)(`input`,{type:`checkbox`,className:`relative h-6 w-10 flex-none cursor-pointer appearance-none rounded-full bg-line transition-colors duration-200 before:absolute before:start-0.5 before:top-0.5 before:size-5 before:rounded-full before:bg-card before:transition-[translate] before:duration-200 checked:bg-cobalt checked:before:translate-x-4`,...e});export{n as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{P as t,i as n}from"./cn-DMYzmXtt.js";import{n as r}from"./button-N-Nucq_K.js";import{c as i,h as a,x as o}from"./dist-CnPFbxes.js";var s=e(t(),1),c=()=>(0,s.useSyncExternalStore)(o,i),l=async e=>{let t=await n.api.commands.$post({json:{commandName:`open`,url:e,deviceIds:null}});if(!t.ok)throw Error(`The hub refused the open command: ${t.status}`);let r=await t.json();if(r.status===`failed`)throw Error(r.line);return r},u=()=>r({mutationFn:l}),d=(e,t)=>{let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>e.name.toLowerCase().includes(n))},f=e=>{let{key:t,metaKey:n,ctrlKey:r}=e;return t.toLowerCase()===`k`&&(n||r)},p=e=>/Mac|iPhone|iPad/.test(e)?`shell.searchShortcutMac`:`shell.searchShortcutOther`,m=``,h=new Set,g=()=>m,_=e=>(h.add(e),()=>{h.delete(e)}),v=e=>{m=e;for(let e of h)e()},y=()=>({searchQuery:(0,s.useSyncExternalStore)(_,g),changeSearchQuery:v}),b=()=>(0,s.useSyncExternalStore)(o,a);export{p as a,d as i,y as n,u as o,f as r,c as s,b as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{P as t}from"./cn-DMYzmXtt.js";import{h as n}from"./runs-queries-BYBE7R9S.js";var r=e(t(),1);function i(e){let t=n();return r.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}export{i as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./rolldown-runtime-WkwZ5CU-.js";import{P as n,l as r}from"./cn-DMYzmXtt.js";import{A as i,D as a,h as o,m as s,p as c}from"./runs-queries-BYBE7R9S.js";var l=t((e=>{var t=n(),i=r();function a(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var o=typeof Object.is==`function`?Object.is:a,s=i.useSyncExternalStore,c=t.useRef,l=t.useEffect,u=t.useMemo,d=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p}})),u=t(((e,t)=>{t.exports=l()})),d=e(n(),1),f=u();function p(e,t){return e===t}function m(e,t=e=>e,n){let r=n?.compare??p,i=(0,d.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,d.useCallback)(()=>e.get(),[e]);return(0,f.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var h={};function g(e,t){let n=d.useRef();return r=>{let a=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=i(n.current,a):a}}function _(e){let t=o(),n=d.useContext(e.from?c:s),r=e.from??n,i=t.stores.getMatchStore(r),l=g(e,t),u=m(i,e=>e?l(e):h);if(u!==h)return u;(e.shouldThrow??!0)&&a()}function v(e){return _({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}export{m as i,_ as n,g as r,v as t};