@bereasoftware/nexa 1.4.1 → 1.6.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.
- package/README.en.md +130 -112
- package/README.md +142 -111
- package/dist/bereasoftware-nexa-1.6.0.tgz +0 -0
- package/dist/nexa.cjs.js +311 -85
- package/dist/nexa.cjs.js.map +1 -1
- package/dist/nexa.es.js +614 -218
- package/dist/nexa.es.js.map +1 -1
- package/dist/nexa.iife.js +311 -85
- package/dist/nexa.iife.js.map +1 -1
- package/dist/nexa.umd.js +311 -85
- package/dist/nexa.umd.js.map +1 -1
- package/dist/types/dev-overlay/index.d.ts +7 -0
- package/dist/types/dev-overlay/overlay.d.ts +11 -0
- package/dist/types/dev-overlay/tracker.d.ts +2 -0
- package/dist/types/dev-overlay/types.d.ts +15 -0
- package/package.json +1 -1
- package/dist/bereasoftware-nexa-1.4.1.tgz +0 -0
package/dist/nexa.cjs.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok:!0,value:e}),t=e=>({ok:!1,error:e});function n(n){return{validate(r){let i=r;for(let[e,r]of Object.entries(n))if(!r(i[e]))return t({message:`Validation failed: field "${e}" is invalid`,code:`VALIDATION_ERROR`});return e(r)}}}function r(n){return{validate(r){let i=r,a=n.filter(e=>!(e in i));return a.length>0?t({message:`Validation failed: missing fields: ${a.join(`, `)}`,code:`VALIDATION_ERROR`}):e(r)}}}var i={validate(n){return Array.isArray(n)?e(n):t({message:`Expected array response`,code:`VALIDATION_ERROR`})}},a={validate(n){return n&&typeof n==`object`&&!Array.isArray(n)?e(n):t({message:`Expected object response`,code:`VALIDATION_ERROR`})}},o={transform(e){return m(e,ee)}},s={transform(e){return m(e,te)}},c={transform(e){return h(e)}};function l(e){return{transform(t){return Array.isArray(t)?t.map(t=>g(t,e)):g(t,e)}}}function u(e){return{transform(t){return{[e]:t}}}}var d=class{maxAttempts;constructor(e=5){this.maxAttempts=e}shouldRetry(e){return e<this.maxAttempts}delayMs(e){return e*50}},f=class{retryableStatuses=[408,429,500,502,503,504];maxAttempts;constructor(e=3){this.maxAttempts=e}shouldRetry(e,t){return e>=this.maxAttempts?!1:this.retryableStatuses.includes(t.status??0)||t.code===`TIMEOUT`}delayMs(e){return Math.min(1e3*2**(e-1),1e4)}},p=class{failureCount=0;lastFailureTime=0;maxAttempts;failureThreshold;resetTimeMs;constructor(e=3,t=5,n=6e4){this.maxAttempts=e,this.failureThreshold=t,this.resetTimeMs=n}shouldRetry(e){return e>=this.maxAttempts||(Date.now()-this.lastFailureTime>this.resetTimeMs&&(this.failureCount=0),this.failureCount>=this.failureThreshold)?!1:(this.failureCount++,this.lastFailureTime=Date.now(),!0)}delayMs(e){return 100*2**(e-1)}reset(){this.failureCount=0,this.lastFailureTime=0}};function ee(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function te(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function m(e,t){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>m(e,t));let n={};for(let[r,i]of Object.entries(e))n[t(r)]=m(i,t);return n}function h(e,t=``){let n={};if(Array.isArray(e))e.forEach((e,r)=>{let i=t?`${t}[${r}]`:`[${r}]`;Object.assign(n,h(e,i))});else if(e&&typeof e==`object`)for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;i&&typeof i==`object`&&!Array.isArray(i)?Object.assign(n,h(i,e)):n[e]=i}return n}function g(e,t){if(!e||typeof e!=`object`)return{};let n=e,r={};for(let e of t)e in n&&(r[e]=n[e]);return r}function ne(e){let t=new AbortController,n=setTimeout(()=>t.abort(),e);return t.signal.addEventListener(`abort`,()=>clearTimeout(n),{once:!0}),t}async function _(e,t=3){try{return await e()}catch(n){if(t<=0)throw n;return _(e,t-1)}}var v=class{cache=new Map;get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>t.ttlMs?(this.cache.delete(e),null):t.data:null}set(e,t,n=6e4){this.cache.set(e,{data:t,timestamp:Date.now(),ttlMs:n})}clear(){this.cache.clear()}has(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>t.ttlMs?(this.cache.delete(e),!1):!0:!1}delete(e){this.cache.delete(e)}};function y(e={}){let t=e.cache||new v,n=e.ttlMs||6e4,r=e.cacheableStatuses||[200,304];return async(e,i)=>{let a=(e.request.method||`GET`).toUpperCase(),o=a===`GET`,s=`${a}:${e.request.url}`;if(o&&t.has(s)){let n=t.get(s);if(n){e.response=n,e.state.cacheHit=!0;return}}await i(),o&&e.response&&r.includes(e.response.status)&&(t.set(s,e.response,n),e.state.cacheMiss=!0)}}var b=y(),x=class{pending=new Map;async execute(e,t){if(this.pending.has(e))return this.pending.get(e);let n=t().finally(()=>{this.pending.delete(e)});return this.pending.set(e,n),n}clear(){this.pending.clear()}};function S(e={}){let t=e.deduplicator||new x,n=e.includeBody??!1,r=e.methods||[`GET`];return async(e,i)=>{let a=(e.request.method||`GET`).toUpperCase();if(!r.includes(a)){await i();return}let o=`${a}:${e.request.url}`;n&&e.request.body&&(o+=`:${JSON.stringify(e.request.body)}`);try{e.response=await t.execute(o,async()=>(await i(),e.response)),e.state.deduped=!0}catch(t){throw e.error=t,t}}}var re=S();function C(e){return async t=>{let n=-1;async function r(i){if(i<=n)throw Error(`next() called multiple times`);n=i;let a=e[i];a&&await a(t,()=>r(i+1))}await r(0)}}var ie=class{middlewares=[];use(e){return this.middlewares.push(e),this}async execute(e){if(e&&typeof e==`object`&&`request`in e&&`response`in e){let t=e;return await C(this.middlewares.map(e=>typeof e==`function`&&e.length===2?e:async(t,n)=>{let r=e;t.response.body=await r(t.response.body),await n()}))(t),t.response.body}let t=e;for(let e of this.middlewares)t=await e(t);return t}clear(){this.middlewares=[]}};function w(e,t,n,r={}){return{ok:e>=200&&e<300,data:t,error:n,status:e,headers:r}}function T(e){return async(t,n)=>{let r=e.path,i;switch(e.method){case`GET`:i=await t.get(r);break;case`POST`:i=await t.post(r,n);break;case`PUT`:i=await t.put(r,n);break;case`PATCH`:i=await t.patch(r,n);break;case`DELETE`:i=await t.delete(r);break;default:throw Error(`Unsupported method: ${e.method}`)}return i}}function E(e){return{request:async(t,n,r)=>{let i=e[n];return await T(i)(t,r)}}}var D=class e{subscribers=[];errorSubscribers=[];completeSubscribers=[];subscribe(e,t,n){return e&&this.subscribers.push(e),t&&this.errorSubscribers.push(t),n&&this.completeSubscribers.push(n),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e),this.errorSubscribers=this.errorSubscribers.filter(e=>e!==t),this.completeSubscribers=this.completeSubscribers.filter(e=>e!==n)}}}next(e){this.subscribers.forEach(t=>t(e))}error(e){this.errorSubscribers.forEach(t=>t(e))}complete(){this.completeSubscribers.forEach(e=>e())}map(t){let n=new e;return this.subscribe(e=>n.next(t(e)),e=>n.error(e),()=>n.complete()),n}filter(t){let n=new e;return this.subscribe(e=>{t(e)&&n.next(e)},e=>n.error(e),()=>n.complete()),n}};function ae(e){return t=>{if(!e(t))throw TypeError(`Value does not match expected type`);return t}}function O(e){return e}function oe(e){return O(e)}var se=class{_promise;resolveFunc;rejectFunc;constructor(){this._promise=new Promise((e,t)=>{this.resolveFunc=e,this.rejectFunc=t})}resolve(e){this.resolveFunc(e)}reject(e){this.rejectFunc(e)}get promise(){return this._promise}promise_(){return this._promise}};async function k(e,t={}){let n=e.body?.getReader();if(!n)throw Error(`Response body is not readable`);let r=[],i=0,a=parseInt(e.headers.get(`content-length`)||`0`,10);for(;;){let{done:e,value:o}=await n.read();if(e)break;r.push(o),i+=o.length,t.onChunk&&await t.onChunk(o),t.onProgress&&a>0&&t.onProgress(i,a)}return A(r,i)}function A(e,t){let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}async function ce(e,t){let n=await k(e);if(typeof window>`u`)await(await import(`fs`).then(e=>e.promises)).writeFile(t,n);else{let e=new Blob([n.buffer],{type:`application/octet-stream`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}}function j(e={}){return async(t,n)=>{if(await n(),t.response&&t.response.body&&typeof t.response.body==`object`&&`getReader`in t.response.body){let n=t.response.body.getReader(),r=[],i=0,a=parseInt(t.response.headers?.[`content-length`]||`0`,10);try{for(;;){let{done:o,value:s}=await n.read();if(o)break;r.push(s),i+=s.length,e.onChunk&&await e.onChunk(s),e.onProgress&&a>0&&e.onProgress(i,a),t.state.streamedChunks=t.state.streamedChunks||[],t.state.streamedChunks.push(s)}let o=A(r,i);t.response.body=o,t.state.streaming=!0,t.state.streamedBytes=i}finally{n.releaseLock()}}}}var le=j({onProgress:(e,t)=>{if(t>0){let n=Math.round(e/t*100);console.warn(`Streaming: ${n}% (${e}/${t} bytes)`)}}}),M=class{plugins=[];cache=new v;deduplicator=new x;middlewares=[];listeners=new Map;register(e){return this.plugins.push(e),e.setup(this),this.emit(`plugin:registered`,e.name),this}addMiddleware(e){return this.middlewares.push(e),this}getCache(){return this.cache}getDeduplicator(){return this.deduplicator}getPipeline(){return C(this.middlewares)}async executePipeline(e){await this.getPipeline()(e)}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);let n=this.listeners.get(e),r=t;return n&&n.add(r),this}emit(e,...t){let n=this.listeners.get(e);if(n)for(let e of n)e(...t)}off(e,t){return this.listeners.get(e)?.delete(t),this}getPlugins(){return[...this.plugins]}clear(){this.plugins=[],this.middlewares=[],this.listeners.clear(),this.cache.clear(),this.deduplicator.clear()}},ue={name:`logger`,setup(e){e.on(`request:start`,(...e)=>{let t=e[0];console.warn(`Request started: ${t}`)}),e.on(`request:success`,(...e)=>{let t=e[0],n=e[1];console.warn(`Request succeeded: ${t} (${n})`)}),e.on(`request:error`,(...e)=>{let t=e[0],n=e[1];console.error(`❌ Request failed: ${t}`,n)})}},N=class{name=`metrics`;metrics={requests:0,errors:0,totalTime:0,avgTime:0};setup(e){e.on(`request:complete`,(...e)=>{let t=e[0],n=e[1];this.metrics.requests++,this.metrics.totalTime+=t,this.metrics.avgTime=this.metrics.totalTime/this.metrics.requests,n||this.metrics.errors++})}getMetrics(){return{...this.metrics}}},P=class{name=`cache`;ttlMs;constructor(e=6e4){this.ttlMs=e}setup(e){e.addMiddleware(y({ttlMs:this.ttlMs}))}},F=class{name=`dedupe`;setup(e){e.addMiddleware(S())}},I=class{store=new v;get(e){return this.store.get(e)}set(e,t,n=6e4){this.store.set(e,t,n)}has(e){return this.store.has(e)}clear(){this.store.clear()}},L=class{maxAttempts;baseDelayMs;constructor(e=3,t=100){this.maxAttempts=e,this.baseDelayMs=t}shouldRetry(e,t){let n=t.status!==void 0&&t.status>=500,r=t.code===`NETWORK_ERROR`;return e<this.maxAttempts&&(n||r||t.code===`TIMEOUT`)}delayMs(e){let t=this.baseDelayMs*2**(e-1),n=Math.random()*t*.1;return Math.min(t+n,3e4)}},R=class{running=0;queue=[];maxConcurrent;constructor(e){this.maxConcurrent=e}async acquire(){if(this.running<this.maxConcurrent){this.running++;return}return new Promise(e=>{this.queue.push(()=>{this.running++,e()})})}release(){this.running--;let e=this.queue.shift();e&&e()}get pending(){return this.queue.length}get active(){return this.running}};function z(e){return e==null?{serialized:void 0,contentType:null}:typeof e==`string`?{serialized:e,contentType:`text/plain`}:typeof FormData<`u`&&e instanceof FormData?{serialized:e,contentType:null}:typeof URLSearchParams<`u`&&e instanceof URLSearchParams?{serialized:e,contentType:`application/x-www-form-urlencoded`}:typeof Blob<`u`&&e instanceof Blob?{serialized:e,contentType:e.type||`application/octet-stream`}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof ReadableStream<`u`&&e instanceof ReadableStream?{serialized:e,contentType:`application/octet-stream`}:{serialized:JSON.stringify(e),contentType:`application/json`}}function B(e,t){return t?e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(e,n)=>{let r=t[n];if(r===void 0)throw Error(`Missing path parameter: :${n}`);return encodeURIComponent(String(r))}):e}var V=class n{requestInterceptors=[];responseInterceptors=[];cache;devTracker;config;requestQueue;pendingRequests=new Set;constructor(e={}){this.config={baseURL:e.baseURL??``,defaultHeaders:e.defaultHeaders??{"Content-Type":`application/json`},defaultTimeout:e.defaultTimeout??3e4,validateStatus:e.validateStatus??(e=>e>=200&&e<300),cacheStrategy:e.cacheStrategy??new I,maxConcurrent:e.maxConcurrent??0,defaultResponseType:e.defaultResponseType??`auto`,defaultHooks:e.defaultHooks??{},adapter:e.adapter},this.cache=this.config.cacheStrategy,this.requestQueue=this.config.maxConcurrent>0?new R(this.config.maxConcurrent):null,this.devTracker=e.devTracker??null}async request(n){if(!this.requestInterceptors.length&&!this.responseInterceptors.length&&!n.cache?.enabled&&!n.hooks&&!Object.keys(this.config.defaultHooks).length&&!n.retry&&!n.validate&&!n.transform&&!this.requestQueue&&!n.onDownloadProgress&&!n.signal)return this.fastPath(n);let r=n.hooks?{...this.config.defaultHooks,...n.hooks}:this.config.defaultHooks,i=this.getMaxAttempts(n.retry),a=this.getRetryStrategy(n.retry),o=this.buildRequest(n);r.onStart?.(o),this.requestQueue&&await this.requestQueue.acquire();try{for(let s=1;s<=i;s++){let c;try{if((n.method===`GET`||!n.method)&&n.cache?.enabled){let t=this.getCacheKey(n),i=this.cache.get(t);if(i){let t=i;return this.trackDev({method:n.method??`GET`,url:o.url,status:t.status,duration:t.duration,cached:!0,ok:!0,headers:{...o.headers},body:n.body,retryCount:0}),r.onSuccess?.(t),r.onFinally?.(),e(t)}}let t=o;for(let e of this.requestInterceptors)t=await e.onRequest(t);c=new AbortController,this.pendingRequests.add(c),n.signal&&n.signal.addEventListener(`abort`,()=>c.abort(),{once:!0});let i=performance.now(),a=await this.fetchWithTimeout(t,this.resolveTimeoutMs(n.timeout??this.config.defaultTimeout),c),l=performance.now()-i,u=a;n.onDownloadProgress&&a.body&&(u=this.trackDownloadProgress(a,n.onDownloadProgress));let d=n.responseType??this.config.defaultResponseType,f=await this.parseResponse(u,t,l,d);if(!this.config.validateStatus(f.status))throw{message:`Request failed with status ${f.status}`,status:f.status,statusText:f.statusText,code:`HTTP_ERROR`};if(n.validate){let e=n.validate.validate(f.data);if(!e.ok)return e}n.transform&&(f.data=n.transform.transform(f.data));let p=f;for(let e of this.responseInterceptors)p=await e.onResponse(p);if((n.method===`GET`||!n.method)&&n.cache?.enabled){let e=this.getCacheKey(n);this.cache.set(e,p,n.cache.ttlMs)}return r.onSuccess?.(p),this.pendingRequests.delete(c),this.trackDev({method:n.method??`GET`,url:o.url,status:p.status,duration:p.duration,cached:!1,ok:!0,headers:{...o.headers},body:n.body,retryCount:s-1}),e(p)}catch(e){let l;if(l=e instanceof DOMException?e.name===`TimeoutError`?{message:`Request timed out`,code:`TIMEOUT`}:e.name===`AbortError`?{message:`Request aborted`,code:`ABORTED`}:{message:e.message,code:`UNKNOWN_ERROR`,originalError:e}:this.isHttpErrorDetails(e)?e:this.normalizeError(e),s<i&&a.shouldRetry(s,l)){r.onRetry?.(s,l);let e=a.delayMs(s);await this.delay(e);continue}let u=l;for(let e of this.responseInterceptors)e.onError&&(u=await e.onError(u));return r.onError?.(u),c&&this.pendingRequests.delete(c),this.trackDev({method:n.method??`GET`,url:o.url,status:u.status,duration:0,cached:!1,ok:!1,code:u.code,headers:{...o.headers},body:n.body,retryCount:s-1}),t(u)}}let s={message:`Max retries exceeded`,code:`MAX_RETRIES`};return r.onError?.(s),this.trackDev({method:n.method??`GET`,url:o.url,duration:0,cached:!1,ok:!1,code:`MAX_RETRIES`,headers:{...o.headers},body:n.body,retryCount:i}),t(s)}finally{r.onFinally?.(),this.requestQueue&&this.requestQueue.release()}}async fastPath(n){let r=B(n.url,n.params),i=this.buildUrl(r,n.query),{serialized:a,contentType:o}=z(n.body),s={...this.config.defaultHeaders,...n.headers};o?s[`Content-Type`]=o:a instanceof FormData&&delete s[`Content-Type`];let c=new AbortController,l=this.resolveTimeoutMs(n.timeout??this.config.defaultTimeout);this.pendingRequests.add(c);try{let r=performance.now(),a=await this.fetchWithTimeout({url:i,method:n.method??`GET`,headers:s,body:n.body,params:n.params},l,c),o=performance.now()-r,u=await this.parseBody(a,n.responseType??this.config.defaultResponseType);if(!this.config.validateStatus(a.status)){let e=t({message:`Request failed with status ${a.status}`,status:a.status,statusText:a.statusText,code:`HTTP_ERROR`});return this.trackDev({method:n.method??`GET`,url:i,status:a.status,duration:o,cached:!1,ok:!1,code:`HTTP_ERROR`,headers:s,body:n.body,retryCount:0}),this.pendingRequests.delete(c),e}return this.pendingRequests.delete(c),this.trackDev({method:n.method??`GET`,url:i,status:a.status,duration:o,cached:!1,ok:!0,headers:s,body:n.body,retryCount:0}),e({status:a.status,statusText:a.statusText,headers:a.headers,data:u,request:{url:i,method:n.method??`GET`,headers:s,body:n.body,params:n.params},duration:o})}catch(e){this.pendingRequests.delete(c);let r=`UNKNOWN_ERROR`;if(e instanceof DOMException?e.name===`TimeoutError`?r=`TIMEOUT`:e.name===`AbortError`&&(r=`ABORTED`):e instanceof Error&&(e.name===`TimeoutError`?r=`TIMEOUT`:e.name===`AbortError`||e.message.includes(`abort`)?r=`ABORTED`:e.name===`TypeError`&&(r=`NETWORK_ERROR`)),this.trackDev({method:n.method??`GET`,url:i,duration:performance.now()-(performance.now()-0),cached:!1,ok:!1,code:r,headers:s,body:n.body,retryCount:0}),e instanceof DOMException){if(e.name===`TimeoutError`)return t({message:`Request timed out`,code:`TIMEOUT`});if(e.name===`AbortError`)return t({message:`Request aborted`,code:`ABORTED`})}return e instanceof Error?e.name===`TimeoutError`?t({message:`Request timed out`,code:`TIMEOUT`}):e.name===`AbortError`||e.message.includes(`abort`)?t({message:`Request aborted`,code:`ABORTED`}):t({message:e.message,code:e.name===`TypeError`?`NETWORK_ERROR`:`UNKNOWN_ERROR`}):t({message:String(e),code:`UNKNOWN_ERROR`})}}get(e,t){return this.request({...t,url:e,method:`GET`})}post(e,t,n){return this.request({...n,url:e,method:`POST`,body:t})}put(e,t,n){return this.request({...n,url:e,method:`PUT`,body:t})}patch(e,t,n){return this.request({...n,url:e,method:`PATCH`,body:t})}delete(e,t){return this.request({...t,url:e,method:`DELETE`})}head(e,t){return this.request({...t,url:e,method:`HEAD`})}options(e,t){return this.request({...t,url:e,method:`OPTIONS`})}addRequestInterceptor(e){return this.requestInterceptors.push(e),()=>{let t=this.requestInterceptors.indexOf(e);t!==-1&&this.requestInterceptors.splice(t,1)}}addResponseInterceptor(e){return this.responseInterceptors.push(e),()=>{let t=this.responseInterceptors.indexOf(e);t!==-1&&this.responseInterceptors.splice(t,1)}}clearInterceptors(){this.requestInterceptors=[],this.responseInterceptors=[]}clearCache(){this.cache.clear()}cancelAll(){for(let e of this.pendingRequests)e.abort();this.pendingRequests.clear()}get activeRequests(){return this.pendingRequests.size}get queueStats(){return{active:this.requestQueue?.active??this.pendingRequests.size,pending:this.requestQueue?.pending??0}}extend(e={}){let t=new n({baseURL:e.baseURL??this.config.baseURL,defaultHeaders:{...this.config.defaultHeaders,...e.defaultHeaders},defaultTimeout:e.defaultTimeout??this.config.defaultTimeout,validateStatus:e.validateStatus??this.config.validateStatus,cacheStrategy:e.cacheStrategy??this.cache,maxConcurrent:e.maxConcurrent??this.config.maxConcurrent,defaultResponseType:e.defaultResponseType??this.config.defaultResponseType,defaultHooks:{...this.config.defaultHooks,...e.defaultHooks},adapter:e.adapter});for(let e of this.requestInterceptors)t.addRequestInterceptor(e);for(let e of this.responseInterceptors)t.addResponseInterceptor(e);return t}async*paginate(e,t,n={}){let r={...n};for(;;){let n=await this.get(e,r);if(!n.ok)break;yield t.getItems(n.value.data);let i=t.getNextPage(n.value.data,r);if(!i)break;r=i}}async poll(e,n,r={}){let i=n.maxAttempts??0;for(let t=1;i===0||t<=i;t++){let a=await this.get(e,r);if(!a.ok||(n.onPoll?.(a.value.data,t),n.until(a.value.data)))return a;if(i>0&&t>=i)break;await this.delay(n.intervalMs)}return t({message:`Polling exhausted after ${i} attempts`,code:`POLL_EXHAUSTED`})}buildRequest(e){let t=B(e.url,e.params);return{url:this.buildUrl(t,e.query),method:e.method??`GET`,headers:{...this.config.defaultHeaders,...e.headers},body:e.body,params:e.params}}buildUrl(e,t){let n=this.config.baseURL+e;if(t){let e=Object.keys(t);if(e.length>0){let r=new URLSearchParams;for(let n=0;n<e.length;n++)r.append(e[n],String(t[e[n]]));n+=`?${r.toString()}`}}return n}getCacheKey(e){let t=B(e.url,e.params),n=e.query?JSON.stringify(e.query):``;return`${e.method??`GET`}:${t}${n?`:`+n:``}`}fetchWithTimeout(e,t,n){let{serialized:r,contentType:i}=z(e.body),a={...e.headers};return i?a[`Content-Type`]=i:r instanceof FormData&&delete a[`Content-Type`],new Promise((i,o)=>{let s=setTimeout(()=>{n.abort(),o(new DOMException(`Request timed out`,`TimeoutError`))},t);(this.config.adapter??fetch)(e.url,{method:e.method,headers:a,body:r,signal:n.signal}).then(e=>{clearTimeout(s),i(e)},e=>{clearTimeout(s),o(e)})})}trackDownloadProgress(e,t){let n=parseInt(e.headers.get(`content-length`)||`0`,10),r=e.body?.getReader();if(!r)return e;let i=0,a=new ReadableStream({async pull(e){let{done:a,value:o}=await r.read();if(a){e.close();return}i+=o.byteLength,t({loaded:i,total:n,percent:n>0?Math.round(i/n*100):0}),e.enqueue(o)}});return new Response(a,{headers:e.headers,status:e.status,statusText:e.statusText})}async parseResponse(e,t,n,r){let i=await this.parseBody(e,r);return{status:e.status,statusText:e.statusText,headers:e.headers,data:i,request:t,duration:n}}async parseBody(e,t){switch(t){case`json`:return await e.json();case`text`:return await e.text();case`blob`:return await e.blob();case`arrayBuffer`:return await e.arrayBuffer();case`formData`:return await e.formData();case`stream`:return e.body;default:{let t=e.headers.get(`content-type`)??``;if(t.includes(`application/json`))return await e.json();if(t.includes(`text/`))return await e.text();if(t.includes(`multipart/form-data`))return await e.formData();if(t.includes(`application/octet-stream`)||t.includes(`image/`)||t.includes(`audio/`)||t.includes(`video/`))return await e.blob();try{return await e.json()}catch{return await e.text()}}}}normalizeError(e){if(e instanceof DOMException){if(e.name===`TimeoutError`)return{message:`Request timed out`,code:`TIMEOUT`};if(e.name===`AbortError`)return{message:`Request aborted`,code:`ABORTED`}}return e instanceof Error?e.name===`TimeoutError`?{message:`Request timed out`,code:`TIMEOUT`}:e.name===`AbortError`||e.message.includes(`abort`)?{message:`Request aborted`,code:`ABORTED`}:{message:e.message,code:e.name===`TypeError`?`NETWORK_ERROR`:`UNKNOWN_ERROR`,originalError:e}:{message:String(e),code:`UNKNOWN_ERROR`,originalError:e}}isHttpErrorDetails(e){return typeof e==`object`&&!!e&&`message`in e&&`code`in e}getMaxAttempts(e){return e?`maxAttempts`in e?e.maxAttempts??1:100:1}getRetryStrategy(e){return e?`shouldRetry`in e?e:new L(e.maxAttempts,e.backoffMs):{shouldRetry:()=>!1,delayMs:()=>0}}resolveTimeoutMs(e){return typeof e==`number`?e:e.total??e.response??e.connection??3e4}delay(e){return new Promise(t=>setTimeout(t,e))}trackDev(e){this.devTracker&&this.devTracker.track(e)}},H=class extends Error{status;code;response;constructor(e,t,n,r){super(e),this.name=`HttpError`,this.status=t,this.code=n,this.response=r}};function U(e){return e instanceof H}function de(e){return new V(e)}function W(){return typeof window>`u`&&typeof process<`u`&&process.versions?.node!==void 0}var fe=class{url;options;pluginManager;status=`closed`;reconnectAttempt=0;reconnectTimer=null;heartbeatTimer=null;stats={messagesSent:0,messagesReceived:0,connectionTime:0,reconnectAttempts:0};connectionStartTime=0;listeners={open:new Set,close:new Set,error:new Set,message:new Set};constructor(e,t={}){this.url=e,this.options=t,this.pluginManager=new M}updateStatus(e){this.status=e,e===`open`?this.connectionStartTime=Date.now():e===`closed`&&this.connectionStartTime>0&&(this.stats.connectionTime+=Date.now()-this.connectionStartTime,this.connectionStartTime=0)}emitOpen(e){this.pluginManager.emit(`websocket:open`,this.url,e);for(let t of this.listeners.open)t(e)}emitClose(e){this.pluginManager.emit(`websocket:close`,this.url,e);for(let t of this.listeners.close)t(e)}emitError(e){let t;e instanceof Error?(t=new Event(`error`),t.error=e):t=e,this.pluginManager.emit(`websocket:error`,this.url,t);for(let e of this.listeners.error)e(t)}emitMessage(e){this.pluginManager.emit(`websocket:message`,this.url,e);for(let t of this.listeners.message)t(e)}onOpen(e){return this.listeners.open.add(e),()=>this.listeners.open.delete(e)}onClose(e){return this.listeners.close.add(e),()=>this.listeners.close.delete(e)}onError(e){return this.listeners.error.add(e),()=>this.listeners.error.delete(e)}onMessage(e){return this.listeners.message.add(e),()=>this.listeners.message.delete(e)}getStatus(){return this.status}getStats(){return{...this.stats,connectionTime:this.stats.connectionTime+(this.connectionStartTime>0?Date.now()-this.connectionStartTime:0)}}scheduleReconnect(){if(this.options.reconnect?.enabled===!1)return;let e=this.options.reconnect?.maxAttempts??1/0;if(this.reconnectAttempt>=e){this.pluginManager.emit(`websocket:reconnect:failed`,this.url,this.reconnectAttempt);return}let t=this.options.reconnect?.baseDelay??1e3,n=this.options.reconnect?.maxDelay??3e4,r=Math.min(n,t*2**this.reconnectAttempt);this.reconnectAttempt++,this.stats.reconnectAttempts=this.reconnectAttempt,this.options.reconnect?.onReconnecting?.(this.reconnectAttempt,r),this.pluginManager.emit(`websocket:reconnecting`,this.url,this.reconnectAttempt,r),this.reconnectTimer=setTimeout(()=>{this.connect().catch(e=>{this.emitError(e instanceof Error?e:Error(String(e)))})},r)}startHeartbeat(){if(!this.options.heartbeat)return;let e=this.options.heartbeat.interval??3e4,t=this.options.heartbeat.pingMessage??`ping`,n=this.options.heartbeat.pongMessage??`pong`,r=!0,i=()=>{if(!r){this.pluginManager.emit(`websocket:heartbeat:timeout`,this.url),this.disconnect();return}r=!1,this.send(t),this.heartbeatTimer=setTimeout(i,e)};this.onMessage(e=>{let t=e.raw;typeof t==`string`&&t===n&&(r=!0)}),this.heartbeatTimer=setTimeout(i,e)}stopHeartbeat(){this.heartbeatTimer&&=(clearTimeout(this.heartbeatTimer),null)}cleanup(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.stopHeartbeat()}},G=class extends fe{socket=null;messageTypeListeners=new Map;constructor(e,t={}){super(e,t)}async connect(){if(!(this.status===`connecting`||this.status===`open`))return this.updateStatus(`connecting`),this.pluginManager.emit(`websocket:connect:start`,this.url),new Promise((e,t)=>{let n=this.options.timeout??1e4,r=setTimeout(()=>{this.updateStatus(`closed`),this.socket?.close(),this.socket=null;let e=Error(`WebSocket connection timeout after ${n}ms`);this.emitError(e),t(e)},n);try{this.socket=new WebSocket(this.url,this.options.protocols),this.socket.onopen=t=>{clearTimeout(r),this.updateStatus(`open`),this.reconnectAttempt=0,this.emitOpen(t),this.options.onOpen?.(t),this.startHeartbeat(),this.pluginManager.emit(`websocket:connect:success`,this.url),e()},this.socket.onclose=e=>{clearTimeout(r),this.updateStatus(`closed`),this.emitClose(e),this.options.onClose?.(e),this.stopHeartbeat(),this.pluginManager.emit(`websocket:disconnected`,this.url,e.code,e.reason),e.code!==1e3&&!e.wasClean&&this.scheduleReconnect()},this.socket.onerror=e=>{clearTimeout(r),this.updateStatus(`closed`),this.emitError(e),this.options.onError?.(e),this.pluginManager.emit(`websocket:connect:error`,this.url,e),t(e)},this.socket.onmessage=e=>{this.stats.messagesReceived++;let t={data:this.tryParseData(e.data),raw:e.data,type:`message`,timestamp:Date.now()};this.emitMessage(t),this.pluginManager.emit(`websocket:message:received`,this.url,t)}}catch(e){clearTimeout(r),this.updateStatus(`closed`),this.pluginManager.emit(`websocket:connect:error`,this.url,e),t(e)}})}disconnect(){this.cleanup(),this.socket&&(this.updateStatus(`closing`),this.socket.close(1e3,`Client disconnected`),this.socket=null,this.updateStatus(`closed`))}send(e){if(!this.socket||this.socket.readyState!==WebSocket.OPEN)throw Error(`WebSocket is not connected`);this.socket.send(e),this.stats.messagesSent++,this.pluginManager.emit(`websocket:message:sent`,this.url,e)}sendJson(e){this.send(JSON.stringify(e))}onMessageType(e,t){return this.messageTypeListeners.has(e)||this.messageTypeListeners.set(e,new Set),this.messageTypeListeners.get(e).add(t),()=>{let n=this.messageTypeListeners.get(e);n&&(n.delete(t),n.size===0&&this.messageTypeListeners.delete(e))}}tryParseData(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}},pe=class extends G{async connect(){if(W())try{let{default:e}=await import(`ws`);return super.connect()}catch{throw Error(`WebSocket client for Node.js requires the "ws" package. Please install it: npm install ws`)}return super.connect()}};function me(e,t={}){return W()?new pe(e,t):new G(e,t)}function K(){return typeof window>`u`&&typeof process<`u`&&process.versions?.node!==void 0}var q=class{url;options;_source=null;pluginManager;status=`closed`;reconnectAttempt=0;reconnectTimer=null;stats={messagesSent:0,messagesReceived:0,connectionTime:0,reconnectAttempts:0};connectionStartTime=0;listeners={open:new Set,close:new Set,error:new Set,message:new Set,event:new Map};_lastEventId=null;constructor(e,t={}){this.url=e,this.options=t,this.pluginManager=new M}updateStatus(e){this.status=e,e===`open`?this.connectionStartTime=Date.now():e===`closed`&&this.connectionStartTime>0&&(this.stats.connectionTime+=Date.now()-this.connectionStartTime,this.connectionStartTime=0)}async connect(){if(!(this.status===`connecting`||this.status===`open`))return this.updateStatus(`connecting`),this.pluginManager.emit(`sse:connect:start`,this.url),new Promise((e,t)=>{let n=this.options.timeout??1e4,r=setTimeout(()=>{this.updateStatus(`closed`),this._source?.close(),this._source=null;let e=Error(`SSE connection timeout after ${n}ms`);this.emitError(e),t(e)},n);try{this._source=new EventSource(this.url),this._source.onopen=t=>{clearTimeout(r),this.updateStatus(`open`),this.reconnectAttempt=0,this.emitOpen(t),this.options.onOpen?.(t),this.pluginManager.emit(`sse:connect:success`,this.url),e()},this._source.onerror=e=>{clearTimeout(r),this.updateStatus(`closed`),this.emitError(e),this.options.onError?.(e),this.pluginManager.emit(`sse:connect:error`,this.url,e),this._source?.readyState===EventSource.CLOSED&&(this.emitClose(),this.options.onClose?.(),this.scheduleReconnect()),t(e)},this._source.onmessage=e=>{this.stats.messagesReceived++,this._lastEventId=e.lastEventId||this._lastEventId;let t={data:this.tryParseData(e.data),raw:e.data,type:e.type||`message`,timestamp:Date.now()};this.emitMessage(t),this.pluginManager.emit(`sse:message:received`,this.url,t);let n=e.type||`message`,r=this.listeners.event.get(n);if(r)for(let e of r)e(t.data)},this._source.addEventListener=this._source.addEventListener.bind(this._source)}catch(e){clearTimeout(r),this.updateStatus(`closed`),this.pluginManager.emit(`sse:connect:error`,this.url,e),t(e)}})}disconnect(){this.cleanup(),this._source&&(this.updateStatus(`closing`),this._source.close(),this._source=null,this.updateStatus(`closed`),this.emitClose(),this.options.onClose?.())}send(e){throw Error(`SSE is a receive-only protocol. Use HTTP requests to send data to server.`)}onMessage(e){return this.listeners.message.add(e),()=>this.listeners.message.delete(e)}onOpen(e){return this.listeners.open.add(e),()=>this.listeners.open.delete(e)}onClose(e){return this.listeners.close.add(e),()=>this.listeners.close.delete(e)}onError(e){return this.listeners.error.add(e),()=>this.listeners.error.delete(e)}onEvent(e,t){return this.listeners.event.has(e)||this.listeners.event.set(e,new Set),this.listeners.event.get(e).add(t),this._source&&!this._source[`on${e}`]&&this._source.addEventListener(e,n=>{t({data:this.tryParseData(n.data),raw:n.data,type:e,timestamp:Date.now()}.data)}),()=>{let n=this.listeners.event.get(e);n&&(n.delete(t),n.size===0&&this.listeners.event.delete(e))}}getStatus(){return this.status}getStats(){return{...this.stats,connectionTime:this.stats.connectionTime+(this.connectionStartTime>0?Date.now()-this.connectionStartTime:0)}}get lastEventId(){return this._lastEventId}get source(){return this._source}emitOpen(e){this.pluginManager.emit(`sse:open`,this.url,e);for(let t of this.listeners.open)t(e)}emitClose(){this.pluginManager.emit(`sse:close`,this.url);for(let e of this.listeners.close)e()}emitError(e){let t;e instanceof Error?(t=new Event(`error`),t.error=e):t=e,this.pluginManager.emit(`sse:error`,this.url,t);for(let e of this.listeners.error)e(t)}emitMessage(e){this.pluginManager.emit(`sse:message`,this.url,e);for(let t of this.listeners.message)t(e)}scheduleReconnect(){if(this.options.reconnect?.enabled===!1)return;let e=this.options.reconnect?.maxAttempts??1/0;if(this.reconnectAttempt>=e){this.pluginManager.emit(`sse:reconnect:failed`,this.url,this.reconnectAttempt);return}let t=this.options.reconnect?.baseDelay??1e3,n=this.options.reconnect?.maxDelay??3e4,r=Math.min(n,t*2**this.reconnectAttempt);this.reconnectAttempt++,this.stats.reconnectAttempts=this.reconnectAttempt,this.options.reconnect?.onReconnecting?.(this.reconnectAttempt,r),this.pluginManager.emit(`sse:reconnecting`,this.url,this.reconnectAttempt,r),this.reconnectTimer=setTimeout(()=>{this.connect().catch(e=>{this.emitError(e instanceof Error?e:Error(String(e)))})},r)}cleanup(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null)}tryParseData(e){try{return JSON.parse(e)}catch{return e}}},he=class extends q{async connect(){if(K())throw Error(`SSE client for Node.js requires a polyfill or custom implementation. Consider using a library like "eventsource" or implement using fetch with streaming.`);return super.connect()}};function ge(e,t={}){return K()?new he(e,t):new q(e,t)}var _e=class{name=`realtime`;setup(e){e.on(`websocket:connect:start`,(...t)=>{let n=t[0];e.emit(`realtime:connect:start`,`websocket`,n)}),e.on(`websocket:connect:success`,(...t)=>{let n=t[0];e.emit(`realtime:connect:success`,`websocket`,n)}),e.on(`websocket:message:received`,(...t)=>{let n=t[0],r=t[1];e.emit(`realtime:message`,`websocket`,n,r)}),e.on(`sse:connect:start`,(...t)=>{let n=t[0];e.emit(`realtime:connect:start`,`sse`,n)}),e.on(`sse:connect:success`,(...t)=>{let n=t[0];e.emit(`realtime:connect:success`,`sse`,n)}),e.on(`sse:message:received`,(...t)=>{let n=t[0],r=t[1];e.emit(`realtime:message`,`sse`,n,r)})}};function ve(){return new _e}var J=class{history=[];maxHistory;listeners=new Set;startTime=Date.now();config;constructor(e={}){this.maxHistory=e.maxHistory??500,this.config={enabled:e.enabled??!0,maxHistory:this.maxHistory,keyboardShortcut:e.keyboardShortcut??`ctrl+shift+n`,position:e.position??`bottom-right`,theme:e.theme??`dark`}}track(e){let t={...e,id:this.generateId(),timestamp:Date.now()};this.history.unshift(t),this.history.length>this.maxHistory&&this.history.pop();for(let e of this.listeners)e(t);return t}getHistory(){return this.history}getMetrics(){let e=this.history.map(e=>e.duration),t=(Date.now()-this.startTime)/1e3;return{totalRequests:this.history.length,successfulRequests:this.history.filter(e=>e.ok).length,failedRequests:this.history.filter(e=>!e.ok).length,cachedRequests:this.history.filter(e=>e.cached).length,avgDuration:e.length?e.reduce((e,t)=>e+t,0)/e.length:0,maxDuration:e.length?Math.max(...e):0,minDuration:e.length?Math.min(...e):0,requestsPerSecond:t>0?this.history.length/t:0,slowestRequests:[...this.history].sort((e,t)=>t.duration-e.duration).slice(0,5)}}clear(){this.history=[],this.startTime=Date.now()}onChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getConfig(){return this.config}generateId(){return`${Date.now()}-${Math.random().toString(36).slice(2,8)}`}},Y={close:`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg>`,chevron:`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>`,back:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>`,retry:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 4v6h6M23 20v-6h-6"/><path d="M20.49 9A9 9 0 005.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 013.51 15"/></svg>`,clear:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>`,search:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg>`,clock:`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>`,zap:`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`},X={bg:`#09090b`,bgElevated:`#18181b`,border:`#27272a`,borderFocus:`#3f3f46`,text:`#fafafa`,textMuted:`#a1a1aa`,textDim:`#71717a`,accent:`#3b82f6`,accentHover:`#2563eb`,success:`#22c55e`,successBg:`rgba(34, 197, 94, 0.1)`,error:`#ef4444`,errorBg:`rgba(239, 68, 68, 0.1)`,warning:`#f59e0b`,get:`#22c55e`,post:`#3b82f6`,put:`#f59e0b`,patch:`#a855f7`,delete:`#ef4444`},Z=`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok:!0,value:e}),t=e=>({ok:!1,error:e});function n(n){return{validate(r){let i=r;for(let[e,r]of Object.entries(n))if(!r(i[e]))return t({message:`Validation failed: field "${e}" is invalid`,code:`VALIDATION_ERROR`});return e(r)}}}function r(n){return{validate(r){let i=r,a=n.filter(e=>!(e in i));return a.length>0?t({message:`Validation failed: missing fields: ${a.join(`, `)}`,code:`VALIDATION_ERROR`}):e(r)}}}var i={validate(n){return Array.isArray(n)?e(n):t({message:`Expected array response`,code:`VALIDATION_ERROR`})}},a={validate(n){return n&&typeof n==`object`&&!Array.isArray(n)?e(n):t({message:`Expected object response`,code:`VALIDATION_ERROR`})}},o={transform(e){return h(e,ee)}},s={transform(e){return h(e,m)}},c={transform(e){return g(e)}};function l(e){return{transform(t){return Array.isArray(t)?t.map(t=>_(t,e)):_(t,e)}}}function u(e){return{transform(t){return{[e]:t}}}}var d=class{maxAttempts;constructor(e=5){this.maxAttempts=e}shouldRetry(e){return e<this.maxAttempts}delayMs(e){return e*50}},f=class{retryableStatuses=[408,429,500,502,503,504];maxAttempts;constructor(e=3){this.maxAttempts=e}shouldRetry(e,t){return e>=this.maxAttempts?!1:this.retryableStatuses.includes(t.status??0)||t.code===`TIMEOUT`}delayMs(e){return Math.min(1e3*2**(e-1),1e4)}},p=class{failureCount=0;lastFailureTime=0;maxAttempts;failureThreshold;resetTimeMs;constructor(e=3,t=5,n=6e4){this.maxAttempts=e,this.failureThreshold=t,this.resetTimeMs=n}shouldRetry(e){return e>=this.maxAttempts||(Date.now()-this.lastFailureTime>this.resetTimeMs&&(this.failureCount=0),this.failureCount>=this.failureThreshold)?!1:(this.failureCount++,this.lastFailureTime=Date.now(),!0)}delayMs(e){return 100*2**(e-1)}reset(){this.failureCount=0,this.lastFailureTime=0}};function ee(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function m(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function h(e,t){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>h(e,t));let n={};for(let[r,i]of Object.entries(e))n[t(r)]=h(i,t);return n}function g(e,t=``){let n={};if(Array.isArray(e))e.forEach((e,r)=>{let i=t?`${t}[${r}]`:`[${r}]`;Object.assign(n,g(e,i))});else if(e&&typeof e==`object`)for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;i&&typeof i==`object`&&!Array.isArray(i)?Object.assign(n,g(i,e)):n[e]=i}return n}function _(e,t){if(!e||typeof e!=`object`)return{};let n=e,r={};for(let e of t)e in n&&(r[e]=n[e]);return r}function te(e){let t=new AbortController,n=setTimeout(()=>t.abort(),e);return t.signal.addEventListener(`abort`,()=>clearTimeout(n),{once:!0}),t}async function v(e,t=3){try{return await e()}catch(n){if(t<=0)throw n;return v(e,t-1)}}var y=class{cache=new Map;get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>t.ttlMs?(this.cache.delete(e),null):t.data:null}set(e,t,n=6e4){this.cache.set(e,{data:t,timestamp:Date.now(),ttlMs:n})}clear(){this.cache.clear()}has(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>t.ttlMs?(this.cache.delete(e),!1):!0:!1}delete(e){this.cache.delete(e)}};function b(e={}){let t=e.cache||new y,n=e.ttlMs||6e4,r=e.cacheableStatuses||[200,304];return async(e,i)=>{let a=(e.request.method||`GET`).toUpperCase(),o=a===`GET`,s=`${a}:${e.request.url}`;if(o&&t.has(s)){let n=t.get(s);if(n){e.response=n,e.state.cacheHit=!0;return}}await i(),o&&e.response&&r.includes(e.response.status)&&(t.set(s,e.response,n),e.state.cacheMiss=!0)}}var x=b(),S=class{pending=new Map;async execute(e,t){if(this.pending.has(e))return this.pending.get(e);let n=t().finally(()=>{this.pending.delete(e)});return this.pending.set(e,n),n}clear(){this.pending.clear()}};function C(e={}){let t=e.deduplicator||new S,n=e.includeBody??!1,r=e.methods||[`GET`];return async(e,i)=>{let a=(e.request.method||`GET`).toUpperCase();if(!r.includes(a)){await i();return}let o=`${a}:${e.request.url}`;n&&e.request.body&&(o+=`:${JSON.stringify(e.request.body)}`);try{e.response=await t.execute(o,async()=>(await i(),e.response)),e.state.deduped=!0}catch(t){throw e.error=t,t}}}var ne=C();function w(e){return async t=>{let n=-1;async function r(i){if(i<=n)throw Error(`next() called multiple times`);n=i;let a=e[i];a&&await a(t,()=>r(i+1))}await r(0)}}var re=class{middlewares=[];use(e){return this.middlewares.push(e),this}async execute(e){if(e&&typeof e==`object`&&`request`in e&&`response`in e){let t=e;return await w(this.middlewares.map(e=>typeof e==`function`&&e.length===2?e:async(t,n)=>{let r=e;t.response.body=await r(t.response.body),await n()}))(t),t.response.body}let t=e;for(let e of this.middlewares)t=await e(t);return t}clear(){this.middlewares=[]}};function ie(e,t,n,r={}){return{ok:e>=200&&e<300,data:t,error:n,status:e,headers:r}}function T(e){return async(t,n)=>{let r=e.path,i;switch(e.method){case`GET`:i=await t.get(r);break;case`POST`:i=await t.post(r,n);break;case`PUT`:i=await t.put(r,n);break;case`PATCH`:i=await t.patch(r,n);break;case`DELETE`:i=await t.delete(r);break;default:throw Error(`Unsupported method: ${e.method}`)}return i}}function ae(e){return{request:async(t,n,r)=>{let i=e[n];return await T(i)(t,r)}}}var E=class e{subscribers=[];errorSubscribers=[];completeSubscribers=[];subscribe(e,t,n){return e&&this.subscribers.push(e),t&&this.errorSubscribers.push(t),n&&this.completeSubscribers.push(n),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e),this.errorSubscribers=this.errorSubscribers.filter(e=>e!==t),this.completeSubscribers=this.completeSubscribers.filter(e=>e!==n)}}}next(e){this.subscribers.forEach(t=>t(e))}error(e){this.errorSubscribers.forEach(t=>t(e))}complete(){this.completeSubscribers.forEach(e=>e())}map(t){let n=new e;return this.subscribe(e=>n.next(t(e)),e=>n.error(e),()=>n.complete()),n}filter(t){let n=new e;return this.subscribe(e=>{t(e)&&n.next(e)},e=>n.error(e),()=>n.complete()),n}};function D(e){return t=>{if(!e(t))throw TypeError(`Value does not match expected type`);return t}}function O(e){return e}function k(e){return O(e)}var oe=class{_promise;resolveFunc;rejectFunc;constructor(){this._promise=new Promise((e,t)=>{this.resolveFunc=e,this.rejectFunc=t})}resolve(e){this.resolveFunc(e)}reject(e){this.rejectFunc(e)}get promise(){return this._promise}promise_(){return this._promise}};async function A(e,t={}){let n=e.body?.getReader();if(!n)throw Error(`Response body is not readable`);let r=[],i=0,a=parseInt(e.headers.get(`content-length`)||`0`,10);for(;;){let{done:e,value:o}=await n.read();if(e)break;r.push(o),i+=o.length,t.onChunk&&await t.onChunk(o),t.onProgress&&a>0&&t.onProgress(i,a)}return j(r,i)}function j(e,t){let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}async function se(e,t){let n=await A(e);if(typeof window>`u`)await(await import(`fs`).then(e=>e.promises)).writeFile(t,n);else{let e=new Blob([n.buffer],{type:`application/octet-stream`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}}function M(e={}){return async(t,n)=>{if(await n(),t.response&&t.response.body&&typeof t.response.body==`object`&&`getReader`in t.response.body){let n=t.response.body.getReader(),r=[],i=0,a=parseInt(t.response.headers?.[`content-length`]||`0`,10);try{for(;;){let{done:o,value:s}=await n.read();if(o)break;r.push(s),i+=s.length,e.onChunk&&await e.onChunk(s),e.onProgress&&a>0&&e.onProgress(i,a),t.state.streamedChunks=t.state.streamedChunks||[],t.state.streamedChunks.push(s)}let o=j(r,i);t.response.body=o,t.state.streaming=!0,t.state.streamedBytes=i}finally{n.releaseLock()}}}}var ce=M({onProgress:(e,t)=>{if(t>0){let n=Math.round(e/t*100);console.warn(`Streaming: ${n}% (${e}/${t} bytes)`)}}}),N=class{plugins=[];cache=new y;deduplicator=new S;middlewares=[];listeners=new Map;register(e){return this.plugins.push(e),e.setup(this),this.emit(`plugin:registered`,e.name),this}addMiddleware(e){return this.middlewares.push(e),this}getCache(){return this.cache}getDeduplicator(){return this.deduplicator}getPipeline(){return w(this.middlewares)}async executePipeline(e){await this.getPipeline()(e)}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);let n=this.listeners.get(e),r=t;return n&&n.add(r),this}emit(e,...t){let n=this.listeners.get(e);if(n)for(let e of n)e(...t)}off(e,t){return this.listeners.get(e)?.delete(t),this}getPlugins(){return[...this.plugins]}clear(){this.plugins=[],this.middlewares=[],this.listeners.clear(),this.cache.clear(),this.deduplicator.clear()}},le={name:`logger`,setup(e){e.on(`request:start`,(...e)=>{let t=e[0];console.warn(`Request started: ${t}`)}),e.on(`request:success`,(...e)=>{let t=e[0],n=e[1];console.warn(`Request succeeded: ${t} (${n})`)}),e.on(`request:error`,(...e)=>{let t=e[0],n=e[1];console.error(`❌ Request failed: ${t}`,n)})}},ue=class{name=`metrics`;metrics={requests:0,errors:0,totalTime:0,avgTime:0};setup(e){e.on(`request:complete`,(...e)=>{let t=e[0],n=e[1];this.metrics.requests++,this.metrics.totalTime+=t,this.metrics.avgTime=this.metrics.totalTime/this.metrics.requests,n||this.metrics.errors++})}getMetrics(){return{...this.metrics}}},de=class{name=`cache`;ttlMs;constructor(e=6e4){this.ttlMs=e}setup(e){e.addMiddleware(b({ttlMs:this.ttlMs}))}},fe=class{name=`dedupe`;setup(e){e.addMiddleware(C())}},pe=class{store=new y;get(e){return this.store.get(e)}set(e,t,n=6e4){this.store.set(e,t,n)}has(e){return this.store.has(e)}clear(){this.store.clear()}},P=class{maxAttempts;baseDelayMs;constructor(e=3,t=100){this.maxAttempts=e,this.baseDelayMs=t}shouldRetry(e,t){let n=t.status!==void 0&&t.status>=500,r=t.code===`NETWORK_ERROR`;return e<this.maxAttempts&&(n||r||t.code===`TIMEOUT`)}delayMs(e){let t=this.baseDelayMs*2**(e-1),n=Math.random()*t*.1;return Math.min(t+n,3e4)}},F=class{running=0;queue=[];maxConcurrent;constructor(e){this.maxConcurrent=e}async acquire(){if(this.running<this.maxConcurrent){this.running++;return}return new Promise(e=>{this.queue.push(()=>{this.running++,e()})})}release(){this.running--;let e=this.queue.shift();e&&e()}get pending(){return this.queue.length}get active(){return this.running}};function I(e){return e==null?{serialized:void 0,contentType:null}:typeof e==`string`?{serialized:e,contentType:`text/plain`}:typeof FormData<`u`&&e instanceof FormData?{serialized:e,contentType:null}:typeof URLSearchParams<`u`&&e instanceof URLSearchParams?{serialized:e,contentType:`application/x-www-form-urlencoded`}:typeof Blob<`u`&&e instanceof Blob?{serialized:e,contentType:e.type||`application/octet-stream`}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof ReadableStream<`u`&&e instanceof ReadableStream?{serialized:e,contentType:`application/octet-stream`}:{serialized:JSON.stringify(e),contentType:`application/json`}}function L(e,t){return t?e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(e,n)=>{let r=t[n];if(r===void 0)throw Error(`Missing path parameter: :${n}`);return encodeURIComponent(String(r))}):e}var R=class n{requestInterceptors=[];responseInterceptors=[];cache;devTracker;config;requestQueue;pendingRequests=new Set;constructor(e={}){this.config={baseURL:e.baseURL??``,defaultHeaders:e.defaultHeaders??{"Content-Type":`application/json`},defaultTimeout:e.defaultTimeout??3e4,validateStatus:e.validateStatus??(e=>e>=200&&e<300),cacheStrategy:e.cacheStrategy??new pe,maxConcurrent:e.maxConcurrent??0,defaultResponseType:e.defaultResponseType??`auto`,defaultHooks:e.defaultHooks??{},adapter:e.adapter},this.cache=this.config.cacheStrategy,this.requestQueue=this.config.maxConcurrent>0?new F(this.config.maxConcurrent):null,this.devTracker=e.devTracker??null}async request(n){if(!this.requestInterceptors.length&&!this.responseInterceptors.length&&!n.cache?.enabled&&!n.hooks&&!Object.keys(this.config.defaultHooks).length&&!n.retry&&!n.validate&&!n.transform&&!this.requestQueue&&!n.onDownloadProgress&&!n.signal)return this.fastPath(n);let r=n.hooks?{...this.config.defaultHooks,...n.hooks}:this.config.defaultHooks,i=this.getMaxAttempts(n.retry),a=this.getRetryStrategy(n.retry),o=this.buildRequest(n);r.onStart?.(o),this.requestQueue&&await this.requestQueue.acquire();try{for(let s=1;s<=i;s++){let c;try{if((n.method===`GET`||!n.method)&&n.cache?.enabled){let t=this.getCacheKey(n),i=this.cache.get(t);if(i){let t=i;return this.trackDev({method:n.method??`GET`,url:o.url,status:t.status,duration:t.duration,cached:!0,ok:!0,headers:{...o.headers},body:n.body,retryCount:0}),r.onSuccess?.(t),r.onFinally?.(),e(t)}}let t=o;for(let e of this.requestInterceptors)t=await e.onRequest(t);c=new AbortController,this.pendingRequests.add(c),n.signal&&n.signal.addEventListener(`abort`,()=>c.abort(),{once:!0});let i=performance.now(),a=await this.fetchWithTimeout(t,this.resolveTimeoutMs(n.timeout??this.config.defaultTimeout),c),l=performance.now()-i,u=a;n.onDownloadProgress&&a.body&&(u=this.trackDownloadProgress(a,n.onDownloadProgress));let d=n.responseType??this.config.defaultResponseType,f=await this.parseResponse(u,t,l,d);if(!this.config.validateStatus(f.status))throw{message:`Request failed with status ${f.status}`,status:f.status,statusText:f.statusText,code:`HTTP_ERROR`};if(n.validate){let e=n.validate.validate(f.data);if(!e.ok)return e}n.transform&&(f.data=n.transform.transform(f.data));let p=f;for(let e of this.responseInterceptors)p=await e.onResponse(p);if((n.method===`GET`||!n.method)&&n.cache?.enabled){let e=this.getCacheKey(n);this.cache.set(e,p,n.cache.ttlMs)}return r.onSuccess?.(p),this.pendingRequests.delete(c),this.trackDev({method:n.method??`GET`,url:o.url,status:p.status,duration:p.duration,cached:!1,ok:!0,headers:{...o.headers},body:n.body,retryCount:s-1}),e(p)}catch(e){let l;if(l=e instanceof DOMException?e.name===`TimeoutError`?{message:`Request timed out`,code:`TIMEOUT`}:e.name===`AbortError`?{message:`Request aborted`,code:`ABORTED`}:{message:e.message,code:`UNKNOWN_ERROR`,originalError:e}:this.isHttpErrorDetails(e)?e:this.normalizeError(e),s<i&&a.shouldRetry(s,l)){r.onRetry?.(s,l);let e=a.delayMs(s);await this.delay(e);continue}let u=l;for(let e of this.responseInterceptors)e.onError&&(u=await e.onError(u));return r.onError?.(u),c&&this.pendingRequests.delete(c),this.trackDev({method:n.method??`GET`,url:o.url,status:u.status,duration:0,cached:!1,ok:!1,code:u.code,headers:{...o.headers},body:n.body,retryCount:s-1}),t(u)}}let s={message:`Max retries exceeded`,code:`MAX_RETRIES`};return r.onError?.(s),this.trackDev({method:n.method??`GET`,url:o.url,duration:0,cached:!1,ok:!1,code:`MAX_RETRIES`,headers:{...o.headers},body:n.body,retryCount:i}),t(s)}finally{r.onFinally?.(),this.requestQueue&&this.requestQueue.release()}}async fastPath(n){let r=L(n.url,n.params),i=this.buildUrl(r,n.query),{serialized:a,contentType:o}=I(n.body),s={...this.config.defaultHeaders,...n.headers};o?s[`Content-Type`]=o:a instanceof FormData&&delete s[`Content-Type`];let c=new AbortController,l=this.resolveTimeoutMs(n.timeout??this.config.defaultTimeout);this.pendingRequests.add(c);try{let r=performance.now(),a=await this.fetchWithTimeout({url:i,method:n.method??`GET`,headers:s,body:n.body,params:n.params},l,c),o=performance.now()-r,u=await this.parseBody(a,n.responseType??this.config.defaultResponseType);if(!this.config.validateStatus(a.status)){let e=t({message:`Request failed with status ${a.status}`,status:a.status,statusText:a.statusText,code:`HTTP_ERROR`});return this.trackDev({method:n.method??`GET`,url:i,status:a.status,duration:o,cached:!1,ok:!1,code:`HTTP_ERROR`,headers:s,body:n.body,retryCount:0}),this.pendingRequests.delete(c),e}return this.pendingRequests.delete(c),this.trackDev({method:n.method??`GET`,url:i,status:a.status,duration:o,cached:!1,ok:!0,headers:s,body:n.body,retryCount:0}),e({status:a.status,statusText:a.statusText,headers:a.headers,data:u,request:{url:i,method:n.method??`GET`,headers:s,body:n.body,params:n.params},duration:o})}catch(e){this.pendingRequests.delete(c);let r=`UNKNOWN_ERROR`;if(e instanceof DOMException?e.name===`TimeoutError`?r=`TIMEOUT`:e.name===`AbortError`&&(r=`ABORTED`):e instanceof Error&&(e.name===`TimeoutError`?r=`TIMEOUT`:e.name===`AbortError`||e.message.includes(`abort`)?r=`ABORTED`:e.name===`TypeError`&&(r=`NETWORK_ERROR`)),this.trackDev({method:n.method??`GET`,url:i,duration:performance.now()-(performance.now()-0),cached:!1,ok:!1,code:r,headers:s,body:n.body,retryCount:0}),e instanceof DOMException){if(e.name===`TimeoutError`)return t({message:`Request timed out`,code:`TIMEOUT`});if(e.name===`AbortError`)return t({message:`Request aborted`,code:`ABORTED`})}return e instanceof Error?e.name===`TimeoutError`?t({message:`Request timed out`,code:`TIMEOUT`}):e.name===`AbortError`||e.message.includes(`abort`)?t({message:`Request aborted`,code:`ABORTED`}):t({message:e.message,code:e.name===`TypeError`?`NETWORK_ERROR`:`UNKNOWN_ERROR`}):t({message:String(e),code:`UNKNOWN_ERROR`})}}get(e,t){return this.request({...t,url:e,method:`GET`})}post(e,t,n){return this.request({...n,url:e,method:`POST`,body:t})}put(e,t,n){return this.request({...n,url:e,method:`PUT`,body:t})}patch(e,t,n){return this.request({...n,url:e,method:`PATCH`,body:t})}delete(e,t){return this.request({...t,url:e,method:`DELETE`})}head(e,t){return this.request({...t,url:e,method:`HEAD`})}options(e,t){return this.request({...t,url:e,method:`OPTIONS`})}addRequestInterceptor(e){return this.requestInterceptors.push(e),()=>{let t=this.requestInterceptors.indexOf(e);t!==-1&&this.requestInterceptors.splice(t,1)}}addResponseInterceptor(e){return this.responseInterceptors.push(e),()=>{let t=this.responseInterceptors.indexOf(e);t!==-1&&this.responseInterceptors.splice(t,1)}}clearInterceptors(){this.requestInterceptors=[],this.responseInterceptors=[]}clearCache(){this.cache.clear()}cancelAll(){for(let e of this.pendingRequests)e.abort();this.pendingRequests.clear()}get activeRequests(){return this.pendingRequests.size}get queueStats(){return{active:this.requestQueue?.active??this.pendingRequests.size,pending:this.requestQueue?.pending??0}}extend(e={}){let t=new n({baseURL:e.baseURL??this.config.baseURL,defaultHeaders:{...this.config.defaultHeaders,...e.defaultHeaders},defaultTimeout:e.defaultTimeout??this.config.defaultTimeout,validateStatus:e.validateStatus??this.config.validateStatus,cacheStrategy:e.cacheStrategy??this.cache,maxConcurrent:e.maxConcurrent??this.config.maxConcurrent,defaultResponseType:e.defaultResponseType??this.config.defaultResponseType,defaultHooks:{...this.config.defaultHooks,...e.defaultHooks},adapter:e.adapter});for(let e of this.requestInterceptors)t.addRequestInterceptor(e);for(let e of this.responseInterceptors)t.addResponseInterceptor(e);return t}async*paginate(e,t,n={}){let r={...n};for(;;){let n=await this.get(e,r);if(!n.ok)break;yield t.getItems(n.value.data);let i=t.getNextPage(n.value.data,r);if(!i)break;r=i}}async poll(e,n,r={}){let i=n.maxAttempts??0;for(let t=1;i===0||t<=i;t++){let a=await this.get(e,r);if(!a.ok||(n.onPoll?.(a.value.data,t),n.until(a.value.data)))return a;if(i>0&&t>=i)break;await this.delay(n.intervalMs)}return t({message:`Polling exhausted after ${i} attempts`,code:`POLL_EXHAUSTED`})}buildRequest(e){let t=L(e.url,e.params);return{url:this.buildUrl(t,e.query),method:e.method??`GET`,headers:{...this.config.defaultHeaders,...e.headers},body:e.body,params:e.params}}buildUrl(e,t){let n=this.config.baseURL+e;if(t){let e=Object.keys(t);if(e.length>0){let r=new URLSearchParams;for(let n=0;n<e.length;n++)r.append(e[n],String(t[e[n]]));n+=`?${r.toString()}`}}return n}getCacheKey(e){let t=L(e.url,e.params),n=e.query?JSON.stringify(e.query):``;return`${e.method??`GET`}:${t}${n?`:`+n:``}`}fetchWithTimeout(e,t,n){let{serialized:r,contentType:i}=I(e.body),a={...e.headers};return i?a[`Content-Type`]=i:r instanceof FormData&&delete a[`Content-Type`],new Promise((i,o)=>{let s=setTimeout(()=>{n.abort(),o(new DOMException(`Request timed out`,`TimeoutError`))},t);(this.config.adapter??fetch)(e.url,{method:e.method,headers:a,body:r,signal:n.signal}).then(e=>{clearTimeout(s),i(e)},e=>{clearTimeout(s),o(e)})})}trackDownloadProgress(e,t){let n=parseInt(e.headers.get(`content-length`)||`0`,10),r=e.body?.getReader();if(!r)return e;let i=0,a=new ReadableStream({async pull(e){let{done:a,value:o}=await r.read();if(a){e.close();return}i+=o.byteLength,t({loaded:i,total:n,percent:n>0?Math.round(i/n*100):0}),e.enqueue(o)}});return new Response(a,{headers:e.headers,status:e.status,statusText:e.statusText})}async parseResponse(e,t,n,r){let i=await this.parseBody(e,r);return{status:e.status,statusText:e.statusText,headers:e.headers,data:i,request:t,duration:n}}async parseBody(e,t){switch(t){case`json`:return await e.json();case`text`:return await e.text();case`blob`:return await e.blob();case`arrayBuffer`:return await e.arrayBuffer();case`formData`:return await e.formData();case`stream`:return e.body;default:{let t=e.headers.get(`content-type`)??``;if(t.includes(`application/json`))return await e.json();if(t.includes(`text/`))return await e.text();if(t.includes(`multipart/form-data`))return await e.formData();if(t.includes(`application/octet-stream`)||t.includes(`image/`)||t.includes(`audio/`)||t.includes(`video/`))return await e.blob();try{return await e.json()}catch{return await e.text()}}}}normalizeError(e){if(e instanceof DOMException){if(e.name===`TimeoutError`)return{message:`Request timed out`,code:`TIMEOUT`};if(e.name===`AbortError`)return{message:`Request aborted`,code:`ABORTED`}}return e instanceof Error?e.name===`TimeoutError`?{message:`Request timed out`,code:`TIMEOUT`}:e.name===`AbortError`||e.message.includes(`abort`)?{message:`Request aborted`,code:`ABORTED`}:{message:e.message,code:e.name===`TypeError`?`NETWORK_ERROR`:`UNKNOWN_ERROR`,originalError:e}:{message:String(e),code:`UNKNOWN_ERROR`,originalError:e}}isHttpErrorDetails(e){return typeof e==`object`&&!!e&&`message`in e&&`code`in e}getMaxAttempts(e){return e?`maxAttempts`in e?e.maxAttempts??1:100:1}getRetryStrategy(e){return e?`shouldRetry`in e?e:new P(e.maxAttempts,e.backoffMs):{shouldRetry:()=>!1,delayMs:()=>0}}resolveTimeoutMs(e){return typeof e==`number`?e:e.total??e.response??e.connection??3e4}delay(e){return new Promise(t=>setTimeout(t,e))}trackDev(e){this.devTracker&&this.devTracker.track(e)}},z=class extends Error{status;code;response;constructor(e,t,n,r){super(e),this.name=`HttpError`,this.status=t,this.code=n,this.response=r}};function B(e){return e instanceof z}function me(e){return new R(e)}function V(){return typeof window>`u`&&typeof process<`u`&&process.versions?.node!==void 0}var he=class{url;options;pluginManager;status=`closed`;reconnectAttempt=0;reconnectTimer=null;heartbeatTimer=null;stats={messagesSent:0,messagesReceived:0,connectionTime:0,reconnectAttempts:0};connectionStartTime=0;listeners={open:new Set,close:new Set,error:new Set,message:new Set};constructor(e,t={}){this.url=e,this.options=t,this.pluginManager=new N}updateStatus(e){this.status=e,e===`open`?this.connectionStartTime=Date.now():e===`closed`&&this.connectionStartTime>0&&(this.stats.connectionTime+=Date.now()-this.connectionStartTime,this.connectionStartTime=0)}emitOpen(e){this.pluginManager.emit(`websocket:open`,this.url,e);for(let t of this.listeners.open)t(e)}emitClose(e){this.pluginManager.emit(`websocket:close`,this.url,e);for(let t of this.listeners.close)t(e)}emitError(e){let t;e instanceof Error?(t=new Event(`error`),t.error=e):t=e,this.pluginManager.emit(`websocket:error`,this.url,t);for(let e of this.listeners.error)e(t)}emitMessage(e){this.pluginManager.emit(`websocket:message`,this.url,e);for(let t of this.listeners.message)t(e)}onOpen(e){return this.listeners.open.add(e),()=>this.listeners.open.delete(e)}onClose(e){return this.listeners.close.add(e),()=>this.listeners.close.delete(e)}onError(e){return this.listeners.error.add(e),()=>this.listeners.error.delete(e)}onMessage(e){return this.listeners.message.add(e),()=>this.listeners.message.delete(e)}getStatus(){return this.status}getStats(){return{...this.stats,connectionTime:this.stats.connectionTime+(this.connectionStartTime>0?Date.now()-this.connectionStartTime:0)}}scheduleReconnect(){if(this.options.reconnect?.enabled===!1)return;let e=this.options.reconnect?.maxAttempts??1/0;if(this.reconnectAttempt>=e){this.pluginManager.emit(`websocket:reconnect:failed`,this.url,this.reconnectAttempt);return}let t=this.options.reconnect?.baseDelay??1e3,n=this.options.reconnect?.maxDelay??3e4,r=Math.min(n,t*2**this.reconnectAttempt);this.reconnectAttempt++,this.stats.reconnectAttempts=this.reconnectAttempt,this.options.reconnect?.onReconnecting?.(this.reconnectAttempt,r),this.pluginManager.emit(`websocket:reconnecting`,this.url,this.reconnectAttempt,r),this.reconnectTimer=setTimeout(()=>{this.connect().catch(e=>{this.emitError(e instanceof Error?e:Error(String(e)))})},r)}startHeartbeat(){if(!this.options.heartbeat)return;let e=this.options.heartbeat.interval??3e4,t=this.options.heartbeat.pingMessage??`ping`,n=this.options.heartbeat.pongMessage??`pong`,r=!0,i=()=>{if(!r){this.pluginManager.emit(`websocket:heartbeat:timeout`,this.url),this.disconnect();return}r=!1,this.send(t),this.heartbeatTimer=setTimeout(i,e)};this.onMessage(e=>{let t=e.raw;typeof t==`string`&&t===n&&(r=!0)}),this.heartbeatTimer=setTimeout(i,e)}stopHeartbeat(){this.heartbeatTimer&&=(clearTimeout(this.heartbeatTimer),null)}cleanup(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.stopHeartbeat()}},H=class extends he{socket=null;messageTypeListeners=new Map;constructor(e,t={}){super(e,t)}async connect(){if(!(this.status===`connecting`||this.status===`open`))return this.updateStatus(`connecting`),this.pluginManager.emit(`websocket:connect:start`,this.url),new Promise((e,t)=>{let n=this.options.timeout??1e4,r=setTimeout(()=>{this.updateStatus(`closed`),this.socket?.close(),this.socket=null;let e=Error(`WebSocket connection timeout after ${n}ms`);this.emitError(e),t(e)},n);try{this.socket=new WebSocket(this.url,this.options.protocols),this.socket.onopen=t=>{clearTimeout(r),this.updateStatus(`open`),this.reconnectAttempt=0,this.emitOpen(t),this.options.onOpen?.(t),this.startHeartbeat(),this.pluginManager.emit(`websocket:connect:success`,this.url),e()},this.socket.onclose=e=>{clearTimeout(r),this.updateStatus(`closed`),this.emitClose(e),this.options.onClose?.(e),this.stopHeartbeat(),this.pluginManager.emit(`websocket:disconnected`,this.url,e.code,e.reason),e.code!==1e3&&!e.wasClean&&this.scheduleReconnect()},this.socket.onerror=e=>{clearTimeout(r),this.updateStatus(`closed`),this.emitError(e),this.options.onError?.(e),this.pluginManager.emit(`websocket:connect:error`,this.url,e),t(e)},this.socket.onmessage=e=>{this.stats.messagesReceived++;let t={data:this.tryParseData(e.data),raw:e.data,type:`message`,timestamp:Date.now()};this.emitMessage(t),this.pluginManager.emit(`websocket:message:received`,this.url,t)}}catch(e){clearTimeout(r),this.updateStatus(`closed`),this.pluginManager.emit(`websocket:connect:error`,this.url,e),t(e)}})}disconnect(){this.cleanup(),this.socket&&(this.updateStatus(`closing`),this.socket.close(1e3,`Client disconnected`),this.socket=null,this.updateStatus(`closed`))}send(e){if(!this.socket||this.socket.readyState!==WebSocket.OPEN)throw Error(`WebSocket is not connected`);this.socket.send(e),this.stats.messagesSent++,this.pluginManager.emit(`websocket:message:sent`,this.url,e)}sendJson(e){this.send(JSON.stringify(e))}onMessageType(e,t){return this.messageTypeListeners.has(e)||this.messageTypeListeners.set(e,new Set),this.messageTypeListeners.get(e).add(t),()=>{let n=this.messageTypeListeners.get(e);n&&(n.delete(t),n.size===0&&this.messageTypeListeners.delete(e))}}tryParseData(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}},ge=class extends H{async connect(){if(V())try{let{default:e}=await import(`ws`);return super.connect()}catch{throw Error(`WebSocket client for Node.js requires the "ws" package. Please install it: npm install ws`)}return super.connect()}};function _e(e,t={}){return V()?new ge(e,t):new H(e,t)}function U(){return typeof window>`u`&&typeof process<`u`&&process.versions?.node!==void 0}var W=class{url;options;_source=null;pluginManager;status=`closed`;reconnectAttempt=0;reconnectTimer=null;stats={messagesSent:0,messagesReceived:0,connectionTime:0,reconnectAttempts:0};connectionStartTime=0;listeners={open:new Set,close:new Set,error:new Set,message:new Set,event:new Map};_lastEventId=null;constructor(e,t={}){this.url=e,this.options=t,this.pluginManager=new N}updateStatus(e){this.status=e,e===`open`?this.connectionStartTime=Date.now():e===`closed`&&this.connectionStartTime>0&&(this.stats.connectionTime+=Date.now()-this.connectionStartTime,this.connectionStartTime=0)}async connect(){if(!(this.status===`connecting`||this.status===`open`))return this.updateStatus(`connecting`),this.pluginManager.emit(`sse:connect:start`,this.url),new Promise((e,t)=>{let n=this.options.timeout??1e4,r=setTimeout(()=>{this.updateStatus(`closed`),this._source?.close(),this._source=null;let e=Error(`SSE connection timeout after ${n}ms`);this.emitError(e),t(e)},n);try{this._source=new EventSource(this.url),this._source.onopen=t=>{clearTimeout(r),this.updateStatus(`open`),this.reconnectAttempt=0,this.emitOpen(t),this.options.onOpen?.(t),this.pluginManager.emit(`sse:connect:success`,this.url),e()},this._source.onerror=e=>{clearTimeout(r),this.updateStatus(`closed`),this.emitError(e),this.options.onError?.(e),this.pluginManager.emit(`sse:connect:error`,this.url,e),this._source?.readyState===EventSource.CLOSED&&(this.emitClose(),this.options.onClose?.(),this.scheduleReconnect()),t(e)},this._source.onmessage=e=>{this.stats.messagesReceived++,this._lastEventId=e.lastEventId||this._lastEventId;let t={data:this.tryParseData(e.data),raw:e.data,type:e.type||`message`,timestamp:Date.now()};this.emitMessage(t),this.pluginManager.emit(`sse:message:received`,this.url,t);let n=e.type||`message`,r=this.listeners.event.get(n);if(r)for(let e of r)e(t.data)},this._source.addEventListener=this._source.addEventListener.bind(this._source)}catch(e){clearTimeout(r),this.updateStatus(`closed`),this.pluginManager.emit(`sse:connect:error`,this.url,e),t(e)}})}disconnect(){this.cleanup(),this._source&&(this.updateStatus(`closing`),this._source.close(),this._source=null,this.updateStatus(`closed`),this.emitClose(),this.options.onClose?.())}send(e){throw Error(`SSE is a receive-only protocol. Use HTTP requests to send data to server.`)}onMessage(e){return this.listeners.message.add(e),()=>this.listeners.message.delete(e)}onOpen(e){return this.listeners.open.add(e),()=>this.listeners.open.delete(e)}onClose(e){return this.listeners.close.add(e),()=>this.listeners.close.delete(e)}onError(e){return this.listeners.error.add(e),()=>this.listeners.error.delete(e)}onEvent(e,t){return this.listeners.event.has(e)||this.listeners.event.set(e,new Set),this.listeners.event.get(e).add(t),this._source&&!this._source[`on${e}`]&&this._source.addEventListener(e,n=>{t({data:this.tryParseData(n.data),raw:n.data,type:e,timestamp:Date.now()}.data)}),()=>{let n=this.listeners.event.get(e);n&&(n.delete(t),n.size===0&&this.listeners.event.delete(e))}}getStatus(){return this.status}getStats(){return{...this.stats,connectionTime:this.stats.connectionTime+(this.connectionStartTime>0?Date.now()-this.connectionStartTime:0)}}get lastEventId(){return this._lastEventId}get source(){return this._source}emitOpen(e){this.pluginManager.emit(`sse:open`,this.url,e);for(let t of this.listeners.open)t(e)}emitClose(){this.pluginManager.emit(`sse:close`,this.url);for(let e of this.listeners.close)e()}emitError(e){let t;e instanceof Error?(t=new Event(`error`),t.error=e):t=e,this.pluginManager.emit(`sse:error`,this.url,t);for(let e of this.listeners.error)e(t)}emitMessage(e){this.pluginManager.emit(`sse:message`,this.url,e);for(let t of this.listeners.message)t(e)}scheduleReconnect(){if(this.options.reconnect?.enabled===!1)return;let e=this.options.reconnect?.maxAttempts??1/0;if(this.reconnectAttempt>=e){this.pluginManager.emit(`sse:reconnect:failed`,this.url,this.reconnectAttempt);return}let t=this.options.reconnect?.baseDelay??1e3,n=this.options.reconnect?.maxDelay??3e4,r=Math.min(n,t*2**this.reconnectAttempt);this.reconnectAttempt++,this.stats.reconnectAttempts=this.reconnectAttempt,this.options.reconnect?.onReconnecting?.(this.reconnectAttempt,r),this.pluginManager.emit(`sse:reconnecting`,this.url,this.reconnectAttempt,r),this.reconnectTimer=setTimeout(()=>{this.connect().catch(e=>{this.emitError(e instanceof Error?e:Error(String(e)))})},r)}cleanup(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null)}tryParseData(e){try{return JSON.parse(e)}catch{return e}}},ve=class extends W{async connect(){if(U())throw Error(`SSE client for Node.js requires a polyfill or custom implementation. Consider using a library like "eventsource" or implement using fetch with streaming.`);return super.connect()}};function ye(e,t={}){return U()?new ve(e,t):new W(e,t)}var be=class{name=`realtime`;setup(e){e.on(`websocket:connect:start`,(...t)=>{let n=t[0];e.emit(`realtime:connect:start`,`websocket`,n)}),e.on(`websocket:connect:success`,(...t)=>{let n=t[0];e.emit(`realtime:connect:success`,`websocket`,n)}),e.on(`websocket:message:received`,(...t)=>{let n=t[0],r=t[1];e.emit(`realtime:message`,`websocket`,n,r)}),e.on(`sse:connect:start`,(...t)=>{let n=t[0];e.emit(`realtime:connect:start`,`sse`,n)}),e.on(`sse:connect:success`,(...t)=>{let n=t[0];e.emit(`realtime:connect:success`,`sse`,n)}),e.on(`sse:message:received`,(...t)=>{let n=t[0],r=t[1];e.emit(`realtime:message`,`sse`,n,r)})}};function xe(){return new be}var G=`nexa.devOverlay.config`;function K(){try{if(typeof localStorage>`u`)return{};let e=localStorage.getItem(G);return e?JSON.parse(e):{}}catch{return{}}}function Se(e){try{if(typeof localStorage>`u`)return;localStorage.setItem(G,JSON.stringify(e))}catch{}}var q=class{history=[];maxHistory;listeners=new Set;startTime=Date.now();config;constructor(e={}){this.maxHistory=e.maxHistory??500,this.config={enabled:e.enabled??!0,maxHistory:this.maxHistory,keyboardShortcut:e.keyboardShortcut??`ctrl+shift+n`,position:e.position??`bottom-right`,theme:e.theme??`dark`,devOnly:e.devOnly??!0,floatingButtonSize:e.floatingButtonSize??48,floatingButtonOffset:e.floatingButtonOffset??24,floatingButtonTheme:e.floatingButtonTheme??`inherit`,branding:e.branding??`Nexa DevTools`,icon:e.icon??`https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png`}}track(e){let t={...e,id:this.generateId(),timestamp:Date.now()};this.history.unshift(t),this.history.length>this.maxHistory&&this.history.pop();for(let e of this.listeners)e(t);return t}getHistory(){return this.history}getMetrics(){let e=this.history.map(e=>e.duration),t=(Date.now()-this.startTime)/1e3;return{totalRequests:this.history.length,successfulRequests:this.history.filter(e=>e.ok).length,failedRequests:this.history.filter(e=>!e.ok).length,cachedRequests:this.history.filter(e=>e.cached).length,avgDuration:e.length?e.reduce((e,t)=>e+t,0)/e.length:0,maxDuration:e.length?Math.max(...e):0,minDuration:e.length?Math.min(...e):0,requestsPerSecond:t>0?this.history.length/t:0,slowestRequests:[...this.history].sort((e,t)=>t.duration-e.duration).slice(0,5)}}clear(){this.history=[],this.startTime=Date.now()}onChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getConfig(){return this.config}updateConfig(e){this.config={...this.config,...e},this.maxHistory=this.config.maxHistory;try{Se(this.config)}catch{}return this.config}generateId(){return`${Date.now()}-${Math.random().toString(36).slice(2,8)}`}},J={gear:`<svg width="16" height="16" viewBox="0 0 48 48" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M 24 4 C 22.423103 4 20.902664 4.1994284 19.451172 4.5371094 A 1.50015 1.50015 0 0 0 18.300781 5.8359375 L 17.982422 8.7382812 C 17.878304 9.6893592 17.328913 10.530853 16.5 11.009766 C 15.672739 11.487724 14.66862 11.540667 13.792969 11.15625 L 13.791016 11.15625 L 11.125 9.9824219 A 1.50015 1.50015 0 0 0 9.4257812 10.330078 C 7.3532865 12.539588 5.7626807 15.215064 4.859375 18.201172 A 1.50015 1.50015 0 0 0 5.4082031 19.845703 L 7.7734375 21.580078 C 8.5457929 22.147918 9 23.042801 9 24 C 9 24.95771 8.5458041 25.853342 7.7734375 26.419922 L 5.4082031 28.152344 A 1.50015 1.50015 0 0 0 4.859375 29.796875 C 5.7625845 32.782665 7.3519262 35.460112 9.4257812 37.669922 A 1.50015 1.50015 0 0 0 11.125 38.015625 L 13.791016 36.841797 C 14.667094 36.456509 15.672169 36.511947 16.5 36.990234 C 17.328913 37.469147 17.878304 38.310641 17.982422 39.261719 L 18.300781 42.164062 A 1.50015 1.50015 0 0 0 19.449219 43.460938 C 20.901371 43.799844 22.423103 44 24 44 C 25.576897 44 27.097336 43.800572 28.548828 43.462891 A 1.50015 1.50015 0 0 0 29.699219 42.164062 L 30.017578 39.261719 C 30.121696 38.310641 30.671087 37.469147 31.5 36.990234 C 32.327261 36.512276 33.33138 36.45738 34.207031 36.841797 L 36.875 38.015625 A 1.50015 1.50015 0 0 0 38.574219 37.669922 C 40.646713 35.460412 42.237319 32.782983 43.140625 29.796875 A 1.50015 1.50015 0 0 0 42.591797 28.152344 L 40.226562 26.419922 C 39.454197 25.853342 39 24.95771 39 24 C 39 23.04229 39.454197 22.146658 40.226562 21.580078 L 42.591797 19.847656 A 1.50015 1.50015 0 0 0 43.140625 18.203125 C 42.237319 15.217017 40.646713 12.539588 38.574219 10.330078 A 1.50015 1.50015 0 0 0 36.875 9.984375 L 34.207031 11.158203 C 33.33138 11.54262 32.327261 11.487724 31.5 11.009766 C 30.671087 10.530853 30.121696 9.6893592 30.017578 8.7382812 L 29.699219 5.8359375 A 1.50015 1.50015 0 0 0 28.550781 4.5390625 C 27.098629 4.2001555 25.576897 4 24 4 z M 24 7 C 24.974302 7 25.90992 7.1748796 26.847656 7.3398438 L 27.035156 9.0644531 C 27.243038 10.963375 28.346913 12.652335 30 13.607422 C 31.654169 14.563134 33.668094 14.673009 35.416016 13.904297 L 37.001953 13.207031 C 38.219788 14.669402 39.183985 16.321182 39.857422 18.130859 L 38.451172 19.162109 C 36.911538 20.291529 36 22.08971 36 24 C 36 25.91029 36.911538 27.708471 38.451172 28.837891 L 39.857422 29.869141 C 39.183985 31.678818 38.219788 33.330598 37.001953 34.792969 L 35.416016 34.095703 C 33.668094 33.326991 31.654169 33.436866 30 34.392578 C 28.346913 35.347665 27.243038 37.036625 27.035156 38.935547 L 26.847656 40.660156 C 25.910002 40.82466 24.973817 41 24 41 C 23.025698 41 22.09008 40.82512 21.152344 40.660156 L 20.964844 38.935547 C 20.756962 37.036625 19.653087 35.347665 18 34.392578 C 16.345831 33.436866 14.331906 33.326991 12.583984 34.095703 L 10.998047 34.792969 C 9.7799772 33.330806 8.8159425 31.678964 8.1425781 29.869141 L 9.5488281 28.837891 C 11.088462 27.708471 12 25.91029 12 24 C 12 22.08971 11.087719 20.290363 9.5488281 19.160156 L 8.1425781 18.128906 C 8.8163325 16.318532 9.7814501 14.667839 11 13.205078 L 12.583984 13.902344 C 14.331906 14.671056 16.345831 14.563134 18 13.607422 C 19.653087 12.652335 20.756962 10.963375 20.964844 9.0644531 L 21.152344 7.3398438 C 22.089998 7.1753403 23.026183 7 24 7 z M 24 16 C 19.599487 16 16 19.59949 16 24 C 16 28.40051 19.599487 32 24 32 C 28.400513 32 32 28.40051 32 24 C 32 19.59949 28.400513 16 24 16 z M 24 19 C 26.779194 19 29 21.220808 29 24 C 29 26.779192 26.779194 29 24 29 C 21.220806 29 19 26.779192 19 24 C 19 21.220808 21.220806 19 24 19 z"></path>
|
|
3
|
+
</svg>`,close:`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg>`,chevron:`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18l6-6-6-6"/></svg>`,back:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>`,retry:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 4v6h6M23 20v-6h-6"/><path d="M20.49 9A9 9 0 005.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 013.51 15"/></svg>`,clear:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>`,search:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/></svg>`,clock:`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>`,zap:`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,download:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`,copy:`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>`},Y={bg:`#0b1120`,bgElevated:`#111827`,bgSurface:`#172033`,border:`#24324a`,borderFocus:`#35507a`,text:`#e5eefb`,textMuted:`#b4c4dd`,textDim:`#7f93b3`,accent:`#38bdf8`,accentHover:`#0ea5e9`,accentSoft:`rgba(56, 189, 248, 0.18)`,success:`#34d399`,successBg:`rgba(52, 211, 153, 0.16)`,error:`#fb7185`,errorBg:`rgba(251, 113, 133, 0.16)`,warning:`#fbbf24`,warningBg:`rgba(251, 191, 36, 0.16)`,info:`#a78bfa`,infoBg:`rgba(167, 139, 250, 0.16)`,get:`#34d399`,post:`#38bdf8`,put:`#fbbf24`,patch:`#a78bfa`,delete:`#fb7185`},Ce=`
|
|
2
4
|
#nexa-dev-overlay * { margin: 0; padding: 0; box-sizing: border-box; }
|
|
3
5
|
#nexa-dev-overlay {
|
|
4
6
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
5
|
-
background: ${
|
|
6
|
-
color: ${
|
|
7
|
-
border: 1px solid ${
|
|
7
|
+
background: ${Y.bg};
|
|
8
|
+
color: ${Y.text};
|
|
9
|
+
border: 1px solid ${Y.border};
|
|
8
10
|
border-radius: 16px;
|
|
9
|
-
box-shadow: 0
|
|
11
|
+
box-shadow: 0 28px 60px -24px rgba(2, 6, 23, 0.78), 0 0 0 1px rgba(148, 163, 184, 0.08);
|
|
10
12
|
overflow: hidden;
|
|
11
13
|
}
|
|
12
14
|
#nexa-dev-overlay .nexa-header {
|
|
@@ -14,8 +16,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
14
16
|
align-items: center;
|
|
15
17
|
justify-content: space-between;
|
|
16
18
|
padding: 16px 20px;
|
|
17
|
-
border-bottom: 1px solid ${
|
|
18
|
-
background: ${
|
|
19
|
+
border-bottom: 1px solid ${Y.border};
|
|
20
|
+
background: ${Y.bgElevated};
|
|
19
21
|
}
|
|
20
22
|
#nexa-dev-overlay .nexa-header-left {
|
|
21
23
|
display: flex;
|
|
@@ -28,7 +30,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
28
30
|
display: flex;
|
|
29
31
|
align-items: center;
|
|
30
32
|
justify-content: center;
|
|
31
|
-
background: ${
|
|
33
|
+
background: linear-gradient(135deg, ${Y.accentSoft}, rgba(255,255,255,0.02));
|
|
32
34
|
border-radius: 8px;
|
|
33
35
|
overflow: hidden;
|
|
34
36
|
}
|
|
@@ -50,20 +52,20 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
50
52
|
background: transparent;
|
|
51
53
|
border: none;
|
|
52
54
|
border-radius: 8px;
|
|
53
|
-
color: ${
|
|
55
|
+
color: ${Y.textMuted};
|
|
54
56
|
cursor: pointer;
|
|
55
57
|
transition: all 0.15s;
|
|
56
58
|
}
|
|
57
59
|
#nexa-dev-overlay .nexa-icon-btn:hover {
|
|
58
|
-
background: ${
|
|
59
|
-
color: ${
|
|
60
|
+
background: ${Y.bgSurface};
|
|
61
|
+
color: ${Y.text};
|
|
60
62
|
}
|
|
61
63
|
#nexa-dev-overlay .nexa-metrics-bar {
|
|
62
64
|
display: flex;
|
|
63
65
|
gap: 4px;
|
|
64
66
|
padding: 12px 16px;
|
|
65
|
-
background: ${
|
|
66
|
-
border-bottom: 1px solid ${
|
|
67
|
+
background: ${Y.bg};
|
|
68
|
+
border-bottom: 1px solid ${Y.border};
|
|
67
69
|
}
|
|
68
70
|
#nexa-dev-overlay .nexa-metric {
|
|
69
71
|
flex: 1;
|
|
@@ -72,30 +74,30 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
72
74
|
align-items: center;
|
|
73
75
|
gap: 2px;
|
|
74
76
|
padding: 8px 12px;
|
|
75
|
-
background: ${
|
|
77
|
+
background: ${Y.bgSurface};
|
|
76
78
|
border-radius: 10px;
|
|
77
79
|
transition: all 0.2s;
|
|
78
80
|
}
|
|
79
81
|
#nexa-dev-overlay .nexa-metric:hover {
|
|
80
|
-
background:
|
|
82
|
+
background: rgba(53, 80, 122, 0.3);
|
|
81
83
|
}
|
|
82
84
|
#nexa-dev-overlay .nexa-metric-value {
|
|
83
85
|
font-size: 18px;
|
|
84
86
|
font-weight: 700;
|
|
85
87
|
letter-spacing: -0.03em;
|
|
86
|
-
color: ${
|
|
88
|
+
color: ${Y.text};
|
|
87
89
|
}
|
|
88
|
-
#nexa-dev-overlay .nexa-metric-ok .nexa-metric-value { color: ${
|
|
89
|
-
#nexa-dev-overlay .nexa-metric-err .nexa-metric-value { color: ${
|
|
90
|
+
#nexa-dev-overlay .nexa-metric-ok .nexa-metric-value { color: ${Y.success}; }
|
|
91
|
+
#nexa-dev-overlay .nexa-metric-err .nexa-metric-value { color: ${Y.error}; }
|
|
90
92
|
#nexa-dev-overlay .nexa-metric-label {
|
|
91
93
|
font-size: 11px;
|
|
92
|
-
color: ${
|
|
94
|
+
color: ${Y.textDim};
|
|
93
95
|
text-transform: uppercase;
|
|
94
96
|
letter-spacing: 0.05em;
|
|
95
97
|
}
|
|
96
98
|
#nexa-dev-overlay .nexa-search {
|
|
97
99
|
padding: 12px 16px;
|
|
98
|
-
border-bottom: 1px solid ${
|
|
100
|
+
border-bottom: 1px solid ${Y.border};
|
|
99
101
|
position: relative;
|
|
100
102
|
}
|
|
101
103
|
#nexa-dev-overlay .nexa-search-icon {
|
|
@@ -103,29 +105,57 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
103
105
|
left: 28px;
|
|
104
106
|
top: 50%;
|
|
105
107
|
transform: translateY(-50%);
|
|
106
|
-
color: ${
|
|
108
|
+
color: ${Y.textDim};
|
|
107
109
|
}
|
|
108
110
|
#nexa-dev-overlay .nexa-search-input {
|
|
109
111
|
width: 100%;
|
|
110
112
|
padding: 10px 12px 10px 38px;
|
|
111
|
-
background: ${
|
|
112
|
-
border: 1px solid ${
|
|
113
|
+
background: ${Y.bg};
|
|
114
|
+
border: 1px solid ${Y.border};
|
|
113
115
|
border-radius: 10px;
|
|
114
|
-
color: ${
|
|
116
|
+
color: ${Y.text};
|
|
115
117
|
font-size: 13px;
|
|
116
118
|
outline: none;
|
|
117
119
|
transition: all 0.15s;
|
|
118
120
|
}
|
|
119
121
|
#nexa-dev-overlay .nexa-search-input:focus {
|
|
120
|
-
border-color: ${
|
|
121
|
-
box-shadow: 0 0 0 3px
|
|
122
|
+
border-color: ${Y.accent};
|
|
123
|
+
box-shadow: 0 0 0 3px ${Y.accentSoft};
|
|
124
|
+
}
|
|
125
|
+
#nexa-dev-overlay .nexa-search-input::placeholder { color: ${Y.textDim}; }
|
|
126
|
+
#nexa-dev-overlay .nexa-filters {
|
|
127
|
+
display: flex;
|
|
128
|
+
gap: 6px;
|
|
129
|
+
padding: 12px 16px 12px 16px;
|
|
130
|
+
border-bottom: 1px solid ${Y.border};
|
|
131
|
+
overflow-x: auto;
|
|
132
|
+
scrollbar-width: none;
|
|
133
|
+
min-height: 50px;
|
|
134
|
+
}
|
|
135
|
+
#nexa-dev-overlay .nexa-filters::-webkit-scrollbar { display: none; }
|
|
136
|
+
#nexa-dev-overlay .nexa-filter-chip {
|
|
137
|
+
padding: 4px 10px;
|
|
138
|
+
background: ${Y.bgSurface};
|
|
139
|
+
border: 1px solid ${Y.border};
|
|
140
|
+
border-radius: 20px;
|
|
141
|
+
color: ${Y.textDim};
|
|
142
|
+
font-size: 11px;
|
|
143
|
+
font-weight: 600;
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
transition: all 0.15s;
|
|
147
|
+
}
|
|
148
|
+
#nexa-dev-overlay .nexa-filter-chip:hover { border-color: ${Y.borderFocus}; color: ${Y.textMuted}; }
|
|
149
|
+
#nexa-dev-overlay .nexa-filter-chip-active {
|
|
150
|
+
background: ${Y.accentSoft};
|
|
151
|
+
border-color: ${Y.accent};
|
|
152
|
+
color: ${Y.accent};
|
|
122
153
|
}
|
|
123
|
-
#nexa-dev-overlay .nexa-search-input::placeholder { color: ${X.textDim}; }
|
|
124
154
|
#nexa-dev-overlay .nexa-tabs {
|
|
125
155
|
display: flex;
|
|
126
156
|
gap: 4px;
|
|
127
157
|
padding: 8px 16px;
|
|
128
|
-
border-bottom: 1px solid ${
|
|
158
|
+
border-bottom: 1px solid ${Y.border};
|
|
129
159
|
}
|
|
130
160
|
#nexa-dev-overlay .nexa-tab {
|
|
131
161
|
display: flex;
|
|
@@ -135,18 +165,18 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
135
165
|
background: transparent;
|
|
136
166
|
border: none;
|
|
137
167
|
border-radius: 8px;
|
|
138
|
-
color: ${
|
|
168
|
+
color: ${Y.textMuted};
|
|
139
169
|
font-size: 13px;
|
|
140
170
|
font-weight: 500;
|
|
141
171
|
cursor: pointer;
|
|
142
172
|
transition: all 0.15s;
|
|
143
173
|
}
|
|
144
|
-
#nexa-dev-overlay .nexa-tab:hover { color: ${
|
|
145
|
-
#nexa-dev-overlay .nexa-tab-active { color: ${
|
|
174
|
+
#nexa-dev-overlay .nexa-tab:hover { color: ${Y.text}; background: ${Y.bgElevated}; }
|
|
175
|
+
#nexa-dev-overlay .nexa-tab-active { color: ${Y.text}; background: ${Y.accent} !important; }
|
|
146
176
|
#nexa-dev-overlay .nexa-tab-count {
|
|
147
177
|
font-size: 11px;
|
|
148
178
|
padding: 2px 6px;
|
|
149
|
-
background: rgba(
|
|
179
|
+
background: rgba(148, 163, 184, 0.14);
|
|
150
180
|
border-radius: 10px;
|
|
151
181
|
}
|
|
152
182
|
#nexa-dev-overlay .nexa-body { flex: 1; overflow: hidden; display: flex; }
|
|
@@ -163,7 +193,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
163
193
|
align-items: center;
|
|
164
194
|
justify-content: space-between;
|
|
165
195
|
padding: 12px 14px;
|
|
166
|
-
background: ${
|
|
196
|
+
background: ${Y.bgSurface};
|
|
167
197
|
border: 1px solid transparent;
|
|
168
198
|
border-radius: 12px;
|
|
169
199
|
cursor: pointer;
|
|
@@ -173,8 +203,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
173
203
|
}
|
|
174
204
|
@keyframes nexaFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
|
|
175
205
|
#nexa-dev-overlay .nexa-request-item:hover {
|
|
176
|
-
background:
|
|
177
|
-
border-color: ${
|
|
206
|
+
background: rgba(23, 32, 51, 0.92);
|
|
207
|
+
border-color: ${Y.borderFocus};
|
|
178
208
|
transform: translateX(2px);
|
|
179
209
|
}
|
|
180
210
|
#nexa-dev-overlay .nexa-req-left {
|
|
@@ -190,11 +220,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
190
220
|
text-transform: uppercase;
|
|
191
221
|
letter-spacing: 0.03em;
|
|
192
222
|
}
|
|
193
|
-
#nexa-dev-overlay .nexa-method-get { background: ${
|
|
194
|
-
#nexa-dev-overlay .nexa-method-post { background:
|
|
195
|
-
#nexa-dev-overlay .nexa-method-put { background:
|
|
196
|
-
#nexa-dev-overlay .nexa-method-patch { background:
|
|
197
|
-
#nexa-dev-overlay .nexa-method-delete { background: ${
|
|
223
|
+
#nexa-dev-overlay .nexa-method-get { background: ${Y.successBg}; color: ${Y.get}; }
|
|
224
|
+
#nexa-dev-overlay .nexa-method-post { background: ${Y.accentSoft}; color: ${Y.post}; }
|
|
225
|
+
#nexa-dev-overlay .nexa-method-put { background: ${Y.warningBg}; color: ${Y.put}; }
|
|
226
|
+
#nexa-dev-overlay .nexa-method-patch { background: ${Y.infoBg}; color: ${Y.patch}; }
|
|
227
|
+
#nexa-dev-overlay .nexa-method-delete { background: ${Y.errorBg}; color: ${Y.delete}; }
|
|
198
228
|
#nexa-dev-overlay .nexa-status {
|
|
199
229
|
font-size: 12px;
|
|
200
230
|
font-weight: 600;
|
|
@@ -203,11 +233,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
203
233
|
min-width: 36px;
|
|
204
234
|
text-align: center;
|
|
205
235
|
}
|
|
206
|
-
#nexa-dev-overlay .nexa-ok { background: ${
|
|
207
|
-
#nexa-dev-overlay .nexa-err { background: ${
|
|
236
|
+
#nexa-dev-overlay .nexa-ok { background: ${Y.successBg}; color: ${Y.success}; }
|
|
237
|
+
#nexa-dev-overlay .nexa-err { background: ${Y.errorBg}; color: ${Y.error}; }
|
|
208
238
|
#nexa-dev-overlay .nexa-url {
|
|
209
239
|
font-size: 13px;
|
|
210
|
-
color: ${
|
|
240
|
+
color: ${Y.textMuted};
|
|
211
241
|
max-width: 180px;
|
|
212
242
|
overflow: hidden;
|
|
213
243
|
text-overflow: ellipsis;
|
|
@@ -226,15 +256,15 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
226
256
|
text-transform: uppercase;
|
|
227
257
|
letter-spacing: 0.03em;
|
|
228
258
|
}
|
|
229
|
-
#nexa-dev-overlay .nexa-badge-cache { background:
|
|
230
|
-
#nexa-dev-overlay .nexa-badge-retry { background:
|
|
259
|
+
#nexa-dev-overlay .nexa-badge-cache { background: ${Y.infoBg}; color: ${Y.info}; }
|
|
260
|
+
#nexa-dev-overlay .nexa-badge-retry { background: ${Y.warningBg}; color: ${Y.warning}; }
|
|
231
261
|
#nexa-dev-overlay .nexa-duration {
|
|
232
262
|
font-size: 12px;
|
|
233
263
|
font-weight: 600;
|
|
234
|
-
color: ${
|
|
264
|
+
color: ${Y.textDim};
|
|
235
265
|
font-variant-numeric: tabular-nums;
|
|
236
266
|
}
|
|
237
|
-
#nexa-dev-overlay .nexa-slow { color: ${
|
|
267
|
+
#nexa-dev-overlay .nexa-slow { color: ${Y.warning}; }
|
|
238
268
|
#nexa-dev-overlay .nexa-empty {
|
|
239
269
|
display: flex;
|
|
240
270
|
flex-direction: column;
|
|
@@ -242,11 +272,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
242
272
|
justify-content: center;
|
|
243
273
|
padding: 48px 24px;
|
|
244
274
|
text-align: center;
|
|
245
|
-
color: ${
|
|
275
|
+
color: ${Y.textDim};
|
|
246
276
|
}
|
|
247
277
|
#nexa-dev-overlay .nexa-empty svg { margin-bottom: 16px; opacity: 0.4; }
|
|
248
|
-
#nexa-dev-overlay .nexa-empty p { font-size: 14px; color: ${
|
|
249
|
-
#nexa-dev-overlay .nexa-empty span { font-size: 12px; color: ${
|
|
278
|
+
#nexa-dev-overlay .nexa-empty p { font-size: 14px; color: ${Y.textMuted}; margin-bottom: 4px; }
|
|
279
|
+
#nexa-dev-overlay .nexa-empty span { font-size: 12px; color: ${Y.textDim}; }
|
|
250
280
|
#nexa-dev-overlay .nexa-detail {
|
|
251
281
|
flex-direction: column;
|
|
252
282
|
padding: 16px;
|
|
@@ -261,26 +291,32 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
261
291
|
justify-content: space-between;
|
|
262
292
|
margin-bottom: 16px;
|
|
263
293
|
}
|
|
294
|
+
#nexa-dev-overlay .nexa-btn-group {
|
|
295
|
+
display: flex;
|
|
296
|
+
gap: 8px;
|
|
297
|
+
}
|
|
264
298
|
#nexa-dev-overlay .nexa-btn {
|
|
265
299
|
display: flex;
|
|
266
300
|
align-items: center;
|
|
267
301
|
gap: 6px;
|
|
268
302
|
padding: 8px 14px;
|
|
269
|
-
background: ${
|
|
270
|
-
border: 1px solid ${
|
|
303
|
+
background: ${Y.bgSurface};
|
|
304
|
+
border: 1px solid ${Y.border};
|
|
271
305
|
border-radius: 8px;
|
|
272
|
-
color: ${
|
|
306
|
+
color: ${Y.textMuted};
|
|
273
307
|
font-size: 13px;
|
|
274
308
|
font-weight: 500;
|
|
275
309
|
cursor: pointer;
|
|
276
310
|
transition: all 0.15s;
|
|
277
311
|
}
|
|
278
|
-
#nexa-dev-overlay .nexa-btn:hover { background:
|
|
279
|
-
#nexa-dev-overlay .nexa-btn-retry { background: ${
|
|
280
|
-
#nexa-dev-overlay .nexa-btn-retry:hover { background: ${
|
|
312
|
+
#nexa-dev-overlay .nexa-btn:hover { background: rgba(53, 80, 122, 0.24); color: ${Y.text}; }
|
|
313
|
+
#nexa-dev-overlay .nexa-btn-retry { background: ${Y.successBg}; border-color: transparent; color: ${Y.success}; }
|
|
314
|
+
#nexa-dev-overlay .nexa-btn-retry:hover { background: ${Y.success}; color: #052e26; }
|
|
315
|
+
#nexa-dev-overlay .nexa-btn-copy { background: ${Y.accentSoft}; border-color: transparent; color: ${Y.accent}; }
|
|
316
|
+
#nexa-dev-overlay .nexa-btn-copy:hover { background: ${Y.accent}; color: #ffffff; }
|
|
281
317
|
#nexa-dev-overlay .nexa-card {
|
|
282
|
-
background: ${
|
|
283
|
-
border: 1px solid ${
|
|
318
|
+
background: ${Y.bgSurface};
|
|
319
|
+
border: 1px solid ${Y.border};
|
|
284
320
|
border-radius: 12px;
|
|
285
321
|
padding: 16px;
|
|
286
322
|
margin-bottom: 12px;
|
|
@@ -288,31 +324,53 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
288
324
|
#nexa-dev-overlay .nexa-card h3 {
|
|
289
325
|
font-size: 12px;
|
|
290
326
|
font-weight: 600;
|
|
291
|
-
color: ${
|
|
327
|
+
color: ${Y.textDim};
|
|
292
328
|
text-transform: uppercase;
|
|
293
329
|
letter-spacing: 0.05em;
|
|
294
330
|
margin-bottom: 12px;
|
|
295
331
|
}
|
|
332
|
+
#nexa-dev-overlay .nexa-notification {
|
|
333
|
+
position: absolute;
|
|
334
|
+
bottom: 24px;
|
|
335
|
+
left: 50%;
|
|
336
|
+
transform: translateX(-50%) translateY(20px);
|
|
337
|
+
background: ${Y.bgElevated};
|
|
338
|
+
color: ${Y.text};
|
|
339
|
+
padding: 10px 18px;
|
|
340
|
+
border-radius: 12px;
|
|
341
|
+
border: 1px solid ${Y.borderFocus};
|
|
342
|
+
font-size: 13px;
|
|
343
|
+
font-weight: 500;
|
|
344
|
+
box-shadow: 0 12px 32px rgba(0,0,0,0.4);
|
|
345
|
+
z-index: 2147483651;
|
|
346
|
+
opacity: 0;
|
|
347
|
+
pointer-events: none;
|
|
348
|
+
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
349
|
+
}
|
|
350
|
+
#nexa-dev-overlay .nexa-notification-show {
|
|
351
|
+
opacity: 1;
|
|
352
|
+
transform: translateX(-50%) translateY(0);
|
|
353
|
+
}
|
|
296
354
|
#nexa-dev-overlay .nexa-row {
|
|
297
355
|
display: flex;
|
|
298
356
|
justify-content: space-between;
|
|
299
357
|
align-items: center;
|
|
300
358
|
padding: 6px 0;
|
|
301
359
|
font-size: 13px;
|
|
302
|
-
border-bottom: 1px solid ${
|
|
360
|
+
border-bottom: 1px solid ${Y.border};
|
|
303
361
|
}
|
|
304
362
|
#nexa-dev-overlay .nexa-row:last-child { border-bottom: none; }
|
|
305
|
-
#nexa-dev-overlay .nexa-row span { color: ${
|
|
306
|
-
#nexa-dev-overlay .nexa-row strong { color: ${
|
|
307
|
-
#nexa-dev-overlay .nexa-row .nexa-ok { color: ${
|
|
308
|
-
#nexa-dev-overlay .nexa-row .nexa-err { color: ${
|
|
363
|
+
#nexa-dev-overlay .nexa-row span { color: ${Y.textMuted}; }
|
|
364
|
+
#nexa-dev-overlay .nexa-row strong { color: ${Y.text}; font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
365
|
+
#nexa-dev-overlay .nexa-row .nexa-ok { color: ${Y.success}; }
|
|
366
|
+
#nexa-dev-overlay .nexa-row .nexa-err { color: ${Y.error}; }
|
|
309
367
|
#nexa-dev-overlay .nexa-code {
|
|
310
|
-
background: ${
|
|
368
|
+
background: ${Y.bg};
|
|
311
369
|
border-radius: 8px;
|
|
312
370
|
padding: 12px;
|
|
313
371
|
font-size: 11px;
|
|
314
372
|
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
|
315
|
-
color: ${
|
|
373
|
+
color: ${Y.textMuted};
|
|
316
374
|
overflow-x: auto;
|
|
317
375
|
white-space: pre;
|
|
318
376
|
max-height: 200px;
|
|
@@ -321,7 +379,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
321
379
|
#nexa-dev-overlay .nexa-url-full {
|
|
322
380
|
font-size: 12px;
|
|
323
381
|
word-break: break-all;
|
|
324
|
-
color: ${
|
|
382
|
+
color: ${Y.accent};
|
|
325
383
|
}
|
|
326
384
|
#nexa-dev-overlay .nexa-metrics-content {
|
|
327
385
|
padding: 16px;
|
|
@@ -329,33 +387,172 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
329
387
|
flex-direction: column;
|
|
330
388
|
gap: 12px;
|
|
331
389
|
}
|
|
390
|
+
#nexa-dev-overlay .nexa-settings-panel {
|
|
391
|
+
position: absolute;
|
|
392
|
+
top: 72px;
|
|
393
|
+
left: 16px;
|
|
394
|
+
right: 16px;
|
|
395
|
+
bottom: 16px;
|
|
396
|
+
z-index: 2147483650;
|
|
397
|
+
display: none;
|
|
398
|
+
flex-direction: column;
|
|
399
|
+
gap: 12px;
|
|
400
|
+
padding: 16px;
|
|
401
|
+
border-radius: 12px;
|
|
402
|
+
background: ${Y.bgElevated};
|
|
403
|
+
border: 1px solid ${Y.border};
|
|
404
|
+
box-shadow: 0 28px 60px -24px rgba(2, 6, 23, 0.76);
|
|
405
|
+
overflow: auto;
|
|
406
|
+
}
|
|
407
|
+
#nexa-dev-overlay .nexa-settings-row { display:flex;align-items:center;gap:8px;margin-bottom:8px }
|
|
408
|
+
#nexa-dev-overlay .nexa-settings-row label{font-size:13px;color:${Y.textDim};min-width:70px}
|
|
409
|
+
#nexa-dev-overlay .nexa-settings-row select{padding:6px 8px;border-radius:8px;border:1px solid ${Y.border};background:${Y.bg};color:${Y.text}}
|
|
410
|
+
|
|
411
|
+
#nexa-dev-overlay.nexa-theme-light {
|
|
412
|
+
background: #f8fbff;
|
|
413
|
+
color: #0f172a;
|
|
414
|
+
border-color: #d8e4f2;
|
|
415
|
+
box-shadow: 0 28px 60px -24px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(148, 163, 184, 0.16);
|
|
416
|
+
}
|
|
417
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-header,
|
|
418
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-metrics-bar,
|
|
419
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-search,
|
|
420
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-tabs {
|
|
421
|
+
background: #f8fbff;
|
|
422
|
+
border-color: #d8e4f2;
|
|
423
|
+
}
|
|
424
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-logo,
|
|
425
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-metric,
|
|
426
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-request-item,
|
|
427
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-btn,
|
|
428
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-card,
|
|
429
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-settings-panel,
|
|
430
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-notification {
|
|
431
|
+
background: #ffffff;
|
|
432
|
+
border-color: #d8e4f2;
|
|
433
|
+
}
|
|
434
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-metric:hover,
|
|
435
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-icon-btn:hover,
|
|
436
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-btn:hover,
|
|
437
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-tab:hover,
|
|
438
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-request-item:hover {
|
|
439
|
+
background: #eef6ff;
|
|
440
|
+
}
|
|
441
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-request-item:hover {
|
|
442
|
+
border-color: #93c5fd;
|
|
443
|
+
}
|
|
444
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-search-icon,
|
|
445
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-metric-label,
|
|
446
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-duration,
|
|
447
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-empty,
|
|
448
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-empty span,
|
|
449
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-row span,
|
|
450
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-settings-row label,
|
|
451
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-notification {
|
|
452
|
+
color: #64748b;
|
|
453
|
+
}
|
|
454
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-notification {
|
|
455
|
+
box-shadow: 0 12px 32px rgba(15,23,42,0.12);
|
|
456
|
+
border-color: #e2e8f0;
|
|
457
|
+
}
|
|
458
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-url,
|
|
459
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-empty p,
|
|
460
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-icon-btn,
|
|
461
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-tab,
|
|
462
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-btn,
|
|
463
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-code {
|
|
464
|
+
color: #334155;
|
|
465
|
+
}
|
|
466
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-metric-value,
|
|
467
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-title,
|
|
468
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-row strong {
|
|
469
|
+
color: #0f172a;
|
|
470
|
+
}
|
|
471
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-search-input,
|
|
472
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-settings-row select,
|
|
473
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-code {
|
|
474
|
+
background: #ffffff;
|
|
475
|
+
color: #0f172a;
|
|
476
|
+
border-color: #d8e4f2;
|
|
477
|
+
}
|
|
478
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-search-input:focus {
|
|
479
|
+
border-color: #38bdf8;
|
|
480
|
+
box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
|
|
481
|
+
}
|
|
482
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-tab-active {
|
|
483
|
+
color: #ffffff;
|
|
484
|
+
background: #0ea5e9 !important;
|
|
485
|
+
}
|
|
486
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-tab-count {
|
|
487
|
+
background: rgba(14, 165, 233, 0.12);
|
|
488
|
+
color: #075985;
|
|
489
|
+
}
|
|
490
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-code,
|
|
491
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-detail,
|
|
492
|
+
#nexa-dev-overlay.nexa-theme-light .nexa-row {
|
|
493
|
+
border-color: #d8e4f2;
|
|
494
|
+
}
|
|
332
495
|
#nexa-dev-overlay .nexa-slow-req {
|
|
333
496
|
display: flex;
|
|
334
497
|
align-items: center;
|
|
335
498
|
gap: 8px;
|
|
336
499
|
}
|
|
337
|
-
|
|
500
|
+
#nexa-dev-overlay.nexa-view-detail .nexa-metrics-bar,
|
|
501
|
+
#nexa-dev-overlay.nexa-view-detail .nexa-search,
|
|
502
|
+
#nexa-dev-overlay.nexa-view-detail .nexa-filters,
|
|
503
|
+
#nexa-dev-overlay.nexa-view-detail .nexa-tabs,
|
|
504
|
+
#nexa-dev-overlay.nexa-view-detail .nexa-body {
|
|
505
|
+
display: none !important;
|
|
506
|
+
}
|
|
507
|
+
`;function X(){try{if(typeof process<`u`){let e=process;if(e.env&&typeof e.env.NODE_ENV==`string`)return e.env.NODE_ENV===`development`}}catch{}try{if(typeof location<`u`&&location.hostname){let e=location.hostname;if(e===`localhost`||e===`127.0.0.1`||e===`0.0.0.0`)return!0}}catch{}return!1}var we=class{panel=null;floatingIcon=null;tracker;visible=!1;selectedRequest=null;config;searchQuery=``;filterType=`all`;removeTrackerListener=null;keyboardShortcutHandler=null;globalKeyboardHandler=null;constructor(e){this.tracker=e,this.config=e.getConfig(),this.canUseDOM()&&(this.setupKeyboardShortcut(),this.createPanel())}show(){this.panel&&(this.panel.style.display=`flex`,this.panel.style.opacity=`0`,this.panel.style.transform=`scale(0.96) translateY(8px)`,(typeof requestAnimationFrame==`function`?requestAnimationFrame:e=>setTimeout(e,0))(()=>{this.panel.style.transition=`all 0.25s cubic-bezier(0.16, 1, 0.3, 1)`,this.panel.style.opacity=`1`,this.panel.style.transform=`scale(1) translateY(0)`}),this.visible=!0,this.hideFloatingIcon())}hide(){this.panel&&(this.panel.style.transition=`all 0.15s ease-out`,this.panel.style.opacity=`0`,this.panel.style.transform=`scale(0.96) translateY(8px)`,setTimeout(()=>{this.panel&&(this.panel.style.display=`none`)},150),this.visible=!1,this.config.enabled&&(!this.config.devOnly||X())&&this.showFloatingIcon())}toggle(){this.visible?this.hide():this.show()}destroy(){this.keyboardShortcutHandler&&=(document.removeEventListener(`keydown`,this.keyboardShortcutHandler),null),this.globalKeyboardHandler&&=(document.removeEventListener(`keydown`,this.globalKeyboardHandler),null),this.removeTrackerListener?.(),this.removeTrackerListener=null,this.panel?.remove(),this.panel=null,this.visible=!1,this.selectedRequest=null,this.floatingIcon&&=(this.floatingIcon.remove(),null)}setupKeyboardShortcut(){let e=this.config.keyboardShortcut.split(`+`),t=new Set(e.map(e=>e.toLowerCase()));this.keyboardShortcutHandler=e=>{let n=new Set;e.ctrlKey&&n.add(`ctrl`),e.metaKey&&(n.add(`meta`),n.add(`cmd`),n.add(`ctrl`)),e.shiftKey&&n.add(`shift`),e.altKey&&n.add(`alt`),(e.key&&e.key.length===1||e.key.length>1)&&n.add(e.key.toLowerCase());let r=!0;for(let e of t)if(!n.has(e)){r=!1;break}r&&n.size===t.size&&(e.preventDefault(),this.toggle())},document.addEventListener(`keydown`,this.keyboardShortcutHandler)}createPanel(){if(!this.canUseDOM())return;try{let e=document.getElementById(`nexa-dev-overlay`);e&&e.remove()}catch{}this.panel=document.createElement(`div`),this.panel.id=`nexa-dev-overlay`;let e=this.config.position,t=e.includes(`bottom`),n=e.includes(`right`),r=`${this.config.floatingButtonOffset??24}px`,i=this.config.branding||`Nexa DevTools`,a=this.config.icon||`https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png`;this.panel.style.cssText=`
|
|
338
508
|
position: fixed;
|
|
339
|
-
${t?`bottom:
|
|
340
|
-
${n?`right:
|
|
509
|
+
${t?`bottom: ${r};`:`top: ${r};`}
|
|
510
|
+
${n?`right: ${r};`:`left: ${r};`}
|
|
341
511
|
width: 420px;
|
|
342
512
|
max-height: 70vh;
|
|
343
|
-
z-index:
|
|
513
|
+
z-index: 2147483649;
|
|
344
514
|
display: flex;
|
|
345
515
|
flex-direction: column;
|
|
346
516
|
overflow: hidden;
|
|
347
|
-
`,this.panel.innerHTML=`<style>${
|
|
517
|
+
`,this.panel.innerHTML=`<style>${Ce}</style>
|
|
348
518
|
|
|
349
519
|
<div class="nexa-header">
|
|
350
|
-
<div class="nexa-header-left">
|
|
520
|
+
<div class="nexa-header-left">
|
|
351
521
|
<div class="nexa-logo">
|
|
352
|
-
<
|
|
522
|
+
<img src="${a}" alt="${i}" style="width:100%;height:auto;object-fit:cover;border-radius:8px;display:block;" />
|
|
353
523
|
</div>
|
|
354
|
-
<span class="nexa-title"
|
|
524
|
+
<span class="nexa-title">${i}</span>
|
|
355
525
|
</div>
|
|
356
526
|
<div class="nexa-header-actions">
|
|
357
|
-
<button class="nexa-icon-btn nexa-btn-
|
|
358
|
-
<button class="nexa-icon-btn nexa-btn-
|
|
527
|
+
<button class="nexa-icon-btn nexa-btn-export" title="Export history (JSON)">${J.download}</button>
|
|
528
|
+
<button class="nexa-icon-btn nexa-btn-settings" title="Settings">${J.gear}</button>
|
|
529
|
+
<button class="nexa-icon-btn nexa-btn-clear" title="Clear history">${J.clear}</button>
|
|
530
|
+
<button class="nexa-icon-btn nexa-btn-close" title="Close (Esc)">${J.close}</button>
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
|
|
534
|
+
<div class="nexa-notification"></div>
|
|
535
|
+
|
|
536
|
+
<div class="nexa-settings-panel" style="display:none">
|
|
537
|
+
<div class="nexa-settings-row">
|
|
538
|
+
<label for="nexa-pos">Position</label>
|
|
539
|
+
<select id="nexa-pos" data-setting="position">
|
|
540
|
+
<option value="top-right">Top Right</option>
|
|
541
|
+
<option value="top-left">Top Left</option>
|
|
542
|
+
<option value="bottom-right">Bottom Right</option>
|
|
543
|
+
<option value="bottom-left">Bottom Left</option>
|
|
544
|
+
</select>
|
|
545
|
+
</div>
|
|
546
|
+
<div class="nexa-settings-row">
|
|
547
|
+
<label for="nexa-theme">Theme</label>
|
|
548
|
+
<select id="nexa-theme" data-setting="theme">
|
|
549
|
+
<option value="dark">Dark</option>
|
|
550
|
+
<option value="light">Light</option>
|
|
551
|
+
</select>
|
|
552
|
+
</div>
|
|
553
|
+
<div style="display:flex;gap:8px;margin-top:8px">
|
|
554
|
+
<button class="nexa-btn nexa-btn-save">Save</button>
|
|
555
|
+
<button class="nexa-btn nexa-btn-cancel">Cancel</button>
|
|
359
556
|
</div>
|
|
360
557
|
</div>
|
|
361
558
|
|
|
@@ -368,10 +565,17 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
368
565
|
</div>
|
|
369
566
|
|
|
370
567
|
<div class="nexa-search">
|
|
371
|
-
<span class="nexa-search-icon">${
|
|
568
|
+
<span class="nexa-search-icon">${J.search}</span>
|
|
372
569
|
<input type="text" class="nexa-search-input" placeholder="Filter by URL, method, or status..." />
|
|
373
570
|
</div>
|
|
374
571
|
|
|
572
|
+
<div class="nexa-filters">
|
|
573
|
+
<div class="nexa-filter-chip nexa-filter-chip-active" data-filter="all">All</div>
|
|
574
|
+
<div class="nexa-filter-chip" data-filter="err">Errors</div>
|
|
575
|
+
<div class="nexa-filter-chip" data-filter="xhr">JSON</div>
|
|
576
|
+
<div class="nexa-filter-chip" data-filter="slow">Slow</div>
|
|
577
|
+
</div>
|
|
578
|
+
|
|
375
579
|
<div class="nexa-tabs">
|
|
376
580
|
<button class="nexa-tab nexa-tab-active" data-tab="requests"><span>Requests</span><span class="nexa-tab-count" data-count="requests">0</span></button>
|
|
377
581
|
<button class="nexa-tab" data-tab="metrics"><span>Metrics</span></button>
|
|
@@ -384,12 +588,15 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
384
588
|
|
|
385
589
|
<div class="nexa-detail" style="display:none">
|
|
386
590
|
<div class="nexa-detail-header">
|
|
387
|
-
<button class="nexa-btn nexa-btn-back">${
|
|
388
|
-
<
|
|
591
|
+
<button class="nexa-btn nexa-btn-back">${J.back} Back</button>
|
|
592
|
+
<div class="nexa-btn-group">
|
|
593
|
+
<button class="nexa-btn nexa-btn-copy">${J.copy} Copy as fetch</button>
|
|
594
|
+
<button class="nexa-btn nexa-btn-retry">${J.retry} Retry</button>
|
|
595
|
+
</div>
|
|
389
596
|
</div>
|
|
390
597
|
<div class="nexa-detail-body"></div>
|
|
391
598
|
</div>
|
|
392
|
-
`,document.body.appendChild(this.panel),this.bindEvents(),this.removeTrackerListener=this.tracker.onChange(()=>this.render()),this.hide(),this.globalKeyboardHandler=e=>{if(e.key===`Escape`&&this.visible){this.hide();return}if(this.visible&&(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`f`){e.preventDefault();let t=this.panel?.querySelector(`.nexa-search-input`);t?.focus(),t?.select()}},document.addEventListener(`keydown`,this.globalKeyboardHandler)}bindEvents(){this.panel&&(this.panel.querySelector(`.nexa-btn-close`)?.addEventListener(`click`,()=>this.hide()),this.panel.querySelector(`.nexa-btn-clear`)?.addEventListener(`click`,()=>{this.tracker.clear(),this.render()}),this.panel.querySelector(`.nexa-btn-back`)?.addEventListener(`click`,()=>this.showMainView()),this.panel.querySelector(`.nexa-btn-retry`)?.addEventListener(`click`,()=>this.retrySelected()),this.panel.querySelector(`.nexa-search-input`)?.addEventListener(`input`,e=>{this.searchQuery=e.target.value.toLowerCase(),this.renderRequestList()}),this.panel.querySelectorAll(`.nexa-tab`).forEach(e=>{e.addEventListener(`click`,()=>{this.panel.querySelectorAll(`.nexa-tab`).forEach(e=>e.classList.remove(`nexa-tab-active`)),this.panel.querySelectorAll(`.nexa-panel`).forEach(e=>e.classList.remove(`nexa-panel-active`)),e.classList.add(`nexa-tab-active`),this.panel.querySelector(`[data-panel="${e.dataset.tab}"]`)?.classList.add(`nexa-panel-active`),e.dataset.tab===`metrics`&&this.renderMetrics()})}))}render(){!this.panel||!this.visible||(this.renderMetricsBar(),this.renderRequestList())}renderMetricsBar(){let e=this.tracker.getMetrics(),t=this.panel;t&&(t.querySelector(`[data-metric="total"]`).textContent=String(e.totalRequests),t.querySelector(`[data-metric="avg"]`).textContent=`${e.avgDuration.toFixed(0)}ms`,t.querySelector(`[data-metric="rate"]`).textContent=`${e.requestsPerSecond.toFixed(1)}`,t.querySelector(`[data-metric="success"]`).textContent=String(e.successfulRequests),t.querySelector(`[data-metric="fail"]`).textContent=String(e.failedRequests),t.querySelector(`[data-count="requests"]`).textContent=String(e.totalRequests))}renderRequestList(){let e=this.panel?.querySelector(`.nexa-request-list`);if(!e)return;let t=this.tracker.getHistory();if(this.searchQuery&&(t=t.filter(e=>e.url.toLowerCase().includes(this.searchQuery)||e.method.toLowerCase().includes(this.searchQuery)||String(e.status).includes(this.searchQuery))),t.length===0){e.innerHTML=`
|
|
599
|
+
`,document.body.appendChild(this.panel),this.config.theme===`light`?this.panel.classList.add(`nexa-theme-light`):this.panel.classList.remove(`nexa-theme-light`),this.bindEvents(),this.removeTrackerListener=this.tracker.onChange(()=>this.render());let o=!this.config.devOnly||X();this.config.enabled&&o&&this.createFloatingIcon(),this.hide(),this.globalKeyboardHandler=e=>{if(e.key===`Escape`&&this.visible){this.hide();return}if(this.visible&&(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`f`){e.preventDefault();let t=this.panel?.querySelector(`.nexa-search-input`);t?.focus(),t?.select()}},document.addEventListener(`keydown`,this.globalKeyboardHandler)}bindEvents(){this.panel&&(this.panel.querySelector(`.nexa-btn-close`)?.addEventListener(`click`,()=>this.hide()),this.panel.querySelector(`.nexa-btn-export`)?.addEventListener(`click`,()=>this.exportHistory()),this.panel.querySelector(`.nexa-btn-copy`)?.addEventListener(`click`,()=>this.copyAsFetch()),this.panel.querySelector(`.nexa-btn-clear`)?.addEventListener(`click`,()=>{this.tracker.clear(),this.render()}),this.panel.querySelector(`.nexa-btn-back`)?.addEventListener(`click`,()=>this.showMainView()),this.panel.querySelector(`.nexa-btn-retry`)?.addEventListener(`click`,()=>this.retrySelected()),this.panel.querySelector(`.nexa-search-input`)?.addEventListener(`input`,e=>{this.searchQuery=e.target.value.toLowerCase(),this.renderRequestList()}),this.panel.querySelectorAll(`.nexa-filter-chip`).forEach(e=>{e.addEventListener(`click`,()=>{this.panel.querySelectorAll(`.nexa-filter-chip`).forEach(e=>e.classList.remove(`nexa-filter-chip-active`)),e.classList.add(`nexa-filter-chip-active`),this.filterType=e.dataset.filter,this.renderRequestList()})}),this.panel.querySelectorAll(`.nexa-tab`).forEach(e=>{e.addEventListener(`click`,()=>{this.panel.querySelectorAll(`.nexa-tab`).forEach(e=>e.classList.remove(`nexa-tab-active`)),this.panel.querySelectorAll(`.nexa-panel`).forEach(e=>e.classList.remove(`nexa-panel-active`)),e.classList.add(`nexa-tab-active`),this.panel.querySelector(`[data-panel="${e.dataset.tab}"]`)?.classList.add(`nexa-panel-active`),e.dataset.tab===`metrics`&&this.renderMetrics()})}),this.panel.querySelector(`.nexa-btn-settings`)?.addEventListener(`click`,()=>{let e=this.panel.querySelector(`.nexa-settings-panel`);if(!e)return;let t=this.panel.querySelector(`[data-setting="position"]`),n=this.panel.querySelector(`[data-setting="theme"]`),r=e.style.display===`flex`;e.style.display=r?`none`:`flex`,r||(this.hideFloatingIcon(),t&&(t.value=this.config.position),n&&(n.value=this.config.theme),t?.focus())}),this.panel.querySelector(`.nexa-btn-save`)?.addEventListener(`click`,()=>{let e=this.panel.querySelector(`[data-setting="position"]`),t=this.panel.querySelector(`[data-setting="theme"]`),n=e?.value,r=t?.value,i={};n!==void 0&&(i.position=n),r!==void 0&&(i.theme=r);let a=this.tracker.updateConfig(i);this.applyConfigToUI(a);let o=this.panel.querySelector(`.nexa-settings-panel`);o&&(o.style.display=`none`)}),this.panel.querySelector(`.nexa-btn-cancel`)?.addEventListener(`click`,()=>{let e=this.panel.querySelector(`.nexa-settings-panel`);e&&(e.style.display=`none`)}))}render(){!this.panel||!this.visible||(this.renderMetricsBar(),this.renderRequestList())}renderMetricsBar(){let e=this.tracker.getMetrics(),t=this.panel;t&&(t.querySelector(`[data-metric="total"]`).textContent=String(e.totalRequests),t.querySelector(`[data-metric="avg"]`).textContent=`${e.avgDuration.toFixed(0)}ms`,t.querySelector(`[data-metric="rate"]`).textContent=`${e.requestsPerSecond.toFixed(1)}`,t.querySelector(`[data-metric="success"]`).textContent=String(e.successfulRequests),t.querySelector(`[data-metric="fail"]`).textContent=String(e.failedRequests),t.querySelector(`[data-count="requests"]`).textContent=String(e.totalRequests))}renderRequestList(){let e=this.panel?.querySelector(`.nexa-request-list`);if(!e)return;let t=this.tracker.getHistory();if(this.filterType===`err`?t=t.filter(e=>!e.ok):this.filterType===`xhr`?t=t.filter(e=>e.headers[`content-type`]&&e.headers[`content-type`].includes(`json`)||e.responseHeaders&&e.responseHeaders[`content-type`]&&e.responseHeaders[`content-type`].includes(`json`)):this.filterType===`slow`&&(t=t.filter(e=>e.duration>500)),this.searchQuery&&(t=t.filter(e=>e.url.toLowerCase().includes(this.searchQuery)||e.method.toLowerCase().includes(this.searchQuery)||String(e.status).includes(this.searchQuery))),t.length===0){e.innerHTML=`
|
|
393
600
|
<div class="nexa-empty">
|
|
394
601
|
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
395
602
|
<circle cx="12" cy="12" r="10"/><path d="M8 12h8M12 8v8"/>
|
|
@@ -407,7 +614,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
407
614
|
${e.cached?`<span class="nexa-badge nexa-badge-cache">Cache</span>`:``}
|
|
408
615
|
${e.retryCount>0?`<span class="nexa-badge nexa-badge-retry">${e.retryCount}R</span>`:``}
|
|
409
616
|
<span class="nexa-duration ${e.duration>500?`nexa-slow`:``}">${e.duration.toFixed(0)}ms</span>
|
|
410
|
-
${
|
|
617
|
+
${J.chevron}
|
|
411
618
|
</div>
|
|
412
619
|
</div>
|
|
413
620
|
`).join(``),e.querySelectorAll(`.nexa-request-item`).forEach(e=>{e.addEventListener(`click`,()=>{let n=e.dataset.id,r=t.find(e=>e.id===n);r&&this.showDetail(r)})})}renderMetrics(){let e=this.tracker.getMetrics(),t=this.panel?.querySelector(`.nexa-metrics-content`);if(!t)return;let n=e.totalRequests>0?(e.successfulRequests/e.totalRequests*100).toFixed(1):`0`;t.innerHTML=`
|
|
@@ -436,10 +643,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
436
643
|
</div>
|
|
437
644
|
`).join(``)}
|
|
438
645
|
</div>
|
|
439
|
-
`:``}`}showDetail(e){this.selectedRequest=e;let t=this.panel
|
|
646
|
+
`:``}`}showDetail(e){if(this.selectedRequest=e,!this.panel)return;let t=this.panel.querySelector(`.nexa-body`),n=this.panel.querySelector(`.nexa-detail`),r=this.panel.querySelector(`.nexa-detail-body`);!t||!n||!r||(this.panel.classList.add(`nexa-view-detail`),t.style.display=`none`,n.style.display=`flex`,r.innerHTML=`
|
|
440
647
|
<div class="nexa-card">
|
|
441
648
|
<h3>Request</h3>
|
|
442
|
-
<div class="nexa-row"><span>Method</span><strong style="color:${e.method===`GET`?
|
|
649
|
+
<div class="nexa-row"><span>Method</span><strong style="color:${e.method===`GET`?Y.get:e.method===`POST`?Y.post:e.method===`DELETE`?Y.delete:Y.warning}">${e.method}</strong></div>
|
|
443
650
|
<div class="nexa-row"><span>URL</span><span class="nexa-url-full">${e.url}</span></div>
|
|
444
651
|
<div class="nexa-row"><span>Status</span><strong class="${e.ok?`nexa-ok`:`nexa-err`}">${e.status||`N/A`}</strong></div>
|
|
445
652
|
<div class="nexa-row"><span>Duration</span><strong>${e.duration.toFixed(1)}ms</strong></div>
|
|
@@ -458,5 +665,24 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>({ok
|
|
|
458
665
|
<h3>Headers</h3>
|
|
459
666
|
<pre class="nexa-code">${this.formatJson(e.headers)}</pre>
|
|
460
667
|
</div>
|
|
461
|
-
`:``}`)}showMainView(){let e=this.panel?.querySelector(`.nexa-body`),t=this.panel?.querySelector(`.nexa-detail`);e&&(e.style.display=`flex`),t&&(t.style.display=`none`),this.selectedRequest=null}retrySelected(){if(!this.selectedRequest)return;let{method:e,url:t,body:n,headers:r}=this.selectedRequest;fetch(t,{method:e,headers:r,body:n?JSON.stringify(n):void 0}).then(async e=>{this.selectedRequest&&(this.selectedRequest={...this.selectedRequest,status:e.status,ok:e.ok,duration:this.selectedRequest.duration,timestamp:Date.now()},this.showDetail(this.selectedRequest))}).catch(()=>{})}
|
|
668
|
+
`:``}`)}showMainView(){this.panel&&this.panel.classList.remove(`nexa-view-detail`);let e=this.panel?.querySelector(`.nexa-body`),t=this.panel?.querySelector(`.nexa-detail`);e&&(e.style.display=`flex`),t&&(t.style.display=`none`),this.selectedRequest=null}retrySelected(){if(!this.selectedRequest)return;let{method:e,url:t,body:n,headers:r}=this.selectedRequest;fetch(t,{method:e,headers:r,body:n?JSON.stringify(n):void 0}).then(async e=>{this.selectedRequest&&(this.selectedRequest={...this.selectedRequest,status:e.status,ok:e.ok,duration:this.selectedRequest.duration,timestamp:Date.now()},this.showDetail(this.selectedRequest))}).catch(()=>{})}exportHistory(){let e=this.tracker.getHistory(),t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`nexa-history-${new Date().toISOString().slice(0,19).replace(/[:]/g,`-`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r),this.showNotification(`History exported as JSON`)}copyAsFetch(){if(!this.selectedRequest)return;let e=this.selectedRequest,t={...e.headers};delete t.host;let n=`fetch("${e.url}", {\n`;n+=` "method": "${e.method}",\n`,Object.keys(t).length>0&&(n+=` "headers": ${JSON.stringify(t,null,4).replace(/\n/g,`
|
|
669
|
+
`)},\n`),e.body&&(n+=` "body": ${JSON.stringify(e.body,null,4).replace(/\n/g,`
|
|
670
|
+
`)},\n`),n+=`});`,navigator.clipboard.writeText(n).then(()=>{this.showNotification(`Copied as fetch to clipboard`)}).catch(()=>{this.showNotification(`Failed to copy to clipboard`)})}showNotification(e){let t=this.panel?.querySelector(`.nexa-notification`);t&&(t.textContent=e,t.classList.add(`nexa-notification-show`),setTimeout(()=>{t.classList.remove(`nexa-notification-show`)},2500))}truncateUrl(e,t=35){try{let t=new URL(e);return t.pathname+(t.search||``)}catch{return e.length>t?e.slice(0,t)+`...`:e}}formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}canUseDOM(){return typeof document<`u`&&typeof document.createElement==`function`&&!!document.body}createFloatingIcon(){if(!this.canUseDOM())return;try{let e=document.getElementById(`nexa-dev-overlay-floating`);e&&e.remove()}catch{}this.floatingIcon&&=(this.floatingIcon.remove(),null);let e=document.createElement(`button`);e.id=`nexa-dev-overlay-floating`,e.title=`Toggle Nexa DevTools`;let t=this.config.floatingButtonSize??48,n=this.config.floatingButtonOffset??24,r=this.config.position||`bottom-right`,i=r.includes(`bottom`),a=r.includes(`right`),o=`${i?`bottom: ${n}px;`:`top: ${n}px;`} ${a?`right: ${n}px;`:`left: ${n}px;`}`,s=this.config.floatingButtonTheme===`inherit`?this.config.theme:this.config.floatingButtonTheme,c=`linear-gradient(135deg,#0ea5e9,#8b5cf6)`,l=`#ffffff`,u=`0 16px 36px rgba(2,6,23,0.34)`,d=`none`;s===`light`&&(c=`linear-gradient(135deg,#f8fbff,#e0f2fe)`,l=`#0f172a`,u=`0 14px 30px rgba(15,23,42,0.16)`,d=`1px solid #d8e4f2`);let f=this.config.branding||`Nexa DevTools`,p=this.config.icon||`https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png`;e.style.cssText=`
|
|
671
|
+
position: fixed;
|
|
672
|
+
${o}
|
|
673
|
+
width: ${t}px;
|
|
674
|
+
height: ${t}px;
|
|
675
|
+
border-radius: 50%;
|
|
676
|
+
border: ${d};
|
|
677
|
+
display: flex;
|
|
678
|
+
align-items: center;
|
|
679
|
+
justify-content: center;
|
|
680
|
+
z-index: 2147483648;
|
|
681
|
+
cursor: pointer;
|
|
682
|
+
box-shadow: ${u};
|
|
683
|
+
background: ${c};
|
|
684
|
+
color: ${l};
|
|
685
|
+
font-weight: 700;
|
|
686
|
+
font-size: ${Math.max(12,Math.floor(t/3))}px;
|
|
687
|
+
`,e.innerHTML=`<img src="${p}" alt="${f}" style="width:${t-10}px;height:auto;object-fit:cover;border-radius:999px;display:block;" />`,e.addEventListener(`click`,e=>{e.stopPropagation(),this.toggle()}),e.addEventListener(`mousedown`,e=>e.preventDefault()),document.body.appendChild(e),e.style.display=this.visible?`none`:`flex`,this.floatingIcon=e}showFloatingIcon(){if(!this.floatingIcon){this.config.enabled&&this.createFloatingIcon();return}this.floatingIcon.style.display=`flex`}hideFloatingIcon(){this.floatingIcon&&(this.floatingIcon.style.display=`none`)}applyConfigToUI(e){this.config=e??this.tracker.getConfig();let t=this.config.position,n=t.includes(`bottom`),r=t.includes(`right`),i=`${this.config.floatingButtonOffset??24}px`;if(this.panel){this.panel.style.bottom=n?i:``,this.panel.style.top=n?``:i,this.panel.style.right=r?i:``,this.panel.style.left=r?``:i,this.config.theme===`light`?this.panel.classList.add(`nexa-theme-light`):this.panel.classList.remove(`nexa-theme-light`);let e=this.panel.querySelector(`.nexa-logo img`),t=this.panel.querySelector(`.nexa-title`),a=this.config.branding||`Nexa DevTools`,o=this.config.icon||`https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png`;e&&(e.src=o,e.alt=a),t&&(t.textContent=a)}this.floatingIcon&&=(this.floatingIcon.remove(),null),this.config.enabled&&(!this.config.devOnly||X())&&this.createFloatingIcon()}refreshConfig(e){this.applyConfigToUI(e)}},Z=null,Q=null,$={enabled:!0,maxHistory:500,keyboardShortcut:`ctrl+shift+n`,position:`bottom-right`,theme:`dark`,devOnly:!0,floatingButtonSize:48,floatingButtonOffset:24,floatingButtonTheme:`inherit`,branding:`Nexa DevTools`,icon:`https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png`};function Te(e={}){if(Z&&Q){let t=K(),n={...$,...e,...t},r=Q.updateConfig(n);try{Z.refreshConfig(r)}catch{}return{tracker:Q,ui:Z,config:r}}let t=K();return Q=new q({...$,...e,...t}),Z=new we(Q),{tracker:Q,ui:Z,config:Q.getConfig()}}function Ee(){return{tracker:Q,ui:Z}}function De(){Z?.destroy(),Z=null,Q=null}exports.AggressiveRetry=d,exports.CachePlugin=de,exports.CacheStore=y,exports.CircuitBreakerRetry=p,exports.ConservativeRetry=f,exports.DedupePlugin=fe,exports.Defer=oe,exports.Err=t,exports.HttpClient=R,exports.HttpError=z,exports.LoggerPlugin=le,exports.MetricsPlugin=ue,exports.MiddlewarePipeline=re,exports.Ok=e,exports.PluginManager=N,exports.RequestDeduplicator=S,exports.RequestTracker=q,exports.TypedObservable=E,exports.cacheMiddleware=x,exports.createApiUrl=k,exports.createCacheMiddleware=b,exports.createDedupeMiddleware=C,exports.createDevOverlay=Te,exports.createHttpClient=me,exports.createPipeline=w,exports.createProjectionTransformer=l,exports.createRealtimePlugin=xe,exports.createRequiredFieldsValidator=r,exports.createSSEClient=ye,exports.createSchemaValidator=n,exports.createStreamingMiddleware=M,exports.createTypeGuard=D,exports.createTypedApiClient=ae,exports.createTypedRequest=T,exports.createTypedResponse=ie,exports.createUrl=O,exports.createWebSocketClient=_e,exports.createWrapperTransformer=u,exports.dedupeMiddleware=ne,exports.destroyDevOverlay=De,exports.getDevOverlay=Ee,exports.handleStream=A,exports.isHttpError=B,exports.retry=v,exports.streamToFile=se,exports.streamingMiddleware=ce,exports.transformCamelToSnake=s,exports.transformFlatten=c,exports.transformSnakeToCamel=o,exports.validatorIsArray=i,exports.validatorIsObject=a,exports.withTimeout=te;
|
|
462
688
|
//# sourceMappingURL=nexa.cjs.js.map
|