@flowot/nx-pn-web 0.1.0 → 0.2.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.
@@ -0,0 +1 @@
1
+ :root{--bg: #f6f7f9;--surface: #ffffff;--surface-soft: #fafbfc;--surface-hover: #f0f2f5;--surface-selected: #e9f0fa;--surface-section: #f8f9fd;--line: #e2e4e9;--line-strong: #d8d8d8;--line-muted: #dbe0e5;--line-input: #a7abb2;--text: #1f2430;--text-secondary: #4a5265;--text-muted: #7a8194;--text-faint: #999999;--text-disabled: #c2c4ca;--text-inverse: #ffffff;--brand: #3b6ef5;--brand-hover: #5a87f7;--brand-pressed: #2855d4;--brand-soft: #e2edff;--color-success: #18b681;--color-success-soft: #e3f7ee;--color-warning: #ffa600;--color-warning-soft: #fff7e8;--color-error: #ff0000;--color-error-soft: #fff5f5;--color-notify: #588ce9;--color-notify-soft: #e9f0fa;--link: #0033cc;--link-hover: #0066ff;--sidebar-bg: #1e2430;--sidebar-text: #dfe3ec;--sidebar-muted: #aeb6c4;--sidebar-faint: #6e7689;--sidebar-hover: rgba(255, 255, 255, .06);--radius-sm: 4px;--radius-md: 6px;--radius-lg: 10px;--shadow-drawer: 0 12px 40px rgba(15, 18, 25, .18);--shadow-modal: 0 20px 60px rgba(15, 18, 25, .24);--h-button: 28px;--h-input: 26px;--h-thead: 30px;--h-row: 35px;--fs-base: 12px;--fs-control: 14px;--fs-title: 16px;--fs-h1: 20px;--fs-h2: 15px;--fs-h3: 13px;--font-sans: system-ui, arial, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--mask: rgba(15, 18, 25, .4)}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font-sans);font-size:var(--fs-base);line-height:1.5}#root{min-height:100vh}.layout{display:flex;min-height:100vh}.sidebar{width:200px;flex:0 0 200px;background:var(--sidebar-bg);color:var(--sidebar-text);display:flex;flex-direction:column;padding:16px 0}.brand{font-size:var(--fs-title);font-weight:700;padding:0 16px 18px;letter-spacing:.02em}.sidebar nav{flex:1}.nav-item{display:block;padding:10px 16px;color:var(--sidebar-muted);text-decoration:none;font-size:var(--fs-control);transition:background .12s,color .12s}.nav-item:hover{background:var(--sidebar-hover);color:var(--text-inverse)}.nav-item.active{background:var(--brand);color:var(--text-inverse)}.nav-sep{font-size:11px;letter-spacing:.05em;text-transform:uppercase;color:var(--sidebar-faint);padding:14px 16px 4px}.sidebar-foot{padding:12px 16px}.ws-badge{font-size:var(--fs-base);color:var(--sidebar-muted)}.ws-badge:before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--sidebar-muted);margin-right:6px}.ws-badge.on:before{background:var(--color-success)}.ws-badge.on{color:var(--sidebar-text)}.main{flex:1;padding:24px 32px;min-width:0;max-width:100%}.page{max-width:1680px;width:100%}.page h1{font-size:var(--fs-h1);font-weight:600;margin:0 0 16px;color:var(--text)}.empty{padding:60px 0;text-align:center;color:var(--text-muted)}.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);padding:16px 18px;margin-bottom:16px}.card h2{font-size:var(--fs-h2);font-weight:600;margin:0 0 14px;color:var(--text)}.muted{color:var(--text-muted);font-size:var(--fs-base)}.error-line{color:var(--color-error);margin:8px 0;font-size:var(--fs-base)}.ok-line{color:var(--color-success);margin:8px 0;font-size:var(--fs-base)}.error-box{background:var(--color-error-soft);border:1px solid #f2c6c6;color:var(--color-error);padding:24px;border-radius:var(--radius-md)}.error-box pre{white-space:pre-wrap;font-family:var(--font-mono);font-size:var(--fs-base)}.warn-box{background:var(--color-warning-soft);border:1px solid #f0d9a8;color:#8a5a00;padding:8px 12px;border-radius:var(--radius-md);margin:10px 0;font-size:var(--fs-base)}.table{width:100%;border-collapse:collapse;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);overflow:hidden;font-size:var(--fs-control)}.table th,.table td{text-align:left;padding:8px 12px;border-bottom:1px solid var(--line);vertical-align:middle;height:var(--h-row)}.table th{background:var(--surface-soft);font-weight:600;color:var(--text-secondary);font-size:var(--fs-base);text-transform:uppercase;letter-spacing:.03em;height:var(--h-thead)}.table tr:last-child td{border-bottom:none}.table.slim td{padding:4px 8px;border-bottom:1px dashed var(--line);font-size:var(--fs-base)}.mono{font-family:var(--font-mono);word-break:break-all}.key{color:var(--text-muted);width:180px;white-space:pre-wrap}.row-click{cursor:pointer;transition:background .12s}.row-click:hover{background:var(--surface-selected)}.empty-cell{text-align:center;color:var(--text-muted);padding:28px}.method{font-family:var(--font-mono);font-size:11px;font-weight:700;padding:2px 7px;border-radius:var(--radius-sm);background:var(--surface-hover);color:var(--text-secondary);display:inline-block}.method.POST{background:var(--color-warning-soft);color:#8a5a00}.method.PUT,.method.PATCH{background:var(--brand-soft);color:var(--brand-pressed)}.method.DELETE{background:var(--color-error-soft);color:#b0222f}.method.GET,.method.HEAD{background:var(--surface-hover);color:var(--text-secondary)}.status{font-family:var(--font-mono);font-weight:600}.status.ok{color:var(--color-success)}.status.warn{color:var(--color-warning)}.status.err{color:var(--color-error)}.tag{font-size:11px;padding:1px 5px;border-radius:3px;margin-left:6px;background:var(--brand-soft);color:var(--brand-pressed)}.tag.replay{background:var(--brand-soft);color:var(--brand-pressed)}.filters{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap;align-items:center}.count{color:var(--text-muted);font-size:var(--fs-base);margin-left:auto}.sort-toggle,.th-sort{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:var(--radius-md);padding:0 10px;height:var(--h-input);font-size:var(--fs-base);cursor:pointer;font-family:inherit;transition:border-color .12s,color .12s}.sort-toggle:hover,.th-sort:hover{border-color:var(--brand);color:var(--brand)}.th-sort{border:none;background:none;padding:0;height:auto;font-weight:600}input[type=text],input[type=search],input:not([type]),select,textarea{border:1px solid var(--line);border-radius:var(--radius-md);padding:0 10px;height:var(--h-input);font-size:var(--fs-control);background:var(--surface);color:var(--text);font-family:inherit;transition:border-color .12s,box-shadow .12s;outline:none}textarea{padding:6px 10px;height:auto;min-height:64px;resize:vertical;font-family:var(--font-mono)}input:hover:not(:disabled):not(:focus),select:hover:not(:disabled):not(:focus){border-color:var(--line-input)}input:focus,select:focus,textarea:focus{border-color:var(--brand);box-shadow:0 0 0 2px var(--brand-soft)}input:disabled,select:disabled,textarea:disabled{background:var(--surface-hover);color:var(--text-faint);cursor:not-allowed}input[type=file]{padding:3px 10px;height:auto}.filters input[type=text]{min-width:180px}.drawer-mask{position:fixed;top:0;right:0;bottom:0;left:0;background:var(--mask);display:flex;justify-content:flex-end;z-index:20}.drawer{background:var(--surface);width:min(720px,92vw);height:100%;overflow-y:auto;padding:20px 24px;box-shadow:var(--shadow-drawer)}.drawer-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}.drawer-head h3{margin:0 0 12px;word-break:break-all;font-size:var(--fs-title)}.drawer h4{margin:18px 0 6px;font-size:var(--fs-h3);color:var(--text-secondary);font-weight:600}.info-row{display:flex;gap:10px;margin:6px 0;font-size:var(--fs-base)}.info-label{color:var(--text-muted);width:64px;flex:0 0 64px}.body-view{background:#10131a;color:#d8dee9;padding:10px 12px;border-radius:var(--radius-md);font-family:var(--font-mono);font-size:var(--fs-base);overflow-x:auto;margin:4px 0}.body-view pre{margin:0;white-space:pre-wrap;word-break:break-word}button{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:var(--radius-md);padding:0 14px;height:var(--h-button);min-width:60px;font-size:var(--fs-control);cursor:pointer;font-family:inherit;transition:border-color .12s,color .12s,background .12s}button:hover:not(:disabled){border-color:var(--brand);color:var(--brand)}button:active:not(:disabled){background:var(--brand-soft)}button:disabled{opacity:.5;cursor:not-allowed}button.ghost{padding:0 10px;height:var(--h-input);min-width:0;font-size:var(--fs-base)}button.danger:hover{border-color:var(--color-error);color:var(--color-error)}button.danger:active:not(:disabled){background:var(--color-error-soft)}.form-actions{margin-top:18px;display:flex;gap:8px}.replay-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}@media (max-width: 900px){.replay-grid{grid-template-columns:1fr}}.select{margin-bottom:14px}.form-row{display:flex;gap:8px;align-items:center}.form-row input.url{flex:1}.replay-grid textarea{min-width:480px}.replay-grid .select{margin-bottom:14px}.field-label{display:block;margin:14px 0 6px;color:var(--text-secondary);font-size:var(--fs-base);font-weight:500}.form-row+.field-label,textarea+.field-label{margin-top:14px}textarea+.muted{margin-top:12px}.hint{font-size:var(--fs-base);color:var(--text-muted);margin:6px 0 0;line-height:1.5}.actions{white-space:nowrap}.actions button{margin-right:6px}.confirm{background:var(--surface);border-radius:var(--radius-lg);padding:20px;width:min(560px,92vw);margin:auto;align-self:center;max-height:80vh;overflow-y:auto;box-shadow:var(--shadow-modal)}.confirm h3{margin:0 0 12px;font-size:var(--fs-title);font-weight:600}.confirm-detail{background:var(--surface-soft);border:1px solid var(--line);border-radius:var(--radius-md);padding:10px 12px;font-size:var(--fs-base);margin:12px 0}.confirm-detail pre{white-space:pre-wrap;margin:8px 0 0;font-family:var(--font-mono)}.compare{display:grid;grid-template-columns:1fr 1fr;gap:12px}@media (max-width: 720px){.compare{grid-template-columns:1fr}}.compare-col h3{font-size:var(--fs-h3);font-weight:600;margin:0 0 8px;color:var(--text-secondary)}.compare-item{display:flex;justify-content:space-between;font-size:var(--fs-base);margin:4px 0;padding:2px 0}.compare-item span{color:var(--text-muted)}.compare-item b{font-weight:600}.form>label{display:block;margin:16px 0;color:var(--text-secondary);font-size:var(--fs-base)}.form>label:first-child{margin-top:0}.form>label:last-child{margin-bottom:0}.form>label select,.form>label input,.form>label textarea{display:block;width:100%;margin-top:6px}
@@ -1,16 +1,16 @@
1
- var ct=Object.defineProperty;var at=(r,e,t)=>e in r?ct(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e,t)=>at(r,typeof e!="symbol"?e+"":e,t);import{jsxs as p,jsx as c}from"react/jsx-runtime";import{useState as O,useCallback as re,useMemo as ee,useEffect as F,Component as Ue,useRef as lt,useSyncExternalStore as ut,Suspense as ht,StrictMode as ft}from"react";import{createRoot as dt}from"react-dom/client";import{NavLink as le,Routes as pt,Route as z,Navigate as gt,BrowserRouter as yt}from"react-router-dom";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();function he(r){return r==null}function A(r,e,t){return Object.defineProperty(r,e,{writable:!0,value:t,enumerable:!1})}function Oe(r,e){return arguments.length===1?t=>Oe(r,t):r in globalThis&&e instanceof globalThis[r]||Object.prototype.toString.call(e).slice(8,-1)===r}function qe(r){return Oe("ArrayBuffer",r)||Oe("SharedArrayBuffer",r)}function mt(r){return qe(r)||ArrayBuffer.isView(r)}var X;(r=>{r.is=qe,r.isSource=mt;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}r.fromSource=e;function t(o){if(o=e(o),typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const u=new Uint8Array(o);for(let h=0;h<u.byteLength;h++)a+=String.fromCharCode(u[h]);return btoa(a)}r.toBase64=t;function n(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}r.fromBase64=n;function s(o){return o=e(o),typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}r.toHex=s;function i(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),u=[];for(let h=0;h<a.length;h+=2)u.push(parseInt(`${a[h]}${a[h+1]}`,16));return Uint8Array.from(u).buffer}r.fromHex=i})(X||(X={}));X.fromBase64;X.toBase64;X.fromHex;X.toHex;function bt(r,e,t){const n=[];let s=0;for(let i=0;i<r.length;i++){const o=r.charCodeAt(i);if(o>=65&&o<=90){if(s===1){const a=r.charCodeAt(i+1);a>=97&&a<=122&&n.push(t),n.push(o+32)}else s!==0&&n.push(t),n.push(o+32);s=1}else o>=97&&o<=122?(n.push(o),s=2):e.includes(o)?(s!==0&&n.push(t),s=0):n.push(o)}return String.fromCharCode(...n)}function wt(r){return bt(r,[45,95],45)}var vt=wt,Te;(r=>{r.millisecond=1,r.second=1e3,r.minute=r.second*60,r.hour=r.minute*60,r.day=r.hour*24,r.week=r.day*7;let e=new Date().getTimezoneOffset();function t(y){e=y}r.setTimezoneOffset=t;function n(){return e}r.getTimezoneOffset=n;function s(y=new Date,g){return typeof y=="number"&&(y=new Date(y)),g===void 0&&(g=e),Math.floor((y.valueOf()/r.minute-g)/1440)}r.getDateNumber=s;function i(y,g){const v=new Date(y*r.day);return g===void 0&&(g=e),new Date(+v+g*r.minute)}r.fromDateNumber=i;const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(y=>`(${o}${y})?`).join("")}$`);function u(y){const g=a.exec(y);return g?(parseFloat(g[1])*r.week||0)+(parseFloat(g[2])*r.day||0)+(parseFloat(g[3])*r.hour||0)+(parseFloat(g[4])*r.minute||0)+(parseFloat(g[5])*r.second||0):0}r.parseTime=u;function h(y){const g=u(y);return g?y=Date.now()+g:/^\d{1,2}(:\d{1,2}){1,2}$/.test(y)?y=`${new Date().toLocaleDateString()}-${y}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(y)&&(y=`${new Date().getFullYear()}-${y}`),y?new Date(y):new Date}r.parseDate=h;function m(y){const g=Math.abs(y);return g>=r.day-r.hour/2?Math.round(y/r.day)+"d":g>=r.hour-r.minute/2?Math.round(y/r.hour)+"h":g>=r.minute-r.second/2?Math.round(y/r.minute)+"m":g>=r.second?Math.round(y/r.second)+"s":y+"ms"}r.format=m;function w(y,g=2){return y.toString().padStart(g,"0")}r.toDigits=w;function S(y,g=new Date){return y.replace("yyyy",g.getFullYear().toString()).replace("yy",g.getFullYear().toString().slice(2)).replace("MM",w(g.getMonth()+1)).replace("dd",w(g.getDate())).replace("hh",w(g.getHours())).replace("mm",w(g.getMinutes())).replace("ss",w(g.getSeconds())).replace("SSS",w(g.getMilliseconds(),3))}r.template=S})(Te||(Te={}));var xt=Object.defineProperty,d=(r,e)=>xt(r,"name",{value:e,configurable:!0}),J,Pe=(J=class{constructor(){l(this,"sn",0);l(this,"map",new Map);l(this,"weak",new WeakMap)}get length(){return this.map.size}push(e){const t=++this.sn;return this.map.set(t,e),this.weak.set(e,t),()=>this.map.delete(t)}delete(e){const t=this.weak.get(e);return t?this.map.delete(t):!1}clear(){const e=[...this.map.values()];return this.map.clear(),e.reverse()}[Symbol.iterator](){return this.map.values()}[Symbol.for("nodejs.util.inspect.custom")](){return[...this]}},d(J,"DisposableList"),J),f={shadow:Symbol.for("cordis.shadow"),caller:Symbol.for("cordis.caller"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),metadata:Symbol.for("cordis.metadata"),initHooks:Symbol.for("cordis.initHooks"),checkProto:Symbol.for("cordis.checkProto"),effect:Symbol.for("cordis.effect"),filter:Symbol.for("cordis.filter"),isolate:Symbol.for("cordis.isolate"),intercept:Symbol.for("cordis.intercept"),init:Symbol.for("cordis.init"),check:Symbol.for("cordis.check"),config:Symbol.for("cordis.config"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),resolveConfig:Symbol.for("cordis.resolveConfig")},St=(function*(){}).constructor,De=(async function*(){}).constructor;function Je(r){return!(!r.prototype||r instanceof St||De!==Function&&r instanceof De)}d(Je,"isConstructor");function me(r,e){if(r===Object.prototype)return e;const t=Object.create(me(Object.getPrototypeOf(r),e));for(const n of Reflect.ownKeys(r))Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n));return t}d(me,"joinPrototype");function ne(r){return r&&(typeof r=="object"||typeof r=="function")}d(ne,"isObject");function je(r,e){let t=r;for(;t;){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;t=Object.getPrototypeOf(t)}}d(je,"getPropertyDescriptor");function D(r,e){if(!ne(e))return e;if(Object.hasOwn(e,f.shadow))return Object.getPrototypeOf(e);const t=e[f.tracker];return t?be(r,e,t):e}d(D,"getTraceable");function se(r,e){return e?new Proxy(r,{get:d((t,n,s)=>n in e&&n!=="constructor"?Reflect.get(e,n,s):Reflect.get(t,n,s),"get"),set:d((t,n,s,i)=>n in e&&n!=="constructor"?Reflect.set(e,n,s,i):Reflect.set(t,n,s,i),"set")}):r}d(se,"withProps");function pe(r,e,t){return se(r,Object.defineProperty(Object.create(null),e,{value:t,writable:!1}))}d(pe,"withProp");function Q(r,e,t,n){var i;if(!t)return n;const s=(i=je(e,t))==null?void 0:i.value;return s?pe(n,t,r.extend({[f.shadow]:s})):n}d(Q,"createShadow");function Ve(r,e,t,n){return new Proxy(e,{apply:d((s,i,o)=>(i===t&&(i=n),D(r,Reflect.apply(s,i,o))),"apply")})}d(Ve,"createShadowMethod");function be(r,e,t){const n=r[f.shadow]??r;r[f.shadow]&&(r=Object.getPrototypeOf(r));const s=new Proxy(e,{get:d((i,o,a)=>{if(o===f.original)return i;if(o===f.caller)return n;if(o===t.property)return r;if(typeof o=="symbol")return Reflect.get(i,o,a);if(t.associate&&r.reflect.props[`${t.associate}.${o}`])return Reflect.get(r,`${t.associate}.${o}`,pe(r,f.receiver,a));let u,h;const m=je(i,o);m&&"value"in m?h=m.value:(u=Q(r,i,t.property,a),h=Reflect.get(i,o,u));const w=h==null?void 0:h[f.tracker];return w?be(r,h,w):!t.noShadow&&typeof h=="function"?(u??(u=Q(r,i,t.property,a)),Ve(r,h,a,u)):h},"get"),set:d((i,o,a,u)=>{if(o===f.original||o===f.caller||o===t.property)return!1;if(typeof o=="symbol")return Reflect.set(i,o,a,u);if(t.associate&&r.reflect.props[`${t.associate}.${o}`])return Reflect.set(r,`${t.associate}.${o}`,a,pe(r,f.receiver,u));const h=Q(r,i,t.property,u);return Reflect.set(i,o,a,h)},"set"),apply:d((i,o,a)=>{const u=t.noShadow?s:Q(r,i,t.property,s);return Ke(u,i,o,a)},"apply")});return s}d(be,"createTraceable");function Ke(r,e,t,n){return e[f.invoke]?e[f.invoke].apply(r,n):Reflect.apply(e,t,n)}d(Ke,"applyTraceable");function ge(r,e,t){const n=d(function(...s){const i=be(n.ctx,n,t);return Reflect.apply(i,this,s)},"self");return A(n,"name",r),Object.setPrototypeOf(n,e)}d(ge,"createCallable");function ke(r,e,t){const n=r.error.stack.split(`
1
+ var at=Object.defineProperty;var lt=(r,e,t)=>e in r?at(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e,t)=>lt(r,typeof e!="symbol"?e+"":e,t);import{jsxs as p,jsx as c}from"react/jsx-runtime";import{useState as O,useCallback as re,useMemo as ee,useEffect as F,Component as qe,useRef as ut,useSyncExternalStore as ht,Suspense as ft,StrictMode as dt}from"react";import{createRoot as pt}from"react-dom/client";import{NavLink as le,Routes as gt,Route as z,Navigate as yt,BrowserRouter as mt}from"react-router-dom";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();function he(r){return r==null}function A(r,e,t){return Object.defineProperty(r,e,{writable:!0,value:t,enumerable:!1})}function ke(r,e){return arguments.length===1?t=>ke(r,t):r in globalThis&&e instanceof globalThis[r]||Object.prototype.toString.call(e).slice(8,-1)===r}function Je(r){return ke("ArrayBuffer",r)||ke("SharedArrayBuffer",r)}function bt(r){return Je(r)||ArrayBuffer.isView(r)}var X;(r=>{r.is=Je,r.isSource=bt;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}r.fromSource=e;function t(o){if(o=e(o),typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const u=new Uint8Array(o);for(let h=0;h<u.byteLength;h++)a+=String.fromCharCode(u[h]);return btoa(a)}r.toBase64=t;function n(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}r.fromBase64=n;function s(o){return o=e(o),typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}r.toHex=s;function i(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),u=[];for(let h=0;h<a.length;h+=2)u.push(parseInt(`${a[h]}${a[h+1]}`,16));return Uint8Array.from(u).buffer}r.fromHex=i})(X||(X={}));X.fromBase64;X.toBase64;X.fromHex;X.toHex;function wt(r,e,t){const n=[];let s=0;for(let i=0;i<r.length;i++){const o=r.charCodeAt(i);if(o>=65&&o<=90){if(s===1){const a=r.charCodeAt(i+1);a>=97&&a<=122&&n.push(t),n.push(o+32)}else s!==0&&n.push(t),n.push(o+32);s=1}else o>=97&&o<=122?(n.push(o),s=2):e.includes(o)?(s!==0&&n.push(t),s=0):n.push(o)}return String.fromCharCode(...n)}function vt(r){return wt(r,[45,95],45)}var xt=vt,De;(r=>{r.millisecond=1,r.second=1e3,r.minute=r.second*60,r.hour=r.minute*60,r.day=r.hour*24,r.week=r.day*7;let e=new Date().getTimezoneOffset();function t(y){e=y}r.setTimezoneOffset=t;function n(){return e}r.getTimezoneOffset=n;function s(y=new Date,g){return typeof y=="number"&&(y=new Date(y)),g===void 0&&(g=e),Math.floor((y.valueOf()/r.minute-g)/1440)}r.getDateNumber=s;function i(y,g){const v=new Date(y*r.day);return g===void 0&&(g=e),new Date(+v+g*r.minute)}r.fromDateNumber=i;const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(y=>`(${o}${y})?`).join("")}$`);function u(y){const g=a.exec(y);return g?(parseFloat(g[1])*r.week||0)+(parseFloat(g[2])*r.day||0)+(parseFloat(g[3])*r.hour||0)+(parseFloat(g[4])*r.minute||0)+(parseFloat(g[5])*r.second||0):0}r.parseTime=u;function h(y){const g=u(y);return g?y=Date.now()+g:/^\d{1,2}(:\d{1,2}){1,2}$/.test(y)?y=`${new Date().toLocaleDateString()}-${y}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(y)&&(y=`${new Date().getFullYear()}-${y}`),y?new Date(y):new Date}r.parseDate=h;function m(y){const g=Math.abs(y);return g>=r.day-r.hour/2?Math.round(y/r.day)+"d":g>=r.hour-r.minute/2?Math.round(y/r.hour)+"h":g>=r.minute-r.second/2?Math.round(y/r.minute)+"m":g>=r.second?Math.round(y/r.second)+"s":y+"ms"}r.format=m;function w(y,g=2){return y.toString().padStart(g,"0")}r.toDigits=w;function S(y,g=new Date){return y.replace("yyyy",g.getFullYear().toString()).replace("yy",g.getFullYear().toString().slice(2)).replace("MM",w(g.getMonth()+1)).replace("dd",w(g.getDate())).replace("hh",w(g.getHours())).replace("mm",w(g.getMinutes())).replace("ss",w(g.getSeconds())).replace("SSS",w(g.getMilliseconds(),3))}r.template=S})(De||(De={}));var St=Object.defineProperty,d=(r,e)=>St(r,"name",{value:e,configurable:!0}),J,je=(J=class{constructor(){l(this,"sn",0);l(this,"map",new Map);l(this,"weak",new WeakMap)}get length(){return this.map.size}push(e){const t=++this.sn;return this.map.set(t,e),this.weak.set(e,t),()=>this.map.delete(t)}delete(e){const t=this.weak.get(e);return t?this.map.delete(t):!1}clear(){const e=[...this.map.values()];return this.map.clear(),e.reverse()}[Symbol.iterator](){return this.map.values()}[Symbol.for("nodejs.util.inspect.custom")](){return[...this]}},d(J,"DisposableList"),J),f={shadow:Symbol.for("cordis.shadow"),caller:Symbol.for("cordis.caller"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),metadata:Symbol.for("cordis.metadata"),initHooks:Symbol.for("cordis.initHooks"),checkProto:Symbol.for("cordis.checkProto"),effect:Symbol.for("cordis.effect"),filter:Symbol.for("cordis.filter"),isolate:Symbol.for("cordis.isolate"),intercept:Symbol.for("cordis.intercept"),init:Symbol.for("cordis.init"),check:Symbol.for("cordis.check"),config:Symbol.for("cordis.config"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),resolveConfig:Symbol.for("cordis.resolveConfig")},Ot=(function*(){}).constructor,Me=(async function*(){}).constructor;function Ge(r){return!(!r.prototype||r instanceof Ot||Me!==Function&&r instanceof Me)}d(Ge,"isConstructor");function me(r,e){if(r===Object.prototype)return e;const t=Object.create(me(Object.getPrototypeOf(r),e));for(const n of Reflect.ownKeys(r))Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n));return t}d(me,"joinPrototype");function ne(r){return r&&(typeof r=="object"||typeof r=="function")}d(ne,"isObject");function Ce(r,e){let t=r;for(;t;){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;t=Object.getPrototypeOf(t)}}d(Ce,"getPropertyDescriptor");function D(r,e){if(!ne(e))return e;if(Object.hasOwn(e,f.shadow))return Object.getPrototypeOf(e);const t=e[f.tracker];return t?be(r,e,t):e}d(D,"getTraceable");function se(r,e){return e?new Proxy(r,{get:d((t,n,s)=>n in e&&n!=="constructor"?Reflect.get(e,n,s):Reflect.get(t,n,s),"get"),set:d((t,n,s,i)=>n in e&&n!=="constructor"?Reflect.set(e,n,s,i):Reflect.set(t,n,s,i),"set")}):r}d(se,"withProps");function pe(r,e,t){return se(r,Object.defineProperty(Object.create(null),e,{value:t,writable:!1}))}d(pe,"withProp");function Q(r,e,t,n){var i;if(!t)return n;const s=(i=Ce(e,t))==null?void 0:i.value;return s?pe(n,t,r.extend({[f.shadow]:s})):n}d(Q,"createShadow");function Ve(r,e,t,n){return new Proxy(e,{apply:d((s,i,o)=>(i===t&&(i=n),D(r,Reflect.apply(s,i,o))),"apply")})}d(Ve,"createShadowMethod");function be(r,e,t){const n=r[f.shadow]??r;r[f.shadow]&&(r=Object.getPrototypeOf(r));const s=new Proxy(e,{get:d((i,o,a)=>{if(o===f.original)return i;if(o===f.caller)return n;if(o===t.property)return r;if(typeof o=="symbol")return Reflect.get(i,o,a);if(t.associate&&r.reflect.props[`${t.associate}.${o}`])return Reflect.get(r,`${t.associate}.${o}`,pe(r,f.receiver,a));let u,h;const m=Ce(i,o);m&&"value"in m?h=m.value:(u=Q(r,i,t.property,a),h=Reflect.get(i,o,u));const w=h==null?void 0:h[f.tracker];return w?be(r,h,w):!t.noShadow&&typeof h=="function"?(u??(u=Q(r,i,t.property,a)),Ve(r,h,a,u)):h},"get"),set:d((i,o,a,u)=>{if(o===f.original||o===f.caller||o===t.property)return!1;if(typeof o=="symbol")return Reflect.set(i,o,a,u);if(t.associate&&r.reflect.props[`${t.associate}.${o}`])return Reflect.set(r,`${t.associate}.${o}`,a,pe(r,f.receiver,u));const h=Q(r,i,t.property,u);return Reflect.set(i,o,a,h)},"set"),apply:d((i,o,a)=>{const u=t.noShadow?s:Q(r,i,t.property,s);return Ke(u,i,o,a)},"apply")});return s}d(be,"createTraceable");function Ke(r,e,t,n){return e[f.invoke]?e[f.invoke].apply(r,n):Reflect.apply(e,t,n)}d(Ke,"applyTraceable");function ge(r,e,t){const n=d(function(...s){const i=be(n.ctx,n,t);return Reflect.apply(i,this,s)},"self");return A(n,"name",r),Object.setPrototypeOf(n,e)}d(ge,"createCallable");function Ee(r,e,t){const n=r.error.stack.split(`
2
2
  `);if(typeof(e==null?void 0:e.stack)!="string"){const o=new Error(e),a=o.stack.split(`
3
3
  `);throw a.splice(1,1/0,...t()),o.stack=a.join(`
4
4
  `),o}const s=e.stack.split(`
5
5
  `);let i=s.indexOf(n[2]);if(i===-1)throw e;for(i-=r.offset;i>0&&s[i-1].endsWith(" (<anonymous>)");)i-=1;throw s.splice(i,1/0,...t()),e.stack=s.join(`
6
- `),e}d(ke,"handleError");function Ee(r,e=we()){const t={offset:1,error:new Error};try{const n=r(t);return ne(n)&&"then"in n?n.then(void 0,s=>ke(t,s,e)):n}catch(n){ke(t,n,e)}}d(Ee,"composeError");function we(r=0){const e=new Error;return()=>e.stack.split(`
7
- `).slice(3+r)}d(we,"buildOuterStack");function Re(r){return r!==null&&r!==!1&&r!==void 0}d(Re,"isBailed");var V,Ot=(V=class{constructor(e){l(this,"ctx");l(this,"_hooks",Object.create(null));this.ctx=e,A(this,f.tracker,{property:"ctx",noShadow:!0}),this.on("internal/listener",function(t,n,s){var i;if(t==="internal/update"&&!s.global){const o=(i=this.fiber._hooks)["internal/update"]??(i["internal/update"]=new Pe),a=s.prepend?"unshift":"push";return o[a](n)}}),this.on("internal/update",function(t,n,s){const i=[...this._hooks["internal/update"]||[]],o=d(()=>(i.shift()??s).call(this,t,n,o),"_next");return o()},{global:!0,prepend:!0})}_resolve(e,t){var o;const n=typeof t[0]=="object"||typeof t[0]=="function"?t.shift():null,s=t.shift();(typeof s!="string"||!s.startsWith("internal/"))&&((o=this._hooks["internal/dispatch"])!=null&&o.length)&&this.emit("internal/dispatch",e,s,t,n);const i=n==null?void 0:n[q.filter];return[n,(this._hooks[s]||[]).filter(a=>a.global||!i||i.call(n,a.ctx)).map(a=>a.callback)]}dispatch(e,t){const[n,s]=this._resolve(e,t);return s.map(i=>i.bind(n))}async parallel(...e){const[t,n]=this._resolve("emit",e),i=(await Promise.allSettled(n.map(async o=>Reflect.apply(o,t,e)))).filter(o=>o.status==="rejected");if(i.length)throw new AggregateError(i.map(o=>o.reason))}emit(...e){const[t,n]=this._resolve("emit",e);for(const s of n)Reflect.apply(s,t,e)}async serial(...e){const[t,n]=this._resolve("serial",e);for(const s of n){const i=await Reflect.apply(s,t,e);if(Re(i))return i}}bail(...e){const[t,n]=this._resolve("bail",e);for(const s of n){const i=Reflect.apply(s,t,e);if(Re(i))return i}}waterfall(...e){const[t,n]=this._resolve("waterfall",e),s=e.pop(),i=d(()=>{const o=n.shift();return o?Reflect.apply(o,t,e):s(...e)},"next");return e.push(i),i()}register(e,t,n,s){const i=s.prepend?"unshift":"push";return this.ctx.fiber.effect(()=>{var a;return((a=this._hooks)[t]??(a[t]=[]))[i]({ctx:this.ctx,callback:n,...s}),()=>this.unregister(t,n)},e)}unregister(e,t){const n=this._hooks[e];if(!n)return;const s=n.findIndex(i=>i.callback===t);if(s>=0)return n.splice(s,1),n.length||delete this._hooks[e],!0}on(e,t,n){typeof n!="object"&&(n={prepend:n}),this.ctx.fiber.assertActive(),t=this.ctx.reflect.bind(t);const s=this.bail(this.ctx,"internal/listener",e,t,n);if(s)return s;const i=`ctx.on(${typeof e=="string"?JSON.stringify(e):e.toString()})`;return this.register(i,e,t,n)}once(e,t,n){const s=this.on(e,function(...i){return s(),t.apply(this,i)},n);return s}},d(V,"EventsService"),V),Me={s:d(r=>String(r),"s"),d:d(r=>Math.trunc(Number(r)),"d"),i:d(r=>Math.trunc(Number(r)),"i"),f:d(r=>Number(r),"f"),o:d(r=>JSON.stringify(r),"o"),O:d(r=>JSON.stringify(r),"O"),c:d(()=>"","c"),C:d((r,e,t)=>Ne.color(e,Ne.code(t.name,e.colors),r),"C")};function Ge(r){return r instanceof Error&&Array.isArray(r.errors)}d(Ge,"isAggregateError");var K,Ne=(K=class{constructor(e,t){l(this,"service");this.service=t,Object.assign(this,e),this.error=this._method("error",0),this.info=this._method("info",2),this.warn=this._method("warn",1),this.debug=this._method("debug",3)}static color(e,t,n,s=""){return e.colors?`\x1B[3${t<8?t:"8;5;"+t}${e.colors>=2?s:""}m${n}\x1B[0m`:""+n}static code(e,t){let n=0;for(let i=0;i<e.length;i++)n=(n<<3)-n+e.charCodeAt(i)+13,n|=0;const s=t?t>=2?Et:kt:[];return s[Math.abs(n)%s.length]}static format(e,t){var a;const n=t.args.slice();n[0]instanceof Error?(n[0]=n[0].stack||n[0].message,n.unshift("%s")):typeof n[0]!="string"&&n.unshift("%o");let s=n.shift();s=s.replace(/%([a-zA-Z%])/g,(u,h)=>{var w;if(u==="%%")return"%";const m=((w=e.formatters)==null?void 0:w[h])??Me[h];if(typeof m=="function"){const S=n.shift();return m(S,e,t)}return u});const i=((a=e.formatters)==null?void 0:a.o)??Me.o;for(let u of n)typeof u=="object"&&u&&(u=i(u,e,t)),s+=" "+u;const{maxLength:o=10240}=e;return s.split(/\r?\n/g).map(u=>u.slice(0,o)+(u.length>o?"...":"")).join(`
8
- `)}_method(e,t){return(...n)=>{var o,a;if(n.length===1&&n[0]instanceof Error){if(n[0].cause)this[e](n[0].cause);else if(Ge(n[0])){n[0].errors.forEach(u=>this[e](u));return}}const s=++this.service._snMessage,i=Date.now();for(const u of this.service.exporters.values()){if((((o=u.levels)==null?void 0:o[this.name])??((a=u.levels)==null?void 0:a.default)??this.level??2)<t)continue;const m={sn:s,ts:i,type:e,level:t,name:this.name,...this.meta,args:n};u.export(m)}}}},d(K,"Logger"),K),kt=[6,2,3,4,5,1],Et=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221],L,Rt=(L=class{constructor(e){l(this,"bufferSize",1e3);l(this,"buffer",[]);l(this,"ctx");l(this,"_snMessage",0);l(this,"_snExporter",0);l(this,"exporters",new Map);const t={property:"ctx",noShadow:!0},n=ge("logger",me(Object.getPrototypeOf(this),Function.prototype),t);return Object.assign(n,this),n.ctx=e,A(n,f.tracker,t),n.exporter({colors:3,export:d(s=>{n.buffer.push(s);const i=n.buffer.length-n.bufferSize;i===1?n.buffer.shift():i>1&&n.buffer.splice(0,i)},"export")}),n}exporter(e){return this.ctx.effect(()=>{const t=++this._snExporter;return this.exporters.set(t,e),()=>this.exporters.delete(t)},"ctx.logger.exporter()")}_resolveConfig(){let e=this.ctx[f.intercept];const t=[];for(;"logger"in e;)Object.hasOwn(e,"logger")&&t.unshift(e.logger),e=Object.getPrototypeOf(e);return Object.assign({},...t)}[f.invoke](e){const t=this._resolveConfig(),s=(this[f.caller]??this.ctx).fiber;return e??(e=t.name),e??(e=vt(s.name)),new Ne({name:e,level:t.level,meta:{fiber:new WeakRef(s)}},this)}},d(L,"LoggerService"),(()=>{for(const e of["error","info","warn","debug"])L.prototype[e]=function(...t){return this()[e](...t)}})(),L),Nt=Symbol.for("ValidationError"),G,We=(G=class extends TypeError{constructor(t){super(`invalid config:
6
+ `),e}d(Ee,"handleError");function Re(r,e=we()){const t={offset:1,error:new Error};try{const n=r(t);return ne(n)&&"then"in n?n.then(void 0,s=>Ee(t,s,e)):n}catch(n){Ee(t,n,e)}}d(Re,"composeError");function we(r=0){const e=new Error;return()=>e.stack.split(`
7
+ `).slice(3+r)}d(we,"buildOuterStack");function Ne(r){return r!==null&&r!==!1&&r!==void 0}d(Ne,"isBailed");var G,kt=(G=class{constructor(e){l(this,"ctx");l(this,"_hooks",Object.create(null));this.ctx=e,A(this,f.tracker,{property:"ctx",noShadow:!0}),this.on("internal/listener",function(t,n,s){var i;if(t==="internal/update"&&!s.global){const o=(i=this.fiber._hooks)["internal/update"]??(i["internal/update"]=new je),a=s.prepend?"unshift":"push";return o[a](n)}}),this.on("internal/update",function(t,n,s){const i=[...this._hooks["internal/update"]||[]],o=d(()=>(i.shift()??s).call(this,t,n,o),"_next");return o()},{global:!0,prepend:!0})}_resolve(e,t){var o;const n=typeof t[0]=="object"||typeof t[0]=="function"?t.shift():null,s=t.shift();(typeof s!="string"||!s.startsWith("internal/"))&&((o=this._hooks["internal/dispatch"])!=null&&o.length)&&this.emit("internal/dispatch",e,s,t,n);const i=n==null?void 0:n[q.filter];return[n,(this._hooks[s]||[]).filter(a=>a.global||!i||i.call(n,a.ctx)).map(a=>a.callback)]}dispatch(e,t){const[n,s]=this._resolve(e,t);return s.map(i=>i.bind(n))}async parallel(...e){const[t,n]=this._resolve("emit",e),i=(await Promise.allSettled(n.map(async o=>Reflect.apply(o,t,e)))).filter(o=>o.status==="rejected");if(i.length)throw new AggregateError(i.map(o=>o.reason))}emit(...e){const[t,n]=this._resolve("emit",e);for(const s of n)Reflect.apply(s,t,e)}async serial(...e){const[t,n]=this._resolve("serial",e);for(const s of n){const i=await Reflect.apply(s,t,e);if(Ne(i))return i}}bail(...e){const[t,n]=this._resolve("bail",e);for(const s of n){const i=Reflect.apply(s,t,e);if(Ne(i))return i}}waterfall(...e){const[t,n]=this._resolve("waterfall",e),s=e.pop(),i=d(()=>{const o=n.shift();return o?Reflect.apply(o,t,e):s(...e)},"next");return e.push(i),i()}register(e,t,n,s){const i=s.prepend?"unshift":"push";return this.ctx.fiber.effect(()=>{var a;return((a=this._hooks)[t]??(a[t]=[]))[i]({ctx:this.ctx,callback:n,...s}),()=>this.unregister(t,n)},e)}unregister(e,t){const n=this._hooks[e];if(!n)return;const s=n.findIndex(i=>i.callback===t);if(s>=0)return n.splice(s,1),n.length||delete this._hooks[e],!0}on(e,t,n){typeof n!="object"&&(n={prepend:n}),this.ctx.fiber.assertActive(),t=this.ctx.reflect.bind(t);const s=this.bail(this.ctx,"internal/listener",e,t,n);if(s)return s;const i=`ctx.on(${typeof e=="string"?JSON.stringify(e):e.toString()})`;return this.register(i,e,t,n)}once(e,t,n){const s=this.on(e,function(...i){return s(),t.apply(this,i)},n);return s}},d(G,"EventsService"),G),Le={s:d(r=>String(r),"s"),d:d(r=>Math.trunc(Number(r)),"d"),i:d(r=>Math.trunc(Number(r)),"i"),f:d(r=>Number(r),"f"),o:d(r=>JSON.stringify(r),"o"),O:d(r=>JSON.stringify(r),"O"),c:d(()=>"","c"),C:d((r,e,t)=>Ie.color(e,Ie.code(t.name,e.colors),r),"C")};function We(r){return r instanceof Error&&Array.isArray(r.errors)}d(We,"isAggregateError");var V,Ie=(V=class{constructor(e,t){l(this,"service");this.service=t,Object.assign(this,e),this.error=this._method("error",0),this.info=this._method("info",2),this.warn=this._method("warn",1),this.debug=this._method("debug",3)}static color(e,t,n,s=""){return e.colors?`\x1B[3${t<8?t:"8;5;"+t}${e.colors>=2?s:""}m${n}\x1B[0m`:""+n}static code(e,t){let n=0;for(let i=0;i<e.length;i++)n=(n<<3)-n+e.charCodeAt(i)+13,n|=0;const s=t?t>=2?Rt:Et:[];return s[Math.abs(n)%s.length]}static format(e,t){var a;const n=t.args.slice();n[0]instanceof Error?(n[0]=n[0].stack||n[0].message,n.unshift("%s")):typeof n[0]!="string"&&n.unshift("%o");let s=n.shift();s=s.replace(/%([a-zA-Z%])/g,(u,h)=>{var w;if(u==="%%")return"%";const m=((w=e.formatters)==null?void 0:w[h])??Le[h];if(typeof m=="function"){const S=n.shift();return m(S,e,t)}return u});const i=((a=e.formatters)==null?void 0:a.o)??Le.o;for(let u of n)typeof u=="object"&&u&&(u=i(u,e,t)),s+=" "+u;const{maxLength:o=10240}=e;return s.split(/\r?\n/g).map(u=>u.slice(0,o)+(u.length>o?"...":"")).join(`
8
+ `)}_method(e,t){return(...n)=>{var o,a;if(n.length===1&&n[0]instanceof Error){if(n[0].cause)this[e](n[0].cause);else if(We(n[0])){n[0].errors.forEach(u=>this[e](u));return}}const s=++this.service._snMessage,i=Date.now();for(const u of this.service.exporters.values()){if((((o=u.levels)==null?void 0:o[this.name])??((a=u.levels)==null?void 0:a.default)??this.level??2)<t)continue;const m={sn:s,ts:i,type:e,level:t,name:this.name,...this.meta,args:n};u.export(m)}}}},d(V,"Logger"),V),Et=[6,2,3,4,5,1],Rt=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221],L,Nt=(L=class{constructor(e){l(this,"bufferSize",1e3);l(this,"buffer",[]);l(this,"ctx");l(this,"_snMessage",0);l(this,"_snExporter",0);l(this,"exporters",new Map);const t={property:"ctx",noShadow:!0},n=ge("logger",me(Object.getPrototypeOf(this),Function.prototype),t);return Object.assign(n,this),n.ctx=e,A(n,f.tracker,t),n.exporter({colors:3,export:d(s=>{n.buffer.push(s);const i=n.buffer.length-n.bufferSize;i===1?n.buffer.shift():i>1&&n.buffer.splice(0,i)},"export")}),n}exporter(e){return this.ctx.effect(()=>{const t=++this._snExporter;return this.exporters.set(t,e),()=>this.exporters.delete(t)},"ctx.logger.exporter()")}_resolveConfig(){let e=this.ctx[f.intercept];const t=[];for(;"logger"in e;)Object.hasOwn(e,"logger")&&t.unshift(e.logger),e=Object.getPrototypeOf(e);return Object.assign({},...t)}[f.invoke](e){const t=this._resolveConfig(),s=(this[f.caller]??this.ctx).fiber;return e??(e=t.name),e??(e=xt(s.name)),new Ie({name:e,level:t.level,meta:{fiber:new WeakRef(s)}},this)}},d(L,"LoggerService"),(()=>{for(const e of["error","info","warn","debug"])L.prototype[e]=function(...t){return this()[e](...t)}})(),L),It=Symbol.for("ValidationError"),K,Ye=(K=class extends TypeError{constructor(t){super(`invalid config:
9
9
  `+t.map(n=>n.path?` - ${n.message} (at ${n.path.join(".")})`:` - ${n.message}`).join(`
10
- `));l(this,"name","ValidationError")}},d(G,"ValidationError"),G);Object.defineProperty(We.prototype,Nt,{value:!0});function Ie(r,e){if(!r.Config)return e;const t=r.Config["~standard"].validate(e);if("then"in t)throw new TypeError("Async config validation is not supported");if(t.issues)throw new We(t.issues);return t.value}d(Ie,"resolveConfig");var B,_e=(B=class extends Error{constructor(t,n){super(n??B.Code[t]);l(this,"code");this.code=t}},d(B,"CordisError"),B);(r=>{r.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(_e||(_e={}));var $="__INACTIVE__",W,Ye=(W=class{constructor(e,t,n,s,i){l(this,"parent");l(this,"inject");l(this,"runtime");l(this,"uid");l(this,"ctx");l(this,"config");l(this,"state",0);l(this,"dispose");l(this,"store");l(this,"inertia");l(this,"_hooks",Object.create(null));l(this,"_disposables",new Pe);l(this,"context");l(this,"_error");l(this,"_runner");l(this,"_store",Object.create(null));this.parent=e,this.inject=n,this.runtime=s;const o=d(a=>{this._disposables.push(a)},"collect");if(s){this.uid=e.registry.counter,this.ctx=this.context=e.extend({fiber:this});const a=Object.entries(this.inject);if(a.length){this.ctx[q.intercept]=Object.create(e[q.intercept]);for(const[u,h]of a)he(h)||(this.ctx[q.intercept][u]=h)}this._runner={epoch:$,getOuterStack:i,execute:d(function(){var u;if(Je(s.callback)){const h=new s.callback(this.ctx,this.config);for(const m of(h==null?void 0:h[f.initHooks])??[])m();return(u=h==null?void 0:h[f.init])==null?void 0:u.call(h)}else return s.callback(this.ctx,this.config)},"execute"),collect:o},this.context.emit("internal/plugin",this);for(const u of Object.keys(this.inject))this._checkImpl(u);this.dispose=e.fiber.effect(()=>{const u=s.fibers.push(this);try{this.config=Ie(s,t),this._refresh()}catch(h){this.ctx.logger.error(h),this._error=h}return async()=>{for(this.uid=null,this.context.emit("internal/plugin",this),this.ctx.registry.has(s.callback)&&(u(),s.fibers.length||this.ctx.registry.delete(s.callback)),this._setEpoch($);this.inertia;)await this.inertia}},"ctx.plugin()")}else this.uid=0,this.ctx=this.context=e,this.state=2,this.store=Object.create(null),this._runner={epoch:"",getOuterStack:i,execute:d(()=>{},"execute"),collect:o},this.dispose=()=>this.restart()}get name(){var t;let e=this;do{if((t=e.runtime)!=null&&t.name)return e.runtime.name;e=e.parent.fiber}while(e!==e.parent.fiber);return"root"}assertActive(){if(this.uid===null)throw new _e("INACTIVE_EFFECT")}_execute(e){const t=e.epoch;return Ee(n=>{const s=d(o=>{if(typeof o=="function")e.collect(o);else if(!he(o))throw new TypeError("Invalid effect")},"safeCollect"),i=e.execute.call(this);if(typeof i=="function")return e.collect(i);if(!he(i))if(ne(i)){if("then"in i)return i.then(s);if(Symbol.iterator in i){n.error=new Error;const o=i[Symbol.iterator]();for(;;){const a=o.next();if(s(a.value),a.done)return}}else if(Symbol.asyncIterator in i){const o=i[Symbol.asyncIterator]();return(async()=>{for(await Promise.resolve(),n.error=new Error;;){if(e.epoch!==t)return;const a=await o.next();if(s(a.value),a.done)return}})()}else throw new TypeError("Invalid effect")}else throw new TypeError("Invalid effect")},e.getOuterStack)}effect(e,t="anonymous"){this.assertActive();const n=[],s=d(()=>{let m;for(const w of n.splice(0).reverse())if(m)m=m.then(w);else{const S=w();ne(S)&&"then"in S&&(m=S)}return m},"dispose"),i={label:t,children:[]},o={execute:e,epoch:!0,collect:d(m=>{n.push(m),this._disposables.delete(m),m[f.effect]&&i.children.push(m[f.effect])},"collect"),getOuterStack:we()};let a;try{a=this._execute(o)}catch(m){throw s(),m}a==null||a.catch(s).catch(m=>this.ctx.logger.error(m));const u=A(()=>{if(o.epoch)return o.epoch=!1,a?a.then(s):s()},f.effect,i),h=d(()=>{if(o.epoch)return o.epoch=!1,s()},"disposeAsync");return u.then=async(m,w)=>Promise.resolve(a).then(()=>h).then(m,w),n.push(this._disposables.push(u)),u}getEffects(){return[...this._disposables].map(e=>e[f.effect]).filter(Boolean)}_getState(){return this.uid===null?4:this._error?3:this._runner.epoch!==$?2:0}_updateState(e){const t=this.state;if(this.state=e()??this._getState(),t!==this.state&&(this.context.emit("internal/status",this,t),!(t!==2&&this.state!==2)))for(const n of Reflect.ownKeys(this.ctx.reflect.store)){const s=this.ctx.reflect.store[n];s.fiber===this&&this.ctx.reflect.notify([s.name])}}_checkImpl(e){const t=this.ctx.reflect._getImpl(e,!0);if(!t)return delete this._store[e];try{if(t.check&&!t.check.call(D(this.ctx,t.value)))return delete this._store[e]}catch(n){return t.fiber.ctx.logger.error(n),delete this._store[e]}this._store[e]=t}_refresh(){let e=!1;e="";for(const t of Object.keys(this.inject)){const n=this._store[t];if(!n){e=$;break}e+=":"+n.fiber.uid}this._setEpoch(e)}_setEpoch(e){const t=this._runner.epoch;e!==t&&(this._error||(this._runner.epoch=e,!this.inertia&&this._updateState(()=>e!==$&&t===$?(this.inertia=this._reload(),1):(this.inertia=this._unload(),5))))}async _reload(){this.store={...this._store};const e=this._runner.epoch;try{await Promise.resolve(),await this._execute(this._runner)}catch(t){this.ctx.logger.error(t),this._error=t,this._runner.epoch=$}this._updateState(()=>{if(this._runner.epoch===e)this.inertia=void 0;else return this.inertia=this._unload(),5})}async _unload(){await Promise.all(this._disposables.clear().map(async e=>{try{await Ee(async t=>{await Promise.resolve(),t.error=new Error,await e()},this._runner.getOuterStack)}catch(t){this.ctx.logger.error(t)}})),this.store=void 0,this._updateState(()=>{if(this._runner.epoch===$)this.inertia=void 0;else return this.inertia=this._reload(),1})}async await(){for(;this.inertia;)await this.inertia;if(this._error)throw this._error;return this}async restart(){const e=this.ctx.fiber;e.assertActive(),e._setEpoch($),e._refresh(),await e.await()}update(e,t=!1){const n=this.ctx.fiber;n.assertActive(),e=Ie(n.runtime,e),n.context.waterfall(n,"internal/update",e,t,()=>(n.config=e,n._error=void 0,n.restart()))}},d(W,"Fiber"),W);function fe(r){const e=r.stack.split(`
10
+ `));l(this,"name","ValidationError")}},d(K,"ValidationError"),K);Object.defineProperty(Ye.prototype,It,{value:!0});function _e(r,e){if(!r.Config)return e;const t=r.Config["~standard"].validate(e);if("then"in t)throw new TypeError("Async config validation is not supported");if(t.issues)throw new Ye(t.issues);return t.value}d(_e,"resolveConfig");var B,Pe=(B=class extends Error{constructor(t,n){super(n??B.Code[t]);l(this,"code");this.code=t}},d(B,"CordisError"),B);(r=>{r.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(Pe||(Pe={}));var $="__INACTIVE__",W,Xe=(W=class{constructor(e,t,n,s,i){l(this,"parent");l(this,"inject");l(this,"runtime");l(this,"uid");l(this,"ctx");l(this,"config");l(this,"state",0);l(this,"dispose");l(this,"store");l(this,"inertia");l(this,"_hooks",Object.create(null));l(this,"_disposables",new je);l(this,"context");l(this,"_error");l(this,"_runner");l(this,"_store",Object.create(null));this.parent=e,this.inject=n,this.runtime=s;const o=d(a=>{this._disposables.push(a)},"collect");if(s){this.uid=e.registry.counter,this.ctx=this.context=e.extend({fiber:this});const a=Object.entries(this.inject);if(a.length){this.ctx[q.intercept]=Object.create(e[q.intercept]);for(const[u,h]of a)he(h)||(this.ctx[q.intercept][u]=h)}this._runner={epoch:$,getOuterStack:i,execute:d(function(){var u;if(Ge(s.callback)){const h=new s.callback(this.ctx,this.config);for(const m of(h==null?void 0:h[f.initHooks])??[])m();return(u=h==null?void 0:h[f.init])==null?void 0:u.call(h)}else return s.callback(this.ctx,this.config)},"execute"),collect:o},this.context.emit("internal/plugin",this);for(const u of Object.keys(this.inject))this._checkImpl(u);this.dispose=e.fiber.effect(()=>{const u=s.fibers.push(this);try{this.config=_e(s,t),this._refresh()}catch(h){this.ctx.logger.error(h),this._error=h}return async()=>{for(this.uid=null,this.context.emit("internal/plugin",this),this.ctx.registry.has(s.callback)&&(u(),s.fibers.length||this.ctx.registry.delete(s.callback)),this._setEpoch($);this.inertia;)await this.inertia}},"ctx.plugin()")}else this.uid=0,this.ctx=this.context=e,this.state=2,this.store=Object.create(null),this._runner={epoch:"",getOuterStack:i,execute:d(()=>{},"execute"),collect:o},this.dispose=()=>this.restart()}get name(){var t;let e=this;do{if((t=e.runtime)!=null&&t.name)return e.runtime.name;e=e.parent.fiber}while(e!==e.parent.fiber);return"root"}assertActive(){if(this.uid===null)throw new Pe("INACTIVE_EFFECT")}_execute(e){const t=e.epoch;return Re(n=>{const s=d(o=>{if(typeof o=="function")e.collect(o);else if(!he(o))throw new TypeError("Invalid effect")},"safeCollect"),i=e.execute.call(this);if(typeof i=="function")return e.collect(i);if(!he(i))if(ne(i)){if("then"in i)return i.then(s);if(Symbol.iterator in i){n.error=new Error;const o=i[Symbol.iterator]();for(;;){const a=o.next();if(s(a.value),a.done)return}}else if(Symbol.asyncIterator in i){const o=i[Symbol.asyncIterator]();return(async()=>{for(await Promise.resolve(),n.error=new Error;;){if(e.epoch!==t)return;const a=await o.next();if(s(a.value),a.done)return}})()}else throw new TypeError("Invalid effect")}else throw new TypeError("Invalid effect")},e.getOuterStack)}effect(e,t="anonymous"){this.assertActive();const n=[],s=d(()=>{let m;for(const w of n.splice(0).reverse())if(m)m=m.then(w);else{const S=w();ne(S)&&"then"in S&&(m=S)}return m},"dispose"),i={label:t,children:[]},o={execute:e,epoch:!0,collect:d(m=>{n.push(m),this._disposables.delete(m),m[f.effect]&&i.children.push(m[f.effect])},"collect"),getOuterStack:we()};let a;try{a=this._execute(o)}catch(m){throw s(),m}a==null||a.catch(s).catch(m=>this.ctx.logger.error(m));const u=A(()=>{if(o.epoch)return o.epoch=!1,a?a.then(s):s()},f.effect,i),h=d(()=>{if(o.epoch)return o.epoch=!1,s()},"disposeAsync");return u.then=async(m,w)=>Promise.resolve(a).then(()=>h).then(m,w),n.push(this._disposables.push(u)),u}getEffects(){return[...this._disposables].map(e=>e[f.effect]).filter(Boolean)}_getState(){return this.uid===null?4:this._error?3:this._runner.epoch!==$?2:0}_updateState(e){const t=this.state;if(this.state=e()??this._getState(),t!==this.state&&(this.context.emit("internal/status",this,t),!(t!==2&&this.state!==2)))for(const n of Reflect.ownKeys(this.ctx.reflect.store)){const s=this.ctx.reflect.store[n];s.fiber===this&&this.ctx.reflect.notify([s.name])}}_checkImpl(e){const t=this.ctx.reflect._getImpl(e,!0);if(!t)return delete this._store[e];try{if(t.check&&!t.check.call(D(this.ctx,t.value)))return delete this._store[e]}catch(n){return t.fiber.ctx.logger.error(n),delete this._store[e]}this._store[e]=t}_refresh(){let e=!1;e="";for(const t of Object.keys(this.inject)){const n=this._store[t];if(!n){e=$;break}e+=":"+n.fiber.uid}this._setEpoch(e)}_setEpoch(e){const t=this._runner.epoch;e!==t&&(this._error||(this._runner.epoch=e,!this.inertia&&this._updateState(()=>e!==$&&t===$?(this.inertia=this._reload(),1):(this.inertia=this._unload(),5))))}async _reload(){this.store={...this._store};const e=this._runner.epoch;try{await Promise.resolve(),await this._execute(this._runner)}catch(t){this.ctx.logger.error(t),this._error=t,this._runner.epoch=$}this._updateState(()=>{if(this._runner.epoch===e)this.inertia=void 0;else return this.inertia=this._unload(),5})}async _unload(){await Promise.all(this._disposables.clear().map(async e=>{try{await Re(async t=>{await Promise.resolve(),t.error=new Error,await e()},this._runner.getOuterStack)}catch(t){this.ctx.logger.error(t)}})),this.store=void 0,this._updateState(()=>{if(this._runner.epoch===$)this.inertia=void 0;else return this.inertia=this._reload(),1})}async await(){for(;this.inertia;)await this.inertia;if(this._error)throw this._error;return this}async restart(){const e=this.ctx.fiber;e.assertActive(),e._setEpoch($),e._refresh(),await e.await()}update(e,t=!1){const n=this.ctx.fiber;n.assertActive(),e=_e(n.runtime,e),n.context.waterfall(n,"internal/update",e,t,()=>(n.config=e,n._error=void 0,n.restart()))}},d(W,"Fiber"),W);function fe(r){const e=r.stack.split(`
11
11
  `);return e.splice(0,2,`Error: ${r.message}`),r.stack=e.join(`
12
- `),r}d(fe,"enhanceError");var It=["prototype","then"];function de(r){return typeof r=="symbol"||It.includes(r)||parseInt(r).toString()===r||r.startsWith("_")}d(de,"isSpecialProperty");var M,Le=(M=class{constructor(e){l(this,"ctx");l(this,"store",Object.create(null));l(this,"props",Object.create(null));this.ctx=e,A(this,f.tracker,{property:"ctx",noShadow:!0}),this.mixin("reflect",["get","set","provide","accessor","mixin"]),this.mixin("fiber",["runtime","effect"]),this.mixin("registry",["inject","plugin"]),this.mixin("events",["on","once","parallel","emit","serial","bail","waterfall"])}get(e,t=!0){var n;return D(this.ctx,(n=this._getImpl(e,t))==null?void 0:n.value)}_getImpl(e,t=!0){const n=this.ctx[f.isolate][e],s=n&&this.store[n];if(s&&!(t&&s.fiber.state!==2))return s}set(e,t,n){const s=this.ctx[f.isolate][e],i=this.store[s];if(!i)throw new Error(`cannot set property "${e}" without provide`);if(i.fiber!==this.ctx.fiber)throw new Error(`cannot set property "${e}" in multiple fibers`);return i.value=t,!0}provide(e,t,n){return this.ctx.fiber.effect(()=>{var o,a;if(!this.props[e])(o=this.props)[e]??(o[e]={type:"service"});else if(this.props[e].type!=="service")throw new Error(`property "${e}" is already declared as ${this.props[e].type}`);this.props[e]={type:"service"},(a=this.ctx.root[f.isolate])[e]??(a[e]=Symbol(e));const s=this.ctx[f.isolate][e],i={name:e,value:t,fiber:this.ctx.fiber,check:n};if(this.store[s])throw new Error(`service "${e}" has been registered at <${this.store[s].fiber.name}>`);return this.store[s]=i,this.ctx.fiber.store[e]=i,this.ctx.fiber.state===2&&this.notify([e]),async()=>{delete this.store[s];const u=this.notify([e]);await Promise.allSettled(u.map(h=>h.await())),delete this.ctx.fiber.store[e]}},`ctx.provide(${JSON.stringify(e)})`)}notify(e,t=(n,s)=>n[f.isolate][s]===this.ctx[f.isolate][s]){var s;const n=[];for(const i of this.ctx.registry.values())for(const o of i.fibers){let a=!1;for(const u of e)u in o.inject&&t(o.ctx,u)&&(a=!0,o._checkImpl(u));a&&(o._refresh(),n.push(o))}for(const i of e){const o=Object.create(this.ctx);o[f.filter]=a=>t(a,i),this.ctx.events.emit(o,"internal/service",i,(s=this._getImpl(i,!1))==null?void 0:s.value)}return n}accessor(e,t){return this.ctx.fiber.effect(()=>{if(e in this.props)throw new Error(`property "${e}" is already declared as ${this.props[e].type}`);return this.props[e]={type:"accessor",...t},()=>delete this.props[e]},`ctx.accessor(${JSON.stringify(e)})`)}mixin(e,t){const n=this;return this.ctx.fiber.effect(function*(){const s=Array.isArray(t)?t.map(o=>[o,o]):Object.entries(t),i=d((o,a)=>o[e],"getTarget");for(const[o,a]of s)yield n.accessor(a,{get(u,h){const m=i(this,h);if(he(m))return m;const w=u?se(u,m):m,S=Reflect.get(m,o,w);return typeof S!="function"?S:S.bind(w??m)},set(u,h,m){const w=i(this,m),S=h?se(h,w):w;return Reflect.set(w,o,u,S)}})},`ctx.mixin(${JSON.stringify(e)})`)}trace(e){return D(this.ctx,e)}bind(e){return new Proxy(e,{apply:d((t,n,s)=>Reflect.apply(t,this.trace(n),s.map(i=>this.trace(i))),"apply"),construct:d((t,n,s)=>Reflect.construct(t,n.map(i=>this.trace(i)),s),"construct")})}},d(M,"ReflectService"),l(M,"handler",{get:d((e,t,n)=>{if(de(t))return Reflect.get(e,t,n);if(Reflect.has(e,t))return D(n,Reflect.get(e,t,n));const s=new Error(`cannot get property "${t}" without inject`);try{const i=e.reflect.props[t];return(i==null?void 0:i.type)==="accessor"?i.get.call(n,n[f.receiver],s):n.fiber.runtime?n.events.waterfall("internal/get",n,t,s,()=>{var u;const o=e[f.isolate][t];let a=(n[f.shadow]??n).fiber;for(;;){const h=(u=a.store)==null?void 0:u[t];if(h)return D(n,h.value);if(t in a.inject)throw s.message=`cannot get required service "${t}" in inactive context`,s;if(!a.runtime||a.parent[f.isolate][t]!==o)throw s;a=a.parent.fiber}}):n.reflect.get(t,!1)}catch(i){throw i===s?fe(i):i}},"get"),set:d((e,t,n,s)=>{if(de(t))return Reflect.set(e,t,n,s);const i=new Error(`cannot set property "${t}" without provide`),o=e.reflect.props[t];if(!o){if(!s.fiber.runtime)return Reflect.set(e,t,n,s);throw fe(i)}try{return o.type==="accessor"?o.set?o.set.call(s,n,s[f.receiver],i):!1:s.events.waterfall("internal/set",s,t,n,i,()=>s.reflect.set(t,n,i))}catch(a){throw a===i?fe(a):a}},"set"),has:d((e,t)=>de(t)?Reflect.has(e,t):Reflect.has(e,t)?!0:!!e.reflect.props[t],"has")}),M);function Xe(r){return r&&typeof r=="object"&&typeof r.apply=="function"}d(Xe,"isApplicable");function ye(r,e){return function(t,n){var s,i;if(n.kind==="class")Object.hasOwn(t,"inject")||(A(t,"inject",Object.create(Object.getPrototypeOf(t).inject??null)),A(t.inject,f.checkProto,!0)),t.inject[r]=e;else if(n.kind==="method"){const o=(i=t[s=f.metadata]??(t[s]={})).inject??(i.inject=Object.create(null));o[r]=e,n.addInitializer(function(){var u,h;const a=(u=this[f.tracker])==null?void 0:u.property;(this[h=f.initHooks]??(this[h]=[])).push(()=>{this.ctx.inject(o,m=>t.call(a?se(this,{[a]:m}):this))})})}else throw new Error("@Inject() can only be used on class or class methods")}}d(ye,"Inject");(r=>{function e(t,n=Object.create(null)){if(!t)return n;if(Array.isArray(t))for(const s of t)n[s]=null;else if(Reflect.has(t,f.checkProto)){Object.assign(n,e(Object.getPrototypeOf(t)));for(const s of Object.keys(t))n[s]=t[s]??null}else for(const s of Object.keys(t))n[s]=t[s]??null;return n}r.resolve=e,d(e,"resolve")})(ye||(ye={}));var Y,_t=(Y=class{constructor(e){l(this,"ctx");l(this,"_counter",0);l(this,"_internal",new Map);this.ctx=e,A(this,f.tracker,{property:"ctx",noShadow:!0})}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e){try{if(typeof e=="function")return e;if(Xe(e))return e.apply}catch{}}get(e){const t=this.resolve(e);return t&&this._internal.get(t)}has(e){const t=this.resolve(e);return!!t&&this._internal.has(t)}delete(e){const t=this.resolve(e),n=t&&this._internal.get(t);if(n){this._internal.delete(t);for(const s of n.fibers)s.dispose();return n}}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}inject(e,t){return this.plugin({inject:e,apply:t,name:t.name})}plugin(e,t,n=we()){const s=this.resolve(e);if(!s)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e);this.ctx.fiber.assertActive();let i=this._internal.get(s);if(!i){let u=e.name;u==="apply"&&(u=void 0),i={name:u,callback:s,fibers:new Pe,Config:e.Config},this._internal.set(s,i)}const o=new Ye(this.ctx,t,ye.resolve(e.inject),i,n),a=Object.create(o);return a.then=(u,h)=>o.await().then(u,h),a}},d(Y,"RegistryService"),Y),I,q=(I=class{static is(e){return!!(e!=null&&e[I.is])}constructor(){this[f.isolate]=Object.create(null),this[f.intercept]=Object.create(null);const e=new Proxy(this,Le.handler);return this.root=e,this.baseUrl=void 0,this.fiber=new Ye(e,{},Object.create(null),null,()=>[]),this.reflect=new Le(e),this.registry=new _t(e),this.events=new Ot(e),this.logger=new Rt(e),this.fiber._disposables.clear(),e}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.fiber.name}>`}extend(e={}){var s;const t=(s=Reflect.getOwnPropertyDescriptor(this,f.shadow))==null?void 0:s.value,n=Object.create(D(this,this));for(const i of Reflect.ownKeys(e))Object.defineProperty(n,i,Reflect.getOwnPropertyDescriptor(e,i));return t?Object.assign(Object.create(n),{[f.shadow]:t}):n}isolate(e,t){const n=Object.create(this[f.isolate]);return n[e]=t??Symbol(e),this.extend({[f.isolate]:n})}intercept(e,t){const n=Object.create(this[f.intercept]);return n[e]=t,this.extend({[f.intercept]:n})}},d(I,"Context"),l(I,"effect",f.effect),l(I,"filter",f.filter),l(I,"isolate",f.isolate),l(I,"intercept",f.intercept),I.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),I.prototype[I.is]=!0,I),N,Pt=(N=class{constructor(e,t){l(this,"ctx");l(this,"name");this.ctx=e,t??(t=this.constructor.provide);let n=this;const s={associate:t,property:"ctx"};return n[f.invoke]&&(n=ge(t,me(Object.getPrototypeOf(this),Function.prototype),s)),n.ctx=e,n.name=t,A(n,f.tracker,s),n.ctx.reflect.provide(t,n,this[f.check]),n}[f.filter](e){return e[f.isolate][this.name]===this.ctx[f.isolate][this.name]}[f.extend](e){let t;return this[N.invoke]?t=ge(this.name,this,this[f.tracker]):t=Object.create(this),Object.assign(t,e)}[f.resolveConfig](e,t){var i;let n=this.ctx[q.intercept];const s=[];for(;this.name in n;)Object.hasOwn(n,this.name)&&s.unshift(n[this.name]),n=Object.getPrototypeOf(n);return e&&s.unshift(e),t&&s.push(t),(i=this.Config)!=null&&i.merge?this.Config.merge(...s):Object.assign({},...s)}static[Symbol.hasInstance](e){var n;if(!e)return!1;let t=e.constructor;for(;t;){if(t=(n=t.prototype)==null?void 0:n.constructor,t===this)return!0;t&&(t=Object.getPrototypeOf(t))}return!1}},d(N,"Service"),l(N,"init",f.init),l(N,"check",f.check),l(N,"config",f.config),l(N,"invoke",f.invoke),l(N,"extend",f.extend),l(N,"tracker",f.tracker),l(N,"resolveConfig",f.resolveConfig),N);const jt=q,Ze=Pt;class Ct{constructor(){l(this,"entries",new Map);l(this,"byPlugin",new Map);l(this,"listeners",new Set);l(this,"snapshotCache",[]);l(this,"byKey",new Map)}keyOf(e,t){return`${e}\0${t}`}index(){this.entries.clear();const e=[...this.byPlugin.values()].flatMap(t=>[...t]).map(t=>this.byKey.get(t)).sort((t,n)=>{const s=t.order??100,i=n.order??100;return s!==i?s-i:t.pluginId!==n.pluginId?t.pluginId<n.pluginId?-1:1:t.path<n.path?-1:1});for(const t of e)this.entries.set(this.keyOf(t.pluginId,t.path),t);this.snapshotCache=[...this.entries.values()]}register(e){if(!e.path.startsWith("/"))throw new Error(`pages.register: path must start with "/" (got ${e.path})`);const t=this.keyOf(e.pluginId,e.path),n=this.byKey.has(t);if(this.byKey.set(t,{...e}),!n){const s=this.byPlugin.get(e.pluginId)??new Set;s.add(t),this.byPlugin.set(e.pluginId,s)}this.index(),this.notify()}unregister(e,t){const n=this.keyOf(e,t);if(!this.byKey.delete(n))return;const s=this.byPlugin.get(e);s&&(s.delete(n),s.size===0&&this.byPlugin.delete(e)),this.index(),this.notify()}unregisterAll(e){const t=this.byPlugin.get(e);if(!(!t||t.size===0)){for(const n of t)this.byKey.delete(n);this.byPlugin.delete(e),this.index(),this.notify()}}snapshot(){return this.snapshotCache}has(e){for(const t of this.entries.values())if(t.path===e)return!0;return!1}get size(){return this.entries.size}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of[...this.listeners])try{e()}catch{}}}class Ce extends Ze{constructor(t){super(t,"pages");l(this,"registry",new Ct)}}l(Ce,"service","pages");const ve=Ce.prototype;ve.register=function(r){const e=this.ctx.effect;return e(()=>(this.registry.register(r),()=>this.registry.unregister(r.pluginId,r.path)),"pages.register")};ve.unregister=function(r){this.registry.unregisterAll(r)};ve.subscribe=function(r){return this.registry.subscribe(r)};ve.getSnapshot=function(){return this.registry.snapshot()};const $t=1;class At{constructor(e){l(this,"state","connecting");l(this,"online");l(this,"onlineEvent");l(this,"offlineEvent");l(this,"socketEvents");l(this,"opener");l(this,"attempt",0);l(this,"timer");l(this,"disposed",!1);l(this,"addOnline");l(this,"addOffline");l(this,"removeOnline");l(this,"removeOffline");l(this,"scheduleTimer");l(this,"onOpened");l(this,"onDownNotify");l(this,"onStopped");this.online=e.online,this.opener=e.open,this.onlineEvent=()=>this.retry(0),this.offlineEvent=()=>this.goOffline(),this.socketEvents=()=>this.onDown(),this.addOnline=e.addOnlineListener,this.addOffline=e.addOfflineListener,this.removeOnline=e.removeOnlineListener,this.removeOffline=e.removeOfflineListener,this.scheduleTimer=e.schedule,this.onOpened=e.onOpen,this.onDownNotify=e.onDown,this.onStopped=e.onStopped,this.addOnline(this.onlineEvent),this.addOffline(this.offlineEvent)}attemptStart(){if(this.state!=="stopped"){if(!this.online()){this.state="offline";return}this.state="connecting",this.opener()}}onSocketOpen(){this.state!=="stopped"&&(this.attempt=0,this.state="connected",this.onOpened())}onDown(){if(this.state!=="stopped"){if(!this.online()){this.goOffline();return}this.state="connecting",this.onDownNotify(),this.retry(this.backoffMs())}}backoffMs(){return Math.min(1e3*2**this.attempt,1e4)}retry(e){if(this.state!=="stopped"){if(this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.attempt+=1,e===0){this.attemptStart();return}this.scheduleTimer(e)}}goOffline(){this.state!=="stopped"&&(this.state="offline",this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.onDownNotify())}onlineNow(){this.state!=="stopped"&&this.retry(0)}begin(){this.attemptStart()}down(){this.onDown()}open(){this.onSocketOpen()}stop(){var e;this.disposed||(this.disposed=!0,this.state="stopped",this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.removeOnline(this.onlineEvent),this.removeOffline(this.offlineEvent),(e=this.onStopped)==null||e.call(this))}}class Tt{constructor(e){l(this,"controller");l(this,"url");l(this,"minDelayMs");l(this,"maxDelayMs");l(this,"handlers");l(this,"Impl");l(this,"socket",null);l(this,"generation",0);l(this,"stopped",!1);l(this,"onFrameBound",null);this.url=e.url,this.minDelayMs=e.minDelayMs??250,this.maxDelayMs=e.maxDelayMs??1e4,this.handlers=e.handlers??{},this.Impl=e.impl??globalThis.WebSocket??null,this.controller=new At({online:()=>e.online??!0,open:()=>this.openSocket(),onOpen:()=>this.handleOpen(),onDown:()=>this.handleDown(),schedule:t=>this.scheduleReconnect(t),addOnlineListener:t=>{typeof window<"u"&&window.addEventListener("online",t)},addOfflineListener:t=>{typeof window<"u"&&window.addEventListener("offline",t)},removeOnlineListener:t=>{typeof window<"u"&&window.removeEventListener("online",t)},removeOfflineListener:t=>{typeof window<"u"&&window.removeEventListener("offline",t)}})}connect(){this.controller.begin()}get currentGeneration(){return this.generation}send(e){const t=this.socket;if(!t||t.readyState!==$t)return!1;try{return t.send(e),!0}catch{return this.controller.down(),!1}}close(){if(this.stopped)return;this.stopped=!0,this.controller.stop();const e=this.socket;if(this.socket=null,e)try{e.close(1e3,"client close")}catch{}}scheduleReconnect(e){this.stopped||setTimeout(()=>{this.stopped||this.controller.begin()},e)}openSocket(){if(!this.stopped)try{const e=new this.Impl(this.url);this.socket=e,e.addEventListener("open",()=>{this.socket===e&&(this.generation=Date.now(),this.controller.open())}),e.addEventListener("close",()=>{this.socket===e&&(this.socket=null,this.controller.down())}),e.addEventListener("error",()=>{});const t=n=>{var s,i;this.socket===e&&typeof n.data=="string"&&((i=(s=this.handlers).onMessage)==null||i.call(s,n.data))};this.onFrameBound=t,e.addEventListener("message",t)}catch{this.socket=null,this.controller.down()}}handleOpen(){var e,t;(t=(e=this.handlers).onOpen)==null||t.call(e,this.generation)}handleDown(){var e,t;this.socket=null,(t=(e=this.handlers).onClose)==null||t.call(e)}}const Dt=3e4,Mt="payload/too-large",ue="rpc/disconnected";let P=class extends Error{constructor(t,n){super(n??t);l(this,"code");this.code=t,this.name="RpcError"}};class Lt{constructor(e,t={}){l(this,"pending",new Map);l(this,"nextId",0);l(this,"generation",0);l(this,"defaultTimeoutMs");l(this,"onFrame");l(this,"closed",!1);l(this,"sendText");this.sendText=e,this.defaultTimeoutMs=t.defaultTimeoutMs??Dt,this.onFrame=t.onFrame??(()=>{})}reset(e){this.rejectAll(new P(ue,"connection reset")),this.generation=e,this.closed=!1}disconnectAll(e){this.rejectAll(e??new P(ue))}rejectAll(e){const t=[...this.pending.values()];this.pending.clear();for(const n of t){clearTimeout(n.timer);try{n.reject(e)}catch{}}}close(){this.closed=!0,this.disconnectAll()}sendNotification(e,t){if(this.closed)return!1;const n={v:1,generation:this.generation,requestId:`n:${this.nextId++}`,op:e,payload:t};let s;try{s=JSON.stringify(n)}catch{return!1}return s.length>Be()?!1:this.sendText(s)}request(e,t,n={}){if(this.closed)return Promise.reject(new P(ue));const s=n.timeoutMs??this.defaultTimeoutMs,i=`c:${this.nextId++}`,o=this.generation,a={v:1,generation:o,requestId:i,op:e,payload:t};let u;try{u=JSON.stringify(a)}catch{return Promise.reject(new P("payload/serialize","payload not serializable"))}return u.length>Be()?Promise.reject(new P(Mt,"frame exceeds MAX_FRAME_BYTES")):new Promise((h,m)=>{const w=setTimeout(()=>{this.pending.delete(i),m(new P("rpc/timeout","rpc timeout"))},s);this.pending.set(i,{op:e,generation:o,resolve:y=>{clearTimeout(w),h(y)},reject:y=>{clearTimeout(w),m(y)},timer:w}),this.sendText(u)||(this.pending.delete(i),clearTimeout(w),m(new P(ue)))})}handleFrame(e){var n,s;if(e.op==="rpc.result"){const i=this.pending.get(e.requestId);if(!i)return;if(i.generation!==e.generation){this.pending.delete(e.requestId),clearTimeout(i.timer),i.reject(new P("rpc/protocol-mismatch","generation mismatch"));return}this.pending.delete(e.requestId),clearTimeout(i.timer);const o=e.payload;if(o&&o.ok===!1){i.reject(new P(((n=o.error)==null?void 0:n.code)??"rpc/error",(s=o.error)==null?void 0:s.message));return}i.resolve(o==null?void 0:o.data);return}const t=this.pending.get(e.requestId);if(t){this.pending.delete(e.requestId),clearTimeout(t.timer),t.generation!==e.generation?t.reject(new P("rpc/protocol-mismatch","generation mismatch")):t.reject(new P("rpc/protocol-mismatch",`unexpected op ${e.op} for pending request`));return}this.onFrame(e)}get pendingCount(){return this.pending.size}}function Be(){return 16*1024*1024}function Bt(r){if(!r||typeof r!="object")return!1;const e=r;return typeof e.id=="string"&&typeof e.pluginRunId=="string"&&typeof e.manifest=="object"}function Ft(r){if(!r||typeof r!="object")return;const e=r,t=typeof e.generation=="number"?e.generation:0,n=typeof e.auditLastId=="number"?e.auditLastId:0,s=Array.isArray(e.records)?e.records:[],i=Array.isArray(e.plugins)?e.plugins:[];return{generation:t,auditLastId:n,records:s,plugins:i.filter(Bt)}}class Ht extends Error{constructor(t,n){super(t);l(this,"code");this.code=n,this.name="RpcError"}}function zt(r){if(!r||typeof r!="object")throw new Ht("malformed audit response");const e=r;return{status:e.status??0,statusText:e.statusText??"",headers:e.headers??{},bytes:e.bytes??0,truncated:e.truncated??!1,bodyText:e.bodyText??"",...e.bodyJson!==void 0?{bodyJson:e.bodyJson}:{}}}let Qe;function Ut(r){Qe=r}class $e extends Ze{constructor(e){super(e,"auditClient")}}l($e,"service","auditClient");function qt(r){var n,s;const e=(n=r.ctx)==null?void 0:n.fiber,t=(s=e==null?void 0:e.config)==null?void 0:s.pluginRunId;return typeof t=="string"?t:""}function ie(r,e,t,n,s){const i=Qe;return i?i.request("rpc.invoke",{method:e,url:t,...n!==void 0?{body:n}:{},...s?{config:s}:{},pluginRunId:qt(r)}).then(o=>zt(o)):Promise.reject(new Error("auditClient used before connectRpc wired the RPC bridge"))}const oe=$e.prototype;oe.get=function(r,e){return ie(this,"GET",r,void 0,e)};oe.post=function(r,e,t){return ie(this,"POST",r,e,t)};oe.put=function(r,e,t){return ie(this,"PUT",r,e,t)};oe.patch=function(r,e,t){return ie(this,"PATCH",r,e,t)};oe.delete=function(r,e){return ie(this,"DELETE",r,void 0,e)};async function Jt(r,e,t){var i;const{ctx:n}=r;if(typeof((i=n.registry)==null?void 0:i.plugin)!="function")throw new Error(`browser-half ${e.id}: ctx lacks a cordis registry (no ctx.registry.plugin)`);const s=n.registry.plugin({inject:["pages","auditClient"],apply:t},{name:e.id,pluginRunId:e.pluginRunId});return await s.await(),{id:e.id,pluginRunId:e.pluginRunId,fiber:s}}async function et(r,e){const t=new Blob([e.code],{type:"text/javascript"}),n=URL.createObjectURL(t);try{const s=await import(n),i=s.default??s.apply;if(typeof i!="function")throw new Error(`browser-half ${e.id} must default-export a function (ctx) => ...`);return await Jt(r,{id:e.id,pluginRunId:e.pluginRunId},i)}finally{URL.revokeObjectURL(n)}}async function Fe(r,e){e.fiber&&(await e.fiber.dispose(),e.fiber=void 0)}class te extends Error{constructor(t,n,s){super(n);l(this,"code");l(this,"status");this.code=t,this.status=s,this.name="ApiError"}}async function Vt(r){var n,s;let e;try{e=await r.json()}catch{throw new te("response/not-json",`host returned ${r.status} ${r.statusText}`)}if(!e||typeof e!="object")throw new te("response/malformed","host returned a non-object payload");const t=e;if(t.ok===!1||!r.ok)throw new te(((n=t.error)==null?void 0:n.code)??"http/error",((s=t.error)==null?void 0:s.message)??`HTTP ${r.status}`,r.status);return t.data}async function H(r,e){const t=await fetch(r,e);return Vt(t)}function tt(r,e){return H(`${r}/api/audit`)}function Kt(r,e){return H(`${r}/api/replay`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}function Ae(r){return H(`${r}/api/plugins`)}function Gt(r,e){return H(`${r}/api/plugins/${encodeURIComponent(e)}/stop`,{method:"POST"})}function Wt(r,e){return H(`${r}/api/plugins/${encodeURIComponent(e)}/remove`,{method:"POST"})}function Yt(r,e){return H(`${r}/api/plugins/install`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({spec:e})})}async function Xt(r,e,t="plugin.zip"){const n=new FormData;return n.append("zip",e,t),H(`${r}/api/plugins`,{method:"POST",body:n})}async function Zt(r,e=""){if(typeof fetch!="function")return;const t=await fetch(`${e}/api/plugins/${encodeURIComponent(r)}/browser-source`);if(t.ok)return await t.text()}async function rt(r,e,t=""){const n=await Zt(e.pluginRunId,t);if(typeof n=="string")return et({ctx:r},{id:e.id,pluginRunId:e.pluginRunId,code:n})}async function Qt(r,e){var i;const t=e.host??"";let n;try{n=await Ae(t)}catch{return}const s=n.find(o=>o.id===e.id);if(s&&(i=s.manifest.halves.browser)!=null&&i.entry)return rt(r.ctx,{id:s.id,pluginRunId:s.pluginRunId},t)}class er{constructor(e){l(this,"ctx");l(this,"rpc");l(this,"transport");l(this,"snapshotListeners",new Set);l(this,"currentSnapshot");l(this,"auditPushes");l(this,"halves",new Map);l(this,"loading",new Set);this.ctx=e.ctx,this.rpc=e.rpc,this.transport=e.transport,this.auditPushes=e.onAuditPush?[e.onAuditPush]:[]}get rpcClient(){return this.rpc}get status(){return this.transport.controller.state}snapshot(){return this.currentSnapshot}onSnapshot(e){return this.snapshotListeners.add(e),this.currentSnapshot&&e(this.currentSnapshot),()=>{this.snapshotListeners.delete(e)}}onAuditPush(e){return this.auditPushes.push(e),()=>{const t=this.auditPushes.indexOf(e);t>=0&&this.auditPushes.splice(t,1)}}applySnapshot(e){const t=Ft(e);if(t){this.currentSnapshot=t,this.reconcile(t);for(const n of[...this.snapshotListeners])try{n(t)}catch{}}}applyAuditPush(e){for(const t of[...this.auditPushes])try{t(e)}catch{}}async applyBrowserHalfLoad(e){const t=await et({ctx:this.ctx},e);this.halves.set(e.pluginRunId,t)}async applyBrowserHalfRetract(e){const t=this.halves.get(e.pluginRunId);t&&(this.halves.delete(e.pluginRunId),await Fe({ctx:this.ctx},t))}async reconcile(e){var n;const t=new Map;for(const s of e.plugins)(n=s.manifest.halves.browser)!=null&&n.entry&&t.set(s.pluginRunId,{id:s.id,pluginRunId:s.pluginRunId});for(const s of t.values())if(!(this.halves.has(s.pluginRunId)||this.loading.has(s.pluginRunId))){this.loading.add(s.pluginRunId);try{const i=await rt(this.ctx,s);i&&this.halves.set(s.pluginRunId,i)}catch{}finally{this.loading.delete(s.pluginRunId)}}for(const[s,i]of[...this.halves])if(!t.has(s)){this.halves.delete(s);try{await Fe({ctx:this.ctx},i)}catch{}}}close(){this.transport.close()}}async function tr(r={}){const e=r.ctx??new jt,t=await nr(e),n=r.url??ir(),s=new Tt({url:n,...r.minDelayMs!==void 0?{minDelayMs:r.minDelayMs}:{},...r.maxDelayMs!==void 0?{maxDelayMs:r.maxDelayMs}:{},...r.wsImpl!==void 0?{impl:r.wsImpl}:{},handlers:{onOpen:()=>{var a;i.reset(s.currentGeneration),i.sendNotification("snapshot.request",{sinceId:((a=o.snapshot())==null?void 0:a.auditLastId)??0})},onMessage:a=>{try{const u=JSON.parse(a);i.handleFrame(u)}catch{}},onClose:()=>{i.disconnectAll()}}}),i=new Lt(a=>s.send(a),{onFrame:a=>rr(o,a)});sr(e),Ut(i);const o=new er({ctx:e,transport:s,rpc:i});return s.connect(),{ctx:e,pages:t,onSnapshot:a=>o.onSnapshot(a),snapshot:()=>o.snapshot(),status:()=>o.status,close:()=>o.close()}}function rr(r,e){var t;switch(e.op){case"snapshot.respond":r.applySnapshot(e.payload);break;case"audit.append":r.applyAuditPush(e.payload);break;case"plugin.changed":r.rpcClient.sendNotification("snapshot.request",{sinceId:((t=r.snapshot())==null?void 0:t.auditLastId)??0});break;case"browser-half.load":r.applyBrowserHalfLoad(e.payload);break;case"browser-half.retract":r.applyBrowserHalfRetract(e.payload);break}}async function nr(r){let e=r.pages;return e||(await r.registry.plugin(Ce).await(),e=r.pages),e}function sr(r){var t,n;(n=(t=r.reflect)._getImpl)!=null&&n.call(t,"auditClient",!0)||new $e(r)}function ir(){return typeof location<"u"?`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/ws`:"ws://localhost:4560/ws"}const or=["GET","POST","PUT","PATCH","DELETE"];function cr(r){const[e,t]=O([]),[n,s]=O(null),i=re(async()=>{try{const o=await tt("");t(o.records),s(null)}catch(o){s(o.message)}},[]);return F(()=>{i();let o;r&&(o=r.onSnapshot(()=>{i()}));const a=window.setInterval(()=>void i(),2e3);return()=>{window.clearInterval(a),o==null||o()}},[r,i]),{records:e,error:n,refresh:i}}function ar({runtime:r}){const{records:e,error:t}=cr(r),[n,s]=O(""),[i,o]=O(""),[a,u]=O(""),[h,m]=O(null),[w,S]=O("desc"),y=re(()=>S(v=>v==="desc"?"asc":"desc"),[]),g=ee(()=>{const v=a.trim().toLowerCase();return e.filter(E=>!(n&&E.method!==n||i&&!E.initiator.toLowerCase().includes(i.toLowerCase())||v&&!`${E.url} ${E.initiator} ${E.statusText}`.toLowerCase().includes(v))).sort((E,j)=>w==="desc"?j.ts-E.ts:E.ts-j.ts)},[e,n,i,a,w]);return p("div",{className:"page",children:[c("h1",{children:"审计记录"}),t&&p("div",{className:"error-line",children:["加载失败:",t]}),p("div",{className:"filters",children:[p("select",{value:n,onChange:v=>s(v.target.value),children:[c("option",{value:"",children:"全部方法"}),or.map(v=>c("option",{value:v,children:v},v))]}),c("input",{placeholder:"发起方过滤",value:i,onChange:v=>o(v.target.value)}),c("input",{placeholder:"搜索 URL / 状态",value:a,onChange:v=>u(v.target.value)}),c("button",{type:"button",className:"sort-toggle",onClick:y,title:w==="desc"?"当前:最新在前,点击切换为时间正序":"当前:时间正序,点击切换为最新在前",children:w==="desc"?"最新在前 ↓":"时间顺序 ↑"}),p("span",{className:"count",children:["共 ",g.length," 条"]})]}),p("table",{className:"table",children:[c("thead",{children:p("tr",{children:[c("th",{children:p("button",{type:"button",className:"th-sort",onClick:y,children:["时间 ",w==="desc"?"↓":"↑"]})}),c("th",{children:"发起方"}),c("th",{children:"方法"}),c("th",{children:"URL"}),c("th",{children:"状态"}),c("th",{children:"耗时"})]})}),p("tbody",{children:[g.length===0&&c("tr",{children:c("td",{colSpan:6,className:"empty-cell",children:"暂无记录"})}),g.map(v=>p("tr",{onClick:()=>m(v),className:"row-click",children:[c("td",{children:nt(v.ts)}),p("td",{children:[v.initiator,v.replayOf!==void 0&&c("span",{className:"tag replay",children:"重放"})]}),c("td",{children:c("span",{className:`method ${v.method}`,children:v.method})}),c("td",{className:"mono",title:v.url,children:v.url}),c("td",{children:c("span",{className:`status ${ur(v.status)}`,children:v.status})}),p("td",{children:[v.durationMs," ms"]})]},v.id))]})]}),h&&c(lr,{record:h,onClose:()=>m(null)})]})}function lr({record:r,onClose:e}){return c("div",{className:"drawer-mask",onClick:e,children:p("div",{className:"drawer",onClick:t=>t.stopPropagation(),children:[p("div",{className:"drawer-head",children:[p("h3",{children:[r.method," ",r.url]}),c("button",{onClick:e,children:"关闭"})]}),p("div",{className:"drawer-body",children:[c(U,{label:"时间",value:nt(r.ts)}),c(U,{label:"发起方",value:r.initiator}),c(U,{label:"状态",value:`${r.status} ${r.statusText}`}),c(U,{label:"耗时",value:`${r.durationMs} ms`}),r.replayOf!==void 0&&c(U,{label:"重放自",value:`#${r.replayOf}`}),r.error&&c(U,{label:"错误",value:`${r.error.name}: ${r.error.message}`}),c("h4",{children:"请求头"}),c(He,{headers:r.reqHeaders}),c("h4",{children:"请求体"}),c(ze,{body:r.reqBody}),c("h4",{children:"响应头"}),c(He,{headers:r.resHeaders}),c("h4",{children:"响应体"}),c(ze,{body:r.resBody})]})]})})}function U({label:r,value:e}){return p("div",{className:"info-row",children:[c("span",{className:"info-label",children:r}),c("span",{children:e})]})}function He({headers:r}){const e=Object.entries(r);return e.length===0?c("div",{className:"muted",children:"(无)"}):c("table",{className:"table slim",children:c("tbody",{children:e.map(([t,n])=>p("tr",{children:[c("td",{className:"mono key",children:t}),c("td",{className:"mono",children:n})]},t))})})}function ze({body:r}){return r.text?p("div",{className:"body-view",children:[c("pre",{children:r.text}),r.truncated&&p("div",{className:"muted",children:["已截断(",r.bytes," bytes)"]})]}):c("div",{className:"muted",children:"(空)"})}function ur(r){return r===0?"err":r<300||r<400?"ok":r<500?"warn":"err"}function nt(r){const e=new Date(r);return`${e.toLocaleDateString("zh-CN")} ${e.toLocaleTimeString("zh-CN",{hour12:!1})}`}const hr=["POST","PUT","PATCH","DELETE"],fr=["GET","POST","PUT","PATCH","DELETE"];function dr({runtime:r}){const[e,t]=O([]),[n,s]=O(""),[i,o]=O("GET"),[a,u]=O(""),[h,m]=O(""),[w,S]=O(""),[y,g]=O(!1),[v,E]=O(!1),[j,xe]=O(null),[T,ce]=O(null);F(()=>{let x=!1;const ae=async()=>{try{const ot=await tt("");x||t(ot.records)}catch{}};ae();const it=window.setInterval(()=>void ae(),3e3);return()=>{x=!0,window.clearInterval(it)}},[]);const R=ee(()=>e.find(x=>x.id===n)??null,[e,n]);F(()=>{R&&(o(R.method),u(R.url),m(gr(R.reqHeaders)),S(R.reqBody.text))},[R]);const b=ee(()=>R?Object.keys(R.reqHeaders).some(ae=>/^(authorization|cookie|x-api-key|proxy-authorization|x-auth-token)$/i.test(ae)):!1,[R]),k=ee(()=>yr(h),[h]),_=n!==""&&a.trim().length>0,C=hr.includes(i);async function Z(){if(n!==""){E(!0),ce(null);try{const x=await Kt("",{recordId:n,overrides:{method:i,url:a,headers:k,body:w}});xe({original:R,replayed:{status:x.status,statusText:x.statusText,durationMs:0,bodyText:x.bodyText,headers:x.headers}}),g(!1)}catch(x){ce(x.message)}finally{E(!1)}}}function Se(){if(C){g(!0);return}Z()}return p("div",{className:"page",children:[c("h1",{children:"API 重放"}),p("div",{className:"replay-grid",children:[p("section",{className:"card",children:[c("h2",{children:"1. 选择记录"}),p("select",{value:n,onChange:x=>s(Number(x.target.value)||""),children:[c("option",{value:"",children:"请选择…"}),[...e].reverse().map(x=>p("option",{value:x.id,children:["#",x.id," ",x.method," ",x.url]},x.id))]}),b&&c("div",{className:"warn-box",children:"此请求包含凭证,重放将使用当前凭证服务的值。"}),c("h2",{children:"2. 编辑请求"}),p("div",{className:"form-row",children:[c("select",{value:i,onChange:x=>o(x.target.value),children:fr.map(x=>c("option",{value:x,children:x},x))}),c("input",{className:"url",value:a,onChange:x=>u(x.target.value),placeholder:"URL"})]}),c("label",{className:"field-label",children:"请求头 (每行 `Key: value`)"}),c("textarea",{value:h,onChange:x=>m(x.target.value),rows:4,className:"mono"}),c("label",{className:"field-label",children:"请求体"}),c("textarea",{value:w,onChange:x=>S(x.target.value),rows:6,className:"mono"}),(R==null?void 0:R.reqBody.truncated)&&c("div",{className:"muted",children:"原始请求体已截断,重放将使用截断版本。"}),c("div",{className:"form-actions",children:c("button",{onClick:Se,disabled:!_||v,children:v?"重放中…":"重放"})}),T&&c("div",{className:"error-line",children:T})]}),p("section",{className:"card",children:[c("h2",{children:"3. 对比"}),!j&&c("div",{className:"muted",children:"选择记录并点击“重放”后在此对比。"}),j&&c(pr,{outcome:j})]})]}),y&&R&&c("div",{className:"drawer-mask",onClick:()=>g(!1),children:p("div",{className:"confirm",onClick:x=>x.stopPropagation(),children:[c("h3",{children:"确认重放非幂等请求"}),p("div",{className:"mono confirm-detail",children:[p("div",{children:[i," ",a]}),p("div",{children:["发起方:",R.initiator]}),c("pre",{children:w.slice(0,1e3)})]}),p("div",{className:"form-actions",children:[c("button",{className:"ghost",onClick:()=>g(!1),children:"取消"}),c("button",{onClick:()=>void Z(),disabled:v,children:"确认重放"})]})]})})]})}function pr({outcome:r}){const{original:e,replayed:t}=r;return p("div",{className:"compare",children:[p("div",{className:"compare-col",children:[c("h3",{children:"原始记录"}),p("div",{className:"compare-item",children:[c("span",{children:"状态"}),p("b",{children:[e.status," ",e.statusText]})]}),p("div",{className:"compare-item",children:[c("span",{children:"耗时"}),p("b",{children:[e.durationMs," ms"]})]}),c("pre",{className:"body-view",children:e.resBody.text||"(空)"})]}),p("div",{className:"compare-col",children:[c("h3",{children:"重放结果"}),p("div",{className:"compare-item",children:[c("span",{children:"状态"}),p("b",{children:[t.status," ",t.statusText]})]}),p("div",{className:"compare-item",children:[c("span",{children:"耗时"}),c("b",{children:t.durationMs?`${t.durationMs} ms`:"—"})]}),c("pre",{className:"body-view",children:t.bodyText||"(空)"})]})]})}function gr(r){return Object.entries(r).map(([e,t])=>`${e}: ${t}`).join(`
13
- `)}function yr(r){const e={};for(const t of r.split(`
14
- `)){const n=t.indexOf(":");if(n<0)continue;const s=t.slice(0,n).trim(),i=t.slice(n+1).trim();s&&(e[s]=i)}return e}const mr={running:"运行中",stopping:"停止中…",removing:"移除中…",error:"错误"};function br(){const[r,e]=O([]),[t,n]=O(""),[s,i]=O(!1),[o,a]=O(null),[u,h]=O(null),[m,w]=O(!1),[S,y]=O(null),[g,v]=O(null),E=re(async()=>{try{const b=await Ae("");e(k=>b.map(_=>{const C=k.find(Se=>Se.pluginRunId===_.pluginRunId);if(!C)return{..._,localState:"running"};const Z={..._,localState:C.localState};return C.message!==void 0&&(Z.message=C.message),Z}))}catch(b){v(b.message)}},[]);F(()=>{E();const b=window.setInterval(()=>void E(),3e3);return()=>window.clearInterval(b)},[E]);async function j(){const b=t.trim();if(b){i(!0),a(null),v(null);try{const k=await Yt("",b);a(`已安装 ${b} → ${k.id}@${k.version}(${k.pluginRunId})`),n(""),await E()}catch(k){const _=k instanceof te?`${k.code}: ${k.message}`:k.message;v(`安装失败:${_}`)}finally{i(!1)}}}async function xe(){if(u){w(!0),y(null),v(null);try{const b=await Xt("",u,u.name);y(`上传成功:${b.id}@${b.manifest.version}(${b.pluginRunId})`),h(null),await E()}catch(b){const k=b instanceof te?`${b.code}: ${b.message}`:b.message;v(`上传失败:${k}`)}finally{w(!1)}}}function T(b,k){e(_=>_.map(C=>C.pluginRunId===b?{...C,...k}:C))}async function ce(b){T(b.pluginRunId,{localState:"stopping"});try{await Gt("",b.pluginRunId),T(b.pluginRunId,{localState:"error",message:"已停止"})}catch(k){T(b.pluginRunId,{localState:"error",message:k.message})}}async function R(b){T(b.pluginRunId,{localState:"removing"});try{await Wt("",b.pluginRunId),e(k=>k.filter(_=>_.pluginRunId!==b.pluginRunId))}catch(k){T(b.pluginRunId,{localState:"error",message:k.message})}}return p("div",{className:"page",children:[c("h1",{children:"插件管理"}),g&&c("div",{className:"error-line",children:g}),p("section",{className:"card",children:[c("h2",{children:"按包名安装"}),p("div",{className:"upload-row",children:[c("input",{type:"text",placeholder:"@scope/my-audit-plugin",value:t,onChange:b=>n(b.target.value),onKeyDown:b=>{b.key==="Enter"&&j()}}),c("button",{onClick:()=>void j(),disabled:!t.trim()||s,children:s?"安装中…":"安装"})]}),o&&c("div",{className:"ok-line",children:o}),p("div",{className:"muted",children:["npm 包名(如需指定版本:",c("span",{className:"mono",children:"pkg@1.2.3"}),"),或本地 ",c("span",{className:"mono",children:"file:./插件文件夹"})]})]}),p("section",{className:"card",children:[c("h2",{children:"或上传 zip"}),p("div",{className:"upload-row",children:[c("input",{type:"file",accept:".zip,application/zip",onChange:b=>{var k;return h(((k=b.target.files)==null?void 0:k[0])??null)}}),c("button",{onClick:()=>void xe(),disabled:!u||m,children:m?"上传中…":"上传"})]}),S&&c("div",{className:"ok-line",children:S})]}),p("section",{className:"card",children:[c("h2",{children:"插件列表"}),r.length===0&&c("div",{className:"muted",children:"暂无插件"}),p("table",{className:"table",children:[c("thead",{children:p("tr",{children:[c("th",{children:"ID"}),c("th",{children:"版本"}),c("th",{children:"标题"}),c("th",{children:"状态"}),c("th",{children:"pluginRunId"}),c("th",{children:"操作"})]})}),c("tbody",{children:r.map(b=>p("tr",{children:[c("td",{className:"mono",children:b.id}),c("td",{children:b.manifest.version}),c("td",{children:b.manifest.title}),p("td",{children:[c("span",{className:`status ${b.localState==="running"?"ok":"warn"}`,children:mr[b.localState]}),b.message&&c("div",{className:"muted",children:b.message})]}),c("td",{className:"mono",children:b.pluginRunId}),p("td",{className:"actions",children:[c("button",{className:"ghost",disabled:b.localState==="stopping"||b.localState==="removing",onClick:()=>void ce(b),children:"停止"}),c("button",{className:"ghost danger",disabled:b.localState==="stopping"||b.localState==="removing",onClick:()=>void R(b),children:"移除"})]})]},b.pluginRunId))})]})]})]})}class wr extends Ue{constructor(){super(...arguments);l(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}render(){var t;return this.state.error?p("div",{className:"error-box",children:[c("h2",{children:"页面出错了"}),c("pre",{children:String(((t=this.state.error)==null?void 0:t.message)??this.state.error)}),c("button",{onClick:()=>this.setState({error:null}),children:"重试"})]}):this.props.children}}const vr="";function xr(){const[r,e]=O(null);F(()=>{let a=!1,u;return tr({url:`${location.origin}/ws`}).then(h=>{if(a){h.close();return}u=h,e(h)}).catch(()=>{}),()=>{a=!0,u==null||u.close()}},[]);const t=lt(new Set);F(()=>{if(!r)return;const a=r;let u=!1;async function h(S,y){try{if(u||t.current.has(y))return;if(a.pages.getSnapshot().find(v=>v.pluginId===S)){t.current.add(y);return}await Qt(a,{id:S}),t.current.add(y)}catch(g){const v=g instanceof Error?`${g.message}
15
- ${g.stack}`:String(g);console.warn(`[plugin-sync] failed to install browser half for ${S} (${y}): ${v}`)}}async function m(){var y;let S;try{S=await Ae(vr)}catch{return}if(!u)for(const g of S)(y=g.manifest.halves.browser)!=null&&y.entry&&h(g.id,g.pluginRunId)}m();const w=a.onSnapshot(S=>{var y;for(const g of S.plugins)(y=g.manifest.halves.browser)!=null&&y.entry&&h(g.id,g.pluginRunId)});return()=>{u=!0,w()}},[r]);const n=re(a=>{const u=r==null?void 0:r.pages;return u?u.subscribe(a):()=>{}},[r]),s=re(()=>{const a=r==null?void 0:r.pages;return a?a.getSnapshot():Sr},[r]),i=ut(n,s),o=ee(()=>i.filter(a=>typeof a.Component=="function"),[i]);return p("div",{className:"layout",children:[p("aside",{className:"sidebar",children:[c("div",{className:"brand",children:"API Audit"}),p("nav",{children:[c(le,{to:"/audit",className:"nav-item",children:"审计记录"}),c(le,{to:"/replay",className:"nav-item",children:"API 重放"}),c(le,{to:"/plugins",className:"nav-item",children:"插件管理"}),o.length>0&&c("div",{className:"nav-sep",children:"插件页面"}),o.map(a=>c(le,{to:a.path,className:"nav-item",children:a.title},`${a.pluginId}:${a.path}`))]}),c("div",{className:"sidebar-foot",children:c(kr,{runtime:r})})]}),c("main",{className:"main",children:c(wr,{children:c(ht,{fallback:c("div",{className:"empty",children:"加载中…"}),children:p(pt,{children:[c(z,{path:"/",element:c(gt,{to:"/audit",replace:!0})}),c(z,{path:"/audit",element:c(ar,{runtime:r})}),c(z,{path:"/replay",element:c(dr,{runtime:r})}),c(z,{path:"/plugins",element:c(br,{})}),o.map(a=>c(z,{path:a.path,element:c(Or,{title:a.title,children:c(a.Component,{})})},`${a.pluginId}:${a.path}`)),c(z,{path:"*",element:c(Er,{})})]})})})})]})}const Sr=Object.freeze([]);class Or extends Ue{constructor(){super(...arguments);l(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}render(){var t;return this.state.error?p("div",{className:"error-box",children:[p("h2",{children:["插件页面出错:",this.props.title]}),c("pre",{children:String(((t=this.state.error)==null?void 0:t.message)??this.state.error)}),c("button",{onClick:()=>this.setState({error:null}),children:"重试"})]}):this.props.children}}function kr({runtime:r}){const[e,t]=O("connecting");F(()=>{if(!r)return;const s=()=>t(r.status());s();const i=window.setInterval(s,500);return()=>window.clearInterval(i)},[r]);const n=e==="connected";return c("span",{className:`ws-badge ${n?"on":""}`,children:n?"已连接":"连接中…"})}function Er(){return p("div",{className:"empty",children:[c("h2",{children:"404"}),c("p",{children:"页面不存在。"})]})}const st=document.getElementById("root");if(!st)throw new Error("missing #root");dt(st).render(c(ft,{children:c(yt,{children:c(xr,{})})}));
16
- //# sourceMappingURL=index-CcuZJdOa.js.map
12
+ `),r}d(fe,"enhanceError");var _t=["prototype","then"];function de(r){return typeof r=="symbol"||_t.includes(r)||parseInt(r).toString()===r||r.startsWith("_")}d(de,"isSpecialProperty");var M,Be=(M=class{constructor(e){l(this,"ctx");l(this,"store",Object.create(null));l(this,"props",Object.create(null));this.ctx=e,A(this,f.tracker,{property:"ctx",noShadow:!0}),this.mixin("reflect",["get","set","provide","accessor","mixin"]),this.mixin("fiber",["runtime","effect"]),this.mixin("registry",["inject","plugin"]),this.mixin("events",["on","once","parallel","emit","serial","bail","waterfall"])}get(e,t=!0){var n;return D(this.ctx,(n=this._getImpl(e,t))==null?void 0:n.value)}_getImpl(e,t=!0){const n=this.ctx[f.isolate][e],s=n&&this.store[n];if(s&&!(t&&s.fiber.state!==2))return s}set(e,t,n){const s=this.ctx[f.isolate][e],i=this.store[s];if(!i)throw new Error(`cannot set property "${e}" without provide`);if(i.fiber!==this.ctx.fiber)throw new Error(`cannot set property "${e}" in multiple fibers`);return i.value=t,!0}provide(e,t,n){return this.ctx.fiber.effect(()=>{var o,a;if(!this.props[e])(o=this.props)[e]??(o[e]={type:"service"});else if(this.props[e].type!=="service")throw new Error(`property "${e}" is already declared as ${this.props[e].type}`);this.props[e]={type:"service"},(a=this.ctx.root[f.isolate])[e]??(a[e]=Symbol(e));const s=this.ctx[f.isolate][e],i={name:e,value:t,fiber:this.ctx.fiber,check:n};if(this.store[s])throw new Error(`service "${e}" has been registered at <${this.store[s].fiber.name}>`);return this.store[s]=i,this.ctx.fiber.store[e]=i,this.ctx.fiber.state===2&&this.notify([e]),async()=>{delete this.store[s];const u=this.notify([e]);await Promise.allSettled(u.map(h=>h.await())),delete this.ctx.fiber.store[e]}},`ctx.provide(${JSON.stringify(e)})`)}notify(e,t=(n,s)=>n[f.isolate][s]===this.ctx[f.isolate][s]){var s;const n=[];for(const i of this.ctx.registry.values())for(const o of i.fibers){let a=!1;for(const u of e)u in o.inject&&t(o.ctx,u)&&(a=!0,o._checkImpl(u));a&&(o._refresh(),n.push(o))}for(const i of e){const o=Object.create(this.ctx);o[f.filter]=a=>t(a,i),this.ctx.events.emit(o,"internal/service",i,(s=this._getImpl(i,!1))==null?void 0:s.value)}return n}accessor(e,t){return this.ctx.fiber.effect(()=>{if(e in this.props)throw new Error(`property "${e}" is already declared as ${this.props[e].type}`);return this.props[e]={type:"accessor",...t},()=>delete this.props[e]},`ctx.accessor(${JSON.stringify(e)})`)}mixin(e,t){const n=this;return this.ctx.fiber.effect(function*(){const s=Array.isArray(t)?t.map(o=>[o,o]):Object.entries(t),i=d((o,a)=>o[e],"getTarget");for(const[o,a]of s)yield n.accessor(a,{get(u,h){const m=i(this,h);if(he(m))return m;const w=u?se(u,m):m,S=Reflect.get(m,o,w);return typeof S!="function"?S:S.bind(w??m)},set(u,h,m){const w=i(this,m),S=h?se(h,w):w;return Reflect.set(w,o,u,S)}})},`ctx.mixin(${JSON.stringify(e)})`)}trace(e){return D(this.ctx,e)}bind(e){return new Proxy(e,{apply:d((t,n,s)=>Reflect.apply(t,this.trace(n),s.map(i=>this.trace(i))),"apply"),construct:d((t,n,s)=>Reflect.construct(t,n.map(i=>this.trace(i)),s),"construct")})}},d(M,"ReflectService"),l(M,"handler",{get:d((e,t,n)=>{if(de(t))return Reflect.get(e,t,n);if(Reflect.has(e,t))return D(n,Reflect.get(e,t,n));const s=new Error(`cannot get property "${t}" without inject`);try{const i=e.reflect.props[t];return(i==null?void 0:i.type)==="accessor"?i.get.call(n,n[f.receiver],s):n.fiber.runtime?n.events.waterfall("internal/get",n,t,s,()=>{var u;const o=e[f.isolate][t];let a=(n[f.shadow]??n).fiber;for(;;){const h=(u=a.store)==null?void 0:u[t];if(h)return D(n,h.value);if(t in a.inject)throw s.message=`cannot get required service "${t}" in inactive context`,s;if(!a.runtime||a.parent[f.isolate][t]!==o)throw s;a=a.parent.fiber}}):n.reflect.get(t,!1)}catch(i){throw i===s?fe(i):i}},"get"),set:d((e,t,n,s)=>{if(de(t))return Reflect.set(e,t,n,s);const i=new Error(`cannot set property "${t}" without provide`),o=e.reflect.props[t];if(!o){if(!s.fiber.runtime)return Reflect.set(e,t,n,s);throw fe(i)}try{return o.type==="accessor"?o.set?o.set.call(s,n,s[f.receiver],i):!1:s.events.waterfall("internal/set",s,t,n,i,()=>s.reflect.set(t,n,i))}catch(a){throw a===i?fe(a):a}},"set"),has:d((e,t)=>de(t)?Reflect.has(e,t):Reflect.has(e,t)?!0:!!e.reflect.props[t],"has")}),M);function Ze(r){return r&&typeof r=="object"&&typeof r.apply=="function"}d(Ze,"isApplicable");function ye(r,e){return function(t,n){var s,i;if(n.kind==="class")Object.hasOwn(t,"inject")||(A(t,"inject",Object.create(Object.getPrototypeOf(t).inject??null)),A(t.inject,f.checkProto,!0)),t.inject[r]=e;else if(n.kind==="method"){const o=(i=t[s=f.metadata]??(t[s]={})).inject??(i.inject=Object.create(null));o[r]=e,n.addInitializer(function(){var u,h;const a=(u=this[f.tracker])==null?void 0:u.property;(this[h=f.initHooks]??(this[h]=[])).push(()=>{this.ctx.inject(o,m=>t.call(a?se(this,{[a]:m}):this))})})}else throw new Error("@Inject() can only be used on class or class methods")}}d(ye,"Inject");(r=>{function e(t,n=Object.create(null)){if(!t)return n;if(Array.isArray(t))for(const s of t)n[s]=null;else if(Reflect.has(t,f.checkProto)){Object.assign(n,e(Object.getPrototypeOf(t)));for(const s of Object.keys(t))n[s]=t[s]??null}else for(const s of Object.keys(t))n[s]=t[s]??null;return n}r.resolve=e,d(e,"resolve")})(ye||(ye={}));var Y,Pt=(Y=class{constructor(e){l(this,"ctx");l(this,"_counter",0);l(this,"_internal",new Map);this.ctx=e,A(this,f.tracker,{property:"ctx",noShadow:!0})}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e){try{if(typeof e=="function")return e;if(Ze(e))return e.apply}catch{}}get(e){const t=this.resolve(e);return t&&this._internal.get(t)}has(e){const t=this.resolve(e);return!!t&&this._internal.has(t)}delete(e){const t=this.resolve(e),n=t&&this._internal.get(t);if(n){this._internal.delete(t);for(const s of n.fibers)s.dispose();return n}}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}inject(e,t){return this.plugin({inject:e,apply:t,name:t.name})}plugin(e,t,n=we()){const s=this.resolve(e);if(!s)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e);this.ctx.fiber.assertActive();let i=this._internal.get(s);if(!i){let u=e.name;u==="apply"&&(u=void 0),i={name:u,callback:s,fibers:new je,Config:e.Config},this._internal.set(s,i)}const o=new Xe(this.ctx,t,ye.resolve(e.inject),i,n),a=Object.create(o);return a.then=(u,h)=>o.await().then(u,h),a}},d(Y,"RegistryService"),Y),I,q=(I=class{static is(e){return!!(e!=null&&e[I.is])}constructor(){this[f.isolate]=Object.create(null),this[f.intercept]=Object.create(null);const e=new Proxy(this,Be.handler);return this.root=e,this.baseUrl=void 0,this.fiber=new Xe(e,{},Object.create(null),null,()=>[]),this.reflect=new Be(e),this.registry=new Pt(e),this.events=new kt(e),this.logger=new Nt(e),this.fiber._disposables.clear(),e}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.fiber.name}>`}extend(e={}){var s;const t=(s=Reflect.getOwnPropertyDescriptor(this,f.shadow))==null?void 0:s.value,n=Object.create(D(this,this));for(const i of Reflect.ownKeys(e))Object.defineProperty(n,i,Reflect.getOwnPropertyDescriptor(e,i));return t?Object.assign(Object.create(n),{[f.shadow]:t}):n}isolate(e,t){const n=Object.create(this[f.isolate]);return n[e]=t??Symbol(e),this.extend({[f.isolate]:n})}intercept(e,t){const n=Object.create(this[f.intercept]);return n[e]=t,this.extend({[f.intercept]:n})}},d(I,"Context"),l(I,"effect",f.effect),l(I,"filter",f.filter),l(I,"isolate",f.isolate),l(I,"intercept",f.intercept),I.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),I.prototype[I.is]=!0,I),N,jt=(N=class{constructor(e,t){l(this,"ctx");l(this,"name");this.ctx=e,t??(t=this.constructor.provide);let n=this;const s={associate:t,property:"ctx"};return n[f.invoke]&&(n=ge(t,me(Object.getPrototypeOf(this),Function.prototype),s)),n.ctx=e,n.name=t,A(n,f.tracker,s),n.ctx.reflect.provide(t,n,this[f.check]),n}[f.filter](e){return e[f.isolate][this.name]===this.ctx[f.isolate][this.name]}[f.extend](e){let t;return this[N.invoke]?t=ge(this.name,this,this[f.tracker]):t=Object.create(this),Object.assign(t,e)}[f.resolveConfig](e,t){var i;let n=this.ctx[q.intercept];const s=[];for(;this.name in n;)Object.hasOwn(n,this.name)&&s.unshift(n[this.name]),n=Object.getPrototypeOf(n);return e&&s.unshift(e),t&&s.push(t),(i=this.Config)!=null&&i.merge?this.Config.merge(...s):Object.assign({},...s)}static[Symbol.hasInstance](e){var n;if(!e)return!1;let t=e.constructor;for(;t;){if(t=(n=t.prototype)==null?void 0:n.constructor,t===this)return!0;t&&(t=Object.getPrototypeOf(t))}return!1}},d(N,"Service"),l(N,"init",f.init),l(N,"check",f.check),l(N,"config",f.config),l(N,"invoke",f.invoke),l(N,"extend",f.extend),l(N,"tracker",f.tracker),l(N,"resolveConfig",f.resolveConfig),N);const Ct=q,Qe=jt;class $t{constructor(){l(this,"entries",new Map);l(this,"byPlugin",new Map);l(this,"listeners",new Set);l(this,"snapshotCache",[]);l(this,"byKey",new Map)}keyOf(e,t){return`${e}\0${t}`}index(){this.entries.clear();const e=[...this.byPlugin.values()].flatMap(t=>[...t]).map(t=>this.byKey.get(t)).sort((t,n)=>{const s=t.order??100,i=n.order??100;return s!==i?s-i:t.pluginId!==n.pluginId?t.pluginId<n.pluginId?-1:1:t.path<n.path?-1:1});for(const t of e)this.entries.set(this.keyOf(t.pluginId,t.path),t);this.snapshotCache=[...this.entries.values()]}register(e){if(!e.path.startsWith("/"))throw new Error(`pages.register: path must start with "/" (got ${e.path})`);const t=this.keyOf(e.pluginId,e.path),n=this.byKey.has(t);if(this.byKey.set(t,{...e}),!n){const s=this.byPlugin.get(e.pluginId)??new Set;s.add(t),this.byPlugin.set(e.pluginId,s)}this.index(),this.notify()}unregister(e,t){const n=this.keyOf(e,t);if(!this.byKey.delete(n))return;const s=this.byPlugin.get(e);s&&(s.delete(n),s.size===0&&this.byPlugin.delete(e)),this.index(),this.notify()}unregisterAll(e){const t=this.byPlugin.get(e);if(!(!t||t.size===0)){for(const n of t)this.byKey.delete(n);this.byPlugin.delete(e),this.index(),this.notify()}}snapshot(){return this.snapshotCache}has(e){for(const t of this.entries.values())if(t.path===e)return!0;return!1}get size(){return this.entries.size}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of[...this.listeners])try{e()}catch{}}}class $e extends Qe{constructor(t){super(t,"pages");l(this,"registry",new $t)}}l($e,"service","pages");const ve=$e.prototype;ve.register=function(r){const e=this.ctx.effect;return e(()=>(this.registry.register(r),()=>this.registry.unregister(r.pluginId,r.path)),"pages.register")};ve.unregister=function(r){this.registry.unregisterAll(r)};ve.subscribe=function(r){return this.registry.subscribe(r)};ve.getSnapshot=function(){return this.registry.snapshot()};const At=1;class Tt{constructor(e){l(this,"state","connecting");l(this,"online");l(this,"onlineEvent");l(this,"offlineEvent");l(this,"socketEvents");l(this,"opener");l(this,"attempt",0);l(this,"timer");l(this,"disposed",!1);l(this,"addOnline");l(this,"addOffline");l(this,"removeOnline");l(this,"removeOffline");l(this,"scheduleTimer");l(this,"onOpened");l(this,"onDownNotify");l(this,"onStopped");this.online=e.online,this.opener=e.open,this.onlineEvent=()=>this.retry(0),this.offlineEvent=()=>this.goOffline(),this.socketEvents=()=>this.onDown(),this.addOnline=e.addOnlineListener,this.addOffline=e.addOfflineListener,this.removeOnline=e.removeOnlineListener,this.removeOffline=e.removeOfflineListener,this.scheduleTimer=e.schedule,this.onOpened=e.onOpen,this.onDownNotify=e.onDown,this.onStopped=e.onStopped,this.addOnline(this.onlineEvent),this.addOffline(this.offlineEvent)}attemptStart(){if(this.state!=="stopped"){if(!this.online()){this.state="offline";return}this.state="connecting",this.opener()}}onSocketOpen(){this.state!=="stopped"&&(this.attempt=0,this.state="connected",this.onOpened())}onDown(){if(this.state!=="stopped"){if(!this.online()){this.goOffline();return}this.state="connecting",this.onDownNotify(),this.retry(this.backoffMs())}}backoffMs(){return Math.min(1e3*2**this.attempt,1e4)}retry(e){if(this.state!=="stopped"){if(this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.attempt+=1,e===0){this.attemptStart();return}this.scheduleTimer(e)}}goOffline(){this.state!=="stopped"&&(this.state="offline",this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.onDownNotify())}onlineNow(){this.state!=="stopped"&&this.retry(0)}begin(){this.attemptStart()}down(){this.onDown()}open(){this.onSocketOpen()}stop(){var e;this.disposed||(this.disposed=!0,this.state="stopped",this.timer&&(clearTimeout(this.timer),this.timer=void 0),this.removeOnline(this.onlineEvent),this.removeOffline(this.offlineEvent),(e=this.onStopped)==null||e.call(this))}}class Dt{constructor(e){l(this,"controller");l(this,"url");l(this,"minDelayMs");l(this,"maxDelayMs");l(this,"handlers");l(this,"Impl");l(this,"socket",null);l(this,"generation",0);l(this,"stopped",!1);l(this,"onFrameBound",null);this.url=e.url,this.minDelayMs=e.minDelayMs??250,this.maxDelayMs=e.maxDelayMs??1e4,this.handlers=e.handlers??{},this.Impl=e.impl??globalThis.WebSocket??null,this.controller=new Tt({online:()=>e.online??!0,open:()=>this.openSocket(),onOpen:()=>this.handleOpen(),onDown:()=>this.handleDown(),schedule:t=>this.scheduleReconnect(t),addOnlineListener:t=>{typeof window<"u"&&window.addEventListener("online",t)},addOfflineListener:t=>{typeof window<"u"&&window.addEventListener("offline",t)},removeOnlineListener:t=>{typeof window<"u"&&window.removeEventListener("online",t)},removeOfflineListener:t=>{typeof window<"u"&&window.removeEventListener("offline",t)}})}connect(){this.controller.begin()}get currentGeneration(){return this.generation}send(e){const t=this.socket;if(!t||t.readyState!==At)return!1;try{return t.send(e),!0}catch{return this.controller.down(),!1}}close(){if(this.stopped)return;this.stopped=!0,this.controller.stop();const e=this.socket;if(this.socket=null,e)try{e.close(1e3,"client close")}catch{}}scheduleReconnect(e){this.stopped||setTimeout(()=>{this.stopped||this.controller.begin()},e)}openSocket(){if(!this.stopped)try{const e=new this.Impl(this.url);this.socket=e,e.addEventListener("open",()=>{this.socket===e&&(this.generation=Date.now(),this.controller.open())}),e.addEventListener("close",()=>{this.socket===e&&(this.socket=null,this.controller.down())}),e.addEventListener("error",()=>{});const t=n=>{var s,i;this.socket===e&&typeof n.data=="string"&&((i=(s=this.handlers).onMessage)==null||i.call(s,n.data))};this.onFrameBound=t,e.addEventListener("message",t)}catch{this.socket=null,this.controller.down()}}handleOpen(){var e,t;(t=(e=this.handlers).onOpen)==null||t.call(e,this.generation)}handleDown(){var e,t;this.socket=null,(t=(e=this.handlers).onClose)==null||t.call(e)}}const Mt=3e4,Lt="payload/too-large",ue="rpc/disconnected";let P=class extends Error{constructor(t,n){super(n??t);l(this,"code");this.code=t,this.name="RpcError"}};class Bt{constructor(e,t={}){l(this,"pending",new Map);l(this,"nextId",0);l(this,"generation",0);l(this,"defaultTimeoutMs");l(this,"onFrame");l(this,"closed",!1);l(this,"sendText");this.sendText=e,this.defaultTimeoutMs=t.defaultTimeoutMs??Mt,this.onFrame=t.onFrame??(()=>{})}reset(e){this.rejectAll(new P(ue,"connection reset")),this.generation=e,this.closed=!1}disconnectAll(e){this.rejectAll(e??new P(ue))}rejectAll(e){const t=[...this.pending.values()];this.pending.clear();for(const n of t){clearTimeout(n.timer);try{n.reject(e)}catch{}}}close(){this.closed=!0,this.disconnectAll()}sendNotification(e,t){if(this.closed)return!1;const n={v:1,generation:this.generation,requestId:`n:${this.nextId++}`,op:e,payload:t};let s;try{s=JSON.stringify(n)}catch{return!1}return s.length>Fe()?!1:this.sendText(s)}request(e,t,n={}){if(this.closed)return Promise.reject(new P(ue));const s=n.timeoutMs??this.defaultTimeoutMs,i=`c:${this.nextId++}`,o=this.generation,a={v:1,generation:o,requestId:i,op:e,payload:t};let u;try{u=JSON.stringify(a)}catch{return Promise.reject(new P("payload/serialize","payload not serializable"))}return u.length>Fe()?Promise.reject(new P(Lt,"frame exceeds MAX_FRAME_BYTES")):new Promise((h,m)=>{const w=setTimeout(()=>{this.pending.delete(i),m(new P("rpc/timeout","rpc timeout"))},s);this.pending.set(i,{op:e,generation:o,resolve:y=>{clearTimeout(w),h(y)},reject:y=>{clearTimeout(w),m(y)},timer:w}),this.sendText(u)||(this.pending.delete(i),clearTimeout(w),m(new P(ue)))})}handleFrame(e){var n,s;if(e.op==="rpc.result"){const i=this.pending.get(e.requestId);if(!i)return;if(i.generation!==e.generation){this.pending.delete(e.requestId),clearTimeout(i.timer),i.reject(new P("rpc/protocol-mismatch","generation mismatch"));return}this.pending.delete(e.requestId),clearTimeout(i.timer);const o=e.payload;if(o&&o.ok===!1){i.reject(new P(((n=o.error)==null?void 0:n.code)??"rpc/error",(s=o.error)==null?void 0:s.message));return}i.resolve(o==null?void 0:o.data);return}const t=this.pending.get(e.requestId);if(t){this.pending.delete(e.requestId),clearTimeout(t.timer),t.generation!==e.generation?t.reject(new P("rpc/protocol-mismatch","generation mismatch")):t.reject(new P("rpc/protocol-mismatch",`unexpected op ${e.op} for pending request`));return}this.onFrame(e)}get pendingCount(){return this.pending.size}}function Fe(){return 16*1024*1024}function Ft(r){if(!r||typeof r!="object")return!1;const e=r;return typeof e.id=="string"&&typeof e.pluginRunId=="string"&&typeof e.manifest=="object"}function Ht(r){if(!r||typeof r!="object")return;const e=r,t=typeof e.generation=="number"?e.generation:0,n=typeof e.auditLastId=="number"?e.auditLastId:0,s=Array.isArray(e.records)?e.records:[],i=Array.isArray(e.plugins)?e.plugins:[];return{generation:t,auditLastId:n,records:s,plugins:i.filter(Ft)}}class zt extends Error{constructor(t,n){super(t);l(this,"code");this.code=n,this.name="RpcError"}}function Ut(r){if(!r||typeof r!="object")throw new zt("malformed audit response");const e=r;return{status:e.status??0,statusText:e.statusText??"",headers:e.headers??{},bytes:e.bytes??0,truncated:e.truncated??!1,bodyText:e.bodyText??"",...e.bodyJson!==void 0?{bodyJson:e.bodyJson}:{}}}let et;function qt(r){et=r}class Ae extends Qe{constructor(e){super(e,"auditClient")}}l(Ae,"service","auditClient");function Jt(r){var n,s;const e=(n=r.ctx)==null?void 0:n.fiber,t=(s=e==null?void 0:e.config)==null?void 0:s.pluginRunId;return typeof t=="string"?t:""}function ie(r,e,t,n,s){const i=et;return i?i.request("rpc.invoke",{method:e,url:t,...n!==void 0?{body:n}:{},...s?{config:s}:{},pluginRunId:Jt(r)}).then(o=>Ut(o)):Promise.reject(new Error("auditClient used before connectRpc wired the RPC bridge"))}const oe=Ae.prototype;oe.get=function(r,e){return ie(this,"GET",r,void 0,e)};oe.post=function(r,e,t){return ie(this,"POST",r,e,t)};oe.put=function(r,e,t){return ie(this,"PUT",r,e,t)};oe.patch=function(r,e,t){return ie(this,"PATCH",r,e,t)};oe.delete=function(r,e){return ie(this,"DELETE",r,void 0,e)};async function Gt(r,e,t){var i;const{ctx:n}=r;if(typeof((i=n.registry)==null?void 0:i.plugin)!="function")throw new Error(`browser-half ${e.id}: ctx lacks a cordis registry (no ctx.registry.plugin)`);const s=n.registry.plugin({inject:["pages","auditClient"],apply:t},{name:e.id,pluginRunId:e.pluginRunId});return await s.await(),{id:e.id,pluginRunId:e.pluginRunId,fiber:s}}async function tt(r,e){const t=new Blob([e.code],{type:"text/javascript"}),n=URL.createObjectURL(t);try{const s=await import(n),i=s.default??s.apply;if(typeof i!="function")throw new Error(`browser-half ${e.id} must default-export a function (ctx) => ...`);return await Gt(r,{id:e.id,pluginRunId:e.pluginRunId},i)}finally{URL.revokeObjectURL(n)}}async function He(r,e){e.fiber&&(await e.fiber.dispose(),e.fiber=void 0)}class te extends Error{constructor(t,n,s){super(n);l(this,"code");l(this,"status");this.code=t,this.status=s,this.name="ApiError"}}async function Vt(r){var n,s;let e;try{e=await r.json()}catch{throw new te("response/not-json",`host returned ${r.status} ${r.statusText}`)}if(!e||typeof e!="object")throw new te("response/malformed","host returned a non-object payload");const t=e;if(t.ok===!1||!r.ok)throw new te(((n=t.error)==null?void 0:n.code)??"http/error",((s=t.error)==null?void 0:s.message)??`HTTP ${r.status}`,r.status);return t.data}async function H(r,e){const t=await fetch(r,e);return Vt(t)}function rt(r,e){return H(`${r}/api/audit`)}function Kt(r,e){return H(`${r}/api/replay`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}function Te(r){return H(`${r}/api/plugins`)}function Wt(r,e){return H(`${r}/api/plugins/${encodeURIComponent(e)}/stop`,{method:"POST"})}function Yt(r,e){return H(`${r}/api/plugins/${encodeURIComponent(e)}/remove`,{method:"POST"})}function Xt(r,e){return H(`${r}/api/plugins/install`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({spec:e})})}async function Zt(r,e,t="plugin.zip"){const n=new FormData;return n.append("zip",e,t),H(`${r}/api/plugins`,{method:"POST",body:n})}async function Qt(r,e=""){if(typeof fetch!="function")return;const t=await fetch(`${e}/api/plugins/${encodeURIComponent(r)}/browser-source`);if(t.ok)return await t.text()}async function nt(r,e,t=""){const n=await Qt(e.pluginRunId,t);if(typeof n=="string")return tt({ctx:r},{id:e.id,pluginRunId:e.pluginRunId,code:n})}async function er(r,e){var i;const t=e.host??"";let n;try{n=await Te(t)}catch{return}const s=n.find(o=>o.id===e.id);if(s&&(i=s.manifest.halves.browser)!=null&&i.entry)return nt(r.ctx,{id:s.id,pluginRunId:s.pluginRunId},t)}class tr{constructor(e){l(this,"ctx");l(this,"rpc");l(this,"transport");l(this,"snapshotListeners",new Set);l(this,"currentSnapshot");l(this,"auditPushes");l(this,"halves",new Map);l(this,"loading",new Set);this.ctx=e.ctx,this.rpc=e.rpc,this.transport=e.transport,this.auditPushes=e.onAuditPush?[e.onAuditPush]:[]}get rpcClient(){return this.rpc}get status(){return this.transport.controller.state}snapshot(){return this.currentSnapshot}onSnapshot(e){return this.snapshotListeners.add(e),this.currentSnapshot&&e(this.currentSnapshot),()=>{this.snapshotListeners.delete(e)}}onAuditPush(e){return this.auditPushes.push(e),()=>{const t=this.auditPushes.indexOf(e);t>=0&&this.auditPushes.splice(t,1)}}applySnapshot(e){const t=Ht(e);if(t){this.currentSnapshot=t,this.reconcile(t);for(const n of[...this.snapshotListeners])try{n(t)}catch{}}}applyAuditPush(e){for(const t of[...this.auditPushes])try{t(e)}catch{}}async applyBrowserHalfLoad(e){const t=await tt({ctx:this.ctx},e);this.halves.set(e.pluginRunId,t)}async applyBrowserHalfRetract(e){const t=this.halves.get(e.pluginRunId);t&&(this.halves.delete(e.pluginRunId),await He({ctx:this.ctx},t))}async reconcile(e){var n;const t=new Map;for(const s of e.plugins)(n=s.manifest.halves.browser)!=null&&n.entry&&t.set(s.pluginRunId,{id:s.id,pluginRunId:s.pluginRunId});for(const s of t.values())if(!(this.halves.has(s.pluginRunId)||this.loading.has(s.pluginRunId))){this.loading.add(s.pluginRunId);try{const i=await nt(this.ctx,s);i&&this.halves.set(s.pluginRunId,i)}catch{}finally{this.loading.delete(s.pluginRunId)}}for(const[s,i]of[...this.halves])if(!t.has(s)){this.halves.delete(s);try{await He({ctx:this.ctx},i)}catch{}}}close(){this.transport.close()}}async function rr(r={}){const e=r.ctx??new Ct,t=await sr(e),n=r.url??or(),s=new Dt({url:n,...r.minDelayMs!==void 0?{minDelayMs:r.minDelayMs}:{},...r.maxDelayMs!==void 0?{maxDelayMs:r.maxDelayMs}:{},...r.wsImpl!==void 0?{impl:r.wsImpl}:{},handlers:{onOpen:()=>{var a;i.reset(s.currentGeneration),i.sendNotification("snapshot.request",{sinceId:((a=o.snapshot())==null?void 0:a.auditLastId)??0})},onMessage:a=>{try{const u=JSON.parse(a);i.handleFrame(u)}catch{}},onClose:()=>{i.disconnectAll()}}}),i=new Bt(a=>s.send(a),{onFrame:a=>nr(o,a)});ir(e),qt(i);const o=new tr({ctx:e,transport:s,rpc:i});return s.connect(),{ctx:e,pages:t,onSnapshot:a=>o.onSnapshot(a),snapshot:()=>o.snapshot(),status:()=>o.status,close:()=>o.close()}}function nr(r,e){var t;switch(e.op){case"snapshot.respond":r.applySnapshot(e.payload);break;case"audit.append":r.applyAuditPush(e.payload);break;case"plugin.changed":r.rpcClient.sendNotification("snapshot.request",{sinceId:((t=r.snapshot())==null?void 0:t.auditLastId)??0});break;case"browser-half.load":r.applyBrowserHalfLoad(e.payload);break;case"browser-half.retract":r.applyBrowserHalfRetract(e.payload);break}}async function sr(r){let e=r.pages;return e||(await r.registry.plugin($e).await(),e=r.pages),e}function ir(r){var t,n;(n=(t=r.reflect)._getImpl)!=null&&n.call(t,"auditClient",!0)||new Ae(r)}function or(){return typeof location<"u"?`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/ws`:"ws://localhost:4560/ws"}const cr=["GET","POST","PUT","PATCH","DELETE"];function ar(r){const[e,t]=O([]),[n,s]=O(null),i=re(async()=>{try{const o=await rt("");t(o.records),s(null)}catch(o){s(o.message)}},[]);return F(()=>{i();let o;r&&(o=r.onSnapshot(()=>{i()}));const a=window.setInterval(()=>void i(),2e3);return()=>{window.clearInterval(a),o==null||o()}},[r,i]),{records:e,error:n,refresh:i}}function lr({runtime:r}){const{records:e,error:t}=ar(r),[n,s]=O(""),[i,o]=O(""),[a,u]=O(""),[h,m]=O(null),[w,S]=O("desc"),y=re(()=>S(v=>v==="desc"?"asc":"desc"),[]),g=ee(()=>{const v=a.trim().toLowerCase();return e.filter(E=>!(n&&E.method!==n||i&&!E.initiator.toLowerCase().includes(i.toLowerCase())||v&&!`${E.url} ${E.initiator} ${E.statusText}`.toLowerCase().includes(v))).sort((E,j)=>w==="desc"?j.ts-E.ts:E.ts-j.ts)},[e,n,i,a,w]);return p("div",{className:"page",children:[c("h1",{children:"审计记录"}),t&&p("div",{className:"error-line",children:["加载失败:",t]}),p("div",{className:"filters",children:[p("select",{value:n,onChange:v=>s(v.target.value),children:[c("option",{value:"",children:"全部方法"}),cr.map(v=>c("option",{value:v,children:v},v))]}),c("input",{placeholder:"发起方过滤",value:i,onChange:v=>o(v.target.value)}),c("input",{placeholder:"搜索 URL / 状态",value:a,onChange:v=>u(v.target.value)}),c("button",{type:"button",className:"sort-toggle",onClick:y,title:w==="desc"?"当前:最新在前,点击切换为时间正序":"当前:时间正序,点击切换为最新在前",children:w==="desc"?"最新在前 ↓":"时间顺序 ↑"}),p("span",{className:"count",children:["共 ",g.length," 条"]})]}),p("table",{className:"table",children:[c("thead",{children:p("tr",{children:[c("th",{children:p("button",{type:"button",className:"th-sort",onClick:y,children:["时间 ",w==="desc"?"↓":"↑"]})}),c("th",{children:"发起方"}),c("th",{children:"方法"}),c("th",{children:"URL"}),c("th",{children:"状态"}),c("th",{children:"耗时"})]})}),p("tbody",{children:[g.length===0&&c("tr",{children:c("td",{colSpan:6,className:"empty-cell",children:"暂无记录"})}),g.map(v=>p("tr",{onClick:()=>m(v),className:"row-click",children:[c("td",{children:st(v.ts)}),p("td",{children:[v.initiator,v.replayOf!==void 0&&c("span",{className:"tag replay",children:"重放"})]}),c("td",{children:c("span",{className:`method ${v.method}`,children:v.method})}),c("td",{className:"mono",title:v.url,children:v.url}),c("td",{children:c("span",{className:`status ${hr(v.status)}`,children:v.status})}),p("td",{children:[v.durationMs," ms"]})]},v.id))]})]}),h&&c(ur,{record:h,onClose:()=>m(null)})]})}function ur({record:r,onClose:e}){return c("div",{className:"drawer-mask",onClick:e,children:p("div",{className:"drawer",onClick:t=>t.stopPropagation(),children:[p("div",{className:"drawer-head",children:[p("h3",{children:[r.method," ",r.url]}),c("button",{onClick:e,children:"关闭"})]}),p("div",{className:"drawer-body",children:[c(U,{label:"时间",value:st(r.ts)}),c(U,{label:"发起方",value:r.initiator}),c(U,{label:"状态",value:`${r.status} ${r.statusText}`}),c(U,{label:"耗时",value:`${r.durationMs} ms`}),r.replayOf!==void 0&&c(U,{label:"重放自",value:`#${r.replayOf}`}),r.error&&c(U,{label:"错误",value:`${r.error.name}: ${r.error.message}`}),c("h4",{children:"请求头"}),c(ze,{headers:r.reqHeaders}),c("h4",{children:"请求体"}),c(Ue,{body:r.reqBody}),c("h4",{children:"响应头"}),c(ze,{headers:r.resHeaders}),c("h4",{children:"响应体"}),c(Ue,{body:r.resBody})]})]})})}function U({label:r,value:e}){return p("div",{className:"info-row",children:[c("span",{className:"info-label",children:r}),c("span",{children:e})]})}function ze({headers:r}){const e=Object.entries(r);return e.length===0?c("div",{className:"muted",children:"(无)"}):c("table",{className:"table slim",children:c("tbody",{children:e.map(([t,n])=>p("tr",{children:[c("td",{className:"mono key",children:t}),c("td",{className:"mono",children:n})]},t))})})}function Ue({body:r}){return r.text?p("div",{className:"body-view",children:[c("pre",{children:r.text}),r.truncated&&p("div",{className:"muted",children:["已截断(",r.bytes," bytes)"]})]}):c("div",{className:"muted",children:"(空)"})}function hr(r){return r===0?"err":r<300||r<400?"ok":r<500?"warn":"err"}function st(r){const e=new Date(r);return`${e.toLocaleDateString("zh-CN")} ${e.toLocaleTimeString("zh-CN",{hour12:!1})}`}const fr=["POST","PUT","PATCH","DELETE"],dr=["GET","POST","PUT","PATCH","DELETE"];function pr({runtime:r}){const[e,t]=O([]),[n,s]=O(""),[i,o]=O("GET"),[a,u]=O(""),[h,m]=O(""),[w,S]=O(""),[y,g]=O(!1),[v,E]=O(!1),[j,xe]=O(null),[T,ce]=O(null);F(()=>{let x=!1;const ae=async()=>{try{const ct=await rt("");x||t(ct.records)}catch{}};ae();const ot=window.setInterval(()=>void ae(),3e3);return()=>{x=!0,window.clearInterval(ot)}},[]);const R=ee(()=>e.find(x=>x.id===n)??null,[e,n]);F(()=>{R&&(o(R.method),u(R.url),m(yr(R.reqHeaders)),S(R.reqBody.text))},[R]);const b=ee(()=>R?Object.keys(R.reqHeaders).some(ae=>/^(authorization|cookie|x-api-key|proxy-authorization|x-auth-token)$/i.test(ae)):!1,[R]),k=ee(()=>mr(h),[h]),_=n!==""&&a.trim().length>0,C=fr.includes(i);async function Z(){if(n!==""){E(!0),ce(null);try{const x=await Kt("",{recordId:n,overrides:{method:i,url:a,headers:k,body:w}});xe({original:R,replayed:{status:x.status,statusText:x.statusText,durationMs:0,bodyText:x.bodyText,headers:x.headers}}),g(!1)}catch(x){ce(x.message)}finally{E(!1)}}}function Se(){if(C){g(!0);return}Z()}return p("div",{className:"page",children:[c("h1",{children:"API 重放"}),p("div",{className:"replay-grid",children:[p("section",{className:"card",children:[c("h2",{children:"1. 选择记录"}),p("div",{className:"select",children:[p("select",{value:n,onChange:x=>s(Number(x.target.value)||""),children:[c("option",{value:"",children:"请选择…"}),[...e].reverse().map(x=>p("option",{value:x.id,children:["#",x.id," ",x.method," ",x.url]},x.id))]}),b&&c("div",{className:"warn-box",children:"此请求包含凭证,重放将使用当前凭证服务的值。"})]}),c("h2",{children:"2. 编辑请求"}),p("div",{className:"form-row",children:[c("select",{value:i,onChange:x=>o(x.target.value),children:dr.map(x=>c("option",{value:x,children:x},x))}),c("input",{className:"url",value:a,onChange:x=>u(x.target.value),placeholder:"URL"})]}),c("label",{className:"field-label",children:"请求头 (每行 `Key: value`)"}),c("textarea",{value:h,onChange:x=>m(x.target.value),rows:4,className:"mono"}),c("label",{className:"field-label",children:"请求体"}),c("textarea",{value:w,onChange:x=>S(x.target.value),rows:6,className:"mono",disabled:Oe(i),placeholder:Oe(i)?"GET/HEAD 请求不携带请求体":""}),Oe(i)&&c("div",{className:"muted",children:"GET/HEAD 请求不携带请求体;上方内容仅作为编辑参考,重放时不会发送。"}),(R==null?void 0:R.reqBody.truncated)&&c("div",{className:"muted",children:"原始请求体已截断,重放将使用截断版本。"}),c("div",{className:"form-actions",children:c("button",{onClick:Se,disabled:!_||v,children:v?"重放中…":"重放"})}),T&&c("div",{className:"error-line",children:T})]}),p("section",{className:"card",children:[c("h2",{children:"3. 对比"}),!j&&c("div",{className:"muted",children:"选择记录并点击“重放”后在此对比。"}),j&&c(gr,{outcome:j})]})]}),y&&R&&c("div",{className:"drawer-mask",onClick:()=>g(!1),children:p("div",{className:"confirm",onClick:x=>x.stopPropagation(),children:[c("h3",{children:"确认重放非幂等请求"}),p("div",{className:"mono confirm-detail",children:[p("div",{children:[i," ",a]}),p("div",{children:["发起方:",R.initiator]}),c("pre",{children:w.slice(0,1e3)})]}),p("div",{className:"form-actions",children:[c("button",{className:"ghost",onClick:()=>g(!1),children:"取消"}),c("button",{onClick:()=>void Z(),disabled:v,children:"确认重放"})]})]})})]})}function gr({outcome:r}){const{original:e,replayed:t}=r;return p("div",{className:"compare",children:[p("div",{className:"compare-col",children:[c("h3",{children:"原始记录"}),p("div",{className:"compare-item",children:[c("span",{children:"状态"}),p("b",{children:[e.status," ",e.statusText]})]}),p("div",{className:"compare-item",children:[c("span",{children:"耗时"}),p("b",{children:[e.durationMs," ms"]})]}),c("pre",{className:"body-view",children:e.resBody.text||"(空)"})]}),p("div",{className:"compare-col",children:[c("h3",{children:"重放结果"}),p("div",{className:"compare-item",children:[c("span",{children:"状态"}),p("b",{children:[t.status," ",t.statusText]})]}),p("div",{className:"compare-item",children:[c("span",{children:"耗时"}),c("b",{children:t.durationMs?`${t.durationMs} ms`:"—"})]}),c("pre",{className:"body-view",children:t.bodyText||"(空)"})]})]})}function yr(r){return Object.entries(r).map(([e,t])=>`${e}: ${t}`).join(`
13
+ `)}function mr(r){const e={};for(const t of r.split(`
14
+ `)){const n=t.indexOf(":");if(n<0)continue;const s=t.slice(0,n).trim(),i=t.slice(n+1).trim();s&&(e[s]=i)}return e}function Oe(r){return r==="GET"||r==="HEAD"}const br={running:"运行中",stopping:"停止中…",removing:"移除中…",error:"错误"};function wr(){const[r,e]=O([]),[t,n]=O(""),[s,i]=O(!1),[o,a]=O(null),[u,h]=O(null),[m,w]=O(!1),[S,y]=O(null),[g,v]=O(null),E=re(async()=>{try{const b=await Te("");e(k=>b.map(_=>{const C=k.find(Se=>Se.pluginRunId===_.pluginRunId);if(!C)return{..._,localState:"running"};const Z={..._,localState:C.localState};return C.message!==void 0&&(Z.message=C.message),Z}))}catch(b){v(b.message)}},[]);F(()=>{E();const b=window.setInterval(()=>void E(),3e3);return()=>window.clearInterval(b)},[E]);async function j(){const b=t.trim();if(b){i(!0),a(null),v(null);try{const k=await Xt("",b);a(`已安装 ${b} → ${k.id}@${k.version}(${k.pluginRunId})`),n(""),await E()}catch(k){const _=k instanceof te?`${k.code}: ${k.message}`:k.message;v(`安装失败:${_}`)}finally{i(!1)}}}async function xe(){if(u){w(!0),y(null),v(null);try{const b=await Zt("",u,u.name);y(`上传成功:${b.id}@${b.manifest.version}(${b.pluginRunId})`),h(null),await E()}catch(b){const k=b instanceof te?`${b.code}: ${b.message}`:b.message;v(`上传失败:${k}`)}finally{w(!1)}}}function T(b,k){e(_=>_.map(C=>C.pluginRunId===b?{...C,...k}:C))}async function ce(b){T(b.pluginRunId,{localState:"stopping"});try{await Wt("",b.pluginRunId),T(b.pluginRunId,{localState:"error",message:"已停止"})}catch(k){T(b.pluginRunId,{localState:"error",message:k.message})}}async function R(b){T(b.pluginRunId,{localState:"removing"});try{await Yt("",b.pluginRunId),e(k=>k.filter(_=>_.pluginRunId!==b.pluginRunId))}catch(k){T(b.pluginRunId,{localState:"error",message:k.message})}}return p("div",{className:"page",children:[c("h1",{children:"插件管理"}),g&&c("div",{className:"error-line",children:g}),p("section",{className:"card",children:[c("h2",{children:"按包名安装"}),p("div",{className:"upload-row",children:[c("input",{type:"text",placeholder:"@scope/my-audit-plugin",value:t,onChange:b=>n(b.target.value),onKeyDown:b=>{b.key==="Enter"&&j()}}),c("button",{onClick:()=>void j(),disabled:!t.trim()||s,children:s?"安装中…":"安装"})]}),o&&c("div",{className:"ok-line",children:o}),p("div",{className:"muted",children:["npm 包名(如需指定版本:",c("span",{className:"mono",children:"pkg@1.2.3"}),"),或本地 ",c("span",{className:"mono",children:"file:./插件文件夹"})]})]}),p("section",{className:"card",children:[c("h2",{children:"或上传 zip"}),p("div",{className:"upload-row",children:[c("input",{type:"file",accept:".zip,application/zip",onChange:b=>{var k;return h(((k=b.target.files)==null?void 0:k[0])??null)}}),c("button",{onClick:()=>void xe(),disabled:!u||m,children:m?"上传中…":"上传"})]}),S&&c("div",{className:"ok-line",children:S})]}),p("section",{className:"card",children:[c("h2",{children:"插件列表"}),r.length===0&&c("div",{className:"muted",children:"暂无插件"}),p("table",{className:"table",children:[c("thead",{children:p("tr",{children:[c("th",{children:"ID"}),c("th",{children:"版本"}),c("th",{children:"标题"}),c("th",{children:"状态"}),c("th",{children:"pluginRunId"}),c("th",{children:"操作"})]})}),c("tbody",{children:r.map(b=>p("tr",{children:[c("td",{className:"mono",children:b.id}),c("td",{children:b.manifest.version}),c("td",{children:b.manifest.title}),p("td",{children:[c("span",{className:`status ${b.localState==="running"?"ok":"warn"}`,children:br[b.localState]}),b.message&&c("div",{className:"muted",children:b.message})]}),c("td",{className:"mono",children:b.pluginRunId}),p("td",{className:"actions",children:[c("button",{className:"ghost",disabled:b.localState==="stopping"||b.localState==="removing",onClick:()=>void ce(b),children:"停止"}),c("button",{className:"ghost danger",disabled:b.localState==="stopping"||b.localState==="removing",onClick:()=>void R(b),children:"移除"})]})]},b.pluginRunId))})]})]})]})}class vr extends qe{constructor(){super(...arguments);l(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}render(){var t;return this.state.error?p("div",{className:"error-box",children:[c("h2",{children:"页面出错了"}),c("pre",{children:String(((t=this.state.error)==null?void 0:t.message)??this.state.error)}),c("button",{onClick:()=>this.setState({error:null}),children:"重试"})]}):this.props.children}}const xr="";function Sr(){const[r,e]=O(null);F(()=>{let a=!1,u;return rr({url:`${location.origin}/ws`}).then(h=>{if(a){h.close();return}u=h,e(h)}).catch(()=>{}),()=>{a=!0,u==null||u.close()}},[]);const t=ut(new Set);F(()=>{if(!r)return;const a=r;let u=!1;async function h(S,y){try{if(u||t.current.has(y))return;if(a.pages.getSnapshot().find(v=>v.pluginId===S)){t.current.add(y);return}await er(a,{id:S}),t.current.add(y)}catch(g){const v=g instanceof Error?`${g.message}
15
+ ${g.stack}`:String(g);console.warn(`[plugin-sync] failed to install browser half for ${S} (${y}): ${v}`)}}async function m(){var y;let S;try{S=await Te(xr)}catch{return}if(!u)for(const g of S)(y=g.manifest.halves.browser)!=null&&y.entry&&h(g.id,g.pluginRunId)}m();const w=a.onSnapshot(S=>{var y;for(const g of S.plugins)(y=g.manifest.halves.browser)!=null&&y.entry&&h(g.id,g.pluginRunId)});return()=>{u=!0,w()}},[r]);const n=re(a=>{const u=r==null?void 0:r.pages;return u?u.subscribe(a):()=>{}},[r]),s=re(()=>{const a=r==null?void 0:r.pages;return a?a.getSnapshot():Or},[r]),i=ht(n,s),o=ee(()=>i.filter(a=>typeof a.Component=="function"),[i]);return p("div",{className:"layout",children:[p("aside",{className:"sidebar",children:[c("div",{className:"brand",children:"API Audit"}),p("nav",{children:[c(le,{to:"/audit",className:"nav-item",children:"审计记录"}),c(le,{to:"/replay",className:"nav-item",children:"API 重放"}),c(le,{to:"/plugins",className:"nav-item",children:"插件管理"}),o.length>0&&c("div",{className:"nav-sep",children:"插件页面"}),o.map(a=>c(le,{to:a.path,className:"nav-item",children:a.title},`${a.pluginId}:${a.path}`))]}),c("div",{className:"sidebar-foot",children:c(Er,{runtime:r})})]}),c("main",{className:"main",children:c(vr,{children:c(ft,{fallback:c("div",{className:"empty",children:"加载中…"}),children:p(gt,{children:[c(z,{path:"/",element:c(yt,{to:"/audit",replace:!0})}),c(z,{path:"/audit",element:c(lr,{runtime:r})}),c(z,{path:"/replay",element:c(pr,{runtime:r})}),c(z,{path:"/plugins",element:c(wr,{})}),o.map(a=>c(z,{path:a.path,element:c(kr,{title:a.title,children:c(a.Component,{})})},`${a.pluginId}:${a.path}`)),c(z,{path:"*",element:c(Rr,{})})]})})})})]})}const Or=Object.freeze([]);class kr extends qe{constructor(){super(...arguments);l(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}render(){var t;return this.state.error?p("div",{className:"error-box",children:[p("h2",{children:["插件页面出错:",this.props.title]}),c("pre",{children:String(((t=this.state.error)==null?void 0:t.message)??this.state.error)}),c("button",{onClick:()=>this.setState({error:null}),children:"重试"})]}):this.props.children}}function Er({runtime:r}){const[e,t]=O("connecting");F(()=>{if(!r)return;const s=()=>t(r.status());s();const i=window.setInterval(s,500);return()=>window.clearInterval(i)},[r]);const n=e==="connected";return c("span",{className:`ws-badge ${n?"on":""}`,children:n?"已连接":"连接中…"})}function Rr(){return p("div",{className:"empty",children:[c("h2",{children:"404"}),c("p",{children:"页面不存在。"})]})}const it=document.getElementById("root");if(!it)throw new Error("missing #root");pt(it).render(c(dt,{children:c(mt,{children:c(Sr,{})})}));
16
+ //# sourceMappingURL=index-DfSekBjO.js.map
package/dist/index.html CHANGED
@@ -16,8 +16,8 @@
16
16
  }
17
17
  }
18
18
  </script>
19
- <script type="module" crossorigin src="/assets/index-CcuZJdOa.js"></script>
20
- <link rel="stylesheet" crossorigin href="/assets/index-DcQEfWXF.css">
19
+ <script type="module" crossorigin src="/assets/index-DfSekBjO.js"></script>
20
+ <link rel="stylesheet" crossorigin href="/assets/index-B66FH-w5.css">
21
21
  </head>
22
22
  <body>
23
23
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowot/nx-pn-web",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Web shell frontend for the nx-pn plugin platform — vite build; dist/ served by the host",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -34,8 +34,8 @@
34
34
  "typescript": "5.6.3",
35
35
  "vite": "^5.4.8",
36
36
  "vitest": "2.1.5",
37
- "@flowot/nx-pn-core": "^0.1.0",
38
- "@flowot/nx-pn-client": "^0.1.0"
37
+ "@flowot/nx-pn-client": "^0.2.0",
38
+ "@flowot/nx-pn-core": "^0.2.0"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "node scripts/build-vendor.mjs && vite build",
@@ -1 +0,0 @@
1
- :root{--bg: #f6f7f9;--panel: #ffffff;--border: #e2e4e9;--text: #1f2430;--muted: #7a8194;--accent: #3b6ef5;--ok: #1a9e5a;--warn: #c98a12;--err: #d83c4a;--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;font-size:14px}#root{min-height:100vh}.layout{display:flex;min-height:100vh}.sidebar{width:200px;flex:0 0 200px;background:#1e2430;color:#dfe3ec;display:flex;flex-direction:column;padding:16px 0}.brand{font-size:17px;font-weight:700;padding:0 16px 18px;letter-spacing:.02em}.sidebar nav{flex:1}.nav-item{display:block;padding:10px 16px;color:#aeb6c4;text-decoration:none}.nav-item:hover{background:#ffffff0f;color:#fff}.nav-item.active{background:var(--accent);color:#fff}.nav-sep{font-size:11px;letter-spacing:.05em;text-transform:uppercase;color:#6e7689;padding:14px 16px 4px}.sidebar-foot{padding:12px 16px}.ws-badge{font-size:12px;color:#8b93a5}.ws-badge:before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;background:#8b93a5;margin-right:6px}.ws-badge.on:before{background:#3ddc84}.ws-badge.on{color:#dfe3ec}.main{flex:1;padding:24px 32px;min-width:0}.page{max-width:1100px}.page h1{font-size:20px;margin:0 0 16px}.card{background:var(--panel);border:1px solid var(--border);border-radius:10px;padding:16px 18px;margin-bottom:16px}.card h2{font-size:15px;margin:0 0 10px}.muted{color:var(--muted)}.error-line{color:var(--err);margin:8px 0}.ok-line{color:var(--ok);margin:8px 0}.error-box{background:#fff5f5;border:1px solid #f2c6c6;color:var(--err);padding:24px;border-radius:8px}.error-box pre{white-space:pre-wrap}.warn-box{background:#fff7e8;border:1px solid #f0d9a8;color:#8a5a00;padding:8px 12px;border-radius:6px;margin:10px 0}.table{width:100%;border-collapse:collapse;background:var(--panel);border:1px solid var(--border);border-radius:10px;overflow:hidden}.table th,.table td{text-align:left;padding:8px 12px;border-bottom:1px solid var(--border);vertical-align:top}.table th{background:#fafbfc;font-weight:600;color:#4a5265;font-size:12px;text-transform:uppercase;letter-spacing:.03em}.table tr:last-child td{border-bottom:none}.table.slim td{padding:4px 8px;border-bottom:1px dashed var(--border);font-size:12px}.mono{font-family:var(--mono);word-break:break-all}.key{color:var(--muted);width:180px;white-space:pre-wrap}.row-click{cursor:pointer}.row-click:hover{background:#f4f7ff}.empty-cell{text-align:center;color:var(--muted);padding:28px}.method{font-family:var(--mono);font-size:11px;font-weight:700;padding:2px 7px;border-radius:4px;background:#eceff5}.method.POST{background:#fff1d6;color:#8a5a00}.method.PUT,.method.PATCH{background:#e2edff;color:#2b5bc0}.method.DELETE{background:#ffe3e6;color:#b0222f}.status{font-family:var(--mono);font-weight:600}.status.ok{color:var(--ok)}.status.warn{color:var(--warn)}.status.err{color:var(--err)}.tag{font-size:11px;padding:1px 5px;border-radius:3px;margin-left:6px}.tag.replay{background:#e2edff;color:#2b5bc0}.filters{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap;align-items:center}.filters input,.filters select,input,select,textarea{border:1px solid var(--border);border-radius:6px;padding:6px 10px;font-size:13px;background:#fff;color:var(--text);font-family:inherit}.filters input[type=text]{min-width:180px}.count{color:var(--muted);font-size:12px}.sort-toggle,.th-sort{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:6px;padding:4px 10px;font-size:12px;cursor:pointer;font-family:inherit}.sort-toggle:hover,.th-sort:hover{border-color:var(--accent);color:var(--accent)}.th-sort{border:none;background:none;padding:0;font-weight:600}.drawer-mask{position:fixed;top:0;right:0;bottom:0;left:0;background:#0f121966;display:flex;justify-content:flex-end;z-index:20}.drawer{background:var(--panel);width:min(720px,92vw);height:100%;overflow-y:auto;padding:20px 24px}.drawer-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}.drawer-head h3{margin:0 0 12px;word-break:break-all}.drawer h4{margin:18px 0 6px;font-size:13px;color:#4a5265}.info-row{display:flex;gap:10px;margin:4px 0}.info-label{color:var(--muted);width:64px;flex:0 0 64px}.body-view{background:#10131a;color:#d8dee9;padding:10px 12px;border-radius:6px;font-family:var(--mono);font-size:12px;overflow-x:auto;margin:4px 0}.body-view pre{margin:0;white-space:pre-wrap}button{border:1px solid var(--border);background:#fff;border-radius:6px;padding:6px 14px;font-size:13px;cursor:pointer;color:var(--text)}button:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}button:disabled{opacity:.5;cursor:not-allowed}button.ghost{padding:3px 10px;font-size:12px}button.danger:hover{border-color:var(--err);color:var(--err)}.form-actions{margin-top:14px;display:flex;gap:8px}.replay-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}@media (max-width: 900px){.replay-grid{grid-template-columns:1fr}}.form-row{display:flex;gap:8px}.form-row input.url{flex:1}.field-label{display:block;margin:10px 0 4px;color:#4a5265;font-size:12px}textarea{width:100%;font-family:var(--mono);resize:vertical}.actions{white-space:nowrap}.actions button{margin-right:6px}.confirm{background:var(--panel);border-radius:10px;padding:20px;width:min(560px,92vw);margin:auto;align-self:center;max-height:80vh;overflow-y:auto}.confirm-detail{background:#f7f8fa;border:1px solid var(--border);border-radius:6px;padding:10px 12px}.confirm-detail pre{white-space:pre-wrap;margin:8px 0 0}.compare{display:grid;grid-template-columns:1fr 1fr;gap:12px}.compare-col h3{font-size:13px;margin:0 0 8px}.compare-item{display:flex;justify-content:space-between;font-size:12px;margin:4px 0}.compare-item span{color:var(--muted)}