apitestcenter 0.16.0 → 0.17.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 (82) hide show
  1. package/dist/THIRD-PARTY-NOTICES-UI.txt +1 -1
  2. package/dist/THIRD-PARTY-NOTICES.txt +1 -1
  3. package/dist/cli.mjs +392 -381
  4. package/dist/ui/404/index.html +1 -1
  5. package/dist/ui/404.html +1 -1
  6. package/dist/ui/__next.__PAGE__.txt +11 -11
  7. package/dist/ui/__next._full.txt +12 -12
  8. package/dist/ui/__next._tree.txt +2 -2
  9. package/dist/ui/_next/static/chunks/036rg3itpc5ge.js +50 -0
  10. package/dist/ui/_next/static/chunks/0e8f1i6w6dqos.js +50 -0
  11. package/dist/ui/_next/static/chunks/0ed__sgjyhon8.css +3 -0
  12. package/dist/ui/_next/static/chunks/0hvubzjy33qo9.js +2 -0
  13. package/dist/ui/_next/static/chunks/{2-fk7_1yukwm4.js → 1519k06vxy4mr.js} +1 -1
  14. package/dist/ui/_next/static/chunks/1wd-qahqqdfeq.js +27 -0
  15. package/dist/ui/_next/static/chunks/2aifruy-vhchn.js +50 -0
  16. package/dist/ui/_next/static/chunks/{3o926vjke_xbm.js → 2b31vf5n6d6th.js} +199 -88
  17. package/dist/ui/_next/static/chunks/33kvaxr7qvnue.js +50 -0
  18. package/dist/ui/_next/static/chunks/36wzwezwmtzq7.js +51 -0
  19. package/dist/ui/_next/static/chunks/3b26__7yusttj.js +1 -0
  20. package/dist/ui/_next/static/chunks/3n2xlaj16gyb-.js +2 -0
  21. package/dist/ui/_next/static/chunks/3r75fvzmnyvck.js +123 -0
  22. package/dist/ui/_next/static/chunks/3vso5wrs90xx-.js +50 -0
  23. package/dist/ui/_next/static/chunks/40y4-vb2nag2l.js +3 -0
  24. package/dist/ui/_not-found/__next._full.txt +11 -11
  25. package/dist/ui/_not-found/__next._not-found.__PAGE__.txt +10 -10
  26. package/dist/ui/_not-found/__next._tree.txt +2 -2
  27. package/dist/ui/_not-found/index.html +1 -1
  28. package/dist/ui/_not-found/index.txt +11 -11
  29. package/dist/ui/compare/__next._full.txt +12 -12
  30. package/dist/ui/compare/__next._tree.txt +2 -2
  31. package/dist/ui/compare/__next.compare.__PAGE__.txt +11 -11
  32. package/dist/ui/compare/index.html +1 -1
  33. package/dist/ui/compare/index.txt +12 -12
  34. package/dist/ui/connections/__next._full.txt +12 -12
  35. package/dist/ui/connections/__next._tree.txt +2 -2
  36. package/dist/ui/connections/__next.connections.__PAGE__.txt +11 -11
  37. package/dist/ui/connections/index.html +2 -2
  38. package/dist/ui/connections/index.txt +12 -12
  39. package/dist/ui/history/__next._full.txt +13 -13
  40. package/dist/ui/history/__next._tree.txt +2 -2
  41. package/dist/ui/history/__next.history.__PAGE__.txt +12 -12
  42. package/dist/ui/history/index.html +1 -1
  43. package/dist/ui/history/index.txt +13 -13
  44. package/dist/ui/home/__next._full.txt +12 -12
  45. package/dist/ui/home/__next._tree.txt +2 -2
  46. package/dist/ui/home/__next.home.__PAGE__.txt +11 -11
  47. package/dist/ui/home/index.html +1 -1
  48. package/dist/ui/home/index.txt +12 -12
  49. package/dist/ui/index.html +1 -1
  50. package/dist/ui/index.txt +12 -12
  51. package/dist/ui/preview/__next._full.txt +13 -13
  52. package/dist/ui/preview/__next._tree.txt +2 -2
  53. package/dist/ui/preview/__next.preview.__PAGE__.txt +12 -12
  54. package/dist/ui/preview/index.html +1 -1
  55. package/dist/ui/preview/index.txt +13 -13
  56. package/dist/ui/suite/__next._full.txt +12 -12
  57. package/dist/ui/suite/__next._tree.txt +2 -2
  58. package/dist/ui/suite/__next.suite.__PAGE__.txt +11 -11
  59. package/dist/ui/suite/index.html +1 -1
  60. package/dist/ui/suite/index.txt +12 -12
  61. package/dist/ui/tests/__next._full.txt +11 -11
  62. package/dist/ui/tests/__next._tree.txt +2 -2
  63. package/dist/ui/tests/__next.tests.__PAGE__.txt +10 -10
  64. package/dist/ui/tests/index.html +1 -1
  65. package/dist/ui/tests/index.txt +11 -11
  66. package/package.json +1 -1
  67. package/dist/ui/_next/static/chunks/0z965ndwtjbm_.js +0 -51
  68. package/dist/ui/_next/static/chunks/11ttwsn_q1n9e.js +0 -50
  69. package/dist/ui/_next/static/chunks/1dblkl6d18f29.js +0 -50
  70. package/dist/ui/_next/static/chunks/1g6q7zaut7pts.js +0 -50
  71. package/dist/ui/_next/static/chunks/1mj3_49yxxkvu.js +0 -3
  72. package/dist/ui/_next/static/chunks/22z3xj74zl8o3.js +0 -1
  73. package/dist/ui/_next/static/chunks/24xh2ng9tdid9.js +0 -50
  74. package/dist/ui/_next/static/chunks/2844deqm9c797.js +0 -50
  75. package/dist/ui/_next/static/chunks/2p2xxbfeii3so.css +0 -3
  76. package/dist/ui/_next/static/chunks/37fbrlydrkdac.js +0 -10
  77. package/dist/ui/_next/static/chunks/3ddcv0i2wy657.js +0 -2
  78. package/dist/ui/_next/static/chunks/3oetlmylrxpce.js +0 -123
  79. package/dist/ui/_next/static/chunks/41xixugzzb47w.js +0 -27
  80. /package/dist/ui/_next/static/{emu38N9csb28KU3jv4SH4 → u2V4Oq6faI2f3slbxdtb5}/_buildManifest.js +0 -0
  81. /package/dist/ui/_next/static/{emu38N9csb28KU3jv4SH4 → u2V4Oq6faI2f3slbxdtb5}/_clientMiddlewareManifest.js +0 -0
  82. /package/dist/ui/_next/static/{emu38N9csb28KU3jv4SH4 → u2V4Oq6faI2f3slbxdtb5}/_ssgManifest.js +0 -0
@@ -0,0 +1,2 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,6980,e=>{"use strict";var t=e.i(14368);e.i(24856);var s=e.i(90870),n=e.i(2385),a=e.i(36163),r=e.i(78451),l=e.i(90139),i=e.i(95486),o=e.i(1245),c=e.i(33577),d=e.i(89932),u=e.i(85905),m=e.i(47677),h=e.i(20621),p=e.i(91694),x=e.i(30197),f=e.i(27813),b=e.i(99522);let y=(0,b.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),g=(0,b.default)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);var v=e.i(3792),k=e.i(5769),w=e.i(71189);let j=(0,b.default)("rows-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);var N=e.i(95927),S=e.i(50962),E=e.i(66478);let C=(0,b.default)("square-x",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var R=e.i(10281),q=e.i(87283),$=e.i(99181),M=e.i(63343),O=e.i(44794),T=e.i(31753),P=e.i(29724),L=e.i(60566),A=e.i(39170),I=e.i(13318),U=e.i(68228),F=e.i(59100);let D=(0,b.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var z=e.i(80707),_=e.i(56396);e.i(42674);var V=e.i(5305),J=e.i(6278);let K="\0new";function H(e,t){if(!t.has("baseUrl"))return"baseUrl";let s="api";try{s=new URL(e).hostname.split(".")[0].replace(/[^A-Za-z0-9]/g,"")||"api"}catch{}let n=`${s}Url`;for(let e=2;t.has(n);e++)n=`${s}Url${e}`;return n}function B({draft:e,sent:s,onChange:n}){let{environments:a,activeEnv:r,vars:l}=(0,J.useWorkspace)(),[i,o]=(0,$.useState)(!1),c=function(e){try{let t=new URL(e);if(!/^https?:$/.test(t.protocol)||["localhost","127.0.0.1"].includes(t.hostname))return[];let s=t.origin,n=t.pathname.split("/").filter(Boolean);return n.length>=2?[s,`${s}/${n[0]}`]:[s]}catch{return[]}}(e.url),d=new Set(Object.values(l).map(e=>e.trim().replace(/\/+$/,"")));return!s||!c.length||c.some(e=>d.has(e))?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>o(!0),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-accent hover:underline",title:"Keep this server address in an environment",children:[(0,t.jsx)(D,{size:13,"aria-hidden":!0})," Save ",c[0].replace(/^https?:\/\//,"")," as a base URL"]}),i?(0,t.jsx)(W,{draft:e,addresses:c,environments:a,activeEnvId:r?.id??null,onChange:n,onClose:()=>o(!1)}):null]})}function W({draft:e,addresses:s,environments:n,activeEnvId:a,onChange:r,onClose:l}){let i=(0,_.useToast)(),{index:o,saveEnvironments:c,setActiveEnv:d,refresh:u}=(0,J.useWorkspace)(),[m,h]=(0,$.useState)(s[0]),[p,x]=(0,$.useState)(a??n[0]?.id??K),[f,b]=(0,$.useState)(()=>{try{return new URL(s[0]).hostname.split(".").slice(0,2).join(" ")}catch{return"My API"}}),y=n.find(e=>e.id===p)??null,g=(0,$.useMemo)(()=>new Set((y?.variables??[]).map(e=>e.key)),[y]),[v,k]=(0,$.useState)(()=>H(s[0],g)),[w,j]=(0,$.useState)(!0),[N,S]=(0,$.useState)(!1),E=(0,$.useRef)(null);(0,$.useEffect)(()=>E.current?.focus(),[]),(0,$.useEffect)(()=>k(H(m,g)),[m,g]);let C=(o?.requests??[]).filter(t=>t.url.startsWith(m)&&t.url!==e.url),R=y?.variables.find(e=>e.key===v),M=F.VARIABLE_NAME.test(v)&&(p!==K||f.trim());async function O(){if(M&&!N){S(!0);try{let t=p===K?globalThis.crypto?.randomUUID?.()??`env-${Date.now().toString(36)}`:p,s=structuredClone(n),a=s.find(e=>e.id===t);a||(a={id:t,name:f.trim(),variables:[]},s.push(a)),a.variables=[...a.variables.filter(e=>e.key!==v),{key:v,value:m,secret:!1}],await c(s),d(t),r((0,V.withUrl)(e,`{{${v}}}${e.url.slice(m.length)}`));let o=0,h=0;if(w){for(let e of C){let t=await J.workspaceApi.get(e.id).catch(()=>null);if(!t||t.secretsMissing?.length){h++;continue}let s=(0,V.requestFromUnknown)(t.request);s.url.startsWith(m)&&(await J.workspaceApi.update(e.id,{name:t.name,collection:t.collection,request:(0,V.withUrl)(s,`{{${v}}}${s.url.slice(m.length)}`)}),o++)}await u()}i(`Saved {{${v}}} in ${a.name}.${o?` ${o} other saved request${1===o?"":"s"} now use it.`:""}${h?` ${h} left as they were (a saved secret isn't available).`:""} Save this request to keep the change.`,"success"),l()}catch(e){i(e instanceof Error?e.message:"Could not save the base URL","error")}finally{S(!1)}}}return(0,t.jsx)("div",{className:"fixed inset-0 z-[75] flex items-center-safe justify-center overflow-y-auto bg-black/50 p-4 sm:p-16",role:"presentation",onMouseDown:e=>e.target===e.currentTarget&&!N&&l(),children:(0,t.jsxs)("form",{role:"dialog","aria-modal":"true","aria-labelledby":"save-base-title",onSubmit:e=>{e.preventDefault(),O()},onKeyDown:e=>"Escape"===e.key&&!N&&l(),className:"w-full max-w-lg space-y-4 rounded-xl border border-line bg-panel p-5 shadow-2xl",children:[(0,t.jsxs)("header",{className:"flex items-center gap-2",children:[(0,t.jsx)("h2",{id:"save-base-title",className:"text-base font-medium text-ink",children:"Save as a base URL"}),(0,t.jsx)("button",{type:"button",onClick:l,"aria-label":"Close",className:"ml-auto rounded p-1 text-mute hover:text-ink",children:(0,t.jsx)(q.X,{size:16})})]}),(0,t.jsx)("p",{className:"text-sm text-mute",children:"Keep the server address in an environment, so you type only the path — and switch servers (UAT, Prod) by switching environments."}),(0,t.jsxs)("fieldset",{className:"space-y-1.5",children:[(0,t.jsx)("legend",{className:"mb-1 text-xs text-mute",children:"Address"}),s.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-ink",children:[(0,t.jsx)("input",{type:"radio",name:"address",checked:m===e,onChange:()=>h(e)}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e})]},e))]}),(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,t.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-mute",children:["Environment",(0,t.jsx)(z.Select,{label:"Environment",value:p,onChange:x,options:[...n.map(e=>({value:e.id,label:e.name,hint:`${e.variables.length} variables`})),{value:K,label:"New environment…"}],className:"rounded-md border border-line bg-panel-2 px-2 py-1.5 text-sm text-ink"})]}),(0,t.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-mute",children:["Variable name",(0,t.jsx)("input",{ref:E,value:v,onChange:e=>k(e.target.value.replace(/[^\w.-]/g,"")),className:"input py-1.5 font-mono text-sm"})]}),p===K?(0,t.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-mute sm:col-span-2",children:["New environment name",(0,t.jsx)("input",{value:f,onChange:e=>b(e.target.value),className:"input py-1.5 text-sm"})]}):null]}),R&&R.value!==m?(0,t.jsxs)("p",{className:"text-xs text-warn",children:[`{{${v}}}`," already exists in this environment (",R.value,") — it will be replaced."]}):null,(0,t.jsxs)("p",{className:"rounded-md bg-panel-2 px-3 py-2 font-mono text-xs text-ink break-all",children:[`{{${v}}}`,(0,t.jsx)("span",{className:"text-mute",children:e.url.slice(m.length)||"/"})]}),C.length?(0,t.jsxs)("label",{className:"flex items-start gap-2 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",checked:w,onChange:e=>j(e.target.checked),className:"mt-1"}),(0,t.jsxs)("span",{children:["Also switch ",C.length," other saved request",1===C.length?"":"s"," that use this address",(0,t.jsxs)("span",{className:"block text-xs text-mute",children:[C.slice(0,3).map(e=>e.name).join(", "),C.length>3?` and ${C.length-3} more`:""]})]})]}):null,(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:l,disabled:N,children:"Cancel"}),(0,t.jsx)("button",{type:"submit",className:"btn btn-primary",disabled:!M||N,children:"Save base URL"})]})]})})}var Q=e.i(65638),X=e.i(37837),Y=e.i(17847);function G(e,t){let s=(0,$.useRef)(!0);(0,$.useEffect)(()=>{if(s.current){s.current=!1;return}let t=e.current;!t||function(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}()||"function"!=typeof t.animate||t.animate([{opacity:.35,transform:"translateY(3px)"},{opacity:1,transform:"none"}],{duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)"})},[e,t])}var Z=e.i(97716);let ee=(e,t)=>"number"==typeof t?`${e}[${t}]`:/^[A-Za-z_$][\w$]*$/.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`;var et=e.i(96659),es=e.i(19656);function en({requestId:e,refreshKey:s,onOpen:n}){let a=(0,$.useRef)(null),[r,l]=(0,$.useState)(!1),[i,o]=(0,$.useState)([]),c=()=>void fetch(`/engine/responses/${e}`,{cache:"no-store"}).then(e=>e.ok?e.json():{answers:[]}).then(e=>o(e.answers)).catch(()=>void 0);return((0,$.useEffect)(c,[e,s]),i.length<2)?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{ref:a,type:"button",onClick:()=>l(e=>!e),"aria-expanded":r,title:"Earlier answers of this request — open one, or see what changed",className:"inline-flex items-center gap-1 rounded-md border border-line px-2 py-0.5 text-xs text-mute hover:border-accent hover:text-ink",children:[(0,t.jsx)(p.History,{size:12,"aria-hidden":!0})," Earlier · ",i.length-1]}),(0,t.jsx)(X.Popover,{anchor:a,open:r,onClose:()=>l(!1),label:"Earlier answers",width:340,children:(0,t.jsxs)("div",{className:"max-h-80 overflow-auto p-1",children:[(0,t.jsxs)("p",{className:"px-2 py-1.5 text-xs text-mute",children:["The last ",i.length," answers of this request, newest first · ",(0,es.formatBytes)(i.reduce((e,t)=>e+t.size,0))," kept"]}),(0,t.jsx)("ul",{children:i.map((s,a)=>{let r;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:async()=>{let t=await fetch(`/engine/responses/${e}/${a}`,{cache:"no-store"});t.ok&&n(await t.json(),a),l(!1)},className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-panel-2",children:[(0,t.jsx)("span",{className:`rounded border px-1.5 font-mono ${(0,L.statusTone)(s.status)}`,children:s.status||"ERR"}),(0,t.jsx)("span",{className:"text-ink",children:0===a?"Latest":(r=new Date(s.at),new Date().toDateString()===r.toDateString()?r.toLocaleTimeString():r.toLocaleString())}),(0,t.jsxs)("span",{className:"ml-auto font-mono text-mute",children:[Math.round(s.durationMs)," ms"]}),(0,t.jsx)("span",{className:"w-16 text-right font-mono text-mute",children:(0,es.formatBytes)(s.size)}),s.checks?(0,t.jsxs)("span",{className:s.passed===s.checks?"text-ok":"text-bad",children:[s.passed,"/",s.checks]}):null]})},s.at)})}),(0,t.jsxs)("button",{type:"button",onClick:async()=>{await fetch(`/engine/responses/${e}`,{method:"DELETE"}),l(!1),c()},className:"mt-1 flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-xs text-mute hover:bg-panel-2 hover:text-bad",children:[(0,t.jsx)(et.Trash2,{size:12,"aria-hidden":!0})," Forget these answers"]})]})})]})}function ea(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}let er=e=>{let t="string"==typeof e?JSON.stringify(e):JSON.stringify(e)??"undefined";return t.length>80?`${t.slice(0,79)}…`:t};function el({earlier:e,latest:s}){let n=(0,$.useMemo)(()=>(function(e,t,s=200){let n,a;try{n=JSON.parse(e),a=JSON.parse(t)}catch{return null}let r=[],l=(e,t,n,a)=>{if(r.length>=s)return;let i=null!==t&&"object"==typeof t;if(null!==e&&"object"==typeof e&&i&&Array.isArray(e)===Array.isArray(t)&&a<40){if(Array.isArray(e)&&Array.isArray(t)){for(let i=0;i<Math.max(e.length,t.length)&&(i>=e.length?r.push({path:ee(n,i),kind:"added",after:t[i]}):i>=t.length?r.push({path:ee(n,i),kind:"removed",before:e[i]}):l(e[i],t[i],ee(n,i),a+1),!(r.length>=s));i++);return}for(let i of new Set([...Object.keys(e),...Object.keys(t)]))if(i in t?i in e?l(e[i],t[i],ee(n,i),a+1):r.push({path:ee(n,i),kind:"added",after:t[i]}):r.push({path:ee(n,i),kind:"removed",before:e[i]}),r.length>=s)break;return}JSON.stringify(e)!==JSON.stringify(t)&&r.push({path:n,kind:"changed",before:e,after:t})};return l(n,a,"$",0),r})(e.body,s.body),[e.body,s.body]),a=(0,$.useMemo)(()=>(function(e,t,s=3e3){let n=e.split("\n"),a=t.split("\n"),r=n.length>s||a.length>s;n=n.slice(0,s),a=a.slice(0,s);let l=0;for(;l<n.length&&l<a.length&&n[l]===a[l];)l++;let i=n.length,o=a.length;for(;i>l&&o>l&&n[i-1]===a[o-1];)i--,o--;let c=n.slice(l,i),d=a.slice(l,o),u=n.slice(0,l).map(e=>({kind:"same",text:e}));if(c.length*d.length>4e6)u.push(...c.map(e=>({kind:"removed",text:e})),...d.map(e=>({kind:"added",text:e})));else{let e=d.length+1,t=new Uint32Array((c.length+1)*e);for(let s=c.length-1;s>=0;s--)for(let n=d.length-1;n>=0;n--)t[s*e+n]=c[s]===d[n]?t[(s+1)*e+n+1]+1:Math.max(t[(s+1)*e+n],t[s*e+n+1]);let s=0,n=0;for(;s<c.length&&n<d.length;)c[s]===d[n]?(u.push({kind:"same",text:c[s]}),s++,n++):t[(s+1)*e+n]>=t[s*e+n+1]?u.push({kind:"removed",text:c[s++]}):u.push({kind:"added",text:d[n++]});for(;s<c.length;)u.push({kind:"removed",text:c[s++]});for(;n<d.length;)u.push({kind:"added",text:d[n++]})}return u.push(...n.slice(i).map(e=>({kind:"same",text:e}))),{lines:u,cut:r}})(ea(e.body),ea(s.body)),[e.body,s.body]),r=a.lines.filter(e=>"same"!==e.kind).length;return(0,t.jsxs)("div",{className:"space-y-3 overflow-auto",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-mute",children:[(0,t.jsxs)("span",{children:["Status ",(0,t.jsx)("span",{className:"font-mono text-ink",children:e.status})," → ",(0,t.jsx)("span",{className:"font-mono text-ink",children:s.status}),e.status===s.status?" (same)":""]}),(0,t.jsxs)("span",{children:["Time ",(0,t.jsxs)("span",{className:"font-mono text-ink",children:[Math.round(e.durationMs)," ms"]})," → ",(0,t.jsxs)("span",{className:"font-mono text-ink",children:[Math.round(s.durationMs)," ms"]})]}),(0,t.jsx)("span",{children:r?`${r} line${1===r?"":"s"} differ`:"The body is the same"})]}),e.masked?(0,t.jsx)("p",{className:"text-xs text-mute",children:"Values that look like secrets were hidden when the earlier answer was kept, so they show as changed."}):null,n&&n.length?(0,t.jsxs)("section",{"aria-label":"Changed fields",children:[(0,t.jsxs)("h3",{className:"mb-1 text-xs font-medium text-mute",children:[n.length," field",1===n.length?"":"s"," changed",n.length>=200?" (the first 200)":""]}),(0,t.jsx)("ul",{className:"max-h-56 space-y-0.5 overflow-auto rounded-md border border-line bg-panel-2 p-2 font-mono text-xs",children:n.map((e,s)=>(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"text-ink",children:e.path})," ","changed"===e.kind?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-bad line-through decoration-bad/60",children:er(e.before)})," → ",(0,t.jsx)("span",{className:"text-ok",children:er(e.after)})]}):"added"===e.kind?(0,t.jsxs)("span",{className:"text-ok",children:["added ",er(e.after)]}):(0,t.jsxs)("span",{className:"text-bad",children:["removed (was ",er(e.before),")"]})]},s))})]}):null,(0,t.jsxs)("section",{"aria-label":"Line by line",children:[(0,t.jsxs)("h3",{className:"mb-1 text-xs font-medium text-mute",children:["Line by line",a.cut?" (the first 3,000 lines)":""]}),(0,t.jsx)("pre",{className:"max-h-[28rem] overflow-auto rounded-md border border-line bg-panel-2 py-2 font-mono text-[12.5px] leading-5",children:a.lines.map((e,s)=>(0,t.jsxs)("div",{className:"added"===e.kind?"bg-ok/10 text-ok":"removed"===e.kind?"bg-bad/10 text-bad":"text-ink",children:[(0,t.jsx)("span",{className:"inline-block w-5 select-none text-center text-mute",children:"added"===e.kind?"+":"removed"===e.kind?"−":" "}),e.text]},s))})]})]})}var ei=e.i(21206),eo=e.i(20054);let ec="apitestcenter-lab-draft";var ed=e.i(59180),eu=e.i(88153),em=e.i(2603),eh=e.i(28950),ep=e.i(99822),ex=e.i(62766),ef=e.i(32610),eb=e.i(14865),ey=e.i(46679),eg=e.i(65238),ev=e.i(7149),ek=e.i(727),ew=e.i(45672),ej=e.i(69578),eN=e.i(17118),eS=e.i(40945),eE=e.i(27122);function eC({steps:e,startedAt:s,onCancel:n}){let[a,r]=(0,$.useState)(()=>Date.now()),[l]=(0,$.useState)(()=>new Map);for(let t of e)"start"!==t.state||l.has(t.id)||l.set(t.id,Date.now());(0,$.useEffect)(()=>{let e=window.setInterval(()=>r(Date.now()),100);return()=>window.clearInterval(e)},[]);let i=e=>e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`;return a-s<250?(0,t.jsx)("div",{className:"flex-1","aria-busy":"true"}):(0,t.jsxs)("div",{role:"status","aria-label":"Sending",className:"flex flex-1 flex-col items-center justify-center gap-5 py-10",children:[(0,t.jsxs)("ul",{className:"w-full max-w-md space-y-2",children:[e.map(e=>(0,t.jsxs)("li",{className:"flex items-center gap-2.5 text-sm",children:["done"===e.state?(0,t.jsx)(eN.CheckCircle2,{size:16,className:"shrink-0 text-ok","aria-label":"done"}):"failed"===e.state?(0,t.jsx)(eE.XCircle,{size:16,className:"shrink-0 text-bad","aria-label":"failed"}):(0,t.jsx)(f.Loader2,{size:16,className:"shrink-0 animate-spin text-accent","aria-label":"running"}),(0,t.jsx)("span",{className:`min-w-0 flex-1 truncate ${"start"===e.state?"text-ink":"text-mute"}`,children:e.label}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-xs text-mute",children:void 0!==e.ms?i(e.ms):i(a-(l.get(e.id)??a))})]},e.id)),e.every(e=>"start"!==e.state)?(0,t.jsxs)("li",{className:"flex items-center gap-2.5 text-sm text-mute",children:[(0,t.jsx)(eS.Circle,{size:16,className:"shrink-0","aria-hidden":!0}),(0,t.jsx)("span",{className:"flex-1",children:"Starting…"})]}):null]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-sm",onClick:n,children:"Cancel"}),(0,t.jsxs)("span",{className:"font-mono text-xs text-mute",children:[i(a-s)," in all"]})]})]})}var eR=e.i(48181),eq=e.i(25120),e$=e.i(97942),eM=e.i(91549);let eO=(0,eq.projectKey)("apitestcenter-lab-saved"),eT="apitestcenter-requests-panel",eP="lab:answers",eL=(0,eq.projectKey)("apitestcenter-lab-tabs"),eA=()=>Math.random().toString(36).slice(2,10),eI=JSON.stringify((0,V.defaultRequestDraft)()),eU=()=>({key:eA(),draft:(0,V.defaultRequestDraft)(),saved:null,result:null,liveId:null,liveOpen:!1}),eF=e=>e.saved?.name??(e.draft.url.trim()?(0,V.autoRunName)(e.draft).replace(/ · \d.*$/,"").replace(/^[A-Z]+ /,""):"New request"),eD=e=>e.saved?JSON.stringify(e.draft)!==e.saved.snapshot:JSON.stringify(e.draft)!==eI,ez={GET:"text-ok",POST:"text-warn",PUT:"text-accent",PATCH:"text-accent",DELETE:"text-bad"},e_=(0,eq.projectKey)("apitestcenter-last-run");function eV(e){try{sessionStorage.setItem(e_,e)}catch{}}function eJ(){return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-accent opacity-60"}),(0,t.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-accent"})]}),"Load running"]})}function eK({title:e,lines:s,action:n}){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center rounded-lg border border-dashed border-line px-6 py-14 text-center",children:[(0,t.jsx)("h2",{className:"text-base font-medium text-ink",children:e}),(0,t.jsx)("div",{className:"mt-2 max-w-md space-y-1.5 text-sm text-mute",children:s.map((e,s)=>(0,t.jsx)("p",{children:e},s))}),n?(0,t.jsx)("div",{className:"mt-5",children:n}):null]})}function eH({runs:e,current:s,disabled:a,onPick:r}){let{slo:l}=(0,eu.useSlo)(),[o,c]=(0,$.useState)(!1),d=(0,$.useRef)(null),u=(0,$.useMemo)(()=>e.slice(0,30),[e]);return(0,$.useEffect)(()=>{if(!o)return;let e=e=>{d.current?.contains(e.target)||c(!1)},t=e=>"Escape"===e.key&&c(!1);return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[o]),(0,t.jsxs)("div",{ref:d,className:"relative",children:[(0,t.jsxs)("button",{type:"button",disabled:a,"aria-haspopup":"listbox","aria-expanded":o,onClick:()=>c(e=>!e),className:"inline-flex items-center gap-1 rounded-md border border-line px-2 py-1 text-xs text-mute hover:text-ink disabled:opacity-40",children:["Recent runs",u.length?(0,t.jsx)("span",{className:"rounded bg-panel-2 px-1 font-mono text-[10px] text-ink",children:u.length}):null,(0,t.jsx)(i.ChevronDown,{size:12})]}),o?(0,t.jsx)("ul",{role:"listbox","aria-label":"Recent runs",className:"absolute right-0 z-30 mt-1 max-h-80 w-80 overflow-auto rounded-md border border-line bg-panel p-1 shadow-xl",children:u.map(e=>{let a=(0,n.buildVerdictFromInputs)(e.verdict,{slo:l}).overall,i=s?.id===e.id;return(0,t.jsx)("li",{role:"option","aria-selected":i,children:(0,t.jsxs)("button",{type:"button",onClick:()=>{r(e),c(!1)},className:`flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-xs ${i?"bg-accent-dim text-ink":"text-ink hover:bg-panel-2"}`,children:[(0,t.jsxs)("span",{className:"min-w-0 truncate",children:[e.baseline?(0,t.jsx)("span",{className:"mr-1 text-accent",title:"Baseline",children:"◆"}):null,e.name]}),(0,t.jsx)(eB,{level:a})]})},e.id)})}):null]})}function eB({level:e}){let s="pass"===e?"text-ok":"fail"===e?"text-bad":"text-warn";return(0,t.jsxs)("span",{className:`shrink-0 font-mono text-xs uppercase ${s}`,children:[(0,t.jsxs)("span",{"aria-hidden":!0,children:["pass"===e?"✓":"fail"===e?"✕":"!"," "]}),e]})}function eW(){let{slo:e,setSlo:s,ready:n}=(0,eu.useSlo)(),[a,r]=(0,$.useState)(!1),[l,i]=(0,$.useState)(500),[o,c]=(0,$.useState)(0),[d,u]=(0,$.useState)(1),[m,h]=(0,$.useState)(99),[p,x]=(0,$.useState)(!1),f=(0,$.useRef)(!1);function b(e){let t={on:a,p95:l,p99:o,errPct:d,checksPct:m,abort:p,...e};if(r(t.on),i(t.p95),c(t.p99),u(t.errPct),h(t.checksPct),x(t.abort),!t.on||!(t.p95>0)||t.errPct<0)return s(null);s({p95Ms:t.p95,errorRate:t.errPct/100,p99Ms:t.p99>0?t.p99:void 0,checksRate:Math.min(100,Math.max(0,t.checksPct))/100,abortOnFail:t.abort})}(0,$.useEffect)(()=>{n&&!f.current&&(f.current=!0,e&&(r(!0),i(e.p95Ms),c(e.p99Ms??0),u(Number((100*e.errorRate).toFixed(4))),h(null!=e.checksRate?Number((100*e.checksRate).toFixed(2)):99),x(!0===e.abortOnFail)))},[n,e]);let y=(e,s,n,a)=>(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"mb-1 block text-xs text-mute",children:e}),(0,t.jsx)("input",{type:"number",min:a.min,max:a.max,step:a.step,value:s,onChange:e=>b({[n]:Number(e.target.value)}),className:"input font-mono"}),a.hint?(0,t.jsx)("span",{className:"mt-1 block text-xs text-mute",children:a.hint}):null]});return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-mute",children:"Targets decide whether a performance test passes. They are sent to k6 as thresholds, drive the verdict and the report colours, and are remembered on this computer."}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:e=>b({on:e.target.checked}),className:"accent-[var(--accent)]"}),"Use my own performance targets"]}),a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[y("p95 must stay under (ms)",l,"p95",{min:1}),y("p99 must stay under (ms)",o,"p99",{min:0,hint:"0 = no p99 target"}),y("Error rate must stay under (%)",d,"errPct",{min:0,max:100,step:.1}),y("Checks must pass at least (%)",m,"checksPct",{min:0,max:100,step:.1,hint:"Only used when the request has checks"})]}),(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded-md border border-line px-3 py-2.5 text-sm text-ink",children:[(0,t.jsx)("input",{type:"checkbox",checked:p,onChange:e=>b({abort:e.target.checked}),className:"mt-0.5 accent-[var(--accent)]"}),(0,t.jsxs)("span",{children:["Stop the test early if a target is clearly missed",(0,t.jsx)("span",{className:"block text-xs text-mute",children:"After a 10-second warm-up, k6 ends the run as soon as a target fails — saves time and stops hammering a struggling API."})]})]})]}):(0,t.jsx)("p",{className:"rounded-md bg-panel-2 px-3 py-2 text-sm text-mute",children:"Using built-in defaults: warn at p95 ≥ 500 ms or errors ≥ 1%, fail at p95 ≥ 2 s or errors ≥ 5%. No thresholds are sent to k6."})]})}function eQ({dirty:e,isSaved:s,title:n,onSave:a,onSaveAs:r,onHistory:l,onExport:o}){let[c,d]=(0,$.useState)(!1),x=(0,$.useRef)(null);return(0,t.jsxs)("div",{className:"inline-flex",children:[(0,t.jsxs)("button",{type:"button",onClick:a,disabled:s&&!e,title:n,className:"btn btn-secondary rounded-r-none border-r-0",children:[(0,t.jsx)(N.Save,{size:16,"aria-hidden":!0}),"Save",e?(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-accent","aria-label":"unsaved changes"}):null]}),(0,t.jsx)("button",{ref:x,type:"button",onClick:()=>d(e=>!e),"aria-label":"More ways to save","aria-haspopup":"menu","aria-expanded":c,className:"btn btn-secondary rounded-l-none px-2",children:(0,t.jsx)(i.ChevronDown,{size:14,"aria-hidden":!0})}),(0,t.jsx)(X.Popover,{anchor:x,open:c,onClose:()=>d(!1),label:"More ways to save",width:220,role:"menu",children:(0,t.jsxs)("div",{className:"-m-2",children:[(0,t.jsx)(Y.MenuItem,{icon:s?u.CopyPlus:h.FolderOpen,label:s?"Save as a new request…":"Save to a folder…",onSelect:()=>{d(!1),r()}}),l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Y.MenuSeparator,{}),(0,t.jsx)(Y.MenuItem,{icon:p.History,label:"Version history…",onSelect:()=>{d(!1),l()}})]}):null,o?(0,t.jsx)(Y.MenuItem,{icon:m.FileOutput,label:"Export…",onSelect:()=>{d(!1),o()}}):null]})})]})}e.s(["LabPage",0,function(){var e;let i=(0,_.useToast)(),m=(0,A.useConfirm)(),p=(0,eo.useEngineHealth)(),b=(0,em.useModKey)(),{slo:N}=(0,eu.useSlo)(),{vars:F,activeEnv:D,refresh:z,rememberValues:K}=(0,J.useWorkspace)(),[H,W]=(0,$.useState)(null),[X,ee]=(0,$.useState)(!1),[et,es]=(0,$.useState)(!0),ea=(0,$.useRef)(null),[er,eN]=(0,$.useState)(V.defaultRequestDraft),[eS,eE]=(0,$.useState)(V.defaultLoad),[eq,eB]=(0,$.useState)(!1),[eX,eY]=(0,$.useState)(null),[eG,eZ]=(0,$.useState)(null),[e0,e1]=(0,$.useState)(!1),[e2,e5]=(0,$.useState)(null),[e6,e9]=(0,$.useState)(!1),e3=(0,$.useRef)(null),e7=(0,$.useRef)(null);G(e3,H?.id),G(e7,eX);let[e4,e8]=(0,$.useState)(!1),[te,tt]=(0,$.useState)([]),[ts,tn]=(0,$.useState)(0),ta=(0,$.useRef)(null),[tr,tl]=(0,$.useState)(!1),[ti,to]=(0,$.useState)(!1),[tc,td]=(0,$.useState)(null),[tu,tm]=(0,$.useState)(null),{index:th,refresh:tp}=(0,ed.useHistory)(),tx=th?.runs??[],[tf,tb]=(0,$.useState)("response"),[ty,tg]=(0,$.useState)(!1),{layout:tv,setLayout:tk}=(0,eb.useViewPrefs)(),tw="below"===tv,tj=(0,ex.usePaneSizes)(tv,et),[tN,tS]=(0,$.useState)(!1),[tE,tC]=(0,$.useState)([]),[tR,tq]=(0,$.useState)("");(0,ep.useKeepAwake)(e0||tE.some(e=>e.key!==tR&&e.liveOpen),"a live connection is open");let t$=tu?.status==="running"||tu?.status==="queued",tM=(0,V.isReady)(er),tO=(0,V.loadProblem)(eS),tT=e4||tr;(0,$.useEffect)(()=>{let e=null;try{e=sessionStorage.getItem(e_)}catch{}e&&(0,ei.fetchRun)(e).then(async t=>{if(t)return tm(t);let s=await ed.historyApi.run(e).catch(()=>null);s&&tm({id:s.report.id,status:s.report.status,report:s.report})});let t=function(){try{let e=sessionStorage.getItem(ec);if(!e)return null;let t=JSON.parse(e);if(2===t.v)return{request:(0,V.requestFromUnknown)(t.request),load:(0,V.loadFromUnknown)(t.load)};return{request:(0,V.requestFromUnknown)(t),load:(0,V.loadFromUnknown)(t)}}catch{return null}}();t&&eE(t.load);let s=[],n="";try{let e=JSON.parse(localStorage.getItem(eL)??"null"),t=(0,eh.recall)(eP)??{};s=(e?.tabs??[]).map(e=>({key:e.key||eA(),draft:(0,V.requestFromUnknown)(e.draft),saved:e.saved??null,result:t[e.key]??null,liveId:null,liveOpen:!1})),n=e?.active??"",es("closed"!==localStorage.getItem(eT))}catch{}if(!s.length){let e=null;try{e=JSON.parse(sessionStorage.getItem(eO)??"null")}catch{}s=[{...eU(),draft:t?.request??(0,V.defaultRequestDraft)(),saved:e}]}let a=s.find(e=>e.key===n)??s[0];tC(s),tq(a.key),eN(a.draft),W(a.saved),eY(a.result),eB(!0)},[]),(0,$.useEffect)(()=>{if(!eq)return;let e={};for(let t of tE){let s=t.key===tR?eX:t.result;s&&(e[t.key]=s)}(0,eh.remember)(eP,e)},[eq,tE,tR,eX]),(0,$.useEffect)(()=>{if(!eq)return;let e=window.setTimeout(()=>{try{sessionStorage.setItem(ec,JSON.stringify({v:2,request:er,load:eS}))}catch{}try{let e=tE.map(e=>e.key===tR?{key:e.key,draft:er,saved:H}:{key:e.key,draft:e.draft,saved:e.saved});localStorage.setItem(eL,JSON.stringify({tabs:e,active:tR}))}catch{}},250);return()=>window.clearTimeout(e)},[er,eS,eq,tE,tR,H]),(0,$.useEffect)(()=>{if(!tu||!t$)return;let e=!1,t=window.setInterval(async()=>{let t=await (0,ei.fetchRun)(tu.id);if(t&&!e&&(tm(t),(0,ei.isTerminalStatus)(t.status))){tp();let e="completed"===t.status?"finished":t.status;i(`Performance test ${e}`,"failed"===t.status?"error":"success");let s=(0,n.buildVerdict)(t.report,{slo:N});(0,ek.notifyFinished)({title:`Performance test ${e}`,body:`${t.report.testName}
2
+ ${"completed"===t.status?s.headline:t.error??"See the report for details."}`,ok:"completed"===t.status&&"fail"!==s.overall})}},500);return()=>{e=!0,window.clearInterval(t)}},[tu?.id,t$]);let tP=!!H&&JSON.stringify(er)!==H.snapshot;function tL(e){W(e);try{e?sessionStorage.setItem(eO,JSON.stringify(e)):sessionStorage.removeItem(eO)}catch{}}function tA(e){es(e);try{localStorage.setItem(eT,e?"open":"closed")}catch{}}async function tI(e){try{let t={name:e?.name??H.name,collection:e?.collection??H.collection,request:er},s=H&&!e?await J.workspaceApi.update(H.id,t):await J.workspaceApi.create(t);tL({id:s.id,name:s.name,collection:s.collection,snapshot:JSON.stringify(er)}),ee(!1),await z(),i(`Saved “${s.name}”${s.collection?` in ${s.collection}`:""}`,"success")}catch(e){i(e instanceof Error?e.message:"Could not save the request","error")}}let tU=()=>({key:tR,draft:er,saved:H,result:eX,liveId:eG,liveOpen:e0});function tF(e){tq(e.key),eN(e.draft),tL(e.saved),eY(e.result),eZ(e.liveId),e1(e.liveOpen),e5(null),e9(!1),to(!1),td(null),ee(!1),tb("response")}function tD(e){if(e===tR)return;let t=tE.find(t=>t.key===e);t&&(tC(e=>e.map(e=>e.key===tR?tU():e)),tF(t))}function tz(e,t){let s=!H&&!eX&&!eG&&JSON.stringify(er)===eI,n={key:s?tR:eA(),draft:e,saved:t,result:null,liveId:null,liveOpen:!1};tC(e=>{if(s)return e.map(e=>e.key===tR?n:e);let t=e.map(e=>e.key===tR?tU():e),a=t.findIndex(e=>e.key===tR);return[...t.slice(0,a+1),n,...t.slice(a+1)]}),tF(n)}async function t_(e){let t=tE.map(e=>e.key===tR?tU():e),s=t.filter(t=>e.includes(t.key));if(!s.length)return;let n=s.filter(eD);if(n.length){let e=1===s.length;if(!await m({title:e?`Close “${eF(n[0])}” without saving?`:`Close ${s.length} tabs?`,body:e?"Its changes have not been saved.":1===n.length?`“${eF(n[0])}” has changes that are not saved.`:`${n.length} of them have changes that are not saved.`,confirmLabel:"Close",tone:"danger"}))return}for(let e of s)e.liveId&&Z.realtimeApi.close(e.liveId);let a=t.filter(t=>!e.includes(t.key));if(!e.includes(tR))return tC(a);let r=t.findIndex(e=>e.key===tR),l=t.slice(r+1).find(t=>!e.includes(t.key))??t.slice(0,r).reverse().find(t=>!e.includes(t.key))??eU();tC(a.length?a:[l]),tF(l)}let[tV,tJ]=(0,$.useState)(null),[tK,tH]=(0,$.useState)(!1);async function tB(){try{let e=await J.workspaceApi.index(),t=t=>e.requests.find(e=>"Practice"===e.collection&&e.name===t),s=t("Sign in")?.id??(await J.workspaceApi.create({name:"Sign in",collection:"Practice",request:{...(0,V.withUrl)({...(0,V.defaultRequestDraft)(),method:"POST"},"{{practiceApi}}/login"),bodyMode:"json",bodyText:'{\n "username": "you",\n "password": "demo"\n}',checks:[{type:"status",expect:"200"}]}})).id,n=t("My orders"),a=n?await J.workspaceApi.get(n.id):await J.workspaceApi.create({name:"My orders",collection:"Practice",request:{...(0,V.withUrl)((0,V.defaultRequestDraft)(),"{{practiceApi}}/orders"),authMode:"bearer",token:"{{token}}",checks:[{type:"status",expect:"200"}],before:{requestId:s,requestName:"Sign in",extract:[{name:"token",from:"json",path:"data.token"}]}}});await z(),tA(!0),await tW(a),i("Added Practice → Sign in and My orders. Press Send: it signs in first, then uses the token.","success")}catch(e){i(e instanceof Error?e.message:"Could not add the practice requests","error")}}function tW(e){if(H?.id===e.id)return;let t=tE.find(t=>t.key!==tR&&t.saved?.id===e.id);if(t)return tD(t.key);let s=(0,V.requestFromUnknown)(e.request);tz(s,{id:e.id,name:e.name,collection:e.collection,snapshot:JSON.stringify(s)})}(0,$.useEffect)(()=>{let e=()=>tH(!(0,ew.welcomeHidden)());return e(),window.addEventListener(ew.WELCOME_EVENT,e),()=>window.removeEventListener(ew.WELCOME_EVENT,e)},[]);let tQ=(0,$.useRef)(()=>{});tQ.current=e=>{let t=(0,V.requestFromUnknown)(e.request),s={id:e.id,name:e.name,collection:e.collection,snapshot:JSON.stringify(t)};H?.id===e.id?(eN(t),tL(s)):tC(n=>n.map(n=>n.saved?.id===e.id?{...n,draft:t,saved:s}:n))},(0,$.useEffect)(()=>{let e=e=>tQ.current(e.detail);return window.addEventListener(e$.REQUEST_REPLACED_EVENT,e),()=>window.removeEventListener(e$.REQUEST_REPLACED_EVENT,e)},[]),(0,$.useEffect)(()=>{let e=e=>{let t=e.detail;W(e=>e?.id===t.id?{...e,name:t.name,collection:t.collection}:e),tC(e=>e.map(e=>e.saved?.id===t.id?{...e,saved:{...e.saved,name:t.name,collection:t.collection}}:e))};return window.addEventListener(Q.REQUEST_MOVED_EVENT,e),()=>window.removeEventListener(Q.REQUEST_MOVED_EVENT,e)},[]);let tX=(0,$.useRef)(tW);tX.current=tW;let tY=(0,$.useRef)(tz);function tG(){tz((0,V.defaultRequestDraft)(),null),window.setTimeout(()=>ea.current?.focus(),0)}async function tZ(){try{td(null);let e=await (0,eg.withFolders)(er,H?.collection,F),t=(0,V.resolveDraft)(e.draft,e.vars,D?.name),s=/^wss?:\/\//i.test(t.url),n=s?(0,V.withUrl)(t,t.url.replace(/^ws/i,"http")):t,a=(0,V.buildPayload)(n,(0,V.toLoadConfig)(eS),(0,V.autoRunName)(n,H?.name),(0,V.targetsFromSlo)(N));return e.contract&&!s&&(a.contract=e.contract),s&&(a.request={...a.request,url:a.request.url.replace(/^http/i,"ws")}),await (0,ey.withRunFirst)(a,t,F,D?.name)}catch(e){return td(e instanceof Error?e.message:"Request is not valid"),null}}async function t0(){try{let e={...er,method:"POST",bodyMode:"graphql",graphqlQuery:s.INTROSPECTION_QUERY,graphqlVariables:"",graphqlOperation:"IntrospectionQuery",graphqlErrorsFail:!1,checks:[],saveValues:[],testData:null},t=await (0,eg.withFolders)(e,H?.collection,F),n=(0,V.resolveDraft)(t.draft,t.vars,D?.name),{request:a,auth:r,options:l,setup:i}=await (0,ey.withRunFirst)((0,V.buildPayload)(n,(0,V.toLoadConfig)(eS),"schema"),n,F,D?.name),o=await fetch("/engine/graphql/introspect",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({request:a,auth:r,options:l,setup:i})}),c=await o.json();return o.ok?c:{status:0,body:"",error:c.error??`Engine error (${o.status})`}}catch(e){return{status:0,body:"",error:e instanceof Error?e.message:String(e)}}}tY.current=tz,(0,$.useEffect)(()=>{let e=()=>{let e=null;try{e=sessionStorage.getItem(ej.OPEN_REQUEST_KEY),sessionStorage.removeItem(ej.OPEN_REQUEST_KEY)}catch{}e&&J.workspaceApi.get(e).then(e=>tX.current(e)).catch(()=>i("That saved request is gone","error"));let t=null;try{t=sessionStorage.getItem(ej.OPEN_DRAFT_KEY),sessionStorage.removeItem(ej.OPEN_DRAFT_KEY)}catch{}if(t)try{let e=JSON.parse(t);tY.current((0,V.withUrl)((0,V.requestFromUnknown)(e),e.url??""),null)}catch{}};return eq&&e(),window.addEventListener(ej.OPEN_REQUEST_EVENT,e),()=>window.removeEventListener(ej.OPEN_REQUEST_EVENT,e)},[eq]);let[t1,t2]=(0,$.useState)(0);async function t5(){if(tT||!tM)return;let e=performance.now(),s=await tZ(),n=Math.round(performance.now()-e);if(!s)return;if(/^wss?:\/\//i.test(s.request.url)){if(eG&&e0)return void await Z.realtimeApi.close(eG);e8(!0),tb("response");try{eG&&Z.realtimeApi.close(eG);let{id:e}=await Z.realtimeApi.connect({request:s.request,auth:s.auth,options:s.options});eY(null),eZ(e),e1(!0)}catch(e){td(e instanceof Error?e.message:"Could not connect")}finally{e8(!1)}return}if("production"===(0,eR.envKind)(D)&&!(0,eR.isReadOnlyMethod)(s.request.method)&&!await m({title:`Send ${s.request.method} to ${D.name}?`,body:(0,t.jsxs)(t.Fragment,{children:["This request can change real data on ",(0,ei.hostOf)(s.request.url),"."]}),confirmLabel:`Send to ${D.name}`,tone:"danger"}))return;e8(!0),to(!1),tb("response");let a=new AbortController;ta.current=a,tn(Date.now()),tt([{id:"prepare",label:"Prepared: folders, connection, variables",state:"done",ms:n}]);try{eZ(null);let e=await (0,ei.sendRequest)(s,H?.id,{signal:a.signal,onStep:e=>tt(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e])});e5(null),e9(!1),eY(e);let t=(e.saved??[]).flatMap(e=>e.found&&void 0!==e.value?[{name:e.name,value:e.value}]:[]);K(t,H?.name??"the last Send")}finally{e8(!1),ta.current=null}}async function t6(e=!1){if(tT||t$||!tM||!p.k6Ready)return;if(tO)return void td(tO);let s=await tZ();if(s){if(to(!1),!e){tl(!0);try{let e=await (0,ei.sendRequest)(s);if(eY(e),!(0,ei.isSuccess)(e)){to(!0),tb("response");return}}finally{tl(!1)}}if("production"===(0,eR.envKind)(D)){if(!await m({title:`Performance test ${D.name}?`,body:(0,t.jsxs)(t.Fragment,{children:["A performance test sends many requests at once to ",(0,ei.hostOf)(s.request.url),". Real users of that system may notice."]}),confirmLabel:"Start performance test",tone:"danger"}))return}else if((0,ei.needsLoadConfirm)(eS.preset,s.load,s.request.url)&&!await m({title:`Start a ${(0,M.profileSummary)(eS)} performance test against ${(0,ei.hostOf)(s.request.url)}?`,body:(0,t.jsxs)(t.Fragment,{children:["This is a ",(0,t.jsx)("span",{className:"text-ink",children:eS.preset})," profile against a non-local host (",(0,M.profileSummary)(eS),"). Only load-test systems you own or are allowed to test.",(0,t.jsxs)("span",{className:"mt-2 block",children:["Each simulated user sends its next request as soon as the last one returns, so a few dozen users can mean thousands of requests per second. Public sites and APIs behind a CDN or firewall usually answer that with ",(0,t.jsx)("span",{className:"text-ink",children:"429"})," or"," ",(0,t.jsx)("span",{className:"text-ink",children:"403"})," and may block this computer for a while — test a staging server, or use Requests per second mode with a modest rate."]})]}),confirmLabel:"Start performance test",tone:"danger"}))return;try{let e=await (0,ei.startLoadRun)(s);eV(e.id),tm(e),tb("report")}catch(e){i(e instanceof Error?e.message:"Failed to start load","error")}}}async function t9(){if(!tu)return;let e=await (0,ei.stopLoadRun)(tu.id);e?tm(e):i("Could not reach the engine to stop the run","error")}(0,$.useEffect)(()=>{t1&&t5()},[t1]),(0,em.useShortcuts)({send:()=>void t5(),run:()=>void t6(),focusUrl:()=>ea.current?.focus(),save:()=>H?void tI():ee(!0),toggleSaved:()=>tA(!et)});let t3=/^wss?:\/\//i.test((0,r.substitute)(er.url,F).text),t7=t3?"Performance tests of WebSockets aren't available yet — Connect to try it":p.k6Ready?tM?tO??void 0:"Enter a URL first":p.k6Label,t4=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button","data-tour":"send",onClick:()=>void t5(),disabled:tT||!tM,title:t3?e0?"Close the connection":`Open the WebSocket (${b}+Enter)`:`Send one request (${b}+Enter)`,className:t3&&e0?"btn btn-secondary":"btn btn-primary",children:[e4?(0,t.jsx)(f.Loader2,{size:16,className:"animate-spin"}):t3?e0?(0,t.jsx)(R.Unplug,{size:16}):(0,t.jsx)(k.Plug,{size:16}):(0,t.jsx)(S.Send,{size:16}),t3?e0?"Disconnect":"Connect":"Send"]}),t$?(0,t.jsxs)("button",{type:"button",onClick:()=>void t9(),disabled:tu?.stopping,className:"btn btn-danger",children:[tu?.stopping?(0,t.jsx)(f.Loader2,{size:16,className:"animate-spin"}):(0,t.jsx)(E.Square,{size:16}),tu?.stopping?"Stopping…":"Stop"]}):(0,t.jsxs)("button",{type:"button","data-tour":"run",onClick:()=>void t6(),disabled:tT||!!t7,title:t7??`Check the request, then run the load profile (${b}+Shift+Enter)`,className:"btn btn-secondary",children:[tr?(0,t.jsx)(f.Loader2,{size:16,className:"animate-spin"}):(0,t.jsx)(v.Play,{size:16}),tr?"Checking…":"Run performance test"]}),(0,t.jsx)(eQ,{dirty:H?tP:JSON.stringify(er)!==eI,isSaved:!!H,onHistory:H?()=>(0,e$.openVersions)(H.id):void 0,onExport:H?()=>(0,eM.openExport)({kind:"request",id:H.id,name:H.name,collection:H.collection}):void 0,title:`Save request (${b}+S)`,onSave:()=>H?void tI():ee(!0),onSaveAs:()=>ee(!0)})]}),t8=tE.map(e=>e.key===tR?tU():e);return(0,t.jsx)(ev.VariableScope,{collection:H?.collection,url:er.url,children:(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[t8.length?(0,t.jsxs)("div",{className:"flex shrink-0 items-stretch border-b border-line bg-canvas",children:[(0,t.jsx)("button",{type:"button",onClick:()=>tA(!et),"aria-label":et?`Hide saved requests (${b}+B)`:`Show saved requests (${b}+B)`,"aria-pressed":et,title:et?`Hide saved requests (${b}+B)`:`Show saved requests (${b}+B)`,className:`hidden shrink-0 items-center border-r border-line px-3 hover:bg-panel/60 hover:text-ink lg:flex ${et?"text-ink":"text-mute"}`,children:(0,t.jsx)(h.FolderOpen,{size:15,"aria-hidden":!0})}),(0,t.jsx)("div",{role:"tablist","aria-label":"Open requests",className:"flex min-w-0 items-stretch overflow-x-auto",children:t8.map(e=>{let s=e.key===tR,n=eF(e);return(0,t.jsxs)("div",{onContextMenu:t=>{t.preventDefault();let s=Number(document.documentElement.style.zoom)||1;tJ({key:e.key,x:t.clientX/s,y:t.clientY/s})},onMouseDown:t=>{1===t.button&&(t.preventDefault(),t_([e.key]))},className:`flex max-w-60 min-w-0 shrink-0 items-center border-r border-line ${s?"bg-panel shadow-[inset_0_2px_0_var(--accent)]":"hover:bg-panel/60"}`,children:[(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":s,onClick:()=>tD(e.key),onKeyDown:t=>{if("ContextMenu"===t.key||t.shiftKey&&"F10"===t.key){t.preventDefault();let s=(0,eb.pageRect)(t.currentTarget);tJ({key:e.key,x:s.left+8,y:s.bottom})}},title:e.saved?.collection?`${e.saved.collection} / ${n}`:n,className:"tab-btn flex min-w-0 items-center gap-2 py-2 pr-1 pl-3 text-sm",children:[(0,t.jsx)("span",{className:`font-mono text-[11px] font-semibold ${ez[e.draft.method]??"text-mute"}`,children:"DELETE"===e.draft.method?"DEL":e.draft.method}),(0,t.jsx)("span",{className:`truncate ${s?"text-ink":"text-mute"}`,children:n})]}),e.saved&&eD(e)?(0,t.jsx)("span",{title:"Not saved","aria-label":"not saved",className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent"}):null,(0,t.jsx)("button",{type:"button",onClick:()=>{t_([e.key])},"aria-label":`Close ${n}`,title:"Close (middle click)",className:"mx-1 shrink-0 rounded p-1 text-mute hover:bg-panel-2 hover:text-ink",children:(0,t.jsx)(q.X,{size:13,"aria-hidden":!0})})]},e.key)})}),tV?(()=>{let e=t8.map(e=>e.key),s=e.indexOf(tV.key),n=t8[s];if(!n)return null;let a=e=>()=>{tJ(null),e()},r=t8.filter(e=>!eD(e)).map(e=>e.key);return(0,t.jsxs)(Y.ContextMenu,{at:tV,label:`Actions for ${eF(n)}`,onClose:()=>tJ(null),children:[(0,t.jsx)(Y.MenuItem,{icon:q.X,label:"Close",hint:"Middle click",onSelect:a(()=>void t_([tV.key]))}),(0,t.jsx)(Y.MenuItem,{icon:C,label:"Close others",disabled:e.length<2,onSelect:a(()=>void t_(e.filter(e=>e!==tV.key)))}),(0,t.jsx)(Y.MenuItem,{icon:l.ArrowRightToLine,label:"Close to the right",disabled:s===e.length-1,onSelect:a(()=>void t_(e.slice(s+1)))}),(0,t.jsx)(Y.MenuItem,{icon:o.CircleCheck,label:"Close unchanged",disabled:!r.length,onSelect:a(()=>void t_(r))}),(0,t.jsx)(Y.MenuItem,{icon:x.ListX,label:"Close all",onSelect:a(()=>void t_(e))}),(0,t.jsx)(Y.MenuSeparator,{}),(0,t.jsx)(Y.MenuItem,{icon:u.CopyPlus,label:"Duplicate",onSelect:a(()=>(function(e){let t=e===tR?tU():tE.find(t=>t.key===e);if(!t)return;let s={key:eA(),draft:structuredClone(t.draft),saved:null,result:null,liveId:null,liveOpen:!1};tC(t=>{let n=t.map(e=>e.key===tR?tU():e),a=n.findIndex(t=>t.key===e);return[...n.slice(0,a+1),s,...n.slice(a+1)]}),tF(s)})(tV.key))}),(0,t.jsx)(Y.MenuItem,{icon:d.Copy,label:"Copy URL",disabled:!n.draft.url.trim(),onSelect:a(()=>void navigator.clipboard.writeText(n.draft.url).then(()=>i("Copied the URL","success"),()=>i("Could not copy","error")))})]})})():null,(0,t.jsx)("button",{type:"button",onClick:()=>tG(),"aria-label":"New request tab",title:"New request",className:"shrink-0 px-3 text-mute hover:bg-panel/60 hover:text-ink",children:(0,t.jsx)(w.Plus,{size:15,"aria-hidden":!0})}),(0,t.jsx)("div",{className:"ml-auto flex shrink-0 items-center px-2",children:(0,t.jsx)(U.EnvironmentBar,{compact:!0,drafts:[er],collections:[H?.collection]})})]}):null,(0,t.jsxs)("header",{className:"border-b border-line bg-panel px-4 py-3 lg:px-6",children:[(0,t.jsx)("h1",{className:"sr-only",children:"Test an API"}),(0,t.jsx)(O.RequestBar,{ref:ea,draft:er,onChange:e=>{eN(e),td(null)},onImported:e=>i(e,"success"),actions:t4}),(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-mute empty:hidden",children:[(0,t.jsx)(B,{draft:er,sent:!!(eX&&eX.status>0),onChange:eN}),X?(0,t.jsx)(Q.SaveRequestForm,{initial:{name:H?.name??(0,V.autoRunName)(er).replace(/ · \d.*$/,""),collection:H?.collection??""},onSave:(e,t)=>void tI({name:e,collection:t}),onCancel:()=>ee(!1)}):null,tc?(0,t.jsx)("span",{className:"text-bad",role:"alert",children:tc}):null]})]}),(0,t.jsxs)("div",{ref:tj.gridRef,style:ty?void 0:tj.gridStyle,className:`relative grid min-h-0 flex-1 overflow-y-auto ${tN?"":"transition-[grid-template-columns] duration-200 ease-out"} motion-reduce:transition-none lg:overflow-hidden ${ty?"":tw?`lg:grid-rows-[minmax(0,1fr)_minmax(0,1fr)] ${et?"lg:grid-cols-[15rem_minmax(0,1fr)] 2xl:grid-cols-[16rem_minmax(0,1fr)]":"lg:grid-cols-[0rem_minmax(0,1fr)]"}`:et?"lg:grid-cols-[15rem_minmax(0,1fr)_minmax(0,1fr)] 2xl:grid-cols-[16rem_minmax(0,5fr)_minmax(0,7fr)]":"lg:grid-cols-[0rem_minmax(0,1fr)_minmax(0,1fr)] 2xl:grid-cols-[0rem_minmax(0,5fr)_minmax(0,7fr)]"}`,children:[ty?null:(0,t.jsx)("div",{inert:!et,"aria-hidden":!et||void 0,className:`min-h-0 min-w-0 overflow-hidden transition-opacity duration-200 motion-reduce:transition-none ${tw?"lg:row-span-2":""} ${et?"opacity-100":"opacity-0 max-lg:hidden"}`,children:(0,t.jsx)("div",{className:"flex h-full w-[15rem] flex-col 2xl:w-[16rem] [&>aside]:flex-1",style:tj.panelWidth?{width:tj.panelWidth}:void 0,children:(0,t.jsx)(Q.RequestsPanel,{activeId:H?.id??null,onOpen:e=>void tW(e),onNew:()=>void tG()})})}),!ty&&et?(0,t.jsx)(ef.Splitter,{orientation:"vertical",label:"Saved requests panel width",value:tj.panel.value,onMove:e=>tj.panel.onMove(e),onStep:tj.panel.onStep,onReset:tj.panel.onReset,onDragging:tS,className:"absolute inset-y-0 -translate-x-1/2",style:tj.panel.style}):null,ty?null:(0,t.jsx)(ef.Splitter,{orientation:tw?"horizontal":"vertical",label:tw?"Request and response heights":"Request and response widths",value:tj.split.value,onMove:tj.split.onMove,onStep:tj.split.onStep,onReset:tj.split.onReset,onDragging:tS,className:tw?"absolute -translate-y-1/2":"absolute -translate-x-1/2",style:tj.split.style}),ty?null:(0,t.jsx)("section",{ref:e3,"aria-label":"Request",className:"min-w-0 px-4 py-4 lg:overflow-y-auto lg:px-6",children:(0,t.jsx)(T.RequestEditor,{id:"lab-request",draft:er,onChange:eN,checkResults:eX?.checks,lastBody:eX?.body,lastResult:eX??void 0,setupResult:eX?.setup,savedResults:eX?.saved,currentId:H?.id,collection:H?.collection,introspect:t0,extraTabs:[{id:"load",label:"Performance",badge:eS.stages?.length?"stages":"rate"===eS.mode?`${eS.rps}/s`:`${eS.vus} users \xb7 ${eS.duration}`,content:(0,t.jsx)(M.LoadEditor,{load:eS,onChange:eE})},{id:"targets",label:"Goals",content:(0,t.jsx)(eW,{})}]})}),(0,t.jsxs)("section",{ref:e7,"aria-label":"Results",className:`@container flex min-h-[32rem] min-w-0 flex-col border-line bg-panel/40 px-4 py-4 lg:min-h-0 lg:overflow-y-auto lg:px-6 ${tw&&!ty?"lg:border-t":"lg:border-l"}`,children:[(0,t.jsx)(I.Tabs,{id:"lab-results",label:"Results",value:tf,onChange:tb,items:[{id:"response",label:"Response",badge:eX?eX.status||"ERR":void 0},{id:"report",label:t$?(0,t.jsx)(eJ,{}):"Performance report"}],trailing:(0,t.jsxs)(t.Fragment,{children:["report"===tf&&tx.length>0?(0,t.jsx)(eH,{runs:tx,current:tu,disabled:t$,onPick:async e=>{try{let t=await ed.historyApi.run(e.id);eV(e.id),tm({id:t.report.id,status:t.report.status,report:t.report})}catch(e){i(e instanceof Error?e.message:"Could not open that run","error")}}}):null,ty?null:(0,t.jsx)("button",{type:"button",onClick:()=>tk(tw?"beside":"below"),"aria-label":tw?"Show the response beside the request":"Show the response below the request",title:tw?"Response beside the request":"Response below the request",className:"hidden rounded p-1.5 text-mute hover:bg-panel-2 hover:text-ink lg:block",children:tw?(0,t.jsx)(c.Columns2,{size:14}):(0,t.jsx)(j,{size:14})}),(0,t.jsx)("button",{type:"button",onClick:()=>tg(e=>!e),"aria-label":ty?"Show the request editor":"Expand results to full width",title:ty?"Show the request editor":"Expand results",className:"hidden rounded p-1.5 text-mute hover:bg-panel-2 hover:text-ink lg:block",children:ty?(0,t.jsx)(g,{size:14}):(0,t.jsx)(y,{size:14})})]})}),(0,t.jsx)("div",{...(0,I.tabPanelProps)("lab-results",tf),className:"flex min-h-0 flex-1 flex-col pt-4",children:"response"===tf?(0,t.jsxs)(t.Fragment,{children:[ti&&eX?(0,t.jsxs)("div",{role:"alert",className:"mb-4 flex flex-wrap items-center gap-3 rounded-md border border-warn/40 bg-warn/10 px-3 py-2.5",children:[(0,t.jsxs)("p",{className:"min-w-0 flex-1 text-sm text-ink",children:[(0,t.jsx)("span",{className:"font-medium text-warn",children:"Performance test not started."})," The check returned"," ",eX.status||"an error",", not 2xx. Fix the request, or run anyway if this status is expected."]}),(0,t.jsx)("button",{type:"button",className:"btn btn-secondary py-1.5 text-xs",onClick:()=>void t6(!0),children:"Run anyway"})]}):null,e4&&te.length?(0,t.jsx)(eC,{steps:te,startedAt:ts,onCancel:()=>ta.current?.abort()}):eG&&!eX?(0,t.jsx)(Z.LiveView,{id:eG,onClosed:()=>e1(!1)}):eX&&e2?(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-accent/40 bg-accent/10 px-3 py-2 text-xs",children:[(0,t.jsxs)("span",{className:"text-ink",children:[e6?"What changed since":"An earlier answer —"," ",new Date(e2.answer.at).toLocaleString()]}),(0,t.jsxs)("span",{className:"ml-auto flex gap-2",children:[(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>e9(e=>!e),children:e6?"Show that answer":"Compare with the latest"}),(0,t.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:()=>e5(null),children:"Back to the latest"})]})]}),e6?(0,t.jsx)(el,{earlier:e2.answer,latest:eX}):(0,t.jsx)(L.ResponseViewer,{result:{ok:(e=e2.answer).status>=200&&e.status<400,status:e.status,statusText:String(e.status),headers:e.headers,body:e.body,truncated:e.truncated,durationMs:e.durationMs,url:e.url,...e.error?{error:e.error}:{},...e.checks?{checks:e.checks}:{}}})]}):eX?(0,t.jsx)(L.ResponseViewer,{result:eX,onWaitLonger:e=>{eN(t=>({...t,timeout:e})),t2(e=>e+1),i(`This request now waits up to ${e} — save it to keep that`,"success")},extra:H?.id?(0,t.jsx)(en,{requestId:H.id,refreshKey:eX,onOpen:(e,t)=>0===t?e5(null):(e5({answer:e,index:t}),e9(!1))}):null,onSaveExample:()=>{eN(e=>({...e,mock:(0,a.exampleFromResponse)(eX.status,eX.headers,eX.body)})),i(H?"Kept as the mock example — save the request to keep it":"Kept as the mock example — save the request to use it in the mock server","success")}}):tK?(0,t.jsx)(ew.WelcomeCard,{practiceReady:!!p.demoApi,onSimple:()=>void(tz({...(0,V.withUrl)((0,V.defaultRequestDraft)(),"{{practiceApi}}/products"),checks:[{type:"status",expect:"2xx"},{type:"json",path:"items[0].name",op:"exists",value:""}]},null),i("Practice request ready — press Send","success")),onSignIn:()=>void tB(),onHide:()=>(0,ew.setWelcomeHidden)(!0)}):(0,t.jsx)(eK,{title:"Send a request to see the response",lines:[(0,t.jsx)(t.Fragment,{children:"Paste a URL — or a whole curl command from your browser's DevTools — into the bar above."}),(0,t.jsxs)(t.Fragment,{children:["Press ",(0,t.jsx)("span",{className:"kbd",children:b}),"+",(0,t.jsx)("span",{className:"kbd",children:"Enter"})," to send it."]})]})]}):tu?(0,t.jsxs)(t.Fragment,{children:[tu.error?(0,t.jsx)("p",{role:"alert",className:"mb-3 rounded-md border border-bad/40 bg-bad/10 px-3 py-2 text-sm text-bad",children:tu.error}):null,(0,t.jsx)(P.ReportView,{report:tu.report,source:"session",live:t$,probe:eX})]}):(0,t.jsx)(eK,{title:"No performance test yet",lines:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-ink",children:"Run performance test"})," sends one check request first, then runs"," ",(0,t.jsx)("span",{className:"font-mono text-ink",children:(0,M.profileSummary)(eS)})," with k6."]}),(0,t.jsx)(t.Fragment,{children:"Change users, duration, and ramps in the Performance tab. Set pass/fail goals in Goals."})],action:(0,t.jsxs)("button",{type:"button",className:"btn btn-primary",disabled:tT||!!t7,title:t7,onClick:()=>void t6(),children:[(0,t.jsx)(v.Play,{size:16}),"Run performance test"]})})})]})]})]})})},"VerdictTag",0,eB],6980)},90139,1245,33577,85905,e=>{"use strict";var t=e.i(99522);let s=(0,t.default)("arrow-right-to-line",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);e.s(["ArrowRightToLine",0,s],90139);var n=e.i(95754);e.s(["CircleCheck",()=>n.default],1245);let a=(0,t.default)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);e.s(["Columns2",0,a],33577);let r=(0,t.default)("copy-plus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["CopyPlus",0,r],85905)},30197,e=>{"use strict";let t=(0,e.i(99522).default)("list-x",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);e.s(["ListX",0,t],30197)}]);