@websublime/vite-plugin-open-api-devtools 0.8.2 → 0.8.3
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/{ModelsPage-DgFhUiBH.js → ModelsPage-DtwVBgEq.js} +6 -6
- package/dist/{ModelsPage-DgFhUiBH.js.map → ModelsPage-DtwVBgEq.js.map} +1 -1
- package/dist/{RoutesPage-DpasQCnt.js → RoutesPage-DVaFf1b6.js} +4 -4
- package/dist/{RoutesPage-DpasQCnt.js.map → RoutesPage-DVaFf1b6.js.map} +1 -1
- package/dist/{SimulatorPage-CDTgl8ax.js → SimulatorPage-QuwXPwEn.js} +4 -4
- package/dist/{SimulatorPage-CDTgl8ax.js.map → SimulatorPage-QuwXPwEn.js.map} +1 -1
- package/dist/{TimelinePage-CLlD6uZ8.js → TimelinePage-CYGTXXoL.js} +7 -7
- package/dist/{TimelinePage-CLlD6uZ8.js.map → TimelinePage-CYGTXXoL.js.map} +1 -1
- package/dist/{check-D8w72KaI.js → check-C8somSxy.js} +2 -2
- package/dist/{check-D8w72KaI.js.map → check-C8somSxy.js.map} +1 -1
- package/dist/devtools.css +1 -1
- package/dist/devtools.js +1 -1
- package/dist/devtools.umd.cjs +1 -1
- package/dist/devtools.umd.cjs.map +1 -1
- package/dist/{format-Bs9S93C7.js → format-9UQBRrMl.js} +2 -2
- package/dist/{format-Bs9S93C7.js.map → format-9UQBRrMl.js.map} +1 -1
- package/dist/{main-DUNgny3E.js → main-B4KUU1eG.js} +5 -5
- package/dist/{main-DUNgny3E.js.map → main-B4KUU1eG.js.map} +1 -1
- package/dist/spa/assets/{ModelsPage-BslYlawu.css → ModelsPage-8J4ivXTd.css} +1 -1
- package/dist/spa/assets/{ModelsPage-Ef8Z_K5t.js → ModelsPage-CGAzOf6p.js} +3 -3
- package/dist/spa/assets/{ModelsPage-Ef8Z_K5t.js.map → ModelsPage-CGAzOf6p.js.map} +1 -1
- package/dist/spa/assets/{RoutesPage-Rs-CBlOu.js → RoutesPage-DRs9ZFX4.js} +2 -2
- package/dist/spa/assets/{RoutesPage-Rs-CBlOu.js.map → RoutesPage-DRs9ZFX4.js.map} +1 -1
- package/dist/spa/assets/{SimulatorPage-CNh6VflM.js → SimulatorPage-DFNoxcRv.js} +2 -2
- package/dist/spa/assets/{SimulatorPage-CNh6VflM.js.map → SimulatorPage-DFNoxcRv.js.map} +1 -1
- package/dist/spa/assets/{TimelinePage-2YaDXdDB.js → TimelinePage-nthQiIag.js} +2 -2
- package/dist/spa/assets/{TimelinePage-2YaDXdDB.js.map → TimelinePage-nthQiIag.js.map} +1 -1
- package/dist/spa/assets/check-DPkOzfFg.js +2 -0
- package/dist/spa/assets/{check-CLk5nWxQ.js.map → check-DPkOzfFg.js.map} +1 -1
- package/dist/spa/assets/{format-YtVMCGJx.js → format-BBKRcMH2.js} +2 -2
- package/dist/spa/assets/{format-YtVMCGJx.js.map → format-BBKRcMH2.js.map} +1 -1
- package/dist/spa/assets/{index-sPgNGnaU.js → index-OjSRPocP.js} +3 -3
- package/dist/spa/assets/{index-sPgNGnaU.js.map → index-OjSRPocP.js.map} +1 -1
- package/dist/spa/assets/{trash-2-DCsOAZPr.js → trash-2-DVdyPNM4.js} +2 -2
- package/dist/spa/assets/{trash-2-DCsOAZPr.js.map → trash-2-DVdyPNM4.js.map} +1 -1
- package/dist/spa/assets/{triangle-alert-DD8Mz05K.js → triangle-alert-COSegcUH.js} +2 -2
- package/dist/spa/assets/{triangle-alert-DD8Mz05K.js.map → triangle-alert-COSegcUH.js.map} +1 -1
- package/dist/spa/assets/x-DC0rfJtM.js +2 -0
- package/dist/spa/assets/{x-5pbhNHo3.js.map → x-DC0rfJtM.js.map} +1 -1
- package/dist/spa/index.html +1 -1
- package/dist/{trash-2-BaiQpXqE.js → trash-2-BXKjlLnv.js} +2 -2
- package/dist/{trash-2-BaiQpXqE.js.map → trash-2-BXKjlLnv.js.map} +1 -1
- package/dist/{triangle-alert-CIaC9iQP.js → triangle-alert-BmO71UYi.js} +2 -2
- package/dist/{triangle-alert-CIaC9iQP.js.map → triangle-alert-BmO71UYi.js.map} +1 -1
- package/dist/{x-BI73Bc0z.js → x-cjNeCV9f.js} +2 -2
- package/dist/{x-BI73Bc0z.js.map → x-cjNeCV9f.js.map} +1 -1
- package/package.json +12 -12
- package/dist/spa/assets/check-CLk5nWxQ.js +0 -2
- package/dist/spa/assets/x-5pbhNHo3.js +0 -2
package/dist/devtools.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(function(j,W){typeof exports=="object"&&typeof module<"u"?W(exports,require("pinia"),require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","pinia","vue","vue-router"],W):(j=typeof globalThis<"u"?globalThis:j||self,W(j.ViteOpenApiDevtools={},j.Pinia,j.Vue,j.VueRouter))})(this,(function(j,W,e,ce){"use strict";const Le=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xe=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,l)=>l?l.toUpperCase():s.toLowerCase()),ve=n=>{const t=Xe(n);return t.charAt(0).toUpperCase()+t.slice(1)},et=(...n)=>n.filter((t,s,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===s).join(" ").trim();var de={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const tt=({size:n,strokeWidth:t=2,absoluteStrokeWidth:s,color:l,iconNode:r,name:o,class:u,...E},{slots:_})=>e.h("svg",{...de,width:n||de.width,height:n||de.height,stroke:l||de.stroke,"stroke-width":s?Number(t)*24/Number(n):t,class:et("lucide",...o?[`lucide-${Le(ve(o))}-icon`,`lucide-${Le(o)}`]:["lucide-icon"]),...E},[...r.map(a=>e.h(...a)),..._.default?[_.default()]:[]]);const z=(n,t)=>(s,{slots:l})=>e.h(tt,{...s,iconNode:t,name:n},l);const me=z("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const X=z("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const te=z("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Ae=z("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const nt=z("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const ot=z("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const G=z("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const be=z("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const Ve=z("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const pe=z("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const Se=z("file-json",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);const Re=z("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);const st=z("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const lt=z("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const at=z("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const Be=z("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);const rt=z("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const ue=z("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const it=z("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const Ce=z("sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);const ct=z("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);const fe=z("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const $e=z("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const dt=z("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const mt=z("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);const ae=z("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const ne=z("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),xe={path:"/_ws",reconnectDelay:2e3,maxReconnectAttempts:Number.POSITIVE_INFINITY,autoConnect:!0},O=e.ref("disconnected"),we=e.ref(null),re=e.ref(0);let L=null,ye=null,oe={...xe},De=!1;const Q=new Map;function Oe(){return typeof window<"u"&&typeof WebSocket<"u"}function pt(){return e.getCurrentInstance()!==null}function ut(n){return Oe()?`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${n}`:`ws://localhost${n}`}function Pe(){ye!==null&&(clearTimeout(ye),ye=null)}function ft(n,t){const s=Q.get(n);if(s)for(const r of s)try{r(t)}catch(o){console.error(`[DevTools WebSocket] Error in event handler for '${n}':`,o)}const l=Q.get("*");if(l)for(const r of l)try{r({type:n,data:t})}catch(o){console.error("[DevTools WebSocket] Error in wildcard event handler:",o)}}function yt(){O.value="connected",re.value=0,Pe()}function ht(n){try{const t=JSON.parse(n.data);if(t.type==="connected"){const s=t.data;we.value=s.serverVersion}ft(t.type,t.data)}catch(t){console.error("[DevTools WebSocket] Failed to parse message:",t)}}function _t(){O.value,O.value="disconnected",L=null,re.value<oe.maxReconnectAttempts&&(O.value="reconnecting",re.value++,ye=setTimeout(()=>{Te()},oe.reconnectDelay))}function gt(n){console.error("[DevTools WebSocket] Error:",n)}function Te(){if(!Oe()||O.value==="connecting"||O.value==="connected"||L&&(L.readyState===WebSocket.CONNECTING||L.readyState===WebSocket.OPEN))return;He(),O.value="connecting";const n=ut(oe.path);try{L=new WebSocket(n),L.onopen=yt,L.onmessage=ht,L.onclose=_t,L.onerror=gt}catch(t){console.error("[DevTools WebSocket] Failed to create WebSocket:",t),O.value="disconnected"}}function He(){L&&(L.onopen=null,L.onmessage=null,L.onclose=null,L.onerror=null,(L.readyState===WebSocket.OPEN||L.readyState===WebSocket.CONNECTING)&&L.close(),L=null)}function je(){Pe(),He(),O.value="disconnected",re.value=0}function kt(n){if(!L||L.readyState!==WebSocket.OPEN)return!1;try{return L.send(JSON.stringify(n)),!0}catch(t){return console.error("[DevTools WebSocket] Failed to send command:",t),!1}}function Ie(n,t){Q.has(n)||Q.set(n,new Set);const s=Q.get(n);return s&&s.add(t),()=>{const l=Q.get(n);l&&(l.delete(t),l.size===0&&Q.delete(n))}}function ze(n,t){const s=Q.get(n);s&&(s.delete(t),s.size===0&&Q.delete(n))}function Et(n,t){const s=l=>{ze(n,s),t(l)};return Ie(n,s)}function Nt(n,t){const s=l=>{t(l)===!0&&ze(n,s)};return Ie(n,s)}function bt(){je(),we.value=null,Q.clear(),oe={...xe},De=!1}function se(n={}){(!De||O.value==="disconnected")&&(oe={...xe,...n},De=!0);const t=e.computed(()=>O.value==="connected"),s=e.computed(()=>O.value==="reconnecting");return pt()&&e.onMounted(()=>{oe.autoConnect&&Te()}),{connectionState:e.computed(()=>O.value),connected:t,isReconnecting:s,serverVersion:e.computed(()=>we.value),reconnectAttempts:e.computed(()=>re.value),connect:Te,disconnect:je,send:kt,on:Ie,off:ze,once:Et,onUntil:Nt,resetState:bt}}const Ue=[{path:"/",redirect:"/routes"},{path:"/routes",name:"routes",component:()=>Promise.resolve().then(()=>to),meta:{title:"Routes",icon:"route"}},{path:"/timeline",name:"timeline",component:()=>Promise.resolve().then(()=>Rs),meta:{title:"Timeline",icon:"clock"}},{path:"/models",name:"models",component:()=>Promise.resolve().then(()=>jl),meta:{title:"Models",icon:"database"}},{path:"/simulator",name:"simulator",component:()=>Promise.resolve().then(()=>ua),meta:{title:"Simulator",icon:"zap"}},{path:"/:pathMatch(.*)*",name:"not-found",redirect:"/routes"}],Vt=ce.createRouter({history:ce.createWebHashHistory(),routes:Ue}),St={class:"app"},Bt={class:"app-header"},Ct={class:"app-header__brand"},$t={class:"app-nav",role:"tablist","aria-label":"DevTools navigation"},xt=["aria-selected","aria-current","aria-controls","onClick"],wt={class:"app-nav__label"},Dt={class:"app-header__status"},Tt={class:"connection-status"},It={class:"connection-status__text"},zt={class:"app-main"},Mt=e.defineComponent({__name:"App",setup(n){const t=ce.useRoute(),s=ce.useRouter(),l=e.computed(()=>Ue.filter(a=>a.name&&a.meta?.title).map(a=>({name:a.name,path:a.path,title:a.meta?.title,icon:a.meta?.icon}))),r=e.computed(()=>t.name);function o(a){s.push(a)}const u={route:Be,clock:G,database:pe,zap:ne};function E(a){return u[a]??Be}const{connected:_}=se();return(a,b)=>{const B=e.resolveComponent("router-view");return e.openBlock(),e.createElementBlock("div",St,[e.createElementVNode("header",Bt,[e.createElementVNode("div",Ct,[e.createVNode(e.unref(ne),{class:"app-header__logo",size:20}),b[0]||(b[0]=e.createElementVNode("span",{class:"app-header__title"},"OpenAPI DevTools",-1))]),e.createElementVNode("nav",$t,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,$=>(e.openBlock(),e.createElementBlock("button",{key:$.name,role:"tab","aria-selected":r.value===$.name,"aria-current":r.value===$.name?"true":void 0,"aria-controls":`panel-${$.name}`,tabindex:0,class:e.normalizeClass(["app-nav__tab",{"app-nav__tab--active":r.value===$.name}]),onClick:w=>o($.path)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(E($.icon)),{size:16,class:"app-nav__icon"})),e.createElementVNode("span",wt,e.toDisplayString($.title),1)],10,xt))),128))]),e.createElementVNode("div",Dt,[e.createElementVNode("div",Tt,[e.createElementVNode("span",{class:e.normalizeClass(["connection-status__dot",e.unref(_)?"connection-status__dot--connected":"connection-status__dot--disconnected"])},null,2),e.createElementVNode("span",It,e.toDisplayString(e.unref(_)?"Connected":"Disconnected"),1),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_)?e.unref(mt):e.unref(dt)),{size:14,class:"connection-status__icon"}))])])]),e.createElementVNode("main",zt,[e.createVNode(B,null,{default:e.withCtx(({Component:$})=>[e.createVNode(e.Transition,{name:"fade",mode:"out-in"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent($)))]),_:2},1024)]),_:1})])])}}}),U=(n,t)=>{const s=n.__vccOpts||n;for(const[l,r]of t)s[l]=r;return s},qt=U(Mt,[["__scopeId","data-v-0a83e2b9"]]);function he(n){try{return structuredClone(e.toRaw(n))}catch{return JSON.parse(JSON.stringify(n))}}const Ft=W.defineStore("models",()=>{const n=e.ref([]),t=e.ref(null),s=e.ref([]),l=e.ref([]),r=e.ref(!1),o=e.ref(null),u=e.computed(()=>t.value?n.value.find(k=>k.name===t.value)??null:null),E=e.ref(!1),_=e.computed(()=>E.value),a=e.computed(()=>n.value.length),b=e.computed(()=>n.value.reduce((k,p)=>k+p.count,0));async function B(){r.value=!0,o.value=null;try{const k=await fetch("/_api/store");if(!k.ok)throw new Error(`Failed to fetch schemas: ${k.statusText}`);const p=await k.json();n.value=p.schemas??[]}catch(k){o.value=k instanceof Error?k.message:"Failed to fetch schemas",console.error("[ModelsStore] Error fetching schemas:",k)}finally{r.value=!1}}async function $(k){t.value!==k&&(t.value=k,await w(k))}async function w(k){r.value=!0,o.value=null;try{const p=await fetch(`/_api/store/${encodeURIComponent(k)}`);if(!p.ok)throw new Error(`Failed to fetch schema data: ${p.statusText}`);const h=await p.json(),m=h.items??[];s.value=he(m),l.value=he(m),E.value=!1;const M=n.value.findIndex(g=>g.name===k);M!==-1&&(n.value[M].count=h.count)}catch(p){o.value=p instanceof Error?p.message:"Failed to fetch schema data",console.error("[ModelsStore] Error fetching schema data:",p)}finally{r.value=!1}}function F(k){if(!Array.isArray(k)){o.value="Invalid data: Expected an array of items",console.error("[ModelsStore] updateItems received non-array value:",typeof k);return}s.value=k,o.value=null,E.value=!0}async function C(){if(!t.value)return o.value="No schema selected",!1;r.value=!0,o.value=null;try{const k=await fetch(`/_api/store/${encodeURIComponent(t.value)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(!k.ok){const m=await k.json().catch(()=>({}));throw new Error(m.error||`Failed to save items: ${k.statusText}`)}const p=await k.json();l.value=he(s.value),E.value=!1;const h=n.value.findIndex(m=>m.name===t.value);return h!==-1&&(n.value[h].count=p.created??s.value.length),!0}catch(k){return o.value=k instanceof Error?k.message:"Failed to save items",console.error("[ModelsStore] Error saving items:",k),!1}finally{r.value=!1}}async function S(){if(!t.value)return o.value="No schema selected",!1;r.value=!0,o.value=null;try{const k=await fetch(`/_api/store/${encodeURIComponent(t.value)}`,{method:"DELETE"});if(!k.ok)throw new Error(`Failed to clear schema: ${k.statusText}`);s.value=[],l.value=[],E.value=!1;const p=n.value.findIndex(h=>h.name===t.value);return p!==-1&&(n.value[p].count=0),!0}catch(k){return o.value=k instanceof Error?k.message:"Failed to clear schema",console.error("[ModelsStore] Error clearing schema:",k),!1}finally{r.value=!1}}function y(){s.value=he(l.value),E.value=!1}async function f(){t.value?await w(t.value):await B()}function d(){n.value=[],t.value=null,s.value=[],l.value=[],r.value=!1,o.value=null,E.value=!1}function x(k){const p=n.value.findIndex(h=>h.name===k.schema);p!==-1&&(n.value[p].count=k.count),t.value===k.schema&&(_.value?console.warn(`[ModelsStore] Skipping auto-refresh for schema "${k.schema}" - unsaved changes exist`):w(k.schema))}function A(k){k.success&&(B(),t.value&&(_.value?console.warn(`[ModelsStore] Skipping auto-refresh after reseed for schema "${t.value}" - unsaved changes exist`):w(t.value)))}return{schemas:n,selectedSchema:t,currentItems:s,loading:r,error:o,currentSchema:u,isDirty:_,schemaCount:a,totalItems:b,fetchSchemas:B,selectSchemaByName:$,fetchSchemaData:w,updateItems:F,saveItems:C,clearSchema:S,discardChanges:y,refresh:f,reset:d,handleStoreUpdate:x,handleReseedComplete:A}}),Je=W.defineStore("registry",()=>{const n=e.ref([]),t=e.ref({totalEndpoints:0,withCustomHandler:0,totalSchemas:0,withCustomSeed:0,autoGenerated:0}),s=e.ref(!1),l=e.ref(null),r=e.ref(""),o=e.ref({methods:[],hasHandler:null,hasSeed:null,tags:[]}),u=e.ref(null),E=e.ref(new Set),_=e.computed(()=>{const i=new Set;for(const N of n.value)for(const D of N.tags)i.add(D);return Array.from(i).sort()}),a=e.computed(()=>{const i=new Set;for(const N of n.value)N.responseSchema&&i.add(N.responseSchema);return Array.from(i).sort()}),b=e.computed(()=>{let i=n.value;if(r.value.trim()){const N=r.value.toLowerCase().trim();i=i.filter(D=>D.path.toLowerCase().includes(N)||D.operationId.toLowerCase().includes(N)||D.summary?.toLowerCase().includes(N)||D.tags.some(c=>c.toLowerCase().includes(N)))}return o.value.methods.length>0&&(i=i.filter(N=>o.value.methods.includes(N.method))),o.value.hasHandler!==null&&(i=i.filter(N=>N.hasHandler===o.value.hasHandler)),o.value.hasSeed!==null&&(i=i.filter(N=>N.hasSeed===o.value.hasSeed)),o.value.tags.length>0&&(i=i.filter(N=>N.tags.some(D=>o.value.tags.includes(D)))),i}),B=e.computed(()=>{const i=new Map;for(const N of b.value){let D;N.tags.length>0?D=N.tags[0]:N.responseSchema?D=N.responseSchema:D=N.path.split("/").filter(Boolean)[0]||"Other",i.has(D)||i.set(D,[]),i.get(D)?.push(N)}return Array.from(i.entries()).map(([N,D])=>({tag:N,endpoints:D.sort((c,V)=>c.path.localeCompare(V.path)),isExpanded:E.value.has(N)})).sort((N,D)=>N.tag.localeCompare(D.tag))}),$=e.computed(()=>u.value?n.value.find(i=>i.key===u.value)??null:null),w=e.computed(()=>n.value.filter(i=>i.hasHandler).length),F=e.computed(()=>n.value.filter(i=>i.hasSeed).length);function C(i){n.value=i.endpoints,t.value=i.stats,l.value=null;for(const N of i.endpoints)N.tags.length>0&&E.value.add(N.tags[0])}function S(i){s.value=i}function y(i){l.value=i,s.value=!1}function f(){l.value=null}function d(i){r.value=i}function x(i){const N=o.value.methods.indexOf(i);N===-1?o.value.methods.push(i):o.value.methods.splice(N,1)}function A(i){o.value.hasHandler=i}function k(i){o.value.hasSeed=i}function p(i){const N=o.value.tags.indexOf(i);N===-1?o.value.tags.push(i):o.value.tags.splice(N,1)}function h(){o.value={methods:[],hasHandler:null,hasSeed:null,tags:[]},r.value=""}function m(){return r.value.trim()!==""||o.value.methods.length>0||o.value.hasHandler!==null||o.value.hasSeed!==null||o.value.tags.length>0}function M(i){u.value=i}function g(i){E.value.has(i)?E.value.delete(i):E.value.add(i)}function T(){for(const i of B.value)E.value.add(i.tag)}function R(){E.value.clear()}function H(i){const N=new Set(i);for(const D of n.value)D.hasHandler=N.has(D.operationId)}function q(i){const N=new Set(i);for(const D of n.value)D.hasSeed=D.responseSchema?N.has(D.responseSchema):!1}return{endpoints:n,stats:t,isLoading:s,error:l,searchQuery:r,filter:o,selectedEndpointKey:u,expandedTags:E,allTags:_,allSchemas:a,filteredEndpoints:b,groupedEndpoints:B,selectedEndpoint:$,handlerCount:w,seedCount:F,setRegistryData:C,setLoading:S,setError:y,clearError:f,setSearchQuery:d,toggleMethodFilter:x,setHandlerFilter:A,setSeedFilter:k,toggleTagFilter:p,clearFilters:h,hasActiveFilters:m,selectEndpoint:M,toggleGroup:g,expandAllGroups:T,collapseAllGroups:R,updateHandlerStatus:H,updateSeedStatus:q}}),Me=[{id:"slow-network",label:"Slow Network",description:"3000ms delay (3G simulation)",type:"delay",status:200,delay:3e3},{id:"server-error",label:"Server Error",description:"Returns HTTP 500",type:"error",status:500,body:{error:"Internal Server Error",message:"Simulated server error"}},{id:"rate-limit",label:"Rate Limited",description:"Returns HTTP 429",type:"error",status:429,body:{error:"Too Many Requests",message:"Rate limit exceeded"}},{id:"not-found",label:"Not Found",description:"Returns HTTP 404",type:"error",status:404,body:{error:"Not Found",message:"Resource not found"}},{id:"request-timeout",label:"Request Timeout",description:"30000ms delay (simulates timeout)",type:"delay",status:200,delay:3e4},{id:"empty-response",label:"Empty Response",description:"Returns HTTP 200 with empty body",type:"empty",status:200,body:null},{id:"unauthorized",label:"Unauthorized",description:"Returns HTTP 401",type:"error",status:401,body:{error:"Unauthorized",message:"Authentication required"}}],Lt=W.defineStore("simulation",()=>{const n=e.ref(new Map),t=e.ref(new Map),s=e.ref(!1),l=e.ref(null),r=e.computed(()=>Array.from(n.value.values())),o=e.computed(()=>n.value.size),u=e.computed(()=>Me),E=e.computed(()=>n.value.size>0),_=e.computed(()=>{const g={delay:[],error:[],empty:[]};for(const T of n.value.values()){const R=a(T);g[R].push(T)}return g});function a(g){const T=g.presetId?Me.find(R=>R.id===g.presetId):null;return T?T.type:g.delay&&g.delay>0?"delay":g.body===null?"empty":"error"}function b(g){n.value.clear();for(const T of g)n.value.set(T.path,T);l.value=null}function B(g,T=!1){if(T){const R=n.value.get(g.path)||null;t.value.set(g.path,R)}n.value.set(g.path,g)}function $(g,T=!1){if(T){const R=n.value.get(g)||null;t.value.set(g,R)}return n.value.delete(g)}function w(){n.value.clear()}function F(g){return n.value.get(g)}function C(g){return n.value.has(g)}function S(g){return Me.find(T=>T.id===g)}function y(g,T,R){const H=S(T);return H?{path:g,operationId:R,status:H.status,delay:H.delay,body:H.body,presetId:H.id}:(l.value=`Preset not found: ${T}`,null)}function f(g){s.value=g}function d(g){l.value=g,s.value=!1}function x(){l.value=null}function A(g){if(!t.value.has(g))return;const T=t.value.get(g);T==null?n.value.delete(g):n.value.set(g,T),t.value.delete(g)}function k(g){console.log("[Simulation] Added:",g.path)}function p(g){$(g.path),console.log("[Simulation] Removed:",g.path)}function h(g){w(),console.log("[Simulation] Cleared all:",g.count)}function m(g){g.success?(t.value.delete(g.path),console.log("[Simulation] Set successfully:",g.path)):(A(g.path),d(`Failed to set simulation for ${g.path}`)),f(!1)}function M(g){g.success?(t.value.delete(g.path),console.log("[Simulation] Cleared successfully:",g.path)):(A(g.path),d(`Failed to clear simulation for ${g.path}`)),f(!1)}return{simulations:n,isLoading:s,error:l,activeSimulations:r,count:o,presets:u,hasActiveSimulations:E,simulationsByType:_,setSimulations:b,addSimulationLocal:B,removeSimulationLocal:$,clearSimulationsLocal:w,getSimulation:F,hasSimulation:C,getPreset:S,createSimulationFromPreset:y,setLoading:f,setError:d,clearError:x,rollbackSimulation:A,handleSimulationAdded:k,handleSimulationRemoved:p,handleSimulationsCleared:h,handleSimulationSet:m,handleSimulationCleared:M}}),At=W.defineStore("timeline",()=>{const n=e.ref([]),t=e.ref(!1),s=e.ref(null),l=e.ref({methods:[],statusCodes:[],searchQuery:"",simulatedOnly:null}),r=e.ref(null),o=e.ref(500),u=new Map;function E(c){return c<200?"1xx":c<300?"2xx":c<400?"3xx":c<500?"4xx":"5xx"}const _=e.computed(()=>{let c=n.value;if(l.value.searchQuery.trim()){const V=l.value.searchQuery.toLowerCase().trim();c=c.filter(I=>I.request.path.toLowerCase().includes(V)||I.request.operationId.toLowerCase().includes(V))}return l.value.methods.length>0&&(c=c.filter(V=>l.value.methods.includes(V.request.method.toUpperCase()))),l.value.statusCodes.length>0&&(c=c.filter(V=>{if(V.status===null)return!1;const I=E(V.status);return l.value.statusCodes.includes(I)})),l.value.simulatedOnly!==null&&(c=c.filter(V=>V.simulated===l.value.simulatedOnly)),c}),a=e.computed(()=>r.value?n.value.find(c=>c.id===r.value)??null:null),b=e.computed(()=>n.value.length),B=e.computed(()=>n.value.filter(c=>c.response!==null).length),$=e.computed(()=>n.value.filter(c=>c.response===null).length),w=e.computed(()=>{const c={"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0};for(const V of n.value)if(V.status!==null){const I=E(V.status);c[I]++}return c}),F=e.computed(()=>{const c=n.value.filter(I=>I.duration!==null);if(c.length===0)return 0;const V=c.reduce((I,Z)=>I+(Z.duration??0),0);return Math.round(V/c.length)});function C(c){const V={id:c.id,request:c,response:null,status:null,duration:null,simulated:!1},I=u.get(c.id);I&&(y(V,I),u.delete(c.id)),n.value.unshift(V),n.value.length>o.value&&(n.value=n.value.slice(0,o.value))}function S(c){const V=n.value.find(I=>I.id===c.requestId);if(V)y(V,c),u.delete(c.requestId);else if(u.set(c.requestId,c),u.size>100){const I=f(c);n.value.unshift(I),u.delete(c.requestId),n.value.length>o.value&&(n.value=n.value.slice(0,o.value))}}function y(c,V){c.response=V,c.status=V.status,c.duration=V.duration,c.simulated=V.simulated}function f(c){const V={id:c.requestId,method:"UNKNOWN",path:"/unknown",operationId:"unknown",timestamp:Date.now(),headers:{},query:{},body:void 0};return{id:c.requestId,request:V,response:c,status:c.status,duration:c.duration,simulated:c.simulated}}function d(c){for(const[V,I]of u){const Z=c.get(V);Z?(y(Z,I),u.delete(V)):(c.set(V,f(I)),u.delete(V))}}function x(c,V){for(const[I,Z]of V){const Y=c.get(I);Y?y(Y,Z):u.set(I,Z)}}function A(c){for(const[V,I]of u)c.has(V)||(c.set(V,f(I)),u.delete(V))}function k(c){const V=new Map,I=new Map;for(const Y of c.entries)if(Y.type==="request"){const v=Y.data;V.set(v.id,{id:v.id,request:v,response:null,status:null,duration:null,simulated:!1})}else if(Y.type==="response"){const v=Y.data;I.set(v.requestId,v)}d(V),x(V,I),A(V);const Z=Array.from(V.values()).sort((Y,v)=>v.request.timestamp-Y.request.timestamp);n.value=Z.slice(0,o.value),s.value=null}function p(){n.value=[],r.value=null,u.clear()}function h(c){t.value=c}function m(c){s.value=c,t.value=!1}function M(){s.value=null}function g(c){l.value.searchQuery=c}function T(c){const V=l.value.methods.indexOf(c);V===-1?l.value.methods.push(c):l.value.methods.splice(V,1)}function R(c){const V=l.value.statusCodes.indexOf(c);V===-1?l.value.statusCodes.push(c):l.value.statusCodes.splice(V,1)}function H(c){l.value.simulatedOnly=c}function q(){l.value={methods:[],statusCodes:[],searchQuery:"",simulatedOnly:null}}function i(){return l.value.searchQuery.trim()!==""||l.value.methods.length>0||l.value.statusCodes.length>0||l.value.simulatedOnly!==null}function N(c){r.value=c}function D(c){const V=Math.max(1,c);o.value=V,n.value.length>V&&(n.value=n.value.slice(0,V))}return{entries:n,isLoading:t,error:s,filter:l,selectedEntryId:r,maxEntries:o,filteredEntries:_,selectedEntry:a,totalCount:b,completedCount:B,pendingCount:$,statusCounts:w,averageDuration:F,addRequest:C,addResponse:S,setTimelineData:k,clearTimeline:p,setLoading:h,setError:m,clearError:M,setSearchQuery:g,toggleMethodFilter:T,toggleStatusFilter:R,setSimulatedFilter:H,clearFilters:q,hasActiveFilters:i,selectEntry:N,setMaxEntries:D}}),Rt=["light","dark","system"];function Qe(n){return typeof n=="string"&&Rt.includes(n)}const qe="openapi-devtools-theme",K=e.ref("system"),ee=e.ref(!1);let _e=null,ge=null;function ke(){return typeof window<"u"&&typeof document<"u"}function Ot(){return e.getCurrentInstance()!==null}function Pt(){const n=e.computed(()=>K.value==="system"?ee.value?"dark":"light":K.value),t=e.computed(()=>n.value==="dark");function s(){if(!ke())return;const a=document.documentElement;n.value==="dark"?(a.classList.add("dark"),a.classList.remove("light")):(a.classList.add("light"),a.classList.remove("dark"))}function l(a){if(!Qe(a)){console.warn(`[DevTools] Invalid theme mode: ${a}`);return}if(K.value=a,ke())try{localStorage.setItem(qe,a)}catch{console.warn("[DevTools] Unable to persist theme preference")}}function r(){K.value==="system"?l(ee.value?"light":"dark"):l(K.value==="dark"?"light":"dark")}function o(){l("system")}function u(){_e&&ge&&(_e.removeEventListener("change",ge),_e=null,ge=null)}function E(){if(!ke())return;u();const a=window.matchMedia("(prefers-color-scheme: dark)");ee.value=a.matches;const b=B=>{ee.value=B.matches};a.addEventListener("change",b),_e=a,ge=b;try{const B=localStorage.getItem(qe);Qe(B)&&(K.value=B)}catch{}s()}function _(){if(u(),K.value="system",ee.value=!1,ke()){document.documentElement.classList.remove("dark","light");try{localStorage.removeItem(qe)}catch{}}}return e.watch([K,ee],()=>{s()}),Ot()&&(e.onMounted(()=>{E()}),e.onUnmounted(()=>{u()})),{themeMode:e.computed(()=>K.value),effectiveTheme:n,isDark:t,systemPrefersDark:e.computed(()=>ee.value),setTheme:l,toggleTheme:r,resetToSystem:o,initialize:E,resetState:_}}let We=!1,Ge=null;function Ke(){if(We)return Ge;const n=e.createApp(qt),t=W.createPinia();return n.use(t),n.use(Vt),n.mount("#app"),We=!0,Ge=n,n}typeof window<"u"&&document.getElementById("app")&&Ke();function Ee(n){return n.toUpperCase()}const Ht={class:"endpoint-detail"},jt={key:0,class:"endpoint-detail__empty"},Ut={key:1,class:"endpoint-detail__content"},Jt={class:"endpoint-detail__header"},Qt={class:"endpoint-detail__path font-mono"},Wt={class:"endpoint-detail__status"},Gt={key:0,class:"endpoint-detail__status-item endpoint-detail__status-item--handler"},Kt={key:1,class:"endpoint-detail__status-item endpoint-detail__status-item--seed"},Zt={key:2,class:"endpoint-detail__status-item endpoint-detail__status-item--security"},Yt={key:3,class:"endpoint-detail__status-item endpoint-detail__status-item--auto"},Xt={class:"endpoint-detail__sections"},vt={class:"endpoint-detail__section"},en={class:"endpoint-detail__section-content font-mono"},tn={key:0,class:"endpoint-detail__section"},nn={class:"endpoint-detail__section-title"},on={class:"endpoint-detail__tags"},sn={key:1,class:"endpoint-detail__section"},ln={class:"endpoint-detail__section-content"},an={key:2,class:"endpoint-detail__section"},rn={class:"endpoint-detail__section-content endpoint-detail__description"},cn={key:3,class:"endpoint-detail__section"},dn={class:"endpoint-detail__section-title"},mn={class:"endpoint-detail__section-content font-mono"},pn={key:4,class:"endpoint-detail__section"},un={class:"endpoint-detail__section-title"},fn={class:"endpoint-detail__security"},yn={class:"endpoint-detail__security-name font-mono"},hn={class:"endpoint-detail__security-scopes text-muted"},_n=U(e.defineComponent({__name:"EndpointDetail",props:{endpoint:{}},setup(n){const t=n,s=e.computed(()=>t.endpoint?.security&&t.endpoint.security.length>0),l=e.computed(()=>t.endpoint?.security?t.endpoint.security.map(r=>({name:r.name,scopes:r.scopes.length>0?r.scopes.join(", "):"No scopes"})):[]);return(r,o)=>(e.openBlock(),e.createElementBlock("div",Ht,[n.endpoint?(e.openBlock(),e.createElementBlock("div",Ut,[e.createElementVNode("header",Jt,[e.createElementVNode("span",{class:e.normalizeClass(["method-badge","method-badge--large",`method-badge--${n.endpoint.method}`])},e.toDisplayString(e.unref(Ee)(n.endpoint.method)),3),e.createElementVNode("h2",Qt,e.toDisplayString(n.endpoint.path),1)]),e.createElementVNode("div",Wt,[n.endpoint.hasHandler?(e.openBlock(),e.createElementBlock("div",Gt,[e.createVNode(e.unref(be),{size:14}),o[2]||(o[2]=e.createElementVNode("span",null,"Has custom handler",-1))])):e.createCommentVNode("",!0),n.endpoint.hasSeed?(e.openBlock(),e.createElementBlock("div",Kt,[e.createVNode(e.unref(Ce),{size:14}),o[3]||(o[3]=e.createElementVNode("span",null,"Has seed data",-1))])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Zt,[e.createVNode(e.unref(st),{size:14}),o[4]||(o[4]=e.createElementVNode("span",null,"Requires authentication",-1))])):e.createCommentVNode("",!0),!n.endpoint.hasHandler&&!n.endpoint.hasSeed?(e.openBlock(),e.createElementBlock("div",Yt,[e.createVNode(e.unref(Se),{size:14}),o[5]||(o[5]=e.createElementVNode("span",null,"Auto-generated response",-1))])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Xt,[e.createElementVNode("section",vt,[o[6]||(o[6]=e.createElementVNode("h3",{class:"endpoint-detail__section-title"},"Operation",-1)),e.createElementVNode("p",en,e.toDisplayString(n.endpoint.operationId),1)]),n.endpoint.tags.length>0?(e.openBlock(),e.createElementBlock("section",tn,[e.createElementVNode("h3",nn,[e.createVNode(e.unref(ct),{size:14}),o[7]||(o[7]=e.createTextVNode(" Tags ",-1))]),e.createElementVNode("div",on,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.endpoint.tags,u=>(e.openBlock(),e.createElementBlock("span",{key:u,class:"endpoint-detail__tag"},e.toDisplayString(u),1))),128))])])):e.createCommentVNode("",!0),n.endpoint.summary?(e.openBlock(),e.createElementBlock("section",sn,[o[8]||(o[8]=e.createElementVNode("h3",{class:"endpoint-detail__section-title"},"Summary",-1)),e.createElementVNode("p",ln,e.toDisplayString(n.endpoint.summary),1)])):e.createCommentVNode("",!0),n.endpoint.description?(e.openBlock(),e.createElementBlock("section",an,[o[9]||(o[9]=e.createElementVNode("h3",{class:"endpoint-detail__section-title"},"Description",-1)),e.createElementVNode("p",rn,e.toDisplayString(n.endpoint.description),1)])):e.createCommentVNode("",!0),n.endpoint.responseSchema?(e.openBlock(),e.createElementBlock("section",cn,[e.createElementVNode("h3",dn,[e.createVNode(e.unref(Se),{size:14}),o[10]||(o[10]=e.createTextVNode(" Response Schema ",-1))]),e.createElementVNode("p",mn,e.toDisplayString(n.endpoint.responseSchema),1)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("section",pn,[e.createElementVNode("h3",un,[e.createVNode(e.unref(it),{size:14}),o[11]||(o[11]=e.createTextVNode(" Security ",-1))]),e.createElementVNode("div",fn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.name,class:"endpoint-detail__security-item"},[e.createElementVNode("span",yn,e.toDisplayString(u.name),1),e.createElementVNode("span",hn,e.toDisplayString(u.scopes),1)]))),128))])])):e.createCommentVNode("",!0)])])):(e.openBlock(),e.createElementBlock("div",jt,[e.createVNode(e.unref(Se),{size:48,class:"endpoint-detail__empty-icon"}),o[0]||(o[0]=e.createElementVNode("h3",{class:"endpoint-detail__empty-title"},"No endpoint selected",-1)),o[1]||(o[1]=e.createElementVNode("p",{class:"endpoint-detail__empty-text text-muted"}," Select an endpoint from the list to view its details ",-1))]))]))}}),[["__scopeId","data-v-c66a0f52"]]),gn={class:"endpoint-list"},kn={key:0,class:"endpoint-list__empty"},En={key:1,class:"endpoint-list__groups"},Nn=["aria-expanded","aria-controls","onClick"],bn={class:"endpoint-group__tag"},Vn={class:"endpoint-group__count text-muted"},Sn=["id","aria-label"],Bn=["aria-selected","onClick"],Cn={class:"endpoint-item__path font-mono"},$n={class:"endpoint-item__indicators"},xn={key:0,class:"endpoint-item__indicator endpoint-item__indicator--handler",title:"Has custom handler"},wn={key:1,class:"endpoint-item__indicator endpoint-item__indicator--seed",title:"Has seed data"},Dn=U(e.defineComponent({__name:"EndpointList",props:{groups:{},selectedKey:{}},emits:["select","toggle-group"],setup(n,{emit:t}){const s=n,l=t;function r(E){l("select",E.key)}function o(E){l("toggle-group",E)}function u(E){return s.selectedKey===E.key}return(E,_)=>(e.openBlock(),e.createElementBlock("div",gn,[n.groups.length===0?(e.openBlock(),e.createElementBlock("div",kn,[..._[0]||(_[0]=[e.createElementVNode("p",{class:"text-muted"},"No endpoints found",-1)])])):(e.openBlock(),e.createElementBlock("div",En,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.groups,a=>(e.openBlock(),e.createElementBlock("div",{key:a.tag,class:"endpoint-group"},[e.createElementVNode("button",{type:"button",class:"endpoint-group__header","aria-expanded":a.isExpanded,"aria-controls":`group-${a.tag}`,onClick:b=>o(a.tag)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.isExpanded?e.unref(X):e.unref(te)),{size:16,class:"endpoint-group__chevron"})),e.createElementVNode("span",bn,e.toDisplayString(a.tag),1),e.createElementVNode("span",Vn," ("+e.toDisplayString(a.endpoints.length)+") ",1)],8,Nn),e.withDirectives(e.createElementVNode("div",{id:`group-${a.tag}`,class:"endpoint-group__items",role:"group","aria-label":`${a.tag} endpoints`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.endpoints,b=>(e.openBlock(),e.createElementBlock("button",{key:b.key,type:"button",class:e.normalizeClass(["endpoint-item",{"endpoint-item--selected":u(b)}]),"aria-selected":u(b),onClick:B=>r(b)},[e.createElementVNode("span",{class:e.normalizeClass(["method-badge",`method-badge--${b.method}`])},e.toDisplayString(e.unref(Ee)(b.method)),3),e.createElementVNode("span",Cn,e.toDisplayString(b.path),1),e.createElementVNode("div",$n,[b.hasHandler?(e.openBlock(),e.createElementBlock("span",xn,[e.createVNode(e.unref(be),{size:12})])):e.createCommentVNode("",!0),b.hasSeed?(e.openBlock(),e.createElementBlock("span",wn,[e.createVNode(e.unref(Ce),{size:12})])):e.createCommentVNode("",!0)])],10,Bn))),128))],8,Sn),[[e.vShow,a.isExpanded]])]))),128))]))]))}}),[["__scopeId","data-v-554ffe63"]]),Tn={class:"routes-page"},In={class:"routes-toolbar"},zn={class:"routes-search"},Mn=["value"],qn=["aria-expanded"],Fn={key:0,class:"routes-filter-toggle__badge"},Ln={class:"routes-stats"},An={class:"routes-stats__item"},Rn={class:"routes-stats__item"},On={key:0,class:"routes-filters"},Pn={class:"routes-filters__section"},Hn={class:"routes-filters__methods"},jn=["onClick"],Un={class:"routes-filters__section"},Jn={class:"routes-filters__status"},Qn={key:0,class:"routes-filters__actions"},Wn={class:"routes-content"},Gn={key:0,class:"routes-loading"},Kn={key:1,class:"routes-error"},Zn={class:"routes-error__message"},Yn={key:2,class:"routes-empty empty-state"},Xn={key:3,class:"routes-empty empty-state"},vn={class:"routes-list-panel"},eo={class:"routes-detail-panel"},to=Object.freeze(Object.defineProperty({__proto__:null,default:U(e.defineComponent({__name:"RoutesPage",setup(n){const t=Je(),{send:s,on:l,connected:r}=se(),o=e.ref(!1),u=e.ref(null),E=["get","post","put","patch","delete","options","head","trace"];function _(){r.value&&(t.setLoading(!0),s({type:"get:registry"}))}function a(h){t.setRegistryData(h),t.setLoading(!1)}function b(h){t.selectEndpoint(h)}function B(h){t.toggleGroup(h)}function $(h){const m=h.target;t.setSearchQuery(m.value)}function w(){t.setSearchQuery(""),u.value?.focus()}function F(h){t.toggleMethodFilter(h)}function C(h){return t.filter.methods.includes(h)}function S(){const h=t.filter.hasHandler;t.setHandlerFilter(h===!0?null:!0)}function y(){const h=t.filter.hasSeed;t.setSeedFilter(h===!0?null:!0)}function f(){t.clearFilters()}function d(){o.value=!o.value}const x=e.computed(()=>t.hasActiveFilters());let A=null,k=null,p=null;return e.onMounted(()=>{A=l("registry",a),k=l("handlers:updated",()=>_()),p=l("seeds:updated",()=>_()),r.value&&_()}),e.onUnmounted(()=>{A?.(),k?.(),p?.()}),e.watch(r,h=>{h&&_()}),(h,m)=>(e.openBlock(),e.createElementBlock("div",Tn,[e.createElementVNode("div",In,[e.createElementVNode("div",zn,[e.createVNode(e.unref(ue),{size:16,class:"routes-search__icon"}),e.createElementVNode("input",{ref_key:"searchInputRef",ref:u,type:"text",class:"routes-search__input input",placeholder:"Search endpoints...",value:e.unref(t).searchQuery,onInput:$},null,40,Mn),e.unref(t).searchQuery?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"routes-search__clear btn btn--ghost btn--icon",title:"Clear search",onClick:w},[e.createVNode(e.unref(ae),{size:14})])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["routes-filter-toggle btn btn--secondary",{"routes-filter-toggle--active":x.value}]),"aria-expanded":o.value,onClick:d},[e.createVNode(e.unref(Re),{size:16}),m[0]||(m[0]=e.createElementVNode("span",null,"Filters",-1)),x.value?(e.openBlock(),e.createElementBlock("span",Fn,e.toDisplayString(e.unref(t).filter.methods.length+(e.unref(t).filter.hasHandler?1:0)+(e.unref(t).filter.hasSeed?1:0)),1)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value?e.unref(Ae):e.unref(X)),{size:14}))],10,qn),e.createElementVNode("div",Ln,[e.createElementVNode("span",An,e.toDisplayString(e.unref(t).filteredEndpoints.length)+" endpoints ",1),m[1]||(m[1]=e.createElementVNode("span",{class:"routes-stats__separator"},"|",-1)),e.createElementVNode("span",Rn,e.toDisplayString(e.unref(t).allTags.length)+" tags ",1)])]),o.value?(e.openBlock(),e.createElementBlock("div",On,[e.createElementVNode("div",Pn,[m[2]||(m[2]=e.createElementVNode("h4",{class:"routes-filters__title"},"Methods",-1)),e.createElementVNode("div",Hn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(E,M=>e.createElementVNode("button",{key:M,type:"button",class:e.normalizeClass(["method-badge",`method-badge--${M}`,{"method-badge--inactive":!C(M)&&e.unref(t).filter.methods.length>0}]),onClick:g=>F(M)},e.toDisplayString(M.toUpperCase()),11,jn)),64))])]),e.createElementVNode("div",Un,[m[5]||(m[5]=e.createElementVNode("h4",{class:"routes-filters__title"},"Status",-1)),e.createElementVNode("div",Jn,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["routes-filters__status-btn",{"routes-filters__status-btn--active":e.unref(t).filter.hasHandler}]),onClick:S},[e.createVNode(e.unref(be),{size:14}),m[3]||(m[3]=e.createElementVNode("span",null,"Has Handler",-1))],2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["routes-filters__status-btn",{"routes-filters__status-btn--active":e.unref(t).filter.hasSeed}]),onClick:y},[e.createVNode(e.unref(Ce),{size:14}),m[4]||(m[4]=e.createElementVNode("span",null,"Has Seed",-1))],2)])]),x.value?(e.openBlock(),e.createElementBlock("div",Qn,[e.createElementVNode("button",{type:"button",class:"btn btn--ghost",onClick:f},[e.createVNode(e.unref(ae),{size:14}),m[6]||(m[6]=e.createTextVNode(" Clear all filters ",-1))])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Wn,[e.unref(t).isLoading?(e.openBlock(),e.createElementBlock("div",Gn,[...m[7]||(m[7]=[e.createElementVNode("div",{class:"routes-loading__spinner"},null,-1),e.createElementVNode("span",{class:"text-muted"},"Loading endpoints...",-1)])])):e.unref(t).error?(e.openBlock(),e.createElementBlock("div",Kn,[e.createElementVNode("p",Zn,e.toDisplayString(e.unref(t).error),1),e.createElementVNode("button",{type:"button",class:"btn btn--primary",onClick:_}," Retry ")])):e.unref(t).endpoints.length===0?(e.openBlock(),e.createElementBlock("div",Yn,[e.createVNode(e.unref(Be),{size:48,class:"empty-state__icon"}),m[8]||(m[8]=e.createElementVNode("h3",{class:"empty-state__title"},"No endpoints found",-1)),m[9]||(m[9]=e.createElementVNode("p",{class:"empty-state__description"}," No API endpoints are available. Make sure your OpenAPI spec is loaded. ",-1))])):e.unref(t).filteredEndpoints.length===0?(e.openBlock(),e.createElementBlock("div",Xn,[e.createVNode(e.unref(ue),{size:48,class:"empty-state__icon"}),m[10]||(m[10]=e.createElementVNode("h3",{class:"empty-state__title"},"No matching endpoints",-1)),m[11]||(m[11]=e.createElementVNode("p",{class:"empty-state__description"}," Try adjusting your search or filters. ",-1)),x.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn--secondary",onClick:f}," Clear filters ")):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createElementVNode("div",vn,[e.createVNode(Dn,{groups:e.unref(t).groupedEndpoints,"selected-key":e.unref(t).selectedEndpointKey,onSelect:b,onToggleGroup:B},null,8,["groups","selected-key"])]),e.createElementVNode("div",eo,[e.createVNode(_n,{endpoint:e.unref(t).selectedEndpoint},null,8,["endpoint"])])],64))])]))}}),[["__scopeId","data-v-bdd419e3"]])},Symbol.toStringTag,{value:"Module"})),no={class:"timeline-detail"},oo={key:0,class:"timeline-detail__empty"},so={key:1,class:"timeline-detail__content"},lo={class:"timeline-detail__header"},ao={class:"timeline-detail__summary"},ro={class:"timeline-detail__path font-mono"},io={class:"timeline-detail__meta"},co={key:1,class:"status-badge status-badge--pending"},mo={class:"timeline-detail__duration"},po={key:2,class:"timeline-detail__simulated",title:"Simulated response"},uo={class:"timeline-detail__actions"},fo={class:"timeline-detail__info"},yo={class:"timeline-detail__info-item"},ho={class:"timeline-detail__info-value font-mono"},_o={class:"timeline-detail__info-item"},go={class:"timeline-detail__info-value font-mono"},ko={class:"timeline-detail__info-item"},Eo={class:"timeline-detail__info-value font-mono"},No={class:"timeline-detail__section"},bo={key:0,class:"timeline-detail__subsection"},Vo=["aria-expanded"],So={class:"text-muted"},Bo={id:"requestQuery-panel",class:"timeline-detail__subsection-content"},Co={class:"timeline-detail__kv-key font-mono"},$o={class:"timeline-detail__kv-value font-mono"},xo={key:1,class:"timeline-detail__subsection"},wo=["aria-expanded"],Do={class:"text-muted"},To={id:"requestHeaders-panel",class:"timeline-detail__subsection-content"},Io={class:"timeline-detail__kv-key font-mono"},zo={class:"timeline-detail__kv-value font-mono"},Mo={key:2,class:"timeline-detail__subsection"},qo={class:"timeline-detail__subsection-header",role:"group"},Fo=["aria-expanded"],Lo={id:"requestBody-panel",class:"timeline-detail__subsection-content"},Ao={class:"timeline-detail__json"},Ro={key:0,class:"timeline-detail__section"},Oo={key:0,class:"timeline-detail__subsection"},Po=["aria-expanded"],Ho={class:"text-muted"},jo={id:"responseHeaders-panel",class:"timeline-detail__subsection-content"},Uo={class:"timeline-detail__kv-key font-mono"},Jo={class:"timeline-detail__kv-value font-mono"},Qo={key:1,class:"timeline-detail__subsection"},Wo={class:"timeline-detail__subsection-header",role:"group"},Go=["aria-expanded"],Ko={id:"responseBody-panel",class:"timeline-detail__subsection-content"},Zo={class:"timeline-detail__json"},Yo={key:1,class:"timeline-detail__section timeline-detail__section--pending"},Xo={class:"timeline-detail__pending"},vo=U(e.defineComponent({__name:"TimelineDetail",props:{entry:{}},setup(n){const t=n,s=e.ref({requestHeaders:!0,requestQuery:!0,requestBody:!0,responseHeaders:!0,responseBody:!0}),l=e.ref(null),r=e.computed(()=>t.entry?new Date(t.entry.request.timestamp).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,hour12:!1}):""),o=e.computed(()=>t.entry?.duration==null?"pending...":t.entry.duration<1e3?`${t.entry.duration}ms`:`${(t.entry.duration/1e3).toFixed(2)}s`),u=e.computed(()=>t.entry?.status?t.entry.status<200?"status-badge--1xx":t.entry.status<300?"status-badge--2xx":t.entry.status<400?"status-badge--3xx":t.entry.status<500?"status-badge--4xx":"status-badge--5xx":"status-badge--pending"),E=e.computed(()=>t.entry?.request.query?Object.keys(t.entry.request.query).length>0:!1),_=e.computed(()=>t.entry?.request.headers?Object.keys(t.entry.request.headers).length>0:!1),a=e.computed(()=>t.entry?.request.body!==void 0&&t.entry?.request.body!==null),b=e.computed(()=>t.entry?.response?.headers?Object.keys(t.entry.response.headers).length>0:!1),B=e.computed(()=>t.entry?.response?.body!==void 0&&t.entry?.response?.body!==null);function $(S){try{return JSON.stringify(S,null,2)}catch{return String(S)}}function w(S){s.value[S]=!s.value[S]}async function F(S,y){try{await navigator.clipboard.writeText(S),l.value=y,setTimeout(()=>{l.value=null},2e3)}catch(f){console.error("Failed to copy:",f)}}async function C(){if(!t.entry)return;const S={request:t.entry.request,response:t.entry.response};await F(JSON.stringify(S,null,2),"full")}return(S,y)=>(e.openBlock(),e.createElementBlock("div",no,[n.entry?(e.openBlock(),e.createElementBlock("div",so,[e.createElementVNode("div",lo,[e.createElementVNode("div",ao,[e.createElementVNode("span",{class:e.normalizeClass(["method-badge",`method-badge--${n.entry.request.method.toLowerCase()}`])},e.toDisplayString(e.unref(Ee)(n.entry.request.method)),3),e.createElementVNode("span",ro,e.toDisplayString(n.entry.request.path),1)]),e.createElementVNode("div",io,[n.entry.status!==null?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["status-badge",u.value])},e.toDisplayString(n.entry.status),3)):(e.openBlock(),e.createElementBlock("span",co,"pending")),e.createElementVNode("span",mo,[e.createVNode(e.unref(G),{size:14}),e.createTextVNode(" "+e.toDisplayString(o.value),1)]),n.entry.simulated?(e.openBlock(),e.createElementBlock("span",po,[e.createVNode(e.unref(ne),{size:14}),y[9]||(y[9]=e.createTextVNode(" Simulated ",-1))])):e.createCommentVNode("",!0)]),e.createElementVNode("div",uo,[e.createElementVNode("button",{type:"button",class:"btn btn--ghost btn--sm",title:"Copy as JSON",onClick:C},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value==="full"?e.unref(me):e.unref(Ve)),{size:14})),e.createTextVNode(" "+e.toDisplayString(l.value==="full"?"Copied!":"Copy JSON"),1)])])]),e.createElementVNode("div",fo,[e.createElementVNode("div",yo,[y[10]||(y[10]=e.createElementVNode("span",{class:"timeline-detail__info-label"},"Timestamp",-1)),e.createElementVNode("span",ho,e.toDisplayString(r.value),1)]),e.createElementVNode("div",_o,[y[11]||(y[11]=e.createElementVNode("span",{class:"timeline-detail__info-label"},"Operation ID",-1)),e.createElementVNode("span",go,e.toDisplayString(n.entry.request.operationId),1)]),e.createElementVNode("div",ko,[y[12]||(y[12]=e.createElementVNode("span",{class:"timeline-detail__info-label"},"Request ID",-1)),e.createElementVNode("span",Eo,e.toDisplayString(n.entry.id),1)])]),e.createElementVNode("div",No,[y[16]||(y[16]=e.createElementVNode("h3",{class:"timeline-detail__section-title"},"Request",-1)),E.value?(e.openBlock(),e.createElementBlock("div",bo,[e.createElementVNode("button",{type:"button",class:"timeline-detail__subsection-header","aria-expanded":s.value.requestQuery,"aria-controls":"requestQuery-panel",onClick:y[0]||(y[0]=f=>w("requestQuery"))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value.requestQuery?e.unref(X):e.unref(te)),{size:16})),y[13]||(y[13]=e.createElementVNode("span",null,"Query Parameters",-1)),e.createElementVNode("span",So,"("+e.toDisplayString(Object.keys(n.entry.request.query).length)+")",1)],8,Vo),e.withDirectives(e.createElementVNode("div",Bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.entry.request.query,(f,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"timeline-detail__kv-row"},[e.createElementVNode("span",Co,e.toDisplayString(d),1),e.createElementVNode("span",$o,e.toDisplayString(Array.isArray(f)?f.join(", "):f),1)]))),128))],512),[[e.vShow,s.value.requestQuery]])])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",xo,[e.createElementVNode("button",{type:"button",class:"timeline-detail__subsection-header","aria-expanded":s.value.requestHeaders,"aria-controls":"requestHeaders-panel",onClick:y[1]||(y[1]=f=>w("requestHeaders"))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value.requestHeaders?e.unref(X):e.unref(te)),{size:16})),y[14]||(y[14]=e.createElementVNode("span",null,"Headers",-1)),e.createElementVNode("span",Do,"("+e.toDisplayString(Object.keys(n.entry.request.headers).length)+")",1)],8,wo),e.withDirectives(e.createElementVNode("div",To,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.entry.request.headers,(f,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"timeline-detail__kv-row"},[e.createElementVNode("span",Io,e.toDisplayString(d),1),e.createElementVNode("span",zo,e.toDisplayString(f),1)]))),128))],512),[[e.vShow,s.value.requestHeaders]])])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("div",Mo,[e.createElementVNode("div",qo,[e.createElementVNode("button",{type:"button",class:"timeline-detail__subsection-toggle","aria-expanded":s.value.requestBody,"aria-controls":"requestBody-panel",onClick:y[2]||(y[2]=f=>w("requestBody"))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value.requestBody?e.unref(X):e.unref(te)),{size:16})),y[15]||(y[15]=e.createElementVNode("span",null,"Body",-1))],8,Fo),e.createElementVNode("button",{type:"button",class:"btn btn--ghost btn--icon btn--sm",title:"Copy body",onClick:y[3]||(y[3]=e.withModifiers(f=>F($(n.entry.request.body),"reqBody"),["stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value==="reqBody"?e.unref(me):e.unref(Ve)),{size:12}))])]),e.withDirectives(e.createElementVNode("div",Lo,[e.createElementVNode("pre",Ao,e.toDisplayString($(n.entry.request.body)),1)],512),[[e.vShow,s.value.requestBody]])])):e.createCommentVNode("",!0)]),n.entry.response?(e.openBlock(),e.createElementBlock("div",Ro,[y[19]||(y[19]=e.createElementVNode("h3",{class:"timeline-detail__section-title"},"Response",-1)),b.value?(e.openBlock(),e.createElementBlock("div",Oo,[e.createElementVNode("button",{type:"button",class:"timeline-detail__subsection-header","aria-expanded":s.value.responseHeaders,"aria-controls":"responseHeaders-panel",onClick:y[4]||(y[4]=f=>w("responseHeaders"))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value.responseHeaders?e.unref(X):e.unref(te)),{size:16})),y[17]||(y[17]=e.createElementVNode("span",null,"Headers",-1)),e.createElementVNode("span",Ho,"("+e.toDisplayString(Object.keys(n.entry.response.headers).length)+")",1)],8,Po),e.withDirectives(e.createElementVNode("div",jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.entry.response.headers,(f,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"timeline-detail__kv-row"},[e.createElementVNode("span",Uo,e.toDisplayString(d),1),e.createElementVNode("span",Jo,e.toDisplayString(f),1)]))),128))],512),[[e.vShow,s.value.responseHeaders]])])):e.createCommentVNode("",!0),B.value?(e.openBlock(),e.createElementBlock("div",Qo,[e.createElementVNode("div",Wo,[e.createElementVNode("button",{type:"button",class:"timeline-detail__subsection-toggle","aria-expanded":s.value.responseBody,"aria-controls":"responseBody-panel",onClick:y[5]||(y[5]=f=>w("responseBody"))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value.responseBody?e.unref(X):e.unref(te)),{size:16})),y[18]||(y[18]=e.createElementVNode("span",null,"Body",-1))],8,Go),e.createElementVNode("button",{type:"button",class:"btn btn--ghost btn--icon btn--sm",title:"Copy body",onClick:y[6]||(y[6]=e.withModifiers(f=>F($(n.entry.response.body),"resBody"),["stop"]))},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value==="resBody"?e.unref(me):e.unref(Ve)),{size:12}))])]),e.withDirectives(e.createElementVNode("div",Ko,[e.createElementVNode("pre",Zo,e.toDisplayString($(n.entry.response.body)),1)],512),[[e.vShow,s.value.responseBody]])])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",Yo,[y[21]||(y[21]=e.createElementVNode("h3",{class:"timeline-detail__section-title"},"Response",-1)),e.createElementVNode("div",Xo,[e.createVNode(e.unref(G),{size:24,class:"timeline-detail__pending-icon"}),y[20]||(y[20]=e.createElementVNode("span",{class:"text-muted"},"Waiting for response...",-1))])]))])):(e.openBlock(),e.createElementBlock("div",oo,[e.createVNode(e.unref(G),{size:48,class:"timeline-detail__empty-icon"}),y[7]||(y[7]=e.createElementVNode("h3",{class:"timeline-detail__empty-title"},"Select an entry",-1)),y[8]||(y[8]=e.createElementVNode("p",{class:"timeline-detail__empty-description"}," Click on a timeline entry to view its details. ",-1))]))]))}}),[["__scopeId","data-v-b4bdd2d2"]]),es={class:"timeline-entry__time font-mono text-muted"},ts={class:"timeline-entry__method"},ns={class:"timeline-entry__path font-mono"},os={class:"timeline-entry__status"},ss={key:1,class:"status-badge status-badge--pending"},ls={class:"timeline-entry__duration font-mono text-muted"},as={key:0,class:"timeline-entry__simulated",title:"Simulated response"},rs=U(e.defineComponent({__name:"TimelineEntry",props:{entry:{},isSelected:{type:Boolean,default:!1}},emits:["select"],setup(n,{emit:t}){const s=n,l=t,r=e.computed(()=>new Date(s.entry.request.timestamp).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})),o=e.computed(()=>s.entry.duration===null?"pending...":s.entry.duration<1e3?`${s.entry.duration}ms`:`${(s.entry.duration/1e3).toFixed(2)}s`),u=e.computed(()=>s.entry.status===null?"status-badge--pending":s.entry.status<200?"status-badge--1xx":s.entry.status<300?"status-badge--2xx":s.entry.status<400?"status-badge--3xx":s.entry.status<500?"status-badge--4xx":"status-badge--5xx"),E=e.computed(()=>s.entry.status===null?G:s.entry.status<400?ot:$e),_=e.computed(()=>s.entry.response===null);function a(){l("select",s.entry.id)}return(b,B)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass(["timeline-entry",{"timeline-entry--selected":n.isSelected},{"timeline-entry--pending":_.value},{"timeline-entry--simulated":n.entry.simulated}]),onClick:a},[e.createElementVNode("div",es,e.toDisplayString(r.value),1),e.createElementVNode("div",ts,[e.createElementVNode("span",{class:e.normalizeClass(["method-badge",`method-badge--${n.entry.request.method.toLowerCase()}`])},e.toDisplayString(e.unref(Ee)(n.entry.request.method)),3)]),e.createElementVNode("div",ns,e.toDisplayString(n.entry.request.path),1),e.createElementVNode("div",os,[n.entry.status!==null?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["status-badge",u.value])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(E.value),{size:12})),e.createTextVNode(" "+e.toDisplayString(n.entry.status),1)],2)):(e.openBlock(),e.createElementBlock("span",ss,[e.createVNode(e.unref(G),{size:12}),B[0]||(B[0]=e.createTextVNode(" pending ",-1))]))]),e.createElementVNode("div",ls,e.toDisplayString(o.value),1),n.entry.simulated?(e.openBlock(),e.createElementBlock("div",as,[e.createVNode(e.unref(ne),{size:14})])):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-a073dbdf"]]),is={class:"timeline-page"},cs={class:"timeline-toolbar"},ds={class:"timeline-search"},ms=["value"],ps=["aria-expanded"],us={key:0,class:"timeline-filter-toggle__badge"},fs={class:"timeline-stats"},ys={class:"timeline-stats__item"},hs={key:0,class:"timeline-stats__separator"},_s={key:1,class:"timeline-stats__item"},gs=["disabled"],ks={key:0,class:"timeline-filters"},Es={class:"timeline-filters__section"},Ns={class:"timeline-filters__methods"},bs=["onClick"],Vs={class:"timeline-filters__section"},Ss={class:"timeline-filters__status"},Bs=["onClick"],Cs={class:"timeline-filters__status-count"},$s={class:"timeline-filters__section"},xs={class:"timeline-filters__type"},ws={key:0,class:"timeline-filters__actions"},Ds={class:"timeline-content"},Ts={key:0,class:"timeline-loading"},Is={key:1,class:"timeline-error"},zs={class:"timeline-error__message"},Ms={key:2,class:"timeline-empty empty-state"},qs={key:3,class:"timeline-empty empty-state"},Fs={class:"timeline-list-panel"},Ls={class:"timeline-list"},As={class:"timeline-detail-panel"},Rs=Object.freeze(Object.defineProperty({__proto__:null,default:U(e.defineComponent({__name:"TimelinePage",setup(n){const t=At(),{send:s,on:l,connected:r}=se(),o=e.ref(!1),u=e.ref(null),E=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD","TRACE"],_=["2xx","3xx","4xx","5xx"];function a(){r.value&&(t.setLoading(!0),s({type:"get:timeline"}))}function b(q){t.setTimelineData(q),t.setLoading(!1)}function B(q){t.addRequest(q)}function $(q){t.addResponse(q)}function w(){t.clearTimeline()}function F(){s({type:"clear:timeline"}),t.clearTimeline()}function C(q){t.selectEntry(q)}function S(q){const i=q.target;t.setSearchQuery(i.value)}function y(){t.setSearchQuery(""),u.value?.focus()}function f(q){t.toggleMethodFilter(q)}function d(q){return t.filter.methods.includes(q)}function x(q){t.toggleStatusFilter(q)}function A(q){return t.filter.statusCodes.includes(q)}function k(){const q=t.filter.simulatedOnly;t.setSimulatedFilter(q===!0?null:!0)}function p(){t.clearFilters()}function h(){o.value=!o.value}const m=e.computed(()=>t.hasActiveFilters()),M=e.computed(()=>t.filter.methods.length+t.filter.statusCodes.length+(t.filter.simulatedOnly!==null?1:0));let g=null,T=null,R=null,H=null;return e.onMounted(()=>{g=l("timeline",b),T=l("request",B),R=l("response",$),H=l("timeline:cleared",w),r.value&&a()}),e.onUnmounted(()=>{g?.(),T?.(),R?.(),H?.()}),e.watch(r,q=>{q&&a()}),(q,i)=>(e.openBlock(),e.createElementBlock("div",is,[e.createElementVNode("div",cs,[e.createElementVNode("div",ds,[e.createVNode(e.unref(ue),{size:16,class:"timeline-search__icon"}),e.createElementVNode("input",{ref_key:"searchInputRef",ref:u,type:"text",class:"timeline-search__input input",placeholder:"Search by path or operation...",value:e.unref(t).filter.searchQuery,onInput:S},null,40,ms),e.unref(t).filter.searchQuery?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"timeline-search__clear btn btn--ghost btn--icon",title:"Clear search",onClick:y},[e.createVNode(e.unref(ae),{size:14})])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["timeline-filter-toggle btn btn--secondary",{"timeline-filter-toggle--active":m.value}]),"aria-expanded":o.value,onClick:h},[e.createVNode(e.unref(Re),{size:16}),i[0]||(i[0]=e.createElementVNode("span",null,"Filters",-1)),M.value>0?(e.openBlock(),e.createElementBlock("span",us,e.toDisplayString(M.value),1)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value?e.unref(Ae):e.unref(X)),{size:14}))],10,ps),e.createElementVNode("div",fs,[e.createElementVNode("span",ys,e.toDisplayString(e.unref(t).filteredEntries.length)+" requests ",1),e.unref(t).averageDuration>0?(e.openBlock(),e.createElementBlock("span",hs,"|")):e.createCommentVNode("",!0),e.unref(t).averageDuration>0?(e.openBlock(),e.createElementBlock("span",_s," avg "+e.toDisplayString(e.unref(t).averageDuration)+"ms ",1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"btn btn--secondary btn--icon",title:"Clear timeline",disabled:e.unref(t).entries.length===0,onClick:F},[e.createVNode(e.unref(fe),{size:16})],8,gs)]),o.value?(e.openBlock(),e.createElementBlock("div",ks,[e.createElementVNode("div",Es,[i[1]||(i[1]=e.createElementVNode("h4",{class:"timeline-filters__title"},"Methods",-1)),e.createElementVNode("div",Ns,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(E,N=>e.createElementVNode("button",{key:N,type:"button",class:e.normalizeClass(["method-badge",`method-badge--${N.toLowerCase()}`,{"method-badge--inactive":!d(N)&&e.unref(t).filter.methods.length>0}]),onClick:D=>f(N)},e.toDisplayString(N),11,bs)),64))])]),e.createElementVNode("div",Vs,[i[2]||(i[2]=e.createElementVNode("h4",{class:"timeline-filters__title"},"Status",-1)),e.createElementVNode("div",Ss,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(_,N=>e.createElementVNode("button",{key:N,type:"button",class:e.normalizeClass(["timeline-filters__status-btn",`timeline-filters__status-btn--${N}`,{"timeline-filters__status-btn--active":A(N)}]),onClick:D=>x(N)},[e.createTextVNode(e.toDisplayString(N)+" ",1),e.createElementVNode("span",Cs," ("+e.toDisplayString(e.unref(t).statusCounts[N])+") ",1)],10,Bs)),64))])]),e.createElementVNode("div",$s,[i[3]||(i[3]=e.createElementVNode("h4",{class:"timeline-filters__title"},"Type",-1)),e.createElementVNode("div",xs,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["timeline-filters__status-btn",{"timeline-filters__status-btn--active":e.unref(t).filter.simulatedOnly}]),onClick:k}," Simulated only ",2)])]),m.value?(e.openBlock(),e.createElementBlock("div",ws,[e.createElementVNode("button",{type:"button",class:"btn btn--ghost",onClick:p},[e.createVNode(e.unref(ae),{size:14}),i[4]||(i[4]=e.createTextVNode(" Clear all filters ",-1))])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Ds,[e.unref(t).isLoading?(e.openBlock(),e.createElementBlock("div",Ts,[...i[5]||(i[5]=[e.createElementVNode("div",{class:"timeline-loading__spinner"},null,-1),e.createElementVNode("span",{class:"text-muted"},"Loading timeline...",-1)])])):e.unref(t).error?(e.openBlock(),e.createElementBlock("div",Is,[e.createElementVNode("p",zs,e.toDisplayString(e.unref(t).error),1),e.createElementVNode("button",{type:"button",class:"btn btn--primary",onClick:a}," Retry ")])):e.unref(t).entries.length===0?(e.openBlock(),e.createElementBlock("div",Ms,[e.createVNode(e.unref(G),{size:48,class:"empty-state__icon"}),i[6]||(i[6]=e.createElementVNode("h3",{class:"empty-state__title"},"No requests yet",-1)),i[7]||(i[7]=e.createElementVNode("p",{class:"empty-state__description"}," API requests will appear here in real-time as they are made. ",-1))])):e.unref(t).filteredEntries.length===0?(e.openBlock(),e.createElementBlock("div",qs,[e.createVNode(e.unref(ue),{size:48,class:"empty-state__icon"}),i[8]||(i[8]=e.createElementVNode("h3",{class:"empty-state__title"},"No matching requests",-1)),i[9]||(i[9]=e.createElementVNode("p",{class:"empty-state__description"}," Try adjusting your search or filters. ",-1)),m.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"btn btn--secondary",onClick:p}," Clear filters ")):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createElementVNode("div",Fs,[e.createElementVNode("div",Ls,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).filteredEntries,N=>(e.openBlock(),e.createBlock(rs,{key:N.id,entry:N,"is-selected":e.unref(t).selectedEntryId===N.id,onSelect:C},null,8,["entry","is-selected"]))),128))])]),e.createElementVNode("div",As,[e.createVNode(vo,{entry:e.unref(t).selectedEntry},null,8,["entry"])])],64))])]))}}),[["__scopeId","data-v-a5c73778"]])},Symbol.toStringTag,{value:"Module"}));function Fe(n,t){return n.length<=t?n:`${n.slice(0,t)}…`}function Os(n){return n==null?"--":typeof n=="string"?Fe(n,50):typeof n=="number"||typeof n=="boolean"?String(n):Array.isArray(n)||typeof n=="object"?Fe(JSON.stringify(n),50):String(n)}function Ze(n,t){if(!(typeof n!="object"||n===null))return n[t]}function Ps(n,t,s){const l=Ze(n,t);return typeof l=="string"||typeof l=="number"?l:s}function Hs(n,t){if(n.length===0)return[];const s=new Set;for(const r of n)if(typeof r=="object"&&r!==null)for(const o of Object.keys(r))s.add(o);if(s.size===0)return[];const l=Array.from(s);return l.includes(t)?[t,...l.filter(r=>r!==t)]:l}const js={class:"data-table"},Us={key:0,class:"data-table__empty"},Js={key:1,class:"data-table__container"},Qs={class:"data-table__table"},Ws=["onClick"],Gs={class:"data-table__row-num"},Ks={key:2,class:"data-table__footer"},Zs={class:"data-table__info"},Ys={class:"data-table__info"},Xs=U(e.defineComponent({__name:"DataTable",props:{items:{},idField:{},selectedIndex:{default:-1}},emits:["select"],setup(n,{emit:t}){const s=n,l=t,r=e.computed(()=>Hs(s.items,s.idField));function o(E){l("select",E)}function u(E,_){return Ps(E,s.idField,_)}return(E,_)=>(e.openBlock(),e.createElementBlock("div",js,[n.items.length===0?(e.openBlock(),e.createElementBlock("div",Us,[e.createVNode(e.unref(pe),{size:32,class:"data-table__empty-icon"}),_[0]||(_[0]=e.createElementVNode("span",null,"No items",-1))])):(e.openBlock(),e.createElementBlock("div",Js,[e.createElementVNode("table",Qs,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[_[1]||(_[1]=e.createElementVNode("th",{class:"data-table__row-num"},"#",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,a=>(e.openBlock(),e.createElementBlock("th",{key:a,class:e.normalizeClass(["data-table__header",{"data-table__header--id":a===n.idField}])},e.toDisplayString(a),3))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(a,b)=>(e.openBlock(),e.createElementBlock("tr",{key:u(a,b),class:e.normalizeClass(["data-table__row",{"data-table__row--selected":b===n.selectedIndex}]),onClick:B=>o(b)},[e.createElementVNode("td",Gs,e.toDisplayString(b+1),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,B=>(e.openBlock(),e.createElementBlock("td",{key:B,class:e.normalizeClass(["data-table__cell",{"data-table__cell--id":B===n.idField}])},e.toDisplayString(e.unref(Os)(e.unref(Ze)(a,B))),3))),128))],10,Ws))),128))])])])),n.items.length>0?(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("span",Zs,e.toDisplayString(n.items.length)+" items",1),e.createElementVNode("span",Ys,e.toDisplayString(r.value.length)+" columns",1)])):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-dcdce8f7"]]),vs={class:"json-editor"},el={class:"json-editor__container"},tl={class:"json-editor__lines","aria-hidden":"true"},nl=["value","readonly","placeholder"],ol={class:"json-editor__status"},sl={class:"json-editor__status-left"},ll={key:0,class:"json-editor__valid"},al={key:1,class:"json-editor__error"},rl={class:"json-editor__status-right"},il={class:"json-editor__info"},cl=U(e.defineComponent({__name:"JsonEditor",props:{modelValue:{},readonly:{type:Boolean,default:!1},placeholder:{default:"Enter JSON data..."},minHeight:{default:200}},emits:["update:modelValue"],setup(n,{expose:t,emit:s}){const l=n,r=s,o=e.ref(""),u=e.ref(null),E=e.computed(()=>u.value===null),_=e.computed(()=>o.value.split(`
|
|
2
2
|
`).length),a=e.computed(()=>Array.from({length:_.value},(C,S)=>S+1));function b(){try{o.value=JSON.stringify(l.modelValue,null,2),u.value=null}catch{o.value="",u.value="Invalid initial value"}}b(),e.watch(()=>l.modelValue,()=>{try{const C=JSON.parse(o.value);JSON.stringify(C)!==JSON.stringify(l.modelValue)&&b()}catch{b()}});function B(C){const S=C.target;o.value=S.value,$()}function $(){if(o.value.trim()===""){u.value=null,r("update:modelValue",[]);return}try{const C=JSON.parse(o.value);u.value=null,r("update:modelValue",C)}catch(C){if(C instanceof Error){const S=C.message.match(/position (\d+)/);if(S){const y=Number.parseInt(S[1],10),f=o.value.substring(0,y).split(`
|
|
3
|
-
`),d=f.length,x=f[f.length-1].length+1;u.value=`Line ${d}, Column ${x}: ${C.message}`}else u.value=C.message}else u.value="Invalid JSON"}}function w(){try{const C=JSON.parse(o.value);o.value=JSON.stringify(C,null,2),u.value=null,r("update:modelValue",C)}catch{}}function F(C){if(C.key==="Tab"){C.preventDefault();const S=C.target,y=S.selectionStart,f=S.selectionEnd,d=`${o.value.substring(0,y)} ${o.value.substring(f)}`;o.value=d,setTimeout(()=>{S.selectionStart=S.selectionEnd=y+2},0),$()}}return t({formatJson:w,isValid:E}),(C,S)=>(e.openBlock(),e.createElementBlock("div",vs,[e.createElementVNode("div",el,[e.createElementVNode("div",tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y,class:"json-editor__line-number"},e.toDisplayString(y),1))),128))]),e.createElementVNode("textarea",{value:o.value,readonly:n.readonly,placeholder:n.placeholder,style:e.normalizeStyle({minHeight:`${n.minHeight}px`}),class:"json-editor__textarea",spellcheck:"false",onInput:B,onKeydown:F},null,44,nl)]),e.createElementVNode("div",ol,[e.createElementVNode("div",sl,[E.value?(e.openBlock(),e.createElementBlock("div",ll,[e.createVNode(e.unref(me),{size:14}),S[0]||(S[0]=e.createElementVNode("span",null,"Valid JSON",-1))])):u.value?(e.openBlock(),e.createElementBlock("div",al,[e.createVNode(e.unref(nt),{size:14}),e.createElementVNode("span",null,e.toDisplayString(u.value),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",rl,[e.createElementVNode("span",il,e.toDisplayString(_.value)+" lines",1)])])]))}}),[["__scopeId","data-v-dbd5ce20"]]),ie=e.ref([]),J=e.reactive({visible:!1,title:"",message:"",confirmText:"Confirm",cancelText:"Cancel",onConfirm:null,onCancel:null}),le=new Map;let P=null,dl=0;function ml(){return`toast-${Date.now()}-${dl++}`}function Ne(n,t,s=3e3){const l=ml(),r={id:l,type:n,message:t,duration:s,timestamp:Date.now()};if(ie.value.push(r),s>0){const o=setTimeout(()=>{Ye(l),le.delete(l)},s);le.set(l,o)}return l}function Ye(n){const t=le.get(n);t!==void 0&&(clearTimeout(t),le.delete(n));const s=ie.value.findIndex(l=>l.id===n);s!==-1&&ie.value.splice(s,1)}function pl(){function n(_,a){return Ne("success",_,a)}function t(_,a){return Ne("error",_,a)}function s(_,a){return Ne("info",_,a)}function l(_,a){return Ne("warning",_,a)}function r(_,a){return new Promise(b=>{P&&(P(!1),P=null),P=b,J.visible=!0,J.title=a?.title||"Confirm",J.message=_,J.confirmText=a?.confirmText||"Confirm",J.cancelText=a?.cancelText||"Cancel",J.onConfirm=()=>{J.visible=!1,P&&(P(!0),P=null)},J.onCancel=()=>{J.visible=!1,P&&(P(!1),P=null)}})}function o(){J.visible=!1,P&&(P(!1),P=null)}function u(_){Ye(_)}function E(){for(const _ of le.values())clearTimeout(_);le.clear(),ie.value=[]}return{toasts:ie,confirmDialog:J,success:n,error:t,info:s,warning:l,dismiss:u,clearAll:E,confirm:r,closeConfirm:o}}const ul={class:"models-page"},fl={class:"models-sidebar"},yl={class:"models-sidebar__header"},hl={class:"models-sidebar__badge"},_l={key:0,class:"models-sidebar__loading"},gl={key:1,class:"models-sidebar__list"},kl=["onClick"],El={class:"models-sidebar__name"},Nl={class:"models-sidebar__count"},bl={class:"models-sidebar__footer"},Vl={class:"models-sidebar__stat"},Sl={class:"font-mono"},Bl={class:"models-content"},Cl={class:"models-toolbar"},$l={class:"models-toolbar__title"},xl={class:"font-mono"},wl={class:"text-muted"},Dl={key:0,class:"models-toolbar__badge models-toolbar__badge--warning"},Tl={class:"models-toolbar__actions"},Il=["disabled"],zl=["disabled"],Ml={key:0,class:"models-error"},ql={class:"models-panels"},Fl={class:"models-panel"},Ll={class:"models-panel"},Al={key:1,class:"models-loading-overlay"},Rl={key:1,class:"empty-state"},Ol={key:0,class:"models-error"},Pl={class:"modal__body"},Hl={class:"modal__footer"},jl=Object.freeze(Object.defineProperty({__proto__:null,default:U(e.defineComponent({__name:"ModelsPage",setup(n){const t=Ft(),{send:s,on:l,connected:r}=se(),{success:o,error:u,confirm:E}=pl(),_=e.ref(null),a=e.ref(!1),b=e.ref(-1);e.onMounted(async()=>{try{await t.fetchSchemas(),t.schemas.length>0&&!t.selectedSchema&&await t.selectSchemaByName(t.schemas[0].name)}catch(f){t.error||(t.error=f instanceof Error?f.message:"Failed to load schemas")}}),l("store:updated",f=>{const d=f;if(typeof f!="object"||f===null||typeof d.schema!="string"||typeof d.action!="string"||typeof d.count!="number"){console.warn("[ModelsPage] Invalid store:updated payload:",f);return}t.handleStoreUpdate(f),b.value=-1}),l("reseeded",f=>{const d=f;if(typeof f!="object"||f===null||typeof d.success!="boolean"||!Array.isArray(d.schemas)){console.warn("[ModelsPage] Invalid reseeded payload:",f);return}t.handleReseedComplete(f),b.value=-1}),e.watch(()=>t.selectedSchema,async()=>{b.value=-1,_.value&&t.currentItems.length>0&&(await e.nextTick(),_.value?.formatJson())}),e.watch(()=>t.currentItems,(f,d)=>{const x=b.value;if(x<0)return;if(x>=f.length){b.value=-1;return}const A=t.currentSchema?.idField??"id",k=d?.[x],p=f[x];if(k!==p){if(typeof k=="object"&&k!==null&&typeof p=="object"&&p!==null){const h=k[A],m=p[A];if(h!==void 0&&h===m)return}b.value=-1}});async function B(f){t.isDirty&&!await E("You have unsaved changes. Are you sure you want to switch schemas?",{title:"Unsaved Changes",confirmText:"Switch Schema",cancelText:"Cancel"})||await t.selectSchemaByName(f)}async function $(){if(!_.value?.isValid){u("Cannot save invalid JSON. Please fix the errors first.");return}if(await t.saveItems())o("Items saved successfully");else{const d=t.error||"Failed to save items";u(d)}}async function w(){if(!t.isDirty)return;await E("Discard all changes and revert to saved data?",{title:"Discard Changes",confirmText:"Discard",cancelText:"Cancel"})&&(t.discardChanges(),o("Changes discarded"))}async function F(){a.value=!1;try{if(await t.clearSchema())o("Schema cleared successfully");else{const d=t.error||"Failed to clear schema";u(d)}}catch(f){const d=f instanceof Error?f.message:"Failed to clear schema";u(d)}}async function C(){if(!r.value){u("WebSocket not connected. Cannot trigger reseed.");return}await E("This will regenerate all seed data and replace existing items. Continue?",{title:"Reseed All Schemas",confirmText:"Reseed",cancelText:"Cancel"})&&(s({type:"reseed"}),o("Reseed command sent"))}function S(f){t.updateItems(f)}function y(f){b.value=b.value===f?-1:f}return(f,d)=>(e.openBlock(),e.createElementBlock("div",ul,[e.createElementVNode("aside",fl,[e.createElementVNode("div",yl,[e.createVNode(e.unref(pe),{size:18}),d[4]||(d[4]=e.createElementVNode("span",null,"Schemas",-1)),e.createElementVNode("span",hl,e.toDisplayString(e.unref(t).schemaCount),1)]),e.unref(t).loading&&e.unref(t).schemas.length===0?(e.openBlock(),e.createElementBlock("div",_l,[...d[5]||(d[5]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("span",null,"Loading...",-1)])])):(e.openBlock(),e.createElementBlock("div",gl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).schemas,x=>(e.openBlock(),e.createElementBlock("button",{key:x.name,class:e.normalizeClass(["models-sidebar__item",{"models-sidebar__item--active":e.unref(t).selectedSchema===x.name}]),onClick:A=>B(x.name)},[e.createElementVNode("span",El,e.toDisplayString(x.name),1),e.createElementVNode("span",Nl,e.toDisplayString(x.count),1)],10,kl))),128))])),e.createElementVNode("div",bl,[e.createElementVNode("div",Vl,[d[6]||(d[6]=e.createElementVNode("span",{class:"text-muted"},"Total Items:",-1)),e.createElementVNode("span",Sl,e.toDisplayString(e.unref(t).totalItems),1)])])]),e.createElementVNode("main",Bl,[e.unref(t).selectedSchema?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Cl,[e.createElementVNode("div",$l,[e.createElementVNode("span",xl,e.toDisplayString(e.unref(t).selectedSchema),1),e.createElementVNode("span",wl,"("+e.toDisplayString(e.unref(t).currentItems.length)+" items)",1),e.unref(t).isDirty?(e.openBlock(),e.createElementBlock("span",Dl," Unsaved ")):e.createCommentVNode("",!0)]),e.createElementVNode("div",Tl,[e.unref(t).isDirty?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn--ghost",title:"Discard changes",onClick:w},[e.createVNode(e.unref(ae),{size:16}),d[7]||(d[7]=e.createElementVNode("span",null,"Discard",-1))])):e.createCommentVNode("",!0),e.createElementVNode("button",{disabled:!e.unref(t).isDirty||e.unref(t).loading,class:"btn btn--primary",title:"Save changes",onClick:$},[e.createVNode(e.unref(rt),{size:16}),d[8]||(d[8]=e.createElementVNode("span",null,"Save",-1))],8,Il),e.createElementVNode("button",{class:"btn btn--danger",title:"Clear all items",onClick:d[0]||(d[0]=x=>a.value=!0)},[e.createVNode(e.unref(fe),{size:16}),d[9]||(d[9]=e.createElementVNode("span",null,"Clear",-1))]),e.createElementVNode("button",{disabled:!e.unref(r),class:"btn btn--secondary",title:"Reseed all schemas with generated data",onClick:C},[e.createVNode(e.unref(at),{size:16}),d[10]||(d[10]=e.createElementVNode("span",null,"Reseed All",-1))],8,zl)])]),e.unref(t).error?(e.openBlock(),e.createElementBlock("div",Ml,[e.createElementVNode("span",null,"⚠️ "+e.toDisplayString(e.unref(t).error),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",ql,[e.createElementVNode("div",Fl,[e.createVNode(cl,{ref_key:"jsonEditorRef",ref:_,"model-value":e.unref(t).currentItems,readonly:e.unref(t).loading,"min-height":400,"onUpdate:modelValue":S},null,8,["model-value","readonly"])]),e.createElementVNode("div",Ll,[e.createVNode(Xs,{items:e.unref(t).currentItems,"id-field":e.unref(t).currentSchema?.idField??"id","selected-index":b.value,onSelect:y},null,8,["items","id-field","selected-index"])])]),e.unref(t).loading?(e.openBlock(),e.createElementBlock("div",Al,[...d[11]||(d[11]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("span",null,"Loading...",-1)])])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("div",Rl,[e.unref(t).error?(e.openBlock(),e.createElementBlock("div",Ol,[e.createElementVNode("span",null,"⚠️ "+e.toDisplayString(e.unref(t).error),1)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(pe),{size:48,class:"empty-state__icon"}),d[12]||(d[12]=e.createElementVNode("h3",{class:"empty-state__title"},"Select a schema",-1)),d[13]||(d[13]=e.createElementVNode("p",{class:"empty-state__description"}," Choose a schema from the sidebar to view and edit its data. ",-1))],64))]))]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-overlay",onClick:d[3]||(d[3]=x=>a.value=!1)},[e.createElementVNode("div",{class:"modal",onClick:d[2]||(d[2]=e.withModifiers(()=>{},["stop"]))},[d[17]||(d[17]=e.createElementVNode("div",{class:"modal__header"},[e.createElementVNode("h3",null,"Clear Schema Data")],-1)),e.createElementVNode("div",Pl,[e.createElementVNode("p",null,[d[14]||(d[14]=e.createTextVNode(" Are you sure you want to clear all items for ",-1)),e.createElementVNode("strong",null,e.toDisplayString(e.unref(t).selectedSchema),1),d[15]||(d[15]=e.createTextVNode("? ",-1))]),d[16]||(d[16]=e.createElementVNode("p",{class:"text-muted"},"This action cannot be undone.",-1))]),e.createElementVNode("div",Hl,[e.createElementVNode("button",{class:"btn btn--ghost",onClick:d[1]||(d[1]=x=>a.value=!1)}," Cancel "),e.createElementVNode("button",{class:"btn btn--danger",onClick:F}," Clear Schema ")])])])):e.createCommentVNode("",!0)]))]))}}),[["__scopeId","data-v-353edfbc"]])},Symbol.toStringTag,{value:"Module"})),Ul={class:"simulator-page"},Jl={class:"simulator-form card"},Ql={class:"simulator-form__header"},Wl={class:"simulator-form__body"},Gl={key:0,class:"simulator-form__row"},Kl=["value"],Zl={class:"simulator-form__row"},Yl=["value"],Xl={class:"simulator-presets"},vl=["title","onClick"],ea={class:"simulator-preset__label"},ta=["disabled"],na={class:"simulator-active"},oa={class:"simulator-active__header"},sa={class:"simulator-active__title"},la=["disabled"],aa={class:"simulator-active__list"},ra={class:"simulator-simulation__info"},ia={class:"simulator-simulation__path font-mono"},ca={class:"simulator-simulation__preset"},da={key:0,class:"text-muted"},ma=["disabled","onClick"],pa={key:0,class:"empty-state"},ua=Object.freeze(Object.defineProperty({__proto__:null,default:U(e.defineComponent({__name:"SimulatorPage",setup(n){const t=Lt(),s=Je(),{send:l,on:r,connected:o}=se(),u=e.ref(""),E=e.ref("GET"),_=e.ref(null),a=e.ref(null),b=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"];let B=[];const $=e.ref(new Set),w=e.computed(()=>s.endpoints.map(p=>({key:p.key,label:`${p.method.toUpperCase()} ${p.path}`,method:p.method.toUpperCase(),path:p.path,operationId:p.operationId}))),F=e.computed(()=>{const p=u.value.trim()!=="",h=_.value!==null;return p&&h}),C=e.computed(()=>t.activeSimulations.map(p=>{const h=p.presetId?t.getPreset(p.presetId):null;return{...p,preset:h}})),S=e.computed(()=>t.count);function y(){if(!F.value||!_.value||!t.getPreset(_.value))return;const h=u.value.trim();if(!h.startsWith("/")){t.setError("Path must start with /");return}if(h.length>500){t.setError("Path is too long (max 500 characters)");return}if(!/^\/[\w\-/{}:.]*$/.test(h)){t.setError("Path contains invalid characters");return}const m=`${E.value.toLowerCase()}:${h}`,M=t.createSimulationFromPreset(m,_.value,void 0);M&&(t.addSimulationLocal(M,!0),t.setLoading(!0),l({type:"set:simulation",data:{path:M.path,status:M.status,delay:M.delay,body:M.body}}),u.value="",_.value=null,a.value=null)}function f(p){t.removeSimulationLocal(p,!0),t.setLoading(!0),l({type:"clear:simulation",data:{path:p}})}function d(){if(S.value!==0){for(const p of t.activeSimulations)$.value.add(p.path),t.removeSimulationLocal(p.path,!0),l({type:"clear:simulation",data:{path:p.path}});t.setLoading(!0)}}function x(){if(!a.value)return;const p=s.endpoints.find(h=>h.key===a.value);p&&(E.value=p.method.toUpperCase(),u.value=p.path)}function A(){a.value=null}function k(){o.value&&(t.setLoading(!0),l({type:"get:registry"}))}return e.onMounted(()=>{B=[r("simulation:active",p=>{t.setSimulations(p.simulations),t.setLoading(!1)}),r("simulation:added",p=>{t.handleSimulationAdded(p)}),r("simulation:removed",p=>{t.handleSimulationRemoved(p)}),r("simulations:cleared",p=>{t.handleSimulationsCleared(p)}),r("simulation:set",p=>{t.handleSimulationSet(p)}),r("simulation:cleared",p=>{$.value.has(p.path)&&$.value.delete(p.path),t.handleSimulationCleared(p)})],o.value&&k()}),e.onUnmounted(()=>{for(const p of B)p()}),e.watch(o,p=>{p?k():t.setLoading(!1)}),(p,h)=>(e.openBlock(),e.createElementBlock("div",Ul,[e.createElementVNode("div",Jl,[e.createElementVNode("div",Ql,[e.createVNode(e.unref(ne),{size:18}),h[3]||(h[3]=e.createElementVNode("span",null,"Add Simulation",-1))]),e.createElementVNode("div",Wl,[w.value.length>0?(e.openBlock(),e.createElementBlock("div",Gl,[h[5]||(h[5]=e.createElementVNode("label",{class:"simulator-form__label"},"Select Endpoint (optional):",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":h[0]||(h[0]=m=>a.value=m),class:"input",onChange:x},[h[4]||(h[4]=e.createElementVNode("option",{value:null},"Manual entry...",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,m=>(e.openBlock(),e.createElementBlock("option",{key:m.key,value:m.key},e.toDisplayString(m.label),9,Kl))),128))],544),[[e.vModelSelect,a.value]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Zl,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":h[1]||(h[1]=m=>E.value=m),class:"simulator-form__method input",onChange:A},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(b,m=>e.createElementVNode("option",{key:m,value:m},e.toDisplayString(m),9,Yl)),64))],544),[[e.vModelSelect,E.value]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":h[2]||(h[2]=m=>u.value=m),type:"text",class:"simulator-form__path input",placeholder:"/api/path",onInput:A},null,544),[[e.vModelText,u.value]])]),e.createElementVNode("div",Xl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).presets,m=>(e.openBlock(),e.createElementBlock("button",{key:m.id,class:e.normalizeClass(["simulator-preset",{"simulator-preset--selected":_.value===m.id},`simulator-preset--${m.type}`]),title:m.description,onClick:M=>_.value=m.id},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.type==="delay"?e.unref(G):e.unref($e)),{size:14})),e.createElementVNode("span",ea,e.toDisplayString(m.label),1)],10,vl))),128))]),e.createElementVNode("button",{class:"btn btn--primary",disabled:!F.value||e.unref(t).isLoading,onClick:y},[e.createVNode(e.unref(lt),{size:16}),h[6]||(h[6]=e.createElementVNode("span",null,"Add Simulation",-1))],8,ta)])]),e.createElementVNode("div",na,[e.createElementVNode("div",oa,[e.createElementVNode("span",sa," Active Simulations ("+e.toDisplayString(S.value)+") ",1),S.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn--ghost",disabled:e.unref(t).isLoading,onClick:d},[e.createVNode(e.unref(fe),{size:14}),h[7]||(h[7]=e.createElementVNode("span",null,"Clear All",-1))],8,la)):e.createCommentVNode("",!0)]),e.createElementVNode("div",aa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,m=>(e.openBlock(),e.createElementBlock("div",{key:m.path,class:"simulator-simulation card"},[e.createElementVNode("div",ra,[e.createElementVNode("span",ia,e.toDisplayString(m.path),1)]),e.createElementVNode("div",ca,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.preset?.type==="delay"?e.unref(G):e.unref($e)),{size:14,class:e.normalizeClass({"text-warning":m.preset?.type==="delay","text-error":m.preset?.type==="error","text-muted":m.preset?.type==="empty"})},null,8,["class"])),e.createElementVNode("span",null,e.toDisplayString(m.preset?.label||`HTTP ${m.status}`),1),m.delay?(e.openBlock(),e.createElementBlock("span",da," ("+e.toDisplayString(m.delay)+"ms) ",1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{class:"btn btn--ghost btn--icon",title:"Remove simulation",disabled:e.unref(t).isLoading,onClick:M=>f(m.path)},[e.createVNode(e.unref(fe),{size:14})],8,ma)]))),128)),S.value===0?(e.openBlock(),e.createElementBlock("div",pa,[e.createVNode(e.unref(ne),{size:48,class:"empty-state__icon"}),h[8]||(h[8]=e.createElementVNode("h3",{class:"empty-state__title"},"No active simulations",-1)),h[9]||(h[9]=e.createElementVNode("p",{class:"empty-state__description"}," Add a simulation above to test error handling and slow responses. ",-1))])):e.createCommentVNode("",!0)])])]))}}),[["__scopeId","data-v-3076fbb2"]])},Symbol.toStringTag,{value:"Module"}));j.bootstrap=Ke,j.useTheme=Pt,j.useWebSocket=se,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
|
|
3
|
+
`),d=f.length,x=f[f.length-1].length+1;u.value=`Line ${d}, Column ${x}: ${C.message}`}else u.value=C.message}else u.value="Invalid JSON"}}function w(){try{const C=JSON.parse(o.value);o.value=JSON.stringify(C,null,2),u.value=null,r("update:modelValue",C)}catch{}}function F(C){if(C.key==="Tab"){C.preventDefault();const S=C.target,y=S.selectionStart,f=S.selectionEnd,d=`${o.value.substring(0,y)} ${o.value.substring(f)}`;o.value=d,setTimeout(()=>{S.selectionStart=S.selectionEnd=y+2},0),$()}}return t({formatJson:w,isValid:E}),(C,S)=>(e.openBlock(),e.createElementBlock("div",vs,[e.createElementVNode("div",el,[e.createElementVNode("div",tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y,class:"json-editor__line-number"},e.toDisplayString(y),1))),128))]),e.createElementVNode("textarea",{value:o.value,readonly:n.readonly,placeholder:n.placeholder,style:e.normalizeStyle({minHeight:`${n.minHeight}px`}),class:"json-editor__textarea",spellcheck:"false",onInput:B,onKeydown:F},null,44,nl)]),e.createElementVNode("div",ol,[e.createElementVNode("div",sl,[E.value?(e.openBlock(),e.createElementBlock("div",ll,[e.createVNode(e.unref(me),{size:14}),S[0]||(S[0]=e.createElementVNode("span",null,"Valid JSON",-1))])):u.value?(e.openBlock(),e.createElementBlock("div",al,[e.createVNode(e.unref(nt),{size:14}),e.createElementVNode("span",null,e.toDisplayString(u.value),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",rl,[e.createElementVNode("span",il,e.toDisplayString(_.value)+" lines",1)])])]))}}),[["__scopeId","data-v-dbd5ce20"]]),ie=e.ref([]),J=e.reactive({visible:!1,title:"",message:"",confirmText:"Confirm",cancelText:"Cancel",onConfirm:null,onCancel:null}),le=new Map;let P=null,dl=0;function ml(){return`toast-${Date.now()}-${dl++}`}function Ne(n,t,s=3e3){const l=ml(),r={id:l,type:n,message:t,duration:s,timestamp:Date.now()};if(ie.value.push(r),s>0){const o=setTimeout(()=>{Ye(l),le.delete(l)},s);le.set(l,o)}return l}function Ye(n){const t=le.get(n);t!==void 0&&(clearTimeout(t),le.delete(n));const s=ie.value.findIndex(l=>l.id===n);s!==-1&&ie.value.splice(s,1)}function pl(){function n(_,a){return Ne("success",_,a)}function t(_,a){return Ne("error",_,a)}function s(_,a){return Ne("info",_,a)}function l(_,a){return Ne("warning",_,a)}function r(_,a){return new Promise(b=>{P&&(P(!1),P=null),P=b,J.visible=!0,J.title=a?.title||"Confirm",J.message=_,J.confirmText=a?.confirmText||"Confirm",J.cancelText=a?.cancelText||"Cancel",J.onConfirm=()=>{J.visible=!1,P&&(P(!0),P=null)},J.onCancel=()=>{J.visible=!1,P&&(P(!1),P=null)}})}function o(){J.visible=!1,P&&(P(!1),P=null)}function u(_){Ye(_)}function E(){for(const _ of le.values())clearTimeout(_);le.clear(),ie.value=[]}return{toasts:ie,confirmDialog:J,success:n,error:t,info:s,warning:l,dismiss:u,clearAll:E,confirm:r,closeConfirm:o}}const ul={class:"models-page"},fl={class:"models-sidebar"},yl={class:"models-sidebar__header"},hl={class:"models-sidebar__badge"},_l={key:0,class:"models-sidebar__loading"},gl={key:1,class:"models-sidebar__list"},kl=["onClick"],El={class:"models-sidebar__name"},Nl={class:"models-sidebar__count"},bl={class:"models-sidebar__footer"},Vl={class:"models-sidebar__stat"},Sl={class:"font-mono"},Bl={class:"models-content"},Cl={class:"models-toolbar"},$l={class:"models-toolbar__title"},xl={class:"font-mono"},wl={class:"text-muted"},Dl={key:0,class:"models-toolbar__badge models-toolbar__badge--warning"},Tl={class:"models-toolbar__actions"},Il=["disabled"],zl=["disabled"],Ml={key:0,class:"models-error"},ql={class:"models-panels"},Fl={class:"models-panel"},Ll={class:"models-panel"},Al={key:1,class:"models-loading-overlay"},Rl={key:1,class:"empty-state"},Ol={key:0,class:"models-error"},Pl={class:"modal__body"},Hl={class:"modal__footer"},jl=Object.freeze(Object.defineProperty({__proto__:null,default:U(e.defineComponent({__name:"ModelsPage",setup(n){const t=Ft(),{send:s,on:l,connected:r}=se(),{success:o,error:u,confirm:E}=pl(),_=e.ref(null),a=e.ref(!1),b=e.ref(-1);e.onMounted(async()=>{try{await t.fetchSchemas(),t.schemas.length>0&&!t.selectedSchema&&await t.selectSchemaByName(t.schemas[0].name)}catch(f){t.error||(t.error=f instanceof Error?f.message:"Failed to load schemas")}}),l("store:updated",f=>{const d=f;if(typeof f!="object"||f===null||typeof d.schema!="string"||typeof d.action!="string"||typeof d.count!="number"){console.warn("[ModelsPage] Invalid store:updated payload:",f);return}t.handleStoreUpdate(f),b.value=-1}),l("reseeded",f=>{const d=f;if(typeof f!="object"||f===null||typeof d.success!="boolean"||!Array.isArray(d.schemas)){console.warn("[ModelsPage] Invalid reseeded payload:",f);return}t.handleReseedComplete(f),b.value=-1}),e.watch(()=>t.selectedSchema,async()=>{b.value=-1,_.value&&t.currentItems.length>0&&(await e.nextTick(),_.value?.formatJson())}),e.watch(()=>t.currentItems,(f,d)=>{const x=b.value;if(x<0)return;if(x>=f.length){b.value=-1;return}const A=t.currentSchema?.idField??"id",k=d?.[x],p=f[x];if(k!==p){if(typeof k=="object"&&k!==null&&typeof p=="object"&&p!==null){const h=k[A],m=p[A];if(h!==void 0&&h===m)return}b.value=-1}});async function B(f){t.isDirty&&!await E("You have unsaved changes. Are you sure you want to switch schemas?",{title:"Unsaved Changes",confirmText:"Switch Schema",cancelText:"Cancel"})||await t.selectSchemaByName(f)}async function $(){if(!_.value?.isValid){u("Cannot save invalid JSON. Please fix the errors first.");return}if(await t.saveItems())o("Items saved successfully");else{const d=t.error||"Failed to save items";u(d)}}async function w(){if(!t.isDirty)return;await E("Discard all changes and revert to saved data?",{title:"Discard Changes",confirmText:"Discard",cancelText:"Cancel"})&&(t.discardChanges(),o("Changes discarded"))}async function F(){a.value=!1;try{if(await t.clearSchema())o("Schema cleared successfully");else{const d=t.error||"Failed to clear schema";u(d)}}catch(f){const d=f instanceof Error?f.message:"Failed to clear schema";u(d)}}async function C(){if(!r.value){u("WebSocket not connected. Cannot trigger reseed.");return}await E("This will regenerate all seed data and replace existing items. Continue?",{title:"Reseed All Schemas",confirmText:"Reseed",cancelText:"Cancel"})&&(s({type:"reseed"}),o("Reseed command sent"))}function S(f){t.updateItems(f)}function y(f){b.value=b.value===f?-1:f}return(f,d)=>(e.openBlock(),e.createElementBlock("div",ul,[e.createElementVNode("aside",fl,[e.createElementVNode("div",yl,[e.createVNode(e.unref(pe),{size:18}),d[4]||(d[4]=e.createElementVNode("span",null,"Schemas",-1)),e.createElementVNode("span",hl,e.toDisplayString(e.unref(t).schemaCount),1)]),e.unref(t).loading&&e.unref(t).schemas.length===0?(e.openBlock(),e.createElementBlock("div",_l,[...d[5]||(d[5]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("span",null,"Loading...",-1)])])):(e.openBlock(),e.createElementBlock("div",gl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).schemas,x=>(e.openBlock(),e.createElementBlock("button",{key:x.name,class:e.normalizeClass(["models-sidebar__item",{"models-sidebar__item--active":e.unref(t).selectedSchema===x.name}]),onClick:A=>B(x.name)},[e.createElementVNode("span",El,e.toDisplayString(x.name),1),e.createElementVNode("span",Nl,e.toDisplayString(x.count),1)],10,kl))),128))])),e.createElementVNode("div",bl,[e.createElementVNode("div",Vl,[d[6]||(d[6]=e.createElementVNode("span",{class:"text-muted"},"Total Items:",-1)),e.createElementVNode("span",Sl,e.toDisplayString(e.unref(t).totalItems),1)])])]),e.createElementVNode("main",Bl,[e.unref(t).selectedSchema?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Cl,[e.createElementVNode("div",$l,[e.createElementVNode("span",xl,e.toDisplayString(e.unref(t).selectedSchema),1),e.createElementVNode("span",wl,"("+e.toDisplayString(e.unref(t).currentItems.length)+" items)",1),e.unref(t).isDirty?(e.openBlock(),e.createElementBlock("span",Dl," Unsaved ")):e.createCommentVNode("",!0)]),e.createElementVNode("div",Tl,[e.unref(t).isDirty?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn--ghost",title:"Discard changes",onClick:w},[e.createVNode(e.unref(ae),{size:16}),d[7]||(d[7]=e.createElementVNode("span",null,"Discard",-1))])):e.createCommentVNode("",!0),e.createElementVNode("button",{disabled:!e.unref(t).isDirty||e.unref(t).loading,class:"btn btn--primary",title:"Save changes",onClick:$},[e.createVNode(e.unref(rt),{size:16}),d[8]||(d[8]=e.createElementVNode("span",null,"Save",-1))],8,Il),e.createElementVNode("button",{class:"btn btn--danger",title:"Clear all items",onClick:d[0]||(d[0]=x=>a.value=!0)},[e.createVNode(e.unref(fe),{size:16}),d[9]||(d[9]=e.createElementVNode("span",null,"Clear",-1))]),e.createElementVNode("button",{disabled:!e.unref(r),class:"btn btn--secondary",title:"Reseed all schemas with generated data",onClick:C},[e.createVNode(e.unref(at),{size:16}),d[10]||(d[10]=e.createElementVNode("span",null,"Reseed All",-1))],8,zl)])]),e.unref(t).error?(e.openBlock(),e.createElementBlock("div",Ml,[e.createElementVNode("span",null,"⚠️ "+e.toDisplayString(e.unref(t).error),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",ql,[e.createElementVNode("div",Fl,[e.createVNode(cl,{ref_key:"jsonEditorRef",ref:_,"model-value":e.unref(t).currentItems,readonly:e.unref(t).loading,"min-height":400,"onUpdate:modelValue":S},null,8,["model-value","readonly"])]),e.createElementVNode("div",Ll,[e.createVNode(Xs,{items:e.unref(t).currentItems,"id-field":e.unref(t).currentSchema?.idField??"id","selected-index":b.value,onSelect:y},null,8,["items","id-field","selected-index"])])]),e.unref(t).loading?(e.openBlock(),e.createElementBlock("div",Al,[...d[11]||(d[11]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("span",null,"Loading...",-1)])])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("div",Rl,[e.unref(t).error?(e.openBlock(),e.createElementBlock("div",Ol,[e.createElementVNode("span",null,"⚠️ "+e.toDisplayString(e.unref(t).error),1)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(pe),{size:48,class:"empty-state__icon"}),d[12]||(d[12]=e.createElementVNode("h3",{class:"empty-state__title"},"Select a schema",-1)),d[13]||(d[13]=e.createElementVNode("p",{class:"empty-state__description"}," Choose a schema from the sidebar to view and edit its data. ",-1))],64))]))]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-overlay",onClick:d[3]||(d[3]=x=>a.value=!1)},[e.createElementVNode("div",{class:"modal",onClick:d[2]||(d[2]=e.withModifiers(()=>{},["stop"]))},[d[17]||(d[17]=e.createElementVNode("div",{class:"modal__header"},[e.createElementVNode("h3",null,"Clear Schema Data")],-1)),e.createElementVNode("div",Pl,[e.createElementVNode("p",null,[d[14]||(d[14]=e.createTextVNode(" Are you sure you want to clear all items for ",-1)),e.createElementVNode("strong",null,e.toDisplayString(e.unref(t).selectedSchema),1),d[15]||(d[15]=e.createTextVNode("? ",-1))]),d[16]||(d[16]=e.createElementVNode("p",{class:"text-muted"},"This action cannot be undone.",-1))]),e.createElementVNode("div",Hl,[e.createElementVNode("button",{class:"btn btn--ghost",onClick:d[1]||(d[1]=x=>a.value=!1)}," Cancel "),e.createElementVNode("button",{class:"btn btn--danger",onClick:F}," Clear Schema ")])])])):e.createCommentVNode("",!0)]))]))}}),[["__scopeId","data-v-96cf0ec0"]])},Symbol.toStringTag,{value:"Module"})),Ul={class:"simulator-page"},Jl={class:"simulator-form card"},Ql={class:"simulator-form__header"},Wl={class:"simulator-form__body"},Gl={key:0,class:"simulator-form__row"},Kl=["value"],Zl={class:"simulator-form__row"},Yl=["value"],Xl={class:"simulator-presets"},vl=["title","onClick"],ea={class:"simulator-preset__label"},ta=["disabled"],na={class:"simulator-active"},oa={class:"simulator-active__header"},sa={class:"simulator-active__title"},la=["disabled"],aa={class:"simulator-active__list"},ra={class:"simulator-simulation__info"},ia={class:"simulator-simulation__path font-mono"},ca={class:"simulator-simulation__preset"},da={key:0,class:"text-muted"},ma=["disabled","onClick"],pa={key:0,class:"empty-state"},ua=Object.freeze(Object.defineProperty({__proto__:null,default:U(e.defineComponent({__name:"SimulatorPage",setup(n){const t=Lt(),s=Je(),{send:l,on:r,connected:o}=se(),u=e.ref(""),E=e.ref("GET"),_=e.ref(null),a=e.ref(null),b=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"];let B=[];const $=e.ref(new Set),w=e.computed(()=>s.endpoints.map(p=>({key:p.key,label:`${p.method.toUpperCase()} ${p.path}`,method:p.method.toUpperCase(),path:p.path,operationId:p.operationId}))),F=e.computed(()=>{const p=u.value.trim()!=="",h=_.value!==null;return p&&h}),C=e.computed(()=>t.activeSimulations.map(p=>{const h=p.presetId?t.getPreset(p.presetId):null;return{...p,preset:h}})),S=e.computed(()=>t.count);function y(){if(!F.value||!_.value||!t.getPreset(_.value))return;const h=u.value.trim();if(!h.startsWith("/")){t.setError("Path must start with /");return}if(h.length>500){t.setError("Path is too long (max 500 characters)");return}if(!/^\/[\w\-/{}:.]*$/.test(h)){t.setError("Path contains invalid characters");return}const m=`${E.value.toLowerCase()}:${h}`,M=t.createSimulationFromPreset(m,_.value,void 0);M&&(t.addSimulationLocal(M,!0),t.setLoading(!0),l({type:"set:simulation",data:{path:M.path,status:M.status,delay:M.delay,body:M.body}}),u.value="",_.value=null,a.value=null)}function f(p){t.removeSimulationLocal(p,!0),t.setLoading(!0),l({type:"clear:simulation",data:{path:p}})}function d(){if(S.value!==0){for(const p of t.activeSimulations)$.value.add(p.path),t.removeSimulationLocal(p.path,!0),l({type:"clear:simulation",data:{path:p.path}});t.setLoading(!0)}}function x(){if(!a.value)return;const p=s.endpoints.find(h=>h.key===a.value);p&&(E.value=p.method.toUpperCase(),u.value=p.path)}function A(){a.value=null}function k(){o.value&&(t.setLoading(!0),l({type:"get:registry"}))}return e.onMounted(()=>{B=[r("simulation:active",p=>{t.setSimulations(p.simulations),t.setLoading(!1)}),r("simulation:added",p=>{t.handleSimulationAdded(p)}),r("simulation:removed",p=>{t.handleSimulationRemoved(p)}),r("simulations:cleared",p=>{t.handleSimulationsCleared(p)}),r("simulation:set",p=>{t.handleSimulationSet(p)}),r("simulation:cleared",p=>{$.value.has(p.path)&&$.value.delete(p.path),t.handleSimulationCleared(p)})],o.value&&k()}),e.onUnmounted(()=>{for(const p of B)p()}),e.watch(o,p=>{p?k():t.setLoading(!1)}),(p,h)=>(e.openBlock(),e.createElementBlock("div",Ul,[e.createElementVNode("div",Jl,[e.createElementVNode("div",Ql,[e.createVNode(e.unref(ne),{size:18}),h[3]||(h[3]=e.createElementVNode("span",null,"Add Simulation",-1))]),e.createElementVNode("div",Wl,[w.value.length>0?(e.openBlock(),e.createElementBlock("div",Gl,[h[5]||(h[5]=e.createElementVNode("label",{class:"simulator-form__label"},"Select Endpoint (optional):",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":h[0]||(h[0]=m=>a.value=m),class:"input",onChange:x},[h[4]||(h[4]=e.createElementVNode("option",{value:null},"Manual entry...",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,m=>(e.openBlock(),e.createElementBlock("option",{key:m.key,value:m.key},e.toDisplayString(m.label),9,Kl))),128))],544),[[e.vModelSelect,a.value]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Zl,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":h[1]||(h[1]=m=>E.value=m),class:"simulator-form__method input",onChange:A},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(b,m=>e.createElementVNode("option",{key:m,value:m},e.toDisplayString(m),9,Yl)),64))],544),[[e.vModelSelect,E.value]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":h[2]||(h[2]=m=>u.value=m),type:"text",class:"simulator-form__path input",placeholder:"/api/path",onInput:A},null,544),[[e.vModelText,u.value]])]),e.createElementVNode("div",Xl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).presets,m=>(e.openBlock(),e.createElementBlock("button",{key:m.id,class:e.normalizeClass(["simulator-preset",{"simulator-preset--selected":_.value===m.id},`simulator-preset--${m.type}`]),title:m.description,onClick:M=>_.value=m.id},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.type==="delay"?e.unref(G):e.unref($e)),{size:14})),e.createElementVNode("span",ea,e.toDisplayString(m.label),1)],10,vl))),128))]),e.createElementVNode("button",{class:"btn btn--primary",disabled:!F.value||e.unref(t).isLoading,onClick:y},[e.createVNode(e.unref(lt),{size:16}),h[6]||(h[6]=e.createElementVNode("span",null,"Add Simulation",-1))],8,ta)])]),e.createElementVNode("div",na,[e.createElementVNode("div",oa,[e.createElementVNode("span",sa," Active Simulations ("+e.toDisplayString(S.value)+") ",1),S.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn--ghost",disabled:e.unref(t).isLoading,onClick:d},[e.createVNode(e.unref(fe),{size:14}),h[7]||(h[7]=e.createElementVNode("span",null,"Clear All",-1))],8,la)):e.createCommentVNode("",!0)]),e.createElementVNode("div",aa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,m=>(e.openBlock(),e.createElementBlock("div",{key:m.path,class:"simulator-simulation card"},[e.createElementVNode("div",ra,[e.createElementVNode("span",ia,e.toDisplayString(m.path),1)]),e.createElementVNode("div",ca,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.preset?.type==="delay"?e.unref(G):e.unref($e)),{size:14,class:e.normalizeClass({"text-warning":m.preset?.type==="delay","text-error":m.preset?.type==="error","text-muted":m.preset?.type==="empty"})},null,8,["class"])),e.createElementVNode("span",null,e.toDisplayString(m.preset?.label||`HTTP ${m.status}`),1),m.delay?(e.openBlock(),e.createElementBlock("span",da," ("+e.toDisplayString(m.delay)+"ms) ",1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{class:"btn btn--ghost btn--icon",title:"Remove simulation",disabled:e.unref(t).isLoading,onClick:M=>f(m.path)},[e.createVNode(e.unref(fe),{size:14})],8,ma)]))),128)),S.value===0?(e.openBlock(),e.createElementBlock("div",pa,[e.createVNode(e.unref(ne),{size:48,class:"empty-state__icon"}),h[8]||(h[8]=e.createElementVNode("h3",{class:"empty-state__title"},"No active simulations",-1)),h[9]||(h[9]=e.createElementVNode("p",{class:"empty-state__description"}," Add a simulation above to test error handling and slow responses. ",-1))])):e.createCommentVNode("",!0)])])]))}}),[["__scopeId","data-v-3076fbb2"]])},Symbol.toStringTag,{value:"Module"}));j.bootstrap=Ke,j.useTheme=Pt,j.useWebSocket=se,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
|
|
4
4
|
//# sourceMappingURL=devtools.umd.cjs.map
|