apitestcenter 0.19.0 → 0.20.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 (76) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +1 -1
  3. package/dist/THIRD-PARTY-NOTICES-UI.txt +1 -1
  4. package/dist/THIRD-PARTY-NOTICES.txt +1 -1
  5. package/dist/cli.mjs +794 -552
  6. package/dist/ui/404/index.html +1 -1
  7. package/dist/ui/404.html +1 -1
  8. package/dist/ui/__next.__PAGE__.txt +9 -9
  9. package/dist/ui/__next._full.txt +9 -9
  10. package/dist/ui/__next._tree.txt +2 -2
  11. package/dist/ui/_next/static/chunks/06kdixojb32u6.js +27 -0
  12. package/dist/ui/_next/static/chunks/0a2q6cpe_c4k-.js +3 -0
  13. package/dist/ui/_next/static/chunks/1r8qtltx9mmfv.js +2 -0
  14. package/dist/ui/_next/static/chunks/1v2mgl5t1qg1g.js +50 -0
  15. package/dist/ui/_next/static/chunks/1y7u7u9moxxxk.js +1 -0
  16. package/dist/ui/_next/static/chunks/2db3njpc0xw6w.js +1 -0
  17. package/dist/ui/_next/static/chunks/2gs5hczs3bpq_.css +3 -0
  18. package/dist/ui/_next/static/chunks/{20hgurwocz54g.js → 2pqt6mieje__r.js} +2 -2
  19. package/dist/ui/_next/static/chunks/3ooomvul846zs.js +3 -0
  20. package/dist/ui/_next/static/chunks/3rptf3gr286c3.js +1056 -0
  21. package/dist/ui/_next/static/chunks/{2at40-h3piqdk.js → 3yvd9c8pue6u7.js} +5 -5
  22. package/dist/ui/_not-found/__next._full.txt +5 -5
  23. package/dist/ui/_not-found/__next._not-found.__PAGE__.txt +5 -5
  24. package/dist/ui/_not-found/__next._tree.txt +2 -2
  25. package/dist/ui/_not-found/index.html +1 -1
  26. package/dist/ui/_not-found/index.txt +5 -5
  27. package/dist/ui/compare/__next._full.txt +8 -8
  28. package/dist/ui/compare/__next._tree.txt +2 -2
  29. package/dist/ui/compare/__next.compare.__PAGE__.txt +8 -8
  30. package/dist/ui/compare/index.html +1 -1
  31. package/dist/ui/compare/index.txt +8 -8
  32. package/dist/ui/connections/__next._full.txt +7 -7
  33. package/dist/ui/connections/__next._tree.txt +2 -2
  34. package/dist/ui/connections/__next.connections.__PAGE__.txt +7 -7
  35. package/dist/ui/connections/index.html +2 -2
  36. package/dist/ui/connections/index.txt +7 -7
  37. package/dist/ui/history/__next._full.txt +25 -24
  38. package/dist/ui/history/__next._tree.txt +2 -2
  39. package/dist/ui/history/__next.history.__PAGE__.txt +26 -25
  40. package/dist/ui/history/index.html +1 -1
  41. package/dist/ui/history/index.txt +25 -24
  42. package/dist/ui/home/__next._full.txt +8 -8
  43. package/dist/ui/home/__next._tree.txt +2 -2
  44. package/dist/ui/home/__next.home.__PAGE__.txt +8 -8
  45. package/dist/ui/home/index.html +1 -1
  46. package/dist/ui/home/index.txt +8 -8
  47. package/dist/ui/index.html +1 -1
  48. package/dist/ui/index.txt +9 -9
  49. package/dist/ui/preview/__next._full.txt +8 -8
  50. package/dist/ui/preview/__next._tree.txt +2 -2
  51. package/dist/ui/preview/__next.preview.__PAGE__.txt +8 -8
  52. package/dist/ui/preview/index.html +1 -1
  53. package/dist/ui/preview/index.txt +8 -8
  54. package/dist/ui/suite/__next._full.txt +7 -7
  55. package/dist/ui/suite/__next._tree.txt +2 -2
  56. package/dist/ui/suite/__next.suite.__PAGE__.txt +7 -7
  57. package/dist/ui/suite/index.html +1 -1
  58. package/dist/ui/suite/index.txt +7 -7
  59. package/dist/ui/tests/__next._full.txt +5 -5
  60. package/dist/ui/tests/__next._tree.txt +2 -2
  61. package/dist/ui/tests/__next.tests.__PAGE__.txt +5 -5
  62. package/dist/ui/tests/index.html +1 -1
  63. package/dist/ui/tests/index.txt +5 -5
  64. package/package.json +2 -2
  65. package/dist/ui/_next/static/chunks/0jksxb6220hcg.js +0 -4
  66. package/dist/ui/_next/static/chunks/26cw_brv1ud3e.js +0 -27
  67. package/dist/ui/_next/static/chunks/2d4j4s35zfogt.js +0 -3
  68. package/dist/ui/_next/static/chunks/2eitm7108zqkh.js +0 -50
  69. package/dist/ui/_next/static/chunks/2ihpgl_z3eude.js +0 -907
  70. package/dist/ui/_next/static/chunks/2lr6d098vgexb.js +0 -1
  71. package/dist/ui/_next/static/chunks/2qci5ienr5rb9.css +0 -3
  72. package/dist/ui/_next/static/chunks/3ixmudnloab4j.js +0 -50
  73. package/dist/ui/_next/static/chunks/3rshqqryni7gb.js +0 -2
  74. /package/dist/ui/_next/static/{P0KsXFffpHNOo_vW1PSSr → XNta4K_1tCu7sU6jlccSS}/_buildManifest.js +0 -0
  75. /package/dist/ui/_next/static/{P0KsXFffpHNOo_vW1PSSr → XNta4K_1tCu7sU6jlccSS}/_clientMiddlewareManifest.js +0 -0
  76. /package/dist/ui/_next/static/{P0KsXFffpHNOo_vW1PSSr → XNta4K_1tCu7sU6jlccSS}/_ssgManifest.js +0 -0
@@ -0,0 +1,2 @@
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63343,44794,90972,45480,87078,35559,12580,90446,e=>{var t=e.i(51487);e.i(24856);var s=e.i(59100),n=e.i(30340),a=e.i(2810),r=e.i(62620),l=e.i(77306),i=e.i(22543),o=e.i(31753),c=e.i(28867);e.i(42674);var d=e.i(5305);function u({label:e,value:s,min:n,max:a,onChange:r,hint:l}){return(0,t.jsxs)("label",{className:"block",children:[(0,t.jsxs)("span",{className:"mb-1 flex items-center gap-1 text-xs text-mute",children:[e,l?(0,t.jsx)(i.f,{label:`About ${e}`,text:l}):null]}),(0,t.jsx)("input",{type:"number",min:n,max:a,value:s,onChange:e=>r(x(e.target.value,n,a)),className:"input font-mono"})]})}function m({stages:e,unit:s,rate:n,onChange:l}){let i=(t,s)=>l(e.map((e,n)=>n===t?{...e,...s}:e));return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-xs text-mute",children:"Each stage moves linearly to its target over its duration. Hold steady by repeating the same target."}),(0,t.jsxs)("div",{className:"overflow-hidden rounded-md border border-line",children:[(0,t.jsxs)("div",{className:"grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2rem] bg-panel-2 text-xs text-mute",children:[(0,t.jsx)("span",{className:"px-2 py-1.5",children:"#"}),(0,t.jsx)("span",{className:"border-l border-line px-2 py-1.5",children:"Duration"}),(0,t.jsxs)("span",{className:"border-l border-line px-2 py-1.5",children:["Target (",s,")"]}),(0,t.jsx)("span",{})]}),e.map((s,a)=>{let o=(0,d.R)(s.duration,!1);return(0,t.jsxs)("div",{className:"grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2rem] border-t border-line",children:[(0,t.jsx)("span",{className:"px-2 py-1.5 font-mono text-xs text-mute",children:a+1}),(0,t.jsx)("input",{"aria-label":`Stage ${a+1} duration`,"aria-invalid":!!o||void 0,title:o,value:s.duration,onChange:e=>i(a,{duration:e.target.value}),className:`min-w-0 border-l border-line bg-transparent px-2 py-1.5 font-mono text-[13px] outline-none focus:bg-panel-2 ${o?"text-bad":"text-ink"}`}),(0,t.jsx)("input",{"aria-label":`Stage ${a+1} target`,type:"number",min:0,max:n?1e5:500,value:s.target,onChange:e=>i(a,{target:x(e.target.value,0,n?1e5:500)}),className:"min-w-0 border-l border-line bg-transparent px-2 py-1.5 font-mono text-[13px] text-ink outline-none focus:bg-panel-2"}),(0,t.jsx)("button",{type:"button","aria-label":`Remove stage ${a+1}`,disabled:e.length<=1,onClick:()=>l(e.filter((e,t)=>t!==a)),className:"grid place-items-center text-mute hover:text-bad disabled:opacity-30",children:(0,t.jsx)(r.X,{size:13})})]},a)})]}),(0,t.jsxs)("button",{type:"button",disabled:e.length>=20,onClick:()=>l([...e,{duration:"30s",target:e[e.length-1]?.target??1}]),className:"inline-flex items-center gap-1 text-xs text-accent hover:underline disabled:opacity-40",children:[(0,t.jsx)(a.f,{size:12,"aria-hidden":!0})," Add stage"]})]})}function x(e,t,s){let n=Math.round(Number(e));return Number.isFinite(n)?Math.min(s,Math.max(t,n)):t}function h(e){let t="rate"===e.mode;if(e.stages&&e.stages.length){let t=[[0,0]],n=0;for(let a of e.stages)n+=(0,s.L)(a.duration),t.push([n,a.target]);return{points:t,totalMs:n,peak:Math.max(0,...e.stages.map(e=>e.target))}}let n=t?e.rps??20:e.vus,a=(0,s.L)(e.rampUp),r=(0,s.L)(e.duration),l=(0,s.L)(e.rampDown);return{points:[[0,a>0?0:n],[a,n],[a+r,n],[a+r+l,l>0?0:n]],totalMs:a+r+l,peak:n}}function p(e){let{totalMs:t,peak:s}=h(e),n="rate"===e.mode?"req/s":1===s?"VU":"VUs";return`${e.stages?.length?"peak ":""}${s.toLocaleString()} ${n} \xb7 ${f(t)}`}function f(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let s=Math.floor(t/60);return s<60?t%60?`${s}m ${t%60}s`:`${s}m`:`${Math.floor(s/60)}h ${s%60}m`}function b({load:e}){let{points:s,totalMs:n,peak:a}=h(e),r=s.map(([e,t])=>`${e/Math.max(n,1)*300},${56-t/Math.max(a,1)*50}`).join(" "),l=`0,56 ${r} 300,56`;return(0,t.jsxs)("figure",{className:"rounded-md border border-line bg-panel-2 px-3 py-2",children:[(0,t.jsxs)("figcaption",{className:"mb-1 flex justify-between text-xs text-mute",children:[(0,t.jsx)("span",{children:"Planned load"}),(0,t.jsx)("span",{className:"font-mono text-ink",children:p(e)})]}),(0,t.jsxs)("svg",{viewBox:"0 0 300 56",preserveAspectRatio:"none",className:"h-14 w-full",role:"img","aria-label":`Load profile: ${p(e)}`,children:[(0,t.jsx)("polygon",{points:l,fill:"var(--series-1)",fillOpacity:.15}),(0,t.jsx)("polyline",{points:r,fill:"none",stroke:"var(--series-1)",strokeWidth:2,vectorEffect:"non-scaling-stroke"})]}),(0,t.jsxs)("div",{className:"mt-1 flex justify-between font-mono text-[11px] text-mute",children:[(0,t.jsx)("span",{children:"0s"}),(0,t.jsx)("span",{children:"rate"===e.mode?"requests per second":"simulated users"}),(0,t.jsx)("span",{children:f(n)})]})]})}e.s(["B",0,function({load:e,onChange:a}){var r;let x,[h,p]=(0,l.useState)(!1),f=t=>a({...e,...t,preset:"custom"}),g="rate"===e.mode,v=!!(e.stages&&e.stages.length);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"mb-1 block text-xs text-mute",children:"Test type"}),(0,t.jsx)(c.f,{label:"Test type",value:e.preset,onChange:t=>a((0,d.V)(e,t)),options:[...n.R.map(e=>({value:e.id,label:e.label})),{value:"custom",label:"Custom"}]}),(0,t.jsx)("p",{className:"mt-2 text-xs text-mute",children:(r=e.preset,(x=n.R.find(e=>e.id===r))?`${x.question} ${x.hint}`:"Your own numbers — change users, duration or stages below.")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"mb-1 flex items-center gap-1 text-xs text-mute",children:["Drive load by",(0,t.jsx)(i.f,{label:"About users vs rate",text:"Simulated users (VUs): N clients each send, wait for the answer, and send again — a slow API gets fewer requests. Requests per second: k6 holds the rate whatever the API does — the honest way to test capacity."})]}),(0,t.jsx)(c.f,{label:"Drive load by",value:e.mode??"users",onChange:e=>f({mode:e}),options:[{value:"users",label:"Simulated users"},{value:"rate",label:"Requests per second"}]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"mb-1 block text-xs text-mute",children:"Shape"}),(0,t.jsx)(c.f,{label:"Load shape",value:v?"stages":"simple",onChange:function(t){if("simple"===t)return f({stages:null});let n=g?e.rps??20:e.vus,a=[];(0,s.L)(e.rampUp)>0&&a.push({duration:e.rampUp,target:n}),a.push({duration:e.duration,target:n}),(0,s.L)(e.rampDown)>0&&a.push({duration:e.rampDown,target:0}),f({stages:a})},options:[{value:"simple",label:"Ramp · hold · down"},{value:"stages",label:"Step by step"}]})]})]}),v?(0,t.jsx)(m,{stages:e.stages,unit:g?"req/s":"VUs",rate:g,onChange:e=>f({stages:e})}):(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[g?(0,t.jsx)(u,{label:"Requests / second",value:e.rps??20,min:1,max:1e5,onChange:e=>f({rps:e})}):(0,t.jsx)(u,{label:"Simulated users",hint:"Concurrent clients running from this computer. 50+ will load both the API and this machine.",value:e.vus,min:1,max:500,onChange:e=>f({vus:e})}),(0,t.jsx)(o.S,{label:"Hold for",mono:!0,value:e.duration,error:(0,d.R)(e.duration,!1),onChange:e=>f({duration:e})}),(0,t.jsx)(o.S,{label:"Ramp up",mono:!0,value:e.rampUp,error:(0,d.R)(e.rampUp),onChange:e=>f({rampUp:e})}),(0,t.jsx)(o.S,{label:"Ramp down",mono:!0,value:e.rampDown,error:(0,d.R)(e.rampDown),onChange:e=>f({rampDown:e})})]}),g?(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:(0,t.jsx)(u,{label:"Max simulated users",hint:"k6 starts more VUs when responses slow down, up to this ceiling. If it runs out, requests are dropped and the report says how many.",value:e.maxVus??100,min:1,max:2e3,onChange:e=>f({maxVus:e})})}):null,(0,t.jsx)(b,{load:e}),(0,t.jsx)("button",{type:"button",className:"text-xs text-accent hover:underline",onClick:()=>p(e=>!e),"aria-expanded":h,children:h?"Hide pacing options":"Pacing options"}),h?(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[g?(0,t.jsx)("p",{className:"text-xs text-mute sm:col-span-2",children:"Think time does not apply when holding a request rate — k6 paces the requests itself."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u,{label:"Think time (ms)",value:e.thinkTimeMs,min:0,max:6e5,onChange:e=>f({thinkTimeMs:e})}),(0,t.jsx)(u,{label:"Random extra (ms)",value:e.thinkJitterMs,min:0,max:6e5,onChange:e=>f({thinkJitterMs:e})})]}),(0,t.jsx)(o.S,{label:"Graceful stop",mono:!0,value:e.gracefulStop,error:(0,d.R)(e.gracefulStop),onChange:e=>f({gracefulStop:e}),hint:"Time in-flight requests get to finish."})]}):null]})},"A",0,p],63343);var g=e.i(59780),v=e.i(83500),j=e.i(84575),y=e.i(80707),N=e.i(70746);let w=null,k=null,C=new Set;function $(){return k??=fetch("/engine/local-servers",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>(e&&(w=e.servers),w)).catch(()=>w).finally(()=>{k=null,C.forEach(e=>e())}),C.forEach(e=>e()),k}var S=e.i(6278);let q=/^\{\{\s*([A-Za-z_][\w.-]*)\s*\}\}/,E=/^(https?):\/\/(localhost|127\.0\.0\.1)(?::(\d{1,5}))?(?=[/?#]|$)/i,z="\0none",M="\0local-other",T="apitestcenter-local-ports",R={GET:"text-ok",POST:"text-warn",PUT:"text-accent",PATCH:"text-accent",DELETE:"text-bad",HEAD:"text-mute",OPTIONS:"text-mute"};function D(){try{let e=JSON.parse(localStorage.getItem(T)??"[]");return(Array.isArray(e)?e.filter(e=>Number.isInteger(e)&&e>0&&e<65536):[]).slice(0,5)}catch{return[]}}function L(e){try{localStorage.setItem(T,JSON.stringify([e,...D().filter(t=>t!==e)].slice(0,5)))}catch{}}let O=(0,l.forwardRef)(function({draft:e,onChange:s,onImported:n,actions:a},i){let{vars:o,environments:c,activeEnv:u}=(0,S.U)(),m=(0,N.k)(),x=(0,l.useRef)(null);(0,l.useImperativeHandle)(i,()=>x.current);let[h,p]=(0,l.useState)([]),[f,b]=(0,l.useState)(null),[T,O]=(0,l.useState)(!1),A=(0,l.useRef)(null);(0,l.useEffect)(()=>p(D()),[]),(0,l.useEffect)(()=>{f&&A.current?.focus()},[f]);let P=e.url,U=q.exec(P)?.[1],F=Object.entries(o).filter(([e,t])=>/^https?:\/\//i.test(t.trim())&&("practiceApi"!==e||U===e)),I=m.filter(e=>!F.some(([t])=>t===e.variable)).map(e=>[e.variable,e.baseUrl,e.name]),B=[...F,...I.map(([e,t])=>[e,t])],W=(()=>{if(T)return null;let e=q.exec(P);if(e&&B.some(([t])=>t===e[1]))return{prefix:e[0],text:`{{${e[1]}}}`,value:e[1]};let t=E.exec(P);if(t){let e=t[1].toLowerCase(),s=t[3]??("https"===e?"443":"80");return{prefix:t[0],text:`${t[2]}${t[3]?`:${t[3]}`:""}`,value:`local:${e}:${s}`}}return null})(),_=P.startsWith("/"),H=_||""===P||null!=W,V=function(e){let[,t]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=()=>t(e=>e+1);return C.add(e),()=>void C.delete(e)},[]),(0,l.useEffect)(()=>{e&&null==w&&!k&&$()},[e]);let s=(0,l.useCallback)(()=>void $(),[]);return{servers:w??[],checked:null!=w,checking:null!=k,refresh:s}}(H),K=W?P.slice(W.prefix.length):P,X=e=>{let t=""===K||K.startsWith("/")||K.startsWith("?")?K:`/${K}`;return`${e}${t||(e.startsWith("{{")?"":"/")}`},J=t=>{let n=/^(https?:\/\/|\{\{)/i.test(t.trim())||""===K&&""!==t&&!/^[/?#]/.test(t);/^https?:\/\//i.test(t.trim())&&O(!0),s((0,d.e)(e,W&&!n?`${W.prefix}${t}`:t))},Z=(0,j.m)(x,J),G=V.servers,Y=[...G.map(e=>({value:`local:${e.scheme}:${e.port}`,label:`localhost:${e.port}`,hint:[e.name,e.scheme,e.selfSigned?"self-signed":""].filter(Boolean).join(" · "),text:`localhost ${e.port} ${e.name??""}`,className:"font-mono",group:"local",inline:!0})),...h.filter(e=>!G.some(t=>t.port===e)).map(e=>({value:`local:http:${e}`,label:`localhost:${e}`,hint:V.checked?"used before · not running now":"used before",text:`localhost ${e}`,className:"font-mono text-mute",group:"local",inline:!0}))];W?.value.startsWith("local:")&&!Y.some(e=>e.value===W.value)&&Y.unshift({value:W.value,label:W.text,hint:"in this request",text:W.text,className:"font-mono",group:"local",inline:!0});let Q=null!=W&&!W.value.startsWith("local:"),ee=[...I.length?[{id:"connections",label:"Connections",text:"connections",defaultOpen:!0}]:[],...F.length?[{id:"env",label:u?.name??"Variables",text:u?.name??"variables",defaultOpen:Q||null==W,action:c.length>1?{label:"switch",title:"Choose another environment",onClick:()=>setTimeout(()=>document.querySelector('button[role="combobox"][aria-label="Environment"]')?.click(),0)}:void 0}]:[],{id:"local",label:"Localhost",text:"localhost",hint:V.checking&&!V.checked?"checking…":`${G.length||"none"} running${V.checking?" · checking…":""}`,defaultOpen:!B.length&&null==W,action:{label:(0,t.jsx)(v.f,{size:12,"aria-hidden":!0,className:V.checking?"animate-spin":""}),title:"Check again for running servers",onClick:V.refresh,keepOpen:!0}}],et=W?"text-accent":_?"text-warn":"text-mute";return(0,t.jsxs)("div",{className:"flex flex-wrap items-stretch gap-2",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-[1_1_28rem] overflow-hidden rounded-lg border border-line bg-panel-2 focus-within:border-accent",children:[(0,t.jsx)(y.f,{label:"Method",value:e.method,onChange:t=>s({...e,method:t}),options:d.C.map(e=>({value:e,label:e,className:`font-mono font-medium ${R[e]}`})),minWidth:140,className:`shrink-0 border-r border-line px-3 font-mono text-sm font-medium outline-none focus-visible:bg-panel ${R[e.method]}`}),f?(0,t.jsxs)("form",{className:"flex shrink-0 items-center gap-1 border-r border-line px-2 font-mono text-xs",onSubmit:t=>{t.preventDefault(),(()=>{if(!f)return;let t=Number(f.port);!Number.isInteger(t)||t<1||t>65535||(L(t),p(D()),s((0,d.e)(e,X(`${f.scheme}://localhost:${t}`))),b(null))})()},onKeyDown:e=>"Escape"===e.key&&b(null),children:[(0,t.jsx)("button",{type:"button",title:"Switch between http and https",onClick:()=>b({...f,scheme:"http"===f.scheme?"https":"http"}),className:"rounded px-1 text-accent hover:bg-panel",children:f.scheme}),(0,t.jsx)("span",{className:"text-mute",children:"://localhost:"}),(0,t.jsx)("input",{ref:A,value:f.port,onChange:e=>b({...f,port:e.target.value.replace(/\D/g,"").slice(0,5)}),inputMode:"numeric",placeholder:"8080","aria-label":"Port",className:"w-14 rounded border border-line bg-panel px-1.5 py-0.5 text-ink outline-none focus:border-accent"}),(0,t.jsx)("button",{type:"submit","aria-label":"Use this port",className:"rounded p-0.5 text-accent hover:bg-panel",children:(0,t.jsx)(g.f,{size:14})}),(0,t.jsx)("button",{type:"button","aria-label":"Cancel",onClick:()=>b(null),className:"rounded p-0.5 text-mute hover:text-ink",children:(0,t.jsx)(r.X,{size:14})})]}):H?(0,t.jsx)(y.f,{label:"Base URL",value:W?.value??z,onChange:t=>{if(t===M)return b({scheme:"http",port:""});if(t===z)return s((0,d.e)(e,K));if(t.startsWith("local:")){let[,n,a]=t.split(":"),r=Number(a);return L(r),p(D()),s((0,d.e)(e,X(`${n}://localhost:${r}`)))}s((0,d.e)(e,X(`{{${t}}}`)))},onOpen:V.refresh,minWidth:320,buttonContent:W?.text??"Base URL",groups:ee,options:[...I.map(([e,t,s])=>({value:e,label:`{{${e}}}`,hint:`${s} \xb7 ${t}`,text:`${e} ${s}`,className:"font-mono text-accent",group:"connections"})),...F.map(([e,t])=>({value:e,label:`{{${e}}}`,hint:t,text:e,className:"font-mono text-accent",group:"env"})),...Y,{value:M,label:"Another port…",text:"another port",group:"local"},{value:z,label:"No base URL — type the whole address",text:"no"}],className:`shrink-0 border-r border-line px-2.5 font-mono text-xs outline-none focus-visible:bg-panel ${et}`}):null,(0,t.jsx)("label",{className:"sr-only",htmlFor:"request-url",children:"Request URL"}),(0,t.jsx)("input",{...Z.handlers,ref:x,id:"request-url",value:K,spellCheck:!1,autoComplete:"off",onChange:e=>J(e.target.value),onKeyDown:e=>void Z.onKeyDown(e),onBlur:()=>{O(!1),Z.handlers.onBlur()},onPaste:t=>{let a=(0,d.X)(e,t.clipboardData.getData("text"));a&&(t.preventDefault(),s(a.draft),a.note&&n?.(a.note))},placeholder:W?"/path — after the base URL":"Paste a URL or a curl command, or type a /path",className:"min-w-0 flex-1 bg-transparent px-3 py-2.5 font-mono text-sm text-ink outline-none placeholder:text-mute"})]}),Z.popup,(0,t.jsx)("div",{className:"flex shrink-0 gap-2",children:a})]})});e.s(["f",0,O],44794);var A=e.i(56003);let P={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};P.node;let U=(0,A.f)(P);e.s(["f",0,U],90972);let F={name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]};F.node;let I=(0,A.f)(F);e.s(["f",0,I],45480);var B=e.i(75606),W=e.i(55919);let _={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};_.node;let H=(0,A.f)(_);e.s(["f",0,H],87078);let V={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};V.node;let K=(0,A.f)(V);e.s(["f",0,K],35559);var X=e.i(39024),J=e.i(56396);let Z="apitestcenter-code-target";e.s(["B",0,function({cookies:e}){let[s,n]=(0,l.useState)(!1);return(0,t.jsxs)("div",{className:"space-y-2 overflow-auto",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Set by this answer",e.length>1?" and the redirects on the way":"",". With the cookie jar on, they go with the next requests to the same site."]}),(0,t.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),"aria-pressed":s,className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-line px-2 py-1 text-xs text-mute hover:text-ink",children:[s?(0,t.jsx)(K,{size:12,"aria-hidden":!0}):(0,t.jsx)(H,{size:12,"aria-hidden":!0}),s?"Hide values":"Show values"]})]}),(0,t.jsx)("div",{className:"overflow-auto rounded-md border border-line",children:(0,t.jsxs)("table",{className:"w-full text-left text-[13px]",children:[(0,t.jsx)("thead",{className:"bg-panel-2 text-xs text-mute",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"px-3 py-1.5 font-normal",children:"Name"}),(0,t.jsx)("th",{className:"px-3 py-1.5 font-normal",children:"Value"}),(0,t.jsx)("th",{className:"px-3 py-1.5 font-normal",children:"Domain · path"}),(0,t.jsx)("th",{className:"px-3 py-1.5 font-normal",children:"Expires"}),(0,t.jsx)("th",{className:"px-3 py-1.5 font-normal",children:"Flags"})]})}),(0,t.jsx)("tbody",{children:e.map((e,n)=>{var a;return(0,t.jsxs)("tr",{className:"border-t border-line align-top",children:[(0,t.jsx)("td",{className:"px-3 py-1.5 font-mono text-ink",children:e.name}),(0,t.jsx)("td",{className:`max-w-[16rem] px-3 py-1.5 font-mono break-all ${s?"text-ink":"text-mute italic"}`,children:s?e.value||"(empty)":B.Z}),(0,t.jsxs)("td",{className:"px-3 py-1.5 font-mono text-xs text-mute",children:[e.domain??"this host"," · ",e.path??"/"]}),(0,t.jsx)("td",{className:"px-3 py-1.5 text-xs text-mute",children:void 0!==e.maxAge?e.maxAge<=0?"deleted":`in ${(a=e.maxAge)<120?`${a} s`:a<7200?`${Math.round(a/60)} min`:a<172800?`${Math.round(a/3600)} h`:`${Math.round(a/86400)} days`}`:e.expires?new Date(e.expires).toLocaleString():"when the app closes"}),(0,t.jsx)("td",{className:"px-3 py-1.5 text-xs text-mute",children:[e.httpOnly?"HttpOnly":"",e.secure?"Secure":"",e.sameSite?`SameSite=${e.sameSite}`:""].filter(Boolean).join(" · ")||"—"})]},n)})})]})})]})},"x",0,function({sent:e}){let s=(0,J.d)(),[n,a]=(0,l.useState)(!1),[r,i]=(0,l.useState)("curl");(0,l.useEffect)(()=>i(function(){try{let e=localStorage.getItem(Z);if(B.X.some(t=>t.id===e))return e}catch{}return"curl"}()),[]);let o=(0,l.useMemo)(()=>n?e:(0,B.A)(e),[e,n]),c=(0,l.useMemo)(()=>(0,B.T)(r,o),[r,o]),d=(0,l.useMemo)(()=>JSON.stringify((0,B.A)(e))!==JSON.stringify(e),[e]),u=(e,t)=>{navigator.clipboard.writeText(e),s(`${t} copied`,"success")};return(0,t.jsxs)("div",{className:"space-y-4 overflow-auto",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("p",{className:"min-w-0 flex-1 font-mono text-[13px] break-all text-ink",children:[(0,t.jsx)("span",{className:"mr-2 font-medium text-accent",children:o.method}),o.url]}),d?(0,t.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),"aria-pressed":n,className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-line px-2 py-1 text-xs text-mute hover:text-ink",children:[n?(0,t.jsx)(K,{size:12,"aria-hidden":!0}):(0,t.jsx)(H,{size:12,"aria-hidden":!0}),n?"Hide secrets":"Show secrets"]}):null]}),e.authNote||e.redirects?.length?(0,t.jsxs)("div",{className:"space-y-1 text-xs text-mute",children:[e.authNote?(0,t.jsxs)("p",{className:"flex items-start gap-1.5",children:[(0,t.jsx)(X.f,{size:12,className:"mt-0.5 shrink-0","aria-hidden":!0}),e.authNote,"."]}):null,e.redirects?.length?(0,t.jsxs)("div",{children:["Then followed ",1===e.redirects.length?"a redirect":`${e.redirects.length} redirects`,":",(0,t.jsx)("ul",{className:"mt-0.5 space-y-0.5 font-mono",children:e.redirects.map((e,s)=>(0,t.jsxs)("li",{className:"break-all",children:["→ ",e]},s))})]}):null]}):null,(0,t.jsxs)("section",{"aria-label":"Headers sent",children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-xs font-medium text-mute",children:"Headers"}),(0,t.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-mute hover:text-ink",onClick:()=>u(o.headers.map(([e,t])=>`${e}: ${t}`).join("\n"),"Headers"),children:[(0,t.jsx)(W.f,{size:12})," Copy"]})]}),(0,t.jsx)("div",{className:"overflow-auto rounded-md border border-line",children:(0,t.jsx)("table",{className:"w-full text-left text-[13px]",children:(0,t.jsx)("tbody",{children:o.headers.map(([e,s],n)=>(0,t.jsxs)("tr",{className:"border-t border-line first:border-t-0",children:[(0,t.jsx)("th",{scope:"row",className:"w-2/5 bg-panel-2 px-3 py-1.5 align-top font-mono font-normal text-mute",children:e}),(0,t.jsx)("td",{className:`px-3 py-1.5 font-mono break-all ${s.includes(B.Z)?"text-mute italic":"text-ink"}`,children:s})]},n))})})})]}),(0,t.jsxs)("section",{"aria-label":"Body sent",children:[(0,t.jsx)("h3",{className:"mb-1.5 text-xs font-medium text-mute",children:"Body"}),void 0===e.body?(0,t.jsx)("p",{className:"text-xs text-mute",children:"No body."}):(0,t.jsxs)("pre",{className:"max-h-64 overflow-auto rounded-md border border-line bg-panel-2 p-3 font-mono text-[13px] leading-5 break-words whitespace-pre-wrap text-ink",children:[o.body,e.bodyTruncated?(0,t.jsxs)("span",{className:"text-warn",children:["\n","… the first 20 MB shown"]}):null]})]}),(0,t.jsxs)("section",{"aria-label":"Code",children:[(0,t.jsxs)("div",{className:"mb-1.5 flex flex-wrap items-center gap-2",children:[(0,t.jsx)("h3",{className:"text-xs font-medium text-mute",children:"Code"}),(0,t.jsx)(y.f,{label:"Language",value:r,onChange:e=>{i(e);try{localStorage.setItem(Z,e)}catch{}},options:B.X.map(e=>({value:e.id,label:e.label})),minWidth:180,className:"rounded-md border border-line bg-panel-2 px-2 py-1 text-xs text-ink outline-none focus-visible:border-accent"}),(0,t.jsxs)("button",{type:"button",className:"ml-auto inline-flex items-center gap-1 text-xs text-mute hover:text-ink",onClick:()=>u(c,"Code"),children:[(0,t.jsx)(W.f,{size:12})," Copy"]})]}),(0,t.jsx)("pre",{"aria-label":`${B.X.find(e=>e.id===r)?.label} code`,className:"max-h-96 overflow-auto rounded-md border border-line bg-panel-2 p-3 font-mono text-[12.5px] leading-5 whitespace-pre text-ink",children:c}),(0,t.jsxs)("p",{className:"mt-1.5 text-xs text-mute",children:[n||!d?"":`Secrets show as ${B.Z} — choose Show secrets to put the real values in. `,"curl"===r&&e.body&&/[^\x00-\x7f]/.test(e.body)?"On Windows, curl.exe can garble non-English letters in the command line — use the PowerShell code there, or save the body to a file and send it with --data-binary @file. ":"",e.authNote&&/signed|challenge|three requests/.test(e.authNote)?"A signature or challenge answer is only good for this one request; sent again later, the server may refuse it.":e.authNote?.startsWith("OAuth 2.0")?"The token expires; the code works until it does.":""]})]})]})}],12580);let G={name:"arrow-down-left",size:24,node:[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]};G.node;let Y=(0,A.f)(G);e.s(["f",0,Y],90446)},60566,97716,16788,68228,65638,46679,e=>{var t=e.i(51487),s=e.i(30932),n=e.i(78e3),a=e.i(90972),r=e.i(55919),l=e.i(87953),i=e.i(86766),o=e.i(45480),c=e.i(77306),d=e.i(28867),u=e.i(13318),m=e.i(56396),x=e.i(15060),h=e.i(12580),p=e.i(90446),f=e.i(51721),b=e.i(39024),g=e.i(37841),v=e.i(28232),j=e.i(92001);let y={async connect(e){let t=await fetch("/engine/realtime/ws",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(!t.ok||!s.id)throw Error(s.error??`Could not connect (${t.status})`);return{id:s.id}},close:e=>fetch(`/engine/realtime/${e}/close`,{method:"POST"}).catch(()=>void 0)};function N({id:e,onClosed:s}){let n=(0,m.d)(),[a,l]=(0,c.useState)([]),[o,d]=(0,c.useState)(null),[u,x]=(0,c.useState)(!1),[h,w]=(0,c.useState)(""),[k,C]=(0,c.useState)(""),[$,S]=(0,c.useState)(!0),q=(0,c.useRef)(null),E=(0,c.useRef)(0),z=(0,c.useRef)(s);z.current=s,(0,c.useEffect)(()=>{l([]),d(null),x(!1),E.current=0;let t=!0,s=0,n=async()=>{try{let s=await fetch(`/engine/realtime/${e}?since=${E.current}`,{cache:"no-store"});if(404===s.status)return void x(!0);let n=await s.json();if(!t)return;if(E.current=n.next,n.events.length&&l(e=>[...e,...n.events].slice(-2e3)),d({kind:n.kind,url:n.url,status:n.status,dropped:n.dropped}),"closed"===n.status)return void z.current?.()}catch{}t&&(s=window.setTimeout(()=>void n(),350))};return n(),()=>{t=!1,window.clearTimeout(s)}},[e]),(0,c.useEffect)(()=>{$&&q.current?.lastElementChild?.scrollIntoView({block:"nearest"})},[a,$]);let M=(0,c.useMemo)(()=>k?a.filter(e=>e.text.toLowerCase().includes(k.toLowerCase())||(e.event??"").toLowerCase().includes(k.toLowerCase())):a,[a,k]),T=(0,c.useMemo)(()=>({in:a.filter(e=>"in"===e.dir).length,out:a.filter(e=>"out"===e.dir).length}),[a]),R=o?.status==="open",D=o?.kind==="ws",L=async()=>{if(!h.trim()||!R)return;let t=await fetch(`/engine/realtime/${e}/send`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:h})});t.ok||n((await t.json().catch(()=>({}))).error??"Could not send","error")};return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",children:[(0,t.jsx)("span",{className:`rounded-md border px-2 py-0.5 font-mono text-sm ${u?"border-line text-mute":R?"border-ok/40 bg-ok/10 text-ok":o?.status==="connecting"?"border-accent/40 text-accent":"border-line text-mute"}`,children:u?"Gone":R?D?"Connected":"Receiving":o?.status==="connecting"?"Connecting…":"Closed"}),(0,t.jsxs)("span",{className:"text-xs text-mute",children:[D?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-ink",children:T.in})," received · ",(0,t.jsx)("span",{className:"text-ink",children:T.out})," sent"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-ink",children:T.in})," events"]}),o?.dropped?` \xb7 first ${o.dropped} no longer kept`:""]}),(0,t.jsxs)("label",{className:"ml-auto flex items-center gap-1 rounded-md border border-line bg-panel px-1.5",children:[(0,t.jsx)(i.f,{size:12,className:"text-mute","aria-hidden":!0}),(0,t.jsx)("input",{value:k,onChange:e=>C(e.target.value),"aria-label":"Filter messages",placeholder:"Filter",className:"w-28 bg-transparent py-1 text-xs text-ink outline-none"})]}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-mute",children:[(0,t.jsx)("input",{type:"checkbox",checked:$,onChange:e=>S(e.target.checked),className:"accent-[var(--accent)]"}),"Follow"]}),R?(0,t.jsxs)("button",{type:"button",onClick:()=>void y.close(e),className:"inline-flex items-center gap-1 rounded-md border border-line px-2 py-1 text-xs text-mute hover:text-ink",children:[(0,t.jsx)(j.f,{size:12,"aria-hidden":!0})," ",D?"Disconnect":"Stop"]}):null]}),o?.url?(0,t.jsx)("p",{className:"font-mono text-xs break-all text-mute",children:o.url}):null,(0,t.jsxs)("ol",{ref:q,"aria-label":D?"Messages":"Events","aria-live":"polite",className:"min-h-[14rem] flex-1 space-y-1 overflow-auto rounded-md border border-line bg-panel-2 p-2",children:[0===M.length?(0,t.jsx)("li",{className:"p-2 text-xs text-mute",children:k?"Nothing matches the filter.":D?"No messages yet.":"No events yet."}):null,M.map((e,s)=>{let a;return(0,t.jsxs)("li",{className:`group flex gap-2 rounded px-1.5 py-1 text-[12.5px] ${"error"===e.dir?"bg-bad/10":"out"===e.dir?"bg-accent/5":""}`,children:[(0,t.jsx)("span",{className:"w-14 shrink-0 pt-0.5 text-right font-mono text-[11px] text-mute tabular",children:(a=e.at/1e3)<60?`${a.toFixed(2)} s`:`${Math.floor(a/60)}:${String(Math.floor(a%60)).padStart(2,"0")}`}),(0,t.jsx)("span",{className:"shrink-0 pt-0.5","aria-label":"in"===e.dir?"received":"out"===e.dir?"sent":e.dir,children:"in"===e.dir?(0,t.jsx)(p.f,{size:13,className:"text-ok"}):"out"===e.dir?(0,t.jsx)(f.f,{size:13,className:"text-accent"}):"error"===e.dir?(0,t.jsx)(v.f,{size:13,className:"text-bad"}):(0,t.jsx)(b.f,{size:13,className:"text-mute"})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[e.event||e.id?(0,t.jsxs)("span",{className:"mr-2 font-mono text-[11px] text-mute",children:[e.event?`event: ${e.event}`:"",e.id?` id: ${e.id}`:""]}):null,(0,t.jsx)("span",{className:`block font-mono break-words whitespace-pre-wrap ${"info"===e.dir?"text-mute":"error"===e.dir?"text-bad":"text-ink"}`,children:"in"===e.dir||"out"===e.dir?function(e){let t=e.trim();if(!(t.startsWith("{")||t.startsWith("[")))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}(e.text):e.text})]}),"in"===e.dir||"out"===e.dir?(0,t.jsx)("button",{type:"button","aria-label":"Copy message",onClick:()=>{navigator.clipboard.writeText(e.text),n("Message copied","success")},className:"shrink-0 self-start rounded p-0.5 text-mute opacity-0 group-hover:opacity-100 hover:text-ink focus:opacity-100",children:(0,t.jsx)(r.f,{size:12})}):null]},s)})]}),D?(0,t.jsxs)("form",{className:"flex items-end gap-2",onSubmit:e=>{e.preventDefault(),L()},children:[(0,t.jsxs)("label",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"sr-only",children:"Message to send"}),(0,t.jsx)("textarea",{value:h,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),L())},rows:Math.min(8,Math.max(2,h.split("\n").length)),disabled:!R,placeholder:R?'{ "type": "subscribe", "channel": "orders" } — Ctrl+Enter sends':"Connect to send messages",spellCheck:!1,className:"w-full resize-y rounded-md border border-line bg-panel-2 px-3 py-2 font-mono text-[13px] text-ink outline-none focus:border-accent disabled:opacity-50"})]}),(0,t.jsxs)("button",{type:"submit",disabled:!R||!h.trim(),className:"btn btn-primary py-2",children:[(0,t.jsx)(g.f,{size:14})," Send"]})]}):null]})}e.s(["d",0,N,"D",0,y],97716);var w=e.i(19656),k=e.i(61230);let C="apitestcenter-show-big-answers",$={200:"OK",201:"Created",202:"Accepted",204:"No Content",301:"Moved Permanently",302:"Found",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",408:"Request Timeout",409:"Conflict",415:"Unsupported Media Type",422:"Unprocessable Content",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"};function S(e){return e>=200&&e<300?"text-ok border-ok/40 bg-ok/10":e>=300&&e<400?"text-accent border-accent/40 bg-accent/10":e>=400&&e<500?"text-warn border-warn/40 bg-warn/10":"text-bad border-bad/40 bg-bad/10"}function q({logs:e}){return(0,t.jsx)("ol",{"aria-label":"Script console",className:"overflow-auto rounded-md border border-line bg-panel-2 p-2 font-mono text-[12.5px] leading-5",children:e.map((e,s)=>(0,t.jsxs)("li",{className:"flex gap-2 border-t border-line/50 px-1 py-0.5 first:border-t-0",children:[(0,t.jsx)("span",{className:"w-24 shrink-0 whitespace-nowrap text-mute",children:"pre"===e.phase?"pre-request":"tests"}),(0,t.jsx)("span",{className:"min-w-0 break-words whitespace-pre-wrap text-ink",children:e.text})]},s))})}function E({label:e,value:s}){return(0,t.jsxs)("span",{className:"text-xs text-mute",children:[e," ",(0,t.jsx)("span",{className:"font-mono text-sm text-ink",children:s})]})}function z({message:e,onWaitLonger:s}){let n,a,r,{title:l,tip:i}=(n=e.toLowerCase(),(a=/^No answer within (\S+)/.exec(e))?{title:`No answer in ${a[1]}`,tip:"The server is reachable but slow: it didn't answer within this request's timeout. Wait longer and send again, or change what new requests wait in Settings → Requests."}:n.includes("econnrefused")?{title:"Connection refused",tip:"Nothing is listening on that host and port. Is the server running, and is the port right?"}:n.includes("enotfound")||n.includes("eai_again")?{title:"Host not found",tip:"DNS could not resolve the host name. Check the spelling, or connect to the VPN for internal hosts."}:n.includes("timeout")||n.includes("etimedout")||n.includes("und_err_headers_timeout")?{title:"Timed out",tip:"The server did not answer in time. Raise Timeout under Settings, or check that the host is reachable."}:n.includes("certificate")||n.includes("self-signed")||n.includes("unable to verify")||n.includes("cert_")?{title:"TLS certificate rejected",tip:"The certificate is not trusted. For a lab certificate, turn on 'Skip TLS certificate check' under Settings."}:n.includes("econnreset")||n.includes("socket hang up")?{title:"Connection reset",tip:"The server closed the connection mid-request. Check the server logs, or a proxy or firewall in between."}:n.includes("engine")?{title:"Engine problem",tip:"The local engine did not answer. Make sure pnpm dev is running."}:{title:"Request failed",tip:"See the details below."}),o=/^No answer within (\S+)/.exec(e)?.[1],c=o&&s?(r=e=>{let t=/^(\d+)(ms|s|m)$/.exec(e.trim());return t?Number(t[1])*("ms"===t[2]?1:"s"===t[2]?1e3:6e4):0},["2m","5m","10m","30m"].filter(e=>r(e)>r(o)).slice(0,2)):[];return(0,t.jsxs)("div",{role:"alert",className:"mt-3 rounded-md border border-bad/40 bg-bad/10 px-3 py-2.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-bad",children:l}),(0,t.jsx)("p",{className:"mt-1 text-sm text-ink",children:i}),c.length?(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:c.map((e,n)=>(0,t.jsxs)("button",{type:"button",className:`btn ${0===n?"btn-primary":"btn-secondary"} py-1 text-xs`,onClick:()=>s(e),children:["Wait up to ",e," and send again"]},e))}):null,(0,t.jsx)("p",{className:"mt-2 font-mono text-xs break-all text-mute",children:e})]})}function M({headers:e}){let s=(0,m.d)(),n=Object.entries(e).sort(([e],[t])=>e.localeCompare(t));return 0===n.length?(0,t.jsx)("p",{className:"text-sm text-mute",children:"No headers."}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-mute hover:text-ink",onClick:()=>{navigator.clipboard.writeText(n.map(([e,t])=>`${e}: ${t}`).join("\n")),s("Headers copied","success")},children:[(0,t.jsx)(r.f,{size:12})," Copy all"]})}),(0,t.jsx)("div",{className:"overflow-auto rounded-md border border-line",children:(0,t.jsx)("table",{className:"w-full text-left text-[13px]",children:(0,t.jsx)("tbody",{children:n.map(([e,s])=>(0,t.jsxs)("tr",{className:"border-t border-line first:border-t-0",children:[(0,t.jsx)("th",{scope:"row",className:"w-2/5 bg-panel-2 px-3 py-1.5 align-top font-mono font-normal text-mute",children:e}),(0,t.jsx)("td",{className:`px-3 py-1.5 font-mono break-all ${"[redacted]"===s?"text-mute italic":"text-ink"}`,children:s})]},e))})})}),(0,t.jsx)("p",{className:"text-xs text-mute",children:"Cookie and authorization headers are hidden here — see Cookies, and Request sent."})]})}function T({body:e,contentType:n,truncated:u,url:h,base64:p}){let f=(0,m.d)(),b=function(e,t){let s=t.toLowerCase();if(s.startsWith("image/"))return"image";if(s.includes("json"))return"json";if(s.includes("html"))return"html";if(s.includes("xml"))return"xml";let n=e.trim();if(n.startsWith("{")||n.startsWith("["))try{return JSON.parse(n),"json"}catch{}return/^<!doctype html|^<html/i.test(n)?"html":n.startsWith("<")?"xml":"text"}(e,n),g="image"===b&&p?`data:${n.split(";")[0]};base64,${p}`:null,v=u||e.length>=2e5,[j,y]=(0,c.useState)("pretty"),[N,k]=(0,c.useState)(!0),[$,S]=(0,c.useState)(""),[q,E]=(0,c.useState)(0),[z,M]=(0,c.useState)(!1),A=(0,c.useRef)(null),P=(0,c.useRef)(null),[U,F]=(0,c.useState)(!1);(0,c.useEffect)(()=>{try{F("1"===localStorage.getItem(C))}catch{}},[e]),(0,c.useEffect)(()=>{y("image"===b?"preview":"pretty"),S(""),E(0)},[e,b]);let I=(0,c.useMemo)(()=>e?"raw"===j?e:function(e,t){if("json"!==t)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}(e,b):"",[e,j,b]),B=(0,c.useMemo)(()=>(function(e,t){if(!t)return 0;let s=e.toLowerCase(),n=t.toLowerCase(),a=0;for(let e=s.indexOf(n);e>=0&&a<1e4;e=s.indexOf(n,e+n.length))a++;return a})(I,$),[I,$]);function W(e){0!==B&&E(t=>(t+e+B)%B)}(0,c.useEffect)(()=>{let e=P.current?.querySelector("mark.current");e?.scrollIntoView({block:"center"})},[q,$,j]);let _=g?[{value:"preview",label:"Preview"},{value:"raw",label:"Raw"}]:[{value:"pretty",label:"Pretty"},{value:"raw",label:"Raw"},..."html"===b?[{value:"preview",label:"Preview"}]:[]];return e?e.length>2097152&&!U?(0,t.jsxs)("div",{role:"region","aria-label":"A big answer",className:"flex flex-1 flex-col items-center justify-center gap-3 rounded-md border border-line bg-panel-2 px-6 py-10 text-center",children:[(0,t.jsxs)("p",{className:"text-sm text-ink",children:["This answer is ",(0,w.L)(e.length),u?" (cut at 20 MB)":"","."]}),(0,t.jsx)("p",{className:"max-w-sm text-xs text-mute",children:"Showing it can take the app a few seconds. Checks and Save values already used all of it."}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-center gap-2",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-primary py-1.5 text-sm",onClick:()=>F(!0),children:"Show it"}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:()=>{y("raw"),F(!0)},children:"As plain text"}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:()=>(0,x.N)(L(h,b),e,O(b)),children:[(0,t.jsx)(l.f,{size:14}),"Save to file"]})]}),(0,t.jsx)("button",{type:"button",className:"text-xs text-mute hover:text-ink",onClick:()=>{try{localStorage.setItem(C,"1")}catch{}F(!0)},children:"Always show big answers"})]}):(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-line bg-panel-2",onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"f"===e.key.toLowerCase()&&(e.preventDefault(),M(!0),window.setTimeout(()=>A.current?.focus(),0))},children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line px-2 py-1.5",children:[(0,t.jsx)(d.f,{label:"Body view",value:j,onChange:y,options:_}),(0,t.jsx)("span",{className:"rounded border border-line px-1.5 py-0.5 font-mono text-xs text-mute uppercase",children:b}),u?(0,t.jsx)("span",{className:"text-xs text-warn",children:"Over 20 MB: the first 20 MB shown"}):null,(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[z?(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-line bg-panel px-1.5",children:[(0,t.jsx)(i.f,{size:12,className:"text-mute"}),(0,t.jsx)("input",{ref:A,value:$,"aria-label":"Find in body",placeholder:"Find",onChange:e=>{S(e.target.value),E(0)},onKeyDown:e=>{"Enter"===e.key&&W(e.shiftKey?-1:1),"Escape"===e.key&&(S(""),M(!1))},className:"w-28 bg-transparent py-1 text-xs text-ink outline-none"}),(0,t.jsx)("span",{className:"font-mono text-xs text-mute tabular",children:$?`${B?q+1:0}/${B}`:""}),(0,t.jsx)(R,{label:"Previous match",onClick:()=>W(-1),children:(0,t.jsx)(a.f,{size:12})}),(0,t.jsx)(R,{label:"Next match",onClick:()=>W(1),children:(0,t.jsx)(s.f,{size:12})})]}):(0,t.jsx)(R,{label:"Find in body (Ctrl+F)",onClick:()=>{M(!0),window.setTimeout(()=>A.current?.focus(),0)},children:(0,t.jsx)(i.f,{size:14})}),(0,t.jsx)(R,{label:N?"Turn off line wrap":"Wrap long lines",pressed:N,onClick:()=>k(e=>!e),children:(0,t.jsx)(o.f,{size:14})}),(0,t.jsx)(R,{label:"Copy body",onClick:()=>{navigator.clipboard.writeText(I),f("Body copied","success")},children:(0,t.jsx)(r.f,{size:14})}),(0,t.jsx)(R,{label:"Download body",onClick:()=>g&&p?(0,x.h)(L(h,b,n),new Blob([Uint8Array.from(atob(p),e=>e.charCodeAt(0))],{type:n.split(";")[0]})):(0,x.N)(L(h,b),I,O(b)),children:(0,t.jsx)(l.f,{size:14})})]})]}),"preview"===j&&g?(0,t.jsx)("div",{className:"flex min-h-[12rem] flex-1 items-center justify-center overflow-auto p-3",children:(0,t.jsx)("img",{src:g,alt:"Response image",className:"max-h-[32rem] max-w-full object-contain"})}):"preview"===j?(0,t.jsx)("iframe",{title:"HTML preview",sandbox:"",srcDoc:e,className:"min-h-[24rem] w-full flex-1 bg-white"}):(0,t.jsx)("pre",{ref:P,tabIndex:0,"aria-label":"Response body",className:`min-h-[12rem] flex-1 overflow-auto p-3 font-mono text-[13px] leading-5 text-ink ${N?"break-words whitespace-pre-wrap":"whitespace-pre"}`,children:$?function(e,s,n){let a=[],r=e.toLowerCase(),l=s.toLowerCase(),i=0,o=0;for(let s=r.indexOf(l);s>=0&&o<1e4;s=r.indexOf(l,s+l.length))a.push(e.slice(i,s)),a.push((0,t.jsx)("mark",{className:`find-hit${o===n?" current":""}`,children:e.slice(s,s+l.length)},s)),i=s+l.length,o++;return a.push(e.slice(i)),a}(I,$,q):"pretty"!==j||"json"!==b||v?I:function(e){let s=[],n=0;for(let a of e.matchAll(D)){let r=a.index??0;s.push(e.slice(n,r)),a[1]?(s.push((0,t.jsx)("span",{className:a[2]?"tok-key":"tok-str",children:a[1]},r)),a[2]&&s.push(a[2])):a[3]?s.push((0,t.jsx)("span",{className:"tok-lit",children:a[3]},r)):s.push((0,t.jsx)("span",{className:"tok-num",children:a[4]},r)),n=r+a[0].length}return s.push(e.slice(n)),s}(I)})]}):(0,t.jsx)("p",{className:"text-sm text-mute",children:"Empty body."})}function R({label:e,onClick:s,children:n,pressed:a}){return(0,t.jsx)("button",{type:"button","aria-label":e,title:e,"aria-pressed":a,onClick:s,className:`rounded p-1 hover:bg-panel hover:text-ink ${a?"text-accent":"text-mute"}`,children:n})}let D=/("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*")(\s*:)?|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function L(e,t,s=""){let n="response";try{n=new URL(e).pathname.split("/").filter(Boolean).pop()||"response"}catch{}let a="json"===t?"json":"html"===t?"html":"xml"===t?"xml":"image"===t?/svg/.test(s)?"svg":s.split("/")[1]?.split(/[;+]/)[0]?.replace("jpeg","jpg")||"img":"txt";return`${n.replace(/[^\w.-]+/g,"_")}.${a}`}function O(e){return"json"===e?"application/json":"html"===e?"text/html":"xml"===e?"application/xml":"text/plain"}function A({url:e}){let s=(0,m.d)(),[a,l]=(0,c.useState)(!1),i=(0,k.f)(e);return(0,t.jsxs)("div",{role:"group","aria-label":"The address that answered",className:"mt-2 flex items-start gap-1 font-mono text-xs text-mute",children:[(0,t.jsx)("button",{type:"button",onClick:()=>l(e=>!e),"aria-expanded":a,"aria-label":a?"Show the address on one line":"Show the whole address",className:"mt-px shrink-0 rounded text-mute hover:text-ink",children:(0,t.jsx)(n.f,{size:13,"aria-hidden":!0,className:`transition-transform ${a?"rotate-90":""}`})}),(0,t.jsx)("span",{onClick:()=>l(!0),className:`min-w-0 flex-1 ${a?"break-all whitespace-pre-wrap":"cursor-pointer truncate"}`,children:i}),(0,t.jsx)("button",{type:"button",title:"Copy the URL","aria-label":"Copy the URL",onClick:()=>void navigator.clipboard.writeText(i).then(()=>s("Copied the URL","success"),()=>s("Could not copy","error")),className:"shrink-0 rounded p-0.5 text-mute hover:text-ink",children:(0,t.jsx)(r.f,{size:12,"aria-hidden":!0})})]})}e.s(["p",0,function({result:e,onSaveExample:s,extra:n,onWaitLonger:a}){var r;let l,[i,o]=(0,c.useState)("body"),d=e.logs??[],m=e.cookies??[],x=("console"!==i||d.length)&&("cookies"!==i||m.length)&&("request"!==i||e.sent)&&("checks"!==i||(e.checks??[]).length)?i:"body",p=e.checks??[],f=p.filter(e=>e.ok).length,b=Object.keys(e.headers).length,g=(l=Object.keys(r=e.headers).find(e=>"content-type"===e.toLowerCase()))?r[l]??"":"",v=(0,c.useMemo)(()=>new TextEncoder().encode(e.body).length,[e.body]),j=!e.status;return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)("span",{className:`rounded-md border px-2 py-0.5 font-mono text-sm font-medium ${S(e.status)}`,children:j?"Error":`${e.status} ${$[e.status]??""}`.trim()}),(0,t.jsx)(E,{label:"Time",value:`${e.durationMs} ms`}),j?null:(0,t.jsx)(E,{label:"Size",value:`${(0,w.L)(v)}${e.truncated?"+":""}`}),g?(0,t.jsx)(E,{label:"Type",value:g.split(";")[0]??g}):null,p.length?(0,t.jsxs)("button",{type:"button",onClick:()=>o("checks"),className:`rounded-md border px-2 py-0.5 text-xs ${f===p.length?"border-ok/40 text-ok":"border-bad/40 text-bad"}`,children:[f===p.length?"✓":"✕"," ",f,"/",p.length," checks"]}):null,n?(0,t.jsx)("span",{className:s&&!j?"":"ml-auto",children:n}):null,s&&!j?(0,t.jsx)("button",{type:"button",onClick:s,title:"Use this answer as what the mock server answers for this request",className:"ml-auto rounded-md border border-line px-2 py-0.5 text-xs text-mute hover:border-accent hover:text-ink",children:"Save as example"}):null]}),(0,t.jsx)(A,{url:e.url}),e.setup||e.dataRow?(0,t.jsxs)("p",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-mute",children:[e.setup?(0,t.jsxs)("span",{className:e.setup.ok?"":"text-bad",children:["Ran first: ",(0,t.jsx)("span",{className:"text-ink",children:e.setup.label}),e.setup.status?` \xb7 ${e.setup.status} \xb7 ${e.setup.durationMs} ms`:"",e.setup.values.map(e=>(0,t.jsxs)("span",{className:`ml-2 font-mono ${e.found?"text-ok":"text-bad"}`,title:e.found?`From ${e.from}: ${e.preview}`:`Not found: ${e.from}`,children:[e.found?"✓":"✕"," ",`{{${e.name}}}`]},e.name))]}):null,e.dataRow?(0,t.jsxs)("span",{children:["Test data: row ",e.dataRow.row," of ",e.dataRow.of.toLocaleString()]}):null]}):null,e.error?(0,t.jsx)(z,{message:e.error,onWaitLonger:a}):null,j&&e.sent?(0,t.jsxs)("details",{className:"mt-3 text-sm",children:[(0,t.jsx)("summary",{className:"cursor-pointer text-xs text-mute hover:text-ink",children:"What was sent"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(h.x,{sent:e.sent})})]}):null,j?null:(0,t.jsxs)("div",{className:"mt-3 flex min-h-0 flex-1 flex-col",children:[(0,t.jsx)(u.i,{id:"response",label:"Response",value:x,onChange:o,items:[{id:"body",label:"Body"},{id:"headers",label:"Headers",badge:b||void 0},...m.length?[{id:"cookies",label:"Cookies",badge:m.length}]:[],...p.length?[{id:"checks",label:"Checks",badge:(0,t.jsxs)("span",{className:f===p.length?"text-ok":"text-bad",children:[f,"/",p.length]})}]:[],...e.sent?[{id:"request",label:"Request sent"}]:[],...d.length?[{id:"console",label:"Console",badge:d.length}]:[]]}),(0,t.jsx)("div",{...(0,u.q)("response",x),className:"flex min-h-0 flex-1 flex-col pt-3",children:"body"===x?e.streamId?(0,t.jsx)(N,{id:e.streamId}):(0,t.jsx)(T,{body:e.body,contentType:g,truncated:e.truncated,url:e.url,base64:e.bodyBase64}):"cookies"===x?(0,t.jsx)(h.B,{cookies:m}):"console"===x?(0,t.jsx)(q,{logs:d}):"request"===x&&e.sent?(0,t.jsx)(h.x,{sent:e.sent}):"checks"===x?(0,t.jsx)("ul",{className:"space-y-1.5",children:p.map((e,s)=>(0,t.jsxs)("li",{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-sm ${e.ok?"border-ok/30 bg-ok/5":"border-bad/40 bg-bad/10"}`,children:[(0,t.jsx)("span",{className:e.ok?"text-ok":"text-bad","aria-hidden":!0,children:e.ok?"✓":"✕"}),(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block font-mono text-[13px] text-ink",children:e.name}),!e.ok&&e.detail?(0,t.jsx)("span",{className:"block text-xs text-mute",children:e.detail}):null]}),(0,t.jsx)("span",{className:`ml-auto shrink-0 text-xs ${e.ok?"text-ok":"text-bad"}`,children:e.ok?"pass":"fail"})]},s))}):(0,t.jsx)(M,{headers:e.headers})})]})]})},"Z",0,S],60566),e.i(24856);var P=e.i(99112),U=e.i(78451),F=e.i(59780),I=e.i(87078),B=e.i(35559),W=e.i(56003);let _={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};_.node;let H=(0,W.f)(_),V={name:"lock",size:24,node:[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]};V.node;let K=(0,W.f)(V);e.s(["f",0,K],16788);var X=e.i(2810),J=e.i(54812),Z=e.i(1326),G=e.i(62620),Y=e.i(39170),Q=e.i(17847),ee=e.i(37837),et=e.i(80707);e.i(42674);var es=e.i(5305),en=e.i(65238),ea=e.i(48181),er=e.i(6278);let el=()=>globalThis.crypto?.randomUUID?.()??`env-${Date.now().toString(36)}`;function ei({onClose:e,startNew:s=!1}){let n=(0,m.d)(),a=(0,Y.L)(),{environments:l,activeEnv:i,setActiveEnv:o,saveEnvironments:d,index:u}=(0,er.U)(),[x,h]=(0,c.useState)(()=>structuredClone(l)),[p,f]=(0,c.useState)(i?.id??l[0]?.id??null),[b,g]=(0,c.useState)(!1),v=(0,c.useRef)(null),j=x.find(e=>e.id===p)??null,y=JSON.stringify(x)!==JSON.stringify(l);(0,c.useEffect)(()=>{let e=document.activeElement;return s&&w(),v.current?.querySelector("input,button")?.focus(),()=>e?.focus()},[]);let N=(e,t)=>h(s=>s.map(s=>s.id===e?{...s,...t}:s));function w(e){let t=e?{id:el(),name:`${e.name} copy`,variables:structuredClone(e.variables)}:{id:el(),name:x.length?`Environment ${x.length+1}`:"DEV",variables:[{key:"baseUrl",value:"",secret:!1}]};h(e=>[...e,t]),f(t.id)}async function k(){(!y||await a({title:"Discard changes to environments?",confirmLabel:"Discard",tone:"danger"}))&&e()}async function C(){g(!0);try{await d(x),i&&!x.some(e=>e.id===i.id)&&o(null),n("Environments saved","success"),e()}catch(e){n(e instanceof Error?e.message:"Could not save environments","error")}finally{g(!1)}}return(0,t.jsx)("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/50 p-4 backdrop-blur-sm",onMouseDown:e=>e.target===e.currentTarget&&void k(),children:(0,t.jsxs)("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":"Environments",onKeyDown:e=>"Escape"===e.key&&void k(),className:"flex max-h-[85vh] w-full max-w-4xl flex-col overflow-hidden rounded-xl border border-line bg-panel shadow-2xl",children:[(0,t.jsxs)("header",{className:"flex items-center justify-between border-b border-line px-5 py-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium text-ink",children:"Environments"}),(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Use ",(0,t.jsx)("code",{className:"font-mono text-ink",children:"{{name}}"})," in the URL, params, headers, body, or auth. Saved to environments.json in your app-data folder."]})]}),(0,t.jsx)("button",{type:"button","aria-label":"Close",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>void k(),children:(0,t.jsx)(G.X,{size:16})})]}),(0,t.jsxs)("div",{className:"grid min-h-0 flex-1 md:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,t.jsxs)("nav",{"aria-label":"Environment list",className:"space-y-1 overflow-auto border-line p-3 md:border-r",children:[x.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>f(e.id),"aria-current":e.id===p?"true":void 0,className:`block w-full truncate rounded-md px-2 py-1.5 text-left text-sm ${e.id===p?"bg-accent-dim text-ink":"text-mute hover:bg-panel-2 hover:text-ink"}`,children:[e.name,(0,t.jsx)("span",{className:"ml-1 text-xs text-mute",children:e.variables.length})]},e.id)),(0,t.jsxs)("button",{type:"button",onClick:()=>w(),className:"mt-2 inline-flex items-center gap-1 text-xs text-accent hover:underline",children:[(0,t.jsx)(X.f,{size:12,"aria-hidden":!0})," New environment"]})]}),(0,t.jsxs)("section",{className:"min-h-0 space-y-4 overflow-auto p-4",children:[j?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("label",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"sr-only",children:"Environment name"}),(0,t.jsx)("input",{value:j.name,onChange:e=>N(j.id,{name:e.target.value}),className:"input text-base font-medium"})]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:()=>w(j),children:[(0,t.jsx)(r.f,{size:13})," Duplicate"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1.5 text-xs",onClick:()=>{h(e=>e.filter(e=>e.id!==j.id)),f(x.find(e=>e.id!==j.id)?.id??null)},children:[(0,t.jsx)(Z.f,{size:13})," Delete"]})]}),(0,t.jsxs)("label",{className:"flex items-start gap-2 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",className:"mt-1 accent-[var(--accent)]",checked:!!j.production,onChange:e=>N(j.id,{production:e.target.checked||void 0})}),(0,t.jsxs)("span",{children:["This is production",(0,t.jsx)("span",{className:"block text-xs text-mute",children:"The top of the window turns red while it's in use, and the app asks before a request that changes data, or a performance test."})]})]}),(0,t.jsx)(ec,{vars:j.variables,onPatch:(e,t)=>j&&N(j.id,{variables:j.variables.map((s,n)=>n===e?{...s,...t}:s)}),onChange:e=>N(j.id,{variables:e})}),(0,t.jsxs)("p",{className:"flex items-start gap-1.5 text-xs text-mute",children:[(0,t.jsx)(K,{size:12,className:"mt-0.5 shrink-0","aria-hidden":!0}),u?.secretsPersistent?"Secret values are encrypted on this computer and never written to environments.json.":"Secret values are never written to disk. In this browser setup they are kept by the engine until it restarts; the desktop app encrypts them."]})]}):(0,t.jsxs)("div",{className:"py-12 text-center text-sm text-mute",children:["No environments yet. Create one for each place you test — DEV, UAT, PROD.",(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("button",{type:"button",className:"btn btn-primary text-sm",onClick:()=>w(),children:[(0,t.jsx)(X.f,{size:14})," New environment"]})})]}),(0,t.jsx)(eo,{onCopied:e=>n(`Copied ${e}`,"success")})]})]}),(0,t.jsxs)("footer",{className:"flex justify-end gap-2 border-t border-line px-5 py-3",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary text-sm",onClick:()=>void k(),children:"Cancel"}),(0,t.jsx)("button",{type:"button",className:"btn btn-primary text-sm",disabled:!y||b,onClick:()=>void C(),children:"Save environments"})]})]})})}function eo({onCopied:e}){return(0,t.jsxs)("details",{className:"rounded-md border border-line bg-panel-2/40 px-3 py-2 text-sm",children:[(0,t.jsxs)("summary",{className:"cursor-pointer text-xs font-medium text-ink",children:["Built-in values ",(0,t.jsx)("span",{className:"font-normal text-mute",children:"— made anew for every request, in performance tests too"})]}),(0,t.jsx)("ul",{className:"mt-2 space-y-1",children:P.Z.map(s=>(0,t.jsxs)("li",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsxs)("button",{type:"button",title:"Copy",onClick:()=>void navigator.clipboard?.writeText(s.example).then(()=>e(s.example)),className:"inline-flex shrink-0 items-center gap-1 rounded border border-line px-1.5 py-0.5 font-mono text-accent hover:border-accent",children:[s.example,(0,t.jsx)(r.f,{size:11,"aria-hidden":!0})]}),(0,t.jsx)("span",{className:"text-mute",children:s.description})]},s.name))}),(0,t.jsxs)("p",{className:"mt-2 text-xs text-mute",children:["In a JSON body put them in quotes, like ",(0,t.jsx)("code",{className:"font-mono text-ink",children:'"id": "{{$uuid}}"'}),"."]})]})}function ec({vars:e,onPatch:s,onChange:n}){let[a,r]=(0,c.useState)(new Set),l=new Set(e.map(e=>e.key.trim()).filter((e,t,s)=>e&&s.indexOf(e)!==t));return(0,t.jsxs)("div",{className:"overflow-hidden rounded-md border border-line",children:[(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)_5.5rem_2rem] bg-panel-2 text-xs text-mute",children:[(0,t.jsx)("span",{className:"px-2.5 py-1.5",children:"Variable"}),(0,t.jsx)("span",{className:"border-l border-line px-2.5 py-1.5",children:"Value"}),(0,t.jsx)("span",{className:"border-l border-line px-2.5 py-1.5",children:"Secret"}),(0,t.jsx)("span",{})]}),e.map((i,o)=>{let c=i.key&&!/^[A-Za-z_][\w.-]*$/.test(i.key)||l.has(i.key.trim());return(0,t.jsxs)("div",{className:"grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)_5.5rem_2rem] border-t border-line",children:[(0,t.jsx)("input",{"aria-label":`Variable ${o+1} name`,"aria-invalid":c||void 0,title:c?"Letters, digits, _ . - ; must start with a letter or _ ; must be unique":void 0,value:i.key,onChange:e=>s(o,{key:e.target.value}),placeholder:"baseUrl",className:`min-w-0 bg-transparent px-2.5 py-1.5 font-mono text-[13px] outline-none focus:bg-panel-2 ${c?"text-bad":"text-ink"}`}),(0,t.jsxs)("span",{className:"relative flex min-w-0 border-l border-line",children:[(0,t.jsx)("input",{"aria-label":`Variable ${o+1} value`,type:i.secret&&!a.has(o)?"password":"text",autoComplete:"off",value:i.value,onChange:e=>s(o,{value:e.target.value}),className:"min-w-0 flex-1 bg-transparent px-2.5 py-1.5 font-mono text-[13px] text-ink outline-none focus:bg-panel-2"}),i.secret?(0,t.jsx)("button",{type:"button","aria-label":a.has(o)?"Hide value":"Show value",onClick:()=>r(e=>{let t=new Set(e);return t.has(o)?t.delete(o):t.add(o),t}),className:"px-2 text-mute hover:text-ink",children:a.has(o)?(0,t.jsx)(B.f,{size:13}):(0,t.jsx)(I.f,{size:13})}):null]}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 border-l border-line px-2.5 text-xs text-mute",children:[(0,t.jsx)("input",{type:"checkbox",checked:i.secret,onChange:e=>s(o,{secret:e.target.checked}),className:"accent-[var(--accent)]"}),"secret"]}),(0,t.jsx)("button",{type:"button","aria-label":`Remove ${i.key||`variable ${o+1}`}`,onClick:()=>n(e.filter((e,t)=>t!==o)),className:"grid place-items-center text-mute hover:text-bad",children:(0,t.jsx)(G.X,{size:13})})]},o)}),(0,t.jsxs)("button",{type:"button",onClick:()=>n([...e,{key:"",value:"",secret:!1}]),className:"flex w-full items-center gap-1 border-t border-line px-2.5 py-1.5 text-xs text-accent hover:bg-panel-2",children:[(0,t.jsx)(X.f,{size:12,"aria-hidden":!0})," Add variable"]})]})}e.s(["f",0,function({drafts:e,collections:n=[],compact:a=!1}){let{environments:r,activeEnv:l,setActiveEnv:i,vars:o,savedValues:d,clearSavedValues:u}=(0,er.U)(),m=Object.keys(d),[x,h]=(0,c.useState)(!1),[p,f]=(0,c.useState)(!1),b=(0,c.useRef)(null),g=(0,c.useMemo)(()=>{let t=new Set;for(let s of e){let e=new Set((0,es.h)(s)),n=[s.url,s.bodyText,s.token,s.username,s.password,s.apiValue,...s.params.map(e=>e.value),...s.headers.map(e=>e.value)].join(" ");(0,U.n)(n).forEach(s=>!e.has(s)&&t.add(s))}return[...t]},[e]),j=(0,en.K)(n),y=g.filter(e=>!(e in o)&&!j.has(e));if([...r.map(e=>({value:e.id,label:e.name,hint:`${e.variables.length} variable${1===e.variables.length?"":"s"}`}))],a){let e=ea.q[(0,ea.v)(l)];return(0,t.jsxs)("div",{className:"flex items-center gap-1 text-xs",children:[y.length?(0,t.jsxs)("span",{role:"status",className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-warn",title:`${y.map(e=>`{{${e}}}`).join(", ")} not defined${l?` in ${l.name}`:" — pick an environment"}`,children:[(0,t.jsx)(v.f,{size:12,"aria-hidden":!0}),(0,t.jsx)("span",{className:"max-w-40 truncate",children:y.map(e=>`{{${e}}}`).join(", ")})]}):null,m.length?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-mute",title:m.map(e=>`{{${e}}} — saved from “${d[e].from}”`).join("\n"),children:[(0,t.jsxs)("span",{className:"font-mono text-accent",children:[m.length," saved"]}),(0,t.jsx)("button",{type:"button",onClick:u,"aria-label":"Clear the values saved from answers",className:"rounded p-0.5 hover:text-ink",children:(0,t.jsx)(G.X,{size:11,"aria-hidden":!0})})]}):null,(0,t.jsxs)("button",{ref:b,type:"button",role:"combobox","aria-label":"Environment","aria-haspopup":"listbox","aria-expanded":p,onClick:()=>f(e=>!e),className:"inline-flex max-w-52 items-center gap-1.5 rounded-md border border-line bg-panel-2 px-2 py-1 text-xs text-ink hover:border-mute",children:[(0,t.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:l?e??"var(--ok)":"var(--line)"},"aria-hidden":!0}),(0,t.jsx)("span",{className:"truncate",children:l?.name??"No environment"}),(0,t.jsx)(s.f,{size:12,className:"shrink-0 text-mute","aria-hidden":!0})]}),(0,t.jsx)(ee.f,{anchor:b,open:p,onClose:()=>f(!1),label:"Environments",width:260,children:(0,t.jsxs)("div",{className:"-m-2",children:[(0,t.jsx)(Q.U,{children:"Environment"}),(0,t.jsx)("ul",{role:"listbox","aria-label":"Environment",children:[{id:"",name:"No environment",count:-1,production:!1},...r.map(e=>({id:e.id,name:e.name,count:e.variables.length,production:e.production}))].map(e=>{let s=(l?.id??"")===e.id,n=e.id?ea.q[(0,ea.v)(e)]??"var(--ok)":"var(--line)";return(0,t.jsx)("li",{role:"option","aria-selected":s,children:(0,t.jsxs)("button",{type:"button",onClick:()=>{i(e.id||null),f(!1)},className:"flex w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm text-ink hover:bg-panel-2",children:[(0,t.jsx)("span",{className:"flex w-4 justify-center","aria-hidden":!0,children:(0,t.jsx)("span",{className:"h-2 w-2 rounded-full",style:{background:n}})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:[e.name,(0,t.jsx)("span",{className:"block text-[11px] text-mute",children:e.count<0?"Only built-in variables":`${e.count} variable${1===e.count?"":"s"}`})]}),s?(0,t.jsx)(F.f,{size:14,className:"shrink-0 text-accent","aria-hidden":!0}):null]})},e.id||"none")})}),(0,t.jsx)(Q.Z,{}),(0,t.jsx)(Q.d,{icon:X.f,label:"New environment…",onSelect:()=>{f(!1),h("new")}}),(0,t.jsx)(Q.d,{icon:J.f,label:"Manage environments…",onSelect:()=>{f(!1),h("manage")}})]})}),(0,t.jsx)("button",{type:"button",onClick:()=>h("manage"),"aria-label":"Manage environments",title:"Manage environments",className:"rounded p-1.5 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(H,{size:14,"aria-hidden":!0})}),x?(0,t.jsx)(ei,{startNew:"new"===x,onClose:()=>h(!1)}):null]})}return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-mute",children:["Environment",(0,t.jsx)(et.f,{label:"Environment",value:l?.id??"",onChange:e=>i(e||null),minWidth:200,options:[{value:"",label:"None",hint:"Only built-in variables"},...r.map(e=>({value:e.id,label:e.name,hint:`${e.variables.length} variable${1===e.variables.length?"":"s"}`}))],className:"rounded-md border border-line bg-panel-2 px-2 py-1 text-xs text-ink hover:border-mute focus-visible:border-accent focus-visible:outline-none"})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>h("manage"),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-mute hover:text-ink",children:[(0,t.jsx)(J.f,{size:12,"aria-hidden":!0})," Manage"]}),g.length>0?y.length?(0,t.jsxs)("span",{className:"text-warn",role:"status",children:[y.map(e=>`{{${e}}}`).join(", ")," not defined",l?` in ${l.name}`:" — pick an environment"]}):(0,t.jsxs)("span",{className:"text-mute",children:["Uses ",g.map(e=>`{{${e}}}`).join(", ")]}):null,m.length?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-mute",title:m.map(e=>`{{${e}}} — saved from “${d[e].from}”`).join("\n"),children:["Saved from answers: ",(0,t.jsx)("span",{className:"font-mono text-accent",children:m.map(e=>`{{${e}}}`).join(", ")}),(0,t.jsx)("button",{type:"button",onClick:u,className:"text-mute underline-offset-2 hover:text-ink hover:underline",children:"Clear"})]}):null,x?(0,t.jsx)(ei,{onClose:()=>h(!1)}):null]})},"L",0,ec],68228);var ed=e.i(49257);let eu={name:"file-plus-corner",size:24,node:[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],aliases:["file-plus-2"]};eu.node;let em=(0,W.f)(eu);var ex=e.i(62338),eh=e.i(87891);let ep={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]};ep.node;let ef=(0,W.f)(ep);var eb=e.i(97471),eg=e.i(59904);let ev={name:"import",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]};ev.node;let ej=(0,W.f)(ev);var ey=e.i(77497),eN=e.i(61318),ew=e.i(80714),ek=e.i(92368),eC=e.i(67531),e$=e.i(2552),eS=e.i(53798),eq=e.i(67217),eE=e.i(15556),ez=e.i(74749),eM=e.i(97942),eT=e.i(91549),eR=e.i(41997),eD=e.i(97424),eL=e.i(36e3),eO=e.i(55925),eA=e.i(1359),eP=e.i(22079),eU=e.i(69159),eF=e.i(23227),eI=e.i(24448);function eB({value:e,parents:s,folder:n,onChange:a}){let r,l=(0,eF.l)(),i=[...s].reverse().find(e=>e.settings.contract);return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-xs text-mute",children:"Each answer inside is checked against this OpenAPI description, on Send and in collection runs: is the operation in it, is the status documented, does the body match the documented schema. That's a contract test."}),(0,t.jsxs)("label",{className:"block space-y-1",children:[(0,t.jsx)("span",{className:"text-sm text-ink",children:"API description"}),(0,t.jsxs)("select",{className:"input",value:e??"",onChange:e=>a(e.target.value||void 0),children:[(0,t.jsx)("option",{value:"",children:i?`From ${i.path}: ${r=i.settings.contract,l?.find(e=>e.id===r)?.name??"a description that was removed"}`:"None"}),l?.map(e=>(0,t.jsxs)("option",{value:e.id,children:[e.name,e.error?" (doesn't read)":` — ${e.operations} operations`]},e.id))]})]}),l&&!l.length?(0,t.jsx)("p",{className:"text-xs text-mute",children:"There are none in this project yet."}):null,e??i?.settings.contract?(0,t.jsx)(eU._,{id:e??i?.settings.contract,folder:n}):null,(0,t.jsx)("button",{type:"button",className:"text-xs text-accent hover:underline",onClick:()=>(0,eP.A)(e??i?.settings.contract),children:l&&!l.length?"Add an API description…":"API descriptions — add one, and see which operations have a request"})]})}function eW({path:e,onClose:s}){let n=(0,m.d)(),{refresh:a}=(0,er.U)(),[r,l]=(0,c.useState)(null),[i,o]=(0,c.useState)([]),[d,x]=(0,c.useState)([]),[h,p]=(0,c.useState)("auth"),[f,b]=(0,c.useState)(!1);async function g(){if(r&&!f){b(!0);try{await en.X.save(e,{...r,headers:r.headers.filter(e=>e.key.trim()),variables:r.variables.filter(e=>e.key.trim())}),await a(),n(`Saved the settings of ${e}`,"success"),s()}catch(e){n(e instanceof Error?e.message:"Could not save","error")}finally{b(!1)}}}(0,c.useEffect)(()=>{let t=!0;return Promise.all([en.X.get(e),en.X.chain((0,U.L)(e))]).then(([e,s])=>{t&&(l(e.settings),o(e.secretsMissing??[]),x(s))}).catch(e=>{t&&(n(e instanceof Error?e.message:"Could not open the folder","error"),l((0,U.I)()))}),()=>{t=!1}},[e,n]);let v=[...d].reverse().find(e=>"inherit"!==e.settings.auth.authMode),j=r?{headers:r.headers.filter(e=>e.key.trim()&&!1!==e.enabled).length,variables:r.variables.length}:{headers:0,variables:0};return(0,t.jsx)("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/50 p-4 backdrop-blur-sm",onMouseDown:e=>e.target===e.currentTarget&&s(),children:(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"folder-settings-title",onKeyDown:e=>"Escape"===e.key&&s(),className:"flex max-h-[85vh] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-line bg-panel shadow-2xl",children:[(0,t.jsxs)("header",{className:"flex items-start justify-between gap-3 border-b border-line px-5 py-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("h2",{id:"folder-settings-title",className:"truncate text-base font-medium text-ink",children:["Folder settings · ",e]}),(0,t.jsx)("p",{className:"text-xs text-mute",children:"Every request inside — and inside its subfolders — uses these. A request's own value wins."})]}),(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,t.jsx)(eI.U,{topic:"sending-requests#folders-sign-in-once"}),(0,t.jsx)("button",{type:"button","aria-label":"Close",className:"rounded p-1 text-mute hover:text-ink",onClick:s,children:(0,t.jsx)(G.X,{size:16})})]})]}),r?(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:[(0,t.jsx)(u.i,{id:"folder-settings",label:"Folder settings",value:h,onChange:p,items:[{id:"auth",label:"Auth"},{id:"headers",label:"Headers",badge:j.headers||void 0},{id:"variables",label:"Variables",badge:j.variables||void 0},{id:"scripts",label:"Scripts",badge:+!!r.preScript.trim()+ +!!r.postScript.trim()||void 0},{id:"contract",label:"API description",badge:r.contract?1:void 0},{id:"docs",label:"Docs",badge:r.description?.trim()?"✓":void 0}]}),(0,t.jsxs)("div",{...(0,u.q)("folder-settings",h),className:"pt-4",children:["auth"===h?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Requests set to ",(0,t.jsx)("span",{className:"text-ink",children:"Auth → From folder"})," (the default for new requests) use this — sign in once here instead of in every request."]}),(0,t.jsx)(eR.d,{value:r.auth,onChange:e=>l({...r,auth:{...r.auth,...e}}),inheritLabel:"From parent",defaults:Object.fromEntries([...d.flatMap(e=>e.settings.variables),...r.variables].map(e=>[e.key,e.value])),inheritNote:v&&"none"!==v.settings.auth.authMode?(0,t.jsxs)(t.Fragment,{children:["Passes on the ",(0,t.jsx)("span",{className:"text-ink",children:(0,eR.S)(v.settings.auth.authMode)})," of"," ",(0,t.jsx)("span",{className:"text-ink",children:v.path}),"."]}):(0,t.jsx)(t.Fragment,{children:"No folder above sets auth, so this folder passes none down."}),secretNote:"Use {{token}} to take it from the environment, or type it — it's kept encrypted on this computer, never in the folder's file."}),i.some(e=>!e.startsWith("var:"))?(0,t.jsxs)("p",{className:"text-xs text-warn",children:["The saved ",i.filter(e=>!e.startsWith("var:")).join(", ")," isn't available on this computer — enter it again."]}):null]}):null,"headers"===h?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(eL.f,{rows:r.headers,onChange:e=>l({...r,headers:e}),keyPlaceholder:"Header",valuePlaceholder:"Value",noun:"header"}),(0,t.jsx)("p",{className:"text-xs text-mute",children:"Sent with every request inside. An inner folder's or a request's header with the same name replaces it."})]}):null,"scripts"===h?(0,t.jsx)(eO.f,{draft:r,onChange:l,forFolder:!0}):null,"docs"===h?(0,t.jsx)(eA.f,{value:r.description??"",onChange:e=>l({...r,description:e}),forFolder:!0}):null,"contract"===h?(0,t.jsx)(eB,{value:r.contract,parents:d,folder:e,onChange:e=>l({...r,contract:e})}):null,"variables"===h?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(ec,{vars:r.variables,onPatch:(e,t)=>l({...r,variables:r.variables.map((s,n)=>n===e?{...s,...t}:s)}),onChange:e=>l({...r,variables:e})}),(0,t.jsxs)("p",{className:"text-xs text-mute",children:["Defaults for ",(0,t.jsx)("code",{className:"font-mono text-ink",children:"{{name}}"})," in the requests inside. The chosen environment wins when it has the same name — so a folder can say"," ",(0,t.jsx)("code",{className:"font-mono text-ink",children:"basePath = /v2"})," and the environment picks the server."]}),i.some(e=>e.startsWith("var:"))?(0,t.jsxs)("p",{className:"text-xs text-warn",children:["Secret values not available on this computer: ",i.filter(e=>e.startsWith("var:")).map(e=>e.slice(4)).join(", ")," — enter them again."]}):null]}):null]})]}):(0,t.jsx)("div",{className:"grid place-items-center p-10 text-mute",children:(0,t.jsx)(eD.f,{className:"animate-spin",size:18,"aria-label":"Loading"})}),(0,t.jsxs)("footer",{className:"flex justify-end gap-2 border-t border-line px-5 py-3",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:s,disabled:f,children:"Cancel"}),(0,t.jsxs)("button",{type:"button",className:"btn btn-primary",onClick:()=>void g(),disabled:!r||f,children:[f?(0,t.jsx)(eD.f,{size:14,className:"animate-spin"}):null,"Save folder settings"]})]})]})})}var e_=e.i(14168),eH=e.i(2603);let eV={GET:"text-ok",POST:"text-warn",PUT:"text-accent",PATCH:"text-accent",DELETE:"text-bad"},eK="atc:request-moved",eX="application/x-atc-requests";function eJ({activeId:e,onOpen:a,allowDelete:l=!0,newFolder:o,onNewFolderDone:d}){let u=(0,m.d)(),x=(0,Y.L)(),{index:h,refresh:p}=(0,er.U)(),[f,b]=(0,c.useState)({});(0,c.useEffect)(()=>{fetch("/engine/responses",{cache:"no-store"}).then(e=>e.json()).then(e=>b(e.requests??{})).catch(()=>void 0)},[h]);let[g,v]=(0,c.useState)(""),[j,y]=(0,c.useState)(new Set),[N,k]=(0,c.useState)(null),[C,$]=(0,c.useState)(null),[S,q]=(0,c.useState)(null),[E,z]=(0,c.useState)(new Set),M=(0,c.useRef)(null),[T,R]=(0,c.useState)(null),[D,L]=(0,c.useState)(null),[O,A]=(0,c.useState)(null),P=h?.requests??[],F=h?.folders??[],I=g.trim().toLowerCase(),B=(0,c.useMemo)(()=>I?P.filter(e=>`${e.name} ${e.collection} ${e.url} ${e.method}`.toLowerCase().includes(I)):P,[P,I]),W=(0,c.useMemo)(()=>(function(e,t,s){let n={path:"",name:"",folders:[],requests:[],summary:null},a=new Map([["",n]]),r=e=>{let t=a.get(e);if(t)return t;let s={path:e,name:(0,U.g)(e),folders:[],requests:[],summary:null};return a.set(e,s),r((0,U.L)(e)).folders.push(s),s};if(s)for(let e of t)r(e.path);for(let t of e)r(t.collection).requests.push(t);for(let e of t){let t=a.get(e.path);t&&(t.summary=e)}let l=e=>{e.folders.sort((e,t)=>e.name.localeCompare(t.name)),e.folders.forEach(l)};return l(n),n})(B,F,!I),[B,F,I]);async function _(e){try{let t=await er.v.get(e);a(t),t.secretsMissing?.length&&u(`Re-enter the ${t.secretsMissing.join(", ")} — secrets are kept only until the engine restarts in this setup`,"info")}catch(e){u(e instanceof Error?e.message:"Could not open the request","error")}}async function H(e,t){let s=0;try{for(let n of e){let e=await er.v.get(n),a=t.name?.trim()||e.name,r=t.collection??e.collection;if(a===e.name&&r===e.collection)continue;let l=await er.v.update(n,{name:a,collection:r,request:e.request});window.dispatchEvent(new CustomEvent(eK,{detail:{id:n,name:l.name,collection:l.collection}})),s++}await p(),void 0!==t.collection&&s&&u(`Moved ${s} request${1===s?"":"s"} to ${t.collection||"the top level"}`,"success")}catch(e){u(e instanceof Error?e.message:"Could not do that","error")}}async function V(e){for(let t of e)await er.v.remove(t).catch(()=>void 0);z(new Set),await p(),u(`${e.length} request${1===e.length?"":"s"} moved to Trash — restore them from Trash in the sidebar`,"success")}(0,c.useEffect)(()=>{o&&k({kind:"new",parent:""})},[o]);let K=e=>l?{onDragOver:t=>{t.dataTransfer.types.includes(eX)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="move",A(e))},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||A(t=>t===e?null:t)},onDrop:t=>{t.preventDefault(),t.stopPropagation(),A(null);try{let s=JSON.parse(t.dataTransfer.getData(eX));Array.isArray(s)&&s.length&&(z(new Set),H(s,{collection:e}))}catch{}}}:{};async function X(e){try{let t=await er.v.create({name:"New request",collection:e,request:(0,es.t)()});y(t=>{let s=new Set(t);return s.delete(e),s}),await p(),await _(t.id),R(t.id)}catch(e){u(e instanceof Error?e.message:"Could not make the request","error")}}async function J(e){try{let t=await er.v.get(e.id);await er.v.create({name:`${e.name} copy`.slice(0,200),collection:e.collection,request:t.request}),await p(),u(`Duplicated “${e.name}”`,"success")}catch(e){u(e instanceof Error?e.message:"Could not duplicate it","error")}}async function Q(e){try{await er.v.remove(e.id),await p(),u(`“${e.name}” moved to Trash — restore it from Trash in the sidebar`,"success")}catch(e){u(e instanceof Error?e.message:"Could not delete it","error")}}async function ee(e){if(k(null),d?.(),!N)return;let t=e.trim();if(t)try{if("new"===N.kind){let e=(0,U.y)(N.parent?`${N.parent}/${t}`:t);await en.X.save(e,(0,U.I)()),y(e=>{let t=new Set(e);return t.delete(N.parent),t})}else{let e=(0,U.y)(t.includes("/")?t:(0,U.L)(N.path)?`${(0,U.L)(N.path)}/${t}`:t);e!==N.path&&await en.X.move(N.path,e)}await p()}catch(e){u(e instanceof Error?e.message:"Could not do that","error")}}async function et(e){if(await x({title:`Delete the folder “${e}”?`,body:"Its settings and empty subfolders are removed. A folder that still has requests can't be deleted — move or delete them first.",confirmLabel:"Delete folder",tone:"danger"}))try{await en.X.remove(e),await p()}catch(e){u(e instanceof Error?e.message:"Could not delete the folder","error")}}let ea=s=>(0,t.jsx)("ul",{children:s.map(s=>{let n=s.id===e,a=E.has(s.id);return T===s.id?(0,t.jsx)("li",{className:"py-0.5 pl-1",children:(0,t.jsx)("input",{autoFocus:!0,defaultValue:s.name,"aria-label":`New name for ${s.name}`,className:"input py-1 text-[13px]",onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&e.target.blur(),"Escape"===e.key&&R(null)},onBlur:e=>{R(null),H([s.id],{name:e.target.value})}})},s.id):(0,t.jsxs)("li",{draggable:l,onDragStart:e=>{let t=a?[...E]:[s.id];e.dataTransfer.setData(eX,JSON.stringify(t)),e.dataTransfer.effectAllowed="move"},onContextMenu:e=>{l&&(e.preventDefault(),q(`r:${s.id}`))},className:`group flex items-center rounded-md ${n?"bg-accent-dim shadow-[inset_2px_0_0_var(--accent)]":a?"bg-panel-2 ring-1 ring-accent/50 ring-inset":"hover:bg-panel-2"}`,children:[(0,t.jsxs)("button",{type:"button",onClick:e=>(function(e,t){if(l&&(e.ctrlKey||e.metaKey)){z(e=>{let s=new Set(e);return s.has(t.id)?s.delete(t.id):s.add(t.id),s}),M.current=t.id;return}if(l&&e.shiftKey&&M.current){let e=function e(t){return!j.has(t.path)||I||""===t.path?[...t.folders.flatMap(e),...t.requests.map(e=>e.id)]:[]}(W),[s,n]=[e.indexOf(M.current),e.indexOf(t.id)].sort((e,t)=>e-t);if(s>=0)return z(new Set(e.slice(s,n+1)))}z(new Set),M.current=t.id,_(t.id)})(e,s),onKeyDown:e=>{l&&("F2"===e.key?(e.preventDefault(),R(s.id)):"Delete"===e.key?(e.preventDefault(),a&&E.size>1?V([...E]):Q(s)):(e.ctrlKey||e.metaKey)&&"d"===e.key.toLowerCase()&&(e.preventDefault(),J(s)))},"aria-current":n?"true":void 0,"aria-pressed":l&&E.size?a:void 0,title:f[s.id]?`${s.url}
2
+ Earlier answers kept: ${(0,w.L)(f[s.id])}`:s.url,className:"tree-row flex min-w-0 flex-1 items-center gap-2 py-1 pr-1 pl-2 text-left",children:[(0,t.jsx)("span",{className:`w-10 shrink-0 font-mono text-[10.5px] font-semibold tracking-wide ${eV[s.method]??"text-mute"}`,children:"DELETE"===s.method?"DEL":s.method}),(0,t.jsx)("span",{className:`min-w-0 truncate text-[13px] ${n?"text-ink":"text-ink/90"}`,children:s.name})]}),l?(0,t.jsx)(eY,{label:`Actions for ${s.name}`,open:S===`r:${s.id}`,onOpenChange:e=>q(e?`r:${s.id}`:null),items:[{icon:ed.f,label:"Open",hint:"Enter",run:()=>void _(s.id)},{icon:ew.f,label:"Rename",hint:"F2",run:()=>R(s.id)},{icon:r.f,label:"Duplicate",hint:"Ctrl+D",run:()=>void J(s)},{icon:ef,label:"Move to…",run:()=>L([s.id])},"separator",{icon:eg.f,label:"Version history",run:()=>(0,eM.g)(s.id)},{icon:ex.f,label:"Export…",run:()=>(0,eT.q)({kind:"request",id:s.id,name:s.name,collection:s.collection})},"separator",{icon:Z.f,label:"Move to Trash",hint:"Del",run:()=>void Q(s),danger:!0}]}):null]},s.id)})}),el=e=>{var a;let r=j.has(e.path)&&!I,i=(a=e.summary)?[a.auth?(0,eR.S)(a.auth):"",a.headers?`${a.headers} header${1===a.headers?"":"s"}`:"",a.variables?`${a.variables} variable${1===a.variables?"":"s"}`:""].filter(Boolean).join(" · "):"";return(0,t.jsxs)("div",{className:"mb-0.5",children:[N?.kind==="rename"&&N.path===e.path?(0,t.jsx)(eZ,{initial:e.path,label:`New name for ${e.path}`,onDone:e=>void ee(e),hint:"Use / to move it into another folder"}):(0,t.jsxs)("div",{...K(e.path),className:`group/folder flex items-center rounded-md ${O===e.path?"bg-accent-dim ring-1 ring-accent ring-inset":"hover:bg-panel-2"}`,onContextMenu:t=>{l&&(t.preventDefault(),q(`f:${e.path}`))},children:[(0,t.jsxs)("button",{type:"button","aria-expanded":!r,onClick:()=>{let t;return t=e.path,y(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},title:i?`Passes down: ${i}`:e.path,className:"tree-row flex min-w-0 flex-1 items-center gap-1.5 py-1 pr-1 pl-1 text-left text-[13px] font-medium text-ink",children:[r?(0,t.jsx)(n.f,{size:13,"aria-hidden":!0,className:"shrink-0 text-mute"}):(0,t.jsx)(s.f,{size:13,"aria-hidden":!0,className:"shrink-0 text-mute"}),(0,t.jsx)(eh.f,{size:14,"aria-hidden":!0,className:"shrink-0 text-mute"}),(0,t.jsx)("span",{className:"truncate",children:e.name}),e.summary?.auth?(0,t.jsx)(ey.f,{size:11,className:"shrink-0 text-accent","aria-label":`signs in with ${(0,eR.S)(e.summary.auth)}`}):null,(0,t.jsx)("span",{className:"ml-auto shrink-0 rounded-full bg-panel-2 px-1.5 text-[11px] font-normal text-mute group-hover/folder:bg-panel",children:function e(t){return t.requests.length+t.folders.reduce((t,s)=>t+e(s),0)}(e)})]}),l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e$.default,{href:(0,e_.W)(e.path),title:`Run all requests in ${e.path}`,"aria-label":`Run all requests in ${e.path}`,className:"ml-0.5 rounded p-1 text-mute opacity-0 group-hover/folder:opacity-100 hover:text-accent focus:opacity-100",children:(0,t.jsx)(ek.f,{size:12})}),(0,t.jsx)(eQ,{path:e.path,onNewRequest:()=>void X(e.path),open:S===`f:${e.path}`,onOpenChange:t=>q(t?`f:${e.path}`:null),onSettings:()=>$(e.path),onNewInside:()=>k({kind:"new",parent:e.path}),onRename:()=>k({kind:"rename",path:e.path}),onDelete:()=>void et(e.path)})]}):null]}),r?null:(0,t.jsxs)("div",{className:"ml-[0.9rem] border-l border-line pl-1",children:[N?.kind==="new"&&N.parent===e.path?(0,t.jsx)(eZ,{initial:"",label:`New folder in ${e.path}`,onDone:e=>void ee(e)}):null,e.folders.map(el),ea(e.requests)]})]},e.path)};return(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,t.jsxs)("label",{className:"relative mb-2 block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Search saved requests"}),(0,t.jsx)(i.f,{size:13,className:"pointer-events-none absolute top-1/2 left-2 -translate-y-1/2 text-mute","aria-hidden":!0}),(0,t.jsx)("input",{value:g,onChange:e=>v(e.target.value),placeholder:"Search requests",className:"input h-8 rounded-lg pl-7 text-xs"})]}),E.size?(0,t.jsxs)("div",{role:"toolbar","aria-label":"Selected requests",className:"mb-2 flex items-center gap-1 rounded-lg border border-accent/40 bg-accent-dim/40 px-2 py-1.5 text-xs",children:[(0,t.jsxs)("span",{className:"flex-1 text-ink",children:[E.size," selected"]}),(0,t.jsx)("button",{type:"button",title:"Move to…","aria-label":"Move the selected requests",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>L([...E]),children:(0,t.jsx)(ef,{size:14,"aria-hidden":!0})}),(0,t.jsx)("button",{type:"button",title:"Export…","aria-label":"Export the selected requests",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>(0,eT.q)({kind:"requests",ids:[...E]}),children:(0,t.jsx)(ex.f,{size:14,"aria-hidden":!0})}),(0,t.jsx)("button",{type:"button",title:"Move to Trash","aria-label":"Move the selected requests to Trash",className:"rounded p-1 text-mute hover:text-bad",onClick:()=>void V([...E]),children:(0,t.jsx)(Z.f,{size:14,"aria-hidden":!0})}),(0,t.jsx)("button",{type:"button",title:"Clear the selection","aria-label":"Clear the selection",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>z(new Set),children:(0,t.jsx)(G.X,{size:14,"aria-hidden":!0})})]}):null,(0,t.jsxs)("div",{...K(""),className:`min-h-0 flex-1 overflow-auto rounded-md ${""===O?"bg-accent-dim/30 ring-1 ring-accent/60 ring-inset":""}`,children:[N?.kind==="new"&&""===N.parent?(0,t.jsx)(eZ,{initial:"",label:"New folder",onDone:e=>void ee(e),hint:"Use / for a folder inside another: Orders/Admin"}):null,0===P.length&&0===F.length?(0,t.jsxs)("div",{className:"space-y-2 px-1 py-4 text-xs text-mute",children:[(0,t.jsx)("p",{children:"No saved requests yet. Press Save (Ctrl+S) to keep the current one."}),(0,t.jsxs)("p",{children:["Coming from Postman or Swagger?"," ",(0,t.jsx)("button",{type:"button",onClick:()=>(0,eq.F)(),className:"text-accent hover:underline",children:"Import your requests"})]}),(0,t.jsxs)("p",{children:["Or"," ",(0,t.jsx)("button",{type:"button",onClick:()=>(0,eE.W)(),className:"text-accent hover:underline",children:"start from a template"})," ","— ready-made requests that run straight away."]})]}):I&&0===B.length?(0,t.jsx)("p",{className:"px-1 py-4 text-xs text-mute",children:"Nothing matches."}):(0,t.jsxs)(t.Fragment,{children:[W.folders.map(el),ea(W.requests)]})]}),C?(0,t.jsx)(eW,{path:C,onClose:()=>$(null)}):null,D?(0,t.jsx)(eG,{count:D.length,folders:[...new Set([...F.map(e=>e.path),...P.map(e=>e.collection)].filter(Boolean))].sort(),onPick:e=>{L(null),z(new Set),H(D,{collection:e})},onClose:()=>L(null)}):null]})}function eZ({initial:e,label:s,onDone:n,hint:a}){let[r,l]=(0,c.useState)(e),i=(0,c.useRef)(null),o=(0,c.useRef)(!1);(0,c.useEffect)(()=>i.current?.select(),[]);let d=e=>{o.current||(o.current=!0,n(e))};return(0,t.jsxs)("div",{className:"px-1 py-1",children:[(0,t.jsx)("input",{ref:i,value:r,"aria-label":s,placeholder:"Folder name",onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&d(r),"Escape"===e.key&&d("")},onBlur:()=>d(r),className:"input py-1 text-xs"}),a?(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-mute",children:a}):null]})}function eG({count:e,folders:s,onPick:n,onClose:a}){let[r,l]=(0,c.useState)("");(0,c.useEffect)(()=>{let e=e=>"Escape"===e.key&&a();return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let i=s.filter(e=>e.toLowerCase().includes(r.trim().toLowerCase()));return(0,t.jsx)("div",{className:"fixed inset-0 z-[66] flex items-center-safe justify-center bg-black/50 p-4 sm:p-16",role:"presentation",onMouseDown:e=>e.target===e.currentTarget&&a(),children:(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"move-title",className:"flex max-h-[70vh] w-full max-w-md flex-col rounded-xl border border-line bg-panel shadow-2xl",children:[(0,t.jsxs)("header",{className:"flex items-center gap-2 border-b border-line px-4 py-3",children:[(0,t.jsx)(ef,{size:15,className:"text-accent","aria-hidden":!0}),(0,t.jsxs)("h2",{id:"move-title",className:"flex-1 text-sm font-medium text-ink",children:["Move ",e," request",1===e?"":"s"," to…"]}),(0,t.jsx)("button",{type:"button",onClick:a,"aria-label":"Close",className:"rounded p-1 text-mute hover:text-ink",children:(0,t.jsx)(G.X,{size:15})})]}),(0,t.jsx)("div",{className:"border-b border-line p-3",children:(0,t.jsx)("input",{autoFocus:!0,value:r,onChange:e=>l(e.target.value),placeholder:"Find a folder","aria-label":"Find a folder",className:"input h-8 text-xs"})}),(0,t.jsxs)("ul",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:[(0,t.jsx)("li",{children:(0,t.jsx)("button",{type:"button",onClick:()=>n(""),className:"w-full rounded-md px-3 py-2 text-left text-sm text-mute hover:bg-panel-2 hover:text-ink",children:"Top level — no folder"})}),i.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>n(e),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink hover:bg-panel-2",children:[(0,t.jsx)(eh.f,{size:14,className:"shrink-0 text-mute","aria-hidden":!0}),(0,t.jsx)("span",{className:"truncate",children:e})]})},e))]})]})})}function eY({label:e,open:s,onOpenChange:n,items:a}){let r=(0,c.useRef)(null);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{ref:r,type:"button","aria-label":e,"aria-haspopup":"menu","aria-expanded":s,onClick:()=>n(!s),className:`mr-1 rounded p-1 text-mute hover:text-ink focus:opacity-100 ${s?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,t.jsx)(eN.f,{size:13})}),(0,t.jsx)(ee.f,{anchor:r,open:s,onClose:()=>n(!1),label:e,width:220,role:"menu",children:(0,t.jsx)("div",{className:"-m-2",children:a.map((e,s)=>"separator"===e?(0,t.jsx)(Q.Z,{},s):(0,t.jsx)(Q.d,{icon:e.icon,label:e.label,hint:e.hint,danger:e.danger,onSelect:()=>{n(!1),e.run()}},e.label))})})]})}function eQ({path:e,open:s,onOpenChange:n,onNewRequest:a,onSettings:r,onNewInside:l,onRename:i,onDelete:o}){let d=(0,c.useRef)(null),u=(0,eS.useRouter)(),m=e=>()=>{n(!1),e()};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{ref:d,type:"button","aria-label":`Actions for ${e}`,"aria-haspopup":"menu","aria-expanded":s,onClick:()=>n(!s),className:`rounded p-1 text-mute hover:text-ink focus:opacity-100 ${s?"opacity-100":"opacity-0 group-hover/folder:opacity-100"}`,children:(0,t.jsx)(eN.f,{size:13})}),(0,t.jsx)(ee.f,{anchor:d,open:s,onClose:()=>n(!1),label:`Actions for ${e}`,width:240,role:"menu",children:(0,t.jsxs)("div",{className:"-m-2",children:[(0,t.jsx)(Q.d,{icon:em,label:"New request here",onSelect:m(a)}),(0,t.jsx)(Q.d,{icon:eb.f,label:"New folder inside",onSelect:m(l)}),(0,t.jsx)(Q.Z,{}),(0,t.jsx)(Q.d,{icon:ek.f,label:"Run this folder",onSelect:m(()=>u.push((0,e_.W)(e)))}),(0,t.jsx)(Q.d,{icon:eC.f,label:"Mock server for this folder",onSelect:m(()=>(0,ez.o)(e))}),(0,t.jsx)(Q.d,{icon:J.f,label:"Folder settings",onSelect:m(r)}),(0,t.jsx)(Q.Z,{}),(0,t.jsx)(Q.d,{icon:ew.f,label:"Rename or move",onSelect:m(i)}),(0,t.jsx)(Q.d,{icon:ex.f,label:"Export…",onSelect:m(()=>(0,eT.q)({kind:"folder",path:e}))}),(0,t.jsx)(Q.Z,{}),(0,t.jsx)(Q.d,{icon:Z.f,label:"Delete folder",danger:!0,onSelect:m(o)})]})})]})}async function e0(e,t,s,n){let a,r,l=t.before;if(!l)return e;try{a=await er.v.get(l.requestId)}catch{throw Error(`Run first: “${l.requestName}” is no longer saved — pick another request on the Run first tab`)}if(a.secretsMissing?.length)throw Error(`Run first: the saved ${a.secretsMissing.join(", ")} of “${a.name}” is not available — open it and enter it again`);try{let e=await (0,en.c)({...(0,es.i)(a.request),before:null,testData:null},a.collection,s);r=(0,es.x)(e.draft,e.vars,n)}catch(e){throw Error(`Run first “${a.name}”: ${e instanceof Error?e.message:"invalid request"}`)}try{return{...e,setup:(0,es.d)({...l,requestName:a.name},r)}}catch(e){throw Error(e instanceof Error&&e.message.startsWith("Run first")?e.message:`Run first “${a.name}”: ${e instanceof Error?e.message:"invalid request"}`)}}e.s(["C",0,eK,"M",0,function({onOpen:e}){let[s,n]=(0,c.useState)(!1),a=(0,c.useRef)(null);return(0,c.useEffect)(()=>{if(!s)return;let e=e=>!a.current?.contains(e.target)&&n(!1),t=e=>"Escape"===e.key&&n(!1);return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[s]),(0,t.jsxs)("div",{ref:a,className:"relative",children:[(0,t.jsxs)("button",{type:"button","aria-expanded":s,onClick:()=>n(e=>!e),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-mute hover:text-ink",children:[(0,t.jsx)(eh.f,{size:12,"aria-hidden":!0})," Load saved request"]}),s?(0,t.jsx)("div",{className:"absolute left-0 z-40 mt-1 flex h-80 w-80 flex-col rounded-md border border-line bg-panel p-2 shadow-xl",children:(0,t.jsx)(eJ,{allowDelete:!1,onOpen:t=>{e(t),n(!1)}})}):null]})},"N",0,function({activeId:e,onOpen:s,onNew:n}){let[a,r]=(0,c.useState)(!1),l=(0,eH.P)();return(0,t.jsxs)("aside",{"aria-label":"Saved requests",className:"flex min-h-0 flex-col border-line bg-panel/40 px-2.5 py-3 lg:border-r",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center justify-between pl-1",children:[(0,t.jsxs)("h2",{className:"text-[13px] font-semibold whitespace-nowrap text-ink",children:["Saved requests ",(0,t.jsxs)("span",{className:"text-[11px] font-normal text-mute",title:"Show or hide this panel",children:["(",l,"+B)"]})]}),(0,t.jsxs)("span",{className:"flex shrink-0 items-center",children:[(0,t.jsx)("button",{type:"button",onClick:n,title:"New request","aria-label":"New request",className:"rounded p-1 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(em,{size:14})}),(0,t.jsx)("button",{type:"button",onClick:()=>r(!0),title:"New folder","aria-label":"New folder",className:"rounded p-1 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(eb.f,{size:14})}),(0,t.jsx)("button",{type:"button",onClick:()=>(0,eq.F)(),title:"Import requests — Postman, Insomnia, Bruno, OpenAPI, .http, Hurl, HAR","aria-label":"Import requests",className:"rounded p-1 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(ej,{size:14})})]})]}),(0,t.jsx)(eJ,{activeId:e,onOpen:s,newFolder:a,onNewFolderDone:()=>r(!1)})]})},"Z",0,function({initial:e,onSave:s,onCancel:n}){let{index:a}=(0,er.U)(),[r,l]=(0,c.useState)(e.name),[i,o]=(0,c.useState)(e.collection),d=(0,c.useRef)(null),u=[...new Set([...(a?.folders??[]).map(e=>e.path),...(a?.requests??[]).map(e=>e.collection)].filter(Boolean))].sort();return(0,c.useEffect)(()=>d.current?.select(),[]),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),r.trim()&&s(r.trim(),i.trim())},onKeyDown:e=>"Escape"===e.key&&n(),className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-mute",children:["Collection",(0,t.jsx)("input",{value:i,onChange:e=>o(e.target.value),list:"atc-collections",placeholder:"none — or Orders/Admin",title:"A folder; use / for a folder inside another",className:"input w-48 py-1 text-xs","aria-label":"Collection"}),(0,t.jsx)("datalist",{id:"atc-collections",children:u.map(e=>(0,t.jsx)("option",{value:e},e))})]}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-mute",children:[(0,t.jsx)("span",{"aria-hidden":!0,children:"/"}),"Name",(0,t.jsx)("input",{ref:d,value:r,onChange:e=>l(e.target.value),className:"input w-52 py-1 text-xs","aria-label":"Request name"})]}),(0,t.jsx)("button",{type:"submit",className:"btn btn-primary py-1 text-xs",children:"Save request"}),(0,t.jsx)("button",{type:"button",className:"rounded p-1 text-mute hover:text-ink","aria-label":"Cancel",onClick:n,children:(0,t.jsx)(G.X,{size:14})})]})}],65638),e.s(["f",0,e0],46679)},92001,e=>{var t=e.i(56003);let s={name:"unplug",size:24,node:[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],92001)}])})();
@@ -0,0 +1,50 @@
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,86369,e=>{var t=e.i(51487),s=e.i(32610),n=e.i(62766);e.i(24856);var r=e.i(2385),a=e.i(23986),l=e.i(56771),i=e.i(83668),o=e.i(49551),c=e.i(83035),d=e.i(59904),m=e.i(97424),p=e.i(86766),u=e.i(1326),h=e.i(62620),f=e.i(2552),x=e.i(53798),y=e.i(77306),v=e.i(67754),b=e.i(6980),g=e.i(29724),w=e.i(39170),k=e.i(28867),j=e.i(56396),N=e.i(19656),C=e.i(59180),S=e.i(88231),$=e.i(88153),T=e.i(45404),F=e.i(15275),_=e.i(16788),E=e.i(76134),I=e.i(24170);function z(){return(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 z-30 grid place-items-center bg-canvas/80 p-6 backdrop-blur-sm",children:(0,t.jsxs)("div",{className:"rounded-xl border-2 border-dashed border-accent bg-panel px-10 py-8 text-center",children:[(0,t.jsx)(F.f,{size:28,className:"mx-auto text-accent","aria-hidden":!0}),(0,t.jsx)("p",{className:"mt-3 text-base text-ink",children:"Drop to open"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-mute",children:"JSON or Zip exports from APITestCenter"})]})})}function M({open:e,busy:s,primary:n,children:r}){return(0,t.jsxs)("label",{className:`btn ${n?"btn-primary":"btn-secondary"} cursor-pointer py-1.5 text-sm ${s?"pointer-events-none opacity-60":""}`,children:[(0,t.jsx)(F.f,{size:15,"aria-hidden":!0}),r,(0,t.jsx)("input",{type:"file",multiple:!0,accept:".json,.zip,application/json,application/zip",className:"sr-only",onChange:t=>{e(Array.from(t.target.files??[])),t.target.value=""}})]})}function D({hasAny:e,open:s,busy:n,onCleared:r}){let a=(0,w.L)(),l=(0,j.d)(),{refresh:i}=(0,C.K)();return e?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(M,{open:s,busy:n,primary:!0,children:"Open reports"}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:async()=>{await a({title:"Remove every report from the viewer?",body:"They're forgotten by this browser. The files on your computer aren't touched.",confirmLabel:"Remove all",tone:"danger"})&&(await (0,E.u)(),await i(),r(),l("The viewer is empty","success"))},children:[(0,t.jsx)(u.f,{size:15,"aria-hidden":!0}),"Remove all"]})]}):null}function R({open:e,samples:s,busy:n}){return(0,t.jsxs)("div",{className:"mx-auto flex h-full max-w-2xl flex-col items-center justify-center px-6 py-12 text-center",children:[(0,t.jsx)("div",{className:"grid h-12 w-12 place-items-center rounded-full bg-accent-dim text-accent",children:(0,t.jsx)(F.f,{size:22,strokeWidth:1.75,"aria-hidden":!0})}),(0,t.jsx)("h2",{className:"mt-4 text-xl font-medium text-ink",children:"Open a performance test report"}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-mute",children:["Drop the ",(0,t.jsx)("strong",{className:"text-ink",children:"JSON"})," or ",(0,t.jsx)("strong",{className:"text-ink",children:"Zip"})," export of an APITestCenter report anywhere on this page. You get the whole report: response times, errors, percentiles, the written summary and every chart. Open several runs of one API to see the trend, or tick two and more to compare them."]}),(0,t.jsxs)("div",{className:"mt-6 flex flex-wrap justify-center gap-2",children:[(0,t.jsx)(M,{open:e,busy:n,primary:!0,children:"Choose files"}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary text-sm",disabled:n,onClick:s,children:[(0,t.jsx)(i.f,{size:14,"aria-hidden":!0}),"Try the samples"]})]}),(0,t.jsxs)("p",{className:"mt-8 inline-flex items-start gap-2 rounded-md border border-line bg-panel px-3 py-2 text-left text-xs text-mute",children:[(0,t.jsx)(_.f,{size:13,className:"mt-0.5 shrink-0 text-accent","aria-hidden":!0}),(0,t.jsx)("span",{children:"Nothing is uploaded. Your browser reads the files and keeps them on this computer until you remove them. No account needed."})]}),(0,t.jsxs)("p",{className:"mt-4 text-xs text-mute",children:["No report yet?"," ",(0,t.jsx)("a",{href:`${I.C}#download`,className:"text-accent hover:underline",children:"Get APITestCenter"})," ","(free), run a performance test, and choose ",(0,t.jsx)("span",{className:"text-ink",children:"Export → JSON"})," or ",(0,t.jsx)("span",{className:"text-ink",children:"Zip"}),"."]})]})}function A(e){return"run"===e.kind?e.startedAt:e.savedAt}function L(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function O({run:e,slo:s}){let n=(0,r.F)(e.verdict,{slo:s}).overall;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-sm text-ink",children:[e.baseline?(0,t.jsx)(l.f,{size:11,className:"mr-1 inline fill-current align-[-1px] text-accent","aria-label":"Reference run"}):null,e.name]}),"failed"===e.status||"cancelled"===e.status?(0,t.jsx)("span",{className:"shrink-0 text-xs text-mute capitalize",children:e.status}):(0,t.jsx)(b.VerdictTag,{level:n})]}),(0,t.jsx)("div",{className:"mt-0.5 truncate font-mono text-xs text-mute",children:e.endpoint}),(0,t.jsxs)("div",{className:"mt-0.5 flex flex-wrap gap-x-3 font-mono text-xs text-mute",children:[(0,t.jsxs)("span",{children:["p95 ",(0,N.E)(e.p95)]}),(0,t.jsxs)("span",{children:[(0,N.Z)(e.errorRate)," err"]}),(0,t.jsx)("span",{children:L(e.startedAt)})]}),e.note?(0,t.jsx)("p",{className:"mt-1 line-clamp-1 text-xs text-ink",children:e.note}):null]})}function P({compare:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.f,{size:13,className:"shrink-0 text-accent","aria-label":"Compare"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm text-ink",children:e.name})]}),(0,t.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-mute",children:[e.titles.map((e,s)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:(0,S.f)(s)},"aria-hidden":!0}),e]},s)),(0,t.jsx)("span",{className:"font-mono",children:L(e.savedAt)})]})]})}function q({name:e,note:s,onSave:n}){let[r,a]=(0,y.useState)(e),[l,i]=(0,y.useState)(s??"");return(0,y.useEffect)(()=>a(e),[e]),(0,y.useEffect)(()=>i(s??""),[s]),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Name"}),(0,t.jsx)("input",{value:r,onChange:e=>a(e.target.value),onBlur:()=>r.trim()!==e&&void n({name:r}),onKeyDown:e=>"Enter"===e.key&&e.target.blur(),className:"w-full rounded-md border border-transparent bg-transparent px-1 py-0.5 text-xl font-medium text-ink hover:border-line focus:border-accent focus:outline-none",title:"Click to rename"})]}),(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Note"}),(0,t.jsx)("textarea",{value:l,rows:l?2:1,onChange:e=>i(e.target.value),onBlur:()=>l.trim()!==(s??"")&&void n({note:l}),placeholder:"Add a note — what changed, which build, why you ran it…",className:"input resize-y text-sm"})]})]})}function G({summary:e,related:s,onSelect:n,onDelete:r,onReveal:a}){let l=(0,j.d)(),{refresh:i}=(0,C.K)(),[c,d]=(0,y.useState)(null),[p,h]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(!e)return;let t=!1;return C.c.run(e.id).then(e=>!t&&d(e)).catch(e=>!t&&h(e instanceof Error?e.message:"Could not read the file")),()=>{t=!0}},[e?.id,e?.bytes]),!e)return null;let f=s.filter(t=>t.endpoint===e.endpoint);async function x(t){try{await C.c.updateRun(e.id,t),await i()}catch(e){l(e instanceof Error?e.message:"Could not save","error")}}return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(q,{name:e.name,note:e.note,onSave:x}),(0,t.jsx)("p",{className:"mt-1 px-1 font-mono text-xs break-all text-mute",children:e.file})]}),(0,t.jsxs)("div",{className:"flex shrink-0 gap-2",children:[I.G?null:(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:()=>a(e.id),children:[(0,t.jsx)(o.f,{size:13}),"Show file"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1.5 text-xs",onClick:()=>r(e.id),children:[(0,t.jsx)(u.f,{size:13}),I.G?"Remove":"Delete"]})]})]}),e.error?(0,t.jsx)("p",{role:"alert",className:"rounded-md border border-bad/40 bg-bad/10 px-3 py-2 font-mono text-xs text-bad",children:e.error}):null,f.length>=2?(0,t.jsx)(v.N,{runs:f,selectedId:e.id,onSelect:n}):null,p?(0,t.jsx)("p",{className:"text-sm text-bad",children:p}):c&&c.report.id===e.id?(0,t.jsx)(g.f,{report:c.report,source:"session",showTitle:!1}):(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-mute",children:[(0,t.jsx)(m.f,{size:14,className:"animate-spin"})," Opening…"]})]})}function U({summary:e,onDelete:s,onReveal:n}){let a=(0,j.d)(),{slo:l}=(0,$.G)(),{refresh:i}=(0,C.K)(),[d,p]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(!e)return;let t=!1;return C.c.compare(e.id).then(e=>!t&&p(e)).catch(()=>void 0),()=>{t=!0}},[e?.id,e?.bytes]),!e)return null;async function h(t){try{await C.c.updateCompare(e.id,t),await i()}catch(e){a(e instanceof Error?e.message:"Could not save","error")}}return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"px-1 text-xs tracking-wide text-accent uppercase",children:["Compare · ","parallel"===e.mode?"all at once":"one after another"]}),(0,t.jsx)(q,{name:e.name,note:e.note,onSave:h}),(0,t.jsx)("p",{className:"mt-1 px-1 font-mono text-xs break-all text-mute",children:e.file})]}),(0,t.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[I.G?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(f.default,{href:`/compare?compare=${e.id}`,className:"btn btn-primary py-1.5 text-xs",children:[(0,t.jsx)(c.f,{size:13}),"Open overlay"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:()=>n(e.id),children:[(0,t.jsx)(o.f,{size:13}),"Show file"]})]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1.5 text-xs",onClick:()=>s(e.id),children:[(0,t.jsx)(u.f,{size:13}),I.G?"Remove":"Delete"]})]})]}),d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{className:"grid gap-2 @2xl:grid-cols-2",children:d.apis.map((e,s)=>(0,t.jsxs)("li",{className:"rounded-lg border border-line bg-panel p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-sm text-ink",children:[(0,t.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:(0,S.f)(s)},"aria-hidden":!0}),(0,t.jsx)("span",{className:"truncate",children:e.title})]}),(0,t.jsx)(b.VerdictTag,{level:(0,r.s)(e.report,{slo:l}).overall})]}),(0,t.jsxs)("p",{className:"mt-1 truncate font-mono text-xs text-mute",children:[e.report.definition.method," ",e.report.definition.url]}),(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap gap-x-4 font-mono text-xs text-ink",children:[(0,t.jsxs)("span",{children:["p95 ",(0,N.E)(e.report.summary.latencyMs.p95)]}),(0,t.jsxs)("span",{children:[(0,N.Z)(e.report.summary.http.failed.rate)," err"]}),(0,t.jsxs)("span",{children:[e.report.summary.http.requests.toLocaleString()," req"]})]})]},e.id))}),I.G?(0,t.jsx)(T.f,{scope:"compare",data:{reports:d.apis.map(e=>e.report),titles:d.apis.map(e=>e.title),slo:l,live:!1}}):null]}):(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-mute",children:[(0,t.jsx)(m.f,{size:14,className:"animate-spin"})," Opening…"]})]})}function H({index:e,onChanged:s,onReveal:n}){let r=(0,w.L)(),l=(0,j.d)();return(0,t.jsxs)("details",{className:"mx-1 mb-3 rounded-md border border-warn/40 bg-warn/10 px-3 py-2 text-sm",children:[(0,t.jsxs)("summary",{className:"cursor-pointer text-ink",children:[(0,t.jsx)(a.f,{size:13,className:"mr-1 inline align-[-2px] text-warn","aria-hidden":!0}),e.invalid.length," ",1===e.invalid.length?"file":"files"," ",I.G?"couldn’t be opened":"in your history folder couldn’t be read"]}),(0,t.jsx)("ul",{className:"mt-2 space-y-1",children:e.invalid.map(e=>(0,t.jsxs)("li",{className:"text-xs",children:[(0,t.jsx)("span",{className:"font-mono text-ink",children:I.G?e.file:`${e.folder}/${e.file}`}),(0,t.jsx)("span",{className:"block text-mute",children:e.reason})]},`${e.folder}/${e.file}`))}),(0,t.jsxs)("div",{className:"mt-2 flex gap-2",children:[I.G?null:(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1 text-xs",onClick:n,children:"Show folder"}),(0,t.jsx)("button",{type:"button",className:"btn btn-danger py-1 text-xs",onClick:async()=>{await r({title:I.G?"Remove them from the list?":"Delete the unreadable files?",body:I.G?"The files on your computer aren't touched.":"They are not valid APITestCenter records. If you edited one by hand, fix it instead and it will reappear.",confirmLabel:I.G?"Remove":"Delete files",tone:"danger"})&&(await C.c.remove({invalid:e.invalid.map(({folder:e,file:t})=>({folder:e,file:t}))}),await s(),l(I.G?"Removed from the list":"Unreadable files deleted","success"))},children:I.G?"Remove them":"Delete them"})]})]})}function V({filtered:e,hasAny:s}){return(0,t.jsx)("p",{className:"px-3 py-6 text-sm text-mute",children:e&&s?"Nothing matches. Clear the search or filter.":I.G?"No reports yet. Drop JSON or Zip exports on this page.":"No saved records yet."})}function W(){return(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-6 py-16 text-center",children:[(0,t.jsx)("div",{className:"grid h-12 w-12 place-items-center rounded-full bg-accent-dim text-accent",children:(0,t.jsx)(d.f,{size:22,strokeWidth:1.75,"aria-hidden":!0})}),(0,t.jsx)("h2",{className:"mt-4 text-base font-medium text-ink",children:"Your history is empty"}),(0,t.jsx)("p",{className:"mt-2 max-w-sm text-sm text-mute",children:"Every performance test and compare is saved here automatically, as a JSON file on this computer. Nothing leaves your machine."}),(0,t.jsxs)("div",{className:"mt-6 flex flex-wrap justify-center gap-2",children:[(0,t.jsxs)(f.default,{href:"/",className:"btn btn-primary text-sm",children:[(0,t.jsx)(i.f,{size:14}),"Test an API"]}),(0,t.jsxs)(f.default,{href:"/compare",className:"btn btn-secondary text-sm",children:[(0,t.jsx)(c.f,{size:14}),"Compare APIs"]})]})]})}e.s(["HistoryBrowser",0,function(){let e=(0,n.K)("history",{min:280}),r=(0,x.useRouter)(),a=(0,j.d)(),l=(0,w.L)(),{slo:i}=(0,$.G)(),{index:d,loading:f,error:v,refresh:b}=(0,C.K)(),[g,S]=(0,y.useState)(""),[T,F]=(0,y.useState)("all"),[_,M]=(0,y.useState)(null),[L,q]=(0,y.useState)(new Set),[B,K]=(0,y.useState)(!1),J=function(e){let t=(0,j.d)(),{refresh:s}=(0,C.K)(),[n,r]=(0,y.useState)(!1),a=(0,y.useCallback)(async n=>{await s();let r=n.filter(e=>"run"===e.kind||"compare"===e.kind),a=n.filter(e=>"invalid"===e.kind),l=r[0]??null;e(l?{kind:l.kind,id:l.id}:null),r.length&&!a.length?t(1===r.length?`Opened “${r[0].name}”`:`Opened ${r.length} reports`,"success"):a.length&&!r.length?t(1===a.length?`${a[0].name}: ${a[0].reason}`:`${a.length} files couldn't be opened — see the list`,"error"):a.length&&t(`Opened ${r.length}; ${a.length} couldn't be opened — see the list`,"error")},[s,e,t]);return{open:(0,y.useCallback)(async e=>{if(e.length){r(!0);try{await a(await (0,E.q)(e))}catch(e){t(e instanceof Error?e.message:"Those files couldn't be opened","error")}finally{r(!1)}}},[a,t]),samples:(0,y.useCallback)(async()=>{r(!0);try{await a(await (0,E.H)())}finally{r(!1)}},[a]),busy:n}}(e=>e&&M(e)),Y=function(e){let[t,s]=(0,y.useState)(!1),n=e=>Array.from(e.dataTransfer.types).includes("Files");return{over:t,handlers:{onDragOver:e=>{n(e)&&(e.preventDefault(),s(!0))},onDragLeave:e=>{e.currentTarget!==e.target&&e.currentTarget.contains(e.relatedTarget)||s(!1)},onDrop:t=>{n(t)&&(t.preventDefault(),s(!1),e(Array.from(t.dataTransfer.files)))}}}}(e=>void J.open(e)),Z=d?.runs??[],X=d?.compares??[],Q=I.G&&null!==d&&Z.length+X.length+d.invalid.length===0,ee=(0,y.useMemo)(()=>{let e=g.trim().toLowerCase();return[..."compares"===T?[]:Z.filter(e=>"baselines"!==T||e.baseline),..."runs"===T||"baselines"===T?[]:X].filter(t=>!e||t.name.toLowerCase().includes(e)||(t.note??"").toLowerCase().includes(e)||("run"===t.kind?t.endpoint.toLowerCase().includes(e):t.titles.join(" ").toLowerCase().includes(e))).sort((e,t)=>Date.parse(A(t))-Date.parse(A(e)))},[Z,X,g,T]);(0,y.useEffect)(()=>{if(d&&!(_&&("run"===_.kind?Z.some(e=>e.id===_.id):X.some(e=>e.id===_.id)))){let e=ee[0];M(e?{kind:e.kind,id:e.id}:null)}},[d]);let et=[...L].filter(e=>e.startsWith("run:")).map(e=>e.slice(4)),es=[...L].filter(e=>e.startsWith("compare:")).map(e=>e.slice(8));async function en(e,t){let s=e.length+t.length;if(await l({title:`Delete ${s} ${1===s?"record":"records"}?`,body:I.G?"They're removed from the viewer. The files on your computer aren't touched.":"The JSON files are removed from your history folder. This cannot be undone — export first if you want a copy.",confirmLabel:"Delete",tone:"danger"})){K(!0);try{let{removed:s}=await C.c.remove({runs:e,compares:t});q(new Set),await b(),a(`Deleted ${s} ${1===s?"record":"records"}`,"success")}catch(e){a(e instanceof Error?e.message:"Delete failed","error")}finally{K(!1)}}}async function er(e){try{await C.c.reveal(e)}catch(e){a(e instanceof Error?e.message:"Could not open the folder","error")}}async function ea(){if(!I.G)return r.push(`/compare?ids=${et.join(",")}`);K(!0);try{let e=await Promise.all(et.map(e=>C.c.run(e))),t=e.map(e=>e.meta?.name?.trim()||e.report.testName),s=t.map((s,n)=>t.filter(e=>e===s).length>1?`${s} (${new Date(e[n].report.startedAt).toLocaleDateString(void 0,{month:"short",day:"numeric"})})`:s),n=await C.c.saveCompare({mode:"sequence",apis:e.map((e,t)=>({id:e.report.id,title:s[t],report:e.report}))});q(new Set),await b(),M({kind:"compare",id:n.id})}catch(e){a(e instanceof Error?e.message:"Could not compare those runs","error")}finally{K(!1)}}let el=function(e){let t=new Map,s=new Date,n=new Date(s.getTime()-864e5),r=(e,t)=>e.toDateString()===t.toDateString();for(let a of e){let e=new Date(A(a)),l=r(e,s)?"Today":r(e,n)?"Yesterday":e.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:e.getFullYear()===s.getFullYear()?void 0:"numeric"}),i=t.get(l)??[];i.push(a),t.set(l,i)}return[...t]}(ee);return(0,t.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",...I.G?Y.handlers:{},children:[I.G&&Y.over?(0,t.jsx)(z,{}):null,(0,t.jsxs)("header",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-line bg-panel px-4 py-3 lg:px-6",children:[(0,t.jsxs)("div",{className:"min-w-[14rem] flex-1",children:[(0,t.jsx)("h1",{className:"text-lg font-medium text-ink",children:I.G?"Your reports":"History"}),(0,t.jsx)("p",{className:"truncate text-xs text-mute",title:d?.dataDir,children:d&&I.G?`${Z.length} ${1===Z.length?"report":"reports"} \xb7 ${X.length} ${1===X.length?"compare":"compares"} \xb7 kept in this browser, never uploaded`:d?`${Z.length} load ${1===Z.length?"test":"tests"} \xb7 ${X.length} ${1===X.length?"compare":"compares"} \xb7 ${(0,N.L)(d.totalBytes)} on this computer`:f?"Loading…":"History is unavailable"})]}),I.G?(0,t.jsx)(D,{hasAny:Z.length+X.length+(d?.invalid.length??0)>0,open:e=>void J.open(e),busy:J.busy,onCleared:()=>M(null)}):(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:()=>void er(),disabled:!d,children:[(0,t.jsx)(o.f,{size:15}),"Show folder"]})]}),!v||d||I.G?null:(0,t.jsxs)("div",{role:"alert",className:"m-6 rounded-md border border-bad/40 bg-bad/10 px-4 py-3 text-sm text-ink",children:[(0,t.jsx)("p",{className:"font-medium text-bad",children:"Can't reach the engine"}),(0,t.jsxs)("p",{className:"mt-1",children:["History is stored by the local engine. Start it with pnpm dev, then come back. (",v,")"]})]}),Q?(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(0,t.jsx)(R,{open:e=>void J.open(e),samples:()=>void J.samples(),busy:J.busy})}):(0,t.jsxs)("div",{ref:e.gridRef,style:e.gridStyle,className:"relative grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] overflow-y-auto lg:grid-cols-[minmax(20rem,26rem)_minmax(0,1fr)] lg:overflow-hidden",children:[(0,t.jsx)(s.f,{label:"History list width",...e.splitter}),(0,t.jsxs)("section",{"aria-label":"Saved records",className:"flex min-h-0 flex-col border-line lg:border-r",children:[(0,t.jsxs)("div",{className:"space-y-2 border-b border-line px-4 py-3",children:[(0,t.jsxs)("label",{className:"relative block",children:[(0,t.jsx)("span",{className:"sr-only",children:"Search history"}),(0,t.jsx)(p.f,{size:14,className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-mute","aria-hidden":!0}),(0,t.jsx)("input",{value:g,onChange:e=>S(e.target.value),placeholder:"Search name, URL, or note",className:"input pl-8"})]}),(0,t.jsx)(k.f,{label:"Show",value:T,onChange:F,options:[{value:"all",label:"All"},{value:"runs",label:"Performance tests"},{value:"compares",label:"Compares"},{value:"baselines",label:"Reference runs"}]})]}),L.size>0?(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line bg-accent-dim px-4 py-2 text-sm",children:[(0,t.jsxs)("span",{className:"text-ink",children:[L.size," selected"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary ml-auto py-1 text-xs",disabled:et.length<2||et.length>6||es.length>0,title:et.length<2?"Tick 2–6 performance tests to overlay them":I.G?"See these runs side by side":"Overlay these runs on Compare",onClick:()=>void ea(),children:[(0,t.jsx)(c.f,{size:13}),I.G?"Compare":"Overlay"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-danger py-1 text-xs",disabled:B,onClick:()=>void en(et,es),children:[(0,t.jsx)(u.f,{size:13}),I.G?"Remove":"Delete"]}),(0,t.jsx)("button",{type:"button","aria-label":"Clear selection",className:"rounded p-1 text-mute hover:text-ink",onClick:()=>q(new Set),children:(0,t.jsx)(h.X,{size:14})})]}):null,(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:[d?.invalid.length?(0,t.jsx)(H,{index:d,onChanged:b,onReveal:()=>void er()}):null,f&&!d?(0,t.jsxs)("p",{className:"flex items-center gap-2 px-3 py-6 text-sm text-mute",children:[(0,t.jsx)(m.f,{size:14,className:"animate-spin"})," ",I.G?"Opening your reports…":"Reading your history folder…"]}):0===ee.length?(0,t.jsx)(V,{filtered:!!g||"all"!==T,hasAny:Z.length+X.length>0}):el.map(([e,s])=>(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h2",{className:"px-2 py-1 text-xs font-medium text-mute",children:e}),(0,t.jsx)("ul",{className:"space-y-0.5",children:s.map(e=>{let s=`${e.kind}:${e.id}`,n=_?.kind===e.kind&&_.id===e.id;return(0,t.jsxs)("li",{className:`flex items-start gap-2 rounded-md px-2 py-2 ${n?"bg-accent-dim":"hover:bg-panel-2"}`,children:[(0,t.jsx)("input",{type:"checkbox",checked:L.has(s),onChange:()=>{let t;return t=`${e.kind}:${e.id}`,void q(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},"aria-label":`Select ${e.name}`,className:"mt-1 accent-[var(--accent)]"}),(0,t.jsx)("button",{type:"button",onClick:()=>M({kind:e.kind,id:e.id}),"aria-current":n?"true":void 0,className:"min-w-0 flex-1 text-left",children:"run"===e.kind?(0,t.jsx)(O,{run:e,slo:i}):(0,t.jsx)(P,{compare:e})})]},s)})})]},e))]})]}),(0,t.jsx)("section",{"aria-label":"Details",className:"@container min-h-0 min-w-0 overflow-y-auto px-4 py-4 lg:px-6",children:_?.kind==="run"?(0,t.jsx)(G,{summary:Z.find(e=>e.id===_.id),related:Z,onSelect:e=>M({kind:"run",id:e}),onDelete:e=>void en([e],[]),onReveal:e=>void er({folder:"runs",id:e})},_.id):_?.kind==="compare"?(0,t.jsx)(U,{summary:X.find(e=>e.id===_.id),onDelete:e=>void en([],[e]),onReveal:e=>void er({folder:"compares",id:e})},_.id):d?I.G?(0,t.jsx)(R,{open:e=>void J.open(e),samples:()=>void J.samples(),busy:J.busy}):(0,t.jsx)(W,{}):null})]})]})}],86369)},37837,e=>{var t=e.i(51487),s=e.i(77306),n=e.i(30597),r=e.i(14865);e.s(["f",0,function({anchor:e,open:a,onClose:l,children:i,label:o,width:c=280,role:d="dialog"}){let m=(0,s.useRef)(null),[p,u]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{if(!a)return;let t=()=>{if(!e.current)return;let t=(0,r.C)(e.current),s=(0,r.v)(),n=m.current?.offsetHeight??320,a=s.height-t.bottom-8,l=t.top-8,i=a<Math.min(n,240)&&l>a,o=Math.min(Math.max(8,t.right-c),s.width-c-8);u({top:i?Math.max(8,t.top-Math.min(n,l)-4):t.bottom+4,left:o,maxHeight:Math.max(160,(i?l:a)-4)})};t();let s=window.requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",t)}},[a,e,c]),(0,s.useEffect)(()=>{if(!a)return;let t=t=>{let s=t.target;m.current?.contains(s)||e.current?.contains(s)||l()},s=t=>{"Escape"===t.key&&(t.stopPropagation(),l(),e.current?.focus())},n=e=>{m.current?.contains(e.target)||l()},r=t=>{e.current?.contains(t.target)&&(t.stopPropagation(),t.preventDefault(),l())};return document.addEventListener("pointerdown",t,!0),document.addEventListener("click",r,!0),document.addEventListener("keydown",s,!0),document.addEventListener("scroll",n,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("click",r,!0),document.removeEventListener("keydown",s,!0),document.removeEventListener("scroll",n,!0)}},[a,l,e]),(0,s.useEffect)(()=>{a&&window.setTimeout(()=>m.current?.querySelector("[role=menuitem], input, select, button")?.focus(),0)},[a]),!a||"u"<typeof document)?null:(0,n.createPortal)((0,t.jsx)("div",{ref:m,role:d,"aria-label":o,style:{top:p?.top??-9999,left:p?.left??-9999,width:c,maxHeight:p?.maxHeight},className:"anim-pop fixed z-[70] overflow-auto rounded-lg border border-line bg-panel p-3 shadow-2xl",children:i}),document.body)}])},32610,e=>{var t=e.i(51487),s=e.i(77306);e.s(["f",0,function({orientation:e,label:n,value:r,onMove:a,onStep:l,onReset:i,onDragging:o,className:c="",style:d}){let[m,p]=(0,s.useState)(!1);(0,s.useEffect)(()=>o?.(m),[m,o]),(0,s.useEffect)(()=>{if(!m)return;let t=e=>a(e.clientX,e.clientY),s=()=>p(!1);return document.body.style.userSelect="none",document.body.style.cursor="vertical"===e?"col-resize":"row-resize",window.addEventListener("pointermove",t),window.addEventListener("pointerup",s),()=>{document.body.style.userSelect="",document.body.style.cursor="",window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",s)}},[m,a,e]);let u="vertical"===e;return(0,t.jsx)("div",{role:"separator",tabIndex:0,"aria-orientation":e,"aria-label":n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r),title:`${n} — drag, or double-click to reset`,onPointerDown:e=>{0===e.button&&(e.preventDefault(),p(!0))},onDoubleClick:i,style:{...d,outline:"none"},onKeyDown:e=>{let t=u?"ArrowLeft":"ArrowUp";e.key===t||e.key===(u?"ArrowRight":"ArrowDown")?(e.preventDefault(),l(e.key===t?-1:1,e.shiftKey)):("Enter"===e.key||"Home"===e.key)&&(e.preventDefault(),i())},className:`group z-20 hidden touch-none outline-none lg:block ${u?"w-2 cursor-col-resize":"h-2 cursor-row-resize"} ${c}`,children:(0,t.jsx)("span",{"aria-hidden":!0,className:`pointer-events-none absolute bg-accent opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-100 ${m?"opacity-100":""} ${u?"inset-y-0 left-1/2 w-0.5 -translate-x-1/2":"inset-x-0 top-1/2 h-0.5 -translate-y-1/2"}`})})}])},30617,e=>{e.i(24856);var t=e.i(46306),s=e.i(36558),n=e.i(2385),r=e.i(17219);let a={base:0,header:1,desc:2,pass:3,warn:4,fail:5};function l(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("\n","&#10;")}function i(e,t,s){if("level"===e)return"pass"===t?a.pass:"warn"===t?a.warn:"fail"===t?a.fail:a.base;let n="number"==typeof t?t:Number(t);return"errors"===e?n>=s.errorFail?a.fail:n>=s.errorWarn?a.warn:a.pass:n>=s.p95FailMs?a.fail:n>=s.p95WarnMs?a.warn:a.pass}let o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
3
+ <fonts count="3">
4
+ <font><sz val="11"/><name val="Calibri"/></font>
5
+ <font><b/><sz val="11"/><color rgb="FFFFFFFF"/><name val="Calibri"/></font>
6
+ <font><sz val="10"/><color rgb="FF5C6778"/><name val="Calibri"/></font>
7
+ </fonts>
8
+ <fills count="6">
9
+ <fill><patternFill patternType="none"/></fill>
10
+ <fill><patternFill patternType="gray125"/></fill>
11
+ <fill><patternFill patternType="solid"><fgColor rgb="FF0B8F7C"/></patternFill></fill>
12
+ <fill><patternFill patternType="solid"><fgColor rgb="FFDCFCE7"/></patternFill></fill>
13
+ <fill><patternFill patternType="solid"><fgColor rgb="FFFEF3C7"/></patternFill></fill>
14
+ <fill><patternFill patternType="solid"><fgColor rgb="FFFECACA"/></patternFill></fill>
15
+ </fills>
16
+ <borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
17
+ <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
18
+ <cellXfs count="6">
19
+ <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
20
+ <xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment horizontal="center" vertical="center"/></xf>
21
+ <xf numFmtId="0" fontId="2" fillId="0" borderId="0" xfId="0" applyFont="1" applyAlignment="1"><alignment wrapText="1" vertical="center"/></xf>
22
+ <xf numFmtId="0" fontId="0" fillId="3" borderId="0" xfId="0" applyFill="1"/>
23
+ <xf numFmtId="0" fontId="0" fillId="4" borderId="0" xfId="0" applyFill="1"/>
24
+ <xf numFmtId="0" fontId="0" fillId="5" borderId="0" xfId="0" applyFill="1"/>
25
+ </cellXfs>
26
+ </styleSheet>`;async function c(e,r,l){let o=(0,n.s)(e,{slo:r}),c=(0,n.v)(r),m=(0,t.$)(l,(0,t.L)(e));return d([{name:"Overview",rows:[[{v:"Key",s:a.header},{v:"Value",s:a.header},{v:"What this means",s:a.header}],...(0,s.E)(e).map(e=>{let t=a.base;return"failed_rate"===e.key&&(t=i("errors",e.value,c)),"latency_p95_ms"===e.key&&(t=i("latency",e.value,c)),(e.key.startsWith("status_5")||"status_0"===e.key)&&(t=Number(e.value)>0?a.fail:a.pass),e.key.startsWith("status_4")&&Number(e.value)>0&&(t=a.warn),e.key.startsWith("threshold:")&&(t="pass"===e.value?a.pass:a.fail),[{v:e.key},{v:e.value,s:t},{v:e.description,s:a.desc}]})]},{name:"Result summary",rows:[[{v:"Field",s:a.header},{v:"Level",s:a.header},{v:"What this means",s:a.header}],[{v:"overall"},{v:o.overall,s:i("level",o.overall,c)},{v:o.headline,s:a.desc}],...o.aspects.map(e=>[{v:e.title},{v:e.level,s:i("level",e.level,c)},{v:e.summary,s:a.desc}]),[{v:"disclaimer"},{v:""},{v:o.disclaimer,s:a.desc}],...m.map((e,s)=>[{v:`chart_${s+1}`},{v:`${e.w}x${e.h}`},{v:t.p[e.id],s:a.desc}])]},{name:"Second by second",rows:[s.V.map(e=>({v:e.header,s:a.header})),...e.buckets.map(e=>(0,s.u)(e).map((e,t)=>{let n=s.V[t]?.key,r=a.base;return"p95_ms"===n&&(r=i("latency",e,c)),"failed_rate"===n&&(r=i("errors",e,c)),"http_5xx"===n&&Number(e)>0&&(r=a.fail),"http_0"===n&&Number(e)>0&&(r=a.fail),"http_4xx"===n&&Number(e)>0&&(r=a.warn),"http_2xx"===n&&Number(e)>0&&(r=a.pass),{v:e,s:r}}))]}])}function d(e){let t={"[Content_Types].xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
27
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
28
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
29
+ <Default Extension="xml" ContentType="application/xml"/>
30
+ <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
31
+ <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
32
+ ${e.map((e,t)=>` <Override PartName="/xl/worksheets/sheet${t+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("\n")}
33
+ </Types>`,"_rels/.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
34
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
35
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
36
+ </Relationships>`,"xl/workbook.xml":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
37
+ <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
38
+ <sheets>
39
+ ${e.map((e,t)=>` <sheet name="${l(e.name.replace(/[:\\/?*[\]]/g," ").trim().slice(0,31)||"Sheet")}" sheetId="${t+1}" r:id="rId${t+1}"/>`).join("\n")}
40
+ </sheets>
41
+ </workbook>`,"xl/_rels/workbook.xml.rels":`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
42
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
43
+ ${e.map((e,t)=>` <Relationship Id="rId${t+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${t+1}.xml"/>`).join("\n")}
44
+ <Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
45
+ </Relationships>`,"xl/styles.xml":o};return e.forEach((e,s)=>{var n;let r,a,i;return t[`xl/worksheets/sheet${s+1}.xml`]=(n=e.rows,a=Array.from({length:r=n[0]?.length??0},(e,t)=>{let s=function(e,t,s=10,n=48){let r=s;for(let s of e){let e=s[t]?.v;void 0!==e&&(r=Math.max(r,String(e).length+2))}return Math.min(n,r)}(n,t,t===r-1&&r>=3?36:12,t===r-1&&r>=3?72:42);return`<col min="${t+1}" max="${t+1}" width="${s}" customWidth="1"/>`}).join(""),i=n.map((e,t)=>`<row r="${t+1}" ht="${0===t?22:18}" customHeight="1">${e.map((e,s)=>{var n;let r,a;return n=t+1,r=`${function(e){let t=e+1,s="";for(;t>0;)s=String.fromCharCode(65+(t-1)%26)+s,t=Math.floor((t-1)/26);return s}(s)}${n}`,a=void 0!==e.s?` s="${e.s}"`:"","number"==typeof e.v&&Number.isFinite(e.v)?`<c r="${r}"${a}><v>${e.v}</v></c>`:`<c r="${r}"${a} t="inlineStr"><is><t xml:space="preserve">${l(e.v)}</t></is></c>`}).join("")}</row>`).join(""),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
46
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
47
+ <sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>
48
+ <cols>${a}</cols>
49
+ <sheetData>${i}</sheetData>
50
+ </worksheet>`)}),new Blob([(0,r.f)(t)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}e.s(["S",0,a,"a",0,c,"F",0,d])},62766,e=>{var t=e.i(77306);let s="apitestcenter-pane-sizes",n=(e,t,s)=>Math.min(s,Math.max(t,e));function r(e){let[s,n]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let t=window.matchMedia(e),s=()=>n(t.matches);return s(),t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e]),s}e.s(["K",0,function(e,{min:a=220,max:l=900,rest:i=360}={}){let o=r("(min-width: 1024px)"),c=(0,t.useRef)(null),d=`${s}:${e}`,[m,p]=(0,t.useState)(null),[u,h]=(0,t.useState)(0);(0,t.useEffect)(()=>{try{let e=Number(JSON.parse(localStorage.getItem(d)??"null"));Number.isFinite(e)&&e>0&&p(e)}catch{}},[d]),(0,t.useEffect)(()=>{let e=[...c.current?.children??[]].find(e=>"separator"!==e.getAttribute("role"));if(!e)return;let t=new ResizeObserver(()=>h(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[o]);let f=(0,t.useCallback)(e=>{let t=c.current?.getBoundingClientRect(),s=null===e?null:Math.round(n(e,a,Math.max(a,Math.min(l,(t?.width??l+i)-i))));p(s);try{null===s?localStorage.removeItem(d):localStorage.setItem(d,JSON.stringify(s))}catch{}},[l,a,i,d]),x=()=>c.current?.getBoundingClientRect();return{wide:o,gridRef:c,gridStyle:o&&null!==m?{gridTemplateColumns:`${m}px minmax(0,1fr)`}:void 0,splitter:{orientation:"vertical",value:(m??u)/Math.max(1,x()?.width??1)*100,onMove:e=>{let t=x();t&&f(e-t.left)},onStep:(e,t)=>f((m??u)+16*e*(t?4:1)),onReset:()=>f(null),className:"absolute inset-y-0 -translate-x-1/2",style:{left:`${u}px`}}}},"f",0,function(e,a){let l=r("(min-width: 1024px)"),i=r("(min-width: 1536px)"),o=(0,t.useRef)(null),[c,d]=(0,t.useState)({panel:null,beside:null,below:null});(0,t.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(s)??"null"),t=e=>"number"==typeof e&&Number.isFinite(e)?e:null;e&&d({panel:t(e.panel),beside:t(e.beside),below:t(e.below)})}catch{}},[]);let m=(0,t.useCallback)(e=>{d(t=>{let n={...t,...e};try{localStorage.setItem(s,JSON.stringify(n))}catch{}return n})},[]),p=n(c.panel??(i?256:240),180,480),u=a?p:0,h=n("below"===e?c.below??.5:c.beside??(i?5/12:.5),.2,.8),f=l?"below"===e?{gridTemplateColumns:`${u}px minmax(0,1fr)`,gridTemplateRows:`minmax(0,${h}fr) minmax(0,${1-h}fr)`}:{gridTemplateColumns:`${u}px minmax(0,${h}fr) minmax(0,${1-h}fr)`}:void 0,x=()=>o.current?.getBoundingClientRect(),y=(0,t.useCallback)(e=>{let t=x();t&&m({panel:n(e-t.left,180,Math.min(480,.4*t.width))})},[m]),v=(0,t.useCallback)((t,s)=>{let r=x();r&&("below"===e?m({below:n((s-r.top)/r.height,.2,.8)}):m({beside:n((t-r.left-u)/Math.max(1,r.width-u),.2,.8)}))},[m,e,u]);return{wide:l,gridRef:o,gridStyle:f,panelWidth:l?p:void 0,panel:{value:p/480*100,onMove:e=>y(e),onStep:(e,t)=>m({panel:n(p+16*e*(t?4:1),180,480)}),onReset:()=>m({panel:null}),style:{left:`${u}px`}},split:{value:100*h,onMove:v,onStep:(t,s)=>m("below"===e?{below:n(h+.02*t*(s?5:1),.2,.8)}:{beside:n(h+.02*t*(s?5:1),.2,.8)}),onReset:()=>m("below"===e?{below:null}:{beside:null}),style:"below"===e?{top:`${100*h}%`,left:`${u}px`,right:0}:{left:`calc(${u}px + (100% - ${u}px) * ${h})`,top:0,bottom:0}}}}])},61230,17847,e=>{e.s(["f",0,function(e){try{return decodeURI(e.replace(/\+/g,"%20")).replace(/%2C/gi,",").replace(/%24/g,"$").replace(/%27/g,"'").replace(/%3A/gi,":").replace(/%2F/gi,"/").replace(/%3D/gi,"=")}catch{return e}}],61230);var t=e.i(51487),s=e.i(77306),n=e.i(30597),r=e.i(14865);e.s(["c",0,function({at:e,label:a,onClose:l,children:i}){let o=(0,s.useRef)(null),[c,d]=(0,s.useState)(null);return((0,s.useLayoutEffect)(()=>{let t=o.current;if(!t)return;let s=(0,r.v)();d({left:Math.max(8,Math.min(e.x,s.width-t.offsetWidth-8)),top:Math.max(8,Math.min(e.y,s.height-t.offsetHeight-8))}),t.querySelector('[role="menuitem"]:not(:disabled)')?.focus()},[e]),(0,s.useEffect)(()=>{let e=e=>{o.current?.contains(e.target)||l()},t=e=>{if("Escape"===e.key)e.stopPropagation(),l();else if("ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();let t=[...o.current?.querySelectorAll('[role="menuitem"]:not(:disabled)')??[]],s=t.indexOf(document.activeElement);t[(s+("ArrowDown"===e.key?1:-1)+t.length)%t.length]?.focus()}};return document.addEventListener("pointerdown",e,!0),document.addEventListener("scroll",e,!0),window.addEventListener("resize",l),window.addEventListener("keydown",t,!0),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("scroll",e,!0),window.removeEventListener("resize",l),window.removeEventListener("keydown",t,!0)}},[l]),"u"<typeof document)?null:(0,n.createPortal)((0,t.jsx)("div",{ref:o,role:"menu","aria-label":a,style:{left:c?.left??-9999,top:c?.top??-9999},className:"fixed z-[80] w-56 rounded-lg border border-line bg-panel p-1 shadow-2xl",children:i}),document.body)},"d",0,function({icon:e,label:s,hint:n,onSelect:r,danger:a=!1,disabled:l=!1}){return(0,t.jsxs)("button",{type:"button",role:"menuitem",disabled:l,onClick:r,className:`flex w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm disabled:opacity-40 ${a?"text-bad hover:bg-bad/10":"text-ink hover:bg-panel-2"}`,children:[(0,t.jsx)("span",{className:`flex w-4 shrink-0 justify-center ${a?"":"text-mute"}`,"aria-hidden":!0,children:e?(0,t.jsx)(e,{size:14}):null}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),n?(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-mute",children:n}):null]})},"U",0,function({children:e}){return(0,t.jsx)("div",{className:"px-2.5 pt-1.5 pb-1 text-[11px] font-medium tracking-wide text-mute uppercase",children:e})},"Z",0,function(){return(0,t.jsx)("div",{role:"separator",className:"my-1 h-px bg-line"})}],17847)},17219,e=>{let t=new Uint32Array(256).map((e,t)=>{let s=t;for(let e=0;e<8;e++)s=1&s?0xedb88320^s>>>1:s>>>1;return s>>>0});function s(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!0),t}function n(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function r(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),s=0;for(let n of e)t.set(n,s),s+=n.length;return t}e.s(["f",0,function(e){let a=new TextEncoder,l=[],i=[],o=0;for(let[c,d]of Object.entries(e)){let e=a.encode(c),m="string"==typeof d?a.encode(d):d,p=function(e){let s=0xffffffff;for(let n of e)s=t[(s^n)&255]^s>>>8;return(0xffffffff^s)>>>0}(m),u=r([n(0x4034b50),s(20),s(0),s(0),s(0),s(0),n(p),n(m.length),n(m.length),s(e.length),s(0),e,m]),h=r([n(0x2014b50),s(20),s(20),s(0),s(0),s(0),s(0),n(p),n(m.length),n(m.length),s(e.length),s(0),s(0),s(0),s(0),n(0),n(o),e]);l.push(u),i.push(h),o+=u.length}let c=r(i),d=r([n(0x6054b50),s(0),s(0),s(Object.keys(e).length),s(Object.keys(e).length),n(c.length),n(o),s(0)]),m=r([...l,c,d]);return new Blob([m.buffer.slice(m.byteOffset,m.byteOffset+m.byteLength)],{type:"application/zip"})}])},32035,e=>{var t=e.i(56003);let s={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],32035)},90632,e=>{var t=e.i(56003);let s={name:"columns-3",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],aliases:["panels-left-right"]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],90632)},61318,e=>{var t=e.i(56003);let s={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],61318)},80714,e=>{var t=e.i(56003);let s={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],80714)},92368,e=>{var t=e.i(56003);let s={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],92368)},13817,e=>{var t=e.i(56003);let s={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};s.node;let n=(0,t.f)(s);e.s(["f",0,n],13817)},47298,14168,e=>{var t=e.i(56003);let s={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};s.node;let n=(0,t.f)(s);async function r(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Engine error (${e.status})`);return t}e.s(["f",0,n],47298);let a=(e,t,s)=>fetch(t,{method:e,headers:void 0===s?void 0:{"content-type":"application/json"},body:void 0===s?void 0:JSON.stringify(s)});e.s(["Y",0,{plan:e=>fetch(`/engine/suites/plan?collection=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>r(e)),savePlan:(e,t)=>a("PUT","/engine/suites/plan",{collection:e,...t}).then(e=>r(e)),start:e=>a("POST","/engine/suites/runs",e).then(e=>r(e)),get:e=>fetch(`/engine/suites/runs/${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>r(e)),stop:e=>a("POST",`/engine/suites/runs/${encodeURIComponent(e)}/stop`).then(e=>r(e))},"W",0,function(e){return`/suite?c=${encodeURIComponent(e)}`}],14168)},36558,e=>{function t(e,s=2){if(!Number.isFinite(e))return 0;let n=10**s;return Math.round(e*n)/n}function s(e){return e>=100?Math.round(e):e>=10?t(e,1):t(e,2)}function n(e){return e>=10?Math.round(e):t(e,1)}function r(e,t=e=>e){return null==e?"":t(e)}e.s(["V",0,[{key:"elapsed_s",header:"Seconds into test",description:"Seconds from the start of the run."},{key:"ts",header:"Clock time",description:"Wall-clock time for this one-second sample."},{key:"vus",header:"Concurrent users",description:"Virtual users (VUs) active in this second."},{key:"rps",header:"Requests per second",description:"Completed requests in this second."},{key:"p50_ms",header:"Median latency (ms)",description:"Half of requests this second were faster than this."},{key:"p95_ms",header:"95th percentile (ms)",description:"95% of requests this second were faster than this."},{key:"p99_ms",header:"99th percentile (ms)",description:"The slow tail this second — 1 in 100 was slower."},{key:"failed_rate",header:"Error rate",description:"Share of requests that failed in this second (0–1)."},{key:"http_2xx",header:"Success (2xx)",description:"Successful HTTP responses this second."},{key:"http_4xx",header:"Client errors (4xx)",description:"Client / auth errors this second."},{key:"http_5xx",header:"Server errors (5xx)",description:"Server errors this second."},{key:"http_0",header:"Network failures",description:"No HTTP status (timeout / reset) this second."},{key:"bytes_in",header:"Bytes received",description:"Response bytes this second."},{key:"bytes_out",header:"Bytes sent",description:"Request bytes this second."},{key:"p90_ms",header:"90th percentile (ms)",description:"90% of requests this second were faster than this."},{key:"p999_ms",header:"99.9th percentile (ms)",description:"1 in 1,000 requests this second was slower than this."},{key:"max_ms",header:"Slowest (ms)",description:"Slowest request this second."},{key:"ttfb_ms",header:"Server time (ms)",description:"Average time to first byte this second — the server's own work."},{key:"connect_ms",header:"TCP connect (ms)",description:"Average TCP connect time this second (0 when connections are reused)."},{key:"tls_ms",header:"TLS handshake (ms)",description:"Average TLS handshake time this second."},{key:"checks_passed",header:"Checks passed",description:"Response checks that passed this second."},{key:"checks_failed",header:"Checks failed",description:"Response checks that failed this second."},{key:"dropped",header:"Dropped requests",description:"Rate mode: requests k6 could not start this second."}],"u",0,function(e){return[e.elapsedS,e.ts,t(e.vus,1),s(e.rps),n(e.p50Ms),n(e.p95Ms),n(e.p99Ms),t(e.failedRate,4),e.http2xx,e.http4xx,e.http5xx,e.http0,e.bytesIn,e.bytesOut,r(e.p90Ms,n),r(e.p999Ms,n),r(e.maxMs,n),r(e.ttfbMs,n),r(e.connectMs,n),r(e.tlsMs,n),r(e.checksPassed),r(e.checksFailed),r(e.dropped)]},"E",0,function(e){let{summary:r}=e,a=[{key:"run_id",value:e.id,description:"Id of this run in this browser tab."},{key:"test_name",value:e.testName,description:"Display name (method, path, time)."},{key:"status",value:e.status,description:"completed, failed, cancelled, or still running."},{key:"started_at",value:e.startedAt,description:"When the load test started (UTC)."},{key:"ended_at",value:e.endedAt,description:"When the load test finished (UTC)."},{key:"method",value:e.definition.method,description:"HTTP method that was repeated."},{key:"url",value:e.definition.url,description:"Target URL (secrets are not exported)."},{key:"auth_mode",value:e.definition.auth.mode,description:"Auth used: none, bearer, basic, or api_key. The secret is not exported."},{key:"executor",value:e.definition.load.executor,description:"Load pattern: constant-vus (steady) or ramping-vus (ramp / hold / down)."},{key:"requests",value:r.http.requests,description:"How many HTTP calls finished. Zero usually means the target never answered."},{key:"rps_avg",value:s(r.http.rps.avg),description:"Average requests per second completed by this generator."},{key:"rps_max",value:s(r.http.rps.max),description:"Peak requests per second in any one-second sample."},{key:"failed_count",value:r.http.failed.count,description:"Requests that failed (4xx, 5xx, timeout, or no status)."},{key:"failed_rate",value:t(r.http.failed.rate,4),description:"Failed / total. Default warning bar is 1% (0.01)."},{key:"latency_min_ms",value:n(r.latencyMs.min),description:"Fastest request (milliseconds)."},{key:"latency_mean_ms",value:n(r.latencyMs.mean),description:"Average response time. Slow outliers pull this up."},{key:"latency_p50_ms",value:n(r.latencyMs.median),description:"Median — half of requests were faster than this."},{key:"latency_p95_ms",value:n(r.latencyMs.p95),description:"95th percentile — 95% of requests were faster. Usual headline latency."},{key:"latency_p99_ms",value:n(r.latencyMs.p99),description:"99th percentile — the slow tail (1 in 100 was slower)."},{key:"latency_max_ms",value:n(r.latencyMs.max),description:"Slowest single request."},{key:"vus_max",value:r.vus.max,description:"Peak concurrent users (virtual users / VUs)."},{key:"vus_avg",value:t(r.vus.avg,1),description:"Average concurrent users over the run."},{key:"bytes_in",value:r.data.bytesIn,description:"Response bytes received by the generator."},{key:"bytes_out",value:r.data.bytesOut,description:"Request bytes sent by the generator."},{key:"phase_ttfb_avg_ms",value:n(r.phasesMs.ttfb.avg),description:"Time to first byte — waiting on the server after the connection is up."},{key:"phase_tls_avg_ms",value:n(r.phasesMs.tls.avg),description:"TLS handshake time. High values often mean a far or overloaded endpoint."}];for(let[e,t]of Object.entries(r.http.status)){let s="0"===e?"No HTTP status (timeout / network).":Number(e)>=500?"Server error.":Number(e)>=400?"Client / auth error.":"Success-class response.";a.push({key:`status_${e}`,value:t,description:`How many responses had status ${e}. ${s}`})}for(let e of r.thresholds)a.push({key:`threshold:${e.name}`,value:e.ok?"pass":"fail",description:"k6 threshold result for this run."});return a}])}])})();
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,53356,t=>{"use strict";var o=t.i(51487),r=t.i(86369);t.s(["default",0,function(){return(0,o.jsx)(r.HistoryBrowser,{})}])}]);
@@ -0,0 +1 @@
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,60459,e=>{var t=e.i(51487),n=e.i(30932),r=e.i(56003);let i={name:"file-search",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]};i.node;let a=(0,r.f)(i);var s=e.i(83668),l=e.i(83035),o=e.i(59904);let c={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};c.node;let d=(0,r.f)(c);var u=e.i(29095),f=e.i(52737),h=e.i(31626),m=e.i(40970),p=e.i(86766);let x={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};x.node;let g=(0,r.f)(x);var y=e.i(1326),v=e.i(62620),b=e.i(2552),j=e.i(53798),w=e.i(75050),k=e.i(77306),N=e.i(57515),C=e.i(69578),S=e.i(78739),E=e.i(22079);e.i(24856);var $=e.i(92084),P=e.i(56396),I=e.i(727),M=e.i(43101);function z(){let e=(0,P.d)(),t=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let n=!0,r=async()=>{try{let{now:r,results:i}=await M.c.since(t.current??new Date(Date.now()+31536e6).toISOString());if(!n)return;if(null===t.current){t.current=r;return}for(let n of(t.current=i.at(-1)?.at??t.current,i.filter(e=>e.schedule&&!e.manual&&(0,$.F)(e.schedule.notify,e)))){let t=(0,$.v)(n,n.schedule);e(`${t.title}. ${t.body}`,t.ok?"success":"error"),(0,I.k)({title:t.title,body:t.body,tag:`atc-schedule-${n.scheduleId}`})}i.length&&window.dispatchEvent(new Event(M.T))}catch{}};r();let i=window.setInterval(()=>void r(),2e4);return()=>{n=!1,window.clearInterval(i)}},[e]),null}var T=e.i(39736),O=e.i(73151),A=e.i(68865),R=e.i(15868);function L(){let{items:e,remove:n,clear:r}=(0,A.w)(),i=(0,j.usePathname)(),a=(0,j.useRouter)();if(!e.length||i.startsWith("/compare"))return null;let s=e.length>=2;return(0,t.jsx)("div",{role:"region","aria-label":"Runs to compare",className:"fixed bottom-4 left-1/2 z-[60] w-[min(56rem,calc(100%-2rem))] -translate-x-1/2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-accent/40 bg-panel px-3 py-2.5 shadow-2xl",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-sm font-medium text-ink",children:[(0,t.jsx)(l.f,{size:16,className:"text-accent","aria-hidden":!0}),"Compare",(0,t.jsxs)("span",{className:"text-xs font-normal text-mute",children:[e.length," of ",A.V]})]}),(0,t.jsx)("ul",{className:"flex min-w-0 flex-1 flex-wrap gap-1.5",children:e.map(e=>(0,t.jsxs)("li",{className:"flex max-w-56 items-center gap-1 rounded-full border border-line bg-panel-2 py-0.5 pr-1 pl-2.5 text-xs text-ink",title:`${e.endpoint} \xb7 ${new Date(e.startedAt).toLocaleString()}`,children:[(0,t.jsx)("span",{className:"truncate",children:e.name}),(0,t.jsx)("button",{type:"button",onClick:()=>n(e.id),className:"rounded-full p-0.5 text-mute hover:text-bad","aria-label":`Remove ${e.name} from compare`,children:(0,t.jsx)(v.X,{size:12})})]},e.id))}),(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:r,className:"text-xs text-mute hover:text-ink",children:"Clear"}),(0,t.jsx)("button",{type:"button",disabled:!s,title:s?"Open these runs side by side on Compare":"Add at least two runs",onClick:()=>((0,R.m)(),a.push(`/compare?ids=${e.map(e=>e.id).join(",")}`)),className:"btn btn-primary py-1.5 text-sm",children:s?`Compare ${e.length} runs`:"Add one more run"})]})]})})}var _=e.i(7641),q=e.i(72350),U=e.i(5831),D=e.i(67217),F=e.i(15556),J=e.i(56931),V=e.i(5504),W=e.i(74749),B=e.i(91549),H=e.i(97942);let K={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};K.node;let G=(0,r.f)(K);var Z=e.i(20054);function X(){let{stopped:e}=(0,Z.J)();return((0,k.useEffect)(()=>{e&&window.close()},[e]),e)?(0,t.jsx)("div",{role:"alertdialog","aria-labelledby":"stopped-title",className:"fixed inset-0 z-[90] grid place-items-center bg-canvas/95 p-6 backdrop-blur-sm",children:(0,t.jsxs)("div",{className:"max-w-md space-y-3 text-center",children:[(0,t.jsx)(G,{size:28,className:"mx-auto text-mute","aria-hidden":!0}),(0,t.jsx)("h2",{id:"stopped-title",className:"text-lg font-medium text-ink",children:"APITestCenter was stopped"}),(0,t.jsx)("p",{className:"text-sm text-mute",children:"It was closed from the command line (Ctrl+C). Your saved requests are safe in their folder. You can close this tab."}),(0,t.jsxs)("p",{className:"text-sm text-mute",children:["To open it again, run ",(0,t.jsx)("code",{className:"rounded bg-panel-2 px-1.5 py-0.5 font-mono text-ink",children:"atc ui"})," — this page reconnects by itself if it starts on the same address."]})]})}):null}var Y=e.i(839),Q=e.i(47918);let ee={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};ee.node;let et=(0,r.f)(ee);var en=e.i(17648),er=e.i(15275),ei=e.i(38675),ea=e.i(31561),es=e.i(2810);let el={name:"rows-3",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],aliases:["panels-top-bottom"]};el.node;let eo=(0,r.f)(el),ec={name:"rows-4",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 7.5H3",key:"1hm9pq"}],["path",{d:"M21 12H3",key:"2avoz0"}],["path",{d:"M21 16.5H3",key:"n7jzkj"}]]};ec.node;let ed=(0,r.f)(ec);var eu=e.i(67531),ef=e.i(16239),eh=e.i(2774),em=e.i(45377),ep=e.i(14865);let ex=[{id:"system",label:"Theme follows the system",icon:h.f},{id:"light",label:"Light theme",icon:eh.f},{id:"dark",label:"Dark theme",icon:ea.f}];function eg({onClick:e,title:n,children:r,label:i}){return(0,t.jsx)("button",{type:"button",onClick:e,title:n,"aria-label":i,className:"inline-flex h-6 shrink-0 items-center gap-1.5 rounded px-2 text-mute hover:bg-panel-2 hover:text-ink",children:r})}function ey(){let e=(0,em.f)();if(!e||"ready"!==e.state&&"available"!==e.state&&"downloading"!==e.state)return null;let n="important"===e.level,r="ready"===e.state?"Restart to update":"downloading"===e.state?`Downloading ${e.percent}%`:n?`Important update: ${e.version}`:`${e.version} available`,i="ready"===e.state?`Version ${e.version} is downloaded: restart to update, or it installs when you close the app`:"downloading"===e.state?`Downloading version ${e.version}`:`Version ${e.version} is available — see what's new`;return(0,t.jsxs)("button",{type:"button",onClick:O.g,title:n&&e.why?`${i}. ${e.why}`:i,className:`inline-flex h-6 shrink-0 items-center gap-1.5 rounded px-2 font-medium ${n?"bg-warn/15 text-warn hover:bg-warn/25":"bg-accent-dim text-accent hover:brightness-110"}`,children:[(0,t.jsx)(Q.f,{size:13,"aria-hidden":!0})," ",r]})}function ev(){let{checked:e,online:n,k6Ready:r,k6Label:i,appVersion:a}=(0,Z.J)(),{zoom:s,zoomIn:l,zoomOut:o,resetZoom:c,density:d,setDensity:u}=(0,ep.x)(),{theme:f,setTheme:h}=(0,w.i)(),[m,p]=(0,k.useState)(!1);(0,k.useEffect)(()=>p(!0),[]);let x=Math.max(0,ex.findIndex(e=>e.id===(m?f??"system":"system"))),g=ex[x].icon;return(0,t.jsxs)("footer",{"aria-label":"Status bar",className:"flex h-8 shrink-0 items-center gap-0.5 overflow-x-auto border-t border-line bg-panel px-2 text-xs whitespace-nowrap",children:[(0,t.jsxs)("span",{role:"status",className:"inline-flex shrink-0 items-center gap-2 px-2 text-ink",title:n?i:"Start it with pnpm dev",children:[(0,t.jsx)("span",{className:`h-2 w-2 rounded-full ${e?n&&r?"bg-ok":n?"bg-warn":"bg-bad":"bg-mute"}`,"aria-hidden":!0}),e?n?r?"Engine ready":"Engine online, k6 missing":"Engine offline":"Checking engine"]}),n?(0,t.jsx)("span",{className:"hidden shrink-0 px-1 text-mute md:inline",children:i}):null,(0,t.jsx)("span",{className:"mx-1 h-4 w-px shrink-0 bg-line","aria-hidden":!0}),(0,t.jsxs)(eg,{onClick:()=>(0,D.F)(),title:"Import requests — Postman, Insomnia, Bruno, OpenAPI, .http, Hurl, HAR",children:[(0,t.jsx)(er.f,{size:13,"aria-hidden":!0})," Import"]}),(0,t.jsxs)(eg,{onClick:()=>(0,V.L)(),title:"Cookies kept between requests",children:[(0,t.jsx)(en.f,{size:13,"aria-hidden":!0})," Cookies"]}),(0,t.jsxs)(eg,{onClick:()=>(0,J.j)(),title:"Client certificates and trusted CAs",children:[(0,t.jsx)(ef.f,{size:13,"aria-hidden":!0})," Certificates"]}),(0,t.jsxs)(eg,{onClick:()=>(0,W.o)(),title:"Answer requests with example responses",children:[(0,t.jsx)(eu.f,{size:13,"aria-hidden":!0})," Mock server"]}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsxs)("span",{role:"group","aria-label":"Zoom",className:"inline-flex shrink-0 items-center",children:[(0,t.jsx)(eg,{onClick:o,title:"Zoom out (Ctrl −)",label:"Zoom out",children:(0,t.jsx)(ei.f,{size:13,"aria-hidden":!0})}),(0,t.jsx)(eg,{onClick:c,title:"Reset zoom (Ctrl 0)",label:`Zoom ${Math.round(100*s)}%, reset`,children:(0,t.jsxs)("span",{className:"tabular w-9 text-center font-mono",children:[Math.round(100*s),"%"]})}),(0,t.jsx)(eg,{onClick:l,title:"Zoom in (Ctrl +)",label:"Zoom in",children:(0,t.jsx)(es.f,{size:13,"aria-hidden":!0})})]}),(0,t.jsxs)(eg,{onClick:()=>u("compact"===d?"comfortable":"compact"),title:"compact"===d?"Compact rows — click for comfortable":"Comfortable rows — click for compact",children:["compact"===d?(0,t.jsx)(ed,{size:13,"aria-hidden":!0}):(0,t.jsx)(eo,{size:13,"aria-hidden":!0}),"compact"===d?"Compact":"Comfortable"]}),(0,t.jsx)(eg,{onClick:()=>h(ex[(x+1)%ex.length].id),title:`${ex[x].label} — click to change`,label:`${ex[x].label}. Click to change.`,children:(0,t.jsx)(g,{size:13,"aria-hidden":!0})}),(0,t.jsx)("span",{"data-tour":"help",className:"inline-flex",children:(0,t.jsxs)(eg,{onClick:_.t,title:"What the words mean, and the tour",children:[(0,t.jsx)(et,{size:13,"aria-hidden":!0})," Help"]})}),(0,t.jsx)(ey,{}),(0,t.jsx)(eg,{onClick:S.J,title:"Version, updates, and where your files are",children:a&&"dev"!==a?`v${a}`:"Development build"})]})}var eb=e.i(51554),ej=e.i(21407),ew=e.i(44505),ek=e.i(99822),eN=e.i(48181),eC=e.i(2603),eS=e.i(60889),eE=e.i(30635),e$=e.i(6278);let eP=[{href:"/home",label:"Home",icon:d},{href:"/",label:"Test API",icon:s.f},{href:"/suite",label:"Run collection",icon:u.f},{href:"/compare",label:"Compare",icon:l.f},{href:"/connections",label:"Connections",icon:m.f},{href:"/history",label:"History",icon:o.f},{href:"/preview",label:"Open report",icon:a}],eI="apitestcenter-phone-notice";function eM({children:e}){let r=(0,j.usePathname)(),i=(0,eC.P)(),{activeEnv:a}=(0,e$.U)(),s=(0,eN.v)(a),l=eN.q[s],[o,c]=(0,k.useState)(!1),{resolvedTheme:d}=(0,w.i)(),{current:u}=(0,eE.O)(),{license:m}=(0,eS.f)(),x=m?.account??null;return(0,k.useEffect)(ej.j,[]),(0,k.useEffect)(()=>{let e=(0,ew.f)();e?.platform&&(document.documentElement.dataset.desktop=e.platform),e&&(0,ek.x)()},[]),(0,k.useEffect)(()=>{let e=(0,ew.f)();if(!e?.setTitleBarColours)return;let t=requestAnimationFrame(()=>{let t=getComputedStyle(document.documentElement);e.setTitleBarColours(t.getPropertyValue("--panel").trim(),t.getPropertyValue("--ink").trim())});return()=>cancelAnimationFrame(t)},[d]),(0,k.useEffect)(()=>{c(window.matchMedia("(max-width: 767px)").matches&&"dismissed"!==window.sessionStorage.getItem(eI))},[]),(0,t.jsxs)("div",{className:"flex flex-col overflow-hidden",style:{height:"calc(100dvh / var(--zoom, 1))"},children:[(0,t.jsx)("a",{href:"#main",className:"sr-only z-50 rounded-md bg-accent px-3 py-2 text-sm text-canvas focus:not-sr-only focus:fixed focus:top-2 focus:left-2",children:"Skip to content"}),l?(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-x-0 z-[90]",style:{background:l,height:3,top:"calc(48px / var(--zoom, 1) - 3px)"}}):null,(0,t.jsxs)("header",{className:"app-titlebar flex shrink-0 items-center gap-3 border-b border-line bg-panel px-3",style:{height:"calc(48px / var(--zoom, 1))"},children:[(0,t.jsxs)(b.default,{href:"/",className:"flex shrink-0 items-center gap-2 rounded-md px-1 py-1","aria-label":"APITestCenter home",children:[(0,t.jsx)(N.f,{size:26}),(0,t.jsx)("span",{className:"hidden text-sm font-semibold tracking-tight text-ink sm:inline",children:"APITestCenter"})]}),u?(0,t.jsxs)(b.default,{href:"/home",title:`${u.path} — switch project`,className:"flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 text-sm text-ink hover:bg-panel-2",children:[(0,t.jsx)("span",{className:"text-mute","aria-hidden":!0,children:"/"}),(0,t.jsx)("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{background:(0,eE.W)(u.id)},"aria-hidden":!0}),(0,t.jsx)("span",{className:"max-w-48 truncate",children:u.name}),(0,t.jsx)(n.f,{size:13,className:"shrink-0 text-mute","aria-hidden":!0})]}):null,(0,t.jsx)("div",{className:"flex min-w-0 flex-1 justify-center",children:(0,t.jsxs)("button",{type:"button",onClick:()=>window.dispatchEvent(new Event("atc:palette")),"aria-label":"Open command palette",title:`Search, run or jump to anything (${i}+K)`,className:"flex h-8 w-full max-w-md min-w-0 items-center gap-2 rounded-lg border border-line bg-canvas px-3 text-sm text-mute hover:border-mute hover:text-ink",children:[(0,t.jsx)(p.f,{size:14,"aria-hidden":!0,className:"shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-left",children:"Search, run or jump to anything"}),(0,t.jsxs)("span",{className:"kbd shrink-0",children:[i," K"]})]})}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2 sm:min-w-40",children:[a?(0,t.jsxs)("span",{className:`inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs ${"production"===s?"border-bad/50 bg-bad/10 text-bad":"border-line text-mute"}`,title:"production"===s?"Production: sends that change data ask first":"The environment in use — change it on the right of the request tabs",children:[(0,t.jsx)("span",{className:"h-2 w-2 rounded-full",style:{background:l??"var(--ok)"},"aria-hidden":!0}),a.name]}):null,x?(0,t.jsx)("button",{type:"button",onClick:()=>(0,Y.j)("plan"),"aria-label":`Account: ${x.email}`,title:`Signed in as ${x.email}`,className:"flex h-7 w-7 items-center justify-center rounded-full bg-accent-dim text-xs font-semibold text-ink uppercase hover:ring-1 hover:ring-accent",children:x.email.slice(0,1)}):(0,t.jsxs)("button",{type:"button",onClick:()=>(0,Y.j)("plan"),title:"Optional: brings a Pro or Team plan to this computer",className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-sm text-mute hover:bg-panel-2 hover:text-ink",children:[(0,t.jsx)(f.f,{size:14,"aria-hidden":!0})," Sign in"]}),(0,t.jsx)("button",{type:"button",onClick:()=>(0,Y.j)(),"aria-label":"Settings",title:`Settings (${i}+,)`,className:"rounded-md p-1.5 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(g,{size:16,"aria-hidden":!0})})]})]}),(0,t.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,t.jsxs)("aside",{"aria-label":"Main navigation",className:"flex w-[4.75rem] shrink-0 flex-col items-center gap-1 border-r border-line bg-panel py-2",children:[(0,t.jsx)("nav",{className:"flex w-full flex-col items-center gap-1 px-1.5",children:eP.map(e=>{let n="/"===e.href?"/"===r:r===e.href||r.startsWith(`${e.href}/`),i=e.icon;return(0,t.jsxs)(b.default,{href:e.href,"aria-current":n?"page":void 0,className:`flex w-full flex-col items-center gap-1 rounded-lg px-1 py-2 text-center text-[11px] leading-tight transition-colors ${n?"bg-accent-dim text-ink":"text-mute hover:bg-panel-2 hover:text-ink"}`,children:[(0,t.jsx)(i,{size:18,strokeWidth:1.75,"aria-hidden":!0,className:n?"text-accent":void 0}),e.label]},e.href)})}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("button",{type:"button",onClick:H.V,title:"Deleted requests — restore them for 30 days",className:"flex w-[calc(100%-0.75rem)] flex-col items-center gap-1 rounded-lg px-1 py-2 text-center text-[11px] leading-tight text-mute hover:bg-panel-2 hover:text-ink",children:[(0,t.jsx)(y.f,{size:18,strokeWidth:1.75,"aria-hidden":!0}),"Trash"]})]}),(0,t.jsxs)("main",{id:"main",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",children:[o?(0,t.jsxs)("div",{role:"note",className:"flex items-start gap-3 border-b border-line bg-accent-dim px-4 py-3 text-sm text-ink",children:[(0,t.jsx)(h.f,{size:18,className:"mt-0.5 shrink-0 text-accent","aria-hidden":!0}),(0,t.jsx)("p",{className:"min-w-0 flex-1",children:"APITestCenter is built for a computer. Performance tests run from the machine you use, and the editor needs room. You can still read reports here."}),(0,t.jsx)("button",{type:"button","aria-label":"Dismiss",className:"shrink-0 rounded p-1 text-mute hover:text-ink",onClick:()=>{window.sessionStorage.setItem(eI,"dismissed"),c(!1)},children:(0,t.jsx)(v.X,{size:16})})]}):null,e]})]}),(0,t.jsx)(ev,{}),(0,t.jsx)(C.o,{}),(0,t.jsx)(_.S,{}),(0,t.jsx)(U.D,{}),(0,t.jsx)(D.b,{}),(0,t.jsx)(F.v,{}),(0,t.jsx)(J.t,{}),(0,t.jsx)(V.r,{}),(0,t.jsx)(W.W,{}),(0,t.jsx)(B.m,{}),(0,t.jsx)(H.I,{}),(0,t.jsx)(H.f,{}),(0,t.jsx)(X,{}),(0,t.jsx)(R.f,{}),(0,t.jsx)(S.G,{}),(0,t.jsx)(E.M,{}),(0,t.jsx)(z,{}),(0,t.jsx)(T.q,{}),(0,t.jsx)(O.T,{}),(0,t.jsx)(q._,{}),(0,t.jsx)(Y.$,{}),(0,t.jsx)(L,{}),(0,t.jsx)(eb.b,{})]})}e.s(["AppShell",0,function({children:e}){return(0,t.jsx)(ep.c,{children:(0,t.jsx)(eM,{children:e})})}],60459)},87329,e=>{var t=e.i(51487),n=e.i(75050),r=e.i(39170),i=e.i(68865),a=e.i(56396),s=e.i(20054),l=e.i(59180),o=e.i(48321),c=e.i(6278),d=e.i(88153),u=e.i(24170);e.s(["Providers",0,function({children:e}){return(0,t.jsx)(n.J,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,storageKey:"apitestcenter-theme",children:u.G?(0,t.jsx)(l.w,{children:(0,t.jsx)(o.y,{children:(0,t.jsx)(d.e,{children:(0,t.jsx)(a.N,{children:(0,t.jsx)(r.a,{children:(0,t.jsx)(i.P,{children:e})})})})})}):(0,t.jsx)(s.N,{children:(0,t.jsx)(l.w,{children:(0,t.jsx)(o.y,{children:(0,t.jsx)(c.n,{children:(0,t.jsx)(d.e,{children:(0,t.jsx)(a.N,{children:(0,t.jsx)(r.a,{children:(0,t.jsx)(i.P,{children:e})})})})})})})})})}])},89287,e=>{var t=e.i(51487),n=e.i(87953),r=e.i(31626),i=e.i(31561),a=e.i(2774),s=e.i(75050),l=e.i(77306),o=e.i(57515),c=e.i(24170);let d=[{id:"system",label:"Theme follows your system",icon:r.f},{id:"light",label:"Light theme",icon:a.f},{id:"dark",label:"Dark theme",icon:i.f}];e.s(["ViewerShell",0,function({children:e}){let{theme:r,setTheme:i}=(0,s.i)(),[a,u]=(0,l.useState)(!1);(0,l.useEffect)(()=>u(!0),[]);let f=Math.max(0,d.findIndex(e=>e.id===r)),h=d[a?f:0],m=h.icon;return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col bg-canvas text-ink",children:[(0,t.jsx)("a",{href:"#main",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-2 focus:rounded focus:bg-panel focus:px-3 focus:py-2",children:"Skip to the reports"}),(0,t.jsxs)("header",{className:"flex items-center gap-3 border-b border-line bg-panel px-4 py-2.5 lg:px-6",children:[(0,t.jsxs)("a",{href:c.C,className:"flex items-center gap-2 text-ink","aria-label":"APITestCenter home",children:[(0,t.jsx)(o.f,{size:26}),(0,t.jsx)("span",{className:"font-semibold",children:"APITestCenter"})]}),(0,t.jsx)("span",{className:"hidden text-mute sm:inline","aria-hidden":!0,children:"/"}),(0,t.jsx)("span",{className:"hidden text-sm text-ink sm:inline",children:"Report viewer"}),(0,t.jsxs)("nav",{"aria-label":"Website",className:"ml-auto flex items-center gap-1 text-sm",children:[(0,t.jsx)("a",{href:`${c.C}docs/reading-the-report`,className:"hidden rounded-md px-2.5 py-1.5 text-mute hover:text-ink md:inline",children:"Reading a report"}),(0,t.jsx)("a",{href:`${c.C}learn/`,className:"hidden rounded-md px-2.5 py-1.5 text-mute hover:text-ink md:inline",children:"Learn"}),(0,t.jsx)("button",{type:"button",onClick:()=>i(d[(f+1)%d.length].id),title:`${h.label} — click to change`,"aria-label":`${h.label}. Click to change.`,className:"rounded-md p-2 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(m,{size:16,"aria-hidden":!0})}),(0,t.jsxs)("a",{href:`${c.C}#download`,className:"btn btn-primary py-1.5 text-sm",children:[(0,t.jsx)(n.f,{size:14,"aria-hidden":!0}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Get the app"}),(0,t.jsx)("span",{className:"sm:hidden",children:"App"})]})]})]}),(0,t.jsx)("main",{id:"main",className:"flex min-h-0 flex-1 flex-col",children:e})]})}])},68865,e=>{var t=e.i(51487),n=e.i(77306);let r="apitestcenter-compare-tray",i=(0,n.createContext)({items:[],has:()=>!1,toggle:()=>!1,remove:()=>{},clear:()=>{}});e.s(["P",0,function({children:e}){let[a,s]=(0,n.useState)([]);(0,n.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(r)??"[]");Array.isArray(e)&&s(e.filter(e=>"string"==typeof e?.id&&"string"==typeof e?.name).slice(0,6))}catch{}},[]);let l=(0,n.useCallback)(e=>{s(e);try{localStorage.setItem(r,JSON.stringify(e))}catch{}},[]),o=(0,n.useMemo)(()=>({items:a,has:e=>a.some(t=>t.id===e),toggle:e=>a.some(t=>t.id===e.id)?(l(a.filter(t=>t.id!==e.id)),!0):!(a.length>=6)&&(l([...a,e]),!0),remove:e=>l(a.filter(t=>t.id!==e)),clear:()=>l([])}),[a,l]);return(0,t.jsx)(i.Provider,{value:o,children:e})},"V",0,6,"w",0,function(){return(0,n.useContext)(i)}])},48181,e=>{e.s(["q",0,{production:"var(--bad)",other:null},"v",0,function(e){return e?.production?"production":"other"},"p",0,e=>/^(GET|HEAD|OPTIONS)$/i.test(e)])},727,e=>{var t=e.i(77306),n=e.i(44505);let r="apitestcenter-notify",i="apitestcenter-notify-change";function a(){let e="Notification"in window?Notification.permission:"unsupported";return"unsupported"===e?"unsupported":"denied"===e?"blocked":"default"===e?"ask":"off"===function(){try{let e=localStorage.getItem(r);return"on"===e||"off"===e?e:null}catch{return null}}()?"off":"on"}function s(e){try{localStorage.setItem(r,e)}catch{}window.dispatchEvent(new Event(i))}async function l(){let e=a();return"ask"===e?"granted"===await Notification.requestPermission()?s("on"):window.dispatchEvent(new Event(i)):("on"===e||"off"===e)&&s("on"===e?"off":"on"),a()}let o=()=>"hidden"===document.visibilityState||!document.hasFocus(),c=null,d=null;function u(){null!==c&&(document.title=c),c=null}e.s(["g",0,a,"k",0,function({title:e,body:t,tag:r}){if("u">typeof document&&o()&&"on"===a())try{let i=new Notification(e,{body:t,tag:r});i.onclick=()=>{(0,n.f)()?.showWindow?.(),window.focus(),i.close()}}catch{}},"G",0,function({title:e,body:t,ok:r}){if("u"<typeof document||!o())return;d=null,c??=document.title,document.title=`${r?"✓":"✕"} ${e} — APITestCenter`;let i=()=>{u(),window.removeEventListener("focus",i)};if(window.addEventListener("focus",i),"on"===a())try{let r=new Notification(e,{body:t,tag:"apitestcenter-run",silent:!1});r.onclick=()=>{(0,n.f)()?.showWindow?.(),window.focus(),r.close()}}catch{}},"y",0,l,"n",0,function(e){(0,t.useEffect)(()=>{e?(c??=document.title,d=e,document.title=`${e} — APITestCenter`):d&&(d=null,u())},[e]),(0,t.useEffect)(()=>()=>{d&&(d=null,u())},[])},"I",0,function(){let[e,n]=(0,t.useState)("unsupported");return(0,t.useEffect)(()=>{let e=()=>n(a());return e(),window.addEventListener(i,e),window.addEventListener("focus",e),()=>{window.removeEventListener(i,e),window.removeEventListener("focus",e)}},[]),e}])},99822,e=>{var t=e.i(77306),n=e.i(727),r=e.i(28950);let i=new Map,a=0;function s(){let e=[...new Set(i.values())];if(document.querySelector('[role="dialog"][aria-modal="true"], [role="alertdialog"]')&&e.push("a dialog is open"),e.length)return{ok:!1,holds:e};(0,r.x)();let t=getComputedStyle(document.body);return{ok:!0,notify:"on"===(0,n.g)(),colours:{bg:t.backgroundColor,fg:t.color}}}e.s(["x",0,function(){window.atcRest=s},"R",0,function(e,n){(0,t.useEffect)(()=>{if(!e)return;let t=String(++a);return i.set(t,n),()=>void i.delete(t)},[e,n])}])},88153,e=>{var t=e.i(51487),n=e.i(77306);let r="apitestcenter-session-slo",i=(0,n.createContext)({slo:null,setSlo:()=>{},ready:!1});e.s(["e",0,function({children:e}){let[a,s]=(0,n.useState)(null),[l,o]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{s(function(){try{let e=localStorage.getItem(r)??sessionStorage.getItem(r);if(!e)return null;let t=JSON.parse(e);if("number"!=typeof t.p95Ms||"number"!=typeof t.errorRate||!(t.p95Ms>0)||t.errorRate<0)return null;return{p95Ms:t.p95Ms,errorRate:t.errorRate,p99Ms:"number"==typeof t.p99Ms&&t.p99Ms>0?t.p99Ms:void 0,checksRate:"number"==typeof t.checksRate?t.checksRate:void 0,abortOnFail:!0===t.abortOnFail}}catch{return null}}()),o(!0)},[]),(0,t.jsx)(i.Provider,{value:{slo:a,setSlo:function(e){s(e);try{sessionStorage.removeItem(r),e?localStorage.setItem(r,JSON.stringify(e)):localStorage.removeItem(r)}catch{}},ready:l},children:e})},"G",0,function(){return(0,n.useContext)(i)}])},48321,e=>{var t=e.i(51487);e.i(24856);var n=e.i(86483),r=e.i(77306),i=e.i(24170);let a="apitestcenter-viewer-views",s=(0,n.e)(null),l=(0,r.createContext)({file:s,ready:!1,viewsFor:e=>n.W.filter(t=>t.scope===e),save:async e=>e});function o(){return(0,r.useContext)(l)}let c=e=>`apitestcenter-last-view-${e}`;e.s(["y",0,function({children:e}){let[o,c]=(0,r.useState)(s),[d,u]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(i.G){c((0,n.e)(function(){try{return JSON.parse(localStorage.getItem(a)??"null")}catch{return null}}())),u(!0);return}fetch("/engine/settings/views",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>e&&c((0,n.e)(e))).catch(()=>void 0).finally(()=>u(!0))},[]);let f=(0,r.useCallback)(async e=>{if(i.G){let t=(0,n.e)(e);try{localStorage.setItem(a,JSON.stringify(t))}catch{}return c(t),t}let t=await fetch("/engine/settings/views",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw Error(r.error??"Could not save the view");let s=(0,n.e)(r);return c(s),s},[]),h=(0,r.useMemo)(()=>({file:o,ready:d,viewsFor:e=>[...n.W,...o.views].filter(t=>t.scope===e),save:f}),[o,d,f]);return(0,t.jsx)(l.Provider,{value:h,children:e})},"J",0,function(e){let{file:t,viewsFor:n}=o(),[i,a]=(0,r.useState)(null);(0,r.useEffect)(()=>{try{a(localStorage.getItem(c(e)))}catch{}},[e]);let s=n(e);return[s.find(e=>e.id===i)??s.find(n=>n.id===t.defaults[e])??s[0],(0,r.useCallback)(t=>{a(t);try{localStorage.setItem(c(e),t)}catch{}},[e])]},"o",0,o])},83668,e=>{var t=e.i(56003);let n={name:"flask-conical",size:24,node:[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]};n.node;let r=(0,t.f)(n);e.s(["f",0,r],83668)},83035,e=>{var t=e.i(56003);let n={name:"git-compare-arrows",size:24,node:[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]};n.node;let r=(0,t.f)(n);e.s(["f",0,r],83035)},40970,28950,e=>{var t=e.i(56003);let n={name:"plug",size:24,node:[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]};n.node;let r=(0,t.f)(n);e.s(["f",0,r],40970);var i=e.i(77306);let a=new Map,s="apitestcenter-resting-memory";try{let e=sessionStorage.getItem(s);if(sessionStorage.removeItem(s),e)for(let[t,n]of Object.entries(JSON.parse(e)))a.set(t,n)}catch{}e.s(["x",0,function(){let e={},t=0;for(let[n,r]of a)try{let i=JSON.stringify(r);if(void 0===i||t+i.length>4e6)continue;e[n]=r,t+=i.length}catch{}try{sessionStorage.setItem(s,JSON.stringify(e))}catch{}},"q",0,function(e){return a.get(e)},"V",0,function(e,t){a.set(e,t)},"C",0,function(e,t){let[n,r]=(0,i.useState)(()=>a.has(e)?a.get(e):"function"==typeof t?t():t);return(0,i.useEffect)(()=>{a.set(e,n)},[e,n]),[n,r]}],28950)},2552,(e,t,n)=>{e.i(31746),Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return g},useLinkStatus:function(){return v}};for(var i in r)Object.defineProperty(n,i,{enumerable:!0,get:r[i]});let a=e.r(56421),s=e.r(51487),l=a._(e.r(77306)),o=e.r(64279),c=e.r(58192),d=e.r(11907),u=e.r(48963),f=e.r(64923),h=e.r(14743),m=e.r(94940),p=e.r(15984),x=e.r(63330);function g(t){var n;let r,i,a,[g,v]=(0,l.useOptimistic)(m.IDLE_LINK_STATUS),b=(0,l.useRef)(null),{href:j,as:w,children:k,prefetch:N=null,passHref:C,replace:S,shallow:E,scroll:$,onClick:P,onMouseEnter:I,onTouchStart:M,legacyBehavior:z=!1,onNavigate:T,transitionTypes:O,ref:A,unstable_dynamicOnHover:R,...L}=t;r=k,z&&("string"==typeof r||"number"==typeof r)&&(r=(0,s.jsx)("a",{children:r}));let _=l.default.useContext(c.AppRouterContext),q=!1!==N,U=!1===N?"none":!0===N?"full":"auto",D="none"!==U?"auto"===U?x.FetchStrategy.PPR:x.FetchStrategy.Full:x.FetchStrategy.PPR,F="string"==typeof(n=w||j)?n:(0,o.formatUrl)(n);if(z){if(r?.$$typeof===Symbol.for("react.lazy"))throw Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag.");i=l.default.Children.only(r)}let J=z?i&&"object"==typeof i&&i.ref:A,V,W=l.default.useCallback(e=>(null!==_&&(b.current=(0,m.mountLinkInstance)(e,F,_,D,q,v,V)),()=>{b.current&&((0,m.unmountLinkForCurrentNavigation)(b.current),b.current=null),(0,m.unmountPrefetchableInstance)(e)}),[q,F,_,D,v,V]),B={ref:(0,d.useMergedRef)(W,J),onClick(t){z||"function"!=typeof P||P(t),z&&i.props&&"function"==typeof i.props.onClick&&i.props.onClick(t),!_||t.defaultPrevented||function(t,n,r,i,a,s,l,o="none"){if("u">typeof window){let c,{nodeName:d}=t.currentTarget;if("A"===d.toUpperCase()&&((c=t.currentTarget.getAttribute("target"))&&"_self"!==c||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,p.isLocalURL)(n)){i&&(t.preventDefault(),location.replace(n));return}if(t.preventDefault(),s){let e=!1;if(s({preventDefault:()=>{e=!0}}),e)return}let{navigate:u}=e.r(29451);u(n,i?"replace":"push",!1===a?h.ScrollBehavior.NoScroll:h.ScrollBehavior.Default,r.current,l,o)}}(t,F,b,S,$,T,O,U)},onMouseEnter(e){z||"function"!=typeof I||I(e),z&&i.props&&"function"==typeof i.props.onMouseEnter&&i.props.onMouseEnter(e),_&&q&&(0,m.onNavigationIntent)(e.currentTarget,!0===R)},onTouchStart:function(e){z||"function"!=typeof M||M(e),z&&i.props&&"function"==typeof i.props.onTouchStart&&i.props.onTouchStart(e),_&&q&&(0,m.onNavigationIntent)(e.currentTarget,!0===R)}};return(0,u.isAbsoluteUrl)(F)?B.href=F:z&&!C&&("a"!==i.type||"href"in i.props)||(B.href=(0,f.addBasePath)(F)),a=z?l.default.cloneElement(i,B):(0,s.jsx)("a",{...L,...B,children:r}),(0,s.jsx)(y.Provider,{value:g,children:a})}let y=(0,l.createContext)(m.IDLE_LINK_STATUS),v=()=>(0,l.useContext)(y);("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},11907,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useMergedRef",{enumerable:!0,get:function(){return i}});let r=e.r(77306);function i(e,t){let n=(0,r.useRef)(null),i=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=n.current;e&&(n.current=null,e());let t=i.current;t&&(i.current=null,t())}else e&&(n.current=a(e,r)),t&&(i.current=a(t,r))},[e,t])}function a(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let n=e(t);return"function"==typeof n?n:()=>e(null)}}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},64279,(e,t,n)=>{e.i(31746),Object.defineProperty(n,"__esModule",{value:!0});var r={formatUrl:function(){return l},formatWithValidation:function(){return c},urlObjectKeys:function(){return o}};for(var i in r)Object.defineProperty(n,i,{enumerable:!0,get:r[i]});let a=e.r(56421)._(e.r(50152)),s=/https?|ftp|gopher|file/;function l(e){let{auth:t,hostname:n}=e,r=e.protocol||"",i=e.pathname||"",l=e.hash||"",o=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:n&&(c=t+(~n.indexOf(":")?`[${n}]`:n),e.port&&(c+=":"+e.port)),o&&"object"==typeof o&&(o=String(a.urlQueryToSearchParams(o)));let d=e.search||o&&`?${o}`||"";return r&&!r.endsWith(":")&&(r+=":"),e.slashes||(!r||s.test(r))&&!1!==c?(c="//"+(c||""),i&&"/"!==i[0]&&(i="/"+i)):c||(c=""),l&&"#"!==l[0]&&(l="#"+l),d&&"?"!==d[0]&&(d="?"+d),i=i.replace(/[?#]/g,encodeURIComponent),d=d.replace("#","%23"),`${r}${c}${i}${d}${l}`}let o=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return l(e)}},15984,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"isLocalURL",{enumerable:!0,get:function(){return a}});let r=e.r(48963),i=e.r(48772);function a(e){if(!(0,r.isAbsoluteUrl)(e))return!0;try{let t=(0,r.getLocationOrigin)(),n=new URL(e,t);return n.origin===t&&(0,i.hasBasePath)(n.pathname)}catch(e){return!1}}},48963,(e,t,n)=>{e.i(31746),Object.defineProperty(n,"__esModule",{value:!0});var r={DecodeError:function(){return g},MiddlewareNotFoundError:function(){return j},MissingStaticPage:function(){return b},NormalizeError:function(){return y},PageNotFoundError:function(){return v},SP:function(){return p},ST:function(){return x},WEB_VITALS:function(){return a},execOnce:function(){return s},getDisplayName:function(){return u},getLocationOrigin:function(){return c},getURL:function(){return d},isAbsoluteUrl:function(){return o},isResSent:function(){return f},loadGetInitialProps:function(){return m},normalizeRepeatedSlashes:function(){return h},stringifyError:function(){return w}};for(var i in r)Object.defineProperty(n,i,{enumerable:!0,get:r[i]});let a=["CLS","FCP","INP","LCP","TTFB"];function s(e){let t,n=!1;return(...r)=>(n||(n=!0,t=e(...r)),t)}let l=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,o=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&l.test(e)};function c(){let{protocol:e,hostname:t,port:n}=window.location;return`${e}//${t}${n?":"+n:""}`}function d(){let{href:e}=window.location,t=c();return e.substring(t.length)}function u(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function h(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function m(e,t){let n=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await m(t.Component,t.ctx)}:{};let r=await e.getInitialProps(t);if(n&&f(n))return r;if(!r)throw Error(`"${u(e)}.getInitialProps()" should resolve to an object. But found "${r}" instead.`);return r}let p="u">typeof performance,x=p&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class g extends Error{}class y extends Error{}class v extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class b extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class j extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function w(e){return JSON.stringify({message:e.message,stack:e.stack})}},92084,43101,e=>{e.s(["S",0,{changes:"When it starts failing, and when it's fixed",failures:"Every failed run",always:"Every run",never:"Never"},"l",0,[5,15,30,60,180,360,720,1440],"s",0,function(e){return e<60?`every ${e} minutes`:60===e?"every hour":e<1440?`every ${e/60} hours`:1440===e?"every day":`every ${e/1440} days`},"K",0,function(e){return e.lastRunAt?Date.parse(e.lastRunAt)+6e4*e.everyMinutes:Date.parse(e.createdAt)},"v",0,function(e,t){let n=t.collection||"Requests outside a folder";if("fixed"===e.change)return{ok:!0,title:`${n} is passing again`,body:e.headline};if(!e.passed){let t=e.failed[0];return{ok:!1,title:`${n} ${"failing"===e.change?"started failing":"failed again"}`,body:t?`${e.headline} — ${t.name}${t.message?`: ${t.message}`:""}`:e.headline}}return{ok:!0,title:`${n} passed`,body:e.headline}},"F",0,function(e,t){return"never"!==e&&("always"===e||("failures"===e?!t.passed||"fixed"===t.change:null!==t.change))}],92084);var t=e.i(77306);let n="atc:schedules-changed";async function r(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Engine error (${e.status})`);return t}let i=(e,t,n)=>fetch(t,{method:e,headers:void 0===n?void 0:{"content-type":"application/json"},body:void 0===n?void 0:JSON.stringify(n)}),a=e=>(window.dispatchEvent(new Event(n)),e),s={list:()=>fetch("/engine/schedules",{cache:"no-store"}).then(e=>r(e)).then(e=>e.schedules),add:e=>i("POST","/engine/schedules",e).then(e=>r(e)).then(a),update:(e,t)=>i("PUT",`/engine/schedules/${encodeURIComponent(e)}`,t).then(e=>r(e)).then(a),remove:e=>i("DELETE",`/engine/schedules/${encodeURIComponent(e)}`).then(e=>r(e)).then(a),run:e=>i("POST",`/engine/schedules/${encodeURIComponent(e)}/run`).then(e=>r(e)).then(a),since:e=>fetch(`/engine/schedules/results?since=${encodeURIComponent(e)}`,{cache:"no-store"}).then(e=>r(e))};e.s(["T",0,n,"c",0,s,"C",0,function(){let[e,r]=(0,t.useState)(null),i=(0,t.useCallback)(()=>void s.list().then(r,()=>r(e=>e??[])),[]);return(0,t.useEffect)(()=>{i();let e=window.setInterval(i,3e4);return window.addEventListener(n,i),()=>{window.clearInterval(e),window.removeEventListener(n,i)}},[i]),e}],43101)}])})();