@axiomify/cli 6.3.1 → 6.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -10937,7 +10937,7 @@ var {
|
|
|
10937
10937
|
|
|
10938
10938
|
// package.json
|
|
10939
10939
|
var package_default = {
|
|
10940
|
-
version: "6.3.
|
|
10940
|
+
version: "6.3.2"};
|
|
10941
10941
|
var ALWAYS_EXTERNAL = ["uWebSockets.js"];
|
|
10942
10942
|
function getUserExternals(cwd) {
|
|
10943
10943
|
let pkgExternals = [];
|
|
@@ -21463,9 +21463,19 @@ async function handlePostRequest(req, res, app) {
|
|
|
21463
21463
|
delete responseHeaders[key.toLowerCase()];
|
|
21464
21464
|
return this;
|
|
21465
21465
|
},
|
|
21466
|
-
send(data,
|
|
21466
|
+
send(data, message) {
|
|
21467
21467
|
responseSent = true;
|
|
21468
|
-
|
|
21468
|
+
try {
|
|
21469
|
+
responseBody = app.serializer({
|
|
21470
|
+
data,
|
|
21471
|
+
message,
|
|
21472
|
+
statusCode: responseStatus,
|
|
21473
|
+
isError: responseStatus >= 400,
|
|
21474
|
+
req: mockReq
|
|
21475
|
+
});
|
|
21476
|
+
} catch {
|
|
21477
|
+
responseBody = data;
|
|
21478
|
+
}
|
|
21469
21479
|
},
|
|
21470
21480
|
sendRaw(data, contentType) {
|
|
21471
21481
|
responseSent = true;
|
package/dist/index.mjs
CHANGED
|
@@ -10493,7 +10493,7 @@ var {
|
|
|
10493
10493
|
|
|
10494
10494
|
// package.json
|
|
10495
10495
|
var package_default = {
|
|
10496
|
-
version: "6.3.
|
|
10496
|
+
version: "6.3.2"};
|
|
10497
10497
|
var ALWAYS_EXTERNAL = ["uWebSockets.js"];
|
|
10498
10498
|
function getUserExternals(cwd) {
|
|
10499
10499
|
let pkgExternals = [];
|
|
@@ -21019,9 +21019,19 @@ async function handlePostRequest(req, res, app) {
|
|
|
21019
21019
|
delete responseHeaders[key.toLowerCase()];
|
|
21020
21020
|
return this;
|
|
21021
21021
|
},
|
|
21022
|
-
send(data,
|
|
21022
|
+
send(data, message) {
|
|
21023
21023
|
responseSent = true;
|
|
21024
|
-
|
|
21024
|
+
try {
|
|
21025
|
+
responseBody = app.serializer({
|
|
21026
|
+
data,
|
|
21027
|
+
message,
|
|
21028
|
+
statusCode: responseStatus,
|
|
21029
|
+
isError: responseStatus >= 400,
|
|
21030
|
+
req: mockReq
|
|
21031
|
+
});
|
|
21032
|
+
} catch {
|
|
21033
|
+
responseBody = data;
|
|
21034
|
+
}
|
|
21025
21035
|
},
|
|
21026
21036
|
sendRaw(data, contentType) {
|
|
21027
21037
|
responseSent = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiomify/cli",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.2",
|
|
4
4
|
"description": "Official CLI for Axiomify — scaffold, dev, build, route inspection, OpenAPI generation, production-readiness checks, host diagnostics, codemod migrations.",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -24,7 +24,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24
24
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
25
25
|
`},Qe=Ke(Xe)(Ze),$e={config:Je},et=function(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}};function tt(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],tt(e[n],t[n]))}),_e(_e({},e),t)}var nt={type:`cancelation`,msg:`operation is manually canceled`};function rt(e){var t=!1,n=new Promise(function(n,r){e.then(function(e){return t?r(nt):n(e)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var it=[`monaco`],at=be(We.create({config:Ge,isInitialized:!1,resolve:null,reject:null,monaco:null}),2),ot=at[0],st=at[1];function ct(e){var t=$e.config(e),n=t.monaco,r=ve(t,it);st(function(e){return{config:tt(e.config,r),monaco:n}})}function lt(){var e=ot(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(st({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),rt(gt);if(window.monaco&&window.monaco.editor)return mt(window.monaco),e.resolve(window.monaco),rt(gt);et(ut,ft)(pt)}return rt(gt)}function ut(e){return document.body.appendChild(e)}function dt(e){var t=document.createElement(`script`);return e&&(t.src=e),t}function ft(e){var t=ot(function(e){return{config:e.config,reject:e.reject}}),n=dt(`${t.config.paths.vs}/loader.js`);return n.onload=function(){return e()},n.onerror=t.reject,n}function pt(){var e=ot(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t([`vs/editor/editor.main`],function(t){var n=t.m||t;mt(n),e.resolve(n)},function(t){e.reject(t)})}function mt(e){ot().monaco||st({monaco:e})}function ht(){return ot(function(e){return e.monaco})}var gt=new Promise(function(e,t){return st({resolve:e,reject:t})}),_t={config:ct,init:lt,__getMonacoInstance:ht},vt={wrapper:{display:`flex`,position:`relative`,textAlign:`initial`},fullWidth:{width:`100%`},hide:{display:`none`}},yt={container:{display:`flex`,height:`100%`,width:`100%`,justifyContent:`center`,alignItems:`center`}};function bt({children:e}){return v.createElement(`div`,{style:yt.container},e)}var xt=bt;function St({width:e,height:t,isEditorReady:n,loading:r,_ref:i,className:a,wrapperProps:o}){return v.createElement(`section`,{style:{...vt.wrapper,width:e,height:t},...o},!n&&v.createElement(xt,null,r),v.createElement(`div`,{ref:i,style:{...vt.fullWidth,...!n&&vt.hide},className:a}))}var Ct=(0,v.memo)(St);function wt(e){(0,v.useEffect)(e,[])}var Tt=wt;function Et(e,t,n=!0){let r=(0,v.useRef)(!0);(0,v.useEffect)(r.current||!n?()=>{r.current=!1}:e,t)}var Dt=Et;function Ot(){}function kt(e,t,n,r){return At(e,r)||jt(e,t,n,r)}function At(e,t){return e.editor.getModel(Mt(e,t))}function jt(e,t,n,r){return e.editor.createModel(t,n,r?Mt(e,r):void 0)}function Mt(e,t){return e.Uri.parse(t)}function Nt({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:c=!1,theme:l=`light`,loading:u=`Loading...`,options:d={},height:f=`100%`,width:p=`100%`,className:m,wrapperProps:h={},beforeMount:g=Ot,onMount:_=Ot}){let[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!0),C=(0,v.useRef)(null),w=(0,v.useRef)(null),T=(0,v.useRef)(null),E=(0,v.useRef)(_),D=(0,v.useRef)(g),O=(0,v.useRef)(!1);Tt(()=>{let e=_t.init();return e.then(e=>(w.current=e)&&S(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>C.current?A():e.cancel()}),Dt(()=>{if(C.current&&w.current){let t=C.current.getOriginalEditor(),i=kt(w.current,e||``,r||n||`text`,a||``);i!==t.getModel()&&t.setModel(i)}},[a],y),Dt(()=>{if(C.current&&w.current){let e=C.current.getModifiedEditor(),r=kt(w.current,t||``,i||n||`text`,o||``);r!==e.getModel()&&e.setModel(r)}},[o],y),Dt(()=>{let e=C.current.getModifiedEditor();e.getOption(w.current.editor.EditorOption.readOnly)?e.setValue(t||``):t!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:t||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[t],y),Dt(()=>{C.current?.getModel()?.original.setValue(e||``)},[e],y),Dt(()=>{let{original:e,modified:t}=C.current.getModel();w.current.editor.setModelLanguage(e,r||n||`text`),w.current.editor.setModelLanguage(t,i||n||`text`)},[n,r,i],y),Dt(()=>{w.current?.editor.setTheme(l)},[l],y),Dt(()=>{C.current?.updateOptions(d)},[d],y);let k=(0,v.useCallback)(()=>{if(!w.current)return;D.current(w.current);let s=kt(w.current,e||``,r||n||`text`,a||``),c=kt(w.current,t||``,i||n||`text`,o||``);C.current?.setModel({original:s,modified:c})},[n,t,i,e,r,a,o]),ee=(0,v.useCallback)(()=>{!O.current&&T.current&&(C.current=w.current.editor.createDiffEditor(T.current,{automaticLayout:!0,...d}),k(),w.current?.editor.setTheme(l),b(!0),O.current=!0)},[d,l,k]);(0,v.useEffect)(()=>{y&&E.current(C.current,w.current)},[y]),(0,v.useEffect)(()=>{!x&&!y&&ee()},[x,y,ee]);function A(){let e=C.current?.getModel();s||e?.original?.dispose(),c||e?.modified?.dispose(),C.current?.dispose()}return v.createElement(Ct,{width:p,height:f,isEditorReady:y,loading:u,_ref:T,className:m,wrapperProps:h})}(0,v.memo)(Nt);function Pt(e){let t=(0,v.useRef)();return(0,v.useEffect)(()=>{t.current=e},[e]),t.current}var Ft=Pt,It=new Map;function Lt({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:i,path:a,theme:o=`light`,line:s,loading:c=`Loading...`,options:l={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p=`100%`,height:m=`100%`,className:h,wrapperProps:g={},beforeMount:_=Ot,onMount:y=Ot,onChange:b,onValidate:x=Ot}){let[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!0),E=(0,v.useRef)(null),D=(0,v.useRef)(null),O=(0,v.useRef)(null),k=(0,v.useRef)(y),ee=(0,v.useRef)(_),A=(0,v.useRef)(),te=(0,v.useRef)(r),ne=Ft(a),re=(0,v.useRef)(!1),j=(0,v.useRef)(!1);Tt(()=>{let e=_t.init();return e.then(e=>(E.current=e)&&T(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>D.current?N():e.cancel()}),Dt(()=>{let o=kt(E.current,e||r||``,t||i||``,a||n||``);o!==D.current?.getModel()&&(d&&It.set(ne,D.current?.saveViewState()),D.current?.setModel(o),d&&D.current?.restoreViewState(It.get(a)))},[a],S),Dt(()=>{D.current?.updateOptions(l)},[l],S),Dt(()=>{!D.current||r===void 0||(D.current.getOption(E.current.editor.EditorOption.readOnly)?D.current.setValue(r):r!==D.current.getValue()&&(j.current=!0,D.current.executeEdits(``,[{range:D.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),D.current.pushUndoStop(),j.current=!1))},[r],S),Dt(()=>{let e=D.current?.getModel();e&&i&&E.current?.editor.setModelLanguage(e,i)},[i],S),Dt(()=>{s!==void 0&&D.current?.revealLine(s)},[s],S),Dt(()=>{E.current?.editor.setTheme(o)},[o],S);let M=(0,v.useCallback)(()=>{if(!(!O.current||!E.current)&&!re.current){ee.current(E.current);let c=a||n,f=kt(E.current,r||e||``,t||i||``,c||``);D.current=E.current?.editor.create(O.current,{model:f,automaticLayout:!0,...l},u),d&&D.current.restoreViewState(It.get(c)),E.current.editor.setTheme(o),s!==void 0&&D.current.revealLine(s),C(!0),re.current=!0}},[e,t,n,r,i,a,l,u,d,o,s]);(0,v.useEffect)(()=>{S&&k.current(D.current,E.current)},[S]),(0,v.useEffect)(()=>{!w&&!S&&M()},[w,S,M]),te.current=r,(0,v.useEffect)(()=>{S&&b&&(A.current?.dispose(),A.current=D.current?.onDidChangeModelContent(e=>{j.current||b(D.current.getValue(),e)}))},[S,b]),(0,v.useEffect)(()=>{if(S){let e=E.current.editor.onDidChangeMarkers(e=>{let t=D.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=E.current.editor.getModelMarkers({resource:t});x?.(e)}});return()=>{e?.dispose()}}return()=>{}},[S,x]);function N(){A.current?.dispose(),f?d&&It.set(a,D.current.saveViewState()):D.current.getModel()?.dispose(),D.current.dispose()}return v.createElement(Ct,{width:p,height:m,isEditorReady:S,loading:c,_ref:O,className:h,wrapperProps:g})}var Rt=(0,v.memo)(Lt),zt=({discovery:e,isDark:t})=>{let[n,r]=(0,v.useState)(`typescript`),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(`editor`),[f,p]=(0,v.useState)(`terminal`),[m,h]=(0,v.useState)([{type:`info`,text:`[INFO] Terminal ready. Write your TypeScript client code and click 'Run Code'.`}]),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)([]),[C,T]=(0,v.useState)(!1),[D,O]=(0,v.useState)(!0),k=(0,v.useRef)(null),ee=(0,v.useRef)(null);(0,v.useEffect)(()=>{A(),te()},[]),(0,v.useEffect)(()=>{ee.current&&o.length>0&&ie(ee.current)},[o]);let A=async(e=`typescript`)=>{try{let t=await w(`/__studio/api/playground/sdk?target=${e}`);if(t.ok){let e=await t.json();a(e.starterCode),s(e.files),l(e.starterCode),e.files.length>0&&b(e.files[0].path)}}catch(e){console.error(`Failed to fetch SDK files:`,e)}},te=()=>{try{let e=localStorage.getItem(`axiomify_pg_history`);e&&S(JSON.parse(e))}catch(e){console.error(`Failed to parse history:`,e)}},ne=e=>{S(e),localStorage.setItem(`axiomify_pg_history`,JSON.stringify(e))},re=(e,t,r)=>{ne([{id:`pgh-`+Date.now(),timestamp:new Date().toISOString(),target:n,code:e,status:t,details:r},...x].slice(0,30))},j=async e=>{let t=e.target.value;r(t),M(`info`,`[SYSTEM] Switching target to ${t.toUpperCase()} and generating SDK...`),await A(t),M(`info`,`[SYSTEM] ${t.toUpperCase()} SDK generated and starter code loaded.`)},M=(e,t)=>{h(n=>[...n,{type:e,text:t}])},N=()=>h([]),ie=e=>{e.languages.typescript.typescriptDefaults.setCompilerOptions({target:e.languages.typescript.ScriptTarget.ES2020,allowNonTsExtensions:!0,moduleResolution:e.languages.typescript.ModuleResolutionKind.NodeJs,module:e.languages.typescript.ModuleKind.CommonJS,noEmit:!0}),e.languages.typescript.typescriptDefaults.setExtraLibs([]),e.languages.typescript.typescriptDefaults.addExtraLib(`declare module "zod" { export const z: any; export type ZodTypeAny = any; }`,`file:///node_modules/zod/index.d.ts`),e.languages.typescript.typescriptDefaults.addExtraLib(`declare module "@axiomify/sdk-runtime" { export const AxiomifyClient: any; export const AxiomifyError: any; }`,`file:///node_modules/@axiomify/sdk-runtime/index.d.ts`),o.forEach(t=>{let n=`file:///${t.path}`;e.languages.typescript.typescriptDefaults.addExtraLib(t.content,n)}),e.languages.typescript.typescriptDefaults.addExtraLib(`export * from './client';
|
|
26
26
|
export * from './types';
|
|
27
|
-
export * from './validators';`,`file:///sdk.ts`)},ae=(e,t)=>{k.current=e,ee.current=t,O(!1),ie(t)},oe=async()=>{let e=k.current?k.current.getValue():c;T(!0),p(`terminal`),M(`info`,`[SYSTEM] Transpiling and executing code...`);try{let t=await(await w(`/__studio/api/playground/execute`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:e,target:n})})).json(),r=null,i=`success`;t.error?(i=`error`,M(`error`,`[ERROR] `+t.error)):(t.logs&&t.logs.length>0&&t.logs.forEach(e=>{M(`info`,e);try{let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))r=JSON.parse(t);else if(e.includes(`Result: `)){let t=e.substring(e.indexOf(`Result: `)+8);r=JSON.parse(t)}}catch{}}),t.errors&&t.errors.length>0&&(i=`error`,t.errors.forEach(e=>{M(`error`,`[ERROR] `+e)})),(!t.logs||t.logs.length===0)&&(!t.errors||t.errors.length===0)&&M(`info`,`[SYSTEM] Execution finished successfully (no logs emitted).`)),re(e,i,t),t.error?_({error:t.error}):_(r||null)}catch(t){M(`error`,`[ERROR] Execution failed: `+String(t)),re(e,`error`,{error:String(t)}),_({error:String(t)})}finally{T(!1)}},se=()=>{k.current?k.current.setValue(i):l(i),M(`info`,`[SYSTEM] Starter code reset.`)},P=e=>{k.current?k.current.setValue(e.code):l(e.code),d(`editor`),M(`info`,`[SYSTEM] Loaded run code from history (${new Date(e.timestamp).toLocaleTimeString()}).`)},F=o.find(e=>e.path===y)?.content||``;return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`panel-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,flexWrap:`wrap`,gap:`12px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`panel-title`,children:`SDK Playground`}),(0,E.jsx)(`div`,{className:`panel-subtitle`,children:`Test your auto-generated Client SDK with language target selection and inline execution`})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,E.jsxs)(`select`,{id:`playground-target-select`,className:`select-input`,style:{margin:0,padding:`6px 12px`,fontSize:`12px`,fontWeight:600,borderRadius:`var(--radius-sm)`,width:`auto`},value:n,onChange:j,children:[(0,E.jsx)(`option`,{value:`typescript`,children:`TypeScript Target`}),(0,E.jsx)(`option`,{value:`python`,children:`Python Target`}),(0,E.jsx)(`option`,{value:`dart`,children:`Dart Target`})]}),(0,E.jsx)(`button`,{className:`btn`,onClick:oe,disabled:C,children:C?`Running...`:`▶ Run Code`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,onClick:se,children:`🔄 Reset starter`})]})]}),(0,E.jsxs)(`div`,{className:`playground-grid`,children:[(0,E.jsxs)(`div`,{className:`tester-section`,style:{display:`flex`,flexDirection:`column`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,borderBottom:`1px solid var(--border)`,marginBottom:`12px`,paddingBottom:`6px`},children:[(0,E.jsx)(`button`,{className:`btn btn-secondary ${u===`editor`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>d(`editor`),children:`💻 Client Editor`}),(0,E.jsx)(`button`,{className:`btn btn-secondary ${u===`preview`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>d(`preview`),children:`📂 SDK Files Preview`})]}),u===`editor`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,E.jsxs)(`div`,{style:{height:`550px`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,overflow:`hidden`,position:`relative`},children:[D&&(0,E.jsxs)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--bg-secondary)`,zIndex:10},children:[(0,E.jsx)(`div`,{className:`spinner`}),(0,E.jsx)(`span`,{style:{marginLeft:`8px`,fontSize:`13px`,color:`var(--text-secondary)`},children:`Initializing Monaco Editor...`})]}),(0,E.jsx)(Rt,{height:`550px`,language:n===`typescript`?`typescript`:n,theme:t?`vs-dark`:`light`,value:c,path:n===`typescript`?`file:///main.ts`:void 0,onChange:e=>l(e||``),onMount:ae,options:{automaticLayout:!0,minimap:{enabled:!1},fontSize:13,fontFamily:`JetBrains Mono, Menlo, monospace`}})]})}),u===`preview`&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},children:[(0,E.jsx)(`span`,{style:{fontSize:`12px`,fontWeight:600,color:`var(--text-secondary)`},children:`Generated Files:`}),(0,E.jsx)(`select`,{className:`select-input`,style:{margin:0,padding:`4px 8px`,fontSize:`12px`,flex:1,width:`auto`},value:y,onChange:e=>b(e.target.value),children:o.length===0?(0,E.jsx)(`option`,{value:``,children:`-- No files generated --`}):o.map(e=>(0,E.jsx)(`option`,{value:e.path,children:e.path},e.path))})]}),(0,E.jsx)(`div`,{style:{height:`500px`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,overflow:`hidden`},children:(0,E.jsx)(Rt,{height:`500px`,language:(e=>e.endsWith(`.py`)?`python`:e.endsWith(`.dart`)?`dart`:e.endsWith(`.yaml`)?`yaml`:e.endsWith(`.json`)?`json`:`typescript`)(y),theme:t?`vs-dark`:`light`,value:F,options:{automaticLayout:!0,readOnly:!0,minimap:{enabled:!1},fontSize:12,fontFamily:`JetBrains Mono, Menlo, monospace`}})})]})]}),(0,E.jsxs)(`div`,{className:`tester-section`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,borderBottom:`1px solid var(--border)`,marginBottom:`12px`,paddingBottom:`6px`,width:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,E.jsx)(`button`,{className:`btn btn-secondary ${f===`terminal`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>p(`terminal`),children:`🖥️ Output Terminal`}),(0,E.jsx)(`button`,{className:`btn btn-secondary ${f===`response`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>p(`response`),children:`📦 Response Preview`}),(0,E.jsx)(`button`,{className:`btn btn-secondary ${f===`history`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>p(`history`),children:`📜 Request History`})]}),f===`terminal`&&(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`2px 8px`,fontSize:`11px`,margin:0},onClick:N,children:`Clear Terminal`})]}),f===`terminal`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,height:`100%`},children:(0,E.jsx)(`div`,{className:`console-terminal`,style:{minHeight:`510px`,maxHeight:`510px`,textAlign:`left`},children:m.map((e,t)=>(0,E.jsx)(`div`,{className:`console-line ${e.type}`,children:e.text},t))})}),f===`response`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,E.jsx)(`div`,{className:`console-terminal`,style:{minHeight:`510px`,maxHeight:`510px`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,fontSize:`12px`,padding:`16px`,overflowY:`auto`,lineHeight:1.5,textAlign:`left`},children:g?(0,E.jsx)(`pre`,{style:{margin:0,fontFamily:`var(--font-mono)`},children:JSON.stringify(g,null,2)}):(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`13px`,textAlign:`center`,paddingTop:`40px`},children:`No response payload captured yet. Run client code that prints an object or response.`})})}),f===`history`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`},children:(0,E.jsx)(`div`,{style:{minHeight:`510px`,maxHeight:`510px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,paddingRight:`4px`},children:x.length===0?(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`13px`,textAlign:`center`,paddingTop:`40px`},children:`No code execution history recorded. Run code to add history.`}):x.map(e=>(0,E.jsxs)(`div`,{className:`card`,style:{display:`flex`,flexDirection:`column`,gap:`6px`,padding:`10px 14px`,cursor:`pointer`,margin:0,textAlign:`left`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`},onClick:()=>P(e),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,E.jsx)(`span`,{className:`method-badge method-POST`,style:{fontSize:`9px`,padding:`1px 4px`},children:e.target.toUpperCase()}),(0,E.jsx)(`span`,{style:{color:e.status===`success`?`var(--success)`:`var(--error)`,fontWeight:`bold`,fontSize:`11px`},children:e.status.toUpperCase()})]}),(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontFamily:`var(--font-mono)`,color:`var(--text-secondary)`,textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,marginTop:`2px`},children:e.code}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,fontSize:`10px`,color:`var(--text-muted)`,marginTop:`4px`},children:[(0,E.jsx)(`span`,{children:new Date(e.timestamp).toLocaleString()}),(0,E.jsx)(`span`,{style:{color:`var(--accent)`,fontWeight:500},children:`Load code ➔`})]})]},e.id))})})]})]})]})},Bt=()=>{let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(`request`);(0,v.useEffect)(()=>{o();let e=setInterval(o,3e3);return()=>clearInterval(e)},[]),(0,v.useEffect)(()=>{e?.entries?.length>0&&!n&&r(e.entries[0].requestId)},[e,n]);let o=async()=>{try{let e=await w(`/__studio/api/session`);if(e.ok){let n=await e.json();t(n);let r=document.getElementById(`badge-recorder`);r&&n.summary&&(r.textContent=String(n.summary.requestCount||0))}}catch(e){console.error(`Failed to fetch session:`,e)}},s=async()=>{if(confirm(`Are you sure you want to clear session recording data?`))try{if((await w(`/__studio/api/session`,{method:`DELETE`})).ok){t(null),r(``);let e=document.getElementById(`badge-recorder`);e&&(e.textContent=`0`)}}catch(e){console.error(`Failed to clear session:`,e)}},c=()=>{let e=x();window.location.href=`/__studio/api/session/har?token=${encodeURIComponent(e)}`},l=e?.entries||[],u=l.find(e=>e.requestId===n)||l[0],d=e=>e>=200&&e<300?{background:`rgba(0, 210, 160, 0.15)`,color:`var(--success)`}:e>=300&&e<400?{background:`rgba(255, 193, 7, 0.15)`,color:`var(--warning)`}:{background:`rgba(255, 107, 107, 0.15)`,color:`var(--error)`};return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`panel-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,flexWrap:`wrap`,gap:`12px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`panel-title`,children:`Session Recorder`}),(0,E.jsx)(`div`,{className:`panel-subtitle`,children:`Capture, examine, and export HTTP/WS api request transaction sessions`})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,E.jsx)(`button`,{className:`btn btn-secondary`,onClick:s,disabled:!e,children:`Clear Recorder`}),(0,E.jsx)(`button`,{className:`btn`,onClick:c,children:`⬇ Export HAR`})]})]}),l.length===0?(0,E.jsxs)(`div`,{className:`empty-state`,children:[(0,E.jsx)(`div`,{className:`empty-state-icon`,children:`📡`}),(0,E.jsx)(`div`,{className:`empty-state-message`,children:`No requests recorded yet. Fire some requests via the Request Tester or host API.`})]}):(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`360px 1fr`,gap:`24px`,minHeight:`650px`,height:`auto`,textAlign:`left`},children:[(0,E.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`16px`,display:`flex`,flexDirection:`column`,gap:`12px`},children:[(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-muted)`},children:`Recorded Transactions`}),(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,maxHeight:`600px`},children:l.map(e=>{let t=u&&e.requestId===u.requestId,n=e.response?.status||0,i=e.response?.durationMs;return(0,E.jsxs)(`div`,{style:{background:t?`var(--bg-tertiary)`:`var(--bg-primary)`,border:t?`1px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,cursor:`pointer`,transition:`all 0.2s`},onClick:()=>r(e.requestId),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`6px`},children:[(0,E.jsx)(`span`,{className:`method-badge method-${e.request.method}`,style:{fontSize:`9px`,padding:`1px 5px`},children:e.request.method}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,alignItems:`center`},children:[n>0&&(0,E.jsx)(`span`,{style:{fontSize:`9px`,fontWeight:700,padding:`1px 5px`,borderRadius:`3px`,...d(n)},children:n}),i!==void 0&&(0,E.jsxs)(`span`,{style:{fontSize:`10px`,color:`var(--text-muted)`},children:[i.toFixed(1),`ms`]})]})]}),(0,E.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`11px`,fontWeight:600,color:`var(--text-primary)`,wordBreak:`break-all`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.request.path}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`9px`,color:`var(--text-muted)`,marginTop:`6px`},children:[(0,E.jsxs)(`span`,{children:[`ID: `,e.requestId.slice(0,8),`...`]}),(0,E.jsx)(`span`,{children:new Date(e.request.timestamp).toLocaleTimeString()})]})]},e.requestId)})})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`20px`},children:u?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`24px`,textAlign:`center`},children:[(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,textTransform:`uppercase`,color:`var(--text-muted)`,marginBottom:`20px`,textAlign:`left`},children:`Transaction Lifecycle Flowchart`}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,gap:`16px`,flexWrap:`wrap`},children:[(0,E.jsxs)(`div`,{style:{background:i===`request`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`request`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`request`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`request`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`💻`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Client Request`}),(0,E.jsx)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`},children:u.request.method})]}),(0,E.jsx)(`div`,{style:{fontSize:`18px`,color:`var(--text-muted)`,fontWeight:800},children:`➔`}),(0,E.jsxs)(`div`,{style:{background:i===`middlewares`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`middlewares`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`middlewares`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`middlewares`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`🛡️`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Middlewares`}),(0,E.jsx)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`},children:u.request.headers?.[`content-type`]?`Parser + Custom`:`Standard`})]}),(0,E.jsx)(`div`,{style:{fontSize:`18px`,color:`var(--text-muted)`,fontWeight:800},children:`➔`}),(0,E.jsxs)(`div`,{style:{background:i===`queries`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`queries`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`queries`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`queries`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`🛢️`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Database Queries`}),(0,E.jsxs)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`},children:[u.queries?.length||0,` executed`]})]}),(0,E.jsx)(`div`,{style:{fontSize:`18px`,color:`var(--text-muted)`,fontWeight:800},children:`➔`}),(0,E.jsxs)(`div`,{style:{background:i===`response`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`response`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`response`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`response`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`📥`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Server Response`}),(0,E.jsx)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`,fontWeight:`bold`},children:u.response?u.response.status:`NO RESPONSE`})]})]})]}),(0,E.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`24px`,flex:1,minHeight:`350px`,display:`flex`,flexDirection:`column`,gap:`16px`},children:[i===`request`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Request Details`}),(0,E.jsxs)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,fontFamily:`var(--font-mono)`,color:`var(--text-primary)`},children:[u.request.method,` `,u.request.path]})]})}),(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`16px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Headers`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:JSON.stringify(u.request.headers,null,2)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Body / Query Params`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:u.request.body?JSON.stringify(u.request.body,null,2):u.request.query&&Object.keys(u.request.query).length>0?JSON.stringify(u.request.query,null,2):`No payload / query parameters`})]})]})]}),i===`middlewares`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Middlewares Execution`}),(0,E.jsx)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,color:`var(--text-primary)`},children:`Request Processing Pipeline`})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:u.timeline&&u.timeline.length>0?u.timeline.map((e,t)=>(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`10px 14px`},children:[(0,E.jsx)(`span`,{style:{fontSize:`12px`,fontWeight:600,color:`var(--text-primary)`},children:e.name}),(0,E.jsxs)(`span`,{style:{fontSize:`11px`,color:`var(--success)`,fontFamily:`var(--font-mono)`},children:[e.duration.toFixed(2),` ms`]})]},t)):(0,E.jsx)(`div`,{style:{fontStyle:`italic`,color:`var(--text-muted)`,fontSize:`12px`},children:`No pipeline execution markers recorded. Custom middleware stats may not be configured.`})})]}),i===`queries`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Database Queries`}),(0,E.jsxs)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,color:`var(--text-primary)`},children:[`SQL & ORM Operations (`,u.queries?.length||0,`)`]})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`,overflowY:`auto`,maxHeight:`300px`},children:!u.queries||u.queries.length===0?(0,E.jsx)(`div`,{style:{fontStyle:`italic`,color:`var(--text-muted)`,fontSize:`12px`,textAlign:`center`,padding:`20px`},children:`No database queries executed during this transaction.`}):u.queries.map((e,t)=>(0,E.jsxs)(`div`,{style:{background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`10px`,color:`var(--text-muted)`,marginBottom:`6px`},children:[(0,E.jsx)(`span`,{style:{fontWeight:700,color:e.failed?`var(--error)`:`var(--success)`},children:e.failed?`❌ FAILED`:`✅ SUCCESS`}),(0,E.jsxs)(`span`,{children:[e.durationMs.toFixed(1),` ms`]})]}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:`var(--text-primary)`},children:e.query})]},t))})]}),i===`response`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Server Response`}),(0,E.jsx)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,color:`var(--text-primary)`},children:`Execution Summary`})]}),u.response&&(0,E.jsx)(`span`,{style:{fontSize:`12px`,fontWeight:700,padding:`4px 10px`,borderRadius:`4px`,...d(u.response.status)},children:u.response.status})]}),u.response?(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`16px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Headers`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:JSON.stringify(u.response.headers,null,2)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Body`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:u.response.body?typeof u.response.body==`object`?JSON.stringify(u.response.body,null,2):String(u.response.body):`Empty Response Body`})]})]}):(0,E.jsx)(`div`,{style:{fontStyle:`italic`,color:`var(--text-muted)`,fontSize:`12px`,textAlign:`center`,padding:`20px`},children:`Response has not been captured yet or transaction is incomplete.`})]})]})]}):(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,textAlign:`center`,padding:`40px`},children:`Select a transaction from the list.`})})]})]})},Vt=({discovery:e,prefilledMethod:t=``,prefilledPath:n=``,onClearPrefill:r})=>{let[i,a]=(0,v.useState)(`GET`),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)([{key:`Content-Type`,value:`application/json`}]),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(null),[x,S]=(0,v.useState)([]),[C,T]=(0,v.useState)(null);(0,v.useEffect)(()=>{D();let e=()=>{D()};return window.addEventListener(`axiomify-replays-updated`,e),()=>{window.removeEventListener(`axiomify-replays-updated`,e)}},[]),(0,v.useEffect)(()=>{t&&n&&(a(t),s(n),A(t,n),r&&r())},[t,n]);let D=async()=>{try{let e=await w(`/__studio/api/request/replays`);if(e.ok){let t=await e.json();S(t.history||t.replays||[])}}catch(e){console.error(`Failed to fetch request replays:`,e)}},O=async()=>{if(confirm(`Are you sure you want to clear request history?`))try{(await w(`/__studio/api/request/replays`,{method:`DELETE`})).ok&&S([])}catch(e){console.error(`Failed to clear replays:`,e)}},k=(e,t)=>{if(!t)return null;let n=e.toLowerCase();if(t.type===`object`&&t.properties){let e={};for(let[n,r]of Object.entries(t.properties))e[n]=k(n,r);return e}return t.type===`array`?[k(e,t.items)]:t.type===`string`?n.includes(`email`)?`john.doe.${Math.floor(Math.random()*1e3)}@example.com`:n.includes(`name`)?n.includes(`first`)?`John`:n.includes(`last`)?`Doe`:`John Doe`:n.includes(`uuid`)||n.includes(`id`)?`9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d`:n.includes(`phone`)||n.includes(`tel`)?`+1-555-0199`:n.includes(`address`)||n.includes(`street`)?`123 Main Street, Springfield`:n.includes(`date`)||n.includes(`time`)||n.includes(`at`)?new Date().toISOString():n.includes(`avatar`)||n.includes(`url`)||n.includes(`image`)?`https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=150&h=150`:t.enum&&t.enum.length>0?t.enum[0]:t.description||`Sample String`:t.type===`number`||t.type===`integer`?n.includes(`age`)?30:n.includes(`price`)?19.99:n.includes(`quantity`)||n.includes(`count`)?5:n.includes(`year`)?2026:42:t.type===`boolean`?!0:null},ee=e=>{let t=[],n=/:([a-zA-Z0-9_]+)/g,r;for(;(r=n.exec(e))!==null;)t.push(r[1]);let i=/{([a-zA-Z0-9_]+)}/g;for(;(r=i.exec(e))!==null;)t.push(r[1]);return Array.from(new Set(t))},A=(t,n)=>{let r=e.schemas.find(e=>e.method===t&&e.path===n);if(r&&r.body){let e=k(`body`,r.body);h(JSON.stringify(e,null,2))}else h(``);if(r&&r.query&&r.query.properties){let e=r.query.properties;l(Object.keys(e).map(t=>{let n=k(t,e[t]);return{key:t,value:n===null?``:String(n)}}))}else l([]);d(ee(n).map(e=>{let t=r?.params?.properties?.[e],n=k(e,t||{type:`string`});return{key:e,value:n===null?``:String(n)}}))},te=e=>{let t=e.target.value;if(!t)return;let n=t.split(` `),r=n[0],i=n[1];a(r),s(i),A(r,i)},ne=async e=>{a(e.method),s(e.path),d([]);let t=[];e.query&&Object.entries(e.query).forEach(([e,n])=>{t.push({key:e,value:String(n)})}),l(t);let n=[];e.headers&&Object.entries(e.headers).forEach(([e,t])=>{n.push({key:e,value:String(t)})}),p(n),e.body?h(typeof e.body==`string`?e.body:JSON.stringify(e.body,null,2)):h(``);try{let t=await w(`/__studio/api/request/replay?id=${encodeURIComponent(e.id)}`);if(t.ok){let e=await t.json();e.response&&(b(e.response),T(null))}}catch(e){console.error(`Failed to load full replay details:`,e)}},re=async()=>{if(!o.trim()){alert(`Please enter a request path`);return}_(!0),T(null);let e={};c.forEach(t=>{t.key.trim()&&(e[t.key.trim()]=t.value.trim())});let t={};f.forEach(e=>{e.key.trim()&&(t[e.key.trim()]=e.value.trim())});let n;if(m.trim())try{n=JSON.parse(m.trim())}catch(e){alert(`Invalid JSON request body: `+e.message),_(!1);return}let r=o.trim();u.forEach(e=>{e.key.trim()&&(r=r.replace(`:${e.key.trim()}`,e.value.trim()).replace(`{${e.key.trim()}}`,e.value.trim()))});try{let a=await(await w(`/__studio/api/request`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({method:i,path:r,headers:t,query:e,body:n})})).json();if(_(!1),D(),a.error){b({status:`ERROR`,body:a.error+(a.message?`: `+a.message:``),headers:{}});return}b(a)}catch(e){_(!1),b({status:`ERROR`,body:`Network error sending request: `+e.message,headers:{}})}},j=e=>({200:`OK`,201:`Created`,202:`Accepted`,204:`No Content`,301:`Moved Permanently`,302:`Found`,304:`Not Modified`,400:`Bad Request`,401:`Unauthorized`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,500:`Internal Server Error`,502:`Bad Gateway`,503:`Service Unavailable`})[e]||``,M=e=>{if(e===`ERROR`)return{background:`rgba(255, 107, 107, 0.15)`,color:`var(--error)`};let t=Number(e);return t>=200&&t<300?{background:`rgba(0, 210, 160, 0.15)`,color:`var(--success)`}:t>=300&&t<400?{background:`rgba(255, 193, 7, 0.15)`,color:`var(--warning)`}:{background:`rgba(255, 107, 107, 0.15)`,color:`var(--error)`}},N=()=>l(e=>[...e,{key:``,value:``}]),ie=e=>l(t=>t.filter((t,n)=>n!==e)),ae=(e,t,n)=>{l(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},oe=()=>p(e=>[...e,{key:``,value:``}]),se=e=>p(t=>t.filter((t,n)=>n!==e)),P=(e,t,n)=>{p(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},F=()=>{if(!y)return;let e=typeof y.body==`object`?JSON.stringify(y.body,null,2):String(y.body);navigator.clipboard.writeText(e).then(()=>{alert(`Copied response body!`)})},I=(e,t)=>{let n=t&&Object.keys(t).length>0,[r,i]=(0,v.useState)(e===`body`||e===`state`);return(0,E.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`6px 8px`,background:`var(--bg-secondary)`,marginBottom:`4px`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontWeight:n?600:400,color:n?`var(--text-primary)`:`var(--text-muted)`,cursor:`pointer`,userSelect:`none`},onClick:()=>n&&i(!r),children:[(0,E.jsx)(`span`,{children:e}),(0,E.jsx)(`span`,{children:n?r?`▼`:`▶`:`—`})]}),n&&r&&(0,E.jsx)(`pre`,{style:{marginTop:`6px`,fontSize:`11px`,color:`var(--text-primary)`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,fontFamily:`var(--font-mono)`,textAlign:`left`},children:JSON.stringify(t,null,2)})]})};return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`panel-header`,children:[(0,E.jsx)(`div`,{className:`panel-title`,children:`Request Tester`}),(0,E.jsx)(`div`,{className:`panel-subtitle`,children:`Interact with and test routes directly against your in-memory Axiomify app instance`})]}),(0,E.jsx)(`div`,{className:`search-bar`,children:(0,E.jsxs)(`select`,{className:`select-input`,style:{maxWidth:`400px`},onChange:te,value:`${i} ${o}`,children:[(0,E.jsx)(`option`,{value:``,children:`-- Choose a discovered route to pre-fill --`}),(e.routes||[]).filter(e=>!e.isWs).map(e=>(0,E.jsxs)(`option`,{value:`${e.method} ${e.path}`,children:[e.method,` `,e.path]},`${e.method} ${e.path}`))]})}),(0,E.jsxs)(`div`,{className:`tester-container`,children:[(0,E.jsxs)(`div`,{className:`tester-section`,style:{maxHeight:`700px`,overflowY:`auto`},children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,marginBottom:`8px`},children:[(0,E.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,E.jsx)(`span`,{children:`⏱️`}),` Replay History`]}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`2px 8px`,fontSize:`10px`,borderRadius:`var(--radius-sm)`,margin:0},onClick:O,children:`Clear`})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:x.length===0?(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`12px`,textAlign:`center`,padding:`16px 0`},children:`No execution runs.`}):x.map(e=>{let t=e.status&&e.status>=200&&e.status<300;return(0,E.jsxs)(`button`,{className:`nav-item`,style:{textAlign:`left`,flexGrow:1,padding:`8px 10px`,fontSize:`12px`,display:`flex`,flexDirection:`column`,gap:`4px`,border:`1px solid var(--border)`,background:`var(--bg-secondary)`,borderRadius:`var(--radius-sm)`,margin:0,width:`100%`},onClick:()=>ne(e),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`},children:[(0,E.jsx)(`span`,{className:`method-badge method-${e.method}`,style:{fontSize:`9px`,padding:`1px 4px`},children:e.method}),(0,E.jsx)(`span`,{style:{color:t?`var(--success)`:`var(--error)`,fontWeight:`bold`,fontSize:`11px`},children:e.status||`ERROR`})]}),(0,E.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`11px`,color:`var(--text-primary)`,wordBreak:`break-all`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,width:`100%`},children:e.path}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`10px`,color:`var(--text-muted)`,width:`100%`},children:[(0,E.jsx)(`span`,{children:e.duration?`${e.duration.toFixed(0)}ms`:``}),(0,E.jsx)(`span`,{children:new Date(e.timestamp).toLocaleTimeString()})]})]},e.id)})})]}),(0,E.jsxs)(`div`,{className:`tester-section`,children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,children:[(0,E.jsx)(`span`,{children:`📝`}),` Request Builder`]}),(0,E.jsxs)(`div`,{className:`form-row`,children:[(0,E.jsxs)(`div`,{className:`form-group`,style:{width:`120px`,flex:`none`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Method`}),(0,E.jsx)(`select`,{className:`select-input`,value:i,onChange:e=>a(e.target.value),children:[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`].map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{className:`form-group`,style:{flex:1},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Path`}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`/api/v1/resource`,value:o,onChange:e=>s(e.target.value)})]})]}),u.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Path Parameters`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:u.map((e,t)=>(0,E.jsxs)(`div`,{className:`kv-row`,children:[(0,E.jsx)(`input`,{className:`text-input`,type:`text`,readOnly:!0,value:e.key,style:{opacity:.7,background:`var(--bg-secondary)`,flex:1}}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Value`,value:e.value,style:{flex:2},onChange:e=>{let n=e.target.value;d(e=>e.map((e,r)=>r===t?{...e,value:n}:e))}})]},t))})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`4px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Query Parameters`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`4px 8px`,fontSize:`11px`},onClick:N,children:`+ Add Param`})]}),(0,E.jsx)(`div`,{children:c.map((e,t)=>(0,E.jsxs)(`div`,{className:`kv-row`,children:[(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Key`,value:e.key,onChange:e=>ae(t,`key`,e.target.value)}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Value`,value:e.value,onChange:e=>ae(t,`value`,e.target.value)}),(0,E.jsx)(`button`,{className:`btn btn-danger`,style:{margin:0},onClick:()=>ie(t),children:`Remove`})]},t))})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`4px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Headers`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`4px 8px`,fontSize:`11px`},onClick:oe,children:`+ Add Header`})]}),(0,E.jsx)(`div`,{children:f.map((e,t)=>(0,E.jsxs)(`div`,{className:`kv-row`,children:[(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Key`,value:e.key,onChange:e=>P(t,`key`,e.target.value)}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Value`,value:e.value,onChange:e=>P(t,`value`,e.target.value)}),(0,E.jsx)(`button`,{className:`btn btn-danger`,style:{margin:0},onClick:()=>se(t),children:`Remove`})]},t))})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Request Body (JSON)`}),(0,E.jsx)(`textarea`,{className:`textarea-input`,placeholder:`{"key": "value"}`,value:m,onChange:e=>h(e.target.value)})]}),(0,E.jsx)(`div`,{style:{marginTop:`10px`},children:(0,E.jsx)(`button`,{className:`btn`,style:{width:`100%`,margin:0},onClick:re,disabled:g,children:g?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`spinner`,style:{width:`14px`,height:`14px`,borderWidth:`2px`,marginRight:`8px`}}),`Sending...`]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{children:`⚡`}),` Send Request`]})})})]}),(0,E.jsxs)(`div`,{className:`tester-section`,style:{display:`flex`,flexDirection:`column`},children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,children:[(0,E.jsx)(`span`,{children:`📥`}),` Response`]}),y?(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`,flex:1},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`form-label`,style:{marginRight:`8px`},children:`Status`}),(0,E.jsxs)(`span`,{className:`response-status-badge`,style:M(y.status),children:[y.status,` `,y.status!==`ERROR`&&j(y.status)]})]}),y.status!==`ERROR`&&(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`6px 12px`,fontSize:`12px`,margin:0},onClick:F,children:`Copy Body`})]}),y.headers&&Object.keys(y.headers).length>0&&(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Headers`}),(0,E.jsx)(`div`,{className:`response-headers-container`,children:(0,E.jsx)(`table`,{className:`response-headers-table`,children:(0,E.jsx)(`tbody`,{children:Object.entries(y.headers).map(([e,t])=>(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`td`,{className:`response-headers-key`,children:e}),(0,E.jsx)(`td`,{className:`response-headers-value`,children:String(t)})]},e))})})})]}),(0,E.jsxs)(`div`,{className:`form-group`,style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Body`}),(0,E.jsx)(`pre`,{className:`response-body-pre`,style:{textAlign:`left`},children:y.status===`ERROR`?y.body:y.body!==null&&y.body!==void 0?typeof y.body==`object`?JSON.stringify(y.body,null,2):String(y.body):`[Empty Response Body]`})]}),y.profile?.validationErrors&&y.profile.validationErrors.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,style:{marginTop:`16px`},children:[(0,E.jsx)(`label`,{className:`form-label`,style:{color:`var(--error)`,fontWeight:600},children:`Validation Errors`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,background:`rgba(239, 68, 68, 0.05)`,border:`1px solid rgba(239, 68, 68, 0.2)`,borderRadius:`var(--radius-md)`,padding:`16px`,textAlign:`left`},children:y.profile.validationErrors.map((e,t)=>(0,E.jsxs)(`div`,{style:{background:`rgba(239, 68, 68, 0.05)`,border:`1px solid rgba(239, 68, 68, 0.15)`,borderRadius:`var(--radius-sm)`,padding:`10px`,fontSize:`12px`,display:`flex`,flexDirection:`column`,gap:`4px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`strong`,{style:{color:`var(--error)`},children:`Field:`}),` `,(0,E.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`,fontWeight:600,color:`var(--error)`},children:e.field}),` (`,(0,E.jsx)(`span`,{style:{textTransform:`uppercase`,fontSize:`10px`,fontWeight:600,color:`var(--text-secondary)`},children:e.location}),`)`]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`strong`,{children:`Reason:`}),` `,e.reason]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`strong`,{children:`Received:`}),` `,(0,E.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`,background:`var(--bg-tertiary)`,padding:`2px 4px`,borderRadius:`3px`,fontSize:`11px`},children:JSON.stringify(e.received)})]})]},t))})]}),y.profile?.timeline&&y.profile.timeline.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,style:{marginTop:`16px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Execution Timeline`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`16px`},children:(()=>{let e=Math.max(...y.profile.timeline.map(e=>e.duration),1);return y.profile.timeline.map((t,n)=>{let r=Math.max(t.duration/e*100,2),i=`timeline-type-middleware`;t.type===`hook`?i=`timeline-type-hook`:t.type===`handler`&&(i=`timeline-type-handler`);let a=t.before&&t.after,o=C===n;return(0,E.jsxs)(`div`,{className:`timeline-row ${a?`clickable`:``}`,style:{textAlign:`left`},onClick:()=>a&&T(o?null:n),children:[(0,E.jsxs)(`div`,{className:`timeline-label-row`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{style:{color:`var(--text-primary)`,fontSize:`12px`},children:t.name}),(0,E.jsx)(`span`,{className:`timeline-type-badge ${i}`,children:t.type})]}),(0,E.jsxs)(`span`,{className:`timeline-duration`,children:[t.duration.toFixed(2),` ms`]})]}),(0,E.jsx)(`div`,{className:`timeline-bar-container`,children:(0,E.jsx)(`div`,{className:`timeline-bar`,style:{width:`${r}%`}})}),a&&o&&(0,E.jsx)(`div`,{style:{padding:`12px`,margin:`4px 0 12px 0`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`},children:(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`16px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-secondary)`,marginBottom:`6px`,textTransform:`uppercase`},children:`📥 State Before`}),I(`body`,t.before?.body),I(`state`,t.before?.state),I(`headers`,t.before?.headers),I(`query`,t.before?.query),I(`params`,t.before?.params)]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--accent)`,marginBottom:`6px`,textTransform:`uppercase`},children:`📤 State After`}),I(`body`,t.after?.body),I(`state`,t.after?.state),I(`headers`,t.after?.headers),I(`query`,t.after?.query),I(`params`,t.after?.params)]})]})})]},n)})})()})]}),y.profile?.queries&&y.profile.queries.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,style:{marginTop:`16px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Database Queries`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`16px`,textAlign:`left`},children:y.profile.queries.map((e,t)=>(0,E.jsxs)(`div`,{className:`db-query-row`,children:[(0,E.jsxs)(`div`,{className:`db-query-header`,children:[(0,E.jsx)(`span`,{className:`db-query-badge`,children:`DATABASE QUERY`}),(0,E.jsxs)(`span`,{className:`db-query-duration`,children:[e.duration.toFixed(2),` ms`]})]}),(0,E.jsx)(`pre`,{className:`db-query-sql`,children:e.query})]},t))})]})]}):(0,E.jsxs)(`div`,{className:`response-placeholder`,children:[(0,E.jsx)(`span`,{children:`📥`}),(0,E.jsx)(`span`,{children:`Send a request to see the response here`})]})]})]})]})},Ht=Object.create(null);Ht.open=`0`,Ht.close=`1`,Ht.ping=`2`,Ht.pong=`3`,Ht.message=`4`,Ht.upgrade=`5`,Ht.noop=`6`;var Ut=Object.create(null);Object.keys(Ht).forEach(e=>{Ut[Ht[e]]=e});var Wt={type:`error`,data:`parser error`},Gt=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,Kt=typeof ArrayBuffer==`function`,qt=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Jt=({type:e,data:t},n,r)=>Gt&&t instanceof Blob?n?r(t):Yt(t,r):Kt&&(t instanceof ArrayBuffer||qt(t))?n?r(t):Yt(new Blob([t]),r):r(Ht[e]+(t||``)),Yt=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function Xt(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Zt;function Qt(e,t){if(Gt&&e.data instanceof Blob)return e.data.arrayBuffer().then(Xt).then(t);if(Kt&&(e.data instanceof ArrayBuffer||qt(e.data)))return t(Xt(e.data));Jt(e,!1,e=>{Zt||=new TextEncoder,t(Zt.encode(e))})}var $t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,en=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)en[$t.charCodeAt(e)]=e;var tn=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=en[e.charCodeAt(r)],o=en[e.charCodeAt(r+1)],s=en[e.charCodeAt(r+2)],c=en[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},nn=typeof ArrayBuffer==`function`,rn=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:on(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:an(e.substring(1),t)}:Ut[n]?e.length>1?{type:Ut[n],data:e.substring(1)}:{type:Ut[n]}:Wt},an=(e,t)=>nn?on(tn(e),t):{base64:!0,data:e},on=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},sn=``,cn=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{Jt(e,!1,e=>{r[a]=e,++i===n&&t(r.join(sn))})})},ln=(e,t)=>{let n=e.split(sn),r=[];for(let e=0;e<n.length;e++){let i=rn(n[e],t);if(r.push(i),i.type===`error`)break}return r};function un(){return new TransformStream({transform(e,t){Qt(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var dn;function fn(e){return e.reduce((e,t)=>e+t.length,0)}function pn(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function mn(e,t){dn||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(fn(n)<1)break;let e=pn(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(fn(n)<2)break;let e=pn(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(fn(n)<8)break;let e=pn(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(Wt);break}i=a*2**32+t.getUint32(4),r=3}else{if(fn(n)<i)break;let e=pn(n,i);s.enqueue(rn(a?e:dn.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(Wt);break}}}})}function L(e){if(e)return hn(e)}function hn(e){for(var t in L.prototype)e[t]=L.prototype[t];return e}L.prototype.on=L.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},L.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},L.prototype.off=L.prototype.removeListener=L.prototype.removeAllListeners=L.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},L.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},L.prototype.emitReserved=L.prototype.emit,L.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},L.prototype.hasListeners=function(e){return!!this.listeners(e).length};var gn=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),_n=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),vn=`arraybuffer`;function yn(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var bn=_n.setTimeout,xn=_n.clearTimeout;function Sn(e,t){t.useNativeTimers?(e.setTimeoutFn=bn.bind(_n),e.clearTimeoutFn=xn.bind(_n)):(e.setTimeoutFn=_n.setTimeout.bind(_n),e.clearTimeoutFn=_n.clearTimeout.bind(_n))}var Cn=1.33;function wn(e){return typeof e==`string`?Tn(e):Math.ceil((e.byteLength||e.size)*Cn)}function Tn(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function En(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Dn(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function On(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var kn=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},An=class extends L{constructor(e){super(),this.writable=!1,Sn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new kn(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=rn(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Dn(e);return t.length?`?`+t:``}},jn=class extends An{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){ln(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,cn(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=En()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},Mn=!1;try{Mn=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Nn=Mn;function Pn(){}var Fn=class extends jn{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},In=class e extends L{constructor(e,t,n){super(),this.createRequest=e,Sn(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=yn(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=Pn,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(In.requestsCount=0,In.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,Ln);else if(typeof addEventListener==`function`){let e=`onpagehide`in _n?`pagehide`:`unload`;addEventListener(e,Ln,!1)}}function Ln(){for(let e in In.requests)In.requests.hasOwnProperty(e)&&In.requests[e].abort()}var Rn=(function(){let e=Bn({xdomain:!1});return e&&e.responseType!==null})(),zn=class extends Fn{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Rn&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new In(Bn,this.uri(),e)}};function Bn(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Nn))return new XMLHttpRequest}catch{}if(!t)try{return new _n[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var Vn=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,Hn=class extends An{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=Vn?{}:yn(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;Jt(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&gn(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=En()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Un=_n.WebSocket||_n.MozWebSocket,Wn={websocket:class extends Hn{createSocket(e,t,n){return Vn?new Un(e,t,n):t?new Un(e,t):new Un(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends An{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=mn(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=un();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&gn(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:zn},Gn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Kn=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function qn(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=Gn.exec(e||``),a={},o=14;for(;o--;)a[Kn[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=Jn(a,a.path),a.queryKey=Yn(a,a.query),a}function Jn(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function Yn(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var Xn=typeof addEventListener==`function`&&typeof removeEventListener==`function`,Zn=[];Xn&&addEventListener(`offline`,()=>{Zn.forEach(e=>e())},!1);var Qn=class e extends L{constructor(e,t){if(super(),this.binaryType=vn,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=qn(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=qn(t.host).host);Sn(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=On(this.opts.query)),Xn&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},Zn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=wn(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,gn(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),Xn&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=Zn.indexOf(this._offlineEventListener);e!==-1&&Zn.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};Qn.protocol=4;var $n=class extends Qn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Qn.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;Qn.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},er=class extends $n{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>Wn[e]).filter(e=>!!e)),super(e,n)}};er.protocol;function tr(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=qn(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var nr=typeof ArrayBuffer==`function`,rr=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,ir=Object.prototype.toString,ar=typeof Blob==`function`||typeof Blob<`u`&&ir.call(Blob)===`[object BlobConstructor]`,or=typeof File==`function`||typeof File<`u`&&ir.call(File)===`[object FileConstructor]`;function sr(e){return nr&&(e instanceof ArrayBuffer||rr(e))||ar&&e instanceof Blob||or&&e instanceof File}function cr(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(cr(e[t]))return!0;return!1}if(sr(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return cr(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&cr(e[t]))return!0;return!1}function lr(e){let t=[],n=e.data,r=e;return r.data=ur(n,t),r.attachments=t.length,{packet:r,buffers:t}}function ur(e,t){if(!e)return e;if(sr(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ur(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=ur(e[r],t));return n}return e}function dr(e,t){return e.data=fr(e.data,t),delete e.attachments,e}function fr(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=fr(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=fr(e[n],t));return e}var pr=s({Decoder:()=>gr,Encoder:()=>hr,PacketType:()=>R,isPacketValid:()=>Cr,protocol:()=>5}),mr=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],R;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(R||={});var hr=class{constructor(e){this.replacer=e}encode(e){return(e.type===R.EVENT||e.type===R.ACK)&&cr(e)?this.encodeAsBinary({type:e.type===R.EVENT?R.BINARY_EVENT:R.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===R.BINARY_EVENT||e.type===R.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=lr(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},gr=class e extends L{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===R.BINARY_EVENT;n||t.type===R.BINARY_ACK?(t.type=n?R.EVENT:R.ACK,this.reconstructor=new _r(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(sr(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(R[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===R.BINARY_EVENT||r.type===R.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!yr(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case R.CONNECT:return xr(t);case R.DISCONNECT:return t===void 0;case R.CONNECT_ERROR:return typeof t==`string`||xr(t);case R.EVENT:case R.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&mr.indexOf(t[0])===-1);case R.ACK:case R.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},_r=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=dr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function vr(e){return typeof e==`string`}var yr=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function br(e){return e===void 0||yr(e)}function xr(e){return Object.prototype.toString.call(e)===`[object Object]`}function Sr(e,t){switch(e){case R.CONNECT:return t===void 0||xr(t);case R.DISCONNECT:return t===void 0;case R.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&mr.indexOf(t[0])===-1);case R.ACK:return Array.isArray(t);case R.CONNECT_ERROR:return typeof t==`string`||xr(t);default:return!1}}function Cr(e){return vr(e.nsp)&&br(e.id)&&Sr(e.type,e.data)}function wr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Tr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Er=class extends L{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[wr(e,`open`,this.onopen.bind(this)),wr(e,`packet`,this.onpacket.bind(this)),wr(e,`error`,this.onerror.bind(this)),wr(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(Tr.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:R.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:R.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case R.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case R.EVENT:case R.BINARY_EVENT:this.onevent(e);break;case R.ACK:case R.BINARY_ACK:this.onack(e);break;case R.DISCONNECT:this.ondisconnect();break;case R.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:R.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:R.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function Dr(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Dr.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},Dr.prototype.reset=function(){this.attempts=0},Dr.prototype.setMin=function(e){this.ms=e},Dr.prototype.setMax=function(e){this.max=e},Dr.prototype.setJitter=function(e){this.jitter=e};var Or=class extends L{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,Sn(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new Dr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||pr;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new er(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=wr(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=wr(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(wr(e,`ping`,this.onping.bind(this)),wr(e,`data`,this.ondata.bind(this)),wr(e,`error`,this.onerror.bind(this)),wr(e,`close`,this.onclose.bind(this)),wr(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){gn(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Er(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},kr={};function Ar(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=tr(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=kr[i]&&a in kr[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new Or(r,t):(kr[i]||(kr[i]=new Or(r,t)),c=kr[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Ar,{Manager:Or,Socket:Er,io:Ar,connect:Ar});var jr=({discovery:e,prefilledPath:t=``,onClearPrefill:n})=>{let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(`http://localhost:3000`),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(`ws`),[d,f]=(0,v.useState)(`disconnected`),[p,m]=(0,v.useState)([]),[h,g]=(0,v.useState)(`message`),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)([]),[T,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)([]),ee=(0,v.useRef)(0),A=(0,v.useRef)(null),te=(0,v.useRef)(null);(0,v.useEffect)(()=>{te.current&&(te.current.scrollTop=te.current.scrollHeight)},[p]),(0,v.useEffect)(()=>{ne()},[]),(0,v.useEffect)(()=>{t&&r.length>0&&(c(t),re(t),n&&n())},[t,r]);let ne=async()=>{try{let e=await w(`/__studio/api/ws/routes`);if(e.ok){let t=await e.json();o(t.appBaseUrl||`http://localhost:3000`),i(t.routes||[])}}catch(e){console.error(`Failed to load WS routes:`,e)}},re=e=>{c(e);let t=r.find(t=>t.path===e);if(!t)return;let n=e;try{/^https?:\/\//i.test(e)&&(n=new URL(e).pathname)}catch{n=e}let i=n.toLowerCase(),a=i.startsWith(`/socket.io`)||i.includes(`/socket.io/`)||i===`/socket.io`,o=i===`/socket`||i.startsWith(`/socket/`)||i.includes(`/socket/`);u(a||o?`socketio`:`ws`),t.schema&&t.schema.message?y(JSON.stringify(t.schema.message,null,2)):y(`{
|
|
27
|
+
export * from './validators';`,`file:///sdk.ts`)},ae=(e,t)=>{k.current=e,ee.current=t,O(!1),ie(t)},oe=async()=>{let e=k.current?k.current.getValue():c;T(!0),p(`terminal`),M(`info`,`[SYSTEM] Transpiling and executing code...`);try{let t=await(await w(`/__studio/api/playground/execute`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:e,target:n})})).json(),r=null,i=`success`;t.error?(i=`error`,M(`error`,`[ERROR] `+t.error)):(t.logs&&t.logs.length>0&&t.logs.forEach(e=>{M(`info`,e);try{let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))r=JSON.parse(t);else if(e.includes(`Result: `)){let t=e.substring(e.indexOf(`Result: `)+8);r=JSON.parse(t)}}catch{}}),t.errors&&t.errors.length>0&&(i=`error`,t.errors.forEach(e=>{M(`error`,`[ERROR] `+e)})),(!t.logs||t.logs.length===0)&&(!t.errors||t.errors.length===0)&&M(`info`,`[SYSTEM] Execution finished successfully (no logs emitted).`)),re(e,i,t),t.error?_({error:t.error}):_(r||null)}catch(t){M(`error`,`[ERROR] Execution failed: `+String(t)),re(e,`error`,{error:String(t)}),_({error:String(t)})}finally{T(!1)}},se=()=>{k.current?k.current.setValue(i):l(i),M(`info`,`[SYSTEM] Starter code reset.`)},P=e=>{k.current?k.current.setValue(e.code):l(e.code),d(`editor`),M(`info`,`[SYSTEM] Loaded run code from history (${new Date(e.timestamp).toLocaleTimeString()}).`)},F=o.find(e=>e.path===y)?.content||``;return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`panel-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,flexWrap:`wrap`,gap:`12px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`panel-title`,children:`SDK Playground`}),(0,E.jsx)(`div`,{className:`panel-subtitle`,children:`Test your auto-generated Client SDK with language target selection and inline execution`})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,E.jsxs)(`select`,{id:`playground-target-select`,className:`select-input`,style:{margin:0,padding:`6px 12px`,fontSize:`12px`,fontWeight:600,borderRadius:`var(--radius-sm)`,width:`auto`},value:n,onChange:j,children:[(0,E.jsx)(`option`,{value:`typescript`,children:`TypeScript Target`}),(0,E.jsx)(`option`,{value:`python`,children:`Python Target`}),(0,E.jsx)(`option`,{value:`dart`,children:`Dart Target`})]}),(0,E.jsx)(`button`,{className:`btn`,onClick:oe,disabled:C,children:C?`Running...`:`▶ Run Code`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,onClick:se,children:`🔄 Reset starter`})]})]}),(0,E.jsxs)(`div`,{className:`playground-grid`,children:[(0,E.jsxs)(`div`,{className:`tester-section`,style:{display:`flex`,flexDirection:`column`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,borderBottom:`1px solid var(--border)`,marginBottom:`12px`,paddingBottom:`6px`},children:[(0,E.jsx)(`button`,{className:`btn btn-secondary ${u===`editor`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>d(`editor`),children:`💻 Client Editor`}),(0,E.jsx)(`button`,{className:`btn btn-secondary ${u===`preview`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>d(`preview`),children:`📂 SDK Files Preview`})]}),u===`editor`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,E.jsxs)(`div`,{style:{height:`550px`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,overflow:`hidden`,position:`relative`},children:[D&&(0,E.jsxs)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--bg-secondary)`,zIndex:10},children:[(0,E.jsx)(`div`,{className:`spinner`}),(0,E.jsx)(`span`,{style:{marginLeft:`8px`,fontSize:`13px`,color:`var(--text-secondary)`},children:`Initializing Monaco Editor...`})]}),(0,E.jsx)(Rt,{height:`550px`,language:n===`typescript`?`typescript`:n,theme:t?`vs-dark`:`light`,value:c,path:n===`typescript`?`file:///main.ts`:void 0,onChange:e=>l(e||``),onMount:ae,options:{automaticLayout:!0,minimap:{enabled:!1},fontSize:13,fontFamily:`JetBrains Mono, Menlo, monospace`}})]})}),u===`preview`&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},children:[(0,E.jsx)(`span`,{style:{fontSize:`12px`,fontWeight:600,color:`var(--text-secondary)`},children:`Generated Files:`}),(0,E.jsx)(`select`,{className:`select-input`,style:{margin:0,padding:`4px 8px`,fontSize:`12px`,flex:1,width:`auto`},value:y,onChange:e=>b(e.target.value),children:o.length===0?(0,E.jsx)(`option`,{value:``,children:`-- No files generated --`}):o.map(e=>(0,E.jsx)(`option`,{value:e.path,children:e.path},e.path))})]}),(0,E.jsx)(`div`,{style:{height:`500px`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,overflow:`hidden`},children:(0,E.jsx)(Rt,{height:`500px`,language:(e=>e.endsWith(`.py`)?`python`:e.endsWith(`.dart`)?`dart`:e.endsWith(`.yaml`)?`yaml`:e.endsWith(`.json`)?`json`:`typescript`)(y),theme:t?`vs-dark`:`light`,value:F,options:{automaticLayout:!0,readOnly:!0,minimap:{enabled:!1},fontSize:12,fontFamily:`JetBrains Mono, Menlo, monospace`}})})]})]}),(0,E.jsxs)(`div`,{className:`tester-section`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,borderBottom:`1px solid var(--border)`,marginBottom:`12px`,paddingBottom:`6px`,width:`100%`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,E.jsx)(`button`,{className:`btn btn-secondary ${f===`terminal`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>p(`terminal`),children:`🖥️ Output Terminal`}),(0,E.jsx)(`button`,{className:`btn btn-secondary ${f===`response`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>p(`response`),children:`📦 Response Preview`}),(0,E.jsx)(`button`,{className:`btn btn-secondary ${f===`history`?`active-tab-btn`:``}`,style:{margin:0,padding:`4px 10px`,fontSize:`12px`},onClick:()=>p(`history`),children:`📜 Request History`})]}),f===`terminal`&&(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`2px 8px`,fontSize:`11px`,margin:0},onClick:N,children:`Clear Terminal`})]}),f===`terminal`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,height:`100%`},children:(0,E.jsx)(`div`,{className:`console-terminal`,style:{minHeight:`510px`,maxHeight:`510px`,textAlign:`left`},children:m.map((e,t)=>(0,E.jsx)(`div`,{className:`console-line ${e.type}`,children:e.text},t))})}),f===`response`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,E.jsx)(`div`,{className:`console-terminal`,style:{minHeight:`510px`,maxHeight:`510px`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,fontSize:`12px`,padding:`16px`,overflowY:`auto`,lineHeight:1.5,textAlign:`left`},children:g?(0,E.jsx)(`pre`,{style:{margin:0,fontFamily:`var(--font-mono)`},children:JSON.stringify(g,null,2)}):(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`13px`,textAlign:`center`,paddingTop:`40px`},children:`No response payload captured yet. Run client code that prints an object or response.`})})}),f===`history`&&(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,overflow:`hidden`},children:(0,E.jsx)(`div`,{style:{minHeight:`510px`,maxHeight:`510px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,paddingRight:`4px`},children:x.length===0?(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`13px`,textAlign:`center`,paddingTop:`40px`},children:`No code execution history recorded. Run code to add history.`}):x.map(e=>(0,E.jsxs)(`div`,{className:`card`,style:{display:`flex`,flexDirection:`column`,gap:`6px`,padding:`10px 14px`,cursor:`pointer`,margin:0,textAlign:`left`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`},onClick:()=>P(e),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,E.jsx)(`span`,{className:`method-badge method-POST`,style:{fontSize:`9px`,padding:`1px 4px`},children:e.target.toUpperCase()}),(0,E.jsx)(`span`,{style:{color:e.status===`success`?`var(--success)`:`var(--error)`,fontWeight:`bold`,fontSize:`11px`},children:e.status.toUpperCase()})]}),(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontFamily:`var(--font-mono)`,color:`var(--text-secondary)`,textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,marginTop:`2px`},children:e.code}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,fontSize:`10px`,color:`var(--text-muted)`,marginTop:`4px`},children:[(0,E.jsx)(`span`,{children:new Date(e.timestamp).toLocaleString()}),(0,E.jsx)(`span`,{style:{color:`var(--accent)`,fontWeight:500},children:`Load code ➔`})]})]},e.id))})})]})]})]})},Bt=()=>{let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(`request`);(0,v.useEffect)(()=>{o();let e=setInterval(o,3e3);return()=>clearInterval(e)},[]),(0,v.useEffect)(()=>{e?.entries?.length>0&&!n&&r(e.entries[0].requestId)},[e,n]);let o=async()=>{try{let e=await w(`/__studio/api/session`);if(e.ok){let n=await e.json();t(n);let r=document.getElementById(`badge-recorder`);r&&n.summary&&(r.textContent=String(n.summary.requestCount||0))}}catch(e){console.error(`Failed to fetch session:`,e)}},s=async()=>{if(confirm(`Are you sure you want to clear session recording data?`))try{if((await w(`/__studio/api/session`,{method:`DELETE`})).ok){t(null),r(``);let e=document.getElementById(`badge-recorder`);e&&(e.textContent=`0`)}}catch(e){console.error(`Failed to clear session:`,e)}},c=()=>{let e=x();window.location.href=`/__studio/api/session/har?token=${encodeURIComponent(e)}`},l=e?.entries||[],u=l.find(e=>e.requestId===n)||l[0],d=e=>e>=200&&e<300?{background:`rgba(0, 210, 160, 0.15)`,color:`var(--success)`}:e>=300&&e<400?{background:`rgba(255, 193, 7, 0.15)`,color:`var(--warning)`}:{background:`rgba(255, 107, 107, 0.15)`,color:`var(--error)`};return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`panel-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,flexWrap:`wrap`,gap:`12px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`panel-title`,children:`Session Recorder`}),(0,E.jsx)(`div`,{className:`panel-subtitle`,children:`Capture, examine, and export HTTP/WS api request transaction sessions`})]}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,E.jsx)(`button`,{className:`btn btn-secondary`,onClick:s,disabled:!e,children:`Clear Recorder`}),(0,E.jsx)(`button`,{className:`btn`,onClick:c,children:`⬇ Export HAR`})]})]}),l.length===0?(0,E.jsxs)(`div`,{className:`empty-state`,children:[(0,E.jsx)(`div`,{className:`empty-state-icon`,children:`📡`}),(0,E.jsx)(`div`,{className:`empty-state-message`,children:`No requests recorded yet. Fire some requests via the Request Tester or host API.`})]}):(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`360px 1fr`,gap:`24px`,minHeight:`650px`,height:`auto`,textAlign:`left`},children:[(0,E.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`16px`,display:`flex`,flexDirection:`column`,gap:`12px`},children:[(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-muted)`},children:`Recorded Transactions`}),(0,E.jsx)(`div`,{style:{flex:1,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,maxHeight:`600px`},children:l.map(e=>{let t=u&&e.requestId===u.requestId,n=e.response?.status||0,i=e.response?.durationMs;return(0,E.jsxs)(`div`,{style:{background:t?`var(--bg-tertiary)`:`var(--bg-primary)`,border:t?`1px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,cursor:`pointer`,transition:`all 0.2s`},onClick:()=>r(e.requestId),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`6px`},children:[(0,E.jsx)(`span`,{className:`method-badge method-${e.request.method}`,style:{fontSize:`9px`,padding:`1px 5px`},children:e.request.method}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,alignItems:`center`},children:[n>0&&(0,E.jsx)(`span`,{style:{fontSize:`9px`,fontWeight:700,padding:`1px 5px`,borderRadius:`3px`,...d(n)},children:n}),i!==void 0&&(0,E.jsxs)(`span`,{style:{fontSize:`10px`,color:`var(--text-muted)`},children:[i.toFixed(1),`ms`]})]})]}),(0,E.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`11px`,fontWeight:600,color:`var(--text-primary)`,wordBreak:`break-all`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.request.path}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`9px`,color:`var(--text-muted)`,marginTop:`6px`},children:[(0,E.jsxs)(`span`,{children:[`ID: `,e.requestId.slice(0,8),`...`]}),(0,E.jsx)(`span`,{children:new Date(e.request.timestamp).toLocaleTimeString()})]})]},e.requestId)})})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`20px`},children:u?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`24px`,textAlign:`center`},children:[(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,textTransform:`uppercase`,color:`var(--text-muted)`,marginBottom:`20px`,textAlign:`left`},children:`Transaction Lifecycle Flowchart`}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,gap:`16px`,flexWrap:`wrap`},children:[(0,E.jsxs)(`div`,{style:{background:i===`request`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`request`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`request`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`request`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`💻`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Client Request`}),(0,E.jsx)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`,fontFamily:`var(--font-mono)`},children:u.request.method})]}),(0,E.jsx)(`div`,{style:{fontSize:`18px`,color:`var(--text-muted)`,fontWeight:800},children:`➔`}),(0,E.jsxs)(`div`,{style:{background:i===`middlewares`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`middlewares`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`middlewares`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`middlewares`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`🛡️`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Middlewares`}),(0,E.jsx)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`},children:u.request.headers?.[`content-type`]?`Parser + Custom`:`Standard`})]}),(0,E.jsx)(`div`,{style:{fontSize:`18px`,color:`var(--text-muted)`,fontWeight:800},children:`➔`}),(0,E.jsxs)(`div`,{style:{background:i===`queries`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`queries`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`queries`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`queries`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`🛢️`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Database Queries`}),(0,E.jsxs)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`},children:[u.queries?.length||0,` executed`]})]}),(0,E.jsx)(`div`,{style:{fontSize:`18px`,color:`var(--text-muted)`,fontWeight:800},children:`➔`}),(0,E.jsxs)(`div`,{style:{background:i===`response`?`rgba(0, 120, 255, 0.08)`:`var(--bg-primary)`,border:i===`response`?`2px solid var(--accent)`:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`,minWidth:`130px`,cursor:`pointer`,transition:`all 0.2s`,boxShadow:i===`response`?`0 0 10px rgba(0, 120, 255, 0.15)`:`none`},onClick:()=>a(`response`),children:[(0,E.jsx)(`div`,{style:{fontSize:`24px`,marginBottom:`4px`},children:`📥`}),(0,E.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:700,color:`var(--text-primary)`},children:`Server Response`}),(0,E.jsx)(`div`,{style:{fontSize:`10px`,color:`var(--text-muted)`,fontWeight:`bold`},children:u.response?u.response.status:`NO RESPONSE`})]})]})]}),(0,E.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`24px`,flex:1,minHeight:`350px`,display:`flex`,flexDirection:`column`,gap:`16px`},children:[i===`request`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Request Details`}),(0,E.jsxs)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,fontFamily:`var(--font-mono)`,color:`var(--text-primary)`},children:[u.request.method,` `,u.request.path]})]})}),(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`16px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Headers`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:JSON.stringify(u.request.headers,null,2)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Body / Query Params`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:u.request.body?JSON.stringify(u.request.body,null,2):u.request.query&&Object.keys(u.request.query).length>0?JSON.stringify(u.request.query,null,2):`No payload / query parameters`})]})]})]}),i===`middlewares`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Middlewares Execution`}),(0,E.jsx)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,color:`var(--text-primary)`},children:`Request Processing Pipeline`})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:u.timeline&&u.timeline.length>0?u.timeline.map((e,t)=>(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`10px 14px`},children:[(0,E.jsx)(`span`,{style:{fontSize:`12px`,fontWeight:600,color:`var(--text-primary)`},children:e.name}),(0,E.jsxs)(`span`,{style:{fontSize:`11px`,color:`var(--success)`,fontFamily:`var(--font-mono)`},children:[e.duration.toFixed(2),` ms`]})]},t)):(0,E.jsx)(`div`,{style:{fontStyle:`italic`,color:`var(--text-muted)`,fontSize:`12px`},children:`No pipeline execution markers recorded. Custom middleware stats may not be configured.`})})]}),i===`queries`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Database Queries`}),(0,E.jsxs)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,color:`var(--text-primary)`},children:[`SQL & ORM Operations (`,u.queries?.length||0,`)`]})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`,overflowY:`auto`,maxHeight:`300px`},children:!u.queries||u.queries.length===0?(0,E.jsx)(`div`,{style:{fontStyle:`italic`,color:`var(--text-muted)`,fontSize:`12px`,textAlign:`center`,padding:`20px`},children:`No database queries executed during this transaction.`}):u.queries.map((e,t)=>(0,E.jsxs)(`div`,{style:{background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`12px`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`10px`,color:`var(--text-muted)`,marginBottom:`6px`},children:[(0,E.jsx)(`span`,{style:{fontWeight:700,color:e.failed?`var(--error)`:`var(--success)`},children:e.failed?`❌ FAILED`:`✅ SUCCESS`}),(0,E.jsxs)(`span`,{children:[e.durationMs.toFixed(1),` ms`]})]}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:`var(--text-primary)`},children:e.query})]},t))})]}),i===`response`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`tag-pill`,style:{textTransform:`uppercase`},children:`Server Response`}),(0,E.jsx)(`h4`,{style:{margin:`6px 0 0 0`,fontSize:`14px`,color:`var(--text-primary)`},children:`Execution Summary`})]}),u.response&&(0,E.jsx)(`span`,{style:{fontSize:`12px`,fontWeight:700,padding:`4px 10px`,borderRadius:`4px`,...d(u.response.status)},children:u.response.status})]}),u.response?(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`16px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Headers`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:JSON.stringify(u.response.headers,null,2)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-muted)`,textTransform:`uppercase`,marginBottom:`6px`},children:`Body`}),(0,E.jsx)(`pre`,{style:{margin:0,fontSize:`11px`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:`200px`,overflowY:`auto`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,padding:`10px`,borderRadius:`var(--radius-sm)`},children:u.response.body?typeof u.response.body==`object`?JSON.stringify(u.response.body,null,2):String(u.response.body):`Empty Response Body`})]})]}):(0,E.jsx)(`div`,{style:{fontStyle:`italic`,color:`var(--text-muted)`,fontSize:`12px`,textAlign:`center`,padding:`20px`},children:`Response has not been captured yet or transaction is incomplete.`})]})]})]}):(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,textAlign:`center`,padding:`40px`},children:`Select a transaction from the list.`})})]})]})},Vt=({discovery:e,prefilledMethod:t=``,prefilledPath:n=``,onClearPrefill:r})=>{let[i,a]=(0,v.useState)(`GET`),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)([{key:`Content-Type`,value:`application/json`}]),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(null),[x,S]=(0,v.useState)([]),[C,T]=(0,v.useState)(null);(0,v.useEffect)(()=>{D();let e=()=>{D()};return window.addEventListener(`axiomify-replays-updated`,e),()=>{window.removeEventListener(`axiomify-replays-updated`,e)}},[]),(0,v.useEffect)(()=>{t&&n&&(a(t),s(n),A(t,n),r&&r())},[t,n]);let D=async()=>{try{let e=await w(`/__studio/api/request/replays`);if(e.ok){let t=await e.json();S([...t.history||t.replays||[]].reverse())}}catch(e){console.error(`Failed to fetch request replays:`,e)}},O=async()=>{if(confirm(`Are you sure you want to clear request history?`))try{(await w(`/__studio/api/request/replays`,{method:`DELETE`})).ok&&S([])}catch(e){console.error(`Failed to clear replays:`,e)}},k=(e,t)=>{if(!t)return null;let n=e.toLowerCase();if(t.type===`object`&&t.properties){let e={};for(let[n,r]of Object.entries(t.properties))e[n]=k(n,r);return e}return t.type===`array`?[k(e,t.items)]:t.type===`string`?n.includes(`email`)?`john.doe.${Math.floor(Math.random()*1e3)}@example.com`:n.includes(`name`)?n.includes(`first`)?`John`:n.includes(`last`)?`Doe`:`John Doe`:n.includes(`uuid`)||n.includes(`id`)?`9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d`:n.includes(`phone`)||n.includes(`tel`)?`+1-555-0199`:n.includes(`address`)||n.includes(`street`)?`123 Main Street, Springfield`:n.includes(`date`)||n.includes(`time`)||n.includes(`at`)?new Date().toISOString():n.includes(`avatar`)||n.includes(`url`)||n.includes(`image`)?`https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=150&h=150`:t.enum&&t.enum.length>0?t.enum[0]:t.description||`Sample String`:t.type===`number`||t.type===`integer`?n.includes(`age`)?30:n.includes(`price`)?19.99:n.includes(`quantity`)||n.includes(`count`)?5:n.includes(`year`)?2026:42:t.type===`boolean`?!0:null},ee=e=>{let t=[],n=/:([a-zA-Z0-9_]+)/g,r;for(;(r=n.exec(e))!==null;)t.push(r[1]);let i=/{([a-zA-Z0-9_]+)}/g;for(;(r=i.exec(e))!==null;)t.push(r[1]);return Array.from(new Set(t))},A=(t,n)=>{let r=e.schemas.find(e=>e.method===t&&e.path===n);if(r&&r.body){let e=k(`body`,r.body);h(JSON.stringify(e,null,2))}else h(``);if(r&&r.query&&r.query.properties){let e=r.query.properties;l(Object.keys(e).map(t=>{let n=k(t,e[t]);return{key:t,value:n===null?``:String(n)}}))}else l([]);d(ee(n).map(e=>{let t=r?.params?.properties?.[e],n=k(e,t||{type:`string`});return{key:e,value:n===null?``:String(n)}}))},te=e=>{let t=e.target.value;if(!t)return;let n=t.split(` `),r=n[0],i=n[1];a(r),s(i),A(r,i)},ne=async e=>{a(e.method),s(e.path),d([]);let t=[];e.query&&Object.entries(e.query).forEach(([e,n])=>{t.push({key:e,value:String(n)})}),l(t);let n=[];e.headers&&Object.entries(e.headers).forEach(([e,t])=>{n.push({key:e,value:String(t)})}),p(n),e.body?h(typeof e.body==`string`?e.body:JSON.stringify(e.body,null,2)):h(``);try{let t=await w(`/__studio/api/request/replay?id=${encodeURIComponent(e.id)}`);if(t.ok){let e=await t.json();e.response&&(b(e.response),T(null))}}catch(e){console.error(`Failed to load full replay details:`,e)}},re=async()=>{if(!o.trim()){alert(`Please enter a request path`);return}_(!0),T(null);let e={};c.forEach(t=>{t.key.trim()&&(e[t.key.trim()]=t.value.trim())});let t={};f.forEach(e=>{e.key.trim()&&(t[e.key.trim()]=e.value.trim())});let n;if(m.trim())try{n=JSON.parse(m.trim())}catch(e){alert(`Invalid JSON request body: `+e.message),_(!1);return}let r=o.trim();u.forEach(e=>{e.key.trim()&&(r=r.replace(`:${e.key.trim()}`,e.value.trim()).replace(`{${e.key.trim()}}`,e.value.trim()))});try{let a=await(await w(`/__studio/api/request`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({method:i,path:r,headers:t,query:e,body:n})})).json();if(_(!1),D(),a.error){b({status:`ERROR`,body:a.error+(a.message?`: `+a.message:``),headers:{}});return}b(a)}catch(e){_(!1),b({status:`ERROR`,body:`Network error sending request: `+e.message,headers:{}})}},j=e=>({200:`OK`,201:`Created`,202:`Accepted`,204:`No Content`,301:`Moved Permanently`,302:`Found`,304:`Not Modified`,400:`Bad Request`,401:`Unauthorized`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,500:`Internal Server Error`,502:`Bad Gateway`,503:`Service Unavailable`})[e]||``,M=e=>{if(e===`ERROR`)return{background:`rgba(255, 107, 107, 0.15)`,color:`var(--error)`};let t=Number(e);return t>=200&&t<300?{background:`rgba(0, 210, 160, 0.15)`,color:`var(--success)`}:t>=300&&t<400?{background:`rgba(255, 193, 7, 0.15)`,color:`var(--warning)`}:{background:`rgba(255, 107, 107, 0.15)`,color:`var(--error)`}},N=()=>l(e=>[...e,{key:``,value:``}]),ie=e=>l(t=>t.filter((t,n)=>n!==e)),ae=(e,t,n)=>{l(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},oe=()=>p(e=>[...e,{key:``,value:``}]),se=e=>p(t=>t.filter((t,n)=>n!==e)),P=(e,t,n)=>{p(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},F=()=>{if(!y)return;let e=typeof y.body==`object`?JSON.stringify(y.body,null,2):String(y.body);navigator.clipboard.writeText(e).then(()=>{alert(`Copied response body!`)})},I=(e,t)=>{let n=t&&Object.keys(t).length>0,[r,i]=(0,v.useState)(e===`body`||e===`state`);return(0,E.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`,padding:`6px 8px`,background:`var(--bg-secondary)`,marginBottom:`4px`},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontWeight:n?600:400,color:n?`var(--text-primary)`:`var(--text-muted)`,cursor:`pointer`,userSelect:`none`},onClick:()=>n&&i(!r),children:[(0,E.jsx)(`span`,{children:e}),(0,E.jsx)(`span`,{children:n?r?`▼`:`▶`:`—`})]}),n&&r&&(0,E.jsx)(`pre`,{style:{marginTop:`6px`,fontSize:`11px`,color:`var(--text-primary)`,whiteSpace:`pre-wrap`,wordBreak:`break-all`,fontFamily:`var(--font-mono)`,textAlign:`left`},children:JSON.stringify(t,null,2)})]})};return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`panel-header`,children:[(0,E.jsx)(`div`,{className:`panel-title`,children:`Request Tester`}),(0,E.jsx)(`div`,{className:`panel-subtitle`,children:`Interact with and test routes directly against your in-memory Axiomify app instance`})]}),(0,E.jsx)(`div`,{className:`search-bar`,children:(0,E.jsxs)(`select`,{className:`select-input`,style:{maxWidth:`400px`},onChange:te,value:`${i} ${o}`,children:[(0,E.jsx)(`option`,{value:``,children:`-- Choose a discovered route to pre-fill --`}),(e.routes||[]).filter(e=>!e.isWs).map(e=>(0,E.jsxs)(`option`,{value:`${e.method} ${e.path}`,children:[e.method,` `,e.path]},`${e.method} ${e.path}`))]})}),(0,E.jsxs)(`div`,{className:`tester-container`,children:[(0,E.jsxs)(`div`,{className:`tester-section`,style:{maxHeight:`700px`,overflowY:`auto`},children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`,marginBottom:`8px`},children:[(0,E.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,E.jsx)(`span`,{children:`⏱️`}),` Replay History`]}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`2px 8px`,fontSize:`10px`,borderRadius:`var(--radius-sm)`,margin:0},onClick:O,children:`Clear`})]}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:x.length===0?(0,E.jsx)(`div`,{style:{color:`var(--text-muted)`,fontSize:`12px`,textAlign:`center`,padding:`16px 0`},children:`No execution runs.`}):x.map(e=>{let t=e.status&&e.status>=200&&e.status<300;return(0,E.jsxs)(`button`,{className:`nav-item`,style:{textAlign:`left`,flexGrow:1,padding:`8px 10px`,fontSize:`12px`,display:`flex`,flexDirection:`column`,gap:`4px`,border:`1px solid var(--border)`,background:`var(--bg-secondary)`,borderRadius:`var(--radius-sm)`,margin:0,width:`100%`},onClick:()=>ne(e),children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`},children:[(0,E.jsx)(`span`,{className:`method-badge method-${e.method}`,style:{fontSize:`9px`,padding:`1px 4px`},children:e.method}),(0,E.jsx)(`span`,{style:{color:t?`var(--success)`:`var(--error)`,fontWeight:`bold`,fontSize:`11px`},children:e.status||`ERROR`})]}),(0,E.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`11px`,color:`var(--text-primary)`,wordBreak:`break-all`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,width:`100%`},children:e.path}),(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`10px`,color:`var(--text-muted)`,width:`100%`},children:[(0,E.jsx)(`span`,{children:e.duration?`${e.duration.toFixed(0)}ms`:``}),(0,E.jsx)(`span`,{children:new Date(e.timestamp).toLocaleTimeString()})]})]},e.id)})})]}),(0,E.jsxs)(`div`,{className:`tester-section`,children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,children:[(0,E.jsx)(`span`,{children:`📝`}),` Request Builder`]}),(0,E.jsxs)(`div`,{className:`form-row`,children:[(0,E.jsxs)(`div`,{className:`form-group`,style:{width:`120px`,flex:`none`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Method`}),(0,E.jsx)(`select`,{className:`select-input`,value:i,onChange:e=>a(e.target.value),children:[`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`].map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{className:`form-group`,style:{flex:1},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Path`}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`/api/v1/resource`,value:o,onChange:e=>s(e.target.value)})]})]}),u.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Path Parameters`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:u.map((e,t)=>(0,E.jsxs)(`div`,{className:`kv-row`,children:[(0,E.jsx)(`input`,{className:`text-input`,type:`text`,readOnly:!0,value:e.key,style:{opacity:.7,background:`var(--bg-secondary)`,flex:1}}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Value`,value:e.value,style:{flex:2},onChange:e=>{let n=e.target.value;d(e=>e.map((e,r)=>r===t?{...e,value:n}:e))}})]},t))})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`4px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Query Parameters`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`4px 8px`,fontSize:`11px`},onClick:N,children:`+ Add Param`})]}),(0,E.jsx)(`div`,{children:c.map((e,t)=>(0,E.jsxs)(`div`,{className:`kv-row`,children:[(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Key`,value:e.key,onChange:e=>ae(t,`key`,e.target.value)}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Value`,value:e.value,onChange:e=>ae(t,`value`,e.target.value)}),(0,E.jsx)(`button`,{className:`btn btn-danger`,style:{margin:0},onClick:()=>ie(t),children:`Remove`})]},t))})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`4px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Headers`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`4px 8px`,fontSize:`11px`},onClick:oe,children:`+ Add Header`})]}),(0,E.jsx)(`div`,{children:f.map((e,t)=>(0,E.jsxs)(`div`,{className:`kv-row`,children:[(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Key`,value:e.key,onChange:e=>P(t,`key`,e.target.value)}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Value`,value:e.value,onChange:e=>P(t,`value`,e.target.value)}),(0,E.jsx)(`button`,{className:`btn btn-danger`,style:{margin:0},onClick:()=>se(t),children:`Remove`})]},t))})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Request Body (JSON)`}),(0,E.jsx)(`textarea`,{className:`textarea-input`,placeholder:`{"key": "value"}`,value:m,onChange:e=>h(e.target.value)})]}),(0,E.jsx)(`div`,{style:{marginTop:`10px`},children:(0,E.jsx)(`button`,{className:`btn`,style:{width:`100%`,margin:0},onClick:re,disabled:g,children:g?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:`spinner`,style:{width:`14px`,height:`14px`,borderWidth:`2px`,marginRight:`8px`}}),`Sending...`]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{children:`⚡`}),` Send Request`]})})})]}),(0,E.jsxs)(`div`,{className:`tester-section`,style:{display:`flex`,flexDirection:`column`},children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,children:[(0,E.jsx)(`span`,{children:`📥`}),` Response`]}),y?(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`,flex:1},children:[(0,E.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{className:`form-label`,style:{marginRight:`8px`},children:`Status`}),(0,E.jsxs)(`span`,{className:`response-status-badge`,style:M(y.status),children:[y.status,` `,y.status!==`ERROR`&&j(y.status)]})]}),y.status!==`ERROR`&&(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{padding:`6px 12px`,fontSize:`12px`,margin:0},onClick:F,children:`Copy Body`})]}),y.headers&&Object.keys(y.headers).length>0&&(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Headers`}),(0,E.jsx)(`div`,{className:`response-headers-container`,children:(0,E.jsx)(`table`,{className:`response-headers-table`,children:(0,E.jsx)(`tbody`,{children:Object.entries(y.headers).map(([e,t])=>(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`td`,{className:`response-headers-key`,children:e}),(0,E.jsx)(`td`,{className:`response-headers-value`,children:String(t)})]},e))})})})]}),(0,E.jsxs)(`div`,{className:`form-group`,style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Body`}),(0,E.jsx)(`pre`,{className:`response-body-pre`,style:{textAlign:`left`},children:y.status===`ERROR`?y.body:y.body!==null&&y.body!==void 0?typeof y.body==`object`?JSON.stringify(y.body,null,2):String(y.body):`[Empty Response Body]`})]}),y.profile?.validationErrors&&y.profile.validationErrors.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,style:{marginTop:`16px`},children:[(0,E.jsx)(`label`,{className:`form-label`,style:{color:`var(--error)`,fontWeight:600},children:`Validation Errors`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,background:`rgba(239, 68, 68, 0.05)`,border:`1px solid rgba(239, 68, 68, 0.2)`,borderRadius:`var(--radius-md)`,padding:`16px`,textAlign:`left`},children:y.profile.validationErrors.map((e,t)=>(0,E.jsxs)(`div`,{style:{background:`rgba(239, 68, 68, 0.05)`,border:`1px solid rgba(239, 68, 68, 0.15)`,borderRadius:`var(--radius-sm)`,padding:`10px`,fontSize:`12px`,display:`flex`,flexDirection:`column`,gap:`4px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`strong`,{style:{color:`var(--error)`},children:`Field:`}),` `,(0,E.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`,fontWeight:600,color:`var(--error)`},children:e.field}),` (`,(0,E.jsx)(`span`,{style:{textTransform:`uppercase`,fontSize:`10px`,fontWeight:600,color:`var(--text-secondary)`},children:e.location}),`)`]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`strong`,{children:`Reason:`}),` `,e.reason]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`strong`,{children:`Received:`}),` `,(0,E.jsx)(`code`,{style:{fontFamily:`var(--font-mono)`,background:`var(--bg-tertiary)`,padding:`2px 4px`,borderRadius:`3px`,fontSize:`11px`},children:JSON.stringify(e.received)})]})]},t))})]}),y.profile?.timeline&&y.profile.timeline.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,style:{marginTop:`16px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Execution Timeline`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`16px`},children:(()=>{let e=Math.max(...y.profile.timeline.map(e=>e.duration),1);return y.profile.timeline.map((t,n)=>{let r=Math.max(t.duration/e*100,2),i=`timeline-type-middleware`;t.type===`hook`?i=`timeline-type-hook`:t.type===`handler`&&(i=`timeline-type-handler`);let a=t.before&&t.after,o=C===n;return(0,E.jsxs)(`div`,{className:`timeline-row ${a?`clickable`:``}`,style:{textAlign:`left`},onClick:()=>a&&T(o?null:n),children:[(0,E.jsxs)(`div`,{className:`timeline-label-row`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`span`,{style:{color:`var(--text-primary)`,fontSize:`12px`},children:t.name}),(0,E.jsx)(`span`,{className:`timeline-type-badge ${i}`,children:t.type})]}),(0,E.jsxs)(`span`,{className:`timeline-duration`,children:[t.duration.toFixed(2),` ms`]})]}),(0,E.jsx)(`div`,{className:`timeline-bar-container`,children:(0,E.jsx)(`div`,{className:`timeline-bar`,style:{width:`${r}%`}})}),a&&o&&(0,E.jsx)(`div`,{style:{padding:`12px`,margin:`4px 0 12px 0`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm)`},children:(0,E.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`16px`},children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--text-secondary)`,marginBottom:`6px`,textTransform:`uppercase`},children:`📥 State Before`}),I(`body`,t.before?.body),I(`state`,t.before?.state),I(`headers`,t.before?.headers),I(`query`,t.before?.query),I(`params`,t.before?.params)]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:700,color:`var(--accent)`,marginBottom:`6px`,textTransform:`uppercase`},children:`📤 State After`}),I(`body`,t.after?.body),I(`state`,t.after?.state),I(`headers`,t.after?.headers),I(`query`,t.after?.query),I(`params`,t.after?.params)]})]})})]},n)})})()})]}),y.profile?.queries&&y.profile.queries.length>0&&(0,E.jsxs)(`div`,{className:`form-group`,style:{marginTop:`16px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Database Queries`}),(0,E.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md)`,padding:`16px`,textAlign:`left`},children:y.profile.queries.map((e,t)=>(0,E.jsxs)(`div`,{className:`db-query-row`,children:[(0,E.jsxs)(`div`,{className:`db-query-header`,children:[(0,E.jsx)(`span`,{className:`db-query-badge`,children:`DATABASE QUERY`}),(0,E.jsxs)(`span`,{className:`db-query-duration`,children:[e.duration.toFixed(2),` ms`]})]}),(0,E.jsx)(`pre`,{className:`db-query-sql`,children:e.query})]},t))})]})]}):(0,E.jsxs)(`div`,{className:`response-placeholder`,children:[(0,E.jsx)(`span`,{children:`📥`}),(0,E.jsx)(`span`,{children:`Send a request to see the response here`})]})]})]})]})},Ht=Object.create(null);Ht.open=`0`,Ht.close=`1`,Ht.ping=`2`,Ht.pong=`3`,Ht.message=`4`,Ht.upgrade=`5`,Ht.noop=`6`;var Ut=Object.create(null);Object.keys(Ht).forEach(e=>{Ut[Ht[e]]=e});var Wt={type:`error`,data:`parser error`},Gt=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,Kt=typeof ArrayBuffer==`function`,qt=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Jt=({type:e,data:t},n,r)=>Gt&&t instanceof Blob?n?r(t):Yt(t,r):Kt&&(t instanceof ArrayBuffer||qt(t))?n?r(t):Yt(new Blob([t]),r):r(Ht[e]+(t||``)),Yt=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function Xt(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Zt;function Qt(e,t){if(Gt&&e.data instanceof Blob)return e.data.arrayBuffer().then(Xt).then(t);if(Kt&&(e.data instanceof ArrayBuffer||qt(e.data)))return t(Xt(e.data));Jt(e,!1,e=>{Zt||=new TextEncoder,t(Zt.encode(e))})}var $t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,en=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)en[$t.charCodeAt(e)]=e;var tn=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=en[e.charCodeAt(r)],o=en[e.charCodeAt(r+1)],s=en[e.charCodeAt(r+2)],c=en[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},nn=typeof ArrayBuffer==`function`,rn=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:on(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:an(e.substring(1),t)}:Ut[n]?e.length>1?{type:Ut[n],data:e.substring(1)}:{type:Ut[n]}:Wt},an=(e,t)=>nn?on(tn(e),t):{base64:!0,data:e},on=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},sn=``,cn=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{Jt(e,!1,e=>{r[a]=e,++i===n&&t(r.join(sn))})})},ln=(e,t)=>{let n=e.split(sn),r=[];for(let e=0;e<n.length;e++){let i=rn(n[e],t);if(r.push(i),i.type===`error`)break}return r};function un(){return new TransformStream({transform(e,t){Qt(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var dn;function fn(e){return e.reduce((e,t)=>e+t.length,0)}function pn(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function mn(e,t){dn||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(fn(n)<1)break;let e=pn(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(fn(n)<2)break;let e=pn(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(fn(n)<8)break;let e=pn(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(Wt);break}i=a*2**32+t.getUint32(4),r=3}else{if(fn(n)<i)break;let e=pn(n,i);s.enqueue(rn(a?e:dn.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(Wt);break}}}})}function L(e){if(e)return hn(e)}function hn(e){for(var t in L.prototype)e[t]=L.prototype[t];return e}L.prototype.on=L.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},L.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},L.prototype.off=L.prototype.removeListener=L.prototype.removeAllListeners=L.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},L.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},L.prototype.emitReserved=L.prototype.emit,L.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},L.prototype.hasListeners=function(e){return!!this.listeners(e).length};var gn=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),_n=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),vn=`arraybuffer`;function yn(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var bn=_n.setTimeout,xn=_n.clearTimeout;function Sn(e,t){t.useNativeTimers?(e.setTimeoutFn=bn.bind(_n),e.clearTimeoutFn=xn.bind(_n)):(e.setTimeoutFn=_n.setTimeout.bind(_n),e.clearTimeoutFn=_n.clearTimeout.bind(_n))}var Cn=1.33;function wn(e){return typeof e==`string`?Tn(e):Math.ceil((e.byteLength||e.size)*Cn)}function Tn(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function En(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Dn(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function On(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var kn=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},An=class extends L{constructor(e){super(),this.writable=!1,Sn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new kn(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=rn(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Dn(e);return t.length?`?`+t:``}},jn=class extends An{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){ln(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,cn(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=En()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},Mn=!1;try{Mn=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Nn=Mn;function Pn(){}var Fn=class extends jn{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},In=class e extends L{constructor(e,t,n){super(),this.createRequest=e,Sn(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=yn(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=Pn,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(In.requestsCount=0,In.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,Ln);else if(typeof addEventListener==`function`){let e=`onpagehide`in _n?`pagehide`:`unload`;addEventListener(e,Ln,!1)}}function Ln(){for(let e in In.requests)In.requests.hasOwnProperty(e)&&In.requests[e].abort()}var Rn=(function(){let e=Bn({xdomain:!1});return e&&e.responseType!==null})(),zn=class extends Fn{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Rn&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new In(Bn,this.uri(),e)}};function Bn(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Nn))return new XMLHttpRequest}catch{}if(!t)try{return new _n[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var Vn=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,Hn=class extends An{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=Vn?{}:yn(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;Jt(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&gn(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=En()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Un=_n.WebSocket||_n.MozWebSocket,Wn={websocket:class extends Hn{createSocket(e,t,n){return Vn?new Un(e,t,n):t?new Un(e,t):new Un(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends An{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=mn(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=un();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&gn(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:zn},Gn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Kn=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function qn(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=Gn.exec(e||``),a={},o=14;for(;o--;)a[Kn[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=Jn(a,a.path),a.queryKey=Yn(a,a.query),a}function Jn(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function Yn(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var Xn=typeof addEventListener==`function`&&typeof removeEventListener==`function`,Zn=[];Xn&&addEventListener(`offline`,()=>{Zn.forEach(e=>e())},!1);var Qn=class e extends L{constructor(e,t){if(super(),this.binaryType=vn,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=qn(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=qn(t.host).host);Sn(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=On(this.opts.query)),Xn&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},Zn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=wn(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,gn(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),Xn&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=Zn.indexOf(this._offlineEventListener);e!==-1&&Zn.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};Qn.protocol=4;var $n=class extends Qn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Qn.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;Qn.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},er=class extends $n{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>Wn[e]).filter(e=>!!e)),super(e,n)}};er.protocol;function tr(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=qn(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var nr=typeof ArrayBuffer==`function`,rr=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,ir=Object.prototype.toString,ar=typeof Blob==`function`||typeof Blob<`u`&&ir.call(Blob)===`[object BlobConstructor]`,or=typeof File==`function`||typeof File<`u`&&ir.call(File)===`[object FileConstructor]`;function sr(e){return nr&&(e instanceof ArrayBuffer||rr(e))||ar&&e instanceof Blob||or&&e instanceof File}function cr(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(cr(e[t]))return!0;return!1}if(sr(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return cr(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&cr(e[t]))return!0;return!1}function lr(e){let t=[],n=e.data,r=e;return r.data=ur(n,t),r.attachments=t.length,{packet:r,buffers:t}}function ur(e,t){if(!e)return e;if(sr(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ur(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=ur(e[r],t));return n}return e}function dr(e,t){return e.data=fr(e.data,t),delete e.attachments,e}function fr(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=fr(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=fr(e[n],t));return e}var pr=s({Decoder:()=>gr,Encoder:()=>hr,PacketType:()=>R,isPacketValid:()=>Cr,protocol:()=>5}),mr=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],R;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(R||={});var hr=class{constructor(e){this.replacer=e}encode(e){return(e.type===R.EVENT||e.type===R.ACK)&&cr(e)?this.encodeAsBinary({type:e.type===R.EVENT?R.BINARY_EVENT:R.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===R.BINARY_EVENT||e.type===R.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=lr(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},gr=class e extends L{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===R.BINARY_EVENT;n||t.type===R.BINARY_ACK?(t.type=n?R.EVENT:R.ACK,this.reconstructor=new _r(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(sr(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(R[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===R.BINARY_EVENT||r.type===R.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!yr(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case R.CONNECT:return xr(t);case R.DISCONNECT:return t===void 0;case R.CONNECT_ERROR:return typeof t==`string`||xr(t);case R.EVENT:case R.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&mr.indexOf(t[0])===-1);case R.ACK:case R.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},_r=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=dr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function vr(e){return typeof e==`string`}var yr=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function br(e){return e===void 0||yr(e)}function xr(e){return Object.prototype.toString.call(e)===`[object Object]`}function Sr(e,t){switch(e){case R.CONNECT:return t===void 0||xr(t);case R.DISCONNECT:return t===void 0;case R.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&mr.indexOf(t[0])===-1);case R.ACK:return Array.isArray(t);case R.CONNECT_ERROR:return typeof t==`string`||xr(t);default:return!1}}function Cr(e){return vr(e.nsp)&&br(e.id)&&Sr(e.type,e.data)}function wr(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Tr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Er=class extends L{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[wr(e,`open`,this.onopen.bind(this)),wr(e,`packet`,this.onpacket.bind(this)),wr(e,`error`,this.onerror.bind(this)),wr(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(Tr.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:R.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:R.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case R.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case R.EVENT:case R.BINARY_EVENT:this.onevent(e);break;case R.ACK:case R.BINARY_ACK:this.onack(e);break;case R.DISCONNECT:this.ondisconnect();break;case R.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:R.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:R.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function Dr(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Dr.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},Dr.prototype.reset=function(){this.attempts=0},Dr.prototype.setMin=function(e){this.ms=e},Dr.prototype.setMax=function(e){this.max=e},Dr.prototype.setJitter=function(e){this.jitter=e};var Or=class extends L{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,Sn(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new Dr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||pr;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new er(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=wr(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=wr(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(wr(e,`ping`,this.onping.bind(this)),wr(e,`data`,this.ondata.bind(this)),wr(e,`error`,this.onerror.bind(this)),wr(e,`close`,this.onclose.bind(this)),wr(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){gn(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Er(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},kr={};function Ar(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=tr(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=kr[i]&&a in kr[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new Or(r,t):(kr[i]||(kr[i]=new Or(r,t)),c=kr[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Ar,{Manager:Or,Socket:Er,io:Ar,connect:Ar});var jr=({discovery:e,prefilledPath:t=``,onClearPrefill:n})=>{let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(`http://localhost:3000`),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(`ws`),[d,f]=(0,v.useState)(`disconnected`),[p,m]=(0,v.useState)([]),[h,g]=(0,v.useState)(`message`),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)([]),[T,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)([]),ee=(0,v.useRef)(0),A=(0,v.useRef)(null),te=(0,v.useRef)(null);(0,v.useEffect)(()=>{te.current&&(te.current.scrollTop=te.current.scrollHeight)},[p]),(0,v.useEffect)(()=>{ne()},[]),(0,v.useEffect)(()=>{t&&r.length>0&&(c(t),re(t),n&&n())},[t,r]);let ne=async()=>{try{let e=await w(`/__studio/api/ws/routes`);if(e.ok){let t=await e.json();o(t.appBaseUrl||`http://localhost:3000`),i(t.routes||[])}}catch(e){console.error(`Failed to load WS routes:`,e)}},re=e=>{c(e);let t=r.find(t=>t.path===e);if(!t)return;let n=e;try{/^https?:\/\//i.test(e)&&(n=new URL(e).pathname)}catch{n=e}let i=n.toLowerCase(),a=i.startsWith(`/socket.io`)||i.includes(`/socket.io/`)||i===`/socket.io`,o=i===`/socket`||i.startsWith(`/socket/`)||i.includes(`/socket/`);u(a||o?`socketio`:`ws`),t.schema&&t.schema.message?y(JSON.stringify(t.schema.message,null,2)):y(`{
|
|
28
28
|
"event": "message",
|
|
29
29
|
"data": {}
|
|
30
30
|
}`)},j=(e,t)=>{let n=new Date().toLocaleTimeString();if(T&&(e===`sent`||e===`received`)){let n=Date.now()-ee.current,r=null,i=null;if(t.startsWith(`Event: `)){let e=t.split(` | Payload: `);r=e[0].substring(7);try{i=JSON.parse(e[1])}catch{i=e[1]}}k(a=>[...a,{type:e,delay:n,content:t,event:r,payload:i}])}m(r=>[...r,{type:e,time:n,payload:t}])},M=()=>{A.current&&=(typeof A.current.close==`function`?A.current.close():typeof A.current.disconnect==`function`&&A.current.disconnect(),null),f(`disconnected`)},N=()=>{if(!s){alert(`Please select a WebSocket route first`);return}M(),f(`connecting`),j(`info`,`Connecting to ${s} using ${l===`socketio`?`Socket.IO`:`Raw WebSocket`}...`);try{if(l===`socketio`){let e=Ar(a,{path:s,transports:[`websocket`],forceNew:!0});A.current=e,e.on(`connect`,()=>{f(`connected`),j(`info`,`Socket.IO Connected (ID: ${e.id})`)}),e.on(`connect_error`,e=>{f(`error`),j(`error`,`Connection error: ${String(e)}`)}),e.on(`disconnect`,e=>{f(`disconnected`),j(`info`,`Socket.IO Disconnected. Reason: ${e}`)}),e.onAny((e,...t)=>{j(`received`,`Event: ${e} | Payload: ${JSON.stringify(t)}`),ue(e,JSON.stringify(t))})}else{let e=new URL(a),t=`${e.protocol===`https:`?`wss://`:`ws://`}${e.host}${s}`,n=new WebSocket(t);A.current=n,n.onopen=()=>{f(`connected`),j(`info`,`WebSocket Connection Established`)},n.onerror=()=>{f(`error`),j(`error`,`WebSocket error event received`)},n.onclose=e=>{f(`disconnected`),j(`info`,`WebSocket Closed (Code: ${e.code}, Reason: ${e.reason||`none`})`)},n.onmessage=e=>{j(`received`,String(e.data));let t=null;try{let n=JSON.parse(e.data);t=n.event||n.type||n.action||null}catch{}ue(t,String(e.data))}}}catch(e){f(`error`),j(`error`,`Failed to connect: ${String(e)}`)}},ie=()=>{if(!A.current)return;if(!(l===`socketio`?A.current.connected:A.current.readyState===WebSocket.OPEN)){alert(`WebSocket is not connected`);return}let e=_.trim();if(e.startsWith(`{`)||e.startsWith(`[`))try{e=JSON.parse(e)}catch(e){alert(`Invalid JSON payload: `+e.message);return}if(l===`socketio`)A.current.emit(h,e),j(`sent`,`Event: ${h} | Payload: ${JSON.stringify(e)}`);else{let t=typeof e==`object`?JSON.stringify(e):String(e);A.current.send(t),j(`sent`,t)}},ae=()=>{!b.trim()||!A.current||l!==`socketio`||(A.current.emit(`join`,b.trim()),j(`sent`,`Emitted "join" to room: ${b.trim()}`))},oe=()=>{!b.trim()||!A.current||l!==`socketio`||(A.current.emit(`leave`,b.trim()),j(`sent`,`Emitted "leave" to room: ${b.trim()}`))},se=()=>{T?(D(!1),j(`info`,`⏹ [RECORD] Recording stopped. ${O.length} messages saved.`)):(D(!0),k([]),ee.current=Date.now(),j(`info`,`🔴 [RECORD] Recording session started. Outbound and inbound messages will be captured.`))},P=async()=>{if(O.length===0)return;j(`info`,`🎬 [REPLAY] Starting auto-replay of recorded session...`),j(`info`,`🎬 [REPLAY] Reconnecting WebSocket...`),M(),N();let e=50,t=!1;for(;e>0;){if(A.current&&(l===`socketio`?A.current.connected:A.current.readyState===WebSocket.OPEN)){t=!0;break}await new Promise(e=>setTimeout(e,100)),e--}if(!t||!A.current){j(`error`,`❌ [REPLAY] Failed to connect for replay.`);return}j(`info`,`🎬 [REPLAY] WebSocket connected. Sending outbound events with delays...`);let n=O.filter(e=>e.type===`sent`);for(let e of n)await new Promise(t=>setTimeout(t,e.delay)),j(`info`,`🎬 [REPLAY] Replaying outbound message after ${e.delay}ms`),l===`socketio`&&e.event?(A.current.emit(e.event,e.payload),j(`sent`,`Event: ${e.event} | Payload: ${JSON.stringify(e.payload)}`)):(A.current.send(e.content),j(`sent`,e.content));j(`info`,`🎬 [REPLAY] Completed sending all outbound messages.`)},F=()=>{let e={id:`rule-`+Date.now(),type:`contains`,target:`event`,value:``};C(t=>[...t,e])},I=e=>{C(t=>t.filter(t=>t.id!==e))},ce=(e,t,n)=>{C(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},le=(e,t)=>{if(e===t)return!0;if(typeof t!=`object`||!t||typeof e!=`object`||!e)return!1;for(let n of Object.keys(t))if(!(n in e)||!le(e[n],t[n]))return!1;return!0},ue=(e,t)=>{if(S.length===0)return;j(`info`,`[ASSERTION] Checking assertions for message...`);let n=null;try{n=JSON.parse(t)}catch{}S.forEach(r=>{if(!r.value.trim())return;let i=!1,a=r.target===`event`&&e||t;if(r.type===`equals`)i=a===r.value;else if(r.type===`contains`)i=a.includes(r.value);else if(r.type===`regex`)try{i=new RegExp(r.value).test(a)}catch{}if(r.target===`payload`&&n&&r.type===`contains`)try{let e=JSON.parse(r.value);i=le(n,e)}catch{i=t.includes(r.value)}i?j(`info`,`✅ [ASSERTION PASSED] Matches rule: Target: ${r.target} | Match: ${r.type} | Value: "${r.value}"`):j(`error`,`❌ [ASSERTION FAILED] Target: ${r.target} | Expected Match: "${r.value}" | Actual: ${a}`)})};return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`panel-header`,children:[(0,E.jsx)(`div`,{className:`panel-title`,children:`WebSocket Route Tester`}),(0,E.jsx)(`div`,{className:`panel-subtitle`,children:`Connect, join rooms, send events, and analyze bidirectional messaging traffic in real-time`})]}),(0,E.jsxs)(`div`,{className:`tester-container`,children:[(0,E.jsxs)(`div`,{className:`tester-section`,style:{height:`700px`,overflowY:`auto`},children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,children:[(0,E.jsx)(`span`,{children:`🔌`}),` WS Connection`]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Discovered Route`}),(0,E.jsxs)(`select`,{className:`select-input`,value:s,onChange:e=>re(e.target.value),children:[(0,E.jsx)(`option`,{value:``,children:`-- Choose Route --`}),r.map(e=>(0,E.jsxs)(`option`,{value:e.path,children:[`WS `,e.path]},e.path))]})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Protocol Type`}),(0,E.jsxs)(`select`,{className:`select-input`,value:l,onChange:e=>u(e.target.value),children:[(0,E.jsx)(`option`,{value:`ws`,children:`Raw WebSocket`}),(0,E.jsx)(`option`,{value:`socketio`,children:`Socket.IO`})]})]}),(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Connection Status`}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,E.jsx)(`div`,{className:d===`connected`?`ws-badge connected`:d===`connecting`?`ws-badge connecting`:`ws-badge disconnected`,style:{width:`100%`,justifyContent:`center`},children:d.toUpperCase()}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`6px`},children:[(0,E.jsx)(`button`,{className:`btn`,style:{flex:1,padding:`8px 12px`,fontSize:`12px`,margin:0},onClick:N,disabled:d===`connected`||d===`connecting`,children:`Connect`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{flex:1,padding:`8px 12px`,fontSize:`12px`,margin:0},onClick:M,disabled:d===`disconnected`,children:`Disconnect`})]})]})]}),l===`socketio`&&(0,E.jsxs)(`div`,{className:`form-group`,style:{borderTop:`1px solid var(--border)`,paddingTop:`12px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Socket.IO Rooms`}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Room name`,value:b,onChange:e=>x(e.target.value)}),(0,E.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{flex:1,padding:`6px`,fontSize:`11px`,margin:0},onClick:ae,disabled:d!==`connected`,children:`Join`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,style:{flex:1,padding:`6px`,fontSize:`11px`,margin:0},onClick:oe,disabled:d!==`connected`,children:`Leave`})]})]}),(0,E.jsxs)(`div`,{className:`form-group`,style:{borderTop:`1px solid var(--border)`,paddingTop:`12px`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Replay & Recorder`}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,E.jsx)(`button`,{className:`btn`,style:{background:T?`rgba(239, 68, 68, 0.2)`:`rgba(239, 68, 68, 0.05)`,color:`var(--error)`,borderColor:T?`var(--error)`:`rgba(239, 68, 68, 0.2)`,borderWidth:`1px`,borderStyle:`solid`,margin:0},onClick:se,children:T?`⏹ Stop`:`🔴 Record Session`}),(0,E.jsx)(`div`,{style:{fontSize:`11px`,color:`var(--text-secondary)`,textAlign:`center`},children:T?`Recording... (${O.length} captured)`:O.length>0?`Captured ${O.length} messages`:`No messages captured`}),(0,E.jsx)(`button`,{className:`btn btn-secondary`,onClick:P,disabled:O.length===0||T,style:{margin:0},children:`🎬 Playback Replay`})]})]})]}),(0,E.jsxs)(`div`,{className:`tester-section`,style:{height:`700px`,display:`flex`,flexDirection:`column`,gap:`14px`,overflowY:`auto`},children:[(0,E.jsxs)(`div`,{className:`tester-section-title`,style:{flexShrink:0},children:[(0,E.jsx)(`span`,{children:`📝`}),` Message Composer`]}),(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`,flexShrink:0},children:[l===`socketio`&&(0,E.jsxs)(`div`,{className:`form-group`,children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Event Name`}),(0,E.jsx)(`input`,{className:`text-input`,type:`text`,placeholder:`Event name`,value:h,onChange:e=>g(e.target.value)})]}),(0,E.jsxs)(`div`,{className:`form-group`,style:{display:`flex`,flexDirection:`column`},children:[(0,E.jsx)(`label`,{className:`form-label`,children:`Message Payload (String or JSON)`}),(0,E.jsx)(`textarea`,{className:`textarea-input`,style:{minHeight:`120px`,resize:`none`},placeholder:l===`socketio`?`{
|
package/ui-dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Axiomify Studio</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BCvKbwZS.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-C1t6d4ij.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|