@oxog/devinspector 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/chunk-5QIYNQ4C.js +19 -0
  3. package/dist/chunk-5QIYNQ4C.js.map +1 -0
  4. package/dist/{chunk-LNBLBFDA.js → chunk-NP2SAIEA.js} +23 -19
  5. package/dist/chunk-NP2SAIEA.js.map +1 -0
  6. package/dist/{chunk-KZ4SDSBO.js → chunk-WUYUDBSC.js} +5 -1
  7. package/dist/chunk-WUYUDBSC.js.map +1 -0
  8. package/dist/{console-monitor-AVTNZCED.js → console-monitor-AO67CSAK.js} +17 -10
  9. package/dist/console-monitor-AO67CSAK.js.map +1 -0
  10. package/dist/devinspector.umd.cjs +766 -489
  11. package/dist/devinspector.umd.cjs.map +1 -1
  12. package/dist/devinspector.umd.js +766 -489
  13. package/dist/devinspector.umd.js.map +1 -1
  14. package/dist/devinspector.umd.min.cjs +2 -2
  15. package/dist/devinspector.umd.min.cjs.map +1 -1
  16. package/dist/devinspector.umd.min.js +2 -2
  17. package/dist/devinspector.umd.min.js.map +1 -1
  18. package/dist/{dom-monitor-JHJVZYS4.js → dom-monitor-D6GHCDBP.js} +1 -1
  19. package/dist/{dom-monitor-JHJVZYS4.js.map → dom-monitor-D6GHCDBP.js.map} +1 -1
  20. package/dist/{error-monitor-3CRFREH3.js → error-monitor-AVTYBTS7.js} +27 -52
  21. package/dist/error-monitor-AVTYBTS7.js.map +1 -0
  22. package/dist/index.cjs +512 -285
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +4 -2
  25. package/dist/index.d.ts +4 -2
  26. package/dist/index.js +268 -98
  27. package/dist/index.js.map +1 -1
  28. package/dist/{inspector-ui-C7WSILKC.js → inspector-ui-TEAZXDPM.js} +17 -7
  29. package/dist/inspector-ui-TEAZXDPM.js.map +1 -0
  30. package/dist/{network-monitor-WNRL2JI7.js → network-monitor-6XRFHXMV.js} +152 -114
  31. package/dist/network-monitor-6XRFHXMV.js.map +1 -0
  32. package/dist/{performance-monitor-UKQFA7ZR.js → performance-monitor-ULNHXBYX.js} +8 -6
  33. package/dist/performance-monitor-ULNHXBYX.js.map +1 -0
  34. package/dist/{state-monitor-JGJLBAD7.js → state-monitor-UNAVEOGH.js} +1 -1
  35. package/dist/{state-monitor-JGJLBAD7.js.map → state-monitor-UNAVEOGH.js.map} +1 -1
  36. package/dist/{storage-monitor-3NPTWRTY.js → storage-monitor-5RCRXYMX.js} +1 -1
  37. package/dist/{storage-monitor-3NPTWRTY.js.map → storage-monitor-5RCRXYMX.js.map} +1 -1
  38. package/package.json +6 -3
  39. package/dist/chunk-KZ4SDSBO.js.map +0 -1
  40. package/dist/chunk-LNBLBFDA.js.map +0 -1
  41. package/dist/console-monitor-AVTNZCED.js.map +0 -1
  42. package/dist/error-monitor-3CRFREH3.js.map +0 -1
  43. package/dist/inspector-ui-C7WSILKC.js.map +0 -1
  44. package/dist/network-monitor-WNRL2JI7.js.map +0 -1
  45. package/dist/performance-monitor-UKQFA7ZR.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @oxog/devinspector v1.4.1
2
+ * @oxog/devinspector v1.5.0
3
3
  * (c) Ersin Koc <ersinkoc@gmail.com>
4
4
  * Released under the MIT License
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DevInspector=t()}(this,function(){"use strict";function e(){return"production"!==function(){try{return process.env.NODE_ENV}catch(e){return}}()}function t(){return"undefined"!=typeof window&&"undefined"!=typeof document}const n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"};function s(e){return String(e).replace(/[&<>"'`]/g,e=>n[e])}class r{constructor(e={}){var t,n;this.events=new Map,this.maxListeners=null!==(t=e.maxListeners)&&void 0!==t?t:10,this.captureRejections=null!==(n=e.captureRejections)&&void 0!==n&&n}on(e,t){this.events.has(e)||this.events.set(e,new Set);const n=this.events.get(e);return n.size>this.maxListeners&&console.warn(`MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ${n.size} ${String(e)} listeners added.`),n.add(t),()=>{n.delete(t),0===n.size&&this.events.delete(e)}}once(e,t){const n=this.on(e,e=>{n(),t(e)});return n}emit(e,...t){const n=this.events.get(e);if(!n||0===n.size)return!1;const s=t[0];return n.forEach(t=>{try{t(s)}catch(t){this.captureRejections?this.emit("error",t):console.error(`Error in event listener for "${String(e)}":`,t)}}),!0}off(e,t){if(!t)return void this.events.delete(e);const n=this.events.get(e);n&&(n.delete(t),0===n.size&&this.events.delete(e))}removeAllListeners(e){e?this.events.delete(e):this.events.clear()}listenerCount(e){const t=this.events.get(e);return t?t.size:0}eventNames(){return Array.from(this.events.keys())}setMaxListeners(e){this.maxListeners=e}getMaxListeners(){return this.maxListeners}}class i{constructor(e){this.plugins=new Map,this.activePlugins=new Set,this.installingPlugins=new Set,this.context=e}async register(e){if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);if(this.installingPlugins.has(e.name))throw new Error(`Plugin "${e.name}" is currently being installed`);this.installingPlugins.add(e.name);try{await e.install(this.context),this.plugins.set(e.name,e),this.activePlugins.add(e.name),e.enable&&e.enable(),this.context.events.emit("plugin:registered",{name:e.name,version:e.version})}catch(t){throw this.installingPlugins.delete(e.name),new Error(`Failed to install plugin "${e.name}": ${t}`)}this.installingPlugins.delete(e.name)}async unregister(e){const t=this.plugins.get(e);if(!t)throw new Error(`Plugin "${e}" is not registered`);t.disable&&t.disable(),t.uninstall&&await t.uninstall(),this.plugins.delete(e),this.activePlugins.delete(e),this.context.events.emit("plugin:unregistered",{name:e})}enable(e){const t=this.plugins.get(e);if(!t)throw new Error(`Plugin "${e}" is not registered`);this.activePlugins.has(e)||(t.enable&&t.enable(),this.activePlugins.add(e),this.context.events.emit("plugin:enabled",{name:e}))}disable(e){const t=this.plugins.get(e);if(!t)throw new Error(`Plugin "${e}" is not registered`);this.activePlugins.has(e)&&(t.disable&&t.disable(),this.activePlugins.delete(e),this.context.events.emit("plugin:disabled",{name:e}))}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}isActive(e){return this.activePlugins.has(e)}getAll(){return Array.from(this.plugins.values())}getActive(){return Array.from(this.activePlugins).map(e=>this.plugins.get(e))}getMetadata(e){const t=this.plugins.get(e);if(t)return{name:t.name,version:t.version,description:t.description}}getAllMetadata(){return this.getAll().map(e=>({name:e.name,version:e.version,description:e.description}))}}const o="1.4.1",a=["log","info","warn","error","debug"],c=1e4,l=/\.(?:css|js|mjs|map|png|jpe?g|gif|svg|webp|avif|ico|woff2?|ttf|otf|eot)(?:[?#]|$)/i,d=["top-left","top-right","bottom-left","bottom-right"],h={dark:{bg:"#1a1a1a",header:"#262626",toolbar:"#1e1e1e",border:"#333",row:"#2a2a2a",text:"#e4e4e7",muted:"#9ca3af",code:"#0f0f0f"},light:{bg:"#ffffff",header:"#f3f4f6",toolbar:"#f9fafb",border:"#d1d5db",row:"#e5e7eb",text:"#111827",muted:"#4b5563",code:"#f3f4f6"}};let p=0;function u(){return p=(p+1)%Number.MAX_SAFE_INTEGER,`${Date.now().toString(36)}-${p.toString(36)}`}function m(e,t){return"number"==typeof e&&Number.isFinite(e)&&e>=0?Math.floor(e):t}function g(e){if("string"!=typeof e)return"";const t=e.toLowerCase().split("+").map(e=>e.trim()).filter(Boolean),n=t.filter(e=>!["ctrl","control","alt","shift","meta","cmd"].includes(e));if(1!==n.length)return"";const s=(...e)=>e.some(e=>t.includes(e));return[s("ctrl","control")&&"ctrl",s("alt")&&"alt",s("shift")&&"shift",s("meta","cmd")&&"meta",n[0]].filter(Boolean).join("+")}function f(e){return e.length>c?`${e.slice(0,c)}… (${e.length-c} more characters)`:e}function v(e){if("string"==typeof e)return e;if(e instanceof Error)return e.stack||`${e.name}: ${e.message}`;if(null!==e&&"object"==typeof e){const t=new WeakSet;try{const n=JSON.stringify(e,(e,n)=>{if("bigint"==typeof n)return`${n}n`;if(null!==n&&"object"==typeof n){if(t.has(n))return"[Circular]";t.add(n)}return n},2);return void 0===n?String(e):n}catch(t){try{return String(e)}catch(e){return"[object]"}}}try{return String(e)}catch(e){return"[unprintable]"}}function b(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e;if("string"==typeof t.url)return t.url;if("string"==typeof t.href)return t.href}return String(e)}function y(e,t){const n=t&&"object"==typeof t?t.method:void 0;if("string"==typeof n&&n)return n.toUpperCase();const s=e&&"object"==typeof e?e.method:void 0;return"string"==typeof s&&s?s.toUpperCase():"GET"}class w{constructor(e={}){var n;this.events=new r({maxListeners:100}),this.network=[],this.consoleEntries=[],this.errors=[],this.metrics=[],this.performanceStats={fps:0,memory:null},this.isRecording=!0,this.isVisible=!1,this.isMinimized=!1,this.destroyed=!1,this.capturing=!1,this.renderQueued=!1,this.activeTab="network",this.selectedRequestId=null,this.widget=null,this.panel=null,this.patches=[],this.cleanups=[],this.rafId=null,this.marks=new Map,this.xhrState=new WeakMap,this.config=w.resolveConfig(null!=e?e:{}),this.active=this.config.enabled&&t();const s=this;if(this.pluginSystem=new i({inspector:this,storage:{get network(){return s.getEntries("network")},get console(){return s.getEntries("console")},get errors(){return s.getEntries("errors")},get metrics(){return s.getEntries("metrics")}},events:this.events,config:this.config}),this.active){w.instances.push(this),this.config.features.network&&(this.interceptFetch(),this.interceptXHR()),this.config.features.console&&this.interceptConsole(),this.config.features.errors&&this.interceptErrors(),this.setupHotkeys(),this.mountWhenReady();for(const t of null!==(n=e.plugins)&&void 0!==n?n:[])this.use(t).catch(e=>this.reportInternal("Failed to register plugin",e));this.events.emit("inspector:ready")}}static getInstance(){const{instances:e}=w;return e.length>0?e[e.length-1]:null}static resolveConfig(t){var n,s,r,i,o;const a=null!==(n=t.features)&&void 0!==n?n:{},c="light"===t.theme||"dark"===t.theme?t.theme:"auto",l=(()=>{try{return"undefined"==typeof window||"function"!=typeof window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches}catch(e){return!0}})(),h=null!==(s=t.hotkeys)&&void 0!==s?s:{};return{enabled:"boolean"==typeof t.enabled?t.enabled:e(),position:d.includes(t.position)?t.position:"bottom-right",theme:"auto"===c?l?"dark":"light":c,hotkeys:{toggle:g(null!==(r=h.toggle)&&void 0!==r?r:"ctrl+shift+d"),minimize:g(null!==(i=h.minimize)&&void 0!==i?i:"ctrl+shift+m")},features:{network:!1!==a.network,console:!1!==a.console,performance:!1!==a.performance,errors:!1!==a.errors},maxNetworkEntries:m(t.maxNetworkEntries,1e3),maxConsoleEntries:m(t.maxConsoleEntries,500),maxErrorEntries:m(t.maxErrorEntries,100),captureStackTraces:!1!==t.captureStackTraces,hideAssets:!0===(null===(o=t.networkFilters)||void 0===o?void 0:o.hideAssets),slowRequestThreshold:m(t.slowRequestThreshold,3e3),onError:"function"==typeof t.onError?t.onError:void 0,onPerformanceIssue:"function"==typeof t.onPerformanceIssue?t.onPerformanceIssue:void 0}}get isEnabled(){return this.active&&!this.destroyed}show(){this.isEnabled&&(this.isVisible=!0,this.panel&&(this.panel.style.display="flex"),this.widget&&(this.widget.style.display="none"),this.render(),this.startPerformanceLoop(),this.events.emit("inspector:show"))}hide(){this.isEnabled&&(this.isVisible=!1,this.panel&&(this.panel.style.display="none"),this.widget&&(this.widget.style.display="flex"),this.stopPerformanceLoop(),this.events.emit("inspector:hide"))}toggle(){this.isVisible?this.hide():this.show()}minimize(){this.isEnabled&&(this.isMinimized=!this.isMinimized,this.panel&&(this.panel.style.height=this.isMinimized?"48px":"650px"),this.render(),this.events.emit("inspector:minimize",this.isMinimized))}clear(e="all"){"network"!==e&&"all"!==e||(this.network=[],this.selectedRequestId=null),"console"!==e&&"all"!==e||(this.consoleEntries=[]),"errors"!==e&&"all"!==e||(this.errors=[]),"metrics"!==e&&"all"!==e||(this.metrics=[]),this.scheduleRender()}toggleRecording(){return this.isRecording=!this.isRecording,this.scheduleRender(),this.isRecording}get recording(){return this.isRecording}getEntries(e){switch(e){case"network":return this.network.map(e=>({...e}));case"console":return this.consoleEntries.map(e=>({...e}));case"errors":return this.errors.map(e=>({...e}));default:return this.metrics.map(e=>({...e}))}}track(e,t){if(!this.isEnabled)return;const n={id:u(),name:String(e),data:t,timestamp:Date.now()};this.pushBounded(this.metrics,n,500),this.emitSafely("performance:metric",n),this.scheduleRender()}markStart(e){var t;if(this.isEnabled){this.marks.set(String(e),performance.now());try{null===(t=performance.mark)||void 0===t||t.call(performance,`devinspector-${e}-start`)}catch(e){}}}markEnd(e){var t,n;if(!this.isEnabled)return;const s=String(e),r=this.marks.get(s);if(void 0===r)return;this.marks.delete(s);const i=performance.now()-r;try{null===(t=performance.mark)||void 0===t||t.call(performance,`devinspector-${s}-end`),null===(n=performance.measure)||void 0===n||n.call(performance,`devinspector-${s}`,`devinspector-${s}-start`,`devinspector-${s}-end`)}catch(e){}const o={id:u(),name:s,duration:i,timestamp:Date.now()};return this.pushBounded(this.metrics,o,500),this.emitSafely("performance:mark",o),this.scheduleRender(),i}use(e){return this.destroyed?Promise.reject(new Error("DevInspector has been destroyed")):this.pluginSystem.register(e)}on(e,t){return this.events.on(e,t)}once(e,t){return this.events.once(e,t)}off(e,t){this.events.off(e,t)}export(){return{version:o,timestamp:Date.now(),data:{network:this.getEntries("network"),console:this.getEntries("console"),errors:this.getEntries("errors"),metrics:this.getEntries("metrics")}}}import(e){const t=e&&"object"==typeof e?e.data:void 0;if(!t||"object"!=typeof t)throw new TypeError("DevInspector.import() expects an object produced by export()");const n=t,s=e=>Array.isArray(e)?e.filter(e=>!!e&&"object"==typeof e):[],r=(e,t="")=>"string"==typeof e?e:t,i=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0;this.network=s(n.network).slice(0,this.config.maxNetworkEntries).map(e=>{var t;return{id:r(e.id,u()),type:"xhr"===e.type?"xhr":"fetch",url:r(e.url),method:r(e.method,"GET"),status:"number"==typeof e.status?e.status:"pending"===e.status?"pending":"error",timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now(),duration:i(e.duration),error:"string"==typeof e.error?e.error:void 0}}),this.consoleEntries=s(n.console).slice(0,this.config.maxConsoleEntries).map(e=>{var t;return{id:r(e.id,u()),level:a.includes(e.level)?e.level:"log",message:f(r(e.message)),timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now()}}),this.errors=s(n.errors).slice(0,this.config.maxErrorEntries).map(e=>{var t;return{id:r(e.id,u()),type:"Promise Rejection"===e.type?"Promise Rejection":"JavaScript Error",message:f(r(e.message)),timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now(),stack:"string"==typeof e.stack?f(e.stack):void 0}}),this.metrics=s(n.metrics).slice(0,500).map(e=>{var t;return{id:r(e.id,u()),name:r(e.name),data:e.data,duration:i(e.duration),timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now()}}),this.selectedRequestId=null,this.scheduleRender()}destroy(){var e,t;if(!this.destroyed){this.destroyed=!0;for(const e of this.patches.reverse())e.target[e.key]===e.replacement&&(e.target[e.key]=e.original);this.patches=[];for(const e of this.cleanups.splice(0))try{e()}catch(e){}this.stopPerformanceLoop(),null===(e=this.widget)||void 0===e||e.remove(),null===(t=this.panel)||void 0===t||t.remove(),this.widget=null,this.panel=null;for(const e of this.pluginSystem.getAll())this.pluginSystem.unregister(e.name).catch(t=>this.reportInternal(`Failed to uninstall plugin "${e.name}"`,t));this.emitSafely("inspector:destroy",void 0),this.events.removeAllListeners(),this.network=[],this.consoleEntries=[],this.errors=[],this.metrics=[],this.marks.clear(),w.instances=w.instances.filter(e=>e!==this)}}get capturingAllowed(){return!this.destroyed&&this.isRecording&&!this.capturing}capture(e){if(this.capturingAllowed){this.capturing=!0;try{e()}catch(e){this.reportInternal("Capture failed",e)}finally{this.capturing=!1}}}emitSafely(e,t){this.events.emit(e,t)}pushBounded(e,t,n){e.unshift(t),e.length>n&&(e.length=n)}patch(e,t,n){const s=e[t];e[t]=n,this.patches.push({target:e,key:t,original:s,replacement:n})}listen(e,t,n){e.addEventListener(t,n),this.cleanups.push(()=>e.removeEventListener(t,n))}addNetworkEntry(e){this.pushBounded(this.network,e,this.config.maxNetworkEntries),this.emitSafely("network:request",{...e}),this.scheduleRender()}finishNetworkEntry(e,t,n,s){if(e.status=t,e.duration=Math.round(n),void 0!==s&&(e.error=s),this.emitSafely("error"===t?"network:error":"network:response",{...e}),n>this.config.slowRequestThreshold){const t={type:"slow-network",message:`Slow network request: ${e.url}`,url:e.url,duration:e.duration};this.emitSafely("performance:issue",t),this.callUser(this.config.onPerformanceIssue,t)}this.scheduleRender()}interceptFetch(){const e="function"==typeof window.fetch?window.fetch:null;if(!e)return;const t=this;this.patch(window,"fetch",function(...n){let s=null;const r=performance.now();if(t.capture(()=>{s={id:u(),type:"fetch",url:b(n[0]),method:y(n[0],n[1]),status:"pending",timestamp:Date.now()},t.addNetworkEntry(s)}),!s)return Reflect.apply(e,this,n);const i=s;let o;try{o=Reflect.apply(e,this,n)}catch(e){throw t.capture(()=>t.finishNetworkEntry(i,"error",performance.now()-r,e instanceof Error?e.message:String(e))),e}return Promise.resolve(o).then(e=>(t.capture(()=>t.finishNetworkEntry(i,e.status,performance.now()-r)),e),e=>{throw t.capture(()=>t.finishNetworkEntry(i,"error",performance.now()-r,e instanceof Error?e.message:String(e))),e})})}interceptXHR(){const e="function"==typeof XMLHttpRequest?XMLHttpRequest:null;if(!e)return;const t=e.prototype,n=t.open,s=t.send,r=this;this.patch(t,"open",function(...e){return r.destroyed||r.xhrState.set(this,{method:"string"==typeof e[0]?e[0].toUpperCase():"GET",url:b(e[1])}),Reflect.apply(n,this,e)}),this.patch(t,"send",function(...e){const t=r.xhrState.get(this);return t&&r.capture(()=>r.trackXhr(this,t)),Reflect.apply(s,this,e)})}trackXhr(e,t){const n={id:u(),type:"xhr",url:t.url,method:t.method,status:"pending",timestamp:Date.now()};t.entry=n,t.start=performance.now(),t.failure=void 0;const s=e=>()=>{t.failure=e},r=s("Network error"),i=s("Request aborted"),o=s("Request timed out"),a=()=>{var s;if(e.removeEventListener("error",r),e.removeEventListener("abort",i),e.removeEventListener("timeout",o),e.removeEventListener("loadend",a),t.entry!==n||this.destroyed)return;const c=performance.now()-(null!==(s=t.start)&&void 0!==s?s:performance.now()),l=void 0!==t.failure||0===e.status;this.capture(()=>{var s;return this.finishNetworkEntry(n,l?"error":e.status,c,l?null!==(s=t.failure)&&void 0!==s?s:"Network error":void 0)})};e.addEventListener("error",r),e.addEventListener("abort",i),e.addEventListener("timeout",o),e.addEventListener("loadend",a),this.addNetworkEntry(n)}interceptConsole(){const e=this;for(const t of a){const n=console[t];if("function"!=typeof n)continue;const s=function(...s){const r=Reflect.apply(n,void 0===this?console:this,s);return e.capture(()=>{const n={id:u(),level:t,message:f(s.map(v).join(" ")),timestamp:Date.now()};e.pushBounded(e.consoleEntries,n,e.config.maxConsoleEntries),e.emitSafely("console:log",{...n}),e.scheduleRender()}),r};this.patch(console,t,s)}}interceptErrors(){const e=(e,t)=>{this.pushBounded(this.errors,e,this.config.maxErrorEntries),this.emitSafely("error:uncaught",{...e}),this.callUser(this.config.onError,t),this.scheduleRender()};this.listen(window,"error",t=>{this.capture(()=>{var n;const s=t.error instanceof Error?t.error:new Error(String(null!==(n=t.message)&&void 0!==n?n:"Unknown error"));e({id:u(),type:"JavaScript Error",message:f(String(t.message||s.message)),timestamp:Date.now(),stack:this.config.captureStackTraces&&s.stack?f(s.stack):void 0,filename:"string"==typeof t.filename&&t.filename?t.filename:void 0,lineno:"number"==typeof t.lineno?t.lineno:void 0,colno:"number"==typeof t.colno?t.colno:void 0},s)})}),this.listen(window,"unhandledrejection",t=>{this.capture(()=>{const n=t.reason,s=n instanceof Error?n:new Error(v(n));e({id:u(),type:"Promise Rejection",message:f(s.message),timestamp:Date.now(),stack:this.config.captureStackTraces&&n instanceof Error&&n.stack?f(n.stack):void 0},s)})})}setupHotkeys(){const{toggle:e,minimize:t}=this.config.hotkeys;(e||t)&&this.listen(document,"keydown",n=>{const s=function(e){return"string"!=typeof e.key?"":[e.ctrlKey&&"ctrl",e.altKey&&"alt",e.shiftKey&&"shift",e.metaKey&&"meta",e.key.toLowerCase()].filter(Boolean).join("+")}(n);e&&s===e?(n.preventDefault(),this.toggle()):t&&s===t&&(n.preventDefault(),this.isVisible||this.show(),this.minimize())})}callUser(e,t){if(e)try{e(t)}catch(e){this.reportInternal("A DevInspector callback threw",e)}}reportInternal(e,t){const n=this.patches.find(e=>e.target===console&&"error"===e.key),s=n?n.original:console.error;try{s.call(console,`[DevInspector] ${e}:`,t)}catch(e){}}startPerformanceLoop(){if(!this.config.features.performance||null!==this.rafId||"function"!=typeof requestAnimationFrame)return;let e=performance.now(),t=0;const n=()=>{if(this.destroyed||!this.isVisible)return void(this.rafId=null);t++;const s=performance.now();if(s-e>=1e3){this.performanceStats.fps=Math.round(1e3*t/(s-e)),t=0,e=s;const n=performance.memory;n&&(this.performanceStats.memory={used:Math.round(n.usedJSHeapSize/1048576),total:Math.round(n.totalJSHeapSize/1048576),limit:Math.round(n.jsHeapSizeLimit/1048576)}),"performance"===this.activeTab&&this.scheduleRender()}this.rafId=requestAnimationFrame(n)};this.rafId=requestAnimationFrame(n)}stopPerformanceLoop(){null!==this.rafId&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(this.rafId),this.rafId=null}mountWhenReady(){if(document.body)return void this.mount();this.listen(document,"DOMContentLoaded",()=>{this.destroyed||this.widget||this.mount()})}get colors(){return h[this.config.theme]}placement(e){const[t,n]=this.config.position.split("-");return`${t}: ${e}px; ${n}: ${e}px;`}mount(){const e=document.createElement("div");e.className="devinspector-widget",e.setAttribute("role","button"),e.setAttribute("aria-label","Open DevInspector"),e.title="DevInspector",e.textContent="🔍",e.style.cssText=`position: fixed; ${this.placement(24)} width: 56px; height: 56px;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 50%;\n display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 999999;\n color: white; font-size: 24px; box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4); user-select: none;`,e.addEventListener("click",()=>this.toggle());const t=document.createElement("div");t.className="devinspector-panel",t.style.cssText=`position: fixed; ${this.placement(24)} width: 480px; max-width: calc(100vw - 48px);\n height: 650px; max-height: calc(100vh - 48px); background: ${this.colors.bg}; border: 1px solid ${this.colors.border};\n border-radius: 12px; display: none; flex-direction: column; z-index: 999998; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 13px;\n color: ${this.colors.text}; overflow: hidden;`,t.addEventListener("click",e=>this.handlePanelClick(e)),this.widget=e,this.panel=t,document.body.appendChild(e),document.body.appendChild(t),this.render()}handlePanelClick(e){var t,n;const s=e.target,r=null===(t=null==s?void 0:s.closest)||void 0===t?void 0:t.call(s,"[data-action]");if(!r)return;switch(r.getAttribute("data-action")){case"minimize":this.minimize();break;case"close":this.hide();break;case"tab":{const e=r.getAttribute("data-tab");["network","console","performance","errors"].includes(e)&&(this.activeTab=e,this.render());break}case"clear":this.clear(null!==(n=r.getAttribute("data-target"))&&void 0!==n?n:"all");break;case"toggle-recording":this.toggleRecording();break;case"select-request":this.selectedRequestId=r.getAttribute("data-id"),this.render();break;case"close-details":this.selectedRequestId=null,this.render()}}scheduleRender(){!this.renderQueued&&this.panel&&this.isVisible&&(this.renderQueued=!0,queueMicrotask(()=>{this.renderQueued=!1,this.destroyed||this.render()}))}render(){if(!this.panel||!this.isVisible)return;const e=this.colors,t=(e,t,n="",s="#374151")=>`<button type="button" data-action="${e}" ${n} style="padding: 6px 12px; background: ${s}; border: none; color: white; cursor: pointer; border-radius: 6px; margin-right: 8px;">${t}</button>`,n=[{id:"network",label:"Network",count:this.network.length},{id:"console",label:"Console",count:this.consoleEntries.length},{id:"performance",label:"Performance"},{id:"errors",label:"Errors",count:this.errors.length}],r=`\n <div style="display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: ${e.header}; border-bottom: 1px solid ${e.border};">\n <div style="display: flex; align-items: center; gap: 8px;">\n <span style="width: 8px; height: 8px; border-radius: 50%; background: ${this.isRecording?"#ef4444":"#6b7280"};"></span>\n <span style="font-weight: 600; font-size: 14px;">DevInspector v${s(o)}</span>\n </div>\n <div style="display: flex; gap: 4px;">\n <button type="button" data-action="minimize" aria-label="Minimize" style="padding: 6px; background: none; border: none; color: ${e.muted}; cursor: pointer;">−</button>\n <button type="button" data-action="close" aria-label="Close" style="padding: 6px; background: none; border: none; color: ${e.muted}; cursor: pointer;">×</button>\n </div>\n </div>`;if(this.isMinimized)return void(this.panel.innerHTML=r);const i=n.map(t=>`<button type="button" data-action="tab" data-tab="${t.id}" style="padding: 12px 16px; border: none; cursor: pointer;\n background: ${this.activeTab===t.id?e.bg:"transparent"}; color: ${this.activeTab===t.id?"#3b82f6":e.muted};\n border-bottom: 2px solid ${this.activeTab===t.id?"#3b82f6":"transparent"};">${t.label}${void 0!==t.count?` <span style="background: #374151; color: white; padding: 2px 6px; border-radius: 10px; font-size: 11px; margin-left: 4px;">${t.count}</span>`:""}</button>`).join("");let a="";switch(this.activeTab){case"network":a=this.renderNetwork(t);break;case"console":a=this.renderConsole(t);break;case"performance":a=this.renderPerformance(t);break;case"errors":a=this.renderErrors(t)}this.panel.innerHTML=`${r}\n <div style="display: flex; background: ${e.header}; border-bottom: 1px solid ${e.border};">${i}</div>\n <div style="flex: 1; min-height: 0; display: flex; flex-direction: column;">${a}</div>`}toolbar(e,t){const n=this.colors;return`<div style="padding: 12px; border-bottom: 1px solid ${n.border}; background: ${n.toolbar}; display: flex; align-items: center;">\n ${e}<span style="margin-left: auto; color: ${n.muted}; font-size: 12px;">${t}</span></div>`}empty(e){return`<div style="display: flex; align-items: center; justify-content: center; height: 200px; color: ${this.colors.muted};">${e}</div>`}renderNetwork(e){var t;const n=this.colors,r=this.config.hideAssets?this.network.filter(e=>!l.test(e.url)):this.network,i=r.map(e=>{var t;const r=e.id===this.selectedRequestId;return`<div data-action="select-request" data-id="${s(e.id)}" style="padding: 10px 16px; border-bottom: 1px solid ${n.row}; cursor: pointer; ${r?"background: rgba(59, 130, 246, 0.25);":""}">\n <div style="display: flex; justify-content: space-between; margin-bottom: 4px;">\n <div style="display: flex; gap: 8px;">\n <span style="background: ${function(e){switch(e){case"GET":return"#16a34a";case"POST":return"#2563eb";case"PUT":return"#d97706";case"DELETE":return"#dc2626";case"PATCH":return"#7c3aed";default:return"#6b7280"}}(e.method)}; color: white; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600;">${s(e.method)}</span>\n <span style="color: ${i=e.status,"number"!=typeof i?"#6b7280":i>=200&&i<300?"#22c55e":i>=300&&i<400?"#f59e0b":i>=400?"#ef4444":"#6b7280"}; font-weight: 600;">${s(e.status)}</span>\n <span style="color: ${n.muted};">${null!==(t=e.duration)&&void 0!==t?t:"-"}ms</span>\n </div>\n <span style="color: ${n.muted}; font-size: 11px;">${s(new Date(e.timestamp).toLocaleTimeString())}</span>\n </div>\n <div style="font-size: 12px; word-break: break-all;">${s(e.url)}</div>\n </div>`;var i}).join(""),o=this.selectedRequestId?this.network.find(e=>e.id===this.selectedRequestId):void 0,a=o?`<div style="border-top: 1px solid ${n.border}; max-height: 200px; overflow-y: auto; background: ${n.toolbar}; padding: 12px 16px; font-size: 12px;">\n <div style="display: flex; justify-content: space-between; margin-bottom: 8px;"><strong>Request details</strong>\n <button type="button" data-action="close-details" aria-label="Close details" style="background: none; border: none; color: ${n.muted}; cursor: pointer;">×</button></div>\n <div><strong>URL:</strong> ${s(o.url)}</div>\n <div><strong>Method:</strong> ${s(o.method)}</div>\n <div><strong>Type:</strong> ${s(o.type)}</div>\n <div><strong>Status:</strong> ${s(o.status)}</div>\n <div><strong>Duration:</strong> ${null!==(t=o.duration)&&void 0!==t?t:"-"}ms</div>\n ${o.error?`<div><strong>Error:</strong> ${s(o.error)}</div>`:""}\n </div>`:"";return`${this.toolbar(e("clear","Clear",'data-target="network"')+e("toggle-recording",this.isRecording?"Pause":"Resume","",this.isRecording?"#ef4444":"#22c55e"),`${r.length} requests`)}\n <div style="flex: 1; overflow-y: auto;">${i||this.empty("No network activity")}</div>${a}`}renderConsole(e){const t=this.colors,n=this.consoleEntries.map(e=>`<div style="padding: 8px 16px; border-bottom: 1px solid ${t.row}; font-size: 12px;">\n <span style="color: ${function(e){switch(e){case"info":return"#60a5fa";case"warn":return"#fbbf24";case"error":return"#f87171";case"debug":return"#a78bfa";default:return"inherit"}}(e.level)}; text-transform: uppercase; font-weight: 600;">[${s(e.level)}]</span>\n <span style="color: ${t.muted}; margin: 0 8px;">${s(new Date(e.timestamp).toLocaleTimeString())}</span>\n <span style="white-space: pre-wrap; word-break: break-word;">${s(e.message)}</span>\n </div>`).join("");return`${this.toolbar(e("clear","Clear",'data-target="console"'),`${this.consoleEntries.length} logs`)}\n <div style="flex: 1; overflow-y: auto; font-family: monospace;">${n||this.empty("No console logs")}</div>`}renderPerformance(e){const t=this.colors,{fps:n,memory:r}=this.performanceStats,i=this.metrics.slice(0,100).map(e=>`<div style="padding: 6px 0; border-bottom: 1px solid ${t.row}; font-size: 12px;">\n <strong>${s(e.name)}</strong>\n ${void 0!==e.duration?`<span style="color: ${t.muted};"> ${e.duration.toFixed(1)}ms</span>`:""}\n ${void 0!==e.data?`<span style="color: ${t.muted};"> ${s(f(v(e.data)))}</span>`:""}\n </div>`).join("");return`${this.toolbar(e("clear","Clear",'data-target="metrics"'),`${this.metrics.length} metrics`)}\n <div style="flex: 1; overflow-y: auto; padding: 16px;">\n <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;">\n <div style="background: #1e3a8a; border-radius: 12px; padding: 16px; text-align: center;">\n <div style="font-size: 28px; font-weight: 700; color: #93c5fd;">${this.config.features.performance?n:"-"}</div>\n <div style="font-size: 12px; color: #bfdbfe;">FPS</div>\n </div>\n <div style="background: #166534; border-radius: 12px; padding: 16px; text-align: center;">\n <div style="font-size: 28px; font-weight: 700; color: #86efac;">${r?`${r.used} MB`:"N/A"}</div>\n <div style="font-size: 12px; color: #bbf7d0;">Memory</div>\n </div>\n </div>\n ${i||`<div style="color: ${t.muted};">Use track(), markStart() and markEnd() to record metrics.</div>`}\n </div>`}renderErrors(e){const t=this.colors,n=this.errors.map(e=>`<div style="padding: 12px 16px; border-bottom: 1px solid ${t.row};">\n <div style="display: flex; justify-content: space-between; margin-bottom: 6px;">\n <span style="color: #ef4444; font-weight: 600;">${s(e.type)}</span>\n <span style="color: ${t.muted}; font-size: 11px;">${s(new Date(e.timestamp).toLocaleTimeString())}</span>\n </div>\n <div style="color: #f87171; margin-bottom: 6px; word-break: break-word;">${s(e.message)}</div>\n ${e.stack?`<pre style="background: ${t.code}; padding: 8px; border-radius: 4px; font-size: 11px; color: ${t.muted}; overflow-x: auto; white-space: pre-wrap;">${s(e.stack)}</pre>`:""}\n </div>`).join("");return`${this.toolbar(e("clear","Clear",'data-target="errors"'),`${this.errors.length} errors`)}\n <div style="flex: 1; overflow-y: auto;">${n||this.empty("No errors recorded")}</div>`}}w.instances=[];class x{constructor(e){this.head=0,this.tail=0,this.size=0,this.idCounter=0,this.maxSize=e.maxSize,this.ttl=e.ttl,this.onEvict=e.onEvict,this.buffer=new Array(this.maxSize)}push(e){const t=`${Date.now()}-${++this.idCounter}`,n={id:t,timestamp:Date.now(),data:e};if(this.size===this.maxSize){const e=this.buffer[this.tail];e&&this.onEvict&&this.onEvict(e),this.tail=(this.tail+1)%this.maxSize}else this.size++;return this.buffer[this.head]=n,this.head=(this.head+1)%this.maxSize,t}get(e){const t=this.findEntry(e);if(t&&!this.isExpired(t))return t.data}getAll(){return this.getAllEntries().map(e=>e.data)}getAllEntries(){const e=[],t=Date.now();for(let n=0;n<this.size;n++){const s=(this.tail+n)%this.maxSize,r=this.buffer[s];r&&!this.isExpired(r,t)&&e.push(r)}return e}find(e){const t=this.getAllEntries();for(const n of t)if(e(n.data))return n.data}filter(e){return this.getAllEntries().filter(t=>e(t.data)).map(e=>e.data)}clear(){this.buffer=new Array(this.maxSize),this.head=0,this.tail=0,this.size=0}getSize(){return this.size}isFull(){return this.size===this.maxSize}findEntry(e){for(let t=0;t<this.size;t++){const n=(this.tail+t)%this.maxSize,s=this.buffer[n];if(s&&s.id===e)return s}}isExpired(e,t=Date.now()){return!!this.ttl&&t-e.timestamp>this.ttl}removeExpired(){if(!this.ttl)return 0;const e=Date.now();let t=0;const n=[];for(let s=0;s<this.size;s++){const r=(this.tail+s)%this.maxSize,i=this.buffer[r];i&&!this.isExpired(i,e)?n.push(i):i&&this.onEvict&&(this.onEvict(i),t++)}return this.buffer=new Array(this.maxSize),this.size=n.length,this.tail=0,this.head=this.size,n.forEach((e,t)=>{this.buffer[t]=e}),t}}class k{constructor(e){this.storage=new Map,this.accessOrder=[],this.maxSize=e.maxSize,this.ttl=e.ttl,this.onEvict=e.onEvict}set(e,t){const n={id:e,timestamp:Date.now(),data:t};if(this.storage.has(e)){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1)}else if(this.storage.size>=this.maxSize){const e=this.accessOrder.shift();if(e){const t=this.storage.get(e);t&&this.onEvict&&this.onEvict(t),this.storage.delete(e)}}this.storage.set(e,n),this.accessOrder.push(e)}get(e){const t=this.storage.get(e);if(t&&!this.isExpired(t))return this.updateAccessOrder(e),t.data;t&&this.delete(e)}has(e){const t=this.storage.get(e);return!(!t||this.isExpired(t))||(t&&this.delete(e),!1)}delete(e){const t=this.storage.get(e);return!!t&&(this.onEvict&&this.onEvict(t),this.storage.delete(e),this.accessOrder=this.accessOrder.filter(t=>t!==e),!0)}clear(){this.onEvict&&this.storage.forEach(e=>this.onEvict(e)),this.storage.clear(),this.accessOrder=[]}getSize(){return this.storage.size}getAllKeys(){return Array.from(this.storage.keys())}getAllValues(){return Array.from(this.storage.values()).filter(e=>!this.isExpired(e)).map(e=>e.data)}updateAccessOrder(e){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}isExpired(e){return!!this.ttl&&Date.now()-e.timestamp>this.ttl}removeExpired(){let e=0;const t=[];return this.storage.forEach((e,n)=>{this.isExpired(e)&&t.push(n)}),t.forEach(t=>{this.delete(t)&&e++}),e}}let E=class n{constructor(e={}){if(this.isVisible=!1,this.isMinimized=!1,this.monitors=new Map,this.ui=null,this.initialized=!1,this.cleanupFunctions=[],this.initPromise=null,this.destroyed=!1,n.instance)return console.warn("DevInspector instance already exists. Returning existing instance."),n.instance;this.config=this.mergeConfig(e),this.events=new r({maxListeners:100}),this.networkStorage=new x({maxSize:this.config.maxNetworkEntries,onEvict:e=>this.events.emit("network:evict",e)}),this.consoleStorage=new x({maxSize:this.config.maxConsoleEntries,onEvict:e=>this.events.emit("console:evict",e)}),this.performanceStorage=new k({maxSize:1e3,ttl:36e5}),this.errorStorage=new x({maxSize:this.config.maxErrorEntries,onEvict:e=>this.events.emit("error:evict",e)}),this.pluginSystem=new i({inspector:this,storage:{network:this.networkStorage,console:this.consoleStorage,performance:this.performanceStorage,error:this.errorStorage},events:this.events,config:this.config}),this.config.enabled&&this.init(),n.instance=this}mergeConfig(t){const n={enabled:e(),position:"bottom-right",theme:"auto",hotkeys:{toggle:"ctrl+shift+d",minimize:"ctrl+shift+m"},features:{network:!0,console:!0,performance:!0,errors:!0,state:!0,dom:!0,storage:!0},plugins:[],maxNetworkEntries:1e3,maxConsoleEntries:500,captureStackTraces:!0,networkFilters:{hideAssets:!1,hideCached:!1},onError:()=>{},onPerformanceIssue:()=>{},maxErrorEntries:100,slowRequestThreshold:3e3,workerUrl:void 0,remoteConfig:null};return{...n,...t,hotkeys:{...n.hotkeys,...t.hotkeys},features:{...n.features,...t.features},networkFilters:{...n.networkFilters,...t.networkFilters}}}init(){return this.initPromise||(this.initPromise=this.runInit()),this.initPromise}async runInit(){var e,n;if(!this.initialized&&!this.destroyed&&t())try{if(await this.loadMonitors(),this.destroyed)return this.teardown();if(await this.loadUI(),this.destroyed)return this.teardown();if(await this.registerPlugins(),this.destroyed)return this.teardown();this.setupHotkeys(),this.setupErrorHandlers(),this.initialized=!0,this.events.emit("inspector:ready")}catch(t){this.teardown(),this.initPromise=null,console.error("Failed to initialize DevInspector:",t),null===(n=(e=this.config).onError)||void 0===n||n.call(e,t)}}async loadMonitors(){const e=this.config.features;if(e.network){const{NetworkMonitor:e}=await Promise.resolve().then(function(){return P}),t=new e(this);this.monitors.set("network",t),t.start()}if(e.console){const{ConsoleMonitor:e}=await Promise.resolve().then(function(){return A}),t=new e(this);this.monitors.set("console",t),t.start()}if(e.performance){const{PerformanceMonitor:e}=await Promise.resolve().then(function(){return H}),t=new e(this);this.monitors.set("performance",t),t.start()}if(e.errors){const{ErrorMonitor:e}=await Promise.resolve().then(function(){return B}),t=new e(this);this.monitors.set("error",t),t.start()}if(e.state){const{StateMonitor:e}=await Promise.resolve().then(function(){return U}),t=new e(this);this.monitors.set("state",t),t.start()}if(e.dom){const{DOMMonitor:e}=await Promise.resolve().then(function(){return _}),t=new e(this);this.monitors.set("dom",t),t.start()}if(e.storage){const{StorageMonitor:e}=await Promise.resolve().then(function(){return W}),t=new e(this);this.monitors.set("storage",t),t.start()}}async loadUI(){const{DevInspectorUI:e}=await Promise.resolve().then(function(){return X});this.ui=new e(this),await this.ui.init()}async registerPlugins(){for(const e of this.config.plugins)try{await this.pluginSystem.register(e)}catch(e){console.error("Failed to register plugin:",e)}}setupHotkeys(){const e=e=>{const{hotkeys:t}=this.config,n=this.getKeyCombo(e);n===t.toggle?(e.preventDefault(),this.toggle()):n===t.minimize&&(e.preventDefault(),this.minimize())};document.addEventListener("keydown",e),this.cleanupFunctions.push(()=>document.removeEventListener("keydown",e))}setupErrorHandlers(){if(!this.config.features.errors)return;const e=e=>{this.events.emit("error:uncaught",{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error:e.error,timestamp:Date.now()})},t=e=>{this.events.emit("error:uncaught",{message:"Unhandled promise rejection",reason:e.reason,promise:e.promise,timestamp:Date.now()})};window.addEventListener("error",e),window.addEventListener("unhandledrejection",t),this.cleanupFunctions.push(()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",t)})}getKeyCombo(e){const t=[];return e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.metaKey&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}show(){var e;this.destroyed||(this.initialized?(this.isVisible=!0,this.isMinimized=!1,null===(e=this.ui)||void 0===e||e.show(),this.events.emit("inspector:show")):this.init().then(()=>{this.initialized&&!this.destroyed&&this.show()}).catch(e=>{var t,n;console.error("Failed to show inspector:",e),null===(n=(t=this.config).onError)||void 0===n||n.call(t,e)}))}hide(){var e;this.isVisible=!1,null===(e=this.ui)||void 0===e||e.hide(),this.events.emit("inspector:hide")}minimize(){var e;this.isMinimized=!0,null===(e=this.ui)||void 0===e||e.minimize(),this.events.emit("inspector:minimize")}toggle(){this.isVisible&&!this.isMinimized?this.hide():this.show()}teardown(){var e;this.monitors.forEach(e=>{var t;try{null===(t=e.stop)||void 0===t||t.call(e)}catch(e){console.error("DevInspector: failed to stop a monitor",e)}}),this.monitors.clear(),null===(e=this.ui)||void 0===e||e.destroy(),this.ui=null,this.cleanupFunctions.forEach(e=>e()),this.cleanupFunctions=[]}destroy(){this.destroyed=!0,this.teardown(),this.events.emit("inspector:destroy"),this.events.removeAllListeners(),n.instance=null}track(e,t){this.events.emit("performance:metric",{name:e,data:t,timestamp:Date.now()})}markStart(e){performance.mark(`devinspector-${e}-start`)}markEnd(e){performance.mark(`devinspector-${e}-end`);try{performance.measure(`devinspector-${e}`,`devinspector-${e}-start`,`devinspector-${e}-end`)}catch(t){console.warn(`Failed to measure ${e}:`,t)}}async use(e){await this.pluginSystem.register(e)}export(){return{version:"1.0.0",timestamp:Date.now(),config:this.config,data:{network:this.networkStorage.getAll(),console:this.consoleStorage.getAll(),performance:this.performanceStorage.getAllValues(),errors:this.errorStorage.getAll()}}}import(e){console.log("Import functionality not yet implemented",e)}on(e,t){return this.events.on(e,t)}off(e,t){this.events.off(e,t)}getEvents(){return this.events}getStorage(e){switch(e){case"network":return this.networkStorage;case"console":return this.consoleStorage;case"performance":return this.performanceStorage;case"error":return this.errorStorage}}getConfig(){return this.config}getPluginSystem(){return this.pluginSystem}getMonitor(e){return this.monitors.get(e)}static getInstance(){return n.instance}};E.instance=null;var S=Object.freeze({__proto__:null,BasePlugin:class{async install(e){this.context=e,await this.onInstall()}async uninstall(){await this.onUninstall(),this.context=void 0}enable(){this.onEnable()}disable(){this.onDisable()}onUninstall(){}onEnable(){}onDisable(){}get inspector(){var e;return null===(e=this.context)||void 0===e?void 0:e.inspector}get events(){var e;if(!(null===(e=this.context)||void 0===e?void 0:e.events))throw new Error("Events not available - plugin not installed");return this.context.events}get storage(){var e;return null===(e=this.context)||void 0===e?void 0:e.storage}get config(){var e;return null===(e=this.context)||void 0===e?void 0:e.config}},CircularStorage:x,DevInspector:w,EnhancedDevInspector:w,EventEmitter:r,IndexedStorage:k,OriginalDevInspector:E,SimpleDevInspector:class{constructor(n={}){this.widget=null,this.panel=null,this.isVisible=!1,this.onKeydown=e=>{e.ctrlKey&&e.shiftKey&&("D"===e.key||"d"===e.key)&&(e.preventDefault(),this.toggle())},this.config={enabled:e(),position:"bottom-right",theme:"dark",...n},this.config.enabled&&t()&&this.init()}init(){this.createWidget(),this.createPanel(),this.setupEventListeners()}createWidget(){this.widget=document.createElement("div"),this.widget.style.cssText=`\n position: fixed;\n ${"bottom-right"===this.config.position?"bottom: 20px; right: 20px;":""}\n ${"bottom-left"===this.config.position?"bottom: 20px; left: 20px;":""}\n ${"top-right"===this.config.position?"top: 20px; right: 20px;":""}\n ${"top-left"===this.config.position?"top: 20px; left: 20px;":""}\n width: 60px;\n height: 60px;\n background: #007acc;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 999999;\n font-size: 24px;\n box-shadow: 0 4px 16px rgba(0,0,0,0.3);\n transition: transform 0.3s ease;\n color: white;\n `,this.widget.innerHTML="🔍",this.widget.title="DevInspector - Click to toggle",document.body.appendChild(this.widget)}createPanel(){var e,t,n;this.panel=document.createElement("div");const s="dark"===this.config.theme?"#1e1e1e":"#ffffff",r="dark"===this.config.theme?"#cccccc":"#333333",i="dark"===this.config.theme?"#3e3e42":"#ddd";this.panel.style.cssText=`\n position: fixed;\n ${(null===(e=this.config.position)||void 0===e?void 0:e.includes("bottom"))?"bottom: 100px;":"top: 100px;"}\n ${(null===(t=this.config.position)||void 0===t?void 0:t.includes("right"))?"right: 20px;":"left: 20px;"}\n width: 500px;\n height: 400px;\n background: ${s};\n border: 1px solid ${i};\n border-radius: 8px;\n color: ${r};\n font-family: Monaco, monospace;\n font-size: 12px;\n display: none;\n flex-direction: column;\n z-index: 999998;\n box-shadow: 0 8px 32px rgba(0,0,0,0.5);\n `,this.panel.innerHTML=`\n <div style="padding: 10px; background: ${"dark"===this.config.theme?"#2d2d30":"#f5f5f5"}; border-bottom: 1px solid ${i}; display: flex; justify-content: space-between; align-items: center;">\n <span style="font-weight: bold;">DevInspector v1.0.0</span>\n <button type="button" class="devinspector-close" style="background: #f44336; border: none; color: white; width: 20px; height: 20px; border-radius: 3px; cursor: pointer;">×</button>\n </div>\n <div style="display: flex; background: ${"dark"===this.config.theme?"#2d2d30":"#f5f5f5"}; border-bottom: 1px solid ${i};">\n <button style="padding: 8px 16px; background: #007acc; border: none; color: white; cursor: pointer;">Network</button>\n <button style="padding: 8px 16px; background: none; border: none; color: ${r}; cursor: pointer;">Console</button>\n <button style="padding: 8px 16px; background: none; border: none; color: ${r}; cursor: pointer;">Performance</button>\n <button style="padding: 8px 16px; background: none; border: none; color: ${r}; cursor: pointer;">Errors</button>\n </div>\n <div style="flex: 1; padding: 15px; overflow: auto;">\n <div style="text-align: center; margin-top: 50px; color: #666;">\n <h3 style="color: #007acc; margin-bottom: 20px;">🎉 DevInspector v1.0.0 - Production Ready!</h3>\n <p>Welcome to the professional developer debugging tool!</p>\n <br>\n <div style="text-align: left; max-width: 400px; margin: 0 auto;">\n <h4 style="color: #007acc;">✅ Features Implemented:</h4>\n <ul style="list-style: none; padding: 0;">\n <li>🌐 Network monitoring (fetch, XHR, WebSocket)</li>\n <li>📝 Console enhancement with filtering</li>\n <li>⚡ Performance monitoring (FPS, memory, metrics)</li>\n <li>🐛 Error tracking with grouping</li>\n <li>🎨 Professional UI with themes</li>\n <li>🔌 Plugin architecture</li>\n <li>📦 Zero dependencies</li>\n <li>🚀 Production ready builds</li>\n </ul>\n <br>\n <p style="font-size: 11px; opacity: 0.8;">\n This is the production-ready DevInspector tool!<br>\n Framework-agnostic • TypeScript • Zero dependencies\n </p>\n </div>\n </div>\n </div>\n `,this.panel.className="devinspector-panel",null===(n=this.panel.querySelector(".devinspector-close"))||void 0===n||n.addEventListener("click",()=>this.hide()),document.body.appendChild(this.panel)}setupEventListeners(){this.widget&&this.widget.addEventListener("click",()=>this.toggle()),document.addEventListener("keydown",this.onKeydown)}show(){this.panel&&(this.panel.style.display="flex",this.isVisible=!0)}hide(){this.panel&&(this.panel.style.display="none",this.isVisible=!1)}toggle(){this.isVisible?this.hide():this.show()}destroy(){t()&&document.removeEventListener("keydown",this.onKeydown),this.widget&&this.widget.parentNode&&this.widget.parentNode.removeChild(this.widget),this.panel&&this.panel.parentNode&&this.panel.parentNode.removeChild(this.panel)}track(e,t){console.log(`[DevInspector] Tracking: ${e}`,t)}markStart(e){performance.mark(`devinspector-${e}-start`)}markEnd(e){performance.mark(`devinspector-${e}-end`);try{performance.measure(`devinspector-${e}`,`devinspector-${e}-start`,`devinspector-${e}-end`)}catch(t){console.warn(`Failed to measure ${e}:`,t)}}},VERSION:o,default:w});const $=w;for(const[e,t]of Object.entries(S))e in $||Object.defineProperty($,e,{value:t,enumerable:!0});function M(){return`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}const z=65536;class L{constructor(e={}){this.requestMap=new Map,this.installed=null,this.originalFetch=window.fetch,this.handlers=e}install(){const e=this;if(this.installed||"function"!=typeof this.originalFetch)return;const t=async function(t,n){var s,r,i,o;const a=M(),c=performance.now();let l,d,h,p={};if("undefined"!=typeof Request&&t instanceof Request){l=t.url,d=t.method,t.headers.forEach((e,t)=>{p[t]=e});try{h=await e.extractBody(t)}catch(e){h="[Body unavailable - request already used]"}}else l=t.toString(),d=(null==n?void 0:n.method)||"GET",(null==n?void 0:n.headers)&&(n.headers instanceof Headers?n.headers.forEach((e,t)=>{p[t]=e}):Array.isArray(n.headers)?n.headers.forEach(([e,t])=>{p[e]=t}):p=n.headers),h=null==n?void 0:n.body;const u={id:a,method:d,url:l,headers:p,body:e.sanitizeBody(h),timestamp:Date.now(),type:"fetch"};let m;e.requestMap.set(a,u),null===(r=(s=e.handlers).onRequest)||void 0===r||r.call(s,u);try{m=await e.originalFetch.apply(null!=this?this:window,[t,n])}catch(t){const n={id:a,message:(null==t?void 0:t.message)||"Network request failed",stack:null==t?void 0:t.stack,timestamp:Date.now()};throw null===(o=(i=e.handlers).onError)||void 0===o||o.call(i,n),e.requestMap.delete(a),t}const g=performance.now()-c;return e.reportResponse(a,m,g),m};this.installed=t,window.fetch=t}async reportResponse(e,t,n){var s,r;try{const i={};let o;t.headers.forEach((e,t)=>{i[t]=e});try{o=t.bodyUsed?"[Body already read]":await this.extractResponseBody(t.clone())}catch(e){o="[Unable to read response]"}null===(r=(s=this.handlers).onResponse)||void 0===r||r.call(s,{id:e,status:t.status,statusText:t.statusText,headers:i,body:o,size:this.calculateSize(o,i),duration:n,timestamp:Date.now(),fromCache:this.isFromCache(t,n)})}catch(e){}finally{this.requestMap.delete(e)}}uninstall(){this.installed&&window.fetch===this.installed&&(window.fetch=this.originalFetch),this.installed=null,this.requestMap.clear()}async extractBody(e){try{const t=e.headers.get("content-type")||"";if(e.bodyUsed)return"[Body already read]";const n=e.clone();return t.includes("application/json")?await this.readPreview(n,!0):t.includes("text/")||t.includes("application/x-www-form-urlencoded")?await this.readPreview(n,!1):t.includes("multipart/form-data")?"[FormData]":"[Binary data]"}catch(e){return"[Unable to read body]"}}async readCapped(e){const t=e.body;if(!t||"function"!=typeof t.getReader){const t=await e.text();return t.length>z?{text:t.slice(0,z),truncated:!0}:{text:t,truncated:!1}}const n=t.getReader(),s=new TextDecoder;let r="",i=0;try{for(;;){const{done:e,value:t}=await n.read();if(e)return{text:r+s.decode(),truncated:!1};if(i+=t.byteLength,r+=s.decode(t,{stream:!0}),i>=z)return{text:r.slice(0,z),truncated:!0}}}finally{n.cancel().catch(()=>{})}}async readPreview(e,t){const{text:n,truncated:s}=await this.readCapped(e);if(s)return`${n}... [truncated]`;if(t)try{return JSON.parse(n)}catch(e){return n}return n}async extractResponseBody(e){var t,n;try{const s=e.headers.get("content-type")||"";if(s.includes("text/event-stream"))return null===(t=e.body)||void 0===t||t.cancel().catch(()=>{}),"[Event stream]";if(s.includes("application/json"))return await this.readPreview(e,!0);if(s.includes("text/"))return await this.readPreview(e,!1);if(s.includes("image/"))return"[Image data]";if(s.includes("video/"))return"[Video data]";if(s.includes("audio/"))return"[Audio data]";const r=e.headers.get("content-length");return null===(n=e.body)||void 0===n||n.cancel().catch(()=>{}),r?`[Binary data: ${r} bytes]`:"[Binary data]"}catch(e){return"[Unable to read response]"}}sanitizeBody(e){if(e){if("string"==typeof e)return e.length>1e4?e.substring(0,1e4)+"...":e;if(e instanceof FormData){const t={};return e.forEach((e,n)=>{e instanceof File?t[n]=`[File: ${e.name}, ${e.size} bytes]`:t[n]=e}),{type:"FormData",entries:t}}return e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e instanceof Blob?`[Blob: ${e.size} bytes, type: ${e.type}]`:e instanceof URLSearchParams?e.toString():e}}calculateSize(e,t){const n=t["content-length"];if(n)return parseInt(n,10);if("string"==typeof e)return new Blob([e]).size;if(e&&"object"==typeof e)try{return new Blob([JSON.stringify(e)]).size}catch(e){return 0}return 0}isFromCache(e,t){if(t<5)return!0;const n=e.headers.get("cache-control"),s=e.headers.get("etag"),r=e.headers.get("last-modified");return!!(n||s||r)}}class C{constructor(e={}){this.installed=null,this.handlers=e,this.originalOpen=XMLHttpRequest.prototype.open,this.originalSend=XMLHttpRequest.prototype.send,this.originalSetRequestHeader=XMLHttpRequest.prototype.setRequestHeader}install(){if(this.installed||"undefined"==typeof XMLHttpRequest)return;const e=this;XMLHttpRequest.prototype.open=function(t,n,s=!0,r,i){return this._devinspectorId=M(),this._devinspectorMethod=t,this._devinspectorUrl=n.toString(),this._devinspectorRequestHeaders={},e.originalOpen.apply(this,[t,n,s,r,i])},XMLHttpRequest.prototype.setRequestHeader=function(t,n){return this._devinspectorRequestHeaders&&(this._devinspectorRequestHeaders[t]=n),e.originalSetRequestHeader.apply(this,[t,n])},XMLHttpRequest.prototype.send=function(t){var n,s;this._devinspectorStartTime=performance.now(),this._devinspectorRequestBody=e.sanitizeBody(t);const r={id:this._devinspectorId,method:this._devinspectorMethod,url:this._devinspectorUrl,headers:this._devinspectorRequestHeaders||{},body:this._devinspectorRequestBody,timestamp:Date.now(),type:"xhr"};return null===(s=(n=e.handlers).onRequest)||void 0===s||s.call(n,r),this.upload&&e.handlers.onProgress&&this.upload.addEventListener("progress",t=>{t.lengthComputable&&e.handlers.onProgress({id:this._devinspectorId,loaded:t.loaded,total:t.total})}),e.handlers.onProgress&&this.addEventListener("progress",t=>{t.lengthComputable&&e.handlers.onProgress({id:this._devinspectorId,loaded:t.loaded,total:t.total})}),this.addEventListener("load",function(){var t,n;const s=performance.now()-this._devinspectorStartTime,r=e.parseResponseHeaders(this.getAllResponseHeaders()),i=e.extractResponseBody(this),o=e.calculateSize(i,r),a={id:this._devinspectorId,status:this.status,statusText:this.statusText,headers:r,body:i,size:o,duration:s,timestamp:Date.now(),fromCache:s<5};null===(n=(t=e.handlers).onResponse)||void 0===n||n.call(t,a)}),this.addEventListener("error",function(){var t,n;const s={id:this._devinspectorId,message:"Network request failed",timestamp:Date.now()};null===(n=(t=e.handlers).onError)||void 0===n||n.call(t,s)}),this.addEventListener("timeout",function(){var t,n;const s={id:this._devinspectorId,message:`Request timeout after ${this.timeout}ms`,timestamp:Date.now()};null===(n=(t=e.handlers).onError)||void 0===n||n.call(t,s)}),this.addEventListener("abort",function(){var t,n;const s={id:this._devinspectorId,message:"Request aborted",timestamp:Date.now()};null===(n=(t=e.handlers).onError)||void 0===n||n.call(t,s)}),e.originalSend.apply(this,[t])},this.installed={open:XMLHttpRequest.prototype.open,send:XMLHttpRequest.prototype.send,setRequestHeader:XMLHttpRequest.prototype.setRequestHeader}}uninstall(){if(!this.installed)return;const e=XMLHttpRequest.prototype;e.open===this.installed.open&&(e.open=this.originalOpen),e.send===this.installed.send&&(e.send=this.originalSend),e.setRequestHeader===this.installed.setRequestHeader&&(e.setRequestHeader=this.originalSetRequestHeader),this.installed=null}sanitizeBody(e){if(e){if("string"==typeof e)return e.length>1e4?e.substring(0,1e4)+"...":e;if(e instanceof FormData){const t={};return e.forEach((e,n)=>{e instanceof File?t[n]=`[File: ${e.name}, ${e.size} bytes]`:t[n]=e}),{type:"FormData",entries:t}}return e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e instanceof Blob?`[Blob: ${e.size} bytes, type: ${e.type}]`:e instanceof Document?"[Document]":e}}parseResponseHeaders(e){const t={};if(!e)return t;return e.trim().split(/[\r\n]+/).forEach(e=>{const n=e.split(": "),s=n.shift();s&&(t[s]=n.join(": "))}),t}extractResponseBody(e){try{const t=e.getResponseHeader("content-type")||"";if("json"===e.responseType&&e.response)return e.response;if("arraybuffer"===e.responseType&&e.response)return`[ArrayBuffer: ${e.response.byteLength} bytes]`;if("blob"===e.responseType&&e.response)return`[Blob: ${e.response.size} bytes, type: ${e.response.type}]`;if("document"===e.responseType)return"[Document]";if(e.responseText){if(t.includes("application/json"))try{return JSON.parse(e.responseText)}catch(t){return e.responseText}return e.responseText.length>1e4?e.responseText.substring(0,1e4)+"...":e.responseText}return null}catch(e){return"[Unable to read response]"}}calculateSize(e,t){const n=t["content-length"];if(n)return parseInt(n,10);if("string"==typeof e)return new Blob([e]).size;if(e&&"object"==typeof e)try{return new Blob([JSON.stringify(e)]).size}catch(e){return 0}return 0}}class I{constructor(e={}){this.connections=new Map,this.installed=null,this.originalWebSocket=window.WebSocket,this.handlers=e}install(){const e=this,t=this.originalWebSocket;if("function"!=typeof t||this.installed)return;const n=function(n,s){var r,i;const o=new t(n,s),a=M();o._devinspectorId=a,o._devinspectorUrl=n.toString(),o._devinspectorProtocols=s;const c={id:a,url:n.toString(),protocols:s,timestamp:Date.now(),readyState:o.readyState,status:"connecting"};e.connections.set(a,c),null===(i=(r=e.handlers).onConnection)||void 0===i||i.call(r,c),o.addEventListener("open",function(){var t,n;const s=e.connections.get(a);s&&(s.status="open",s.readyState=this.readyState,null===(n=(t=e.handlers).onStatusChange)||void 0===n||n.call(t,{connectionId:a,status:"open"}))}),o.addEventListener("close",function(t){var n,s;const r=e.connections.get(a);r&&(r.status="closed",r.readyState=this.readyState,null===(s=(n=e.handlers).onStatusChange)||void 0===s||s.call(n,{connectionId:a,status:"closed"})),e.connections.delete(a)}),o.addEventListener("error",function(t){var n,s;const r={id:M(),connectionId:a,message:"WebSocket error occurred",timestamp:Date.now()};null===(s=(n=e.handlers).onError)||void 0===s||s.call(n,r)}),o.addEventListener("message",function(t){var n,s;const r={id:M(),connectionId:a,type:"received",data:e.parseMessageData(t.data),timestamp:Date.now(),size:e.calculateMessageSize(t.data)};null===(s=(n=e.handlers).onMessage)||void 0===s||s.call(n,r)});const l=o.send.bind(o);o.send=function(t){var n,s;const r={id:M(),connectionId:a,type:"sent",data:e.parseMessageData(t),timestamp:Date.now(),size:e.calculateMessageSize(t)};return null===(s=(n=e.handlers).onMessage)||void 0===s||s.call(n,r),l(t)};const d=o.close.bind(o);return o.close=function(t,n){var s,r;const i=e.connections.get(a);return i&&(i.status="closing",i.readyState=this.readyState,null===(r=(s=e.handlers).onStatusChange)||void 0===r||r.call(s,{connectionId:a,status:"closing"})),d(t,n)},o};Object.setPrototypeOf(n,t),n.prototype=t.prototype,this.installed=n,window.WebSocket=n}uninstall(){this.installed&&window.WebSocket===this.installed&&(window.WebSocket=this.originalWebSocket),this.installed=null,this.connections.clear()}parseMessageData(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e.length>1e4?e.substring(0,1e4)+"...":e}return e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e instanceof Blob?`[Blob: ${e.size} bytes, type: ${e.type}]`:ArrayBuffer.isView(e)?`[ArrayBufferView: ${e.byteLength} bytes]`:e}calculateMessageSize(e){return"string"==typeof e?new Blob([e]).size:e instanceof ArrayBuffer?e.byteLength:e instanceof Blob?e.size:ArrayBuffer.isView(e)?e.byteLength:0}getActiveConnections(){return Array.from(this.connections.values())}getConnection(e){return this.connections.get(e)}}var P=Object.freeze({__proto__:null,NetworkMonitor:class{constructor(e){this.beaconInterceptor=null,this.beaconOriginal=null,this.entries=new Map,this.isActive=!1,this.inspector=e,this.fetchInterceptor=new L({onRequest:this.handleRequest.bind(this,"fetch"),onResponse:this.handleResponse.bind(this),onError:this.handleError.bind(this)}),this.xhrInterceptor=new C({onRequest:this.handleRequest.bind(this,"xhr"),onResponse:this.handleResponse.bind(this),onError:this.handleError.bind(this),onProgress:this.handleProgress.bind(this)}),this.websocketMonitor=new I({onConnection:this.handleWebSocketConnection.bind(this),onMessage:this.handleWebSocketMessage.bind(this),onStatusChange:this.handleWebSocketStatusChange.bind(this),onError:this.handleWebSocketError.bind(this)})}start(){this.isActive||(this.fetchInterceptor.install(),this.xhrInterceptor.install(),this.websocketMonitor.install(),this.installBeaconInterceptor(),this.isActive=!0)}stop(){this.isActive&&(this.fetchInterceptor.uninstall(),this.xhrInterceptor.uninstall(),this.websocketMonitor.uninstall(),this.uninstallBeaconInterceptor(),this.isActive=!1)}handleRequest(e,t){const n={id:t.id,type:e,request:t,timestamp:t.timestamp};this.track(t.id,n);this.inspector.getStorage("network").push(n),this.inspector.getEvents().emit("network:request",{...t,type:e})}handleResponse(e){var t,n,s,r;const i=this.entries.get(e.id);i&&(i.response=e,i.duration=e.duration,i.status=e.status,i.size=e.size,this.inspector.getEvents().emit("network:response",e),e.duration>3e3&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"slow-network",message:`Slow network request: ${null===(s=i.request)||void 0===s?void 0:s.url}`,duration:e.duration,url:null===(r=i.request)||void 0===r?void 0:r.url})))}handleError(e){const t=this.entries.get(e.id);t&&(t.error=e,this.inspector.getEvents().emit("network:error",e))}handleProgress(e){this.inspector.getEvents().emit("network:progress",e)}handleWebSocketConnection(e){const t={id:e.id,type:"websocket",websocket:{connection:e,messages:[],errors:[]},timestamp:e.timestamp};this.track(e.id,t);this.inspector.getStorage("network").push(t),this.inspector.getEvents().emit("network:websocket:connection",e)}handleWebSocketMessage(e){const t=this.entries.get(e.connectionId);t&&t.websocket&&(t.websocket.messages.push(e),t.websocket.messages.length>500&&t.websocket.messages.shift(),this.inspector.getEvents().emit("network:websocket:message",e))}handleWebSocketStatusChange(e){var t;const n=this.entries.get(e.connectionId);n&&(null===(t=n.websocket)||void 0===t?void 0:t.connection)&&(n.websocket.connection.status=e.status,this.inspector.getEvents().emit("network:websocket:status",e))}handleWebSocketError(e){const t=this.entries.get(e.connectionId);t&&t.websocket&&(t.websocket.errors.push(e),t.websocket.errors.length>500&&t.websocket.errors.shift(),this.inspector.getEvents().emit("network:websocket:error",e))}track(e,t){this.entries.set(e,t);const n=Math.max(1,this.inspector.getConfig().maxNetworkEntries);for(;this.entries.size>n;){const e=this.entries.keys().next().value;this.entries.delete(e)}}installBeaconInterceptor(){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return;const e=navigator.sendBeacon.bind(navigator),t=this,n=function(n,s){const r=t.generateId(),i={id:r,method:"POST",url:n,headers:{},body:t.sanitizeBeaconData(s),timestamp:Date.now(),type:"beacon"};t.handleRequest("beacon",i);const o=e(n,s);return setTimeout(()=>{const e={id:r,status:o?204:0,statusText:o?"No Content":"Failed",headers:{},size:0,duration:0,timestamp:Date.now()};t.handleResponse(e)},0),o};this.beaconOriginal=navigator.sendBeacon,this.beaconInterceptor=n,navigator.sendBeacon=n}uninstallBeaconInterceptor(){this.beaconInterceptor&&navigator.sendBeacon===this.beaconInterceptor&&(navigator.sendBeacon=this.beaconOriginal),this.beaconInterceptor=null,this.beaconOriginal=null}sanitizeBeaconData(e){if(e){if("string"==typeof e)return e.length>1e3?e.substring(0,1e3)+"...":e;if(e instanceof FormData){const t={};return e.forEach((e,n)=>{t[n]=e instanceof File?`[File: ${e.name}]`:e}),{type:"FormData",entries:t}}return e instanceof Blob?`[Blob: ${e.size} bytes]`:e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e}}generateId(){return`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}getEntries(){return Array.from(this.entries.values())}clearEntries(){this.entries.clear()}getEntry(e){return this.entries.get(e)}filterEntries(e){return Array.from(this.entries.values()).filter(e)}}});class D{constructor(e={},t=!0){this.originalMethods=new Map,this.groupLevel=0,this.counters=new Map,this.timers=new Map,this.wrappers=new Map,this.handling=!1,this.handlers=e,this.captureStackTraces=t}install(){this.originalMethods.size>0||["log","info","warn","error","debug","trace","table","group","groupCollapsed","groupEnd","clear","count","countReset","time","timeEnd","timeLog","assert","dir","dirxml","profile","profileEnd"].forEach(e=>{"function"==typeof console[e]&&(this.originalMethods.set(e,console[e]),this.interceptMethod(e))})}uninstall(){this.originalMethods.forEach((e,t)=>{console[t]===this.wrappers.get(t)&&(console[t]=e)}),this.originalMethods.clear(),this.wrappers.clear(),this.counters.clear(),this.timers.clear(),this.groupLevel=0}interceptMethod(e){const t=this,n=this.originalMethods.get(e),s=function(...s){const r=n.apply(console,s);if(t.handling||!t.wrappers.has(e))return r;t.handling=!0;try{t.capture(e,s)}finally{t.handling=!1}return r};this.wrappers.set(e,s),console[e]=s}capture(e,t){var n,s,r,i;switch(e){case"clear":return void(null===(s=(n=this.handlers).onClear)||void 0===s||s.call(n));case"group":case"groupCollapsed":this.groupLevel++;break;case"groupEnd":this.groupLevel=Math.max(0,this.groupLevel-1);break;case"count":return void this.handleCount(t[0]);case"countReset":return void this.counters.delete(t[0]||"default");case"time":return void this.timers.set(t[0]||"default",performance.now());case"timeEnd":return void this.handleTimeEnd(t[0],"timeEnd");case"timeLog":this.handleTimeEnd(t[0],"timeLog");break;case"assert":if(t[0])return;t=t.slice(1)}const o={id:M(),level:e,args:t,formattedArgs:this.formatArgs(t),timestamp:Date.now(),groupLevel:this.groupLevel};if(this.captureStackTraces&&("error"===e||"warn"===e||"trace"===e)){const e=((a||new Error).stack||"").split("\n").slice(1).map(e=>e.trim()).filter(e=>e.startsWith("at ")).slice(3);o.stack=e,o.source=this.extractSourceFromStack(e[0])}var a;null===(i=(r=this.handlers).onLog)||void 0===i||i.call(r,o)}handleCount(e){var t,n;const s=e||"default",r=(this.counters.get(s)||0)+1;this.counters.set(s,r);const i={id:M(),level:"log",args:[`${s}: ${r}`],formattedArgs:[`${s}: ${r}`],timestamp:Date.now(),groupLevel:this.groupLevel};null===(n=(t=this.handlers).onLog)||void 0===n||n.call(t,i)}handleTimeEnd(e,t){var n,s,r,i;const o=e||"default",a=this.timers.get(o);if(void 0===a){const e={id:M(),level:"warn",args:[`Timer '${o}' does not exist`],formattedArgs:[`Timer '${o}' does not exist`],timestamp:Date.now(),groupLevel:this.groupLevel};return void(null===(s=(n=this.handlers).onLog)||void 0===s||s.call(n,e))}const c=performance.now()-a;"timeEnd"===t&&this.timers.delete(o);const l={id:M(),level:"log",args:[`${o}: ${c.toFixed(3)}ms`],formattedArgs:[`${o}: ${c.toFixed(3)}ms`],timestamp:Date.now(),groupLevel:this.groupLevel};null===(i=(r=this.handlers).onLog)||void 0===i||i.call(r,l)}formatArgs(e){return e.map(e=>this.formatValue(e))}formatValue(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t||"number"===t||"boolean"===t)return e;if(e instanceof Error)return{type:"error",name:e.name,message:e.message,stack:e.stack};if(e instanceof Date)return{type:"date",value:e.toISOString()};if(e instanceof RegExp)return{type:"regexp",value:e.toString()};if("function"==typeof e)return{type:"function",name:e.name||"<anonymous>",value:e.toString().substring(0,100)};if(Array.isArray(e))return{type:"array",length:e.length,value:e.slice(0,100).map(e=>this.formatValue(e))};if("object"===t)try{const t=function(e,t){const n=new WeakSet;return JSON.stringify(e,(e,t)=>{if("object"==typeof t&&null!==t){if(n.has(t))return"[Circular]";n.add(t)}return"function"==typeof t?t.toString():t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t},t)}(e,2);return{type:"object",value:JSON.parse(t)}}catch(e){return{type:"object",value:"[Complex Object]"}}return String(e)}extractSourceFromStack(e){if(!e)return;const t=e.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);if(!t)return;const[,,n,s,r]=t;return{file:n.replace(/^.*\//,""),line:parseInt(s,10),column:parseInt(r,10)}}}class T{formatArgs(e){return e.map(e=>this.formatValue(e))}formatArgsAsText(e){return e.map(e=>this.formatValueAsText(e)).join(" ")}formatValue(e){var t;if(null===e)return"null";if(void 0===e)return"undefined";const n=typeof e;if("string"===n||"number"===n||"boolean"===n)return e;if(e instanceof Error)return{type:"error",name:e.name,message:e.message,stack:e.stack};if(e instanceof Date)return{type:"date",value:e.toISOString()};if(e instanceof RegExp)return{type:"regexp",value:e.toString()};if(e instanceof Set)return{type:"set",size:e.size,values:Array.from(e).slice(0,100)};if(e instanceof Map)return{type:"map",size:e.size,entries:Array.from(e.entries()).slice(0,100)};if(e instanceof WeakSet||e instanceof WeakMap)return{type:e instanceof WeakSet?"weakset":"weakmap",value:"[WeakCollection]"};if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return{type:"arraybuffer",byteLength:e.byteLength};if("function"==typeof e)return{type:"function",name:e.name||"<anonymous>",value:e.toString().substring(0,100)};if(Array.isArray(e))return{type:"array",length:e.length,value:e.slice(0,100).map(e=>this.formatValue(e))};if("object"===n){if(e.type&&void 0!==e.value)return e;try{const n=Object.getPrototypeOf(e),s=(null===(t=null==n?void 0:n.constructor)||void 0===t?void 0:t.name)||"Object",r=Object.entries(e).slice(0,100),i={type:"object",constructor:s,value:{}};for(const[e,t]of r)i.value[e]=this.formatValue(t);return Object.keys(e).length>100&&(i.truncated=!0,i.totalKeys=Object.keys(e).length),i}catch(e){return{type:"object",value:"[Complex Object]"}}}return String(e)}formatValueAsText(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t)return`"${e}"`;if("number"===t||"boolean"===t)return String(e);if(e.type)switch(e.type){case"error":return`${e.name}: ${e.message}`;case"date":case"regexp":return e.value;case"function":return`[Function: ${e.name}]`;case"array":return`Array(${e.length})`;case"object":return e.constructor?`${e.constructor} {...}`:"Object {...}";case"set":return`Set(${e.size})`;case"map":return`Map(${e.size})`;default:return JSON.stringify(e.value)}return JSON.stringify(e)}formatStackTrace(e){return e.map((e,t)=>{const n=e.replace(/^\s*at\s+/,"");return" ".repeat(t)+n}).join("\n")}highlightSyntax(e,t="javascript"){let n=e;return n=n.replace(/(["'`])(?:(?=(\\?))\2.)*?\1/g,'<span class="string">$&</span>'),n=n.replace(/\b(\d+)\b/g,'<span class="number">$1</span>'),["const","let","var","function","class","if","else","for","while","return","new","this","typeof","instanceof","try","catch","finally","throw","async","await","import","export","default"].forEach(e=>{const t=new RegExp(`\\b${e}\\b`,"g");n=n.replace(t,`<span class="keyword">${e}</span>`)}),n=n.replace(/(\/\/.*$)/gm,'<span class="comment">$1</span>'),n=n.replace(/(\/\*[\s\S]*?\*\/)/g,'<span class="comment">$1</span>'),n}}var A=Object.freeze({__proto__:null,ConsoleMonitor:class{constructor(e){this.isActive=!1,this.commandHistory=[],this.historyIndex=-1,this.inspector=e,this.formatter=new T,this.interceptor=new D({onLog:this.handleLog.bind(this),onClear:this.handleClear.bind(this)},e.getConfig().captureStackTraces)}start(){this.isActive||(this.interceptor.install(),this.setupCommandExecution(),this.isActive=!0)}stop(){this.isActive&&(this.interceptor.uninstall(),this.isActive=!1)}handleLog(e){this.inspector.getStorage("console").push(e),this.inspector.getEvents().emit("console:log",e),"error"===e.level&&this.inspector.getEvents().emit("error:caught",{message:this.formatter.formatArgs(e.args),stack:e.stack,timestamp:e.timestamp,source:"console"})}handleClear(){this.inspector.getStorage("console").clear(),this.inspector.getEvents().emit("console:clear")}setupCommandExecution(){this.inspector.on("console:execute",e=>{this.executeCommand(e)})}async executeCommand(e){var t;this.commandHistory.push(e),this.historyIndex=this.commandHistory.length;const n={id:`cmd-${Date.now()}`,level:"log",args:[`> ${e}`],formattedArgs:[`> ${e}`],timestamp:Date.now(),groupLevel:0};this.handleLog(n);try{const t=new(0,Object.getPrototypeOf(async function(){}).constructor)("return ("+e+")"),n=await t.call(window);if(void 0!==n){const e={id:`result-${Date.now()}`,level:"log",args:[n],formattedArgs:this.formatter.formatArgs([n]),timestamp:Date.now(),groupLevel:0};this.handleLog(e)}}catch(e){const n={id:`error-${Date.now()}`,level:"error",args:[e],formattedArgs:this.formatter.formatArgs([e]),timestamp:Date.now(),groupLevel:0,stack:null===(t=e.stack)||void 0===t?void 0:t.split("\n")};this.handleLog(n)}}getHistory(){return[...this.commandHistory]}navigateHistory(e){if(0!==this.commandHistory.length)return this.historyIndex="up"===e?Math.max(0,this.historyIndex-1):Math.min(this.commandHistory.length,this.historyIndex+1),this.commandHistory[this.historyIndex]}filterLogs(e){return this.inspector.getStorage("console").getAll().filter(t=>{var n;if(e.levels&&e.levels.length>0&&!e.levels.includes(t.level))return!1;if(e.search){const n=e.search.toLowerCase();if(!JSON.stringify(t.formattedArgs).toLowerCase().includes(n))return!1}return!(e.source&&(null===(n=t.source)||void 0===n?void 0:n.file)&&!t.source.file.includes(e.source))})}exportLogs(e="json"){const t=this.inspector.getStorage("console").getAll();return"json"===e?JSON.stringify(t,null,2):t.map(e=>`[${new Date(e.timestamp).toISOString()}] ${e.level.toUpperCase().padEnd(5)} ${this.formatter.formatArgsAsText(e.formattedArgs)}${e.source?` [${e.source.file}:${e.source.line}]`:""}`).join("\n")}}});class R{constructor(e,t=1e3){this.isRunning=!1,this.lastTime=0,this.frameCount=0,this.fps=0,this.frameTimeSum=0,this.droppedFrames=0,this.animationId=null,this.lastUpdateTime=0,this.tick=()=>{if(!this.isRunning)return;const e=performance.now(),t=e-this.lastTime;this.frameTimeSum+=t,this.frameCount++,t>16.67&&this.droppedFrames++;const n=e-this.lastUpdateTime;if(n>=this.updateInterval){this.fps=1e3*this.frameCount/n;const t=this.frameTimeSum/this.frameCount;this.callback({fps:Math.round(this.fps),timestamp:Date.now(),frameTime:t,droppedFrames:this.droppedFrames}),this.frameCount=0,this.frameTimeSum=0,this.droppedFrames=0,this.lastUpdateTime=e}this.lastTime=e,this.animationId=requestAnimationFrame(this.tick)},this.callback=e,this.updateInterval=t}start(){this.isRunning||(this.isRunning=!0,this.lastTime=performance.now(),this.lastUpdateTime=this.lastTime,this.frameCount=0,this.frameTimeSum=0,this.droppedFrames=0,this.tick())}stop(){this.isRunning&&(this.isRunning=!1,null!==this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null))}getCurrentFPS(){return Math.round(this.fps)}}class j{constructor(e,t=1e3){this.intervalId=null,this.callback=e,this.updateInterval=t,this.isSupported=this.checkSupport()}checkSupport(){return"memory"in performance&&void 0!==performance.memory}start(){this.isSupported?null===this.intervalId&&(this.measure(),this.intervalId=window.setInterval(()=>{this.measure()},this.updateInterval)):console.warn("Performance.memory is not supported in this browser")}stop(){null!==this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}measure(){if(!performance.memory)return;const{usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n}=performance.memory,s=e/n*100,r={usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n,timestamp:Date.now(),percentUsed:s};this.callback(r)}getCurrentMemory(){if(!this.isSupported||!performance.memory)return null;const{usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n}=performance.memory;return{usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n,timestamp:Date.now(),percentUsed:e/n*100}}isMemorySupported(){return this.isSupported}}class N{constructor(e){this.metrics={},this.observer=null,this.fidObserver=null,this.clsValue=0,this.clsEntries=[],this.sessionValue=0,this.sessionEntries=[],this.callback=e}start(){this.observePaintMetrics(),this.observeLCP(),this.observeFID(),this.observeCLS(),this.observeINP(),this.measureNavigationTiming()}stop(){var e,t;null===(e=this.observer)||void 0===e||e.disconnect(),null===(t=this.fidObserver)||void 0===t||t.disconnect(),this.observer=null,this.fidObserver=null}observePaintMetrics(){try{new PerformanceObserver(e=>{for(const t of e.getEntries())"first-contentful-paint"===t.name&&(this.metrics.FCP=Math.round(t.startTime),this.reportMetrics())}).observe({entryTypes:["paint"]})}catch(e){console.warn("Paint metrics not supported")}}observeLCP(){try{new PerformanceObserver(e=>{const t=e.getEntries(),n=t[t.length-1];this.metrics.LCP=Math.round(n.startTime),this.reportMetrics()}).observe({entryTypes:["largest-contentful-paint"]})}catch(e){console.warn("LCP not supported")}}observeFID(){try{this.fidObserver=new PerformanceObserver(e=>{var t;for(const n of e.getEntries())if("first-input"===n.name){const e=n;this.metrics.FID=Math.round(e.processingStart-e.startTime),this.reportMetrics(),null===(t=this.fidObserver)||void 0===t||t.disconnect()}}),this.fidObserver.observe({entryTypes:["first-input"]})}catch(e){console.warn("FID not supported")}}observeCLS(){try{new PerformanceObserver(e=>{for(const t of e.getEntries()){const e=t;e.hadRecentInput||(this.clsValue+=e.value,this.clsEntries.push(t))}this.metrics.CLS=Math.round(1e3*this.clsValue)/1e3,this.reportMetrics()}).observe({entryTypes:["layout-shift"]})}catch(e){console.warn("CLS not supported")}}observeINP(){try{let e=0;new PerformanceObserver(t=>{for(const n of t.getEntries())if("event"===n.entryType){const t=n.duration;t>e&&(e=t,this.metrics.INP=Math.round(e),this.reportMetrics())}}).observe({entryTypes:["event"]})}catch(e){console.warn("INP not supported")}}measureNavigationTiming(){if(!performance.timing)return;const e=performance.timing,t=e.navigationStart;this.metrics.TTFB=Math.round(e.responseStart-t),e.domainLookupEnd,e.domainLookupStart,e.connectEnd,e.connectStart,e.responseStart,e.requestStart,e.responseEnd,e.responseStart,e.domComplete,e.domLoading,e.domContentLoadedEventEnd,e.loadEventEnd,e.loadEventEnd,this.reportMetrics()}reportMetrics(){this.callback({...this.metrics})}getMetrics(){return{...this.metrics}}markStart(e){performance.mark(`${e}-start`)}markEnd(e){performance.mark(`${e}-end`);try{performance.measure(e,`${e}-start`,`${e}-end`);const t=performance.getEntriesByName(e,"measure");if(t.length>0){return t[t.length-1].duration}}catch(t){console.warn(`Failed to measure ${e}`)}}clearMarks(e){e?(performance.clearMarks(`${e}-start`),performance.clearMarks(`${e}-end`),performance.clearMeasures(e)):(performance.clearMarks(),performance.clearMeasures())}}class q{constructor(e,t=50){this.observer=null,this.idCounter=0,this.fallbackRunning=!1,this.callback=e,this.threshold=t}start(){if(!this.observer)try{this.observer=new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration>=this.threshold&&this.handleLongTask(t)}),this.observer.observe({entryTypes:["longtask"]})}catch(e){console.warn("Long Task API not supported"),this.fallbackDetection()}}stop(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.observer=null,this.fallbackRunning=!1}handleLongTask(e){const t=e,n={id:"longtask-"+ ++this.idCounter,duration:Math.round(e.duration),startTime:Math.round(e.startTime),timestamp:Date.now(),attribution:t.attribution?t.attribution.map(e=>({name:e.name,containerType:e.containerType,containerSrc:e.containerSrc,containerId:e.containerId,containerName:e.containerName})):[]};this.callback(n)}fallbackDetection(){this.fallbackRunning=!0;let e=performance.now();const t=()=>{const n=performance.now(),s=n-e;if(s>this.threshold){const t={id:"longtask-fallback-"+ ++this.idCounter,duration:Math.round(s),startTime:Math.round(e),timestamp:Date.now(),attribution:[{name:"unknown",containerType:"window"}]};this.callback(t)}e=n,this.fallbackRunning&&requestAnimationFrame(t)};requestAnimationFrame(t)}}var H=Object.freeze({__proto__:null,PerformanceMonitor:class{constructor(e){this.isActive=!1,this.performanceData={timestamp:Date.now()},this.inspector=e,this.fpsMonitor=new R(this.handleFPSData.bind(this)),this.memoryMonitor=new j(this.handleMemoryData.bind(this)),this.metricsCollector=new N(this.handleMetrics.bind(this)),this.longTaskDetector=new q(this.handleLongTask.bind(this)),this.emitPerformanceData=function(e,t,n={}){let s,r,i=null,o=0,a=null;const{leading:c=!0,trailing:l=!0}=n,d=()=>{const t=a,n=s;return a=s=null,r=e.apply(n,t),r};return function(...e){const n=Date.now(),h=t-(n-o);return s=this,a=e,h<=0||h>t?(i&&(clearTimeout(i),i=null),o=n,c&&(r=d())):!i&&l&&(i=setTimeout(()=>{o=Date.now(),i=null,l&&a&&d()},h)),r}}(this.emitPerformanceData.bind(this),100)}start(){this.isActive||(this.fpsMonitor.start(),this.memoryMonitor.start(),this.metricsCollector.start(),this.longTaskDetector.start(),this.setupPerformanceObservers(),this.monitorResourceTiming(),this.isActive=!0)}stop(){this.isActive&&(this.fpsMonitor.stop(),this.memoryMonitor.stop(),this.metricsCollector.stop(),this.longTaskDetector.stop(),this.isActive=!1)}handleFPSData(e){var t,n;this.performanceData.fps=e;this.inspector.getStorage("performance").set("fps",e),e.fps<30&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"low-fps",message:`Low FPS detected: ${e.fps}`,fps:e.fps,droppedFrames:e.droppedFrames})),this.emitPerformanceData()}handleMemoryData(e){var t,n;this.performanceData.memory=e;this.inspector.getStorage("performance").set("memory",e),e.percentUsed>90&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"high-memory",message:`High memory usage: ${e.percentUsed.toFixed(1)}%`,percentUsed:e.percentUsed,usedBytes:e.usedJSHeapSize})),this.emitPerformanceData()}handleMetrics(e){var t,n,s,r,i,o;this.performanceData.metrics=e;this.inspector.getStorage("performance").set("metrics",e),e.LCP&&e.LCP>2500&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"poor-lcp",message:`Poor LCP: ${e.LCP}ms`,value:e.LCP})),e.FID&&e.FID>100&&(null===(r=(s=this.inspector.getConfig()).onPerformanceIssue)||void 0===r||r.call(s,{type:"poor-fid",message:`Poor FID: ${e.FID}ms`,value:e.FID})),e.CLS&&e.CLS>.1&&(null===(o=(i=this.inspector.getConfig()).onPerformanceIssue)||void 0===o||o.call(i,{type:"poor-cls",message:`Poor CLS: ${e.CLS}`,value:e.CLS})),this.inspector.getEvents().emit("performance:metrics",e)}handleLongTask(e){var t,n;const s=this.inspector.getStorage("performance"),r=s.get("longTasks")||[];r.push(e),r.length>100&&r.shift(),s.set("longTasks",r),this.inspector.getEvents().emit("performance:longtask",e),e.duration>200&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"long-task",message:`Long task detected: ${e.duration}ms`,duration:e.duration,attribution:e.attribution}))}emitPerformanceData(){this.performanceData.timestamp=Date.now(),this.inspector.getEvents().emit("performance:data",this.performanceData)}setupPerformanceObservers(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())this.inspector.getEvents().emit("performance:navigation",{name:t.name,duration:t.duration,startTime:t.startTime,timestamp:Date.now()})}).observe({entryTypes:["navigation"]})}catch(e){console.warn("Navigation timing observation not supported")}}monitorResourceTiming(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{var t,n;for(const s of e.getEntries()){const e=s;e.duration>1e3&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"slow-resource",message:`Slow resource: ${e.name}`,duration:e.duration,url:e.name}))}}).observe({entryTypes:["resource"]})}catch(e){console.warn("Resource timing observation not supported")}}markStart(e){this.metricsCollector.markStart(e)}markEnd(e){const t=this.metricsCollector.markEnd(e);void 0!==t&&this.inspector.getEvents().emit("performance:mark",{name:e,duration:t,timestamp:Date.now()})}getSnapshot(){return{fps:this.performanceData.fps,memory:this.memoryMonitor.getCurrentMemory()||void 0,metrics:this.metricsCollector.getMetrics(),longTasks:this.inspector.getStorage("performance").get("longTasks")||[],timestamp:Date.now()}}}});class F{constructor(e){this.groups=new Map,this.seenErrors=new WeakSet,this.ignorePatterns=[],this.callback=e,this.setupDefaultIgnorePatterns()}setupDefaultIgnorePatterns(){this.ignorePatterns=[/ResizeObserver loop limit exceeded/,/ResizeObserver loop completed with undelivered notifications/,/Non-Error promise rejection captured/,/Network request failed/,/Failed to fetch/,/Load failed/,/Script error/]}addIgnorePattern(e){this.ignorePatterns.push(e)}trackError(e,t="error"){if(e instanceof Error&&this.seenErrors.has(e))return;const n=this.createErrorInfo(e,t);if(this.shouldIgnoreError(n))return;e instanceof Error&&this.seenErrors.add(e);const s=this.groupError(n);n.groupId=s.id,this.callback(n)}createErrorInfo(e,t){let n,s,r,i,o="",a=[];if(e instanceof Error)o=e.message||e.toString(),a=e.stack?e.stack.split("\n").map(e=>e.trim()):[],i={name:e.name,message:e.message,stack:e.stack};else if("message"in e&&e instanceof ErrorEvent)o=e.message,n=e.filename,s=e.lineno,r=e.colno,e.error&&(a=e.error.stack?e.error.stack.split("\n").map(e=>e.trim()):[],i=e.error);else if("reason"in e&&e instanceof PromiseRejectionEvent){const t=e.reason;t instanceof Error?(o=t.message||t.toString(),a=t.stack?t.stack.split("\n").map(e=>e.trim()):[],i=t):(o=String(t),i=t)}const c=a.map(e=>function(e){const t=e.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);if(!t)return null;const[,n,s,r,i]=t;return{functionName:n||"<anonymous>",fileName:s||"<unknown>",lineNumber:parseInt(r||"0",10),columnNumber:parseInt(i||"0",10)}}(e)).filter(e=>null!==e);return{id:M(),type:t,message:o,stack:a,stackFrames:c,source:n,lineno:s,colno:r,timestamp:Date.now(),userAgent:navigator.userAgent,url:window.location.href,errorObject:i,count:1}}shouldIgnoreError(e){var t;for(const t of this.ignorePatterns)if(t.test(e.message))return!0;return"Script error."===e.message&&!(null===(t=e.stack)||void 0===t?void 0:t.length)||!(!e.source||!(e.source.includes("extension://")||e.source.includes("chrome-extension://")||e.source.includes("moz-extension://")))}groupError(e){const t=this.generateFingerprint(e);let n=this.groups.get(t);return n||(n={id:M(),fingerprint:t,message:e.message,count:0,firstSeen:e.timestamp,lastSeen:e.timestamp,errors:[]},this.groups.set(t,n)),n.count++,n.lastSeen=e.timestamp,n.errors.push(e),n.errors.length>10&&n.errors.shift(),n}generateFingerprint(e){const t=[e.type,this.normalizeMessage(e.message)];if(e.stackFrames&&e.stackFrames.length>0){const n=e.stackFrames[0];n.fileName&&(t.push(n.fileName),n.functionName&&t.push(n.functionName))}else e.source&&t.push(e.source);return t.join("|")}normalizeMessage(e){return e.replace(/https?:\/\/[^\s]+/g,"<URL>").replace(/\b\d+\b/g,"<NUM>").replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,"<UUID>").replace(/"[^"]*"/g,'"<STRING>"').replace(/'[^']*'/g,"'<STRING>'").replace(/\s+/g," ").trim()}getGroups(){return Array.from(this.groups.values()).sort((e,t)=>t.lastSeen-e.lastSeen)}getGroup(e){for(const t of this.groups.values())if(t.id===e)return t}clearGroups(){this.groups.clear()}getErrorStats(){let e=0;const t={},n=[];for(const s of this.groups.values()){e+=s.count;for(const e of s.errors)t[e.type]=(t[e.type]||0)+1,n.push(e)}return n.sort((e,t)=>t.timestamp-e.timestamp),{totalErrors:e,totalGroups:this.groups.size,errorsByType:t,recentErrors:n.slice(0,10)}}}class O{constructor(){this.cache={},this.enabled=!0,this.sourceMapUrlRegex=/\/\/# sourceMappingURL=(.+)$/,this.checkSupport()}checkSupport(){return this.enabled="undefined"!=typeof fetch&&"URL"in window,this.enabled}async enhanceStackTrace(e){if(!this.enabled)return e;const t=[];for(const n of e){const e=await this.enhanceStackFrame(n);t.push(e)}return t}async enhanceStackFrame(e){const t=e.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);if(!t)return e;const[,n,s,r,i]=t,o=parseInt(r,10),a=parseInt(i,10);try{const t=await this.findSourceMapUrl(s);if(!t)return e;const r=await this.loadSourceMap(s,t);if(!r)return e;const i=this.getOriginalPosition(r,o,a);if(i){return`at ${n?`${n} `:""}(${i.source}:${i.line}:${i.column})`}}catch(e){console.debug("Failed to enhance stack frame:",e)}return e}async findSourceMapUrl(e){if(this.cache[e])return this.cache[e].sourceMapUrl;try{if(e.startsWith("data:")||e.includes("blob:"))return null;const t=await fetch(e,{method:"GET",mode:"cors",credentials:"omit"});if(!t.ok)return null;const n=await t.text(),s=n.split("\n").slice(-5).join("\n").match(this.sourceMapUrlRegex);if(!s)return null;const r=s[1];if(r.startsWith("data:"))return r;return new URL(r,e).href}catch(e){return null}}async loadSourceMap(e,t){var n;if(null===(n=this.cache[e])||void 0===n?void 0:n.sourceMap)return this.cache[e].sourceMap;try{let n;if(t.startsWith("data:")){const e=t.split(",")[1];n=atob(e)}else{const e=await fetch(t,{method:"GET",mode:"cors",credentials:"omit"});if(!e.ok)return null;n=await e.text()}const s=JSON.parse(n);return this.cache[e]={sourceMapUrl:t,sourceMap:s},s}catch(e){return null}}getOriginalPosition(e,t,n){var s;return e.mappings&&e.sources?{source:e.sources[0]||"unknown",line:t,column:n,name:null===(s=e.names)||void 0===s?void 0:s[0]}:null}clearCache(){this.cache={}}setEnabled(e){this.enabled=e&&this.checkSupport()}isEnabled(){return this.enabled}}var B=Object.freeze({__proto__:null,ErrorMonitor:class{constructor(e){this.isActive=!1,this.originalHandlers={error:null,unhandledrejection:null},this.handleErrorEvent=e=>{this.errorTracker.trackError(e,"error")},this.handleRejectionEvent=e=>{this.errorTracker.trackError(e,"unhandledRejection")},this.inspector=e,this.errorTracker=new F(this.handleError.bind(this)),this.sourceMapSupport=new O}start(){this.isActive||(this.installErrorHandlers(),this.isActive=!0)}stop(){this.isActive&&(this.uninstallErrorHandlers(),this.isActive=!1)}installErrorHandlers(){this.originalHandlers.error=window.onerror,this.originalHandlers.unhandledrejection=window.onunhandledrejection,window.onerror=(e,t,n,s,r)=>{const i=new ErrorEvent("error",{message:String(e),filename:t,lineno:n,colno:s,error:r});return this.errorTracker.trackError(i,"error"),!this.originalHandlers.error||this.originalHandlers.error(e,t,n,s,r)},window.onunhandledrejection=e=>(this.errorTracker.trackError(e,"unhandledRejection"),!this.originalHandlers.unhandledrejection||this.originalHandlers.unhandledrejection(e)),window.addEventListener("error",this.handleErrorEvent),window.addEventListener("unhandledrejection",this.handleRejectionEvent)}uninstallErrorHandlers(){window.onerror=this.originalHandlers.error,window.onunhandledrejection=this.originalHandlers.unhandledrejection,window.removeEventListener("error",this.handleErrorEvent),window.removeEventListener("unhandledrejection",this.handleRejectionEvent)}async handleError(e){var t,n;if(e.stack&&this.sourceMapSupport.isEnabled())try{e.stack=await this.sourceMapSupport.enhanceStackTrace(e.stack)}catch(e){console.debug("Failed to enhance stack trace:",e)}this.inspector.getStorage("error").push(e),this.inspector.getEvents().emit("unhandledRejection"===e.type?"error:uncaught":"error:caught",e),null===(n=(t=this.inspector.getConfig()).onError)||void 0===n||n.call(t,new Error(e.message)),this.inspector.getConfig().enabled&&console.error("[DevInspector] Error captured:",e)}trackError(e){this.errorTracker.trackError(e)}getErrorGroups(){return this.errorTracker.getGroups()}getErrorStats(){return this.errorTracker.getErrorStats()}clearErrors(){this.errorTracker.clearGroups();this.inspector.getStorage("error").clear()}addIgnorePattern(e){this.errorTracker.addIgnorePattern(e)}enableSourceMaps(e){this.sourceMapSupport.setEnabled(e)}}});var U=Object.freeze({__proto__:null,StateMonitor:class{constructor(e){this.isActive=!1,this.inspector=e}start(){this.isActive||(this.isActive=!0)}stop(){this.isActive&&(this.isActive=!1)}}});var _=Object.freeze({__proto__:null,DOMMonitor:class{constructor(e){this.isActive=!1,this.inspector=e}start(){this.isActive||(this.isActive=!0)}stop(){this.isActive&&(this.isActive=!1)}}});var W=Object.freeze({__proto__:null,StorageMonitor:class{constructor(e){this.isActive=!1,this.inspector=e}start(){this.isActive||(this.isActive=!0)}stop(){this.isActive&&(this.isActive=!1)}}});class V{constructor(e){this.isDragging=!1,this.dragOffset={x:0,y:0},this.errorCount=0,this.eventUnsubscribers=[],this.inspector=e,this.element=this.createElement(),this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.setupEventListeners(),this.updatePosition()}createElement(){const e=document.createElement("div");return e.className="devinspector-floating-widget",e.innerHTML="🔍",e.title="DevInspector - Click to toggle, drag to move",e}setupEventListeners(){this.element.addEventListener("click",e=>{this.isDragging||this.inspector.toggle()}),this.element.addEventListener("mousedown",this.handleMouseDown.bind(this)),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp);const e=this.inspector.on("error:caught",()=>{this.errorCount++,this.updateAppearance()});this.eventUnsubscribers.push(e);const t=this.inspector.on("error:uncaught",()=>{this.errorCount++,this.updateAppearance()});this.eventUnsubscribers.push(t);const n=this.inspector.on("inspector:show",()=>{this.errorCount=0,this.updateAppearance()});this.eventUnsubscribers.push(n)}handleMouseDown(e){e.preventDefault(),this.isDragging=!0;const t=this.element.getBoundingClientRect();this.dragOffset={x:e.clientX-t.left,y:e.clientY-t.top},this.element.style.cursor="grabbing",this.element.style.zIndex="1000000"}handleMouseMove(e){if(!this.isDragging)return;e.preventDefault();const t=e.clientX-this.dragOffset.x,n=e.clientY-this.dragOffset.y,s=window.innerWidth-this.element.offsetWidth,r=window.innerHeight-this.element.offsetHeight,i=Math.max(0,Math.min(t,s)),o=Math.max(0,Math.min(n,r));this.element.style.left=`${i}px`,this.element.style.top=`${o}px`,this.element.style.right="auto",this.element.style.bottom="auto"}handleMouseUp(){this.isDragging&&(this.isDragging=!1,this.element.style.cursor="pointer",this.element.style.zIndex="999998",this.snapToEdge())}snapToEdge(){const e=this.element.getBoundingClientRect(),t=e.left+e.width/2,n=e.top+e.height/2,s={left:t,right:window.innerWidth-t,top:n,bottom:window.innerHeight-n};switch(Object.entries(s).reduce((e,t)=>e[1]<t[1]?e:t)[0]){case"left":this.element.style.left="20px";break;case"right":this.element.style.left="auto",this.element.style.right="20px";break;case"top":this.element.style.top="20px";break;case"bottom":this.element.style.top="auto",this.element.style.bottom="20px"}}updatePosition(){const e=this.inspector.getConfig().position;switch(this.element.style.top="auto",this.element.style.right="auto",this.element.style.bottom="auto",this.element.style.left="auto",e){case"top-left":this.element.style.top="20px",this.element.style.left="20px";break;case"top-right":this.element.style.top="20px",this.element.style.right="20px";break;case"bottom-left":this.element.style.bottom="20px",this.element.style.left="20px";break;default:this.element.style.bottom="20px",this.element.style.right="20px"}}updateAppearance(){this.errorCount>0?(this.element.classList.add("has-errors"),this.element.innerHTML="⚠️",this.element.title=`DevInspector - ${this.errorCount} error${this.errorCount>1?"s":""} detected`):(this.element.classList.remove("has-errors"),this.element.innerHTML="🔍",this.element.title="DevInspector - Click to toggle, drag to move")}show(){this.element.parentNode||document.body.appendChild(this.element),this.element.style.display="flex"}hide(){this.element.style.display="none"}destroy(){document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),this.eventUnsubscribers.forEach(e=>e()),this.eventUnsubscribers=[],this.element.parentNode&&this.element.parentNode.removeChild(this.element)}getElement(){return this.element}}class J{constructor(e){this.tabs=new Map,this.activeTab=null,this.isDragging=!1,this.dragOffset={x:0,y:0},this.isResizing=!1,this.badgeUpdateInterval=null,this.boundMouseMove=e=>this.handleMouseMove(e),this.boundMouseUp=()=>this.handleMouseUp(),this.inspector=e,this.element=this.createElement(),this.setupEventListeners(),this.updatePosition()}createElement(){const e=document.createElement("div");e.className=`devinspector position-${this.inspector.getConfig().position}`,e.style.width="600px",e.style.height="400px",e.style.display="none",this.headerElement=document.createElement("div"),this.headerElement.className="devinspector-header",this.headerElement.innerHTML='\n <h3 class="devinspector-title">DevInspector</h3>\n <div class="devinspector-controls">\n <button class="devinspector-control settings" title="Settings">⚙️</button>\n <button class="devinspector-control minimize" title="Minimize">−</button>\n <button class="devinspector-control close" title="Close">×</button>\n </div>\n ',this.tabsElement=document.createElement("div"),this.tabsElement.className="devinspector-tabs",this.bodyElement=document.createElement("div"),this.bodyElement.className="devinspector-body";const t=document.createElement("div");return t.className="devinspector-resizer",e.appendChild(this.headerElement),e.appendChild(this.tabsElement),e.appendChild(this.bodyElement),e.appendChild(t),e}setupEventListeners(){this.headerElement.querySelectorAll(".devinspector-control").forEach(e=>{e.addEventListener("click",t=>{t.stopPropagation();const n=e.className;n.includes("minimize")?this.inspector.minimize():n.includes("close")?this.inspector.hide():n.includes("settings")&&this.showSettings()})}),this.headerElement.addEventListener("mousedown",this.handleHeaderMouseDown.bind(this)),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp);this.element.querySelector(".devinspector-resizer").addEventListener("mousedown",this.handleResizerMouseDown.bind(this)),this.tabsElement.addEventListener("click",e=>{const t=e.target.closest(".devinspector-tab");if(t){const e=t.dataset.tabId;e&&this.setActiveTab(e)}}),this.badgeUpdateInterval=window.setInterval(()=>this.updateBadges(),1e3)}handleHeaderMouseDown(e){if(e.target.closest(".devinspector-control"))return;e.preventDefault(),this.isDragging=!0;const t=this.element.getBoundingClientRect();this.dragOffset={x:e.clientX-t.left,y:e.clientY-t.top},this.headerElement.style.cursor="grabbing",this.element.style.zIndex="1000000"}handleResizerMouseDown(e){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.element.style.zIndex="1000000",document.body.style.cursor="nw-resize"}handleMouseMove(e){if(this.isDragging){e.preventDefault();const t=e.clientX-this.dragOffset.x,n=e.clientY-this.dragOffset.y,s=window.innerWidth-this.element.offsetWidth,r=window.innerHeight-this.element.offsetHeight,i=Math.max(0,Math.min(t,s)),o=Math.max(0,Math.min(n,r));this.element.style.left=`${i}px`,this.element.style.top=`${o}px`,this.element.style.right="auto",this.element.style.bottom="auto"}else if(this.isResizing){e.preventDefault();const t=this.element.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top,r=300,i=200,o=window.innerWidth-t.left,a=window.innerHeight-t.top,c=Math.max(r,Math.min(n,o)),l=Math.max(i,Math.min(s,a));this.element.style.width=`${c}px`,this.element.style.height=`${l}px`}}handleMouseUp(){this.isDragging&&(this.isDragging=!1,this.headerElement.style.cursor="move",this.element.style.zIndex="999999"),this.isResizing&&(this.isResizing=!1,this.element.style.zIndex="999999",document.body.style.cursor="auto")}updatePosition(){const e=this.inspector.getConfig().position;this.element.classList.remove("position-top-left","position-top-right","position-bottom-left","position-bottom-right"),this.element.classList.add(`position-${e}`)}showSettings(){console.log("Settings not implemented yet")}addTab(e){this.tabs.set(e.id,e);const t=document.createElement("button");if(t.className="devinspector-tab",t.dataset.tabId=e.id,t.textContent=e.label,e.badge){const e=document.createElement("span");e.className="devinspector-tab-badge",e.textContent="0",t.appendChild(e)}this.tabsElement.appendChild(t);const n=document.createElement("div");n.className="devinspector-panel",n.dataset.panelId=e.id,n.appendChild(e.content),this.bodyElement.appendChild(n),1===this.tabs.size&&this.setActiveTab(e.id),this.updateBadges()}removeTab(e){if(!this.tabs.has(e))return;this.tabs.delete(e);const t=Array.from(this.tabsElement.querySelectorAll(".devinspector-tab")).find(t=>t.dataset.tabId===e);t&&t.remove();const n=Array.from(this.bodyElement.querySelectorAll(".devinspector-panel")).find(t=>t.dataset.panelId===e);if(n&&n.remove(),this.activeTab===e){const e=this.tabs.keys().next().value;e?this.setActiveTab(e):this.activeTab=null}}setActiveTab(e){this.tabs.has(e)&&(this.activeTab=e,this.tabsElement.querySelectorAll(".devinspector-tab").forEach(t=>{const n=t;t.classList.toggle("active",n.dataset.tabId===e)}),this.bodyElement.querySelectorAll(".devinspector-panel").forEach(t=>{const n=t;t.classList.toggle("active",n.dataset.panelId===e)}))}updateBadges(){this.tabs.forEach((e,t)=>{if(e.badge){const n=e.badge(),s=Array.from(this.tabsElement.querySelectorAll(".devinspector-tab")).find(e=>e.dataset.tabId===t),r=null==s?void 0:s.querySelector(".devinspector-tab-badge");r&&(r.textContent=n.toString(),r.style.display=n>0?"inline-block":"none")}})}show(){this.element.parentNode||document.body.appendChild(this.element),this.element.style.display="flex",this.element.classList.remove("minimized")}hide(){this.element.style.display="none"}minimize(){this.element.classList.add("minimized")}destroy(){null!==this.badgeUpdateInterval&&(clearInterval(this.badgeUpdateInterval),this.badgeUpdateInterval=null),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),this.element.parentNode&&this.element.parentNode.removeChild(this.element)}getElement(){return this.element}getActiveTab(){return this.activeTab}}var X=Object.freeze({__proto__:null,DevInspectorUI:class{constructor(e){this.styleElement=null,this.isVisible=!1,this.isMinimized=!1,this.inspector=e,this.floatingWidget=new V(e),this.mainPanel=new J(e)}async init(){this.injectStyles(),this.setupTabs(),this.setupEventListeners(),this.floatingWidget.show()}injectStyles(){this.styleElement=document.createElement("style");const e=this.inspector.getConfig().theme,t="function"==typeof window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,n="auto"===e?t?"dark":"light":e;this.styleElement.textContent=((e="dark")=>{const t="dark"===e?{primary:"#1e1e1e",secondary:"#2d2d30",tertiary:"#3e3e42",accent:"#007acc",text:"#cccccc",textSecondary:"#9d9d9d",border:"#3e3e42",success:"#4caf50",warning:"#ff9800",error:"#f44336",info:"#2196f3"}:{primary:"#ffffff",secondary:"#f5f5f5",tertiary:"#e0e0e0",accent:"#1976d2",text:"#333333",textSecondary:"#666666",border:"#ddd",success:"#4caf50",warning:"#ff9800",error:"#f44336",info:"#2196f3"};return`\n .devinspector {\n position: fixed;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n line-height: 1.4;\n color: ${t.text};\n background: ${t.primary};\n border: 1px solid ${t.border};\n border-radius: 8px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);\n z-index: 999999;\n min-width: 300px;\n min-height: 200px;\n resize: both;\n overflow: hidden;\n backdrop-filter: blur(10px);\n transition: all 0.3s ease;\n }\n\n .devinspector.fullwidth {\n width: calc(100vw - 40px) !important;\n left: 20px !important;\n right: 20px !important;\n }\n\n .devinspector.bottom-sidebar {\n bottom: 0 !important;\n left: 0 !important;\n right: 0 !important;\n top: auto !important;\n width: 100vw !important;\n height: 40vh !important;\n border-radius: 0 !important;\n border-left: none !important;\n border-right: none !important;\n border-bottom: none !important;\n resize: vertical;\n }\n\n .devinspector.bottom-sidebar .devinspector-header {\n border-radius: 0;\n }\n\n .devinspector * {\n box-sizing: border-box;\n }\n\n .devinspector.position-top-left {\n top: 20px;\n left: 20px;\n }\n\n .devinspector.position-top-right {\n top: 20px;\n right: 20px;\n }\n\n .devinspector.position-bottom-left {\n bottom: 20px;\n left: 20px;\n }\n\n .devinspector.position-bottom-right {\n bottom: 20px;\n right: 20px;\n }\n\n .devinspector.position-bottom-sidebar {\n bottom: 0;\n left: 0;\n right: 0;\n width: 100vw;\n height: 40vh;\n border-radius: 0;\n border-left: none;\n border-right: none;\n border-bottom: none;\n }\n\n .devinspector.minimized {\n width: 50px !important;\n height: 50px !important;\n overflow: hidden;\n border-radius: 50%;\n cursor: pointer;\n }\n\n .devinspector.minimized .devinspector-header {\n height: 100%;\n border-radius: 50%;\n justify-content: center;\n align-items: center;\n }\n\n .devinspector.minimized .devinspector-body,\n .devinspector.minimized .devinspector-tabs,\n .devinspector.minimized .devinspector-title {\n display: none !important;\n }\n\n .devinspector-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 12px;\n background: ${t.secondary};\n border-bottom: 1px solid ${t.border};\n cursor: move;\n user-select: none;\n border-radius: 8px 8px 0 0;\n }\n\n .devinspector-title {\n font-weight: 600;\n color: ${t.text};\n margin: 0;\n font-size: 13px;\n }\n\n .devinspector-controls {\n display: flex;\n gap: 4px;\n }\n\n .devinspector-control {\n width: 18px;\n height: 18px;\n border: none;\n border-radius: 3px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: bold;\n transition: all 0.2s ease;\n }\n\n .devinspector-control:hover {\n opacity: 0.8;\n transform: scale(1.1);\n }\n\n .devinspector-control.minimize {\n background: ${t.warning};\n color: white;\n }\n\n .devinspector-control.close {\n background: ${t.error};\n color: white;\n }\n\n .devinspector-control.settings {\n background: ${t.tertiary};\n color: ${t.text};\n }\n\n .devinspector-tabs {\n display: flex;\n background: ${t.secondary};\n border-bottom: 1px solid ${t.border};\n overflow-x: auto;\n }\n\n .devinspector-tab {\n padding: 8px 16px;\n background: none;\n border: none;\n color: ${t.textSecondary};\n cursor: pointer;\n font-family: inherit;\n font-size: 11px;\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n border-bottom: 2px solid transparent;\n transition: all 0.2s ease;\n white-space: nowrap;\n }\n\n .devinspector-tab:hover {\n color: ${t.text};\n background: ${t.tertiary};\n }\n\n .devinspector-tab.active {\n color: ${t.accent};\n border-bottom-color: ${t.accent};\n background: ${t.primary};\n }\n\n .devinspector-tab-badge {\n display: inline-block;\n background: ${t.error};\n color: white;\n border-radius: 10px;\n padding: 1px 6px;\n font-size: 10px;\n margin-left: 6px;\n min-width: 16px;\n text-align: center;\n }\n\n .devinspector-body {\n flex: 1;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n }\n\n .devinspector-panel {\n flex: 1;\n display: none;\n flex-direction: column;\n overflow: hidden;\n }\n\n .devinspector-panel.active {\n display: flex;\n }\n\n .devinspector-toolbar {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 12px;\n background: ${t.secondary};\n border-bottom: 1px solid ${t.border};\n flex-wrap: wrap;\n }\n\n .devinspector-search {\n flex: 1;\n min-width: 200px;\n padding: 4px 8px;\n border: 1px solid ${t.border};\n border-radius: 4px;\n background: ${t.primary};\n color: ${t.text};\n font-family: inherit;\n font-size: 11px;\n }\n\n .devinspector-search::placeholder {\n color: ${t.textSecondary};\n }\n\n .devinspector-button {\n padding: 4px 8px;\n border: 1px solid ${t.border};\n border-radius: 4px;\n background: ${t.tertiary};\n color: ${t.text};\n cursor: pointer;\n font-family: inherit;\n font-size: 11px;\n transition: all 0.2s ease;\n }\n\n .devinspector-button:hover {\n background: ${t.accent};\n color: white;\n }\n\n .devinspector-button.active {\n background: ${t.accent};\n color: white;\n }\n\n .devinspector-content {\n flex: 1;\n overflow: auto;\n padding: 8px;\n }\n\n .devinspector-list {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n .devinspector-list-item {\n padding: 8px 12px;\n border-bottom: 1px solid ${t.border};\n cursor: pointer;\n transition: background 0.2s ease;\n }\n\n .devinspector-list-item:hover {\n background: ${t.secondary};\n }\n\n .devinspector-list-item.selected {\n background: ${t.accent};\n color: white;\n }\n\n .devinspector-timestamp {\n color: ${t.textSecondary};\n font-size: 10px;\n }\n\n .devinspector-status {\n display: inline-block;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 10px;\n font-weight: bold;\n text-transform: uppercase;\n }\n\n .devinspector-status.success {\n background: ${t.success};\n color: white;\n }\n\n .devinspector-status.error {\n background: ${t.error};\n color: white;\n }\n\n .devinspector-status.warning {\n background: ${t.warning};\n color: white;\n }\n\n .devinspector-status.info {\n background: ${t.info};\n color: white;\n }\n\n .devinspector-json {\n font-family: 'Monaco', 'Menlo', monospace;\n font-size: 11px;\n line-height: 1.4;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .devinspector-json .json-key {\n color: ${"dark"===e?"#9cdcfe":"#0451a5"};\n }\n\n .devinspector-json .json-string {\n color: ${"dark"===e?"#ce9178":"#a31515"};\n }\n\n .devinspector-json .json-number {\n color: ${"dark"===e?"#b5cea8":"#09885a"};\n }\n\n .devinspector-json .json-boolean {\n color: ${"dark"===e?"#569cd6":"#0000ff"};\n }\n\n .devinspector-json .json-null {\n color: ${"dark"===e?"#569cd6":"#0000ff"};\n }\n\n .devinspector-console-entry {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 4px 8px;\n border-bottom: 1px solid ${t.border};\n font-family: 'Monaco', 'Menlo', monospace;\n font-size: 11px;\n line-height: 1.4;\n }\n\n .devinspector-console-entry.log {\n color: ${t.text};\n }\n\n .devinspector-console-entry.info {\n color: ${t.info};\n }\n\n .devinspector-console-entry.warn {\n color: ${t.warning};\n }\n\n .devinspector-console-entry.error {\n color: ${t.error};\n }\n\n .devinspector-console-entry.debug {\n color: ${t.textSecondary};\n }\n\n .devinspector-console-level {\n font-weight: bold;\n text-transform: uppercase;\n font-size: 10px;\n min-width: 40px;\n }\n\n .devinspector-chart {\n height: 100px;\n background: ${t.secondary};\n border: 1px solid ${t.border};\n border-radius: 4px;\n margin: 8px 0;\n position: relative;\n }\n\n .devinspector-metric {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px;\n background: ${t.secondary};\n border: 1px solid ${t.border};\n border-radius: 4px;\n margin: 4px 0;\n }\n\n .devinspector-metric-label {\n font-weight: 500;\n color: ${t.text};\n }\n\n .devinspector-metric-value {\n font-weight: bold;\n color: ${t.accent};\n }\n\n .devinspector-error-group {\n border-left: 4px solid ${t.error};\n padding-left: 8px;\n margin: 8px 0;\n }\n\n .devinspector-error-message {\n font-weight: bold;\n color: ${t.error};\n margin-bottom: 4px;\n }\n\n .devinspector-error-stack {\n font-family: 'Monaco', 'Menlo', monospace;\n font-size: 10px;\n color: ${t.textSecondary};\n background: ${t.secondary};\n padding: 8px;\n border-radius: 4px;\n overflow-x: auto;\n white-space: pre;\n }\n\n .devinspector-resizer {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 16px;\n height: 16px;\n cursor: nw-resize;\n background: linear-gradient(\n -45deg,\n transparent 0%,\n transparent 40%,\n ${t.border} 40%,\n ${t.border} 60%,\n transparent 60%,\n transparent 100%\n );\n }\n\n .devinspector-floating-widget {\n position: fixed;\n width: 60px;\n height: 60px;\n background: ${t.accent};\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);\n z-index: 999998;\n transition: all 0.3s ease;\n color: white;\n font-weight: bold;\n font-size: 14px;\n }\n\n .devinspector-floating-widget:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);\n }\n\n .devinspector-floating-widget.has-errors {\n background: ${t.error};\n animation: pulse 2s infinite;\n }\n\n @keyframes pulse {\n 0% { opacity: 1; }\n 50% { opacity: 0.7; }\n 100% { opacity: 1; }\n }\n\n /* Scrollbar styles */\n .devinspector *::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n\n .devinspector *::-webkit-scrollbar-track {\n background: ${t.secondary};\n }\n\n .devinspector *::-webkit-scrollbar-thumb {\n background: ${t.tertiary};\n border-radius: 4px;\n }\n\n .devinspector *::-webkit-scrollbar-thumb:hover {\n background: ${t.accent};\n }\n `})(n),document.head.appendChild(this.styleElement)}setupTabs(){const e={id:"network",label:"Network",badge:()=>this.inspector.getStorage("network").getSize(),content:this.createNetworkPanel()},t={id:"console",label:"Console",badge:()=>this.inspector.getStorage("console").getSize(),content:this.createConsolePanel()},n={id:"performance",label:"Performance",content:this.createPerformancePanel()},s={id:"errors",label:"Errors",badge:()=>this.inspector.getStorage("error").getSize(),content:this.createErrorsPanel()};this.mainPanel.addTab(e),this.mainPanel.addTab(t),this.mainPanel.addTab(n),this.mainPanel.addTab(s)}createNetworkPanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-toolbar">\n <input type="text" class="devinspector-search" placeholder="Filter requests...">\n <button class="devinspector-button">Clear</button>\n <button class="devinspector-button">Export</button>\n </div>\n <div class="devinspector-content">\n <div class="devinspector-network-list">\n <p style="text-align: center; color: #666; margin-top: 40px;">\n Network requests will appear here...\n </p>\n </div>\n </div>\n ',this.inspector.on("network:request",t=>{this.addNetworkEntry(e,t)}),this.inspector.on("network:response",t=>{this.updateNetworkEntry(e,t)}),e}createConsolePanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-toolbar">\n <input type="text" class="devinspector-search" placeholder="Filter logs...">\n <button class="devinspector-button">Clear</button>\n <button class="devinspector-button">Export</button>\n </div>\n <div class="devinspector-content">\n <div class="devinspector-console-list">\n <p style="text-align: center; color: #666; margin-top: 40px;">\n Console logs will appear here...\n </p>\n </div>\n </div>\n ',this.inspector.on("console:log",t=>{this.addConsoleEntry(e,t)}),e}createPerformancePanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-content">\n <div class="devinspector-metrics">\n <div class="devinspector-metric">\n <span class="devinspector-metric-label">FPS</span>\n <span class="devinspector-metric-value" id="fps-value">--</span>\n </div>\n <div class="devinspector-metric">\n <span class="devinspector-metric-label">Memory</span>\n <span class="devinspector-metric-value" id="memory-value">--</span>\n </div>\n <div class="devinspector-chart" id="fps-chart"></div>\n <div class="devinspector-chart" id="memory-chart"></div>\n </div>\n </div>\n ',this.inspector.on("performance:data",t=>{this.updatePerformanceMetrics(e,t)}),e}createErrorsPanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-toolbar">\n <button class="devinspector-button">Clear All</button>\n <button class="devinspector-button">Export</button>\n </div>\n <div class="devinspector-content">\n <div class="devinspector-errors-list">\n <p style="text-align: center; color: #666; margin-top: 40px;">\n No errors detected\n </p>\n </div>\n </div>\n ',this.inspector.on("error:caught",t=>{this.addErrorEntry(e,t)}),this.inspector.on("error:uncaught",t=>{this.addErrorEntry(e,t)}),e}setupEventListeners(){this.inspector.on("console:clear",()=>{const e=document.querySelector(".devinspector-console-list");e&&(e.innerHTML='\n <p style="text-align: center; color: #666; margin-top: 40px;">\n Console cleared\n </p>\n ')})}addNetworkEntry(e,t){const n=e.querySelector(".devinspector-network-list");if(!n)return;const r=n.querySelector("p");r&&r.remove();const i=document.createElement("div");i.className="devinspector-list-item",i.dataset.requestId=t.id,i.innerHTML=`\n <div style="display: flex; justify-content: space-between; align-items: center;">\n <span>${s(t.method)} ${s(t.url)}</span>\n <span class="devinspector-status info">Pending</span>\n </div>\n <div class="devinspector-timestamp">${new Date(t.timestamp).toLocaleTimeString()}</div>\n `,n.appendChild(i)}updateNetworkEntry(e,t){const n=Array.from(e.querySelectorAll("[data-request-id]")).find(e=>e.dataset.requestId===String(t.id));if(!n)return;const s=n.querySelector(".devinspector-status");s&&(s.textContent=`${t.status}`,s.className="devinspector-status "+(t.status>=400?"error":"success"))}addConsoleEntry(e,t){const n=e.querySelector(".devinspector-console-list");if(!n)return;const r=n.querySelector("p");r&&r.remove();const i=document.createElement("div");i.className=`devinspector-console-entry ${String(t.level).replace(/[^a-zA-Z]/g,"")}`,i.innerHTML=`\n <span class="devinspector-console-level">${s(t.level)}</span>\n <span class="devinspector-console-content">${s(this.formatConsoleArgs(t.formattedArgs))}</span>\n <span class="devinspector-timestamp">${new Date(t.timestamp).toLocaleTimeString()}</span>\n `,n.appendChild(i),n.scrollTop=n.scrollHeight}addErrorEntry(e,t){const n=e.querySelector(".devinspector-errors-list");if(!n)return;const r=n.querySelector("p");r&&r.remove();const i=document.createElement("div");i.className="devinspector-error-group",i.innerHTML=`\n <div class="devinspector-error-message">${s(t.message)}</div>\n <div class="devinspector-timestamp">${new Date(t.timestamp).toLocaleTimeString()}</div>\n ${t.stack?`<pre class="devinspector-error-stack">${s(Array.isArray(t.stack)?t.stack.join("\n"):t.stack)}</pre>`:""}\n `,n.appendChild(i)}updatePerformanceMetrics(e,t){const n=e.querySelector("#fps-value"),s=e.querySelector("#memory-value");if(n&&t.fps&&(n.textContent=`${t.fps.fps} FPS`),s&&t.memory){const e=Math.round(t.memory.usedJSHeapSize/1024/1024);s.textContent=`${e} MB`}}formatConsoleArgs(e){return e.map(e=>"string"==typeof e?e:e&&"object"==typeof e?JSON.stringify(e,null,2):String(e)).join(" ")}show(){this.mainPanel.show(),this.isVisible=!0,this.isMinimized=!1}hide(){this.mainPanel.hide(),this.isVisible=!1}minimize(){this.mainPanel.minimize(),this.isMinimized=!0}destroy(){this.floatingWidget.destroy(),this.mainPanel.destroy(),this.styleElement&&this.styleElement.parentNode&&this.styleElement.parentNode.removeChild(this.styleElement)}getElement(){return this.mainPanel.getElement()}}});return $});
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DevInspector=t()}(this,function(){"use strict";function e(){return"production"!==function(){try{return process.env.NODE_ENV}catch(e){return}}()}function t(e,t){return"number"==typeof e&&Number.isFinite(e)&&e>=0?Math.floor(e):t}function n(){return"undefined"!=typeof window&&"undefined"!=typeof document}const s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"};function r(e){return String(e).replace(/[&<>"'`]/g,e=>s[e])}class i{constructor(e={}){var t,n;this.events=new Map,this.maxListeners=null!==(t=e.maxListeners)&&void 0!==t?t:10,this.captureRejections=null!==(n=e.captureRejections)&&void 0!==n&&n}on(e,t){this.events.has(e)||this.events.set(e,new Set);const n=this.events.get(e);return n.size>this.maxListeners&&console.warn(`MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ${n.size} ${String(e)} listeners added.`),n.add(t),()=>{n.delete(t),0===n.size&&this.events.delete(e)}}once(e,t){const n=this.on(e,e=>{n(),t(e)});return n}emit(e,...t){const n=this.events.get(e);if(!n||0===n.size)return!1;const s=t[0];return n.forEach(t=>{try{t(s)}catch(t){this.captureRejections?this.emit("error",t):console.error(`Error in event listener for "${String(e)}":`,t)}}),!0}off(e,t){if(!t)return void this.events.delete(e);const n=this.events.get(e);n&&(n.delete(t),0===n.size&&this.events.delete(e))}removeAllListeners(e){e?this.events.delete(e):this.events.clear()}listenerCount(e){const t=this.events.get(e);return t?t.size:0}eventNames(){return Array.from(this.events.keys())}setMaxListeners(e){this.maxListeners=e}getMaxListeners(){return this.maxListeners}}const o=new WeakMap;function a(e,t,n,s){const r=e;r[t]===n?r[t]=function(e){let t=e;for(;null!==t&&"function"==typeof t&&o.has(t);)t=o.get(t);return t}(s):null!==n&&"function"==typeof n&&o.set(n,s)}class c{constructor(e){this.plugins=new Map,this.activePlugins=new Set,this.installingPlugins=new Set,this.context=e}async register(e){if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);if(this.installingPlugins.has(e.name))throw new Error(`Plugin "${e.name}" is currently being installed`);this.installingPlugins.add(e.name);try{await e.install(this.context),this.plugins.set(e.name,e),this.activePlugins.add(e.name),e.enable&&e.enable(),this.context.events.emit("plugin:registered",{name:e.name,version:e.version})}catch(t){throw this.installingPlugins.delete(e.name),new Error(`Failed to install plugin "${e.name}": ${t}`)}this.installingPlugins.delete(e.name)}async unregister(e){const t=this.plugins.get(e);if(!t)throw new Error(`Plugin "${e}" is not registered`);try{t.disable&&t.disable(),t.uninstall&&await t.uninstall()}finally{this.plugins.delete(e),this.activePlugins.delete(e),this.context.events.emit("plugin:unregistered",{name:e})}}enable(e){const t=this.plugins.get(e);if(!t)throw new Error(`Plugin "${e}" is not registered`);this.activePlugins.has(e)||(t.enable&&t.enable(),this.activePlugins.add(e),this.context.events.emit("plugin:enabled",{name:e}))}disable(e){const t=this.plugins.get(e);if(!t)throw new Error(`Plugin "${e}" is not registered`);this.activePlugins.has(e)&&(t.disable&&t.disable(),this.activePlugins.delete(e),this.context.events.emit("plugin:disabled",{name:e}))}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}isActive(e){return this.activePlugins.has(e)}getAll(){return Array.from(this.plugins.values())}getActive(){return Array.from(this.activePlugins).map(e=>this.plugins.get(e))}getMetadata(e){const t=this.plugins.get(e);if(t)return{name:t.name,version:t.version,description:t.description}}getAllMetadata(){return this.getAll().map(e=>({name:e.name,version:e.version,description:e.description}))}}const l="1.5.0",d=["log","info","warn","error","debug"],h=1e4,p=/\.(?:css|js|mjs|map|png|jpe?g|gif|svg|webp|avif|ico|woff2?|ttf|otf|eot)(?:[?#]|$)/i,u=["top-left","top-right","bottom-left","bottom-right"],m={dark:{bg:"#1a1a1a",header:"#262626",toolbar:"#1e1e1e",border:"#333",row:"#2a2a2a",text:"#e4e4e7",muted:"#9ca3af",code:"#0f0f0f"},light:{bg:"#ffffff",header:"#f3f4f6",toolbar:"#f9fafb",border:"#d1d5db",row:"#e5e7eb",text:"#111827",muted:"#4b5563",code:"#f3f4f6"}};let g=0;function f(){return g=(g+1)%Number.MAX_SAFE_INTEGER,`${Date.now().toString(36)}-${g.toString(36)}`}function v(e){if("string"!=typeof e)return"";const t=e.toLowerCase().split("+").map(e=>e.trim()).filter(Boolean),n=t.filter(e=>!["ctrl","control","alt","shift","meta","cmd"].includes(e));if(1!==n.length)return"";const s=(...e)=>e.some(e=>t.includes(e));return[s("ctrl","control")&&"ctrl",s("alt")&&"alt",s("shift")&&"shift",s("meta","cmd")&&"meta",n[0]].filter(Boolean).join("+")}function y(e){return e.length>h?`${e.slice(0,h)}… (${e.length-h} more characters)`:e}function b(e){if("string"==typeof e)return e;if(e instanceof Error)return e.stack||`${e.name}: ${e.message}`;if(null!==e&&"object"==typeof e){const t=new WeakSet;try{const n=JSON.stringify(e,(e,n)=>{if("bigint"==typeof n)return`${n}n`;if(null!==n&&"object"==typeof n){if(t.has(n))return"[Circular]";t.add(n)}return n},2);return void 0===n?String(e):n}catch(t){try{return String(e)}catch(e){return"[object]"}}}try{return String(e)}catch(e){return"[unprintable]"}}function w(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e;if("string"==typeof t.url)return t.url;if("string"==typeof t.href)return t.href}return String(e)}function x(e,t){const n=t&&"object"==typeof t?t.method:void 0;if("string"==typeof n&&n)return n.toUpperCase();const s=e&&"object"==typeof e?e.method:void 0;return"string"==typeof s&&s?s.toUpperCase():"GET"}class k{constructor(e={}){var t;this.events=new i({maxListeners:100}),this.network=[],this.consoleEntries=[],this.errors=[],this.metrics=[],this.performanceStats={fps:0,memory:null},this.isRecording=!0,this.isVisible=!1,this.isMinimized=!1,this.destroyed=!1,this.capturing=!1,this.renderQueued=!1,this.activeTab="network",this.selectedRequestId=null,this.widget=null,this.panel=null,this.patches=[],this.cleanups=[],this.rafId=null,this.marks=new Map,this.xhrState=new WeakMap,this.config=k.resolveConfig(null!=e?e:{}),this.active=this.config.enabled&&n();const s=this;if(this.pluginSystem=new c({inspector:this,storage:{get network(){return s.getEntries("network")},get console(){return s.getEntries("console")},get errors(){return s.getEntries("errors")},get metrics(){return s.getEntries("metrics")}},events:this.events,config:this.config}),this.active){k.instances.push(this),this.config.features.network&&(this.interceptFetch(),this.interceptXHR()),this.config.features.console&&this.interceptConsole(),this.config.features.errors&&this.interceptErrors(),this.setupHotkeys(),this.mountWhenReady();for(const n of null!==(t=e.plugins)&&void 0!==t?t:[])this.use(n).catch(e=>{this.destroyed||this.reportInternal("Failed to register plugin",e)});this.events.emit("inspector:ready")}}static getInstance(){const{instances:e}=k;return e.length>0?e[e.length-1]:null}static resolveConfig(n){var s,r,i,o,a;const c=null!==(s=n.features)&&void 0!==s?s:{},l="light"===n.theme||"dark"===n.theme?n.theme:"auto",d=(()=>{try{return"undefined"==typeof window||"function"!=typeof window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches}catch(e){return!0}})(),h=null!==(r=n.hotkeys)&&void 0!==r?r:{};return{enabled:"boolean"==typeof n.enabled?n.enabled:e(),position:u.includes(n.position)?n.position:"bottom-right",theme:"auto"===l?d?"dark":"light":l,hotkeys:{toggle:v(null!==(i=h.toggle)&&void 0!==i?i:"ctrl+shift+d"),minimize:v(null!==(o=h.minimize)&&void 0!==o?o:"ctrl+shift+m")},features:{network:!1!==c.network,console:!1!==c.console,performance:!1!==c.performance,errors:!1!==c.errors},maxNetworkEntries:t(n.maxNetworkEntries,1e3),maxConsoleEntries:t(n.maxConsoleEntries,500),maxErrorEntries:t(n.maxErrorEntries,100),captureStackTraces:!1!==n.captureStackTraces,hideAssets:!0===(null===(a=n.networkFilters)||void 0===a?void 0:a.hideAssets),slowRequestThreshold:t(n.slowRequestThreshold,3e3),onError:"function"==typeof n.onError?n.onError:void 0,onPerformanceIssue:"function"==typeof n.onPerformanceIssue?n.onPerformanceIssue:void 0}}get isEnabled(){return this.active&&!this.destroyed}show(){this.isEnabled&&(this.isVisible=!0,this.panel&&(this.panel.style.display="flex"),this.widget&&(this.widget.style.display="none"),this.render(),this.startPerformanceLoop(),this.events.emit("inspector:show"))}hide(){this.isEnabled&&(this.isVisible=!1,this.panel&&(this.panel.style.display="none"),this.widget&&(this.widget.style.display="flex"),this.stopPerformanceLoop(),this.events.emit("inspector:hide"))}toggle(){this.isVisible?this.hide():this.show()}minimize(){this.isEnabled&&(this.isMinimized=!this.isMinimized,this.panel&&(this.panel.style.height=this.isMinimized?"48px":"650px"),this.render(),this.events.emit("inspector:minimize",this.isMinimized))}clear(e="all"){"network"!==e&&"all"!==e||(this.network=[],this.selectedRequestId=null),"console"!==e&&"all"!==e||(this.consoleEntries=[]),"errors"!==e&&"all"!==e||(this.errors=[]),"metrics"!==e&&"all"!==e||(this.metrics=[]),this.scheduleRender()}toggleRecording(){return this.isRecording=!this.isRecording,this.scheduleRender(),this.isRecording}get recording(){return this.isRecording}getEntries(e){switch(e){case"network":return this.network.map(e=>({...e}));case"console":return this.consoleEntries.map(e=>({...e}));case"errors":return this.errors.map(e=>({...e}));default:return this.metrics.map(e=>({...e}))}}track(e,t){if(!this.isEnabled)return;const n={id:f(),name:String(e),data:t,timestamp:Date.now()};this.pushBounded(this.metrics,n,500),this.emitSafely("performance:metric",n),this.scheduleRender()}markStart(e){var t;if(this.isEnabled){this.marks.set(String(e),performance.now());try{null===(t=performance.mark)||void 0===t||t.call(performance,`devinspector-${e}-start`)}catch(e){}}}markEnd(e){var t,n;if(!this.isEnabled)return;const s=String(e),r=this.marks.get(s);if(void 0===r)return;this.marks.delete(s);const i=performance.now()-r;try{null===(t=performance.mark)||void 0===t||t.call(performance,`devinspector-${s}-end`),null===(n=performance.measure)||void 0===n||n.call(performance,`devinspector-${s}`,`devinspector-${s}-start`,`devinspector-${s}-end`)}catch(e){}const o={id:f(),name:s,duration:i,timestamp:Date.now()};return this.pushBounded(this.metrics,o,500),this.emitSafely("performance:mark",o),this.scheduleRender(),i}use(e){return this.destroyed?Promise.reject(new Error("DevInspector has been destroyed")):this.pluginSystem.register(e).then(async()=>{if(this.destroyed)throw await this.pluginSystem.unregister(e.name).catch(t=>this.reportInternal(`Failed to uninstall plugin "${e.name}"`,t)),new Error("DevInspector has been destroyed")})}on(e,t){return this.events.on(e,t)}once(e,t){return this.events.once(e,t)}off(e,t){this.events.off(e,t)}export(){return{version:l,timestamp:Date.now(),data:{network:this.getEntries("network"),console:this.getEntries("console"),errors:this.getEntries("errors"),metrics:this.getEntries("metrics")}}}import(e){const t=e&&"object"==typeof e?e.data:void 0;if(!t||"object"!=typeof t)throw new TypeError("DevInspector.import() expects an object produced by export()");const n=t,s=e=>Array.isArray(e)?e.filter(e=>!!e&&"object"==typeof e):[],r=(e,t="")=>"string"==typeof e?e:t,i=e=>"number"==typeof e&&Number.isFinite(e)?e:void 0;this.network=s(n.network).slice(0,this.config.maxNetworkEntries).map(e=>{var t;return{id:r(e.id,f()),type:"xhr"===e.type?"xhr":"fetch",url:r(e.url),method:r(e.method,"GET"),status:"number"==typeof e.status?e.status:"pending"===e.status?"pending":"error",timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now(),duration:i(e.duration),error:"string"==typeof e.error?e.error:void 0}}),this.consoleEntries=s(n.console).slice(0,this.config.maxConsoleEntries).map(e=>{var t;return{id:r(e.id,f()),level:d.includes(e.level)?e.level:"log",message:y(r(e.message)),timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now()}}),this.errors=s(n.errors).slice(0,this.config.maxErrorEntries).map(e=>{var t;return{id:r(e.id,f()),type:"Promise Rejection"===e.type?"Promise Rejection":"JavaScript Error",message:y(r(e.message)),timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now(),stack:"string"==typeof e.stack?y(e.stack):void 0}}),this.metrics=s(n.metrics).slice(0,500).map(e=>{var t;return{id:r(e.id,f()),name:r(e.name),data:e.data,duration:i(e.duration),timestamp:null!==(t=i(e.timestamp))&&void 0!==t?t:Date.now()}}),this.selectedRequestId=null,this.scheduleRender()}destroy(){var e,t;if(!this.destroyed){this.destroyed=!0;for(const e of this.patches.reverse())a(e.target,e.key,e.replacement,e.original);this.patches=[];for(const e of this.cleanups.splice(0))try{e()}catch(e){}this.stopPerformanceLoop(),null===(e=this.widget)||void 0===e||e.remove(),null===(t=this.panel)||void 0===t||t.remove(),this.widget=null,this.panel=null;for(const e of this.pluginSystem.getAll())this.pluginSystem.unregister(e.name).catch(t=>this.reportInternal(`Failed to uninstall plugin "${e.name}"`,t));this.emitSafely("inspector:destroy",void 0),this.events.removeAllListeners(),this.network=[],this.consoleEntries=[],this.errors=[],this.metrics=[],this.marks.clear(),k.instances=k.instances.filter(e=>e!==this)}}get capturingAllowed(){return!this.destroyed&&this.isRecording&&!this.capturing}capture(e){if(this.capturingAllowed){this.capturing=!0;try{e()}catch(e){this.reportInternal("Capture failed",e)}finally{this.capturing=!1}}}emitSafely(e,t){this.events.emit(e,t)}pushBounded(e,t,n){e.unshift(t),e.length>n&&(e.length=n)}patch(e,t,n){const s=e[t];e[t]=n,this.patches.push({target:e,key:t,original:s,replacement:n})}listen(e,t,n){e.addEventListener(t,n),this.cleanups.push(()=>e.removeEventListener(t,n))}addNetworkEntry(e){this.pushBounded(this.network,e,this.config.maxNetworkEntries),this.emitSafely("network:request",{...e}),this.scheduleRender()}finishNetworkEntry(e,t,n,s){if(e.status=t,e.duration=Math.round(n),void 0!==s&&(e.error=s),this.emitSafely("error"===t?"network:error":"network:response",{...e}),n>this.config.slowRequestThreshold){const t={type:"slow-network",message:`Slow network request: ${e.url}`,url:e.url,duration:e.duration};this.emitSafely("performance:issue",t),this.callUser(this.config.onPerformanceIssue,t)}this.scheduleRender()}interceptFetch(){const e="function"==typeof window.fetch?window.fetch:null;if(!e)return;const t=this;this.patch(window,"fetch",function(...n){let s=null;const r=performance.now();if(t.capture(()=>{s={id:f(),type:"fetch",url:w(n[0]),method:x(n[0],n[1]),status:"pending",timestamp:Date.now()},t.addNetworkEntry(s)}),!s)return Reflect.apply(e,this,n);const i=s;let o;try{o=Reflect.apply(e,this,n)}catch(e){throw t.capture(()=>t.finishNetworkEntry(i,"error",performance.now()-r,e instanceof Error?e.message:String(e))),e}return Promise.resolve(o).then(e=>(t.capture(()=>t.finishNetworkEntry(i,e.status,performance.now()-r)),e),e=>{throw t.capture(()=>t.finishNetworkEntry(i,"error",performance.now()-r,e instanceof Error?e.message:String(e))),e})})}interceptXHR(){const e="function"==typeof XMLHttpRequest?XMLHttpRequest:null;if(!e)return;const t=e.prototype,n=t.open,s=t.send,r=this;this.patch(t,"open",function(...e){var t,s;const i=Reflect.apply(n,this,e);return r.destroyed||(null===(s=null===(t=r.xhrState.get(this))||void 0===t?void 0:t.terminate)||void 0===s||s.call(t),r.xhrState.set(this,{method:"string"==typeof e[0]?e[0].toUpperCase():"GET",url:w(e[1])})),i}),this.patch(t,"send",function(...e){var t;const n=r.xhrState.get(this),i={};n&&r.capture(()=>i.fail=r.trackXhr(this,n));try{return Reflect.apply(s,this,e)}catch(e){throw null===(t=i.fail)||void 0===t||t.call(i,e),e}})}trackXhr(e,t){const n={entry:t.entry,start:t.start,failure:t.failure,terminate:t.terminate};let s=!1;const r={id:f(),type:"xhr",url:t.url,method:t.method,status:"pending",timestamp:Date.now()},i=performance.now();t.entry=r,t.start=i,t.failure=void 0;const o=e=>()=>{t.failure=e},a=o("Network error"),c=o("Request aborted"),l=o("Request timed out"),d=()=>{e.removeEventListener("error",a),e.removeEventListener("abort",c),e.removeEventListener("timeout",l),e.removeEventListener("loadend",h)},h=()=>{var n;if(d(),s||t.entry!==r||this.destroyed)return;s=!0;const i=performance.now()-(null!==(n=t.start)&&void 0!==n?n:performance.now()),o=void 0!==t.failure||0===e.status;this.capture(()=>{var n;return this.finishNetworkEntry(r,o?"error":e.status,i,o?null!==(n=t.failure)&&void 0!==n?n:"Network error":void 0)})};return e.addEventListener("error",a),e.addEventListener("abort",c),e.addEventListener("timeout",l),e.addEventListener("loadend",h),t.terminate=()=>{d(),s||this.destroyed||(s=!0,this.capture(()=>this.finishNetworkEntry(r,"error",performance.now()-i,"Request aborted")))},this.addNetworkEntry(r),e=>{d(),s||(s=!0,t.entry===r&&Object.assign(t,n),this.destroyed||this.capture(()=>this.finishNetworkEntry(r,"error",performance.now()-i,e instanceof Error?e.message:String(e))))}}interceptConsole(){const e=this;for(const t of d){const n=console[t];if("function"!=typeof n)continue;const s=function(...s){const r=Reflect.apply(n,void 0===this?console:this,s);return e.capture(()=>{const n={id:f(),level:t,message:y(s.map(b).join(" ")),timestamp:Date.now()};e.pushBounded(e.consoleEntries,n,e.config.maxConsoleEntries),e.emitSafely("console:log",{...n}),e.scheduleRender()}),r};this.patch(console,t,s)}}interceptErrors(){const e=(e,t)=>{this.pushBounded(this.errors,e,this.config.maxErrorEntries),this.emitSafely("error:uncaught",{...e}),this.callUser(this.config.onError,t),this.scheduleRender()};this.listen(window,"error",t=>{this.capture(()=>{var n;const s=t.error instanceof Error?t.error:new Error(String(null!==(n=t.message)&&void 0!==n?n:"Unknown error"));e({id:f(),type:"JavaScript Error",message:y(String(t.message||s.message)),timestamp:Date.now(),stack:this.config.captureStackTraces&&s.stack?y(s.stack):void 0,filename:"string"==typeof t.filename&&t.filename?t.filename:void 0,lineno:"number"==typeof t.lineno?t.lineno:void 0,colno:"number"==typeof t.colno?t.colno:void 0},s)})}),this.listen(window,"unhandledrejection",t=>{this.capture(()=>{const n=t.reason,s=n instanceof Error?n:new Error(b(n));e({id:f(),type:"Promise Rejection",message:y(s.message),timestamp:Date.now(),stack:this.config.captureStackTraces&&n instanceof Error&&n.stack?y(n.stack):void 0},s)})})}setupHotkeys(){const{toggle:e,minimize:t}=this.config.hotkeys;(e||t)&&this.listen(document,"keydown",n=>{const s=function(e){return"string"!=typeof e.key?"":[e.ctrlKey&&"ctrl",e.altKey&&"alt",e.shiftKey&&"shift",e.metaKey&&"meta",e.key.toLowerCase()].filter(Boolean).join("+")}(n);e&&s===e?(n.preventDefault(),this.toggle()):t&&s===t&&(n.preventDefault(),this.isVisible||this.show(),this.minimize())})}callUser(e,t){if(e)try{e(t)}catch(e){this.reportInternal("A DevInspector callback threw",e)}}reportInternal(e,t){const n=this.patches.find(e=>e.target===console&&"error"===e.key),s=n?n.original:console.error;try{s.call(console,`[DevInspector] ${e}:`,t)}catch(e){}}startPerformanceLoop(){if(!this.config.features.performance||null!==this.rafId||"function"!=typeof requestAnimationFrame)return;let e=performance.now(),t=0;const n=()=>{if(this.destroyed||!this.isVisible)return void(this.rafId=null);t++;const s=performance.now();if(s-e>=1e3){this.performanceStats.fps=Math.round(1e3*t/(s-e)),t=0,e=s;const n=performance.memory;n&&(this.performanceStats.memory={used:Math.round(n.usedJSHeapSize/1048576),total:Math.round(n.totalJSHeapSize/1048576),limit:Math.round(n.jsHeapSizeLimit/1048576)}),"performance"===this.activeTab&&this.scheduleRender()}this.rafId=requestAnimationFrame(n)};this.rafId=requestAnimationFrame(n)}stopPerformanceLoop(){null!==this.rafId&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(this.rafId),this.rafId=null}mountWhenReady(){if(document.body)return void this.mount();this.listen(document,"DOMContentLoaded",()=>{this.destroyed||this.widget||this.mount()})}get colors(){return m[this.config.theme]}placement(e){const[t,n]=this.config.position.split("-");return`${t}: ${e}px; ${n}: ${e}px;`}mount(){const e=document.createElement("div");e.className="devinspector-widget",e.setAttribute("role","button"),e.setAttribute("aria-label","Open DevInspector"),e.title="DevInspector",e.textContent="🔍",e.style.cssText=`position: fixed; ${this.placement(24)} width: 56px; height: 56px;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 50%;\n display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 999999;\n color: white; font-size: 24px; box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4); user-select: none;`,e.addEventListener("click",()=>this.toggle());const t=document.createElement("div");t.className="devinspector-panel",t.style.cssText=`position: fixed; ${this.placement(24)} width: 480px; max-width: calc(100vw - 48px);\n height: 650px; max-height: calc(100vh - 48px); background: ${this.colors.bg}; border: 1px solid ${this.colors.border};\n border-radius: 12px; display: none; flex-direction: column; z-index: 999998; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 13px;\n color: ${this.colors.text}; overflow: hidden;`,t.addEventListener("click",e=>this.handlePanelClick(e)),this.widget=e,this.panel=t,document.body.appendChild(e),document.body.appendChild(t),this.render()}handlePanelClick(e){var t,n;const s=e.target,r=null===(t=null==s?void 0:s.closest)||void 0===t?void 0:t.call(s,"[data-action]");if(!r)return;switch(r.getAttribute("data-action")){case"minimize":this.minimize();break;case"close":this.hide();break;case"tab":{const e=r.getAttribute("data-tab");["network","console","performance","errors"].includes(e)&&(this.activeTab=e,this.render());break}case"clear":this.clear(null!==(n=r.getAttribute("data-target"))&&void 0!==n?n:"all");break;case"toggle-recording":this.toggleRecording();break;case"select-request":this.selectedRequestId=r.getAttribute("data-id"),this.render();break;case"close-details":this.selectedRequestId=null,this.render()}}scheduleRender(){!this.renderQueued&&this.panel&&this.isVisible&&(this.renderQueued=!0,queueMicrotask(()=>{this.renderQueued=!1,this.destroyed||this.render()}))}render(){if(!this.panel||!this.isVisible)return;const e=this.colors,t=(e,t,n="",s="#374151")=>`<button type="button" data-action="${e}" ${n} style="padding: 6px 12px; background: ${s}; border: none; color: white; cursor: pointer; border-radius: 6px; margin-right: 8px;">${t}</button>`,n=[{id:"network",label:"Network",count:this.network.length},{id:"console",label:"Console",count:this.consoleEntries.length},{id:"performance",label:"Performance"},{id:"errors",label:"Errors",count:this.errors.length}],s=`\n <div style="display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: ${e.header}; border-bottom: 1px solid ${e.border};">\n <div style="display: flex; align-items: center; gap: 8px;">\n <span style="width: 8px; height: 8px; border-radius: 50%; background: ${this.isRecording?"#ef4444":"#6b7280"};"></span>\n <span style="font-weight: 600; font-size: 14px;">DevInspector v${r(l)}</span>\n </div>\n <div style="display: flex; gap: 4px;">\n <button type="button" data-action="minimize" aria-label="Minimize" style="padding: 6px; background: none; border: none; color: ${e.muted}; cursor: pointer;">−</button>\n <button type="button" data-action="close" aria-label="Close" style="padding: 6px; background: none; border: none; color: ${e.muted}; cursor: pointer;">×</button>\n </div>\n </div>`;if(this.isMinimized)return void(this.panel.innerHTML=s);const i=n.map(t=>`<button type="button" data-action="tab" data-tab="${t.id}" style="padding: 12px 16px; border: none; cursor: pointer;\n background: ${this.activeTab===t.id?e.bg:"transparent"}; color: ${this.activeTab===t.id?"#3b82f6":e.muted};\n border-bottom: 2px solid ${this.activeTab===t.id?"#3b82f6":"transparent"};">${t.label}${void 0!==t.count?` <span style="background: #374151; color: white; padding: 2px 6px; border-radius: 10px; font-size: 11px; margin-left: 4px;">${t.count}</span>`:""}</button>`).join("");let o="";switch(this.activeTab){case"network":o=this.renderNetwork(t);break;case"console":o=this.renderConsole(t);break;case"performance":o=this.renderPerformance(t);break;case"errors":o=this.renderErrors(t)}this.panel.innerHTML=`${s}\n <div style="display: flex; background: ${e.header}; border-bottom: 1px solid ${e.border};">${i}</div>\n <div style="flex: 1; min-height: 0; display: flex; flex-direction: column;">${o}</div>`}toolbar(e,t){const n=this.colors;return`<div style="padding: 12px; border-bottom: 1px solid ${n.border}; background: ${n.toolbar}; display: flex; align-items: center;">\n ${e}<span style="margin-left: auto; color: ${n.muted}; font-size: 12px;">${t}</span></div>`}empty(e){return`<div style="display: flex; align-items: center; justify-content: center; height: 200px; color: ${this.colors.muted};">${e}</div>`}renderNetwork(e){var t;const n=this.colors,s=this.config.hideAssets?this.network.filter(e=>!p.test(e.url)):this.network,i=s.map(e=>{var t;const s=e.id===this.selectedRequestId;return`<div data-action="select-request" data-id="${r(e.id)}" style="padding: 10px 16px; border-bottom: 1px solid ${n.row}; cursor: pointer; ${s?"background: rgba(59, 130, 246, 0.25);":""}">\n <div style="display: flex; justify-content: space-between; margin-bottom: 4px;">\n <div style="display: flex; gap: 8px;">\n <span style="background: ${function(e){switch(e){case"GET":return"#16a34a";case"POST":return"#2563eb";case"PUT":return"#d97706";case"DELETE":return"#dc2626";case"PATCH":return"#7c3aed";default:return"#6b7280"}}(e.method)}; color: white; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600;">${r(e.method)}</span>\n <span style="color: ${i=e.status,"number"!=typeof i?"#6b7280":i>=200&&i<300?"#22c55e":i>=300&&i<400?"#f59e0b":i>=400?"#ef4444":"#6b7280"}; font-weight: 600;">${r(e.status)}</span>\n <span style="color: ${n.muted};">${null!==(t=e.duration)&&void 0!==t?t:"-"}ms</span>\n </div>\n <span style="color: ${n.muted}; font-size: 11px;">${r(new Date(e.timestamp).toLocaleTimeString())}</span>\n </div>\n <div style="font-size: 12px; word-break: break-all;">${r(e.url)}</div>\n </div>`;var i}).join(""),o=this.selectedRequestId?this.network.find(e=>e.id===this.selectedRequestId):void 0,a=o?`<div style="border-top: 1px solid ${n.border}; max-height: 200px; overflow-y: auto; background: ${n.toolbar}; padding: 12px 16px; font-size: 12px;">\n <div style="display: flex; justify-content: space-between; margin-bottom: 8px;"><strong>Request details</strong>\n <button type="button" data-action="close-details" aria-label="Close details" style="background: none; border: none; color: ${n.muted}; cursor: pointer;">×</button></div>\n <div><strong>URL:</strong> ${r(o.url)}</div>\n <div><strong>Method:</strong> ${r(o.method)}</div>\n <div><strong>Type:</strong> ${r(o.type)}</div>\n <div><strong>Status:</strong> ${r(o.status)}</div>\n <div><strong>Duration:</strong> ${null!==(t=o.duration)&&void 0!==t?t:"-"}ms</div>\n ${o.error?`<div><strong>Error:</strong> ${r(o.error)}</div>`:""}\n </div>`:"";return`${this.toolbar(e("clear","Clear",'data-target="network"')+e("toggle-recording",this.isRecording?"Pause":"Resume","",this.isRecording?"#ef4444":"#22c55e"),`${s.length} requests`)}\n <div style="flex: 1; overflow-y: auto;">${i||this.empty("No network activity")}</div>${a}`}renderConsole(e){const t=this.colors,n=this.consoleEntries.map(e=>`<div style="padding: 8px 16px; border-bottom: 1px solid ${t.row}; font-size: 12px;">\n <span style="color: ${function(e){switch(e){case"info":return"#60a5fa";case"warn":return"#fbbf24";case"error":return"#f87171";case"debug":return"#a78bfa";default:return"inherit"}}(e.level)}; text-transform: uppercase; font-weight: 600;">[${r(e.level)}]</span>\n <span style="color: ${t.muted}; margin: 0 8px;">${r(new Date(e.timestamp).toLocaleTimeString())}</span>\n <span style="white-space: pre-wrap; word-break: break-word;">${r(e.message)}</span>\n </div>`).join("");return`${this.toolbar(e("clear","Clear",'data-target="console"'),`${this.consoleEntries.length} logs`)}\n <div style="flex: 1; overflow-y: auto; font-family: monospace;">${n||this.empty("No console logs")}</div>`}renderPerformance(e){const t=this.colors,{fps:n,memory:s}=this.performanceStats,i=this.metrics.slice(0,100).map(e=>`<div style="padding: 6px 0; border-bottom: 1px solid ${t.row}; font-size: 12px;">\n <strong>${r(e.name)}</strong>\n ${void 0!==e.duration?`<span style="color: ${t.muted};"> ${e.duration.toFixed(1)}ms</span>`:""}\n ${void 0!==e.data?`<span style="color: ${t.muted};"> ${r(y(b(e.data)))}</span>`:""}\n </div>`).join("");return`${this.toolbar(e("clear","Clear",'data-target="metrics"'),`${this.metrics.length} metrics`)}\n <div style="flex: 1; overflow-y: auto; padding: 16px;">\n <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;">\n <div style="background: #1e3a8a; border-radius: 12px; padding: 16px; text-align: center;">\n <div style="font-size: 28px; font-weight: 700; color: #93c5fd;">${this.config.features.performance?n:"-"}</div>\n <div style="font-size: 12px; color: #bfdbfe;">FPS</div>\n </div>\n <div style="background: #166534; border-radius: 12px; padding: 16px; text-align: center;">\n <div style="font-size: 28px; font-weight: 700; color: #86efac;">${s?`${s.used} MB`:"N/A"}</div>\n <div style="font-size: 12px; color: #bbf7d0;">Memory</div>\n </div>\n </div>\n ${i||`<div style="color: ${t.muted};">Use track(), markStart() and markEnd() to record metrics.</div>`}\n </div>`}renderErrors(e){const t=this.colors,n=this.errors.map(e=>`<div style="padding: 12px 16px; border-bottom: 1px solid ${t.row};">\n <div style="display: flex; justify-content: space-between; margin-bottom: 6px;">\n <span style="color: #ef4444; font-weight: 600;">${r(e.type)}</span>\n <span style="color: ${t.muted}; font-size: 11px;">${r(new Date(e.timestamp).toLocaleTimeString())}</span>\n </div>\n <div style="color: #f87171; margin-bottom: 6px; word-break: break-word;">${r(e.message)}</div>\n ${e.stack?`<pre style="background: ${t.code}; padding: 8px; border-radius: 4px; font-size: 11px; color: ${t.muted}; overflow-x: auto; white-space: pre-wrap;">${r(e.stack)}</pre>`:""}\n </div>`).join("");return`${this.toolbar(e("clear","Clear",'data-target="errors"'),`${this.errors.length} errors`)}\n <div style="flex: 1; overflow-y: auto;">${n||this.empty("No errors recorded")}</div>`}}k.instances=[];class E{constructor(e){this.head=0,this.tail=0,this.size=0,this.idCounter=0;const{maxSize:t}=e;if("number"!=typeof t||!Number.isFinite(t)||t<0)throw new RangeError(`CircularStorage maxSize must be a non-negative finite number, got ${String(t)}`);this.maxSize=Math.floor(t),this.ttl=e.ttl,this.onEvict=e.onEvict,this.buffer=new Array(this.maxSize)}push(e){const t=`${Date.now()}-${++this.idCounter}`;if(0===this.maxSize)return t;const n={id:t,timestamp:Date.now(),data:e};if(this.size===this.maxSize){const e=this.buffer[this.tail];e&&this.onEvict&&this.onEvict(e),this.tail=(this.tail+1)%this.maxSize}else this.size++;return this.buffer[this.head]=n,this.head=(this.head+1)%this.maxSize,t}get(e){const t=this.findEntry(e);if(t&&!this.isExpired(t))return t.data}getAll(){return this.getAllEntries().map(e=>e.data)}getAllEntries(){const e=[],t=Date.now();for(let n=0;n<this.size;n++){const s=(this.tail+n)%this.maxSize,r=this.buffer[s];r&&!this.isExpired(r,t)&&e.push(r)}return e}find(e){const t=this.getAllEntries();for(const n of t)if(e(n.data))return n.data}filter(e){return this.getAllEntries().filter(t=>e(t.data)).map(e=>e.data)}clear(){this.buffer=new Array(this.maxSize),this.head=0,this.tail=0,this.size=0}getSize(){return this.size}isFull(){return this.size===this.maxSize}findEntry(e){for(let t=0;t<this.size;t++){const n=(this.tail+t)%this.maxSize,s=this.buffer[n];if(s&&s.id===e)return s}}isExpired(e,t=Date.now()){return!!this.ttl&&t-e.timestamp>this.ttl}removeExpired(){var e;if(!this.ttl)return 0;const t=Date.now();let n=0;const s=[];for(let r=0;r<this.size;r++){const i=(this.tail+r)%this.maxSize,o=this.buffer[i];o&&!this.isExpired(o,t)?s.push(o):o&&(null===(e=this.onEvict)||void 0===e||e.call(this,o),n++)}return this.buffer=new Array(this.maxSize),this.size=s.length,this.tail=0,this.head=this.size,s.forEach((e,t)=>{this.buffer[t]=e}),n}}class S{constructor(e){this.storage=new Map,this.accessOrder=[],this.maxSize=e.maxSize,this.ttl=e.ttl,this.onEvict=e.onEvict}set(e,t){const n={id:e,timestamp:Date.now(),data:t};if(this.storage.has(e)){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1)}else if(this.storage.size>=this.maxSize){const e=this.accessOrder.shift();if(e){const t=this.storage.get(e);t&&this.onEvict&&this.onEvict(t),this.storage.delete(e)}}this.storage.set(e,n),this.accessOrder.push(e)}get(e){const t=this.storage.get(e);if(t&&!this.isExpired(t))return this.updateAccessOrder(e),t.data;t&&this.delete(e)}has(e){const t=this.storage.get(e);return!(!t||this.isExpired(t))||(t&&this.delete(e),!1)}delete(e){const t=this.storage.get(e);return!!t&&(this.onEvict&&this.onEvict(t),this.storage.delete(e),this.accessOrder=this.accessOrder.filter(t=>t!==e),!0)}clear(){this.onEvict&&this.storage.forEach(e=>this.onEvict(e)),this.storage.clear(),this.accessOrder=[]}getSize(){return this.storage.size}getAllKeys(){return Array.from(this.storage.keys())}getAllValues(){return Array.from(this.storage.values()).filter(e=>!this.isExpired(e)).map(e=>e.data)}updateAccessOrder(e){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}isExpired(e){return!!this.ttl&&Date.now()-e.timestamp>this.ttl}removeExpired(){let e=0;const t=[];return this.storage.forEach((e,n)=>{this.isExpired(e)&&t.push(n)}),t.forEach(t=>{this.delete(t)&&e++}),e}}let $=class s{constructor(e={}){if(this.isVisible=!1,this.isMinimized=!1,this.monitors=new Map,this.ui=null,this.initialized=!1,this.cleanupFunctions=[],this.initPromise=null,this.destroyed=!1,this.uninstallingPlugins=new Set,s.instance)return console.warn("DevInspector instance already exists. Returning existing instance."),s.instance;this.config=this.mergeConfig(e),this.events=new i({maxListeners:100}),this.networkStorage=new E({maxSize:this.config.maxNetworkEntries,onEvict:e=>this.events.emit("network:evict",e)}),this.consoleStorage=new E({maxSize:this.config.maxConsoleEntries,onEvict:e=>this.events.emit("console:evict",e)}),this.performanceStorage=new S({maxSize:1e3,ttl:36e5}),this.errorStorage=new E({maxSize:this.config.maxErrorEntries,onEvict:e=>this.events.emit("error:evict",e)}),this.pluginSystem=new c({inspector:this,storage:{network:this.networkStorage,console:this.consoleStorage,performance:this.performanceStorage,error:this.errorStorage},events:this.events,config:this.config}),this.config.enabled&&this.init(),s.instance=this}mergeConfig(n){const s={enabled:e(),position:"bottom-right",theme:"auto",hotkeys:{toggle:"ctrl+shift+d",minimize:"ctrl+shift+m"},features:{network:!0,console:!0,performance:!0,errors:!0,state:!0,dom:!0,storage:!0},plugins:[],maxNetworkEntries:1e3,maxConsoleEntries:500,captureStackTraces:!0,networkFilters:{hideAssets:!1,hideCached:!1},onError:()=>{},onPerformanceIssue:()=>{},maxErrorEntries:100,slowRequestThreshold:3e3,workerUrl:void 0,remoteConfig:null};return{...s,...n,hotkeys:{...s.hotkeys,...n.hotkeys},features:{...s.features,...n.features},networkFilters:{...s.networkFilters,...n.networkFilters},maxNetworkEntries:t(n.maxNetworkEntries,s.maxNetworkEntries),maxConsoleEntries:t(n.maxConsoleEntries,s.maxConsoleEntries),maxErrorEntries:t(n.maxErrorEntries,s.maxErrorEntries)}}init(){return this.initPromise||(this.initPromise=this.runInit()),this.initPromise}async runInit(){var e,t;if(!this.initialized&&!this.destroyed&&n())try{if(await this.loadMonitors(),this.destroyed)return this.teardown();if(await this.loadUI(),this.destroyed)return this.teardown();if(await this.registerPlugins(),this.destroyed)return this.teardown();this.setupHotkeys(),this.initialized=!0,this.events.emit("inspector:ready")}catch(n){this.teardown(),this.initPromise=null,console.error("Failed to initialize DevInspector:",n),null===(t=(e=this.config).onError)||void 0===t||t.call(e,n)}}async loadMonitors(){const e=this.config.features;if(e.network){const{NetworkMonitor:e}=await Promise.resolve().then(function(){return T}),t=new e(this);this.monitors.set("network",t),t.start()}if(e.console){const{ConsoleMonitor:e}=await Promise.resolve().then(function(){return j}),t=new e(this);this.monitors.set("console",t),t.start()}if(e.performance){const{PerformanceMonitor:e}=await Promise.resolve().then(function(){return H}),t=new e(this);this.monitors.set("performance",t),t.start()}if(e.errors){const{ErrorMonitor:e}=await Promise.resolve().then(function(){return W}),t=new e(this);this.monitors.set("error",t),t.start()}if(e.state){const{StateMonitor:e}=await Promise.resolve().then(function(){return V}),t=new e(this);this.monitors.set("state",t),t.start()}if(e.dom){const{DOMMonitor:e}=await Promise.resolve().then(function(){return J}),t=new e(this);this.monitors.set("dom",t),t.start()}if(e.storage){const{StorageMonitor:e}=await Promise.resolve().then(function(){return X}),t=new e(this);this.monitors.set("storage",t),t.start()}}async loadUI(){const{DevInspectorUI:e}=await Promise.resolve().then(function(){return Y});this.ui=new e(this),await this.ui.init()}async registerPlugins(){for(const e of this.config.plugins)try{await this.pluginSystem.register(e)}catch(e){console.error("Failed to register plugin:",e)}}setupHotkeys(){const e=e=>{const{hotkeys:t}=this.config,n=this.getKeyCombo(e);n===t.toggle?(e.preventDefault(),this.toggle()):n===t.minimize&&(e.preventDefault(),this.minimize())};document.addEventListener("keydown",e),this.cleanupFunctions.push(()=>document.removeEventListener("keydown",e))}getKeyCombo(e){const t=[];return e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.metaKey&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}show(){var e;this.destroyed||(this.initialized?(this.isVisible=!0,this.isMinimized=!1,null===(e=this.ui)||void 0===e||e.show(),this.events.emit("inspector:show")):this.init().then(()=>{this.initialized&&!this.destroyed&&this.show()}).catch(e=>{var t,n;console.error("Failed to show inspector:",e),null===(n=(t=this.config).onError)||void 0===n||n.call(t,e)}))}hide(){var e;this.isVisible=!1,null===(e=this.ui)||void 0===e||e.hide(),this.events.emit("inspector:hide")}minimize(){var e;this.isMinimized=!0,null===(e=this.ui)||void 0===e||e.minimize(),this.events.emit("inspector:minimize")}toggle(){this.isVisible&&!this.isMinimized?this.hide():this.show()}teardown(){var e;this.monitors.forEach(e=>{var t;try{null===(t=e.stop)||void 0===t||t.call(e)}catch(e){console.error("DevInspector: failed to stop a monitor",e)}}),this.monitors.clear(),null===(e=this.ui)||void 0===e||e.destroy(),this.ui=null,this.cleanupFunctions.forEach(e=>e()),this.cleanupFunctions=[],this.uninstallPlugins()}uninstallPlugins(e=this.pluginSystem.getAll().map(e=>e.name)){for(const t of e)this.uninstallingPlugins.has(t)||(this.uninstallingPlugins.add(t),this.pluginSystem.unregister(t).catch(e=>{console.error(`DevInspector: failed to uninstall plugin "${t}"`,e)}).finally(()=>this.uninstallingPlugins.delete(t)))}destroy(){this.destroyed=!0,this.teardown(),this.events.emit("inspector:destroy"),this.events.removeAllListeners(),s.instance=null}track(e,t){this.events.emit("performance:metric",{name:e,data:t,timestamp:Date.now()})}markStart(e){performance.mark(`devinspector-${e}-start`)}markEnd(e){performance.mark(`devinspector-${e}-end`);try{performance.measure(`devinspector-${e}`,`devinspector-${e}-start`,`devinspector-${e}-end`)}catch(t){console.warn(`Failed to measure ${e}:`,t)}}async use(e){if(this.destroyed)throw new Error("DevInspector has been destroyed");if(await this.pluginSystem.register(e),this.destroyed)throw this.uninstallPlugins([e.name]),new Error("DevInspector has been destroyed")}export(){return{version:"1.0.0",timestamp:Date.now(),config:this.config,data:{network:this.networkStorage.getAll(),console:this.consoleStorage.getAll(),performance:this.performanceStorage.getAllValues(),errors:this.errorStorage.getAll()}}}import(e){console.log("Import functionality not yet implemented",e)}on(e,t){return this.events.on(e,t)}off(e,t){this.events.off(e,t)}getEvents(){return this.events}getStorage(e){switch(e){case"network":return this.networkStorage;case"console":return this.consoleStorage;case"performance":return this.performanceStorage;case"error":return this.errorStorage}}getConfig(){return this.config}getPluginSystem(){return this.pluginSystem}getMonitor(e){return this.monitors.get(e)}static getInstance(){return s.instance}};$.instance=null;var M=Object.freeze({__proto__:null,BasePlugin:class{async install(e){this.context=e,await this.onInstall()}async uninstall(){await this.onUninstall(),this.context=void 0}enable(){this.onEnable()}disable(){this.onDisable()}onUninstall(){}onEnable(){}onDisable(){}get inspector(){var e;return null===(e=this.context)||void 0===e?void 0:e.inspector}get events(){var e;if(!(null===(e=this.context)||void 0===e?void 0:e.events))throw new Error("Events not available - plugin not installed");return this.context.events}get storage(){var e;return null===(e=this.context)||void 0===e?void 0:e.storage}get config(){var e;return null===(e=this.context)||void 0===e?void 0:e.config}},CircularStorage:E,DevInspector:k,EnhancedDevInspector:k,EventEmitter:i,IndexedStorage:S,OriginalDevInspector:$,SimpleDevInspector:class{constructor(t={}){this.widget=null,this.panel=null,this.isVisible=!1,this.onKeydown=e=>{e.ctrlKey&&e.shiftKey&&("D"===e.key||"d"===e.key)&&(e.preventDefault(),this.toggle())},this.config={enabled:e(),position:"bottom-right",theme:"dark",...t},this.config.enabled&&n()&&this.init()}init(){this.createWidget(),this.createPanel(),this.setupEventListeners()}createWidget(){this.widget=document.createElement("div"),this.widget.style.cssText=`\n position: fixed;\n ${"bottom-right"===this.config.position?"bottom: 20px; right: 20px;":""}\n ${"bottom-left"===this.config.position?"bottom: 20px; left: 20px;":""}\n ${"top-right"===this.config.position?"top: 20px; right: 20px;":""}\n ${"top-left"===this.config.position?"top: 20px; left: 20px;":""}\n width: 60px;\n height: 60px;\n background: #007acc;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 999999;\n font-size: 24px;\n box-shadow: 0 4px 16px rgba(0,0,0,0.3);\n transition: transform 0.3s ease;\n color: white;\n `,this.widget.innerHTML="🔍",this.widget.title="DevInspector - Click to toggle",document.body.appendChild(this.widget)}createPanel(){var e,t,n;this.panel=document.createElement("div");const s="dark"===this.config.theme?"#1e1e1e":"#ffffff",r="dark"===this.config.theme?"#cccccc":"#333333",i="dark"===this.config.theme?"#3e3e42":"#ddd";this.panel.style.cssText=`\n position: fixed;\n ${(null===(e=this.config.position)||void 0===e?void 0:e.includes("bottom"))?"bottom: 100px;":"top: 100px;"}\n ${(null===(t=this.config.position)||void 0===t?void 0:t.includes("right"))?"right: 20px;":"left: 20px;"}\n width: 500px;\n height: 400px;\n background: ${s};\n border: 1px solid ${i};\n border-radius: 8px;\n color: ${r};\n font-family: Monaco, monospace;\n font-size: 12px;\n display: none;\n flex-direction: column;\n z-index: 999998;\n box-shadow: 0 8px 32px rgba(0,0,0,0.5);\n `,this.panel.innerHTML=`\n <div style="padding: 10px; background: ${"dark"===this.config.theme?"#2d2d30":"#f5f5f5"}; border-bottom: 1px solid ${i}; display: flex; justify-content: space-between; align-items: center;">\n <span style="font-weight: bold;">DevInspector v1.0.0</span>\n <button type="button" class="devinspector-close" style="background: #f44336; border: none; color: white; width: 20px; height: 20px; border-radius: 3px; cursor: pointer;">×</button>\n </div>\n <div style="display: flex; background: ${"dark"===this.config.theme?"#2d2d30":"#f5f5f5"}; border-bottom: 1px solid ${i};">\n <button style="padding: 8px 16px; background: #007acc; border: none; color: white; cursor: pointer;">Network</button>\n <button style="padding: 8px 16px; background: none; border: none; color: ${r}; cursor: pointer;">Console</button>\n <button style="padding: 8px 16px; background: none; border: none; color: ${r}; cursor: pointer;">Performance</button>\n <button style="padding: 8px 16px; background: none; border: none; color: ${r}; cursor: pointer;">Errors</button>\n </div>\n <div style="flex: 1; padding: 15px; overflow: auto;">\n <div style="text-align: center; margin-top: 50px; color: #666;">\n <h3 style="color: #007acc; margin-bottom: 20px;">🎉 DevInspector v1.0.0 - Production Ready!</h3>\n <p>Welcome to the professional developer debugging tool!</p>\n <br>\n <div style="text-align: left; max-width: 400px; margin: 0 auto;">\n <h4 style="color: #007acc;">✅ Features Implemented:</h4>\n <ul style="list-style: none; padding: 0;">\n <li>🌐 Network monitoring (fetch, XHR, WebSocket)</li>\n <li>📝 Console enhancement with filtering</li>\n <li>⚡ Performance monitoring (FPS, memory, metrics)</li>\n <li>🐛 Error tracking with grouping</li>\n <li>🎨 Professional UI with themes</li>\n <li>🔌 Plugin architecture</li>\n <li>📦 Zero dependencies</li>\n <li>🚀 Production ready builds</li>\n </ul>\n <br>\n <p style="font-size: 11px; opacity: 0.8;">\n This is the production-ready DevInspector tool!<br>\n Framework-agnostic • TypeScript • Zero dependencies\n </p>\n </div>\n </div>\n </div>\n `,this.panel.className="devinspector-panel",null===(n=this.panel.querySelector(".devinspector-close"))||void 0===n||n.addEventListener("click",()=>this.hide()),document.body.appendChild(this.panel)}setupEventListeners(){this.widget&&this.widget.addEventListener("click",()=>this.toggle()),document.addEventListener("keydown",this.onKeydown)}show(){this.panel&&(this.panel.style.display="flex",this.isVisible=!0)}hide(){this.panel&&(this.panel.style.display="none",this.isVisible=!1)}toggle(){this.isVisible?this.hide():this.show()}destroy(){n()&&document.removeEventListener("keydown",this.onKeydown),this.widget&&this.widget.parentNode&&this.widget.parentNode.removeChild(this.widget),this.panel&&this.panel.parentNode&&this.panel.parentNode.removeChild(this.panel)}track(e,t){console.log(`[DevInspector] Tracking: ${e}`,t)}markStart(e){performance.mark(`devinspector-${e}-start`)}markEnd(e){performance.mark(`devinspector-${e}-end`);try{performance.measure(`devinspector-${e}`,`devinspector-${e}-start`,`devinspector-${e}-end`)}catch(t){console.warn(`Failed to measure ${e}:`,t)}}},VERSION:l,default:k});const z=k;for(const[e,t]of Object.entries(M))e in z||Object.defineProperty(z,e,{value:t,enumerable:!0});function C(){return`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}const L=65536;class I{constructor(e={}){this.requestMap=new Map,this.installed=null,this.originalFetch=window.fetch,this.handlers=e}install(){const e=this;if(this.installed||"function"!=typeof this.originalFetch)return;const t=async function(n,s){if(e.installed!==t)return e.originalFetch.apply(null!=this?this:window,[n,s]);const r=C(),i=performance.now();let o,a,c,l,d,h={};const p=new Promise(e=>d=e);let u;"undefined"!=typeof Request&&n instanceof Request?(o=n.url,a=n.method,n.headers.forEach((e,t)=>{h[t]=e}),l=e.extractBody(n,p)):(o=n.toString(),a=(null==s?void 0:s.method)||"GET",(null==s?void 0:s.headers)&&(s.headers instanceof Headers?s.headers.forEach((e,t)=>{h[t]=e}):Array.isArray(s.headers)?s.headers.forEach(([e,t])=>{h[e]=t}):h=s.headers),c=null==s?void 0:s.body);try{u=Promise.resolve(e.originalFetch.apply(null!=this?this:window,[n,s]))}catch(e){u=Promise.reject(e)}const m=(async()=>{var t,n;l&&(c=await l);const s={id:r,method:a,url:o,headers:h,body:e.sanitizeBody(c),timestamp:Date.now(),type:"fetch"};e.requestMap.set(r,s),null===(n=(t=e.handlers).onRequest)||void 0===n||n.call(t,s)})().catch(()=>{});let g;try{g=await u}catch(t){throw d(),m.then(()=>{var n,s;const i={id:r,message:(null==t?void 0:t.message)||"Network request failed",stack:null==t?void 0:t.stack,timestamp:Date.now()};try{null===(s=(n=e.handlers).onError)||void 0===s||s.call(n,i)}catch(e){}e.requestMap.delete(r)}),t}const f=performance.now()-i;return e.reportResponse(r,g,f,m),g};this.installed=t,window.fetch=t}async reportResponse(e,t,n,s){var r,i;try{const o={};let a;t.headers.forEach((e,t)=>{o[t]=e});try{a=t.bodyUsed?"[Body already read]":await this.extractResponseBody(t.clone())}catch(e){a="[Unable to read response]"}await s,null===(i=(r=this.handlers).onResponse)||void 0===i||i.call(r,{id:e,status:t.status,statusText:t.statusText,headers:o,body:a,size:this.calculateSize(a,o),duration:n,timestamp:Date.now(),fromCache:this.isFromCache(t,n)})}catch(e){}finally{this.requestMap.delete(e)}}uninstall(){this.installed&&a(window,"fetch",this.installed,this.originalFetch),this.installed=null,this.requestMap.clear()}async extractBody(e,t){try{if(e.bodyUsed)return"[Body already read]";if(!e.body)return;const n=e.headers.get("content-type")||"",s=n.includes("application/json");return s||n.includes("text/")||n.includes("application/x-www-form-urlencoded")?await this.readPreview(e.clone(),s,t):n.includes("multipart/form-data")?"[FormData]":"[Binary data]"}catch(e){return"[Unable to read body]"}}async readCapped(e,t){const n=e.body;if(!n||"function"!=typeof n.getReader){const t=await e.text();return t.length>L?{text:t.slice(0,L),truncated:!0}:{text:t,truncated:!1}}const s=n.getReader(),r=new TextDecoder;let i="",o=0;try{for(;;){const e=await(t?Promise.race([s.read(),t.then(()=>null)]):s.read());if(!e)return{text:i+r.decode(),truncated:!0};const{done:n,value:a}=e;if(n)return{text:i+r.decode(),truncated:!1};if(o+=a.byteLength,i+=r.decode(a,{stream:!0}),o>=L)return{text:i.slice(0,L),truncated:!0}}}finally{s.cancel().catch(()=>{})}}async readPreview(e,t,n){const{text:s,truncated:r}=await this.readCapped(e,n);if(r)return`${s}... [truncated]`;if(t)try{return JSON.parse(s)}catch(e){return s}return s}async extractResponseBody(e){var t,n;try{const s=e.headers.get("content-type")||"";if(s.includes("text/event-stream"))return null===(t=e.body)||void 0===t||t.cancel().catch(()=>{}),"[Event stream]";if(s.includes("application/json"))return await this.readPreview(e,!0);if(s.includes("text/"))return await this.readPreview(e,!1);if(s.includes("image/"))return"[Image data]";if(s.includes("video/"))return"[Video data]";if(s.includes("audio/"))return"[Audio data]";const r=e.headers.get("content-length");return null===(n=e.body)||void 0===n||n.cancel().catch(()=>{}),r?`[Binary data: ${r} bytes]`:"[Binary data]"}catch(e){return"[Unable to read response]"}}sanitizeBody(e){if(e){if("string"==typeof e)return e.length>1e4?e.substring(0,1e4)+"...":e;if(e instanceof FormData){const t={};return e.forEach((e,n)=>{e instanceof File?t[n]=`[File: ${e.name}, ${e.size} bytes]`:t[n]=e}),{type:"FormData",entries:t}}return e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e instanceof Blob?`[Blob: ${e.size} bytes, type: ${e.type}]`:e instanceof URLSearchParams?e.toString():e}}calculateSize(e,t){const n=t["content-length"];if(n)return parseInt(n,10);if("string"==typeof e)return new Blob([e]).size;if(e&&"object"==typeof e)try{return new Blob([JSON.stringify(e)]).size}catch(e){return 0}return 0}isFromCache(e,t){if(t<5)return!0;const n=e.headers.get("cache-control"),s=e.headers.get("etag"),r=e.headers.get("last-modified");return!!(n||s||r)}}class P{constructor(e={}){this.installed=null,this.handlers=e,this.originalOpen=XMLHttpRequest.prototype.open,this.originalSend=XMLHttpRequest.prototype.send,this.originalSetRequestHeader=XMLHttpRequest.prototype.setRequestHeader}install(){if(this.installed||"undefined"==typeof XMLHttpRequest)return;const e=this;XMLHttpRequest.prototype.open=function(t,n,s=!0,r,i){var o;const a=e.originalOpen.apply(this,[t,n,s,r,i]);return null===(o=this._devinspectorCancel)||void 0===o||o.call(this),this._devinspectorId=C(),this._devinspectorMethod=t,this._devinspectorUrl=n.toString(),this._devinspectorRequestHeaders={},a},XMLHttpRequest.prototype.setRequestHeader=function(t,n){return this._devinspectorRequestHeaders&&(this._devinspectorRequestHeaders[t]=n),e.originalSetRequestHeader.apply(this,[t,n])},XMLHttpRequest.prototype.send=function(t){var n,s;if(!e.installed||this._devinspectorCancel)return e.originalSend.apply(this,[t]);const r=this,i=this._devinspectorId,o=performance.now();this._devinspectorStartTime=o,this._devinspectorRequestBody=e.sanitizeBody(t);const a={id:i,method:this._devinspectorMethod,url:this._devinspectorUrl,headers:this._devinspectorRequestHeaders||{},body:this._devinspectorRequestBody,timestamp:Date.now(),type:"xhr"};null===(s=(n=e.handlers).onRequest)||void 0===s||s.call(n,a);const c=[],l=(e,t,n)=>{e.addEventListener(t,n),c.push([e,t,n])};let d=!1;const h=()=>{d=!0;for(const[e,t,n]of c)e.removeEventListener(t,n);c.length=0,r._devinspectorCancel===u&&(r._devinspectorCancel=void 0)},p=t=>{var n,s;null===(s=(n=e.handlers).onError)||void 0===s||s.call(n,{id:i,message:t,timestamp:Date.now()})},u=()=>{h(),p("Request aborted")},m=t=>{var n,s;t.lengthComputable&&(null===(s=(n=e.handlers).onProgress)||void 0===s||s.call(n,{id:i,loaded:t.loaded,total:t.total}))};e.handlers.onProgress&&(this.upload&&l(this.upload,"progress",m),l(this,"progress",m)),l(this,"load",()=>{var t,n;const s=performance.now()-o,a=e.parseResponseHeaders(r.getAllResponseHeaders()),c=e.extractResponseBody(r),l=e.calculateSize(c,a),d={id:i,status:r.status,statusText:r.statusText,headers:a,body:c,size:l,duration:s,timestamp:Date.now(),fromCache:s<5};null===(n=(t=e.handlers).onResponse)||void 0===n||n.call(t,d)}),l(this,"error",()=>p("Network request failed")),l(this,"timeout",()=>p(`Request timeout after ${r.timeout}ms`)),l(this,"abort",()=>p("Request aborted")),l(this,"loadend",h),this._devinspectorCancel=u;try{return e.originalSend.apply(this,[t])}catch(e){throw d||(h(),p(e instanceof Error?e.message:String(e))),e}},this.installed={open:XMLHttpRequest.prototype.open,send:XMLHttpRequest.prototype.send,setRequestHeader:XMLHttpRequest.prototype.setRequestHeader}}uninstall(){if(!this.installed)return;const e=XMLHttpRequest.prototype;a(e,"open",this.installed.open,this.originalOpen),a(e,"send",this.installed.send,this.originalSend),a(e,"setRequestHeader",this.installed.setRequestHeader,this.originalSetRequestHeader),this.installed=null}sanitizeBody(e){if(e){if("string"==typeof e)return e.length>1e4?e.substring(0,1e4)+"...":e;if(e instanceof FormData){const t={};return e.forEach((e,n)=>{e instanceof File?t[n]=`[File: ${e.name}, ${e.size} bytes]`:t[n]=e}),{type:"FormData",entries:t}}return e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e instanceof Blob?`[Blob: ${e.size} bytes, type: ${e.type}]`:e instanceof Document?"[Document]":e}}parseResponseHeaders(e){const t={};if(!e)return t;return e.trim().split(/[\r\n]+/).forEach(e=>{const n=e.split(": "),s=n.shift();s&&(t[s]=n.join(": "))}),t}extractResponseBody(e){try{const t=e.getResponseHeader("content-type")||"";if("json"===e.responseType&&e.response)return e.response;if("arraybuffer"===e.responseType&&e.response)return`[ArrayBuffer: ${e.response.byteLength} bytes]`;if("blob"===e.responseType&&e.response)return`[Blob: ${e.response.size} bytes, type: ${e.response.type}]`;if("document"===e.responseType)return"[Document]";if(e.responseText){if(t.includes("application/json"))try{return JSON.parse(e.responseText)}catch(t){return e.responseText}return e.responseText.length>1e4?e.responseText.substring(0,1e4)+"...":e.responseText}return null}catch(e){return"[Unable to read response]"}}calculateSize(e,t){const n=t["content-length"];if(n)return parseInt(n,10);if("string"==typeof e)return new Blob([e]).size;if(e&&"object"==typeof e)try{return new Blob([JSON.stringify(e)]).size}catch(e){return 0}return 0}}class D{constructor(e={}){this.connections=new Map,this.installed=null,this.originalWebSocket=window.WebSocket,this.handlers=e}install(){const e=this,t=this.originalWebSocket;if("function"!=typeof t||this.installed)return;const n=function(s,r){var i,o,a;const c=void 0===r?[s]:[s,r],l=Reflect.construct(t,c,null!==(i=new.target)&&void 0!==i?i:t);if(e.installed!==n)return l;const d=C();l._devinspectorId=d,l._devinspectorUrl=s.toString(),l._devinspectorProtocols=r;const h={id:d,url:s.toString(),protocols:r,timestamp:Date.now(),readyState:l.readyState,status:"connecting"};e.connections.set(d,h),null===(a=(o=e.handlers).onConnection)||void 0===a||a.call(o,h),l.addEventListener("open",function(){var t,n;const s=e.connections.get(d);s&&(s.status="open",s.readyState=this.readyState,null===(n=(t=e.handlers).onStatusChange)||void 0===n||n.call(t,{connectionId:d,status:"open"}))}),l.addEventListener("close",function(t){var n,s;const r=e.connections.get(d);r&&(r.status="closed",r.readyState=this.readyState,null===(s=(n=e.handlers).onStatusChange)||void 0===s||s.call(n,{connectionId:d,status:"closed"})),e.connections.delete(d)}),l.addEventListener("error",function(t){var n,s;const r={id:C(),connectionId:d,message:"WebSocket error occurred",timestamp:Date.now()};null===(s=(n=e.handlers).onError)||void 0===s||s.call(n,r)}),l.addEventListener("message",function(t){var n,s;const r={id:C(),connectionId:d,type:"received",data:e.parseMessageData(t.data),timestamp:Date.now(),size:e.calculateMessageSize(t.data)};null===(s=(n=e.handlers).onMessage)||void 0===s||s.call(n,r)});const p=l.send.bind(l);l.send=function(t){var n,s;const r={id:C(),connectionId:d,type:"sent",data:e.parseMessageData(t),timestamp:Date.now(),size:e.calculateMessageSize(t)};return null===(s=(n=e.handlers).onMessage)||void 0===s||s.call(n,r),p(t)};const u=l.close.bind(l);return l.close=function(t,n){var s,r;const i=e.connections.get(d);return i&&(i.status="closing",i.readyState=this.readyState,null===(r=(s=e.handlers).onStatusChange)||void 0===r||r.call(s,{connectionId:d,status:"closing"})),u(t,n)},l};Object.setPrototypeOf(n,t),n.prototype=t.prototype,this.installed=n,window.WebSocket=n}uninstall(){this.installed&&a(window,"WebSocket",this.installed,this.originalWebSocket),this.installed=null,this.connections.clear()}parseMessageData(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e.length>1e4?e.substring(0,1e4)+"...":e}return e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e instanceof Blob?`[Blob: ${e.size} bytes, type: ${e.type}]`:ArrayBuffer.isView(e)?`[ArrayBufferView: ${e.byteLength} bytes]`:e}calculateMessageSize(e){return"string"==typeof e?new Blob([e]).size:e instanceof ArrayBuffer?e.byteLength:e instanceof Blob?e.size:ArrayBuffer.isView(e)?e.byteLength:0}getActiveConnections(){return Array.from(this.connections.values())}getConnection(e){return this.connections.get(e)}}var T=Object.freeze({__proto__:null,NetworkMonitor:class{constructor(e){this.beaconInterceptor=null,this.beaconOriginal=null,this.entries=new Map,this.isActive=!1,this.inspector=e,this.fetchInterceptor=new I({onRequest:this.handleRequest.bind(this,"fetch"),onResponse:this.handleResponse.bind(this),onError:this.handleError.bind(this)}),this.xhrInterceptor=new P({onRequest:this.handleRequest.bind(this,"xhr"),onResponse:this.handleResponse.bind(this),onError:this.handleError.bind(this),onProgress:this.handleProgress.bind(this)}),this.websocketMonitor=new D({onConnection:this.handleWebSocketConnection.bind(this),onMessage:this.handleWebSocketMessage.bind(this),onStatusChange:this.handleWebSocketStatusChange.bind(this),onError:this.handleWebSocketError.bind(this)})}start(){this.isActive||(this.fetchInterceptor.install(),this.xhrInterceptor.install(),this.websocketMonitor.install(),this.installBeaconInterceptor(),this.isActive=!0)}stop(){this.isActive&&(this.fetchInterceptor.uninstall(),this.xhrInterceptor.uninstall(),this.websocketMonitor.uninstall(),this.uninstallBeaconInterceptor(),this.isActive=!1)}handleRequest(e,t){const n={id:t.id,type:e,request:t,timestamp:t.timestamp};this.track(t.id,n);this.inspector.getStorage("network").push(n),this.inspector.getEvents().emit("network:request",{...t,type:e})}handleResponse(e){var t,n,s,r;const i=this.entries.get(e.id);i&&(i.response=e,i.duration=e.duration,i.status=e.status,i.size=e.size,this.inspector.getEvents().emit("network:response",e),e.duration>3e3&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"slow-network",message:`Slow network request: ${null===(s=i.request)||void 0===s?void 0:s.url}`,duration:e.duration,url:null===(r=i.request)||void 0===r?void 0:r.url})))}handleError(e){const t=this.entries.get(e.id);t&&(t.error=e,this.inspector.getEvents().emit("network:error",e))}handleProgress(e){this.inspector.getEvents().emit("network:progress",e)}handleWebSocketConnection(e){const t={id:e.id,type:"websocket",websocket:{connection:e,messages:[],errors:[]},timestamp:e.timestamp};this.track(e.id,t);this.inspector.getStorage("network").push(t),this.inspector.getEvents().emit("network:websocket:connection",e)}handleWebSocketMessage(e){const t=this.entries.get(e.connectionId);t&&t.websocket&&(t.websocket.messages.push(e),t.websocket.messages.length>500&&t.websocket.messages.shift(),this.inspector.getEvents().emit("network:websocket:message",e))}handleWebSocketStatusChange(e){var t;const n=this.entries.get(e.connectionId);n&&(null===(t=n.websocket)||void 0===t?void 0:t.connection)&&(n.websocket.connection.status=e.status,this.inspector.getEvents().emit("network:websocket:status",e))}handleWebSocketError(e){const t=this.entries.get(e.connectionId);t&&t.websocket&&(t.websocket.errors.push(e),t.websocket.errors.length>500&&t.websocket.errors.shift(),this.inspector.getEvents().emit("network:websocket:error",e))}track(e,t){this.entries.set(e,t);const n=Math.max(1,this.inspector.getConfig().maxNetworkEntries);for(;this.entries.size>n;){const e=this.entries.keys().next().value;this.entries.delete(e)}}installBeaconInterceptor(){if("undefined"==typeof navigator||"function"!=typeof navigator.sendBeacon)return;const e=navigator.sendBeacon.bind(navigator),t=this,n=function(n,s){const r=t.generateId(),i={id:r,method:"POST",url:n,headers:{},body:t.sanitizeBeaconData(s),timestamp:Date.now(),type:"beacon"};t.handleRequest("beacon",i);const o=e(n,s);return setTimeout(()=>{const e={id:r,status:o?204:0,statusText:o?"No Content":"Failed",headers:{},size:0,duration:0,timestamp:Date.now()};t.handleResponse(e)},0),o};this.beaconOriginal=navigator.sendBeacon,this.beaconInterceptor=n,navigator.sendBeacon=n}uninstallBeaconInterceptor(){this.beaconInterceptor&&navigator.sendBeacon===this.beaconInterceptor&&(navigator.sendBeacon=this.beaconOriginal),this.beaconInterceptor=null,this.beaconOriginal=null}sanitizeBeaconData(e){if(e){if("string"==typeof e)return e.length>1e3?e.substring(0,1e3)+"...":e;if(e instanceof FormData){const t={};return e.forEach((e,n)=>{t[n]=e instanceof File?`[File: ${e.name}]`:e}),{type:"FormData",entries:t}}return e instanceof Blob?`[Blob: ${e.size} bytes]`:e instanceof ArrayBuffer?`[ArrayBuffer: ${e.byteLength} bytes]`:e}}generateId(){return`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}getEntries(){return Array.from(this.entries.values())}clearEntries(){this.entries.clear()}getEntry(e){return this.entries.get(e)}filterEntries(e){return Array.from(this.entries.values()).filter(e)}}});class A{constructor(e={},t=!0){this.originalMethods=new Map,this.groupLevel=0,this.counters=new Map,this.timers=new Map,this.wrappers=new Map,this.handling=!1,this.handlers=e,this.captureStackTraces=t}install(){this.originalMethods.size>0||["log","info","warn","error","debug","trace","table","group","groupCollapsed","groupEnd","clear","count","countReset","time","timeEnd","timeLog","assert","dir","dirxml","profile","profileEnd"].forEach(e=>{"function"==typeof console[e]&&(this.originalMethods.set(e,console[e]),this.interceptMethod(e))})}uninstall(){this.originalMethods.forEach((e,t)=>{a(console,t,this.wrappers.get(t),e)}),this.originalMethods.clear(),this.wrappers.clear(),this.counters.clear(),this.timers.clear(),this.groupLevel=0}interceptMethod(e){const t=this,n=this.originalMethods.get(e),s=function(...s){const r=n.apply(console,s);if(t.handling||!t.wrappers.has(e))return r;t.handling=!0;try{t.capture(e,s)}finally{t.handling=!1}return r};this.wrappers.set(e,s),console[e]=s}capture(e,t){var n,s,r,i;switch(e){case"clear":return void(null===(s=(n=this.handlers).onClear)||void 0===s||s.call(n));case"group":case"groupCollapsed":this.groupLevel++;break;case"groupEnd":this.groupLevel=Math.max(0,this.groupLevel-1);break;case"count":return void this.handleCount(t[0]);case"countReset":return void this.counters.delete(t[0]||"default");case"time":return void this.timers.set(t[0]||"default",performance.now());case"timeEnd":return void this.handleTimeEnd(t[0],"timeEnd");case"timeLog":this.handleTimeEnd(t[0],"timeLog");break;case"assert":if(t[0])return;t=t.slice(1)}const o={id:C(),level:e,args:t,formattedArgs:this.formatArgs(t),timestamp:Date.now(),groupLevel:this.groupLevel};if(this.captureStackTraces&&("error"===e||"warn"===e||"trace"===e)){const e=((a||new Error).stack||"").split("\n").slice(1).map(e=>e.trim()).filter(e=>e.startsWith("at ")).slice(3);o.stack=e,o.source=this.extractSourceFromStack(e[0])}var a;null===(i=(r=this.handlers).onLog)||void 0===i||i.call(r,o)}handleCount(e){var t,n;const s=e||"default",r=(this.counters.get(s)||0)+1;this.counters.set(s,r);const i={id:C(),level:"log",args:[`${s}: ${r}`],formattedArgs:[`${s}: ${r}`],timestamp:Date.now(),groupLevel:this.groupLevel};null===(n=(t=this.handlers).onLog)||void 0===n||n.call(t,i)}handleTimeEnd(e,t){var n,s,r,i;const o=e||"default",a=this.timers.get(o);if(void 0===a){const e={id:C(),level:"warn",args:[`Timer '${o}' does not exist`],formattedArgs:[`Timer '${o}' does not exist`],timestamp:Date.now(),groupLevel:this.groupLevel};return void(null===(s=(n=this.handlers).onLog)||void 0===s||s.call(n,e))}const c=performance.now()-a;"timeEnd"===t&&this.timers.delete(o);const l={id:C(),level:"log",args:[`${o}: ${c.toFixed(3)}ms`],formattedArgs:[`${o}: ${c.toFixed(3)}ms`],timestamp:Date.now(),groupLevel:this.groupLevel};null===(i=(r=this.handlers).onLog)||void 0===i||i.call(r,l)}formatArgs(e){return e.map(e=>this.formatValue(e))}formatValue(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t||"number"===t||"boolean"===t)return e;if(e instanceof Error)return{type:"error",name:e.name,message:e.message,stack:e.stack};if(e instanceof Date)return{type:"date",value:e.toISOString()};if(e instanceof RegExp)return{type:"regexp",value:e.toString()};if("function"==typeof e)return{type:"function",name:e.name||"<anonymous>",value:e.toString().substring(0,100)};if(Array.isArray(e))return{type:"array",length:e.length,value:e.slice(0,100).map(e=>this.formatValue(e))};if("object"===t)try{const t=function(e,t){const n=new WeakSet;return JSON.stringify(e,(e,t)=>{if("object"==typeof t&&null!==t){if(n.has(t))return"[Circular]";n.add(t)}return"function"==typeof t?t.toString():t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t},t)}(e,2);return{type:"object",value:JSON.parse(t)}}catch(e){return{type:"object",value:"[Complex Object]"}}return String(e)}extractSourceFromStack(e){if(!e)return;const t=e.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);if(!t)return;const[,,n,s,r]=t;return{file:n.replace(/^.*\//,""),line:parseInt(s,10),column:parseInt(r,10)}}}class R{formatArgs(e){return e.map(e=>this.formatValue(e))}formatArgsAsText(e){return e.map(e=>this.formatValueAsText(e)).join(" ")}formatValue(e){var t;if(null===e)return"null";if(void 0===e)return"undefined";const n=typeof e;if("string"===n||"number"===n||"boolean"===n)return e;if(e instanceof Error)return{type:"error",name:e.name,message:e.message,stack:e.stack};if(e instanceof Date)return{type:"date",value:e.toISOString()};if(e instanceof RegExp)return{type:"regexp",value:e.toString()};if(e instanceof Set)return{type:"set",size:e.size,values:Array.from(e).slice(0,100)};if(e instanceof Map)return{type:"map",size:e.size,entries:Array.from(e.entries()).slice(0,100)};if(e instanceof WeakSet||e instanceof WeakMap)return{type:e instanceof WeakSet?"weakset":"weakmap",value:"[WeakCollection]"};if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return{type:"arraybuffer",byteLength:e.byteLength};if("function"==typeof e)return{type:"function",name:e.name||"<anonymous>",value:e.toString().substring(0,100)};if(Array.isArray(e))return{type:"array",length:e.length,value:e.slice(0,100).map(e=>this.formatValue(e))};if("object"===n){if(e.type&&void 0!==e.value)return e;try{const n=Object.getPrototypeOf(e),s=(null===(t=null==n?void 0:n.constructor)||void 0===t?void 0:t.name)||"Object",r=Object.entries(e).slice(0,100),i={type:"object",constructor:s,value:{}};for(const[e,t]of r)i.value[e]=this.formatValue(t);return Object.keys(e).length>100&&(i.truncated=!0,i.totalKeys=Object.keys(e).length),i}catch(e){return{type:"object",value:"[Complex Object]"}}}return String(e)}formatValueAsText(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t)return`"${e}"`;if("number"===t||"boolean"===t)return String(e);if(e.type)switch(e.type){case"error":return`${e.name}: ${e.message}`;case"date":case"regexp":return e.value;case"function":return`[Function: ${e.name}]`;case"array":return`Array(${e.length})`;case"object":return e.constructor?`${e.constructor} {...}`:"Object {...}";case"set":return`Set(${e.size})`;case"map":return`Map(${e.size})`;default:return JSON.stringify(e.value)}return JSON.stringify(e)}formatStackTrace(e){return e.map((e,t)=>{const n=e.replace(/^\s*at\s+/,"");return" ".repeat(t)+n}).join("\n")}highlightSyntax(e,t="javascript"){let n=e;return n=n.replace(/(["'`])(?:(?=(\\?))\2.)*?\1/g,'<span class="string">$&</span>'),n=n.replace(/\b(\d+)\b/g,'<span class="number">$1</span>'),["const","let","var","function","class","if","else","for","while","return","new","this","typeof","instanceof","try","catch","finally","throw","async","await","import","export","default"].forEach(e=>{const t=new RegExp(`\\b${e}\\b`,"g");n=n.replace(t,`<span class="keyword">${e}</span>`)}),n=n.replace(/(\/\/.*$)/gm,'<span class="comment">$1</span>'),n=n.replace(/(\/\*[\s\S]*?\*\/)/g,'<span class="comment">$1</span>'),n}}var j=Object.freeze({__proto__:null,ConsoleMonitor:class{constructor(e){this.isActive=!1,this.commandHistory=[],this.historyIndex=-1,this.inspector=e,this.formatter=new R,this.interceptor=new A({onLog:this.handleLog.bind(this),onClear:this.handleClear.bind(this)},e.getConfig().captureStackTraces)}start(){this.isActive||(this.interceptor.install(),this.setupCommandExecution(),this.isActive=!0)}stop(){this.isActive&&(this.interceptor.uninstall(),this.isActive=!1)}handleLog(e){this.inspector.getStorage("console").push(e),this.inspector.getEvents().emit("console:log",e),"error"===e.level&&this.inspector.getEvents().emit("error:caught",{message:this.formatter.formatArgs(e.args),stack:e.stack,timestamp:e.timestamp,source:"console"})}handleClear(){this.inspector.getStorage("console").clear(),this.inspector.getEvents().emit("console:clear")}setupCommandExecution(){this.inspector.on("console:execute",e=>{this.executeCommand(e)})}async executeCommand(e){var t;this.commandHistory.push(e),this.historyIndex=this.commandHistory.length;const n={id:`cmd-${Date.now()}`,level:"log",args:[`> ${e}`],formattedArgs:[`> ${e}`],timestamp:Date.now(),groupLevel:0};this.handleLog(n);try{const t=new(0,Object.getPrototypeOf(async function(){}).constructor)("return ("+e+")"),n=await t.call(window);if(void 0!==n){const e={id:`result-${Date.now()}`,level:"log",args:[n],formattedArgs:this.formatter.formatArgs([n]),timestamp:Date.now(),groupLevel:0};this.handleLog(e)}}catch(e){const n={id:`error-${Date.now()}`,level:"error",args:[e],formattedArgs:this.formatter.formatArgs([e]),timestamp:Date.now(),groupLevel:0,stack:null===(t=e.stack)||void 0===t?void 0:t.split("\n")};this.handleLog(n)}}getHistory(){return[...this.commandHistory]}navigateHistory(e){if(0!==this.commandHistory.length)return this.historyIndex="up"===e?Math.max(0,this.historyIndex-1):Math.min(this.commandHistory.length,this.historyIndex+1),this.commandHistory[this.historyIndex]}filterLogs(e){return this.inspector.getStorage("console").getAll().filter(t=>{var n;if(e.levels&&e.levels.length>0&&!e.levels.includes(t.level))return!1;if(e.search){const n=e.search.toLowerCase();if(!JSON.stringify(t.formattedArgs).toLowerCase().includes(n))return!1}return!(e.source&&(null===(n=t.source)||void 0===n?void 0:n.file)&&!t.source.file.includes(e.source))})}exportLogs(e="json"){const t=this.inspector.getStorage("console").getAll();return"json"===e?JSON.stringify(t,null,2):t.map(e=>`[${new Date(e.timestamp).toISOString()}] ${e.level.toUpperCase().padEnd(5)} ${this.formatter.formatArgsAsText(e.formattedArgs)}${e.source?` [${e.source.file}:${e.source.line}]`:""}`).join("\n")}}});class N{constructor(e,t=1e3){this.isRunning=!1,this.lastTime=0,this.frameCount=0,this.fps=0,this.frameTimeSum=0,this.droppedFrames=0,this.animationId=null,this.lastUpdateTime=0,this.tick=()=>{if(!this.isRunning)return;const e=performance.now(),t=e-this.lastTime;this.frameTimeSum+=t,this.frameCount++,t>16.67&&this.droppedFrames++;const n=e-this.lastUpdateTime;if(n>=this.updateInterval){this.fps=1e3*this.frameCount/n;const t=this.frameTimeSum/this.frameCount;this.callback({fps:Math.round(this.fps),timestamp:Date.now(),frameTime:t,droppedFrames:this.droppedFrames}),this.frameCount=0,this.frameTimeSum=0,this.droppedFrames=0,this.lastUpdateTime=e}this.lastTime=e,this.animationId=requestAnimationFrame(this.tick)},this.callback=e,this.updateInterval=t}start(){this.isRunning||(this.isRunning=!0,this.lastTime=performance.now(),this.lastUpdateTime=this.lastTime,this.frameCount=0,this.frameTimeSum=0,this.droppedFrames=0,this.tick())}stop(){this.isRunning&&(this.isRunning=!1,null!==this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null))}getCurrentFPS(){return Math.round(this.fps)}}class q{constructor(e,t=1e3){this.intervalId=null,this.callback=e,this.updateInterval=t,this.isSupported=this.checkSupport()}checkSupport(){return"memory"in performance&&void 0!==performance.memory}start(){this.isSupported?null===this.intervalId&&(this.measure(),this.intervalId=window.setInterval(()=>{this.measure()},this.updateInterval)):console.warn("Performance.memory is not supported in this browser")}stop(){null!==this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}measure(){if(!performance.memory)return;const{usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n}=performance.memory,s=e/n*100,r={usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n,timestamp:Date.now(),percentUsed:s};this.callback(r)}getCurrentMemory(){if(!this.isSupported||!performance.memory)return null;const{usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n}=performance.memory;return{usedJSHeapSize:e,totalJSHeapSize:t,jsHeapSizeLimit:n,timestamp:Date.now(),percentUsed:e/n*100}}isMemorySupported(){return this.isSupported}}class F{constructor(e){this.metrics={},this.observer=null,this.fidObserver=null,this.clsValue=0,this.clsEntries=[],this.sessionValue=0,this.sessionEntries=[],this.callback=e}start(){this.observePaintMetrics(),this.observeLCP(),this.observeFID(),this.observeCLS(),this.observeINP(),this.measureNavigationTiming()}stop(){var e,t;null===(e=this.observer)||void 0===e||e.disconnect(),null===(t=this.fidObserver)||void 0===t||t.disconnect(),this.observer=null,this.fidObserver=null}observePaintMetrics(){try{new PerformanceObserver(e=>{for(const t of e.getEntries())"first-contentful-paint"===t.name&&(this.metrics.FCP=Math.round(t.startTime),this.reportMetrics())}).observe({entryTypes:["paint"]})}catch(e){console.warn("Paint metrics not supported")}}observeLCP(){try{new PerformanceObserver(e=>{const t=e.getEntries(),n=t[t.length-1];this.metrics.LCP=Math.round(n.startTime),this.reportMetrics()}).observe({entryTypes:["largest-contentful-paint"]})}catch(e){console.warn("LCP not supported")}}observeFID(){try{this.fidObserver=new PerformanceObserver(e=>{var t;for(const n of e.getEntries())if("first-input"===n.name){const e=n;this.metrics.FID=Math.round(e.processingStart-e.startTime),this.reportMetrics(),null===(t=this.fidObserver)||void 0===t||t.disconnect()}}),this.fidObserver.observe({entryTypes:["first-input"]})}catch(e){console.warn("FID not supported")}}observeCLS(){try{new PerformanceObserver(e=>{for(const t of e.getEntries()){const e=t;e.hadRecentInput||(this.clsValue+=e.value,this.clsEntries.push(t))}this.metrics.CLS=Math.round(1e3*this.clsValue)/1e3,this.reportMetrics()}).observe({entryTypes:["layout-shift"]})}catch(e){console.warn("CLS not supported")}}observeINP(){try{let e=0;new PerformanceObserver(t=>{for(const n of t.getEntries())if("event"===n.entryType){const t=n.duration;t>e&&(e=t,this.metrics.INP=Math.round(e),this.reportMetrics())}}).observe({entryTypes:["event"]})}catch(e){console.warn("INP not supported")}}measureNavigationTiming(){if(!performance.timing)return;const e=performance.timing,t=e.navigationStart;this.metrics.TTFB=Math.round(e.responseStart-t),e.domainLookupEnd,e.domainLookupStart,e.connectEnd,e.connectStart,e.responseStart,e.requestStart,e.responseEnd,e.responseStart,e.domComplete,e.domLoading,e.domContentLoadedEventEnd,e.loadEventEnd,e.loadEventEnd,this.reportMetrics()}reportMetrics(){this.callback({...this.metrics})}getMetrics(){return{...this.metrics}}markStart(e){performance.mark(`${e}-start`)}markEnd(e){performance.mark(`${e}-end`);try{performance.measure(e,`${e}-start`,`${e}-end`);const t=performance.getEntriesByName(e,"measure");if(t.length>0){return t[t.length-1].duration}}catch(t){console.warn(`Failed to measure ${e}`)}}clearMarks(e){e?(performance.clearMarks(`${e}-start`),performance.clearMarks(`${e}-end`),performance.clearMeasures(e)):(performance.clearMarks(),performance.clearMeasures())}}class O{constructor(e,t=50){this.observer=null,this.idCounter=0,this.fallbackRunning=!1,this.callback=e,this.threshold=t}start(){if(!this.observer)try{this.observer=new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration>=this.threshold&&this.handleLongTask(t)}),this.observer.observe({entryTypes:["longtask"]})}catch(e){console.warn("Long Task API not supported"),this.fallbackDetection()}}stop(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.observer=null,this.fallbackRunning=!1}handleLongTask(e){const t=e,n={id:"longtask-"+ ++this.idCounter,duration:Math.round(e.duration),startTime:Math.round(e.startTime),timestamp:Date.now(),attribution:t.attribution?t.attribution.map(e=>({name:e.name,containerType:e.containerType,containerSrc:e.containerSrc,containerId:e.containerId,containerName:e.containerName})):[]};this.callback(n)}fallbackDetection(){this.fallbackRunning=!0;let e=performance.now();const t=()=>{const n=performance.now(),s=n-e;if(s>this.threshold){const t={id:"longtask-fallback-"+ ++this.idCounter,duration:Math.round(s),startTime:Math.round(e),timestamp:Date.now(),attribution:[{name:"unknown",containerType:"window"}]};this.callback(t)}e=n,this.fallbackRunning&&requestAnimationFrame(t)};requestAnimationFrame(t)}}var H=Object.freeze({__proto__:null,PerformanceMonitor:class{constructor(e){this.isActive=!1,this.performanceData={timestamp:Date.now()},this.inspector=e,this.fpsMonitor=new N(this.handleFPSData.bind(this)),this.memoryMonitor=new q(this.handleMemoryData.bind(this)),this.metricsCollector=new F(this.handleMetrics.bind(this)),this.longTaskDetector=new O(this.handleLongTask.bind(this)),this.emitPerformanceData=function(e,t,n={}){let s,r,i=null,o=0,a=null;const{leading:c=!0,trailing:l=!0}=n,d=()=>{const t=a,n=s;return a=s=null,r=e.apply(n,t),r};return function(...e){const n=Date.now(),h=t-(n-o);return s=this,a=e,h<=0||h>t?(i&&(clearTimeout(i),i=null),o=n,c&&(r=d())):!i&&l&&(i=setTimeout(()=>{o=Date.now(),i=null,l&&a&&d()},h)),r}}(this.emitPerformanceData.bind(this),100)}start(){this.isActive||(this.fpsMonitor.start(),this.memoryMonitor.start(),this.metricsCollector.start(),this.longTaskDetector.start(),this.setupPerformanceObservers(),this.monitorResourceTiming(),this.isActive=!0)}stop(){this.isActive&&(this.fpsMonitor.stop(),this.memoryMonitor.stop(),this.metricsCollector.stop(),this.longTaskDetector.stop(),this.isActive=!1)}handleFPSData(e){var t,n;this.performanceData.fps=e;this.inspector.getStorage("performance").set("fps",e),e.fps<30&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"low-fps",message:`Low FPS detected: ${e.fps}`,fps:e.fps,droppedFrames:e.droppedFrames})),this.emitPerformanceData()}handleMemoryData(e){var t,n;this.performanceData.memory=e;this.inspector.getStorage("performance").set("memory",e),e.percentUsed>90&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"high-memory",message:`High memory usage: ${e.percentUsed.toFixed(1)}%`,percentUsed:e.percentUsed,usedBytes:e.usedJSHeapSize})),this.emitPerformanceData()}handleMetrics(e){var t,n,s,r,i,o;this.performanceData.metrics=e;this.inspector.getStorage("performance").set("metrics",e),e.LCP&&e.LCP>2500&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"poor-lcp",message:`Poor LCP: ${e.LCP}ms`,value:e.LCP})),e.FID&&e.FID>100&&(null===(r=(s=this.inspector.getConfig()).onPerformanceIssue)||void 0===r||r.call(s,{type:"poor-fid",message:`Poor FID: ${e.FID}ms`,value:e.FID})),e.CLS&&e.CLS>.1&&(null===(o=(i=this.inspector.getConfig()).onPerformanceIssue)||void 0===o||o.call(i,{type:"poor-cls",message:`Poor CLS: ${e.CLS}`,value:e.CLS})),this.inspector.getEvents().emit("performance:metrics",e)}handleLongTask(e){var t,n;const s=this.inspector.getStorage("performance"),r=s.get("longTasks")||[];r.push(e),r.length>100&&r.shift(),s.set("longTasks",r),this.inspector.getEvents().emit("performance:longtask",e),e.duration>200&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"long-task",message:`Long task detected: ${e.duration}ms`,duration:e.duration,attribution:e.attribution}))}emitPerformanceData(){this.performanceData.timestamp=Date.now(),this.inspector.getEvents().emit("performance:data",this.performanceData)}setupPerformanceObservers(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())this.inspector.getEvents().emit("performance:navigation",{name:t.name,duration:t.duration,startTime:t.startTime,timestamp:Date.now()})}).observe({entryTypes:["navigation"]})}catch(e){console.warn("Navigation timing observation not supported")}}monitorResourceTiming(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{var t,n;for(const s of e.getEntries()){const e=s;e.duration>1e3&&(null===(n=(t=this.inspector.getConfig()).onPerformanceIssue)||void 0===n||n.call(t,{type:"slow-resource",message:`Slow resource: ${e.name}`,duration:e.duration,url:e.name}))}}).observe({entryTypes:["resource"]})}catch(e){console.warn("Resource timing observation not supported")}}markStart(e){this.metricsCollector.markStart(e)}markEnd(e){const t=this.metricsCollector.markEnd(e);void 0!==t&&this.inspector.getEvents().emit("performance:mark",{name:e,duration:t,timestamp:Date.now()})}getSnapshot(){return{fps:this.performanceData.fps,memory:this.memoryMonitor.getCurrentMemory()||void 0,metrics:this.metricsCollector.getMetrics(),longTasks:this.inspector.getStorage("performance").get("longTasks")||[],timestamp:Date.now()}}}});function B(e,t){const n=globalThis[t];return"function"!=typeof n||e instanceof n}class U{constructor(e){this.groups=new Map,this.seenErrors=new WeakSet,this.ignorePatterns=[],this.callback=e,this.setupDefaultIgnorePatterns()}setupDefaultIgnorePatterns(){this.ignorePatterns=[/ResizeObserver loop limit exceeded/,/ResizeObserver loop completed with undelivered notifications/,/Non-Error promise rejection captured/,/Network request failed/,/Failed to fetch/,/Load failed/,/Script error/]}addIgnorePattern(e){this.ignorePatterns.push(e)}trackError(e,t="error"){if(e instanceof Error&&this.seenErrors.has(e))return;const n=this.createErrorInfo(e,t);if(this.shouldIgnoreError(n))return;e instanceof Error&&this.seenErrors.add(e);const s=this.groupError(n);n.groupId=s.id,this.callback(n)}createErrorInfo(e,t){let n,s,r,i,o="",a=[];if(e instanceof Error)o=e.message||e.toString(),a=e.stack?e.stack.split("\n").map(e=>e.trim()):[],i={name:e.name,message:e.message,stack:e.stack};else if("message"in e&&B(e,"ErrorEvent"))o=e.message,n=e.filename,s=e.lineno,r=e.colno,e.error&&(a=e.error.stack?e.error.stack.split("\n").map(e=>e.trim()):[],i=e.error);else if("reason"in e&&B(e,"PromiseRejectionEvent")){const t=e.reason;t instanceof Error?(o=t.message||t.toString(),a=t.stack?t.stack.split("\n").map(e=>e.trim()):[],i=t):(o=String(t),i=t)}const c=a.map(e=>function(e){const t=e.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);if(!t)return null;const[,n,s,r,i]=t;return{functionName:n||"<anonymous>",fileName:s||"<unknown>",lineNumber:parseInt(r||"0",10),columnNumber:parseInt(i||"0",10)}}(e)).filter(e=>null!==e);return{id:C(),type:t,message:o,stack:a,stackFrames:c,source:n,lineno:s,colno:r,timestamp:Date.now(),userAgent:navigator.userAgent,url:window.location.href,errorObject:i,count:1}}shouldIgnoreError(e){var t;for(const t of this.ignorePatterns)if(t.test(e.message))return!0;return"Script error."===e.message&&!(null===(t=e.stack)||void 0===t?void 0:t.length)||!(!e.source||!(e.source.includes("extension://")||e.source.includes("chrome-extension://")||e.source.includes("moz-extension://")))}groupError(e){const t=this.generateFingerprint(e);let n=this.groups.get(t);return n||(n={id:C(),fingerprint:t,message:e.message,count:0,firstSeen:e.timestamp,lastSeen:e.timestamp,errors:[]},this.groups.set(t,n)),n.count++,n.lastSeen=e.timestamp,n.errors.push(e),n.errors.length>10&&n.errors.shift(),n}generateFingerprint(e){const t=[e.type,this.normalizeMessage(e.message)];if(e.stackFrames&&e.stackFrames.length>0){const n=e.stackFrames[0];n.fileName&&(t.push(n.fileName),n.functionName&&t.push(n.functionName))}else e.source&&t.push(e.source);return t.join("|")}normalizeMessage(e){return e.replace(/https?:\/\/[^\s]+/g,"<URL>").replace(/\b\d+\b/g,"<NUM>").replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,"<UUID>").replace(/"[^"]*"/g,'"<STRING>"').replace(/'[^']*'/g,"'<STRING>'").replace(/\s+/g," ").trim()}getGroups(){return Array.from(this.groups.values()).sort((e,t)=>t.lastSeen-e.lastSeen)}getGroup(e){for(const t of this.groups.values())if(t.id===e)return t}clearGroups(){this.groups.clear()}getErrorStats(){let e=0;const t={},n=[];for(const s of this.groups.values()){e+=s.count;for(const e of s.errors)t[e.type]=(t[e.type]||0)+1,n.push(e)}return n.sort((e,t)=>t.timestamp-e.timestamp),{totalErrors:e,totalGroups:this.groups.size,errorsByType:t,recentErrors:n.slice(0,10)}}}class _{constructor(){this.cache={},this.enabled=!0,this.sourceMapUrlRegex=/\/\/# sourceMappingURL=(.+)$/,this.checkSupport()}checkSupport(){return this.enabled="undefined"!=typeof fetch&&"URL"in window,this.enabled}async enhanceStackTrace(e){if(!this.enabled)return e;const t=[];for(const n of e){const e=await this.enhanceStackFrame(n);t.push(e)}return t}async enhanceStackFrame(e){const t=e.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);if(!t)return e;const[,n,s,r,i]=t,o=parseInt(r,10),a=parseInt(i,10);try{const t=await this.findSourceMapUrl(s);if(!t)return e;const r=await this.loadSourceMap(s,t);if(!r)return e;const i=this.getOriginalPosition(r,o,a);if(i){return`at ${n?`${n} `:""}(${i.source}:${i.line}:${i.column})`}}catch(e){console.debug("Failed to enhance stack frame:",e)}return e}async findSourceMapUrl(e){if(this.cache[e])return this.cache[e].sourceMapUrl;try{if(e.startsWith("data:")||e.includes("blob:"))return null;const t=await fetch(e,{method:"GET",mode:"cors",credentials:"omit"});if(!t.ok)return null;const n=await t.text(),s=n.split("\n").slice(-5).join("\n").match(this.sourceMapUrlRegex);if(!s)return null;const r=s[1];if(r.startsWith("data:"))return r;return new URL(r,e).href}catch(e){return null}}async loadSourceMap(e,t){var n;if(null===(n=this.cache[e])||void 0===n?void 0:n.sourceMap)return this.cache[e].sourceMap;try{let n;if(t.startsWith("data:")){const e=t.split(",")[1];n=atob(e)}else{const e=await fetch(t,{method:"GET",mode:"cors",credentials:"omit"});if(!e.ok)return null;n=await e.text()}const s=JSON.parse(n);return this.cache[e]={sourceMapUrl:t,sourceMap:s},s}catch(e){return null}}getOriginalPosition(e,t,n){var s;return e.mappings&&e.sources?{source:e.sources[0]||"unknown",line:t,column:n,name:null===(s=e.names)||void 0===s?void 0:s[0]}:null}clearCache(){this.cache={}}setEnabled(e){this.enabled=e&&this.checkSupport()}isEnabled(){return this.enabled}}var W=Object.freeze({__proto__:null,ErrorMonitor:class{constructor(e){this.isActive=!1,this.trackingUncaught=!1,this.handleErrorEvent=e=>{this.trackUncaught(()=>this.errorTracker.trackError(e,"error"))},this.handleRejectionEvent=e=>{this.trackUncaught(()=>this.errorTracker.trackError(e,"unhandledRejection"))},this.inspector=e,this.errorTracker=new U(this.handleError.bind(this)),this.sourceMapSupport=new _}start(){this.isActive||(this.installErrorHandlers(),this.isActive=!0)}stop(){this.isActive&&(this.uninstallErrorHandlers(),this.isActive=!1)}installErrorHandlers(){window.addEventListener("error",this.handleErrorEvent),window.addEventListener("unhandledrejection",this.handleRejectionEvent)}uninstallErrorHandlers(){window.removeEventListener("error",this.handleErrorEvent),window.removeEventListener("unhandledrejection",this.handleRejectionEvent)}trackUncaught(e){this.trackingUncaught=!0;try{e()}finally{this.trackingUncaught=!1}}async handleError(e){var t,n;const s=this.trackingUncaught;if(e.stack&&this.sourceMapSupport.isEnabled())try{e.stack=await this.sourceMapSupport.enhanceStackTrace(e.stack)}catch(e){console.debug("Failed to enhance stack trace:",e)}this.inspector.getStorage("error").push(e),this.inspector.getEvents().emit(s?"error:uncaught":"error:caught",e),null===(n=(t=this.inspector.getConfig()).onError)||void 0===n||n.call(t,new Error(e.message))}trackError(e){this.errorTracker.trackError(e)}getErrorGroups(){return this.errorTracker.getGroups()}getErrorStats(){return this.errorTracker.getErrorStats()}clearErrors(){this.errorTracker.clearGroups();this.inspector.getStorage("error").clear()}addIgnorePattern(e){this.errorTracker.addIgnorePattern(e)}enableSourceMaps(e){this.sourceMapSupport.setEnabled(e)}}});var V=Object.freeze({__proto__:null,StateMonitor:class{constructor(e){this.isActive=!1,this.inspector=e}start(){this.isActive||(this.isActive=!0)}stop(){this.isActive&&(this.isActive=!1)}}});var J=Object.freeze({__proto__:null,DOMMonitor:class{constructor(e){this.isActive=!1,this.inspector=e}start(){this.isActive||(this.isActive=!0)}stop(){this.isActive&&(this.isActive=!1)}}});var X=Object.freeze({__proto__:null,StorageMonitor:class{constructor(e){this.isActive=!1,this.inspector=e}start(){this.isActive||(this.isActive=!0)}stop(){this.isActive&&(this.isActive=!1)}}});class G{constructor(e){this.isDragging=!1,this.dragOffset={x:0,y:0},this.errorCount=0,this.eventUnsubscribers=[],this.inspector=e,this.element=this.createElement(),this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this),this.setupEventListeners(),this.updatePosition()}createElement(){const e=document.createElement("div");return e.className="devinspector-floating-widget",e.innerHTML="🔍",e.title="DevInspector - Click to toggle, drag to move",e}setupEventListeners(){this.element.addEventListener("click",e=>{this.isDragging||this.inspector.toggle()}),this.element.addEventListener("mousedown",this.handleMouseDown.bind(this)),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp);const e=this.inspector.on("error:caught",()=>{this.errorCount++,this.updateAppearance()});this.eventUnsubscribers.push(e);const t=this.inspector.on("error:uncaught",()=>{this.errorCount++,this.updateAppearance()});this.eventUnsubscribers.push(t);const n=this.inspector.on("inspector:show",()=>{this.errorCount=0,this.updateAppearance()});this.eventUnsubscribers.push(n)}handleMouseDown(e){e.preventDefault(),this.isDragging=!0;const t=this.element.getBoundingClientRect();this.dragOffset={x:e.clientX-t.left,y:e.clientY-t.top},this.element.style.cursor="grabbing",this.element.style.zIndex="1000000"}handleMouseMove(e){if(!this.isDragging)return;e.preventDefault();const t=e.clientX-this.dragOffset.x,n=e.clientY-this.dragOffset.y,s=window.innerWidth-this.element.offsetWidth,r=window.innerHeight-this.element.offsetHeight,i=Math.max(0,Math.min(t,s)),o=Math.max(0,Math.min(n,r));this.element.style.left=`${i}px`,this.element.style.top=`${o}px`,this.element.style.right="auto",this.element.style.bottom="auto"}handleMouseUp(){this.isDragging&&(this.isDragging=!1,this.element.style.cursor="pointer",this.element.style.zIndex="999998",this.snapToEdge())}snapToEdge(){const e=this.element.getBoundingClientRect(),t=e.left+e.width/2,n=e.top+e.height/2,s={left:t,right:window.innerWidth-t,top:n,bottom:window.innerHeight-n};switch(Object.entries(s).reduce((e,t)=>e[1]<t[1]?e:t)[0]){case"left":this.element.style.left="20px";break;case"right":this.element.style.left="auto",this.element.style.right="20px";break;case"top":this.element.style.top="20px";break;case"bottom":this.element.style.top="auto",this.element.style.bottom="20px"}}updatePosition(){const e=this.inspector.getConfig().position;switch(this.element.style.top="auto",this.element.style.right="auto",this.element.style.bottom="auto",this.element.style.left="auto",e){case"top-left":this.element.style.top="20px",this.element.style.left="20px";break;case"top-right":this.element.style.top="20px",this.element.style.right="20px";break;case"bottom-left":this.element.style.bottom="20px",this.element.style.left="20px";break;default:this.element.style.bottom="20px",this.element.style.right="20px"}}updateAppearance(){this.errorCount>0?(this.element.classList.add("has-errors"),this.element.innerHTML="⚠️",this.element.title=`DevInspector - ${this.errorCount} error${this.errorCount>1?"s":""} detected`):(this.element.classList.remove("has-errors"),this.element.innerHTML="🔍",this.element.title="DevInspector - Click to toggle, drag to move")}show(){this.element.parentNode||document.body.appendChild(this.element),this.element.style.display="flex"}hide(){this.element.style.display="none"}destroy(){document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),this.eventUnsubscribers.forEach(e=>e()),this.eventUnsubscribers=[],this.element.parentNode&&this.element.parentNode.removeChild(this.element)}getElement(){return this.element}}class K{constructor(e){this.tabs=new Map,this.activeTab=null,this.isDragging=!1,this.dragOffset={x:0,y:0},this.isResizing=!1,this.badgeUpdateInterval=null,this.boundMouseMove=e=>this.handleMouseMove(e),this.boundMouseUp=()=>this.handleMouseUp(),this.inspector=e,this.element=this.createElement(),this.setupEventListeners(),this.updatePosition()}createElement(){const e=document.createElement("div");e.className=`devinspector position-${this.inspector.getConfig().position}`,e.style.width="600px",e.style.height="400px",e.style.display="none",this.headerElement=document.createElement("div"),this.headerElement.className="devinspector-header",this.headerElement.innerHTML='\n <h3 class="devinspector-title">DevInspector</h3>\n <div class="devinspector-controls">\n <button class="devinspector-control settings" title="Settings">⚙️</button>\n <button class="devinspector-control minimize" title="Minimize">−</button>\n <button class="devinspector-control close" title="Close">×</button>\n </div>\n ',this.tabsElement=document.createElement("div"),this.tabsElement.className="devinspector-tabs",this.bodyElement=document.createElement("div"),this.bodyElement.className="devinspector-body";const t=document.createElement("div");return t.className="devinspector-resizer",e.appendChild(this.headerElement),e.appendChild(this.tabsElement),e.appendChild(this.bodyElement),e.appendChild(t),e}setupEventListeners(){this.headerElement.querySelectorAll(".devinspector-control").forEach(e=>{e.addEventListener("click",t=>{t.stopPropagation();const n=e.className;n.includes("minimize")?this.inspector.minimize():n.includes("close")?this.inspector.hide():n.includes("settings")&&this.showSettings()})}),this.headerElement.addEventListener("mousedown",this.handleHeaderMouseDown.bind(this)),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp);this.element.querySelector(".devinspector-resizer").addEventListener("mousedown",this.handleResizerMouseDown.bind(this)),this.tabsElement.addEventListener("click",e=>{const t=e.target.closest(".devinspector-tab");if(t){const e=t.dataset.tabId;e&&this.setActiveTab(e)}}),this.badgeUpdateInterval=window.setInterval(()=>this.updateBadges(),1e3)}handleHeaderMouseDown(e){if(e.target.closest(".devinspector-control"))return;e.preventDefault(),this.isDragging=!0;const t=this.element.getBoundingClientRect();this.dragOffset={x:e.clientX-t.left,y:e.clientY-t.top},this.headerElement.style.cursor="grabbing",this.element.style.zIndex="1000000"}handleResizerMouseDown(e){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.element.style.zIndex="1000000",document.body.style.cursor="nw-resize"}handleMouseMove(e){if(this.isDragging){e.preventDefault();const t=e.clientX-this.dragOffset.x,n=e.clientY-this.dragOffset.y,s=window.innerWidth-this.element.offsetWidth,r=window.innerHeight-this.element.offsetHeight,i=Math.max(0,Math.min(t,s)),o=Math.max(0,Math.min(n,r));this.element.style.left=`${i}px`,this.element.style.top=`${o}px`,this.element.style.right="auto",this.element.style.bottom="auto"}else if(this.isResizing){e.preventDefault();const t=this.element.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top,r=300,i=200,o=window.innerWidth-t.left,a=window.innerHeight-t.top,c=Math.max(r,Math.min(n,o)),l=Math.max(i,Math.min(s,a));this.element.style.width=`${c}px`,this.element.style.height=`${l}px`}}handleMouseUp(){this.isDragging&&(this.isDragging=!1,this.headerElement.style.cursor="move",this.element.style.zIndex="999999"),this.isResizing&&(this.isResizing=!1,this.element.style.zIndex="999999",document.body.style.cursor="auto")}updatePosition(){const e=this.inspector.getConfig().position;this.element.classList.remove("position-top-left","position-top-right","position-bottom-left","position-bottom-right"),this.element.classList.add(`position-${e}`)}showSettings(){console.log("Settings not implemented yet")}addTab(e){this.tabs.set(e.id,e);const t=document.createElement("button");if(t.className="devinspector-tab",t.dataset.tabId=e.id,t.textContent=e.label,e.badge){const e=document.createElement("span");e.className="devinspector-tab-badge",e.textContent="0",t.appendChild(e)}this.tabsElement.appendChild(t);const n=document.createElement("div");n.className="devinspector-panel",n.dataset.panelId=e.id,n.appendChild(e.content),this.bodyElement.appendChild(n),1===this.tabs.size&&this.setActiveTab(e.id),this.updateBadges()}removeTab(e){if(!this.tabs.has(e))return;this.tabs.delete(e);const t=Array.from(this.tabsElement.querySelectorAll(".devinspector-tab")).find(t=>t.dataset.tabId===e);t&&t.remove();const n=Array.from(this.bodyElement.querySelectorAll(".devinspector-panel")).find(t=>t.dataset.panelId===e);if(n&&n.remove(),this.activeTab===e){const e=this.tabs.keys().next().value;e?this.setActiveTab(e):this.activeTab=null}}setActiveTab(e){this.tabs.has(e)&&(this.activeTab=e,this.tabsElement.querySelectorAll(".devinspector-tab").forEach(t=>{const n=t;t.classList.toggle("active",n.dataset.tabId===e)}),this.bodyElement.querySelectorAll(".devinspector-panel").forEach(t=>{const n=t;t.classList.toggle("active",n.dataset.panelId===e)}))}updateBadges(){this.tabs.forEach((e,t)=>{if(e.badge){const n=e.badge(),s=Array.from(this.tabsElement.querySelectorAll(".devinspector-tab")).find(e=>e.dataset.tabId===t),r=null==s?void 0:s.querySelector(".devinspector-tab-badge");r&&(r.textContent=n.toString(),r.style.display=n>0?"inline-block":"none")}})}show(){this.element.parentNode||document.body.appendChild(this.element),this.element.style.display="flex",this.element.classList.remove("minimized")}hide(){this.element.style.display="none"}minimize(){this.element.classList.add("minimized")}destroy(){null!==this.badgeUpdateInterval&&(clearInterval(this.badgeUpdateInterval),this.badgeUpdateInterval=null),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),this.element.parentNode&&this.element.parentNode.removeChild(this.element)}getElement(){return this.element}getActiveTab(){return this.activeTab}}var Y=Object.freeze({__proto__:null,DevInspectorUI:class{constructor(e){this.styleElement=null,this.isVisible=!1,this.isMinimized=!1,this.inspector=e,this.floatingWidget=new G(e),this.mainPanel=new K(e)}async init(){this.injectStyles(),this.setupTabs(),this.setupEventListeners(),this.floatingWidget.show()}injectStyles(){this.styleElement=document.createElement("style");const e=this.inspector.getConfig().theme,t="function"==typeof window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,n="auto"===e?t?"dark":"light":e;this.styleElement.textContent=((e="dark")=>{const t="dark"===e?{primary:"#1e1e1e",secondary:"#2d2d30",tertiary:"#3e3e42",accent:"#007acc",text:"#cccccc",textSecondary:"#9d9d9d",border:"#3e3e42",success:"#4caf50",warning:"#ff9800",error:"#f44336",info:"#2196f3"}:{primary:"#ffffff",secondary:"#f5f5f5",tertiary:"#e0e0e0",accent:"#1976d2",text:"#333333",textSecondary:"#666666",border:"#ddd",success:"#4caf50",warning:"#ff9800",error:"#f44336",info:"#2196f3"};return`\n .devinspector {\n position: fixed;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n line-height: 1.4;\n color: ${t.text};\n background: ${t.primary};\n border: 1px solid ${t.border};\n border-radius: 8px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);\n z-index: 999999;\n min-width: 300px;\n min-height: 200px;\n resize: both;\n overflow: hidden;\n backdrop-filter: blur(10px);\n transition: all 0.3s ease;\n }\n\n .devinspector.fullwidth {\n width: calc(100vw - 40px) !important;\n left: 20px !important;\n right: 20px !important;\n }\n\n .devinspector.bottom-sidebar {\n bottom: 0 !important;\n left: 0 !important;\n right: 0 !important;\n top: auto !important;\n width: 100vw !important;\n height: 40vh !important;\n border-radius: 0 !important;\n border-left: none !important;\n border-right: none !important;\n border-bottom: none !important;\n resize: vertical;\n }\n\n .devinspector.bottom-sidebar .devinspector-header {\n border-radius: 0;\n }\n\n .devinspector * {\n box-sizing: border-box;\n }\n\n .devinspector.position-top-left {\n top: 20px;\n left: 20px;\n }\n\n .devinspector.position-top-right {\n top: 20px;\n right: 20px;\n }\n\n .devinspector.position-bottom-left {\n bottom: 20px;\n left: 20px;\n }\n\n .devinspector.position-bottom-right {\n bottom: 20px;\n right: 20px;\n }\n\n .devinspector.position-bottom-sidebar {\n bottom: 0;\n left: 0;\n right: 0;\n width: 100vw;\n height: 40vh;\n border-radius: 0;\n border-left: none;\n border-right: none;\n border-bottom: none;\n }\n\n .devinspector.minimized {\n width: 50px !important;\n height: 50px !important;\n overflow: hidden;\n border-radius: 50%;\n cursor: pointer;\n }\n\n .devinspector.minimized .devinspector-header {\n height: 100%;\n border-radius: 50%;\n justify-content: center;\n align-items: center;\n }\n\n .devinspector.minimized .devinspector-body,\n .devinspector.minimized .devinspector-tabs,\n .devinspector.minimized .devinspector-title {\n display: none !important;\n }\n\n .devinspector-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 12px;\n background: ${t.secondary};\n border-bottom: 1px solid ${t.border};\n cursor: move;\n user-select: none;\n border-radius: 8px 8px 0 0;\n }\n\n .devinspector-title {\n font-weight: 600;\n color: ${t.text};\n margin: 0;\n font-size: 13px;\n }\n\n .devinspector-controls {\n display: flex;\n gap: 4px;\n }\n\n .devinspector-control {\n width: 18px;\n height: 18px;\n border: none;\n border-radius: 3px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 12px;\n font-weight: bold;\n transition: all 0.2s ease;\n }\n\n .devinspector-control:hover {\n opacity: 0.8;\n transform: scale(1.1);\n }\n\n .devinspector-control.minimize {\n background: ${t.warning};\n color: white;\n }\n\n .devinspector-control.close {\n background: ${t.error};\n color: white;\n }\n\n .devinspector-control.settings {\n background: ${t.tertiary};\n color: ${t.text};\n }\n\n .devinspector-tabs {\n display: flex;\n background: ${t.secondary};\n border-bottom: 1px solid ${t.border};\n overflow-x: auto;\n }\n\n .devinspector-tab {\n padding: 8px 16px;\n background: none;\n border: none;\n color: ${t.textSecondary};\n cursor: pointer;\n font-family: inherit;\n font-size: 11px;\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n border-bottom: 2px solid transparent;\n transition: all 0.2s ease;\n white-space: nowrap;\n }\n\n .devinspector-tab:hover {\n color: ${t.text};\n background: ${t.tertiary};\n }\n\n .devinspector-tab.active {\n color: ${t.accent};\n border-bottom-color: ${t.accent};\n background: ${t.primary};\n }\n\n .devinspector-tab-badge {\n display: inline-block;\n background: ${t.error};\n color: white;\n border-radius: 10px;\n padding: 1px 6px;\n font-size: 10px;\n margin-left: 6px;\n min-width: 16px;\n text-align: center;\n }\n\n .devinspector-body {\n flex: 1;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n }\n\n .devinspector-panel {\n flex: 1;\n display: none;\n flex-direction: column;\n overflow: hidden;\n }\n\n .devinspector-panel.active {\n display: flex;\n }\n\n .devinspector-toolbar {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 12px;\n background: ${t.secondary};\n border-bottom: 1px solid ${t.border};\n flex-wrap: wrap;\n }\n\n .devinspector-search {\n flex: 1;\n min-width: 200px;\n padding: 4px 8px;\n border: 1px solid ${t.border};\n border-radius: 4px;\n background: ${t.primary};\n color: ${t.text};\n font-family: inherit;\n font-size: 11px;\n }\n\n .devinspector-search::placeholder {\n color: ${t.textSecondary};\n }\n\n .devinspector-button {\n padding: 4px 8px;\n border: 1px solid ${t.border};\n border-radius: 4px;\n background: ${t.tertiary};\n color: ${t.text};\n cursor: pointer;\n font-family: inherit;\n font-size: 11px;\n transition: all 0.2s ease;\n }\n\n .devinspector-button:hover {\n background: ${t.accent};\n color: white;\n }\n\n .devinspector-button.active {\n background: ${t.accent};\n color: white;\n }\n\n .devinspector-content {\n flex: 1;\n overflow: auto;\n padding: 8px;\n }\n\n .devinspector-list {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n .devinspector-list-item {\n padding: 8px 12px;\n border-bottom: 1px solid ${t.border};\n cursor: pointer;\n transition: background 0.2s ease;\n }\n\n .devinspector-list-item:hover {\n background: ${t.secondary};\n }\n\n .devinspector-list-item.selected {\n background: ${t.accent};\n color: white;\n }\n\n .devinspector-timestamp {\n color: ${t.textSecondary};\n font-size: 10px;\n }\n\n .devinspector-status {\n display: inline-block;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 10px;\n font-weight: bold;\n text-transform: uppercase;\n }\n\n .devinspector-status.success {\n background: ${t.success};\n color: white;\n }\n\n .devinspector-status.error {\n background: ${t.error};\n color: white;\n }\n\n .devinspector-status.warning {\n background: ${t.warning};\n color: white;\n }\n\n .devinspector-status.info {\n background: ${t.info};\n color: white;\n }\n\n .devinspector-json {\n font-family: 'Monaco', 'Menlo', monospace;\n font-size: 11px;\n line-height: 1.4;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .devinspector-json .json-key {\n color: ${"dark"===e?"#9cdcfe":"#0451a5"};\n }\n\n .devinspector-json .json-string {\n color: ${"dark"===e?"#ce9178":"#a31515"};\n }\n\n .devinspector-json .json-number {\n color: ${"dark"===e?"#b5cea8":"#09885a"};\n }\n\n .devinspector-json .json-boolean {\n color: ${"dark"===e?"#569cd6":"#0000ff"};\n }\n\n .devinspector-json .json-null {\n color: ${"dark"===e?"#569cd6":"#0000ff"};\n }\n\n .devinspector-console-entry {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 4px 8px;\n border-bottom: 1px solid ${t.border};\n font-family: 'Monaco', 'Menlo', monospace;\n font-size: 11px;\n line-height: 1.4;\n }\n\n .devinspector-console-entry.log {\n color: ${t.text};\n }\n\n .devinspector-console-entry.info {\n color: ${t.info};\n }\n\n .devinspector-console-entry.warn {\n color: ${t.warning};\n }\n\n .devinspector-console-entry.error {\n color: ${t.error};\n }\n\n .devinspector-console-entry.debug {\n color: ${t.textSecondary};\n }\n\n .devinspector-console-level {\n font-weight: bold;\n text-transform: uppercase;\n font-size: 10px;\n min-width: 40px;\n }\n\n .devinspector-chart {\n height: 100px;\n background: ${t.secondary};\n border: 1px solid ${t.border};\n border-radius: 4px;\n margin: 8px 0;\n position: relative;\n }\n\n .devinspector-metric {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px;\n background: ${t.secondary};\n border: 1px solid ${t.border};\n border-radius: 4px;\n margin: 4px 0;\n }\n\n .devinspector-metric-label {\n font-weight: 500;\n color: ${t.text};\n }\n\n .devinspector-metric-value {\n font-weight: bold;\n color: ${t.accent};\n }\n\n .devinspector-error-group {\n border-left: 4px solid ${t.error};\n padding-left: 8px;\n margin: 8px 0;\n }\n\n .devinspector-error-message {\n font-weight: bold;\n color: ${t.error};\n margin-bottom: 4px;\n }\n\n .devinspector-error-stack {\n font-family: 'Monaco', 'Menlo', monospace;\n font-size: 10px;\n color: ${t.textSecondary};\n background: ${t.secondary};\n padding: 8px;\n border-radius: 4px;\n overflow-x: auto;\n white-space: pre;\n }\n\n .devinspector-resizer {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 16px;\n height: 16px;\n cursor: nw-resize;\n background: linear-gradient(\n -45deg,\n transparent 0%,\n transparent 40%,\n ${t.border} 40%,\n ${t.border} 60%,\n transparent 60%,\n transparent 100%\n );\n }\n\n .devinspector-floating-widget {\n position: fixed;\n width: 60px;\n height: 60px;\n background: ${t.accent};\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);\n z-index: 999998;\n transition: all 0.3s ease;\n color: white;\n font-weight: bold;\n font-size: 14px;\n }\n\n .devinspector-floating-widget:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);\n }\n\n .devinspector-floating-widget.has-errors {\n background: ${t.error};\n animation: pulse 2s infinite;\n }\n\n @keyframes pulse {\n 0% { opacity: 1; }\n 50% { opacity: 0.7; }\n 100% { opacity: 1; }\n }\n\n /* Scrollbar styles */\n .devinspector *::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n\n .devinspector *::-webkit-scrollbar-track {\n background: ${t.secondary};\n }\n\n .devinspector *::-webkit-scrollbar-thumb {\n background: ${t.tertiary};\n border-radius: 4px;\n }\n\n .devinspector *::-webkit-scrollbar-thumb:hover {\n background: ${t.accent};\n }\n `})(n),document.head.appendChild(this.styleElement)}setupTabs(){const e={id:"network",label:"Network",badge:()=>this.inspector.getStorage("network").getSize(),content:this.createNetworkPanel()},t={id:"console",label:"Console",badge:()=>this.inspector.getStorage("console").getSize(),content:this.createConsolePanel()},n={id:"performance",label:"Performance",content:this.createPerformancePanel()},s={id:"errors",label:"Errors",badge:()=>this.inspector.getStorage("error").getSize(),content:this.createErrorsPanel()};this.mainPanel.addTab(e),this.mainPanel.addTab(t),this.mainPanel.addTab(n),this.mainPanel.addTab(s)}createNetworkPanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-toolbar">\n <input type="text" class="devinspector-search" placeholder="Filter requests...">\n <button class="devinspector-button">Clear</button>\n <button class="devinspector-button">Export</button>\n </div>\n <div class="devinspector-content">\n <div class="devinspector-network-list">\n <p style="text-align: center; color: #666; margin-top: 40px;">\n Network requests will appear here...\n </p>\n </div>\n </div>\n ',this.inspector.on("network:request",t=>{this.addNetworkEntry(e,t)}),this.inspector.on("network:response",t=>{this.updateNetworkEntry(e,t)}),e}createConsolePanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-toolbar">\n <input type="text" class="devinspector-search" placeholder="Filter logs...">\n <button class="devinspector-button">Clear</button>\n <button class="devinspector-button">Export</button>\n </div>\n <div class="devinspector-content">\n <div class="devinspector-console-list">\n <p style="text-align: center; color: #666; margin-top: 40px;">\n Console logs will appear here...\n </p>\n </div>\n </div>\n ',this.inspector.on("console:log",t=>{this.addConsoleEntry(e,t)}),e}createPerformancePanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-content">\n <div class="devinspector-metrics">\n <div class="devinspector-metric">\n <span class="devinspector-metric-label">FPS</span>\n <span class="devinspector-metric-value" id="fps-value">--</span>\n </div>\n <div class="devinspector-metric">\n <span class="devinspector-metric-label">Memory</span>\n <span class="devinspector-metric-value" id="memory-value">--</span>\n </div>\n <div class="devinspector-chart" id="fps-chart"></div>\n <div class="devinspector-chart" id="memory-chart"></div>\n </div>\n </div>\n ',this.inspector.on("performance:data",t=>{this.updatePerformanceMetrics(e,t)}),e}createErrorsPanel(){const e=document.createElement("div");return e.innerHTML='\n <div class="devinspector-toolbar">\n <button class="devinspector-button">Clear All</button>\n <button class="devinspector-button">Export</button>\n </div>\n <div class="devinspector-content">\n <div class="devinspector-errors-list">\n <p style="text-align: center; color: #666; margin-top: 40px;">\n No errors detected\n </p>\n </div>\n </div>\n ',this.inspector.on("error:caught",t=>{this.addErrorEntry(e,t)}),this.inspector.on("error:uncaught",t=>{this.addErrorEntry(e,t)}),e}setupEventListeners(){this.inspector.on("console:clear",()=>{const e=document.querySelector(".devinspector-console-list");e&&(e.innerHTML='\n <p style="text-align: center; color: #666; margin-top: 40px;">\n Console cleared\n </p>\n ')})}addNetworkEntry(e,t){const n=e.querySelector(".devinspector-network-list");if(!n)return;const s=n.querySelector("p");s&&s.remove();const i=document.createElement("div");i.className="devinspector-list-item",i.dataset.requestId=t.id,i.innerHTML=`\n <div style="display: flex; justify-content: space-between; align-items: center;">\n <span>${r(t.method)} ${r(t.url)}</span>\n <span class="devinspector-status info">Pending</span>\n </div>\n <div class="devinspector-timestamp">${new Date(t.timestamp).toLocaleTimeString()}</div>\n `,n.appendChild(i)}updateNetworkEntry(e,t){const n=Array.from(e.querySelectorAll("[data-request-id]")).find(e=>e.dataset.requestId===String(t.id));if(!n)return;const s=n.querySelector(".devinspector-status");s&&(s.textContent=`${t.status}`,s.className="devinspector-status "+(t.status>=400?"error":"success"))}addConsoleEntry(e,t){const n=e.querySelector(".devinspector-console-list");if(!n)return;const s=n.querySelector("p");s&&s.remove();const i=document.createElement("div");i.className=`devinspector-console-entry ${String(t.level).replace(/[^a-zA-Z]/g,"")}`,i.innerHTML=`\n <span class="devinspector-console-level">${r(t.level)}</span>\n <span class="devinspector-console-content">${r(this.formatConsoleArgs(t.formattedArgs))}</span>\n <span class="devinspector-timestamp">${new Date(t.timestamp).toLocaleTimeString()}</span>\n `,n.appendChild(i),n.scrollTop=n.scrollHeight}addErrorEntry(e,t){const n=e.querySelector(".devinspector-errors-list");if(!n)return;const s=n.querySelector("p");s&&s.remove();const i=document.createElement("div");i.className="devinspector-error-group",i.innerHTML=`\n <div class="devinspector-error-message">${r(t.message)}</div>\n <div class="devinspector-timestamp">${new Date(t.timestamp).toLocaleTimeString()}</div>\n ${t.stack?`<pre class="devinspector-error-stack">${r(Array.isArray(t.stack)?t.stack.join("\n"):t.stack)}</pre>`:""}\n `,n.appendChild(i)}updatePerformanceMetrics(e,t){const n=e.querySelector("#fps-value"),s=e.querySelector("#memory-value");if(n&&t.fps&&(n.textContent=`${t.fps.fps} FPS`),s&&t.memory){const e=Math.round(t.memory.usedJSHeapSize/1024/1024);s.textContent=`${e} MB`}}formatConsoleArgs(e){return e.map(e=>"string"==typeof e?e:e&&"object"==typeof e?JSON.stringify(e,null,2):String(e)).join(" ")}show(){this.mainPanel.show(),this.isVisible=!0,this.isMinimized=!1}hide(){this.mainPanel.hide(),this.isVisible=!1}minimize(){this.mainPanel.minimize(),this.isMinimized=!0}destroy(){this.floatingWidget.destroy(),this.mainPanel.destroy(),this.styleElement&&this.styleElement.parentNode&&this.styleElement.parentNode.removeChild(this.styleElement)}getElement(){return this.mainPanel.getElement()}}});return z});
7
7
  //# sourceMappingURL=devinspector.umd.min.cjs.map