@myskyline_ai/ccdebug 0.2.11 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web/dist/assets/{index-sbcH6dBt.js → index-xbz65MKz.js} +2 -2
- package/web/dist/assets/{index-sbcH6dBt.js.map → index-xbz65MKz.js.map} +1 -1
- package/web/dist/index.html +1 -1
- package/web/server/conversation-parser.d.ts.map +1 -1
- package/web/server/conversation-parser.js +26 -11
- package/web/server/conversation-parser.js.map +1 -1
- package/web/server/log-file-manager.d.ts.map +1 -1
- package/web/server/log-file-manager.js +51 -32
- package/web/server/log-file-manager.js.map +1 -1
- package/web/server/web-server.d.ts.map +1 -1
- package/web/server/web-server.js +7 -5
- package/web/server/web-server.js.map +1 -1
package/package.json
CHANGED
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const l=new this(t);return n.forEach(o=>l.set(o)),l}static accessor(t){const l=(this[Ly]=this[Ly]={accessors:{}}).accessors,o=this.prototype;function r(a){const i=dr(a);l[i]||(dx(o,a),l[i]=!0)}return $e.isArray(t)?t.forEach(r):r(t),this}};Wn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);$e.reduceDescriptors(Wn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(l){this[n]=l}}});$e.freezeMethods(Wn);function Sp(e,t){const n=this||vi,l=t||n,o=Wn.from(l.headers);let r=l.data;return $e.forEach(e,function(i){r=i.call(n,r,o.normalize(),t?t.status:void 0)}),o.normalize(),r}function S2(e){return!!(e&&e.__CANCEL__)}function er(e,t,n){dt.call(this,e??"canceled",dt.ERR_CANCELED,t,n),this.name="CanceledError"}$e.inherits(er,dt,{__CANCEL__:!0});function P2(e,t,n){const l=n.config.validateStatus;!n.status||!l||l(n.status)?e(n):t(new dt("Request failed with status code "+n.status,[dt.ERR_BAD_REQUEST,dt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function fx(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function px(e,t){e=e||10;const n=new Array(e),l=new Array(e);let o=0,r=0,a;return t=t!==void 0?t:1e3,function(s){const c=Date.now(),u=l[r];a||(a=c),n[o]=s,l[o]=c;let f=r,v=0;for(;f!==o;)v+=n[f++],f=f%e;if(o=(o+1)%e,o===r&&(r=(r+1)%e),c-a<t)return;const h=u&&c-u;return h?Math.round(v*1e3/h):void 0}}function vx(e,t){let n=0,l=1e3/t,o,r;const a=(c,u=Date.now())=>{n=u,o=null,r&&(clearTimeout(r),r=null),e(...c)};return[(...c)=>{const u=Date.now(),f=u-n;f>=l?a(c,u):(o=c,r||(r=setTimeout(()=>{r=null,a(o)},l-f)))},()=>o&&a(o)]}const wu=(e,t,n=3)=>{let l=0;const o=px(50,250);return vx(r=>{const a=r.loaded,i=r.lengthComputable?r.total:void 0,s=a-l,c=o(s),u=a<=i;l=a;const f={loaded:a,total:i,progress:i?a/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&u?(i-a)/c:void 0,event:r,lengthComputable:i!=null,[t?"download":"upload"]:!0};e(f)},n)},Ey=(e,t)=>{const n=e!=null;return[l=>t[0]({lengthComputable:n,total:e,loaded:l}),t[1]]},Iy=e=>(...t)=>$e.asap(()=>e(...t)),hx=On.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,On.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(On.origin),On.navigator&&/(msie|trident)/i.test(On.navigator.userAgent)):()=>!0,mx=On.hasStandardBrowserEnv?{write(e,t,n,l,o,r,a){if(typeof document>"u")return;const i=[`${e}=${encodeURIComponent(t)}`];$e.isNumber(n)&&i.push(`expires=${new Date(n).toUTCString()}`),$e.isString(l)&&i.push(`path=${l}`),$e.isString(o)&&i.push(`domain=${o}`),r===!0&&i.push("secure"),$e.isString(a)&&i.push(`SameSite=${a}`),document.cookie=i.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function gx(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function yx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function O2(e,t,n){let l=!gx(t);return e&&(l||n==!1)?yx(e,t):t}const By=e=>e instanceof Wn?{...e}:e;function ia(e,t){t=t||{};const n={};function l(c,u,f,v){return $e.isPlainObject(c)&&$e.isPlainObject(u)?$e.merge.call({caseless:v},c,u):$e.isPlainObject(u)?$e.merge({},u):$e.isArray(u)?u.slice():u}function o(c,u,f,v){if($e.isUndefined(u)){if(!$e.isUndefined(c))return l(void 0,c,f,v)}else return l(c,u,f,v)}function r(c,u){if(!$e.isUndefined(u))return l(void 0,u)}function a(c,u){if($e.isUndefined(u)){if(!$e.isUndefined(c))return l(void 0,c)}else return l(void 0,u)}function i(c,u,f){if(f in t)return l(c,u);if(f in e)return l(void 0,c)}const s={url:r,method:r,data:r,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:i,headers:(c,u,f)=>o(By(c),By(u),f,!0)};return $e.forEach(Object.keys({...e,...t}),function(u){const f=s[u]||o,v=f(e[u],t[u],u);$e.isUndefined(v)&&f!==i||(n[u]=v)}),n}const _2=e=>{const t=ia({},e);let{data:n,withXSRFToken:l,xsrfHeaderName:o,xsrfCookieName:r,headers:a,auth:i}=t;if(t.headers=a=Wn.from(a),t.url=k2(O2(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&a.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),$e.isFormData(n)){if(On.hasStandardBrowserEnv||On.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if($e.isFunction(n.getHeaders)){const s=n.getHeaders(),c=["content-type","content-length"];Object.entries(s).forEach(([u,f])=>{c.includes(u.toLowerCase())&&a.set(u,f)})}}if(On.hasStandardBrowserEnv&&(l&&$e.isFunction(l)&&(l=l(t)),l||l!==!1&&hx(t.url))){const s=o&&r&&mx.read(r);s&&a.set(o,s)}return t},bx=typeof XMLHttpRequest<"u",Cx=bx&&function(e){return new Promise(function(n,l){const o=_2(e);let r=o.data;const a=Wn.from(o.headers).normalize();let{responseType:i,onUploadProgress:s,onDownloadProgress:c}=o,u,f,v,h,m;function y(){h&&h(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function b(){if(!g)return;const k=Wn.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),S={data:!i||i==="text"||i==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:k,config:e,request:g};P2(function(_){n(_),y()},function(_){l(_),y()},S),g=null}"onloadend"in g?g.onloadend=b:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(b)},g.onabort=function(){g&&(l(new dt("Request aborted",dt.ECONNABORTED,e,g)),g=null)},g.onerror=function($){const S=$&&$.message?$.message:"Network Error",P=new dt(S,dt.ERR_NETWORK,e,g);P.event=$||null,l(P),g=null},g.ontimeout=function(){let $=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const S=o.transitional||w2;o.timeoutErrorMessage&&($=o.timeoutErrorMessage),l(new dt($,S.clarifyTimeoutError?dt.ETIMEDOUT:dt.ECONNABORTED,e,g)),g=null},r===void 0&&a.setContentType(null),"setRequestHeader"in g&&$e.forEach(a.toJSON(),function($,S){g.setRequestHeader(S,$)}),$e.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),i&&i!=="json"&&(g.responseType=o.responseType),c&&([v,m]=wu(c,!0),g.addEventListener("progress",v)),s&&g.upload&&([f,h]=wu(s),g.upload.addEventListener("progress",f),g.upload.addEventListener("loadend",h)),(o.cancelToken||o.signal)&&(u=k=>{g&&(l(!k||k.type?new er(null,e,g):k),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const w=fx(o.url);if(w&&On.protocols.indexOf(w)===-1){l(new dt("Unsupported protocol "+w+":",dt.ERR_BAD_REQUEST,e));return}g.send(r||null)})},kx=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let l=new AbortController,o;const r=function(c){if(!o){o=!0,i();const u=c instanceof Error?c:this.reason;l.abort(u instanceof dt?u:new er(u instanceof Error?u.message:u))}};let a=t&&setTimeout(()=>{a=null,r(new dt(`timeout ${t} of ms exceeded`,dt.ETIMEDOUT))},t);const i=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(r):c.removeEventListener("abort",r)}),e=null)};e.forEach(c=>c.addEventListener("abort",r));const{signal:s}=l;return s.unsubscribe=()=>$e.asap(i),s}},wx=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let l=0,o;for(;l<n;)o=l+t,yield e.slice(l,o),l=o},$x=async function*(e,t){for await(const n of Sx(e))yield*wx(n,t)},Sx=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:l}=await t.read();if(n)break;yield l}}finally{await t.cancel()}},Ay=(e,t,n,l)=>{const o=$x(e,t);let r=0,a,i=s=>{a||(a=!0,l&&l(s))};return new ReadableStream({async pull(s){try{const{done:c,value:u}=await o.next();if(c){i(),s.close();return}let f=u.byteLength;if(n){let v=r+=f;n(v)}s.enqueue(new Uint8Array(u))}catch(c){throw i(c),c}},cancel(s){return i(s),o.return()}},{highWaterMark:2})},Vy=64*1024,{isFunction:Ni}=$e,Px=(({Request:e,Response:t})=>({Request:e,Response:t}))($e.global),{ReadableStream:xy,TextEncoder:My}=$e.global,Ny=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ox=e=>{e=$e.merge.call({skipUndefined:!0},Px,e);const{fetch:t,Request:n,Response:l}=e,o=t?Ni(t):typeof fetch=="function",r=Ni(n),a=Ni(l);if(!o)return!1;const i=o&&Ni(xy),s=o&&(typeof My=="function"?(m=>y=>m.encode(y))(new My):async m=>new Uint8Array(await new n(m).arrayBuffer())),c=r&&i&&Ny(()=>{let m=!1;const y=new n(On.origin,{body:new xy,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!y}),u=a&&i&&Ny(()=>$e.isReadableStream(new l("").body)),f={stream:u&&(m=>m.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(y,g)=>{let b=y&&y[m];if(b)return b.call(y);throw new dt(`Response type '${m}' is not supported`,dt.ERR_NOT_SUPPORT,g)})});const v=async m=>{if(m==null)return 0;if($e.isBlob(m))return m.size;if($e.isSpecCompliantForm(m))return(await new n(On.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if($e.isArrayBufferView(m)||$e.isArrayBuffer(m))return m.byteLength;if($e.isURLSearchParams(m)&&(m=m+""),$e.isString(m))return(await s(m)).byteLength},h=async(m,y)=>{const g=$e.toFiniteNumber(m.getContentLength());return g??v(y)};return async m=>{let{url:y,method:g,data:b,signal:w,cancelToken:k,timeout:$,onDownloadProgress:S,onUploadProgress:P,responseType:_,headers:I,withCredentials:D="same-origin",fetchOptions:H}=_2(m),N=t||fetch;_=_?(_+"").toLowerCase():"text";let X=kx([w,k&&k.toAbortSignal()],$),Z=null;const z=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let Y;try{if(P&&c&&g!=="get"&&g!=="head"&&(Y=await h(I,b))!==0){let K=new n(y,{method:"POST",body:b,duplex:"half"}),te;if($e.isFormData(b)&&(te=K.headers.get("content-type"))&&I.setContentType(te),K.body){const[O,T]=Ey(Y,wu(Iy(P)));b=Ay(K.body,Vy,O,T)}}$e.isString(D)||(D=D?"include":"omit");const F=r&&"credentials"in n.prototype,V={...H,signal:X,method:g.toUpperCase(),headers:I.normalize().toJSON(),body:b,duplex:"half",credentials:F?D:void 0};Z=r&&new n(y,V);let R=await(r?N(Z,H):N(y,V));const j=u&&(_==="stream"||_==="response");if(u&&(S||j&&z)){const K={};["status","statusText","headers"].forEach(W=>{K[W]=R[W]});const te=$e.toFiniteNumber(R.headers.get("content-length")),[O,T]=S&&Ey(te,wu(Iy(S),!0))||[];R=new l(Ay(R.body,Vy,O,()=>{T&&T(),z&&z()}),K)}_=_||"text";let M=await f[$e.findKey(f,_)||"text"](R,m);return!j&&z&&z(),await new Promise((K,te)=>{P2(K,te,{data:M,headers:Wn.from(R.headers),status:R.status,statusText:R.statusText,config:m,request:Z})})}catch(F){throw z&&z(),F&&F.name==="TypeError"&&/Load failed|fetch/i.test(F.message)?Object.assign(new dt("Network Error",dt.ERR_NETWORK,m,Z),{cause:F.cause||F}):dt.from(F,F&&F.code,m,Z)}}},_x=new Map,T2=e=>{let t=e&&e.env||{};const{fetch:n,Request:l,Response:o}=t,r=[l,o,n];let a=r.length,i=a,s,c,u=_x;for(;i--;)s=r[i],c=u.get(s),c===void 0&&u.set(s,c=i?new Map:Ox(t)),u=c;return c};T2();const Uh={http:WV,xhr:Cx,fetch:{get:T2}};$e.forEach(Uh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ry=e=>`- ${e}`,Tx=e=>$e.isFunction(e)||e===null||e===!1;function Lx(e,t){e=$e.isArray(e)?e:[e];const{length:n}=e;let l,o;const r={};for(let a=0;a<n;a++){l=e[a];let i;if(o=l,!Tx(l)&&(o=Uh[(i=String(l)).toLowerCase()],o===void 0))throw new dt(`Unknown adapter '${i}'`);if(o&&($e.isFunction(o)||(o=o.get(t))))break;r[i||"#"+a]=o}if(!o){const a=Object.entries(r).map(([s,c])=>`adapter ${s} `+(c===!1?"is not supported by the environment":"is not available in the build"));let i=n?a.length>1?`since :
|
|
35
35
|
`+a.map(Ry).join(`
|
|
36
36
|
`):" "+Ry(a[0]):"as no adapter specified";throw new dt("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return o}const L2={getAdapter:Lx,adapters:Uh};function Pp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new er(null,e)}function zy(e){return Pp(e),e.headers=Wn.from(e.headers),e.data=Sp.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),L2.getAdapter(e.adapter||vi.adapter,e)(e).then(function(l){return Pp(e),l.data=Sp.call(e,e.transformResponse,l),l.headers=Wn.from(l.headers),l},function(l){return S2(l)||(Pp(e),l&&l.response&&(l.response.data=Sp.call(e,e.transformResponse,l.response),l.response.headers=Wn.from(l.response.headers))),Promise.reject(l)})}const E2="1.13.2",gc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{gc[e]=function(l){return typeof l===e||"a"+(t<1?"n ":" ")+e}});const Dy={};gc.transitional=function(t,n,l){function o(r,a){return"[Axios v"+E2+"] Transitional option '"+r+"'"+a+(l?". "+l:"")}return(r,a,i)=>{if(t===!1)throw new dt(o(a," has been removed"+(n?" in "+n:"")),dt.ERR_DEPRECATED);return n&&!Dy[a]&&(Dy[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(r,a,i):!0}};gc.spelling=function(t){return(n,l)=>(console.warn(`${l} is likely a misspelling of ${t}`),!0)};function Ex(e,t,n){if(typeof e!="object")throw new dt("options must be an object",dt.ERR_BAD_OPTION_VALUE);const l=Object.keys(e);let o=l.length;for(;o-- >0;){const r=l[o],a=t[r];if(a){const i=e[r],s=i===void 0||a(i,r,e);if(s!==!0)throw new dt("option "+r+" must be "+s,dt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new dt("Unknown option "+r,dt.ERR_BAD_OPTION)}}const Hs={assertOptions:Ex,validators:gc},Ol=Hs.validators;let na=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ty,response:new Ty}}async request(t,n){try{return await this._request(t,n)}catch(l){if(l instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const r=o.stack?o.stack.replace(/^.+\n/,""):"";try{l.stack?r&&!String(l.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(l.stack+=`
|
|
37
|
-
`+r):l.stack=r}catch{}}throw l}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ia(this.defaults,n);const{transitional:l,paramsSerializer:o,headers:r}=n;l!==void 0&&Hs.assertOptions(l,{silentJSONParsing:Ol.transitional(Ol.boolean),forcedJSONParsing:Ol.transitional(Ol.boolean),clarifyTimeoutError:Ol.transitional(Ol.boolean)},!1),o!=null&&($e.isFunction(o)?n.paramsSerializer={serialize:o}:Hs.assertOptions(o,{encode:Ol.function,serialize:Ol.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Hs.assertOptions(n,{baseUrl:Ol.spelling("baseURL"),withXsrfToken:Ol.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=r&&$e.merge(r.common,r[n.method]);r&&$e.forEach(["delete","get","head","post","put","patch","common"],m=>{delete r[m]}),n.headers=Wn.concat(a,r);const i=[];let s=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(s=s&&y.synchronous,i.unshift(y.fulfilled,y.rejected))});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let u,f=0,v;if(!s){const m=[zy.bind(this),void 0];for(m.unshift(...i),m.push(...c),v=m.length,u=Promise.resolve(n);f<v;)u=u.then(m[f++],m[f++]);return u}v=i.length;let h=n;for(;f<v;){const m=i[f++],y=i[f++];try{h=m(h)}catch(g){y.call(this,g);break}}try{u=zy.call(this,h)}catch(m){return Promise.reject(m)}for(f=0,v=c.length;f<v;)u=u.then(c[f++],c[f++]);return u}getUri(t){t=ia(this.defaults,t);const n=O2(t.baseURL,t.url,t.allowAbsoluteUrls);return k2(n,t.params,t.paramsSerializer)}};$e.forEach(["delete","get","head","options"],function(t){na.prototype[t]=function(n,l){return this.request(ia(l||{},{method:t,url:n,data:(l||{}).data}))}});$e.forEach(["post","put","patch"],function(t){function n(l){return function(r,a,i){return this.request(ia(i||{},{method:t,headers:l?{"Content-Type":"multipart/form-data"}:{},url:r,data:a}))}}na.prototype[t]=n(),na.prototype[t+"Form"]=n(!0)});let Ix=class I2{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});const l=this;this.promise.then(o=>{if(!l._listeners)return;let r=l._listeners.length;for(;r-- >0;)l._listeners[r](o);l._listeners=null}),this.promise.then=o=>{let r;const a=new Promise(i=>{l.subscribe(i),r=i}).then(o);return a.cancel=function(){l.unsubscribe(r)},a},t(function(r,a,i){l.reason||(l.reason=new er(r,a,i),n(l.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=l=>{t.abort(l)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new I2(function(o){t=o}),cancel:t}}};function Bx(e){return function(n){return e.apply(null,n)}}function Ax(e){return $e.isObject(e)&&e.isAxiosError===!0}const $v={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries($v).forEach(([e,t])=>{$v[t]=e});function B2(e){const t=new na(e),n=u2(na.prototype.request,t);return $e.extend(n,na.prototype,t,{allOwnKeys:!0}),$e.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return B2(ia(e,o))},n}const wt=B2(vi);wt.Axios=na;wt.CanceledError=er;wt.CancelToken=Ix;wt.isCancel=S2;wt.VERSION=E2;wt.toFormData=mc;wt.AxiosError=dt;wt.Cancel=wt.CanceledError;wt.all=function(t){return Promise.all(t)};wt.spread=Bx;wt.isAxiosError=Ax;wt.mergeConfig=ia;wt.AxiosHeaders=Wn;wt.formToJSON=e=>$2($e.isHTMLForm(e)?new FormData(e):e);wt.getAdapter=L2.getAdapter;wt.HttpStatusCode=$v;wt.default=wt;const{Axios:xD,AxiosError:MD,CanceledError:ND,isCancel:RD,CancelToken:zD,VERSION:DD,all:jD,Cancel:FD,isAxiosError:HD,spread:WD,toFormData:KD,AxiosHeaders:qD,HttpStatusCode:UD,formToJSON:YD,getAdapter:ZD,mergeConfig:GD}=wt,Nl=Object.create(null);Nl.open="0";Nl.close="1";Nl.ping="2";Nl.pong="3";Nl.message="4";Nl.upgrade="5";Nl.noop="6";const Ws=Object.create(null);Object.keys(Nl).forEach(e=>{Ws[Nl[e]]=e});const Sv={type:"error",data:"parser error"},A2=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",V2=typeof ArrayBuffer=="function",x2=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Yh=({type:e,data:t},n,l)=>A2&&t instanceof Blob?n?l(t):jy(t,l):V2&&(t instanceof ArrayBuffer||x2(t))?n?l(t):jy(new Blob([t]),l):l(Nl[e]+(t||"")),jy=(e,t)=>{const n=new FileReader;return n.onload=function(){const l=n.result.split(",")[1];t("b"+(l||""))},n.readAsDataURL(e)};function Fy(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Op;function Vx(e,t){if(A2&&e.data instanceof Blob)return e.data.arrayBuffer().then(Fy).then(t);if(V2&&(e.data instanceof ArrayBuffer||x2(e.data)))return t(Fy(e.data));Yh(e,!1,n=>{Op||(Op=new TextEncoder),t(Op.encode(n))})}const Hy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Hy.length;e++)yr[Hy.charCodeAt(e)]=e;const xx=e=>{let t=e.length*.75,n=e.length,l,o=0,r,a,i,s;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),u=new Uint8Array(c);for(l=0;l<n;l+=4)r=yr[e.charCodeAt(l)],a=yr[e.charCodeAt(l+1)],i=yr[e.charCodeAt(l+2)],s=yr[e.charCodeAt(l+3)],u[o++]=r<<2|a>>4,u[o++]=(a&15)<<4|i>>2,u[o++]=(i&3)<<6|s&63;return c},Mx=typeof ArrayBuffer=="function",Zh=(e,t)=>{if(typeof e!="string")return{type:"message",data:M2(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Nx(e.substring(1),t)}:Ws[n]?e.length>1?{type:Ws[n],data:e.substring(1)}:{type:Ws[n]}:Sv},Nx=(e,t)=>{if(Mx){const n=xx(e);return M2(n,t)}else return{base64:!0,data:e}},M2=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},N2="",Rx=(e,t)=>{const n=e.length,l=new Array(n);let o=0;e.forEach((r,a)=>{Yh(r,!1,i=>{l[a]=i,++o===n&&t(l.join(N2))})})},zx=(e,t)=>{const n=e.split(N2),l=[];for(let o=0;o<n.length;o++){const r=Zh(n[o],t);if(l.push(r),r.type==="error")break}return l};function Dx(){return new TransformStream({transform(e,t){Vx(e,n=>{const l=n.length;let o;if(l<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,l);else if(l<65536){o=new Uint8Array(3);const r=new DataView(o.buffer);r.setUint8(0,126),r.setUint16(1,l)}else{o=new Uint8Array(9);const r=new DataView(o.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(l))}e.data&&typeof e.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let _p;function Ri(e){return e.reduce((t,n)=>t+n.length,0)}function zi(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let l=0;for(let o=0;o<t;o++)n[o]=e[0][l++],l===e[0].length&&(e.shift(),l=0);return e.length&&l<e[0].length&&(e[0]=e[0].slice(l)),n}function jx(e,t){_p||(_p=new TextDecoder);const n=[];let l=0,o=-1,r=!1;return new TransformStream({transform(a,i){for(n.push(a);;){if(l===0){if(Ri(n)<1)break;const s=zi(n,1);r=(s[0]&128)===128,o=s[0]&127,o<126?l=3:o===126?l=1:l=2}else if(l===1){if(Ri(n)<2)break;const s=zi(n,2);o=new DataView(s.buffer,s.byteOffset,s.length).getUint16(0),l=3}else if(l===2){if(Ri(n)<8)break;const s=zi(n,8),c=new DataView(s.buffer,s.byteOffset,s.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){i.enqueue(Sv);break}o=u*Math.pow(2,32)+c.getUint32(4),l=3}else{if(Ri(n)<o)break;const s=zi(n,o);i.enqueue(Zh(r?s:_p.decode(s),t)),l=0}if(o===0||o>e){i.enqueue(Sv);break}}}})}const R2=4;function Gt(e){if(e)return Fx(e)}function Fx(e){for(var t in Gt.prototype)e[t]=Gt.prototype[t];return e}Gt.prototype.on=Gt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Gt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Gt.prototype.off=Gt.prototype.removeListener=Gt.prototype.removeAllListeners=Gt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var l,o=0;o<n.length;o++)if(l=n[o],l===t||l.fn===t){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Gt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],l=1;l<arguments.length;l++)t[l-1]=arguments[l];if(n){n=n.slice(0);for(var l=0,o=n.length;l<o;++l)n[l].apply(this,t)}return this};Gt.prototype.emitReserved=Gt.prototype.emit;Gt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Gt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const yc=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Qn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hx="arraybuffer";function z2(e,...t){return t.reduce((n,l)=>(e.hasOwnProperty(l)&&(n[l]=e[l]),n),{})}const Wx=Qn.setTimeout,Kx=Qn.clearTimeout;function bc(e,t){t.useNativeTimers?(e.setTimeoutFn=Wx.bind(Qn),e.clearTimeoutFn=Kx.bind(Qn)):(e.setTimeoutFn=Qn.setTimeout.bind(Qn),e.clearTimeoutFn=Qn.clearTimeout.bind(Qn))}const qx=1.33;function Ux(e){return typeof e=="string"?Yx(e):Math.ceil((e.byteLength||e.size)*qx)}function Yx(e){let t=0,n=0;for(let l=0,o=e.length;l<o;l++)t=e.charCodeAt(l),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(l++,n+=4);return n}function D2(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Zx(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Gx(e){let t={},n=e.split("&");for(let l=0,o=n.length;l<o;l++){let r=n[l].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}class Xx extends Error{constructor(t,n,l){super(t),this.description=n,this.context=l,this.type="TransportError"}}class Gh extends Gt{constructor(t){super(),this.writable=!1,bc(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,l){return super.emitReserved("error",new Xx(t,n,l)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Zh(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Zx(t);return n.length?"?"+n:""}}class Jx extends Gh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let l=0;this._polling&&(l++,this.once("pollComplete",function(){--l||n()})),this.writable||(l++,this.once("drain",function(){--l||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};zx(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Rx(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=D2()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let j2=!1;try{j2=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Qx=j2;function eM(){}class tM extends Jx{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let l=location.port;l||(l=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||l!==t.port}}doWrite(t,n){const l=this.request({method:"POST",data:t});l.on("success",n),l.on("error",(o,r)=>{this.onError("xhr post error",o,r)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,l)=>{this.onError("xhr poll error",n,l)}),this.pollXhr=t}}class Vl extends Gt{constructor(t,n,l){super(),this.createRequest=t,bc(this,l),this._opts=l,this._method=l.method||"GET",this._uri=n,this._data=l.data!==void 0?l.data:null,this._create()}_create(){var t;const n=z2(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const l=this._xhr=this.createRequest(n);try{l.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){l.setDisableHeaderCheck&&l.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&l.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{l.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{l.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(l),"withCredentials"in l&&(l.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(l.timeout=this._opts.requestTimeout),l.onreadystatechange=()=>{var o;l.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(l.getResponseHeader("set-cookie"))),l.readyState===4&&(l.status===200||l.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof l.status=="number"?l.status:0)},0))},l.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Vl.requestsCount++,Vl.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=eM,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Vl.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Vl.requestsCount=0;Vl.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Wy);else if(typeof addEventListener=="function"){const e="onpagehide"in Qn?"pagehide":"unload";addEventListener(e,Wy,!1)}}function Wy(){for(let e in Vl.requests)Vl.requests.hasOwnProperty(e)&&Vl.requests[e].abort()}const nM=function(){const e=F2({xdomain:!1});return e&&e.responseType!==null}();class lM extends tM{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=nM&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Vl(F2,this.uri(),t)}}function F2(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Qx))return new XMLHttpRequest}catch{}if(!t)try{return new Qn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const H2=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class oM extends Gh{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,l=H2?{}:z2(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(l.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,l)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const l=t[n],o=n===t.length-1;Yh(l,this.supportsBinary,r=>{try{this.doWrite(l,r)}catch{}o&&yc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=D2()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Tp=Qn.WebSocket||Qn.MozWebSocket;class aM extends oM{createSocket(t,n,l){return H2?new Tp(t,n,l):n?new Tp(t,n):new Tp(t)}doWrite(t,n){this.ws.send(n)}}class rM extends Gh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=jx(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=t.readable.pipeThrough(n).getReader(),o=Dx();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const r=()=>{l.read().then(({done:i,value:s})=>{i||(this.onPacket(s),r())}).catch(i=>{})};r();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const l=t[n],o=n===t.length-1;this._writer.write(l).then(()=>{o&&yc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const iM={websocket:aM,webtransport:rM,polling:lM},sM=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,uM=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Pv(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),l=e.indexOf("]");n!=-1&&l!=-1&&(e=e.substring(0,n)+e.substring(n,l).replace(/:/g,";")+e.substring(l,e.length));let o=sM.exec(e||""),r={},a=14;for(;a--;)r[uM[a]]=o[a]||"";return n!=-1&&l!=-1&&(r.source=t,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=cM(r,r.path),r.queryKey=dM(r,r.query),r}function cM(e,t){const n=/\/{2,9}/g,l=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&l.splice(0,1),t.slice(-1)=="/"&&l.splice(l.length-1,1),l}function dM(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(l,o,r){o&&(n[o]=r)}),n}const Ov=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ks=[];Ov&&addEventListener("offline",()=>{Ks.forEach(e=>e())},!1);class _o extends Gt{constructor(t,n){if(super(),this.binaryType=Hx,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const l=Pv(t);n.hostname=l.host,n.secure=l.protocol==="https"||l.protocol==="wss",n.port=l.port,l.query&&(n.query=l.query)}else n.host&&(n.hostname=Pv(n.host).host);bc(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(l=>{const o=l.prototype.name;this.transports.push(o),this._transportsByName[o]=l}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Gx(this.opts.query)),Ov&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ks.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=R2,n.transport=t,this.id&&(n.sid=this.id);const l=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](l)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&_o.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",_o.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let l=0;l<this.writeBuffer.length;l++){const o=this.writeBuffer[l].data;if(o&&(n+=Ux(o)),l>0&&n>this._maxPayload)return this.writeBuffer.slice(0,l);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,yc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,l){return this._sendPacket("message",t,n,l),this}send(t,n,l){return this._sendPacket("message",t,n,l),this}_sendPacket(t,n,l,o){if(typeof n=="function"&&(o=n,n=void 0),typeof l=="function"&&(o=l,l=null),this.readyState==="closing"||this.readyState==="closed")return;l=l||{},l.compress=l.compress!==!1;const r={type:t,data:n,options:l};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},l=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?l():t()}):this.upgrading?l():t()),this}_onError(t){if(_o.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ov&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const l=Ks.indexOf(this._offlineEventListener);l!==-1&&Ks.splice(l,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}_o.protocol=R2;class fM extends _o{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),l=!1;_o.priorWebsocketSuccess=!1;const o=()=>{l||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!l)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;_o.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{l||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=n.name,this.emitReserved("upgradeError",v)}}))};function r(){l||(l=!0,u(),n.close(),n=null)}const a=f=>{const v=new Error("probe error: "+f);v.transport=n.name,r(),this.emitReserved("upgradeError",v)};function i(){a("transport closed")}function s(){a("socket closed")}function c(f){n&&f.name!==n.name&&r()}const u=()=>{n.removeListener("open",o),n.removeListener("error",a),n.removeListener("close",i),this.off("close",s),this.off("upgrading",c)};n.once("open",o),n.once("error",a),n.once("close",i),this.once("close",s),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{l||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let l=0;l<t.length;l++)~this.transports.indexOf(t[l])&&n.push(t[l]);return n}}let pM=class extends fM{constructor(t,n={}){const l=typeof t=="object"?t:n;(!l.transports||l.transports&&typeof l.transports[0]=="string")&&(l.transports=(l.transports||["polling","websocket","webtransport"]).map(o=>iM[o]).filter(o=>!!o)),super(t,l)}};function vM(e,t="",n){let l=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),l=Pv(e)),l.port||(/^(http|ws)$/.test(l.protocol)?l.port="80":/^(http|ws)s$/.test(l.protocol)&&(l.port="443")),l.path=l.path||"/";const r=l.host.indexOf(":")!==-1?"["+l.host+"]":l.host;return l.id=l.protocol+"://"+r+":"+l.port+t,l.href=l.protocol+"://"+r+(n&&n.port===l.port?"":":"+l.port),l}const hM=typeof ArrayBuffer=="function",mM=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,W2=Object.prototype.toString,gM=typeof Blob=="function"||typeof Blob<"u"&&W2.call(Blob)==="[object BlobConstructor]",yM=typeof File=="function"||typeof File<"u"&&W2.call(File)==="[object FileConstructor]";function Xh(e){return hM&&(e instanceof ArrayBuffer||mM(e))||gM&&e instanceof Blob||yM&&e instanceof File}function qs(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,l=e.length;n<l;n++)if(qs(e[n]))return!0;return!1}if(Xh(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return qs(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&qs(e[n]))return!0;return!1}function bM(e){const t=[],n=e.data,l=e;return l.data=_v(n,t),l.attachments=t.length,{packet:l,buffers:t}}function _v(e,t){if(!e)return e;if(Xh(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let l=0;l<e.length;l++)n[l]=_v(e[l],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const l in e)Object.prototype.hasOwnProperty.call(e,l)&&(n[l]=_v(e[l],t));return n}return e}function CM(e,t){return e.data=Tv(e.data,t),delete e.attachments,e}function Tv(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Tv(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Tv(e[n],t));return e}const kM=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],wM=5;var gt;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(gt||(gt={}));class $M{constructor(t){this.replacer=t}encode(t){return(t.type===gt.EVENT||t.type===gt.ACK)&&qs(t)?this.encodeAsBinary({type:t.type===gt.EVENT?gt.BINARY_EVENT:gt.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===gt.BINARY_EVENT||t.type===gt.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=bM(t),l=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(l),o}}function Ky(e){return Object.prototype.toString.call(e)==="[object Object]"}class Jh extends Gt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const l=n.type===gt.BINARY_EVENT;l||n.type===gt.BINARY_ACK?(n.type=l?gt.EVENT:gt.ACK,this.reconstructor=new SM(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Xh(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const l={type:Number(t.charAt(0))};if(gt[l.type]===void 0)throw new Error("unknown packet type "+l.type);if(l.type===gt.BINARY_EVENT||l.type===gt.BINARY_ACK){const r=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const a=t.substring(r,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");l.attachments=Number(a)}if(t.charAt(n+1)==="/"){const r=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););l.nsp=t.substring(r,n)}else l.nsp="/";const o=t.charAt(n+1);if(o!==""&&Number(o)==o){const r=n+1;for(;++n;){const a=t.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===t.length)break}l.id=Number(t.substring(r,n+1))}if(t.charAt(++n)){const r=this.tryParse(t.substr(n));if(Jh.isPayloadValid(l.type,r))l.data=r;else throw new Error("invalid payload")}return l}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case gt.CONNECT:return Ky(n);case gt.DISCONNECT:return n===void 0;case gt.CONNECT_ERROR:return typeof n=="string"||Ky(n);case gt.EVENT:case gt.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&kM.indexOf(n[0])===-1);case gt.ACK:case gt.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class SM{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=CM(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const PM=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Jh,Encoder:$M,get PacketType(){return gt},protocol:wM},Symbol.toStringTag,{value:"Module"}));function rl(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const OM=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class K2 extends Gt{constructor(t,n,l){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,l&&l.auth&&(this.auth=l.auth),this._opts=Object.assign({},l),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[rl(t,"open",this.onopen.bind(this)),rl(t,"packet",this.onpacket.bind(this)),rl(t,"error",this.onerror.bind(this)),rl(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var l,o,r;if(OM.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const a={type:gt.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,f=n.pop();this._registerAckCallback(u,f),a.id=u}const i=(o=(l=this.io.engine)===null||l===void 0?void 0:l.transport)===null||o===void 0?void 0:o.writable,s=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!i||(s?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(t,n){var l;const o=(l=this.flags.timeout)!==null&&l!==void 0?l:this._opts.ackTimeout;if(o===void 0){this.acks[t]=n;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===t&&this.sendBuffer.splice(i,1);n.call(this,new Error("operation has timed out"))},o),a=(...i)=>{this.io.clearTimeoutFn(r),n.apply(this,i)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((l,o)=>{const r=(a,i)=>a?o(a):l(i);r.withError=!0,n.push(r),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const l={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...r)=>l!==this._queue[0]?void 0:(o!==null?l.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...r)),l.pending=!1,this._drainQueue())),this._queue.push(l),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:gt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(l=>String(l.id)===t)){const l=this.acks[t];delete this.acks[t],l.withError&&l.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case gt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case gt.EVENT:case gt.BINARY_EVENT:this.onevent(t);break;case gt.ACK:case gt.BINARY_ACK:this.onack(t);break;case gt.DISCONNECT:this.ondisconnect();break;case gt.CONNECT_ERROR:this.destroy();const l=new Error(t.data.message);l.data=t.data.data,this.emitReserved("connect_error",l);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const l of n)l.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let l=!1;return function(...o){l||(l=!0,n.packet({type:gt.ACK,id:t,data:o}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:gt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let l=0;l<n.length;l++)if(t===n[l])return n.splice(l,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let l=0;l<n.length;l++)if(t===n[l])return n.splice(l,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const l of n)l.apply(this,t.data)}}}function tr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}tr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};tr.prototype.reset=function(){this.attempts=0};tr.prototype.setMin=function(e){this.ms=e};tr.prototype.setMax=function(e){this.max=e};tr.prototype.setJitter=function(e){this.jitter=e};class Lv extends Gt{constructor(t,n){var l;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,bc(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((l=n.randomizationFactor)!==null&&l!==void 0?l:.5),this.backoff=new tr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const o=n.parser||PM;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new pM(this.uri,this.opts);const n=this.engine,l=this;this._readyState="opening",this.skipReconnect=!1;const o=rl(n,"open",function(){l.onopen(),t&&t()}),r=i=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",i),t?t(i):this.maybeReconnectOnOpen()},a=rl(n,"error",r);if(this._timeout!==!1){const i=this._timeout,s=this.setTimeoutFn(()=>{o(),r(new Error("timeout")),n.close()},i);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(o),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(rl(t,"ping",this.onping.bind(this)),rl(t,"data",this.ondata.bind(this)),rl(t,"error",this.onerror.bind(this)),rl(t,"close",this.onclose.bind(this)),rl(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){yc(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let l=this.nsps[t];return l?this._autoConnect&&!l.active&&l.connect():(l=new K2(this,t,n),this.nsps[t]=l),l}_destroy(t){const n=Object.keys(this.nsps);for(const l of n)if(this.nsps[l].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let l=0;l<n.length;l++)this.engine.write(n[l],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var l;this.cleanup(),(l=this.engine)===null||l===void 0||l.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const l=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},n);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const fr={};function Us(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=vM(e,t.path||"/socket.io"),l=n.source,o=n.id,r=n.path,a=fr[o]&&r in fr[o].nsps,i=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let s;return i?s=new Lv(l,t):(fr[o]||(fr[o]=new Lv(l,t)),s=fr[o]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(Us,{Manager:Lv,Socket:K2,io:Us,connect:Us});const _M=typeof window<"u",TM=_M&&(new URLSearchParams(window.location.search).get("debug")==="1"||window.localStorage.getItem("CCDEBUG_DEBUG")==="1"),Kl=(...e)=>{TM&&console.log(...e)},hi=x4("timeline",()=>{const e=x(null),t=x([]),n=x(null),l=x([]),o=x(null),r=x(null),a=x(!1),i=x(null),s=x(null),c=x([]),u=x(null),f=x(!1),v=x(""),h=x([]),m=x(!1),y=x(new Set),g=p(()=>o.value?o.value:null),b=p(()=>r.value?r.value:null),w=p(()=>{var O;return((O=s.value)==null?void 0:O.connected)||!1}),k=async(O=!1)=>{var T;a.value=!0,i.value=null;try{const W=await wt.get("/api/project/info");W.data.success&&W.data.data&&(e.value=W.data.data);const ee=new URLSearchParams(window.location.search),B=ee.get("sessionid"),oe=ee.get("file"),se=ee.get("step"),me=ee.get("project");if(me&&!O){const he=decodeURIComponent(me);if(Kl("检测到URL项目路径参数:",he),((T=e.value)==null?void 0:T.projectDir)!==he)try{await Y(he);return}catch(G){console.warn("切换到指定项目失败:",G)}}if(oe){await X();const he=c.value.find(G=>G.id===oe);if(he)await Z(he);else{let G=null;for(const U of c.value){const q=`/api/files?mainLogId=${encodeURIComponent(U.id)}`;try{const J=await wt.get(q);if(J.data.success&&J.data.data){const ie=J.data.data.files;if(ie.some(fe=>fe.id===oe)){G=U,t.value=ie;break}}}catch(J){console.error(`获取主日志 ${U.id} 的文件列表失败:`,J)}}if(G)u.value=G,await $(oe);else{const U=await wt.get("/api/files");U.data.success&&U.data.data&&(t.value=U.data.data.files),await $(oe)}}if(o.value&&se){const G=o.value.steps.find(U=>U.id===se);G&&(r.value=G,setTimeout(()=>{te(se),_(se)},300))}}else if(B){const he=`/api/files?sessionId=${encodeURIComponent(B)}`,G=await wt.get(he);if(G.data.success&&G.data.data){const{files:U}=G.data.data;t.value=U,U.length===1&&(Kl(`找到唯一匹配sessionId ${B} 的文件,自动加载: ${U[0].id}`),await $(U[0].id))}}else await X(),c.value.length>0&&await Z(c.value[0]);I()}catch(W){console.error("初始化失败:",W),i.value="初始化失败,请检查服务器连接"}finally{a.value=!1}},$=async O=>{if(!(n.value===O&&o.value!==null)){a.value=!0,i.value=null,o.value=null,r.value=null,l.value=[];try{const T=await wt.get(`/api/conversations/${O}`);if(T.data.success&&T.data.data)l.value=[T.data.data],n.value=O,o.value=T.data.data,T.data.data.steps&&T.data.data.steps.length>0?r.value=T.data.data.steps[0]:r.value=null;else throw n.value=O,new Error(T.data.error||"加载文件失败")}catch(T){console.error("加载文件失败:",T),i.value="加载文件失败,请重试",o.value=null,r.value=null,l.value=[]}finally{a.value=!1}}},S=O=>{o.value=O,O.steps.length>0?r.value=O.steps[0]:r.value=null},P=O=>{r.value=O,O&&_(O.id)},_=O=>{setTimeout(()=>{const T=document.querySelector(`[data-step-id="${O}"]`);T&&T.scrollIntoView({behavior:"smooth",block:"center"})},100)},I=()=>{s.value&&s.value.disconnect();const T=`http://localhost:${window.location.port||"3003"}`;s.value=Us(T,{transports:["websocket","polling"]}),s.value.on("connect",()=>{Kl("WebSocket连接成功")}),s.value.on("disconnect",()=>{Kl("WebSocket连接断开")}),s.value.on("file:updated",async W=>{if(Kl("文件更新:",W),W.data.files&&(t.value=W.data.files),n.value&&W.data.fileId===n.value)if(W.data.conversations)if(l.value=W.data.conversations,o.value){const ee=W.data.conversations.find(B=>{var oe;return B.id===((oe=o.value)==null?void 0:oe.id)});if(ee){if(o.value=ee,r.value){const B=typeof r.value=="string"?r.value:r.value.id,oe=ee.steps.find(se=>se.id===B);oe?r.value=oe:r.value=ee.steps[ee.steps.length-1]||null}}else W.data.conversations.length>0?S(W.data.conversations[0]):(o.value=null,r.value=null)}else W.data.conversations.length>0&&S(W.data.conversations[0]);else await $(n.value)}),s.value.on("project:changed",W=>{Kl("项目变更:",W),k(!0)})},D=async()=>{try{const T=new URLSearchParams(window.location.search).get("sessionid"),W=T?`/api/files?sessionId=${encodeURIComponent(T)}`:"/api/files",ee=await wt.get(W);ee.data.success&&ee.data.data&&(t.value=ee.data.data.files)}catch(O){console.error("刷新文件列表失败:",O),i.value="刷新文件列表失败"}},H=()=>{i.value=null},N=()=>{s.value&&(s.value.disconnect(),s.value=null)},X=async()=>{f.value=!0,i.value=null;try{const O=await wt.get("/api/main-logs");if(O.data.success&&O.data.data)c.value=O.data.data.mainLogs,Kl(`获取到 ${c.value.length} 个主日志`);else throw new Error(O.data.error||"获取主日志列表失败")}catch(O){console.error("获取主日志列表失败:",O),i.value="获取主日志列表失败,请重试"}finally{f.value=!1}},Z=async O=>{u.value=O,a.value=!0,i.value=null;try{const T=`/api/files?mainLogId=${encodeURIComponent(O.id)}`,W=await wt.get(T);if(W.data.success&&W.data.data)t.value=W.data.data.files,Kl(`选中主日志 ${O.id},共 ${t.value.length} 个文件`),t.value.length>0&&await $(O.id);else throw new Error(W.data.error||"获取文件列表失败")}catch(T){console.error("选择主日志失败:",T),i.value="选择主日志失败,请重试"}finally{a.value=!1}},z=async()=>{try{const O=await wt.get("/api/projects");if(O.data.success&&O.data.data)return Kl(`获取到 ${O.data.data.projects.length} 个可用项目`),O.data.data.projects;throw new Error(O.data.error||"获取项目列表失败")}catch(O){throw console.error("获取项目列表失败:",O),i.value="获取项目列表失败,请重试",O}},Y=async O=>{a.value=!0,i.value=null;try{const T=await wt.post("/api/project/switch",{projectPath:O});if(T.data.success&&T.data.data)console.log(`项目已切换到: ${T.data.data.projectDir}`),console.log(`日志目录: ${T.data.data.logDir}`),n.value=null,o.value=null,r.value=null,l.value=[],t.value=[],c.value=[],u.value=null,await k(!0);else throw new Error(T.data.error||"切换项目失败")}catch(T){throw console.error("切换项目失败:",T),i.value="切换项目失败,请重试",T}finally{a.value=!1}},F=async O=>{if(!O.trim())return[];m.value=!0,v.value=O;const T=[];try{const W=[];if(u.value)W.push({fileId:u.value.id,fileName:u.value.name,isSubAgent:!1}),u.value.agentLogs&&u.value.agentLogs.length>0&&u.value.agentLogs.forEach(ee=>{W.push({fileId:ee.id,fileName:ee.agentName||ee.name,isSubAgent:!0})});else if(n.value){const ee=t.value.find(B=>B.id===n.value);ee&&W.push({fileId:ee.id,fileName:ee.name,isSubAgent:!1})}for(const ee of W){const B=await V(ee.fileId,ee.fileName,ee.isSubAgent,O);B.resultCount>0&&T.push(B)}return h.value=T,T}catch(W){throw console.error("搜索失败:",W),W}finally{m.value=!1}},V=async(O,T,W,ee)=>{const B={fileId:O,fileName:T,isSubAgent:W,resultCount:0,results:[]};try{const oe=await wt.get(`/api/conversations/${O}`);if(!oe.data.success||!oe.data.data)return B;const se=oe.data.data,me=ee.toLowerCase().split(/\s+/).filter(he=>he.length>0);return se.steps.forEach((he,G)=>{const U=R(he,me,O,T);B.results.push(...U)}),B.resultCount=B.results.length,B}catch(oe){return console.error(`搜索文件 ${O} 失败:`,oe),B}},R=(O,T,W,ee)=>{const B=[];if(O.content){const oe=O.content.toLowerCase();if(T.every(se=>oe.includes(se))){const se=j(O.content,T[0]);B.push({stepId:O.id,stepType:O.type,stepIndex:O.originalIndex||0,timestamp:O.timestamp,matchedContent:se,matchedField:"content",fileId:W,fileName:ee,tool_use_id:O.tool_use_id})}}return B},j=(O,T)=>{const W=O.toLowerCase(),ee=T.toLowerCase(),B=W.indexOf(ee);if(B===-1)return O.substring(0,100)+(O.length>100?"...":"");const oe=Math.max(0,B-50),se=Math.min(O.length,B+T.length+50);let me=O.substring(oe,se);return oe>0&&(me="..."+me),se<O.length&&(me=me+"..."),me},M=O=>{y.value.has(O)?y.value.delete(O):y.value.add(O)},K=O=>y.value.has(O),te=O=>{y.value.has(O)||y.value.add(O)};return{currentProject:e,availableFiles:t,currentFileId:n,conversations:l,currentConversation:o,selectedStep:r,loading:a,error:i,mainLogs:c,selectedMainLog:u,mainLogsLoading:f,searchKeyword:v,searchResults:h,searchLoading:m,expandedSteps:y,currentConversationData:g,currentStepData:b,isConnected:w,initialize:k,loadFile:$,selectConversation:S,selectStep:P,scrollToStep:_,refreshFiles:D,clearError:H,disconnect:N,fetchMainLogs:X,selectMainLog:Z,fetchAvailableProjects:z,switchProject:Y,performSearch:F,toggleExpanded:M,isExpanded:K,ensureStepExpanded:te}}),LM=Q({name:"IconShareAlt",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:t}){const n=ae("icon"),l=p(()=>[n,`${n}-share-alt`,{[`${n}-spin`]:e.spin}]),o=p(()=>{const a={};return e.size&&(a.fontSize=Le(e.size)?`${e.size}px`:e.size),e.rotate&&(a.transform=`rotate(${e.rotate}deg)`),a});return{cls:l,innerStyle:o,onClick:a=>{t("click",a)}}}}),EM=["stroke-width","stroke-linecap","stroke-linejoin"];function IM(e,t,n,l,o,r){return C(),E("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:L(e.cls),style:Ee(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:t[0]||(t[0]=(...a)=>e.onClick&&e.onClick(...a))},t[1]||(t[1]=[A("path",{d:"M32.442 21.552a4.5 4.5 0 1 1 .065 4.025m-.065-4.025-16.884-8.104m16.884 8.104A4.483 4.483 0 0 0 32 23.5c0 .75.183 1.455.507 2.077m-16.95-12.13a4.5 4.5 0 1 1-8.113-3.895 4.5 4.5 0 0 1 8.114 3.896Zm-.064 20.977A4.5 4.5 0 1 0 11.5 41c3.334-.001 5.503-3.68 3.993-6.578Zm0 0 17.014-8.847"},null,-1)]),14,EM)}var Lp=ve(LM,[["render",IM]]);const BM=Object.assign(Lp,{install:(e,t)=>{var n;const l=(n=t==null?void 0:t.iconPrefix)!=null?n:"";e.component(l+Lp.name,Lp)}}),AM=Q({name:"IconBug",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:t}){const n=ae("icon"),l=p(()=>[n,`${n}-bug`,{[`${n}-spin`]:e.spin}]),o=p(()=>{const a={};return e.size&&(a.fontSize=Le(e.size)?`${e.size}px`:e.size),e.rotate&&(a.transform=`rotate(${e.rotate}deg)`),a});return{cls:l,innerStyle:o,onClick:a=>{t("click",a)}}}}),VM=["stroke-width","stroke-linecap","stroke-linejoin"];function xM(e,t,n,l,o,r){return C(),E("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:L(e.cls),style:Ee(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:t[0]||(t[0]=(...a)=>e.onClick&&e.onClick(...a))},t[1]||(t[1]=[A("path",{d:"M24 42c-6.075 0-11-4.925-11-11V18h22v13c0 6.075-4.925 11-11 11Zm0 0V23m11 4h8M5 27h8M7 14a4 4 0 0 0 4 4h26a4 4 0 0 0 4-4m0 28v-.5a6.5 6.5 0 0 0-6.5-6.5M7 42v-.5a6.5 6.5 0 0 1 6.5-6.5M17 14a7 7 0 1 1 14 0"},null,-1)]),14,VM)}var Ep=ve(AM,[["render",xM]]);const MM=Object.assign(Ep,{install:(e,t)=>{var n;const l=(n=t==null?void 0:t.iconPrefix)!=null?n:"";e.component(l+Ep.name,Ep)}}),NM={class:"main-log-dialog"},RM={class:"file-name-cell"},zM={class:"file-id"},DM={class:"preview-text"},jM=Q({__name:"MainLogSelectDialog",props:{visible:{type:Boolean,default:!1},mainLogs:{default:()=>[]},loading:{type:Boolean,default:!1}},emits:["update:visible","select"],setup(e,{emit:t}){const n=e,l=t,o=p({get:()=>n.visible,set:m=>l("update:visible",m)}),r=x(null),a=x([]),i=[{title:"文件名",dataIndex:"name",slotName:"fileName",width:240,ellipsis:!0},{title:"开始时间",dataIndex:"startTime",slotName:"startTime",width:200},{title:"结束时间",dataIndex:"endTime",slotName:"endTime",width:200},{title:"输入消息",dataIndex:"inputPreview",slotName:"inputPreview",ellipsis:!0},{title:"子Agent数",dataIndex:"agentCount",slotName:"agentCount",width:120,align:"center"}],s={type:"radio"};Ie(a,m=>{if(m.length>0){const y=n.mainLogs.find(g=>g.id===m[0]);y&&(r.value=y)}});const c=m=>{if(!m)return"";const y=new Date(m),g=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),w=String(y.getDate()).padStart(2,"0"),k=String(y.getHours()).padStart(2,"0"),$=String(y.getMinutes()).padStart(2,"0"),S=String(y.getSeconds()).padStart(2,"0");return`${g}/${b}/${w} ${k}:${$}:${S}`},u=m=>{a.value=[m.id],r.value=m},f=()=>{r.value&&(l("select",r.value),o.value=!1,h())},v=()=>{o.value=!1,h()},h=()=>{r.value=null,a.value=[]};return Ie(o,m=>{m||h()}),(m,y)=>{const g=ne("a-tooltip"),b=ne("a-tag"),w=ne("a-table"),k=ne("a-modal");return C(),ce(k,{visible:o.value,"onUpdate:visible":y[1]||(y[1]=$=>o.value=$),title:"选择会话日志",width:"1020px","mask-closable":!1,onOk:f,onCancel:v},{default:ue(()=>[A("div",NM,[d(w,{columns:i,data:n.mainLogs,loading:n.loading,pagination:!1,scroll:{y:400},"row-key":"id","row-selection":s,"selected-keys":a.value,"onUpdate:selectedKeys":y[0]||(y[0]=$=>a.value=$),onRowClick:u},{fileName:ue(({record:$})=>[A("div",RM,[A("span",zM,we($.id),1)])]),startTime:ue(({record:$})=>[A("span",null,we(c($.startTime)),1)]),endTime:ue(({record:$})=>[A("span",null,we(c($.endTime)),1)]),inputPreview:ue(({record:$})=>[d(g,{content:$.inputFull,position:"top"},{default:ue(()=>[A("span",DM,we($.inputPreview),1)]),_:2},1032,["content"])]),agentCount:ue(({record:$})=>[d(b,{color:"blue"},{default:ue(()=>[ze(we($.agentLogs.length),1)]),_:2},1024)]),_:1},8,["data","loading","selected-keys"])])]),_:1},8,["visible"])}}}),xo=(e,t)=>{const n=e.__vccOpts||e;for(const[l,o]of t)n[l]=o;return n},FM=xo(jM,[["__scopeId","data-v-533a9e6f"]]),HM={class:"project-select-dialog"},WM={class:"search-container"},KM={class:"project-name-cell"},qM={class:"project-name"},UM={class:"path-text"},YM=Q({__name:"ProjectSelectDialog",props:{visible:{type:Boolean,default:!1},projects:{default:()=>[]},currentProject:{},loading:{type:Boolean,default:!1}},emits:["update:visible","select"],setup(e,{emit:t}){const n=e,l=t,o=x(""),r=p(()=>{if(!o.value.trim())return n.projects;const b=o.value.toLowerCase();return n.projects.filter(w=>w.name.toLowerCase().includes(b)||w.path.toLowerCase().includes(b))}),a=p({get:()=>n.visible,set:b=>l("update:visible",b)}),i=x(null),s=x([]),c=[{title:"项目名称",dataIndex:"name",slotName:"projectName",width:300},{title:"项目路径",dataIndex:"path",slotName:"projectPath"}],u={type:"radio"};Ie(s,b=>{if(b.length>0){const w=r.value.find(k=>k.path===b[0]);w&&(i.value=w)}});const f=b=>{o.value=b},v=()=>{o.value=""},h=b=>{s.value=[b.path],i.value=b},m=()=>{i.value&&(l("select",i.value.path),a.value=!1,g())},y=()=>{a.value=!1,g()},g=()=>{i.value=null,s.value=[]};return Ie(a,b=>{if(b&&n.currentProject){const w=r.value.find(k=>k.path===n.currentProject);w&&(s.value=[w.path],i.value=w)}else b||(g(),o.value="")}),(b,w)=>{const k=ne("a-input-search"),$=ne("a-alert"),S=ne("a-tag"),P=ne("a-table"),_=ne("a-modal");return C(),ce(_,{visible:a.value,"onUpdate:visible":w[2]||(w[2]=I=>a.value=I),title:"选择项目",width:"1200px","mask-closable":!1,onOk:m,onCancel:y},{default:ue(()=>[A("div",HM,[A("div",WM,[d(k,{modelValue:o.value,"onUpdate:modelValue":w[0]||(w[0]=I=>o.value=I),placeholder:"请输入项目名称进行搜索","allow-clear":"",onClear:v,onSearch:f,style:{"margin-bottom":"16px"}},null,8,["modelValue"])]),!n.loading&&r.value.length===0?(C(),ce($,{key:0,type:"warning",style:{"margin-bottom":"16px"}},{default:ue(()=>[ze(we(o.value?"未找到匹配的项目":"未找到可用项目")+"。请确认用户主目录下存在 ",1),w[3]||(w[3]=A("code",null,"~/.claude/projects",-1)),w[4]||(w[4]=ze(" 目录。 ",-1))]),_:1})):le("",!0),d(P,{columns:c,data:r.value,loading:n.loading,pagination:!1,scroll:{y:500},"row-key":"path","row-selection":u,"selected-keys":s.value,"onUpdate:selectedKeys":w[1]||(w[1]=I=>s.value=I),onRowClick:h},{projectName:ue(({record:I})=>[A("div",KM,[A("span",qM,we(I.name),1),I.isDefault?(C(),ce(S,{key:0,color:"blue",size:"small",style:{"margin-left":"8px"}},{default:ue(()=>[...w[5]||(w[5]=[ze(" 当前项目 ",-1)])]),_:1})):le("",!0)])]),projectPath:ue(({record:I})=>[A("span",UM,we(I.path),1)]),_:1},8,["data","loading","selected-keys"])])]),_:1},8,["visible"])}}}),ZM=xo(YM,[["__scopeId","data-v-a8fb4722"]]),qy=e=>({user_message:"#1890ff",assistant_thinking:"#faad14",assistant_message:"#52c41a",tool_call:"#722ed1",tool_result:"#13c2c2",agent_child:"#eb2f96",agent_end:"#eb2f96",sub_agent:"#eb2f96"})[e]||"#d9d9d9",GM=e=>({user_message:"#e6f7ff",assistant_thinking:"#fff7e6",assistant_message:"#f6ffed",tool_call:"#f9f0ff",tool_result:"#e6fffb",agent_child:"#fff0f6",agent_end:"#fff0f6",sub_agent:"#fff0f6"})[e]||"#f5f5f5",XM={class:"file-selector"},JM={class:"info-item"},QM={class:"value"},eN={class:"info-item"},tN={class:"value"},nN={class:"file-selector-content"},lN={class:"file-option"},oN={class:"file-name"},aN={class:"step-count"},rN={key:0,class:"no-files"},iN={key:0},sN={class:"detail-item"},uN={class:"value"},cN={class:"detail-item"},dN={class:"value"},fN={class:"detail-item"},pN={class:"value"},vN={class:"step-type-filter"},hN={class:"filter-actions"},mN={class:"steps-chart"},gN=["title","onClick"],yN={class:"step-index"},bN={key:0,class:"filter-stats"},CN={key:1,class:"file-hint"},kN=Q({__name:"ProjectPanel",setup(e){const t=(()=>{try{return new URLSearchParams(window.location.search).get("debug")==="1"||window.localStorage.getItem("CCDEBUG_DEBUG")==="1"}catch{return!1}})(),n=(...O)=>{t&&console.log(...O)},l=hi(),o=p(()=>l.currentProject),r=p(()=>l.availableFiles),a=p(()=>l.currentFileId),i=p(()=>l.conversations),s=p(()=>l.currentConversation),c=p(()=>l.selectedStep),u=p(()=>l.loading);p(()=>l.isConnected);const f=p(()=>l.mainLogs),v=p(()=>l.mainLogsLoading),h=x(null),m=x(null),y=x(!1),g=x(!1),b=x([]),w=x(!1),k=[{value:"user_message",label:"用户消息",color:"#1890ff"},{value:"assistant_thinking",label:"助手思考",color:"#faad14"},{value:"assistant_message",label:"助手消息",color:"#52c41a"},{value:"tool_call",label:"工具调用",color:"#722ed1"},{value:"sub_agent",label:"子代理",color:"#eb2f96"}],$=x(["user_message","assistant_thinking","assistant_message","tool_call","sub_agent"]),S=x([]),P=p(()=>{var T;if(!((T=s.value)!=null&&T.steps))return[];const O=new Set;return s.value.steps.forEach(W=>{W.type==="tool_call"&&W.tool_name&&O.add(W.tool_name)}),Array.from(O).sort()});Ie([()=>k,P],([O,T])=>{if(O.length>0&&S.value.length===0){const W=O.map(B=>B.value),ee=T.map(B=>`tool:${B}`);S.value=[...W,...ee]}},{immediate:!0});const _=p(()=>k.map(O=>O.value==="tool_call"?{key:O.value,title:O.label,children:P.value.map(T=>({key:`tool:${T}`,title:T}))}:{key:O.value,title:O.label})),I=p(()=>{var O;return(O=s.value)!=null&&O.steps?s.value.steps.filter(T=>{const W=T.type==="agent_child"||T.type==="agent_end"?"sub_agent":T.type;if(W==="tool_call"){const ee=S.value.filter(B=>B.startsWith("tool:")).map(B=>B.substring(5));return ee.length>0?(n("过滤工具调用:",{stepToolName:T.tool_name,selectedTools:ee,match:ee.includes(T.tool_name||"")}),ee.includes(T.tool_name||"")):S.value.includes("tool_call")}return S.value.includes(W)}):[]}),D=()=>{const O=k.map(W=>W.value),T=P.value.map(W=>`tool:${W}`);S.value=[...O,...T]},H=()=>{S.value=[]};Ie(S,O=>{$.value=O.filter(T=>!T.startsWith("tool:"))},{immediate:!0}),Ie(a,O=>{n("🔍 调试测试: currentFileId变化",{newFileId:O,oldSelectedFileId:h.value}),h.value=O},{immediate:!0});const N=O=>{n("🔍 调试测试: 文件切换",{fileId:O,currentFileId:a.value}),h.value=O,O!==a.value&&l.loadFile(O)},X=O=>{l.selectStep(O),Z(O.id)},Z=O=>{setTimeout(()=>{const T=document.querySelector(`[data-step-id="${O}"]`);T&&T.scrollIntoView({behavior:"smooth",block:"center"})},100)},z=O=>new Date(O).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"}),Y=O=>new Date(O).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),F=()=>{var ee;if(!h.value)return"";let O=r.value.find(B=>B.id===h.value);if(!O)for(const B of f.value){const oe=(ee=B.agentLogs)==null?void 0:ee.find(se=>se.id===h.value);if(oe){O=oe;break}}if(O)return V(O);const T=h.value,W=T.lastIndexOf(".");return W>-1?T.substring(0,W):T},V=O=>{if(O.agentName)return O.agentName;const T=O.name,W=T.lastIndexOf(".");return W>-1?T.substring(0,W):T},R=O=>{if(O.stepCount!==void 0)return O.stepCount;const T=i.value.find(W=>W.id===O.id);return T!=null&&T.steps?T.steps.filter(W=>W.type!=="tool_result").length:0},j=async()=>{await l.fetchMainLogs(),y.value=!0},M=async O=>{n("📋 选择主日志:",O),await l.selectMainLog(O)},K=async()=>{w.value=!0;try{b.value=await l.fetchAvailableProjects()}catch(O){console.error("获取项目列表失败:",O)}finally{w.value=!1}g.value=!0},te=async O=>{n("📁 选择项目:",O);try{await l.switchProject(O),g.value=!1}catch(T){console.error("切换项目失败:",T)}};return lt(()=>{const T=new URLSearchParams(window.location.search).get("sessionid");T&&(m.value=T)}),(O,T)=>{var ee,B;const W=ne("a-alert");return C(),E("div",XM,[d(ct(hr),{title:"项目信息",bordered:!1,size:"small",class:"file-card"},{extra:ue(()=>[d(ct(qt),{type:"primary",size:"small",onClick:K,loading:w.value},{default:ue(()=>[...T[4]||(T[4]=[ze(" 选择项目 ",-1)])]),_:1},8,["loading"])]),default:ue(()=>{var oe,se;return[A("div",JM,[T[5]||(T[5]=A("span",{class:"label"},"项目路径:",-1)),A("span",QM,we(((oe=o.value)==null?void 0:oe.path)||"未知"),1)]),A("div",eN,[T[6]||(T[6]=A("span",{class:"label"},"日志目录:",-1)),A("span",tN,we(((se=o.value)==null?void 0:se.logDir)||"未知"),1)])]}),_:1}),d(ct(hr),{title:"日志文件",bordered:!1,size:"small",class:"file-card"},{extra:ue(()=>[d(ct(qt),{type:"primary",size:"small",onClick:j,loading:v.value},{default:ue(()=>[...T[7]||(T[7]=[ze(" 选择会话 ",-1)])]),_:1},8,["loading"])]),default:ue(()=>[A("div",nN,[d(ct(za),{modelValue:h.value,"onUpdate:modelValue":T[0]||(T[0]=oe=>h.value=oe),placeholder:"请选择日志文件",loading:u.value,disabled:r.value.length===0,onChange:N,class:"file-select","popup-container":".file-selector","popup-props":{class:"custom-select-popup"}},{default:ue(()=>[(C(!0),E(Ve,null,Ct(r.value,oe=>(C(),ce(ct(Po),{key:oe.id,value:oe.id,label:V(oe)},{default:ue(()=>[A("div",lN,[A("div",oN,[ze(we(V(oe)),1),A("span",aN,"("+we(R(oe))+"步)",1)])])]),_:2},1032,["value","label"]))),128))]),_:1},8,["modelValue","loading","disabled"]),r.value.length===0&&!u.value?(C(),E("div",rN,[d(ct(Rl),{description:"未找到日志文件"})])):le("",!0)])]),_:1}),d(FM,{visible:y.value,"onUpdate:visible":T[1]||(T[1]=oe=>y.value=oe),"main-logs":f.value,loading:v.value,onSelect:M},null,8,["visible","main-logs","loading"]),d(ZM,{visible:g.value,"onUpdate:visible":T[2]||(T[2]=oe=>g.value=oe),projects:b.value,"current-project":(ee=o.value)==null?void 0:ee.path,loading:w.value,onSelect:te},null,8,["visible","projects","current-project","loading"]),h.value?(C(),E("div",iN,[d(ct(hr),{title:"日志信息",bordered:!1,size:"small",class:"file-card"},{default:ue(()=>{var oe,se;return[A("div",sN,[T[8]||(T[8]=A("span",{class:"label"},"文件名:",-1)),A("span",uN,we(F()),1)]),A("div",cN,[T[9]||(T[9]=A("span",{class:"label"},"开始时间:",-1)),A("span",dN,we((oe=s.value)!=null&&oe.timestamp?Y(s.value.timestamp):"-"),1)]),A("div",fN,[T[10]||(T[10]=A("span",{class:"label"},"步骤数量:",-1)),A("span",pN,we((se=s.value)!=null&&se.steps?s.value.steps.filter(me=>me.type!=="tool_result").length:0),1)])]}),_:1}),(B=s.value)!=null&&B.steps&&s.value.steps.length>0?(C(),ce(ct(hr),{key:0,title:"步骤概览",bordered:!1,class:"file-card",size:"small"},{extra:ue(()=>[d(ct(Ju),{trigger:"click",position:"bottom"},{content:ue(()=>[A("div",vN,[T[13]||(T[13]=A("div",{class:"filter-header"},"选择要显示的节点类型",-1)),d(ct(ku),{"checked-keys":S.value,"onUpdate:checkedKeys":T[3]||(T[3]=oe=>S.value=oe),data:_.value,checkable:!0,"default-expand-all":!0,"show-line":!1,size:"mini","block-node":!0},{icon:ue(({node:oe})=>{var se;return[A("div",{class:"tree-node-color",style:Ee({backgroundColor:oe.key.startsWith("tool:")?"#722ed1":(se=k.find(me=>me.value===oe.key))==null?void 0:se.color})},null,4)]}),_:1},8,["checked-keys","data"]),A("div",hN,[d(ct(qt),{size:"mini",onClick:D},{default:ue(()=>[...T[11]||(T[11]=[ze(" 全选 ",-1)])]),_:1}),d(ct(qt),{size:"mini",onClick:H},{default:ue(()=>[...T[12]||(T[12]=[ze(" 清空 ",-1)])]),_:1})])])]),default:ue(()=>[d(ct(qt),{type:"text",size:"small"},{icon:ue(()=>[d(ct(MC))]),default:ue(()=>[ze(" 过滤 ("+we(I.value.length)+") ",1)]),_:1})]),_:1})]),default:ue(()=>[A("div",mN,[(C(!0),E(Ve,null,Ct(I.value,(oe,se)=>{var me;return C(),E("div",{key:oe.id,class:L(["step-bar",{selected:((me=c.value)==null?void 0:me.id)===oe.id}]),style:Ee({backgroundColor:ct(GM)(oe.type),borderColor:ct(qy)(oe.type),color:ct(qy)(oe.type)}),title:`${oe.type} - ${z(oe.timestamp)}`,onClick:he=>X(oe)},[A("span",yN,we(oe.originalIndex),1)],14,gN)}),128))]),s.value?(C(),E("div",bN," 显示 "+we(I.value.length)+" / "+we(s.value.steps.filter(oe=>oe.type!=="tool_result").length)+" 个步骤 ",1)):le("",!0)]),_:1})):le("",!0)])):(C(),E("div",CN,[d(W,null,{default:ue(()=>[...T[14]||(T[14]=[ze("选择一个日志文件以查看对话时间线和详细信息",-1)])]),_:1})]))])}}}),wN=xo(kN,[["__scopeId","data-v-957cb932"]]),$N={class:"timeline-container"},SN={key:0,class:"loading"},PN={key:1,class:"timeline-content"},ON={key:0,class:"empty-state"},_N={key:1,class:"timeline-wrapper"},TN={class:"timeline-title"},LN={class:"timeline-main"},EN=["onClick"],IN={key:0,class:"timeline-time"},BN={class:"timeline-connector"},AN=["title"],VN={class:"step-number"},xN={key:0,class:"timeline-line"},MN=["data-step-id"],NN=["onClick"],RN={class:"header-left"},zN={class:"tag-duration-group"},DN={class:"step-type-tag"},jN={class:"summary-text"},FN={key:0,class:"tool-name-highlight"},HN={key:1,class:"subagent-type-highlight"},WN={key:2,class:"tool-specific-info"},KN={key:3,class:"subagent-prompt"},qN={class:"tag-duration-group"},UN=["title"],YN={key:0,class:"header-info"},ZN={key:0,class:"tool-name-header"},GN={key:1,class:"subagent-name-header"},XN=["onClick"],JN={key:0,class:"user-query-content"},QN=["innerHTML"],eR={key:1,class:"agent-thinking-content"},tR=["innerHTML"],nR={key:2,class:"agent-message-content"},lR=["innerHTML"],oR={key:3,class:"tool-use-content"},aR={key:0,class:"tool-details-expanded"},rR={class:"tool-header"},iR={class:"tool-name"},sR={class:"tool-parameters"},uR=["innerHTML"],cR={key:0,class:"tool-result-container"},dR={class:"tool-result-card"},fR={class:"result-content"},pR=["innerHTML"],vR={key:4,class:"sub-agent-content"},hR={key:0,class:"sub-agent-details-expanded"},mR={class:"sub-agent-header"},gR=["onClick","title"],yR={key:1,class:"sub-agent-type-text"},bR={class:"sub-agent-parameters"},CR=["innerHTML"],kR={key:0,class:"tool-result-container"},wR={class:"tool-result-card"},$R={class:"result-content"},SR=["innerHTML"],PR={key:5,class:"default-content"},OR=["innerHTML"],_R=Q({components:{ATooltip:qn},__name:"Timeline",setup(e,{expose:t}){const n=(()=>{var O;if(typeof window<"u")try{return new URL(window.location.href).searchParams.get("debug")==="1"||((O=window.localStorage)==null?void 0:O.getItem("CCDEBUG_DEBUG"))==="1"}catch{return!1}return!1})(),l=(...O)=>{n&&console.log(...O)},o=(...O)=>{n&&console.warn(...O)},r=hi(),a=p(()=>r.loading);p(()=>r.conversations);const i=p(()=>r.currentConversation),s=p(()=>r.selectedStep),c=p(()=>r.searchKeyword),u=p(()=>{var ee;if(!((ee=i.value)!=null&&ee.steps))return[];const O=i.value.steps;l("🔍 processedSteps - 原始步骤数量:",O.length);const T=new Map;O.forEach(B=>{(B.type==="tool_call"||B.type==="agent_child")&&(l("🔧 找到工具/子代理步骤:",{id:B.id,tool_use_id:B.tool_use_id,tool_name:B.tool_name,type:B.type}),B.tool_use_id?T.set(B.tool_use_id,{...B}):(o("⚠️ 工具/子代理步骤缺少tool_use_id,使用步骤id作为fallback:",B.id),T.set(B.id,{...B})))}),l("🗺️ toolUseMap大小:",T.size),O.forEach(B=>{if(B.type==="tool_result"){l("📊 找到tool_result步骤:",{id:B.id,tool_use_id:B.tool_use_id});let oe=null;if(B.tool_use_id&&(oe=T.get(B.tool_use_id)),!oe){const se=O.indexOf(B);for(let me=se-1;me>=0;me--){const he=O[me];if(he.type==="tool_call"){const G=he.tool_use_id||he.id;if(oe=T.get(G),oe){l("🔗 通过位置关系关联tool_result到tool_call:",{toolResultId:B.id,toolCallId:he.id});break}}}}oe?(oe.toolResult=B,l("✅ 成功关联tool_result到tool_call")):o("⚠️ 无法找到对应的tool_call步骤")}});const W=[];return O.forEach(B=>{if(B.type==="tool_call"||B.type==="agent_child"){const oe=B.tool_use_id||B.id,se=T.get(oe);se?(W.push(se),l("📝 添加工具/子代理步骤:",{id:se.id,type:se.type,hasToolResult:!!se.toolResult})):(W.push(B),l("📝 添加原始工具/子代理步骤:",{id:B.id,type:B.type}))}else B.type==="tool_result"?l("🚫 跳过tool_result步骤,应作为工具/子代理的子节点:",B.id):W.push(B)}),l("📋 最终处理后的步骤数量:",W.length),W}),f=O=>{r.selectConversation(O)},v=O=>{r.selectStep(O)},h=O=>{m(O)&&r.toggleExpanded(O.id)},m=O=>{if(O.type==="user_message"||O.type==="assistant_thought"||O.type==="assistant_message")return!1;if(O.type==="tool_call"||O.type==="agent_child")return!0;const T=P(O);return T?Math.ceil(T.length/50)*20+40>150:!1},y=O=>O.type==="tool_call"||O.type==="agent_child",g=(O,T)=>O?O.length<=T?O:O.substring(0,T)+"...":"",b=O=>O&&(O.prompt||O.query||O.input||O.message)||"",w=O=>{var se,me;const T=he=>{if(!Array.isArray(he))return"任务总数:0; completed:0; in_progress:0; pending:0";const G=he.length,U=he.filter(ie=>ie.status==="completed").length,q=he.filter(ie=>ie.status==="in_progress").length,J=he.filter(ie=>ie.status==="pending").length;return`任务总数:${G}; pending:${J}; in_progress:${q}; completed:${U}`};let W=[],ee=[];O.toolResult&&O.toolResult.rawLogEntry.toolUseResult?(W=O.toolResult.rawLogEntry.toolUseResult.oldTodos,ee=O.toolResult.rawLogEntry.toolUseResult.newTodos):(W=((se=O.parameters)==null?void 0:se.old_todos)||[],ee=((me=O.parameters)==null?void 0:me.todos)||[]);const B=T(W),oe=T(ee);return`调用前(${B}) -> 调用后(${oe})`},k=O=>{var ee;const T=O.parameters||{};switch(((ee=O.tool_name)==null?void 0:ee.toLowerCase())||""){case"edit":return T.filePath||T.file_path||"";case"glob":return T.pattern||"";case"grep":const B=T.path||"",oe=T.pattern||"";return`${B} | ${oe}`;case"read":return T.file_path||"";case"skill":return T.skill||"";case"todowrite":return w(O);case"write":return T.file_path||"";case"bash":return T.command||"";default:const se=Object.keys(T)[0];return se?String(T[se]):""}},$=O=>{if(O.type==="agent_child"){const T=O.subagent_type||"未知",W=b(O.parameters);return`${T} | ${W}`}if(O.type==="tool_call"){const T=O.tool_name||"未知工具",W=k(O);return`${T} | ${W}`}return""},S=O=>{if(O.type==="agent_child")return b(O.parameters)||"无参数信息";if(O.type==="tool_call"){const T=O.parameters||{};return JSON.stringify(T,null,2)}return""},P=O=>{if(O.type==="tool_call"){let T=JSON.stringify(O.parameters||{},null,2);if(O.toolResult){const W=K(O,!0);T+=`
|
|
37
|
+
`+r):l.stack=r}catch{}}throw l}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ia(this.defaults,n);const{transitional:l,paramsSerializer:o,headers:r}=n;l!==void 0&&Hs.assertOptions(l,{silentJSONParsing:Ol.transitional(Ol.boolean),forcedJSONParsing:Ol.transitional(Ol.boolean),clarifyTimeoutError:Ol.transitional(Ol.boolean)},!1),o!=null&&($e.isFunction(o)?n.paramsSerializer={serialize:o}:Hs.assertOptions(o,{encode:Ol.function,serialize:Ol.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Hs.assertOptions(n,{baseUrl:Ol.spelling("baseURL"),withXsrfToken:Ol.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=r&&$e.merge(r.common,r[n.method]);r&&$e.forEach(["delete","get","head","post","put","patch","common"],m=>{delete r[m]}),n.headers=Wn.concat(a,r);const i=[];let s=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(s=s&&y.synchronous,i.unshift(y.fulfilled,y.rejected))});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let u,f=0,v;if(!s){const m=[zy.bind(this),void 0];for(m.unshift(...i),m.push(...c),v=m.length,u=Promise.resolve(n);f<v;)u=u.then(m[f++],m[f++]);return u}v=i.length;let h=n;for(;f<v;){const m=i[f++],y=i[f++];try{h=m(h)}catch(g){y.call(this,g);break}}try{u=zy.call(this,h)}catch(m){return Promise.reject(m)}for(f=0,v=c.length;f<v;)u=u.then(c[f++],c[f++]);return u}getUri(t){t=ia(this.defaults,t);const n=O2(t.baseURL,t.url,t.allowAbsoluteUrls);return k2(n,t.params,t.paramsSerializer)}};$e.forEach(["delete","get","head","options"],function(t){na.prototype[t]=function(n,l){return this.request(ia(l||{},{method:t,url:n,data:(l||{}).data}))}});$e.forEach(["post","put","patch"],function(t){function n(l){return function(r,a,i){return this.request(ia(i||{},{method:t,headers:l?{"Content-Type":"multipart/form-data"}:{},url:r,data:a}))}}na.prototype[t]=n(),na.prototype[t+"Form"]=n(!0)});let Ix=class I2{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});const l=this;this.promise.then(o=>{if(!l._listeners)return;let r=l._listeners.length;for(;r-- >0;)l._listeners[r](o);l._listeners=null}),this.promise.then=o=>{let r;const a=new Promise(i=>{l.subscribe(i),r=i}).then(o);return a.cancel=function(){l.unsubscribe(r)},a},t(function(r,a,i){l.reason||(l.reason=new er(r,a,i),n(l.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=l=>{t.abort(l)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new I2(function(o){t=o}),cancel:t}}};function Bx(e){return function(n){return e.apply(null,n)}}function Ax(e){return $e.isObject(e)&&e.isAxiosError===!0}const $v={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries($v).forEach(([e,t])=>{$v[t]=e});function B2(e){const t=new na(e),n=u2(na.prototype.request,t);return $e.extend(n,na.prototype,t,{allOwnKeys:!0}),$e.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return B2(ia(e,o))},n}const wt=B2(vi);wt.Axios=na;wt.CanceledError=er;wt.CancelToken=Ix;wt.isCancel=S2;wt.VERSION=E2;wt.toFormData=mc;wt.AxiosError=dt;wt.Cancel=wt.CanceledError;wt.all=function(t){return Promise.all(t)};wt.spread=Bx;wt.isAxiosError=Ax;wt.mergeConfig=ia;wt.AxiosHeaders=Wn;wt.formToJSON=e=>$2($e.isHTMLForm(e)?new FormData(e):e);wt.getAdapter=L2.getAdapter;wt.HttpStatusCode=$v;wt.default=wt;const{Axios:xD,AxiosError:MD,CanceledError:ND,isCancel:RD,CancelToken:zD,VERSION:DD,all:jD,Cancel:FD,isAxiosError:HD,spread:WD,toFormData:KD,AxiosHeaders:qD,HttpStatusCode:UD,formToJSON:YD,getAdapter:ZD,mergeConfig:GD}=wt,Nl=Object.create(null);Nl.open="0";Nl.close="1";Nl.ping="2";Nl.pong="3";Nl.message="4";Nl.upgrade="5";Nl.noop="6";const Ws=Object.create(null);Object.keys(Nl).forEach(e=>{Ws[Nl[e]]=e});const Sv={type:"error",data:"parser error"},A2=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",V2=typeof ArrayBuffer=="function",x2=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Yh=({type:e,data:t},n,l)=>A2&&t instanceof Blob?n?l(t):jy(t,l):V2&&(t instanceof ArrayBuffer||x2(t))?n?l(t):jy(new Blob([t]),l):l(Nl[e]+(t||"")),jy=(e,t)=>{const n=new FileReader;return n.onload=function(){const l=n.result.split(",")[1];t("b"+(l||""))},n.readAsDataURL(e)};function Fy(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Op;function Vx(e,t){if(A2&&e.data instanceof Blob)return e.data.arrayBuffer().then(Fy).then(t);if(V2&&(e.data instanceof ArrayBuffer||x2(e.data)))return t(Fy(e.data));Yh(e,!1,n=>{Op||(Op=new TextEncoder),t(Op.encode(n))})}const Hy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Hy.length;e++)yr[Hy.charCodeAt(e)]=e;const xx=e=>{let t=e.length*.75,n=e.length,l,o=0,r,a,i,s;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),u=new Uint8Array(c);for(l=0;l<n;l+=4)r=yr[e.charCodeAt(l)],a=yr[e.charCodeAt(l+1)],i=yr[e.charCodeAt(l+2)],s=yr[e.charCodeAt(l+3)],u[o++]=r<<2|a>>4,u[o++]=(a&15)<<4|i>>2,u[o++]=(i&3)<<6|s&63;return c},Mx=typeof ArrayBuffer=="function",Zh=(e,t)=>{if(typeof e!="string")return{type:"message",data:M2(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Nx(e.substring(1),t)}:Ws[n]?e.length>1?{type:Ws[n],data:e.substring(1)}:{type:Ws[n]}:Sv},Nx=(e,t)=>{if(Mx){const n=xx(e);return M2(n,t)}else return{base64:!0,data:e}},M2=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},N2="",Rx=(e,t)=>{const n=e.length,l=new Array(n);let o=0;e.forEach((r,a)=>{Yh(r,!1,i=>{l[a]=i,++o===n&&t(l.join(N2))})})},zx=(e,t)=>{const n=e.split(N2),l=[];for(let o=0;o<n.length;o++){const r=Zh(n[o],t);if(l.push(r),r.type==="error")break}return l};function Dx(){return new TransformStream({transform(e,t){Vx(e,n=>{const l=n.length;let o;if(l<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,l);else if(l<65536){o=new Uint8Array(3);const r=new DataView(o.buffer);r.setUint8(0,126),r.setUint16(1,l)}else{o=new Uint8Array(9);const r=new DataView(o.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(l))}e.data&&typeof e.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let _p;function Ri(e){return e.reduce((t,n)=>t+n.length,0)}function zi(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let l=0;for(let o=0;o<t;o++)n[o]=e[0][l++],l===e[0].length&&(e.shift(),l=0);return e.length&&l<e[0].length&&(e[0]=e[0].slice(l)),n}function jx(e,t){_p||(_p=new TextDecoder);const n=[];let l=0,o=-1,r=!1;return new TransformStream({transform(a,i){for(n.push(a);;){if(l===0){if(Ri(n)<1)break;const s=zi(n,1);r=(s[0]&128)===128,o=s[0]&127,o<126?l=3:o===126?l=1:l=2}else if(l===1){if(Ri(n)<2)break;const s=zi(n,2);o=new DataView(s.buffer,s.byteOffset,s.length).getUint16(0),l=3}else if(l===2){if(Ri(n)<8)break;const s=zi(n,8),c=new DataView(s.buffer,s.byteOffset,s.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){i.enqueue(Sv);break}o=u*Math.pow(2,32)+c.getUint32(4),l=3}else{if(Ri(n)<o)break;const s=zi(n,o);i.enqueue(Zh(r?s:_p.decode(s),t)),l=0}if(o===0||o>e){i.enqueue(Sv);break}}}})}const R2=4;function Gt(e){if(e)return Fx(e)}function Fx(e){for(var t in Gt.prototype)e[t]=Gt.prototype[t];return e}Gt.prototype.on=Gt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Gt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Gt.prototype.off=Gt.prototype.removeListener=Gt.prototype.removeAllListeners=Gt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var l,o=0;o<n.length;o++)if(l=n[o],l===t||l.fn===t){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Gt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],l=1;l<arguments.length;l++)t[l-1]=arguments[l];if(n){n=n.slice(0);for(var l=0,o=n.length;l<o;++l)n[l].apply(this,t)}return this};Gt.prototype.emitReserved=Gt.prototype.emit;Gt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Gt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const yc=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Qn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hx="arraybuffer";function z2(e,...t){return t.reduce((n,l)=>(e.hasOwnProperty(l)&&(n[l]=e[l]),n),{})}const Wx=Qn.setTimeout,Kx=Qn.clearTimeout;function bc(e,t){t.useNativeTimers?(e.setTimeoutFn=Wx.bind(Qn),e.clearTimeoutFn=Kx.bind(Qn)):(e.setTimeoutFn=Qn.setTimeout.bind(Qn),e.clearTimeoutFn=Qn.clearTimeout.bind(Qn))}const qx=1.33;function Ux(e){return typeof e=="string"?Yx(e):Math.ceil((e.byteLength||e.size)*qx)}function Yx(e){let t=0,n=0;for(let l=0,o=e.length;l<o;l++)t=e.charCodeAt(l),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(l++,n+=4);return n}function D2(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Zx(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Gx(e){let t={},n=e.split("&");for(let l=0,o=n.length;l<o;l++){let r=n[l].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}class Xx extends Error{constructor(t,n,l){super(t),this.description=n,this.context=l,this.type="TransportError"}}class Gh extends Gt{constructor(t){super(),this.writable=!1,bc(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,l){return super.emitReserved("error",new Xx(t,n,l)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Zh(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Zx(t);return n.length?"?"+n:""}}class Jx extends Gh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let l=0;this._polling&&(l++,this.once("pollComplete",function(){--l||n()})),this.writable||(l++,this.once("drain",function(){--l||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};zx(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Rx(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=D2()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let j2=!1;try{j2=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Qx=j2;function eM(){}class tM extends Jx{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let l=location.port;l||(l=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||l!==t.port}}doWrite(t,n){const l=this.request({method:"POST",data:t});l.on("success",n),l.on("error",(o,r)=>{this.onError("xhr post error",o,r)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,l)=>{this.onError("xhr poll error",n,l)}),this.pollXhr=t}}class Vl extends Gt{constructor(t,n,l){super(),this.createRequest=t,bc(this,l),this._opts=l,this._method=l.method||"GET",this._uri=n,this._data=l.data!==void 0?l.data:null,this._create()}_create(){var t;const n=z2(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const l=this._xhr=this.createRequest(n);try{l.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){l.setDisableHeaderCheck&&l.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&l.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{l.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{l.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(l),"withCredentials"in l&&(l.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(l.timeout=this._opts.requestTimeout),l.onreadystatechange=()=>{var o;l.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(l.getResponseHeader("set-cookie"))),l.readyState===4&&(l.status===200||l.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof l.status=="number"?l.status:0)},0))},l.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Vl.requestsCount++,Vl.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=eM,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Vl.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Vl.requestsCount=0;Vl.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Wy);else if(typeof addEventListener=="function"){const e="onpagehide"in Qn?"pagehide":"unload";addEventListener(e,Wy,!1)}}function Wy(){for(let e in Vl.requests)Vl.requests.hasOwnProperty(e)&&Vl.requests[e].abort()}const nM=function(){const e=F2({xdomain:!1});return e&&e.responseType!==null}();class lM extends tM{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=nM&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Vl(F2,this.uri(),t)}}function F2(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Qx))return new XMLHttpRequest}catch{}if(!t)try{return new Qn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const H2=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class oM extends Gh{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,l=H2?{}:z2(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(l.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,l)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const l=t[n],o=n===t.length-1;Yh(l,this.supportsBinary,r=>{try{this.doWrite(l,r)}catch{}o&&yc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=D2()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Tp=Qn.WebSocket||Qn.MozWebSocket;class aM extends oM{createSocket(t,n,l){return H2?new Tp(t,n,l):n?new Tp(t,n):new Tp(t)}doWrite(t,n){this.ws.send(n)}}class rM extends Gh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=jx(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=t.readable.pipeThrough(n).getReader(),o=Dx();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const r=()=>{l.read().then(({done:i,value:s})=>{i||(this.onPacket(s),r())}).catch(i=>{})};r();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const l=t[n],o=n===t.length-1;this._writer.write(l).then(()=>{o&&yc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const iM={websocket:aM,webtransport:rM,polling:lM},sM=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,uM=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Pv(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),l=e.indexOf("]");n!=-1&&l!=-1&&(e=e.substring(0,n)+e.substring(n,l).replace(/:/g,";")+e.substring(l,e.length));let o=sM.exec(e||""),r={},a=14;for(;a--;)r[uM[a]]=o[a]||"";return n!=-1&&l!=-1&&(r.source=t,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=cM(r,r.path),r.queryKey=dM(r,r.query),r}function cM(e,t){const n=/\/{2,9}/g,l=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&l.splice(0,1),t.slice(-1)=="/"&&l.splice(l.length-1,1),l}function dM(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(l,o,r){o&&(n[o]=r)}),n}const Ov=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ks=[];Ov&&addEventListener("offline",()=>{Ks.forEach(e=>e())},!1);class _o extends Gt{constructor(t,n){if(super(),this.binaryType=Hx,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const l=Pv(t);n.hostname=l.host,n.secure=l.protocol==="https"||l.protocol==="wss",n.port=l.port,l.query&&(n.query=l.query)}else n.host&&(n.hostname=Pv(n.host).host);bc(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(l=>{const o=l.prototype.name;this.transports.push(o),this._transportsByName[o]=l}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Gx(this.opts.query)),Ov&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ks.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=R2,n.transport=t,this.id&&(n.sid=this.id);const l=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](l)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&_o.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",_o.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let l=0;l<this.writeBuffer.length;l++){const o=this.writeBuffer[l].data;if(o&&(n+=Ux(o)),l>0&&n>this._maxPayload)return this.writeBuffer.slice(0,l);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,yc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,l){return this._sendPacket("message",t,n,l),this}send(t,n,l){return this._sendPacket("message",t,n,l),this}_sendPacket(t,n,l,o){if(typeof n=="function"&&(o=n,n=void 0),typeof l=="function"&&(o=l,l=null),this.readyState==="closing"||this.readyState==="closed")return;l=l||{},l.compress=l.compress!==!1;const r={type:t,data:n,options:l};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},l=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?l():t()}):this.upgrading?l():t()),this}_onError(t){if(_o.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ov&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const l=Ks.indexOf(this._offlineEventListener);l!==-1&&Ks.splice(l,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}_o.protocol=R2;class fM extends _o{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),l=!1;_o.priorWebsocketSuccess=!1;const o=()=>{l||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!l)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;_o.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{l||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=n.name,this.emitReserved("upgradeError",v)}}))};function r(){l||(l=!0,u(),n.close(),n=null)}const a=f=>{const v=new Error("probe error: "+f);v.transport=n.name,r(),this.emitReserved("upgradeError",v)};function i(){a("transport closed")}function s(){a("socket closed")}function c(f){n&&f.name!==n.name&&r()}const u=()=>{n.removeListener("open",o),n.removeListener("error",a),n.removeListener("close",i),this.off("close",s),this.off("upgrading",c)};n.once("open",o),n.once("error",a),n.once("close",i),this.once("close",s),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{l||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let l=0;l<t.length;l++)~this.transports.indexOf(t[l])&&n.push(t[l]);return n}}let pM=class extends fM{constructor(t,n={}){const l=typeof t=="object"?t:n;(!l.transports||l.transports&&typeof l.transports[0]=="string")&&(l.transports=(l.transports||["polling","websocket","webtransport"]).map(o=>iM[o]).filter(o=>!!o)),super(t,l)}};function vM(e,t="",n){let l=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),l=Pv(e)),l.port||(/^(http|ws)$/.test(l.protocol)?l.port="80":/^(http|ws)s$/.test(l.protocol)&&(l.port="443")),l.path=l.path||"/";const r=l.host.indexOf(":")!==-1?"["+l.host+"]":l.host;return l.id=l.protocol+"://"+r+":"+l.port+t,l.href=l.protocol+"://"+r+(n&&n.port===l.port?"":":"+l.port),l}const hM=typeof ArrayBuffer=="function",mM=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,W2=Object.prototype.toString,gM=typeof Blob=="function"||typeof Blob<"u"&&W2.call(Blob)==="[object BlobConstructor]",yM=typeof File=="function"||typeof File<"u"&&W2.call(File)==="[object FileConstructor]";function Xh(e){return hM&&(e instanceof ArrayBuffer||mM(e))||gM&&e instanceof Blob||yM&&e instanceof File}function qs(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,l=e.length;n<l;n++)if(qs(e[n]))return!0;return!1}if(Xh(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return qs(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&qs(e[n]))return!0;return!1}function bM(e){const t=[],n=e.data,l=e;return l.data=_v(n,t),l.attachments=t.length,{packet:l,buffers:t}}function _v(e,t){if(!e)return e;if(Xh(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let l=0;l<e.length;l++)n[l]=_v(e[l],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const l in e)Object.prototype.hasOwnProperty.call(e,l)&&(n[l]=_v(e[l],t));return n}return e}function CM(e,t){return e.data=Tv(e.data,t),delete e.attachments,e}function Tv(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Tv(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Tv(e[n],t));return e}const kM=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],wM=5;var gt;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(gt||(gt={}));class $M{constructor(t){this.replacer=t}encode(t){return(t.type===gt.EVENT||t.type===gt.ACK)&&qs(t)?this.encodeAsBinary({type:t.type===gt.EVENT?gt.BINARY_EVENT:gt.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===gt.BINARY_EVENT||t.type===gt.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=bM(t),l=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(l),o}}function Ky(e){return Object.prototype.toString.call(e)==="[object Object]"}class Jh extends Gt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const l=n.type===gt.BINARY_EVENT;l||n.type===gt.BINARY_ACK?(n.type=l?gt.EVENT:gt.ACK,this.reconstructor=new SM(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Xh(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const l={type:Number(t.charAt(0))};if(gt[l.type]===void 0)throw new Error("unknown packet type "+l.type);if(l.type===gt.BINARY_EVENT||l.type===gt.BINARY_ACK){const r=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const a=t.substring(r,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");l.attachments=Number(a)}if(t.charAt(n+1)==="/"){const r=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););l.nsp=t.substring(r,n)}else l.nsp="/";const o=t.charAt(n+1);if(o!==""&&Number(o)==o){const r=n+1;for(;++n;){const a=t.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===t.length)break}l.id=Number(t.substring(r,n+1))}if(t.charAt(++n)){const r=this.tryParse(t.substr(n));if(Jh.isPayloadValid(l.type,r))l.data=r;else throw new Error("invalid payload")}return l}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case gt.CONNECT:return Ky(n);case gt.DISCONNECT:return n===void 0;case gt.CONNECT_ERROR:return typeof n=="string"||Ky(n);case gt.EVENT:case gt.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&kM.indexOf(n[0])===-1);case gt.ACK:case gt.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class SM{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=CM(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const PM=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Jh,Encoder:$M,get PacketType(){return gt},protocol:wM},Symbol.toStringTag,{value:"Module"}));function rl(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const OM=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class K2 extends Gt{constructor(t,n,l){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,l&&l.auth&&(this.auth=l.auth),this._opts=Object.assign({},l),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[rl(t,"open",this.onopen.bind(this)),rl(t,"packet",this.onpacket.bind(this)),rl(t,"error",this.onerror.bind(this)),rl(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var l,o,r;if(OM.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const a={type:gt.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,f=n.pop();this._registerAckCallback(u,f),a.id=u}const i=(o=(l=this.io.engine)===null||l===void 0?void 0:l.transport)===null||o===void 0?void 0:o.writable,s=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!i||(s?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(t,n){var l;const o=(l=this.flags.timeout)!==null&&l!==void 0?l:this._opts.ackTimeout;if(o===void 0){this.acks[t]=n;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===t&&this.sendBuffer.splice(i,1);n.call(this,new Error("operation has timed out"))},o),a=(...i)=>{this.io.clearTimeoutFn(r),n.apply(this,i)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((l,o)=>{const r=(a,i)=>a?o(a):l(i);r.withError=!0,n.push(r),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const l={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...r)=>l!==this._queue[0]?void 0:(o!==null?l.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...r)),l.pending=!1,this._drainQueue())),this._queue.push(l),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:gt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(l=>String(l.id)===t)){const l=this.acks[t];delete this.acks[t],l.withError&&l.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case gt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case gt.EVENT:case gt.BINARY_EVENT:this.onevent(t);break;case gt.ACK:case gt.BINARY_ACK:this.onack(t);break;case gt.DISCONNECT:this.ondisconnect();break;case gt.CONNECT_ERROR:this.destroy();const l=new Error(t.data.message);l.data=t.data.data,this.emitReserved("connect_error",l);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const l of n)l.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let l=!1;return function(...o){l||(l=!0,n.packet({type:gt.ACK,id:t,data:o}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:gt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let l=0;l<n.length;l++)if(t===n[l])return n.splice(l,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let l=0;l<n.length;l++)if(t===n[l])return n.splice(l,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const l of n)l.apply(this,t.data)}}}function tr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}tr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};tr.prototype.reset=function(){this.attempts=0};tr.prototype.setMin=function(e){this.ms=e};tr.prototype.setMax=function(e){this.max=e};tr.prototype.setJitter=function(e){this.jitter=e};class Lv extends Gt{constructor(t,n){var l;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,bc(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((l=n.randomizationFactor)!==null&&l!==void 0?l:.5),this.backoff=new tr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const o=n.parser||PM;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new pM(this.uri,this.opts);const n=this.engine,l=this;this._readyState="opening",this.skipReconnect=!1;const o=rl(n,"open",function(){l.onopen(),t&&t()}),r=i=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",i),t?t(i):this.maybeReconnectOnOpen()},a=rl(n,"error",r);if(this._timeout!==!1){const i=this._timeout,s=this.setTimeoutFn(()=>{o(),r(new Error("timeout")),n.close()},i);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(o),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(rl(t,"ping",this.onping.bind(this)),rl(t,"data",this.ondata.bind(this)),rl(t,"error",this.onerror.bind(this)),rl(t,"close",this.onclose.bind(this)),rl(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){yc(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let l=this.nsps[t];return l?this._autoConnect&&!l.active&&l.connect():(l=new K2(this,t,n),this.nsps[t]=l),l}_destroy(t){const n=Object.keys(this.nsps);for(const l of n)if(this.nsps[l].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let l=0;l<n.length;l++)this.engine.write(n[l],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var l;this.cleanup(),(l=this.engine)===null||l===void 0||l.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const l=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},n);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const fr={};function Us(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=vM(e,t.path||"/socket.io"),l=n.source,o=n.id,r=n.path,a=fr[o]&&r in fr[o].nsps,i=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let s;return i?s=new Lv(l,t):(fr[o]||(fr[o]=new Lv(l,t)),s=fr[o]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(Us,{Manager:Lv,Socket:K2,io:Us,connect:Us});const _M=typeof window<"u",TM=_M&&(new URLSearchParams(window.location.search).get("debug")==="1"||window.localStorage.getItem("CCDEBUG_DEBUG")==="1"),Kl=(...e)=>{TM&&console.log(...e)},hi=x4("timeline",()=>{const e=x(null),t=x([]),n=x(null),l=x([]),o=x(null),r=x(null),a=x(!1),i=x(null),s=x(null),c=x([]),u=x(null),f=x(!1),v=x(""),h=x([]),m=x(!1),y=x(new Set),g=p(()=>o.value?o.value:null),b=p(()=>r.value?r.value:null),w=p(()=>{var O;return((O=s.value)==null?void 0:O.connected)||!1}),k=async(O=!1)=>{var T;a.value=!0,i.value=null;try{const W=await wt.get("/api/project/info");W.data.success&&W.data.data&&(e.value=W.data.data);const ee=new URLSearchParams(window.location.search),B=ee.get("sessionid"),oe=ee.get("file"),se=ee.get("step"),me=ee.get("project");if(me&&!O){const he=decodeURIComponent(me);if(Kl("检测到URL项目路径参数:",he),((T=e.value)==null?void 0:T.projectDir)!==he)try{await Y(he);return}catch(G){console.warn("切换到指定项目失败:",G)}}if(oe){await X();const he=c.value.find(G=>G.id===oe);if(he)await Z(he);else{let G=null;for(const U of c.value){const q=`/api/files?mainLogId=${encodeURIComponent(U.id)}`;try{const J=await wt.get(q);if(J.data.success&&J.data.data){const ie=J.data.data.files;if(ie.some(fe=>fe.id===oe)){G=U,t.value=ie;break}}}catch(J){console.error(`获取主日志 ${U.id} 的文件列表失败:`,J)}}if(G)u.value=G,await $(oe);else{const U=await wt.get("/api/files");U.data.success&&U.data.data&&(t.value=U.data.data.files),await $(oe)}}if(o.value&&se){const G=o.value.steps.find(U=>U.id===se);G&&(r.value=G,setTimeout(()=>{te(se),_(se)},300))}}else if(B){const he=`/api/files?sessionId=${encodeURIComponent(B)}`,G=await wt.get(he);if(G.data.success&&G.data.data){const{files:U}=G.data.data;t.value=U,U.length===1&&(Kl(`找到唯一匹配sessionId ${B} 的文件,自动加载: ${U[0].id}`),await $(U[0].id))}}else await X(),c.value.length>0&&await Z(c.value[0]);I()}catch(W){console.error("初始化失败:",W),i.value="初始化失败,请检查服务器连接"}finally{a.value=!1}},$=async O=>{if(!(n.value===O&&o.value!==null)){a.value=!0,i.value=null,o.value=null,r.value=null,l.value=[];try{const T=await wt.get(`/api/conversations/${O}`);if(T.data.success&&T.data.data)l.value=[T.data.data],n.value=O,o.value=T.data.data,T.data.data.steps&&T.data.data.steps.length>0?r.value=T.data.data.steps[0]:r.value=null;else throw n.value=O,new Error(T.data.error||"加载文件失败")}catch(T){console.error("加载文件失败:",T),i.value="加载文件失败,请重试",o.value=null,r.value=null,l.value=[]}finally{a.value=!1}}},S=O=>{o.value=O,O.steps.length>0?r.value=O.steps[0]:r.value=null},P=O=>{r.value=O,O&&_(O.id)},_=O=>{setTimeout(()=>{const T=document.querySelector(`[data-step-id="${O}"]`);T&&T.scrollIntoView({behavior:"smooth",block:"center"})},100)},I=()=>{s.value&&s.value.disconnect();const T=`http://localhost:${window.location.port||"3003"}`;s.value=Us(T,{transports:["websocket","polling"]}),s.value.on("connect",()=>{Kl("WebSocket连接成功")}),s.value.on("disconnect",()=>{Kl("WebSocket连接断开")}),s.value.on("file:updated",async W=>{if(Kl("文件更新:",W),W.data.files&&(t.value=W.data.files),n.value&&W.data.fileId===n.value)if(W.data.conversations)if(l.value=W.data.conversations,o.value){const ee=W.data.conversations.find(B=>{var oe;return B.id===((oe=o.value)==null?void 0:oe.id)});if(ee){if(o.value=ee,r.value){const B=typeof r.value=="string"?r.value:r.value.id,oe=ee.steps.find(se=>se.id===B);oe?r.value=oe:r.value=ee.steps[ee.steps.length-1]||null}}else W.data.conversations.length>0?S(W.data.conversations[0]):(o.value=null,r.value=null)}else W.data.conversations.length>0&&S(W.data.conversations[0]);else await $(n.value)}),s.value.on("project:changed",W=>{Kl("项目变更:",W),k(!0)})},D=async()=>{try{const T=new URLSearchParams(window.location.search).get("sessionid"),W=T?`/api/files?sessionId=${encodeURIComponent(T)}`:"/api/files",ee=await wt.get(W);ee.data.success&&ee.data.data&&(t.value=ee.data.data.files)}catch(O){console.error("刷新文件列表失败:",O),i.value="刷新文件列表失败"}},H=()=>{i.value=null},N=()=>{s.value&&(s.value.disconnect(),s.value=null)},X=async()=>{f.value=!0,i.value=null;try{const O=await wt.get("/api/main-logs");if(O.data.success&&O.data.data)c.value=O.data.data.mainLogs,Kl(`获取到 ${c.value.length} 个主日志`);else throw new Error(O.data.error||"获取主日志列表失败")}catch(O){console.error("获取主日志列表失败:",O),i.value="获取主日志列表失败,请重试"}finally{f.value=!1}},Z=async O=>{u.value=O,a.value=!0,i.value=null;try{const T=`/api/files?mainLogId=${encodeURIComponent(O.id)}`,W=await wt.get(T);if(W.data.success&&W.data.data)t.value=W.data.data.files,Kl(`选中主日志 ${O.id},共 ${t.value.length} 个文件`);else throw new Error(W.data.error||"获取文件列表失败")}catch(T){console.error("选择主日志失败:",T),i.value="选择主日志失败,请重试"}finally{a.value=!1}},z=async()=>{try{const O=await wt.get("/api/projects");if(O.data.success&&O.data.data)return Kl(`获取到 ${O.data.data.projects.length} 个可用项目`),O.data.data.projects;throw new Error(O.data.error||"获取项目列表失败")}catch(O){throw console.error("获取项目列表失败:",O),i.value="获取项目列表失败,请重试",O}},Y=async O=>{a.value=!0,i.value=null;try{const T=await wt.post("/api/project/switch",{projectPath:O});if(T.data.success&&T.data.data)console.log(`项目已切换到: ${T.data.data.projectDir}`),console.log(`日志目录: ${T.data.data.logDir}`),n.value=null,o.value=null,r.value=null,l.value=[],t.value=[],c.value=[],u.value=null,await k(!0);else throw new Error(T.data.error||"切换项目失败")}catch(T){throw console.error("切换项目失败:",T),i.value="切换项目失败,请重试",T}finally{a.value=!1}},F=async O=>{if(!O.trim())return[];m.value=!0,v.value=O;const T=[];try{const W=[];if(u.value)W.push({fileId:u.value.id,fileName:u.value.name,isSubAgent:!1}),u.value.agentLogs&&u.value.agentLogs.length>0&&u.value.agentLogs.forEach(ee=>{W.push({fileId:ee.id,fileName:ee.agentName||ee.name,isSubAgent:!0})});else if(n.value){const ee=t.value.find(B=>B.id===n.value);ee&&W.push({fileId:ee.id,fileName:ee.name,isSubAgent:!1})}for(const ee of W){const B=await V(ee.fileId,ee.fileName,ee.isSubAgent,O);B.resultCount>0&&T.push(B)}return h.value=T,T}catch(W){throw console.error("搜索失败:",W),W}finally{m.value=!1}},V=async(O,T,W,ee)=>{const B={fileId:O,fileName:T,isSubAgent:W,resultCount:0,results:[]};try{const oe=await wt.get(`/api/conversations/${O}`);if(!oe.data.success||!oe.data.data)return B;const se=oe.data.data,me=ee.toLowerCase().split(/\s+/).filter(he=>he.length>0);return se.steps.forEach((he,G)=>{const U=R(he,me,O,T);B.results.push(...U)}),B.resultCount=B.results.length,B}catch(oe){return console.error(`搜索文件 ${O} 失败:`,oe),B}},R=(O,T,W,ee)=>{const B=[];if(O.content){const oe=O.content.toLowerCase();if(T.every(se=>oe.includes(se))){const se=j(O.content,T[0]);B.push({stepId:O.id,stepType:O.type,stepIndex:O.originalIndex||0,timestamp:O.timestamp,matchedContent:se,matchedField:"content",fileId:W,fileName:ee,tool_use_id:O.tool_use_id})}}return B},j=(O,T)=>{const W=O.toLowerCase(),ee=T.toLowerCase(),B=W.indexOf(ee);if(B===-1)return O.substring(0,100)+(O.length>100?"...":"");const oe=Math.max(0,B-50),se=Math.min(O.length,B+T.length+50);let me=O.substring(oe,se);return oe>0&&(me="..."+me),se<O.length&&(me=me+"..."),me},M=O=>{y.value.has(O)?y.value.delete(O):y.value.add(O)},K=O=>y.value.has(O),te=O=>{y.value.has(O)||y.value.add(O)};return{currentProject:e,availableFiles:t,currentFileId:n,conversations:l,currentConversation:o,selectedStep:r,loading:a,error:i,mainLogs:c,selectedMainLog:u,mainLogsLoading:f,searchKeyword:v,searchResults:h,searchLoading:m,expandedSteps:y,currentConversationData:g,currentStepData:b,isConnected:w,initialize:k,loadFile:$,selectConversation:S,selectStep:P,scrollToStep:_,refreshFiles:D,clearError:H,disconnect:N,fetchMainLogs:X,selectMainLog:Z,fetchAvailableProjects:z,switchProject:Y,performSearch:F,toggleExpanded:M,isExpanded:K,ensureStepExpanded:te}}),LM=Q({name:"IconShareAlt",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:t}){const n=ae("icon"),l=p(()=>[n,`${n}-share-alt`,{[`${n}-spin`]:e.spin}]),o=p(()=>{const a={};return e.size&&(a.fontSize=Le(e.size)?`${e.size}px`:e.size),e.rotate&&(a.transform=`rotate(${e.rotate}deg)`),a});return{cls:l,innerStyle:o,onClick:a=>{t("click",a)}}}}),EM=["stroke-width","stroke-linecap","stroke-linejoin"];function IM(e,t,n,l,o,r){return C(),E("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:L(e.cls),style:Ee(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:t[0]||(t[0]=(...a)=>e.onClick&&e.onClick(...a))},t[1]||(t[1]=[A("path",{d:"M32.442 21.552a4.5 4.5 0 1 1 .065 4.025m-.065-4.025-16.884-8.104m16.884 8.104A4.483 4.483 0 0 0 32 23.5c0 .75.183 1.455.507 2.077m-16.95-12.13a4.5 4.5 0 1 1-8.113-3.895 4.5 4.5 0 0 1 8.114 3.896Zm-.064 20.977A4.5 4.5 0 1 0 11.5 41c3.334-.001 5.503-3.68 3.993-6.578Zm0 0 17.014-8.847"},null,-1)]),14,EM)}var Lp=ve(LM,[["render",IM]]);const BM=Object.assign(Lp,{install:(e,t)=>{var n;const l=(n=t==null?void 0:t.iconPrefix)!=null?n:"";e.component(l+Lp.name,Lp)}}),AM=Q({name:"IconBug",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:t}){const n=ae("icon"),l=p(()=>[n,`${n}-bug`,{[`${n}-spin`]:e.spin}]),o=p(()=>{const a={};return e.size&&(a.fontSize=Le(e.size)?`${e.size}px`:e.size),e.rotate&&(a.transform=`rotate(${e.rotate}deg)`),a});return{cls:l,innerStyle:o,onClick:a=>{t("click",a)}}}}),VM=["stroke-width","stroke-linecap","stroke-linejoin"];function xM(e,t,n,l,o,r){return C(),E("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:L(e.cls),style:Ee(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:t[0]||(t[0]=(...a)=>e.onClick&&e.onClick(...a))},t[1]||(t[1]=[A("path",{d:"M24 42c-6.075 0-11-4.925-11-11V18h22v13c0 6.075-4.925 11-11 11Zm0 0V23m11 4h8M5 27h8M7 14a4 4 0 0 0 4 4h26a4 4 0 0 0 4-4m0 28v-.5a6.5 6.5 0 0 0-6.5-6.5M7 42v-.5a6.5 6.5 0 0 1 6.5-6.5M17 14a7 7 0 1 1 14 0"},null,-1)]),14,VM)}var Ep=ve(AM,[["render",xM]]);const MM=Object.assign(Ep,{install:(e,t)=>{var n;const l=(n=t==null?void 0:t.iconPrefix)!=null?n:"";e.component(l+Ep.name,Ep)}}),NM={class:"main-log-dialog"},RM={class:"file-name-cell"},zM={class:"file-id"},DM={class:"preview-text"},jM=Q({__name:"MainLogSelectDialog",props:{visible:{type:Boolean,default:!1},mainLogs:{default:()=>[]},loading:{type:Boolean,default:!1}},emits:["update:visible","select"],setup(e,{emit:t}){const n=e,l=t,o=p({get:()=>n.visible,set:m=>l("update:visible",m)}),r=x(null),a=x([]),i=[{title:"文件名",dataIndex:"name",slotName:"fileName",width:240,ellipsis:!0},{title:"开始时间",dataIndex:"startTime",slotName:"startTime",width:200},{title:"结束时间",dataIndex:"endTime",slotName:"endTime",width:200},{title:"输入消息",dataIndex:"inputPreview",slotName:"inputPreview",ellipsis:!0},{title:"子Agent数",dataIndex:"agentCount",slotName:"agentCount",width:120,align:"center"}],s={type:"radio"};Ie(a,m=>{if(m.length>0){const y=n.mainLogs.find(g=>g.id===m[0]);y&&(r.value=y)}});const c=m=>{if(!m)return"";const y=new Date(m),g=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),w=String(y.getDate()).padStart(2,"0"),k=String(y.getHours()).padStart(2,"0"),$=String(y.getMinutes()).padStart(2,"0"),S=String(y.getSeconds()).padStart(2,"0");return`${g}/${b}/${w} ${k}:${$}:${S}`},u=m=>{a.value=[m.id],r.value=m},f=()=>{r.value&&(l("select",r.value),o.value=!1,h())},v=()=>{o.value=!1,h()},h=()=>{r.value=null,a.value=[]};return Ie(o,m=>{m||h()}),(m,y)=>{const g=ne("a-tooltip"),b=ne("a-tag"),w=ne("a-table"),k=ne("a-modal");return C(),ce(k,{visible:o.value,"onUpdate:visible":y[1]||(y[1]=$=>o.value=$),title:"选择会话日志",width:"1020px","mask-closable":!1,onOk:f,onCancel:v},{default:ue(()=>[A("div",NM,[d(w,{columns:i,data:n.mainLogs,loading:n.loading,pagination:!1,scroll:{y:400},"row-key":"id","row-selection":s,"selected-keys":a.value,"onUpdate:selectedKeys":y[0]||(y[0]=$=>a.value=$),onRowClick:u},{fileName:ue(({record:$})=>[A("div",RM,[A("span",zM,we($.id),1)])]),startTime:ue(({record:$})=>[A("span",null,we(c($.startTime)),1)]),endTime:ue(({record:$})=>[A("span",null,we(c($.endTime)),1)]),inputPreview:ue(({record:$})=>[d(g,{content:$.inputFull,position:"top"},{default:ue(()=>[A("span",DM,we($.inputPreview),1)]),_:2},1032,["content"])]),agentCount:ue(({record:$})=>[d(b,{color:"blue"},{default:ue(()=>[ze(we($.agentLogs.length),1)]),_:2},1024)]),_:1},8,["data","loading","selected-keys"])])]),_:1},8,["visible"])}}}),xo=(e,t)=>{const n=e.__vccOpts||e;for(const[l,o]of t)n[l]=o;return n},FM=xo(jM,[["__scopeId","data-v-533a9e6f"]]),HM={class:"project-select-dialog"},WM={class:"search-container"},KM={class:"project-name-cell"},qM={class:"project-name"},UM={class:"path-text"},YM=Q({__name:"ProjectSelectDialog",props:{visible:{type:Boolean,default:!1},projects:{default:()=>[]},currentProject:{},loading:{type:Boolean,default:!1}},emits:["update:visible","select"],setup(e,{emit:t}){const n=e,l=t,o=x(""),r=p(()=>{if(!o.value.trim())return n.projects;const b=o.value.toLowerCase();return n.projects.filter(w=>w.name.toLowerCase().includes(b)||w.path.toLowerCase().includes(b))}),a=p({get:()=>n.visible,set:b=>l("update:visible",b)}),i=x(null),s=x([]),c=[{title:"项目名称",dataIndex:"name",slotName:"projectName",width:300},{title:"项目路径",dataIndex:"path",slotName:"projectPath"}],u={type:"radio"};Ie(s,b=>{if(b.length>0){const w=r.value.find(k=>k.path===b[0]);w&&(i.value=w)}});const f=b=>{o.value=b},v=()=>{o.value=""},h=b=>{s.value=[b.path],i.value=b},m=()=>{i.value&&(l("select",i.value.path),a.value=!1,g())},y=()=>{a.value=!1,g()},g=()=>{i.value=null,s.value=[]};return Ie(a,b=>{if(b&&n.currentProject){const w=r.value.find(k=>k.path===n.currentProject);w&&(s.value=[w.path],i.value=w)}else b||(g(),o.value="")}),(b,w)=>{const k=ne("a-input-search"),$=ne("a-alert"),S=ne("a-tag"),P=ne("a-table"),_=ne("a-modal");return C(),ce(_,{visible:a.value,"onUpdate:visible":w[2]||(w[2]=I=>a.value=I),title:"选择项目",width:"1200px","mask-closable":!1,onOk:m,onCancel:y},{default:ue(()=>[A("div",HM,[A("div",WM,[d(k,{modelValue:o.value,"onUpdate:modelValue":w[0]||(w[0]=I=>o.value=I),placeholder:"请输入项目名称进行搜索","allow-clear":"",onClear:v,onSearch:f,style:{"margin-bottom":"16px"}},null,8,["modelValue"])]),!n.loading&&r.value.length===0?(C(),ce($,{key:0,type:"warning",style:{"margin-bottom":"16px"}},{default:ue(()=>[ze(we(o.value?"未找到匹配的项目":"未找到可用项目")+"。请确认用户主目录下存在 ",1),w[3]||(w[3]=A("code",null,"~/.claude/projects",-1)),w[4]||(w[4]=ze(" 目录。 ",-1))]),_:1})):le("",!0),d(P,{columns:c,data:r.value,loading:n.loading,pagination:!1,scroll:{y:500},"row-key":"path","row-selection":u,"selected-keys":s.value,"onUpdate:selectedKeys":w[1]||(w[1]=I=>s.value=I),onRowClick:h},{projectName:ue(({record:I})=>[A("div",KM,[A("span",qM,we(I.name),1),I.isDefault?(C(),ce(S,{key:0,color:"blue",size:"small",style:{"margin-left":"8px"}},{default:ue(()=>[...w[5]||(w[5]=[ze(" 当前项目 ",-1)])]),_:1})):le("",!0)])]),projectPath:ue(({record:I})=>[A("span",UM,we(I.path),1)]),_:1},8,["data","loading","selected-keys"])])]),_:1},8,["visible"])}}}),ZM=xo(YM,[["__scopeId","data-v-a8fb4722"]]),qy=e=>({user_message:"#1890ff",assistant_thinking:"#faad14",assistant_message:"#52c41a",tool_call:"#722ed1",tool_result:"#13c2c2",agent_child:"#eb2f96",agent_end:"#eb2f96",sub_agent:"#eb2f96"})[e]||"#d9d9d9",GM=e=>({user_message:"#e6f7ff",assistant_thinking:"#fff7e6",assistant_message:"#f6ffed",tool_call:"#f9f0ff",tool_result:"#e6fffb",agent_child:"#fff0f6",agent_end:"#fff0f6",sub_agent:"#fff0f6"})[e]||"#f5f5f5",XM={class:"file-selector"},JM={class:"info-item"},QM={class:"value"},eN={class:"info-item"},tN={class:"value"},nN={class:"file-selector-content"},lN={class:"file-option"},oN={class:"file-name"},aN={class:"step-count"},rN={key:0,class:"no-files"},iN={key:0},sN={class:"detail-item"},uN={class:"value"},cN={class:"detail-item"},dN={class:"value"},fN={class:"detail-item"},pN={class:"value"},vN={class:"step-type-filter"},hN={class:"filter-actions"},mN={class:"steps-chart"},gN=["title","onClick"],yN={class:"step-index"},bN={key:0,class:"filter-stats"},CN={key:1,class:"file-hint"},kN=Q({__name:"ProjectPanel",setup(e){const t=(()=>{try{return new URLSearchParams(window.location.search).get("debug")==="1"||window.localStorage.getItem("CCDEBUG_DEBUG")==="1"}catch{return!1}})(),n=(...O)=>{t&&console.log(...O)},l=hi(),o=p(()=>l.currentProject),r=p(()=>l.availableFiles),a=p(()=>l.currentFileId),i=p(()=>l.conversations),s=p(()=>l.currentConversation),c=p(()=>l.selectedStep),u=p(()=>l.loading);p(()=>l.isConnected);const f=p(()=>l.mainLogs),v=p(()=>l.mainLogsLoading),h=x(null),m=x(null),y=x(!1),g=x(!1),b=x([]),w=x(!1),k=[{value:"user_message",label:"用户消息",color:"#1890ff"},{value:"assistant_thinking",label:"助手思考",color:"#faad14"},{value:"assistant_message",label:"助手消息",color:"#52c41a"},{value:"tool_call",label:"工具调用",color:"#722ed1"},{value:"sub_agent",label:"子代理",color:"#eb2f96"}],$=x(["user_message","assistant_thinking","assistant_message","tool_call","sub_agent"]),S=x([]),P=p(()=>{var T;if(!((T=s.value)!=null&&T.steps))return[];const O=new Set;return s.value.steps.forEach(W=>{W.type==="tool_call"&&W.tool_name&&O.add(W.tool_name)}),Array.from(O).sort()});Ie([()=>k,P],([O,T])=>{if(O.length>0&&S.value.length===0){const W=O.map(B=>B.value),ee=T.map(B=>`tool:${B}`);S.value=[...W,...ee]}},{immediate:!0});const _=p(()=>k.map(O=>O.value==="tool_call"?{key:O.value,title:O.label,children:P.value.map(T=>({key:`tool:${T}`,title:T}))}:{key:O.value,title:O.label})),I=p(()=>{var O;return(O=s.value)!=null&&O.steps?s.value.steps.filter(T=>{const W=T.type==="agent_child"||T.type==="agent_end"?"sub_agent":T.type;if(W==="tool_call"){const ee=S.value.filter(B=>B.startsWith("tool:")).map(B=>B.substring(5));return ee.length>0?(n("过滤工具调用:",{stepToolName:T.tool_name,selectedTools:ee,match:ee.includes(T.tool_name||"")}),ee.includes(T.tool_name||"")):S.value.includes("tool_call")}return S.value.includes(W)}):[]}),D=()=>{const O=k.map(W=>W.value),T=P.value.map(W=>`tool:${W}`);S.value=[...O,...T]},H=()=>{S.value=[]};Ie(S,O=>{$.value=O.filter(T=>!T.startsWith("tool:"))},{immediate:!0}),Ie(a,O=>{n("🔍 调试测试: currentFileId变化",{newFileId:O,oldSelectedFileId:h.value}),h.value=O},{immediate:!0});const N=O=>{n("🔍 调试测试: 文件切换",{fileId:O,currentFileId:a.value}),h.value=O,O!==a.value&&l.loadFile(O)},X=O=>{l.selectStep(O),Z(O.id)},Z=O=>{setTimeout(()=>{const T=document.querySelector(`[data-step-id="${O}"]`);T&&T.scrollIntoView({behavior:"smooth",block:"center"})},100)},z=O=>new Date(O).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"}),Y=O=>new Date(O).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),F=()=>{var ee;if(!h.value)return"";let O=r.value.find(B=>B.id===h.value);if(!O)for(const B of f.value){const oe=(ee=B.agentLogs)==null?void 0:ee.find(se=>se.id===h.value);if(oe){O=oe;break}}if(O)return V(O);const T=h.value,W=T.lastIndexOf(".");return W>-1?T.substring(0,W):T},V=O=>{if(O.agentName)return O.agentName;const T=O.name,W=T.lastIndexOf(".");return W>-1?T.substring(0,W):T},R=O=>{if(O.stepCount!==void 0)return O.stepCount;const T=i.value.find(W=>W.id===O.id);return T!=null&&T.steps?T.steps.filter(W=>W.type!=="tool_result").length:0},j=async()=>{await l.fetchMainLogs(),y.value=!0},M=async O=>{n("📋 选择主日志:",O),await l.selectMainLog(O)},K=async()=>{w.value=!0;try{b.value=await l.fetchAvailableProjects()}catch(O){console.error("获取项目列表失败:",O)}finally{w.value=!1}g.value=!0},te=async O=>{n("📁 选择项目:",O);try{await l.switchProject(O),g.value=!1}catch(T){console.error("切换项目失败:",T)}};return lt(()=>{const T=new URLSearchParams(window.location.search).get("sessionid");T&&(m.value=T)}),(O,T)=>{var ee,B;const W=ne("a-alert");return C(),E("div",XM,[d(ct(hr),{title:"项目信息",bordered:!1,size:"small",class:"file-card"},{extra:ue(()=>[d(ct(qt),{type:"primary",size:"small",onClick:K,loading:w.value},{default:ue(()=>[...T[4]||(T[4]=[ze(" 选择项目 ",-1)])]),_:1},8,["loading"])]),default:ue(()=>{var oe,se;return[A("div",JM,[T[5]||(T[5]=A("span",{class:"label"},"项目路径:",-1)),A("span",QM,we(((oe=o.value)==null?void 0:oe.path)||"未知"),1)]),A("div",eN,[T[6]||(T[6]=A("span",{class:"label"},"日志目录:",-1)),A("span",tN,we(((se=o.value)==null?void 0:se.logDir)||"未知"),1)])]}),_:1}),d(ct(hr),{title:"日志文件",bordered:!1,size:"small",class:"file-card"},{extra:ue(()=>[d(ct(qt),{type:"primary",size:"small",onClick:j,loading:v.value},{default:ue(()=>[...T[7]||(T[7]=[ze(" 选择会话 ",-1)])]),_:1},8,["loading"])]),default:ue(()=>[A("div",nN,[d(ct(za),{modelValue:h.value,"onUpdate:modelValue":T[0]||(T[0]=oe=>h.value=oe),placeholder:"请选择日志文件",loading:u.value,disabled:r.value.length===0,onChange:N,class:"file-select","popup-container":".file-selector","popup-props":{class:"custom-select-popup"}},{default:ue(()=>[(C(!0),E(Ve,null,Ct(r.value,oe=>(C(),ce(ct(Po),{key:oe.id,value:oe.id,label:V(oe)},{default:ue(()=>[A("div",lN,[A("div",oN,[ze(we(V(oe)),1),A("span",aN,"("+we(R(oe))+"步)",1)])])]),_:2},1032,["value","label"]))),128))]),_:1},8,["modelValue","loading","disabled"]),r.value.length===0&&!u.value?(C(),E("div",rN,[d(ct(Rl),{description:"未找到日志文件"})])):le("",!0)])]),_:1}),d(FM,{visible:y.value,"onUpdate:visible":T[1]||(T[1]=oe=>y.value=oe),"main-logs":f.value,loading:v.value,onSelect:M},null,8,["visible","main-logs","loading"]),d(ZM,{visible:g.value,"onUpdate:visible":T[2]||(T[2]=oe=>g.value=oe),projects:b.value,"current-project":(ee=o.value)==null?void 0:ee.path,loading:w.value,onSelect:te},null,8,["visible","projects","current-project","loading"]),h.value?(C(),E("div",iN,[d(ct(hr),{title:"日志信息",bordered:!1,size:"small",class:"file-card"},{default:ue(()=>{var oe,se;return[A("div",sN,[T[8]||(T[8]=A("span",{class:"label"},"文件名:",-1)),A("span",uN,we(F()),1)]),A("div",cN,[T[9]||(T[9]=A("span",{class:"label"},"开始时间:",-1)),A("span",dN,we((oe=s.value)!=null&&oe.timestamp?Y(s.value.timestamp):"-"),1)]),A("div",fN,[T[10]||(T[10]=A("span",{class:"label"},"步骤数量:",-1)),A("span",pN,we((se=s.value)!=null&&se.steps?s.value.steps.filter(me=>me.type!=="tool_result").length:0),1)])]}),_:1}),(B=s.value)!=null&&B.steps&&s.value.steps.length>0?(C(),ce(ct(hr),{key:0,title:"步骤概览",bordered:!1,class:"file-card",size:"small"},{extra:ue(()=>[d(ct(Ju),{trigger:"click",position:"bottom"},{content:ue(()=>[A("div",vN,[T[13]||(T[13]=A("div",{class:"filter-header"},"选择要显示的节点类型",-1)),d(ct(ku),{"checked-keys":S.value,"onUpdate:checkedKeys":T[3]||(T[3]=oe=>S.value=oe),data:_.value,checkable:!0,"default-expand-all":!0,"show-line":!1,size:"mini","block-node":!0},{icon:ue(({node:oe})=>{var se;return[A("div",{class:"tree-node-color",style:Ee({backgroundColor:oe.key.startsWith("tool:")?"#722ed1":(se=k.find(me=>me.value===oe.key))==null?void 0:se.color})},null,4)]}),_:1},8,["checked-keys","data"]),A("div",hN,[d(ct(qt),{size:"mini",onClick:D},{default:ue(()=>[...T[11]||(T[11]=[ze(" 全选 ",-1)])]),_:1}),d(ct(qt),{size:"mini",onClick:H},{default:ue(()=>[...T[12]||(T[12]=[ze(" 清空 ",-1)])]),_:1})])])]),default:ue(()=>[d(ct(qt),{type:"text",size:"small"},{icon:ue(()=>[d(ct(MC))]),default:ue(()=>[ze(" 过滤 ("+we(I.value.length)+") ",1)]),_:1})]),_:1})]),default:ue(()=>[A("div",mN,[(C(!0),E(Ve,null,Ct(I.value,(oe,se)=>{var me;return C(),E("div",{key:oe.id,class:L(["step-bar",{selected:((me=c.value)==null?void 0:me.id)===oe.id}]),style:Ee({backgroundColor:ct(GM)(oe.type),borderColor:ct(qy)(oe.type),color:ct(qy)(oe.type)}),title:`${oe.type} - ${z(oe.timestamp)}`,onClick:he=>X(oe)},[A("span",yN,we(oe.originalIndex),1)],14,gN)}),128))]),s.value?(C(),E("div",bN," 显示 "+we(I.value.length)+" / "+we(s.value.steps.filter(oe=>oe.type!=="tool_result").length)+" 个步骤 ",1)):le("",!0)]),_:1})):le("",!0)])):(C(),E("div",CN,[d(W,null,{default:ue(()=>[...T[14]||(T[14]=[ze("选择一个日志文件以查看对话时间线和详细信息",-1)])]),_:1})]))])}}}),wN=xo(kN,[["__scopeId","data-v-957cb932"]]),$N={class:"timeline-container"},SN={key:0,class:"loading"},PN={key:1,class:"timeline-content"},ON={key:0,class:"empty-state"},_N={key:1,class:"timeline-wrapper"},TN={class:"timeline-title"},LN={class:"timeline-main"},EN=["onClick"],IN={key:0,class:"timeline-time"},BN={class:"timeline-connector"},AN=["title"],VN={class:"step-number"},xN={key:0,class:"timeline-line"},MN=["data-step-id"],NN=["onClick"],RN={class:"header-left"},zN={class:"tag-duration-group"},DN={class:"step-type-tag"},jN={class:"summary-text"},FN={key:0,class:"tool-name-highlight"},HN={key:1,class:"subagent-type-highlight"},WN={key:2,class:"tool-specific-info"},KN={key:3,class:"subagent-prompt"},qN={class:"tag-duration-group"},UN=["title"],YN={key:0,class:"header-info"},ZN={key:0,class:"tool-name-header"},GN={key:1,class:"subagent-name-header"},XN=["onClick"],JN={key:0,class:"user-query-content"},QN=["innerHTML"],eR={key:1,class:"agent-thinking-content"},tR=["innerHTML"],nR={key:2,class:"agent-message-content"},lR=["innerHTML"],oR={key:3,class:"tool-use-content"},aR={key:0,class:"tool-details-expanded"},rR={class:"tool-header"},iR={class:"tool-name"},sR={class:"tool-parameters"},uR=["innerHTML"],cR={key:0,class:"tool-result-container"},dR={class:"tool-result-card"},fR={class:"result-content"},pR=["innerHTML"],vR={key:4,class:"sub-agent-content"},hR={key:0,class:"sub-agent-details-expanded"},mR={class:"sub-agent-header"},gR=["onClick","title"],yR={key:1,class:"sub-agent-type-text"},bR={class:"sub-agent-parameters"},CR=["innerHTML"],kR={key:0,class:"tool-result-container"},wR={class:"tool-result-card"},$R={class:"result-content"},SR=["innerHTML"],PR={key:5,class:"default-content"},OR=["innerHTML"],_R=Q({components:{ATooltip:qn},__name:"Timeline",setup(e,{expose:t}){const n=(()=>{var O;if(typeof window<"u")try{return new URL(window.location.href).searchParams.get("debug")==="1"||((O=window.localStorage)==null?void 0:O.getItem("CCDEBUG_DEBUG"))==="1"}catch{return!1}return!1})(),l=(...O)=>{n&&console.log(...O)},o=(...O)=>{n&&console.warn(...O)},r=hi(),a=p(()=>r.loading);p(()=>r.conversations);const i=p(()=>r.currentConversation),s=p(()=>r.selectedStep),c=p(()=>r.searchKeyword),u=p(()=>{var ee;if(!((ee=i.value)!=null&&ee.steps))return[];const O=i.value.steps;l("🔍 processedSteps - 原始步骤数量:",O.length);const T=new Map;O.forEach(B=>{(B.type==="tool_call"||B.type==="agent_child")&&(l("🔧 找到工具/子代理步骤:",{id:B.id,tool_use_id:B.tool_use_id,tool_name:B.tool_name,type:B.type}),B.tool_use_id?T.set(B.tool_use_id,{...B}):(o("⚠️ 工具/子代理步骤缺少tool_use_id,使用步骤id作为fallback:",B.id),T.set(B.id,{...B})))}),l("🗺️ toolUseMap大小:",T.size),O.forEach(B=>{if(B.type==="tool_result"){l("📊 找到tool_result步骤:",{id:B.id,tool_use_id:B.tool_use_id});let oe=null;if(B.tool_use_id&&(oe=T.get(B.tool_use_id)),!oe){const se=O.indexOf(B);for(let me=se-1;me>=0;me--){const he=O[me];if(he.type==="tool_call"){const G=he.tool_use_id||he.id;if(oe=T.get(G),oe){l("🔗 通过位置关系关联tool_result到tool_call:",{toolResultId:B.id,toolCallId:he.id});break}}}}oe?(oe.toolResult=B,l("✅ 成功关联tool_result到tool_call")):o("⚠️ 无法找到对应的tool_call步骤")}});const W=[];return O.forEach(B=>{if(B.type==="tool_call"||B.type==="agent_child"){const oe=B.tool_use_id||B.id,se=T.get(oe);se?(W.push(se),l("📝 添加工具/子代理步骤:",{id:se.id,type:se.type,hasToolResult:!!se.toolResult})):(W.push(B),l("📝 添加原始工具/子代理步骤:",{id:B.id,type:B.type}))}else B.type==="tool_result"?l("🚫 跳过tool_result步骤,应作为工具/子代理的子节点:",B.id):W.push(B)}),l("📋 最终处理后的步骤数量:",W.length),W}),f=O=>{r.selectConversation(O)},v=O=>{r.selectStep(O)},h=O=>{m(O)&&r.toggleExpanded(O.id)},m=O=>{if(O.type==="user_message"||O.type==="assistant_thought"||O.type==="assistant_message")return!1;if(O.type==="tool_call"||O.type==="agent_child")return!0;const T=P(O);return T?Math.ceil(T.length/50)*20+40>150:!1},y=O=>O.type==="tool_call"||O.type==="agent_child",g=(O,T)=>O?O.length<=T?O:O.substring(0,T)+"...":"",b=O=>O&&(O.prompt||O.query||O.input||O.message)||"",w=O=>{var se,me;const T=he=>{if(!Array.isArray(he))return"任务总数:0; completed:0; in_progress:0; pending:0";const G=he.length,U=he.filter(ie=>ie.status==="completed").length,q=he.filter(ie=>ie.status==="in_progress").length,J=he.filter(ie=>ie.status==="pending").length;return`任务总数:${G}; pending:${J}; in_progress:${q}; completed:${U}`};let W=[],ee=[];O.toolResult&&O.toolResult.rawLogEntry.toolUseResult?(W=O.toolResult.rawLogEntry.toolUseResult.oldTodos,ee=O.toolResult.rawLogEntry.toolUseResult.newTodos):(W=((se=O.parameters)==null?void 0:se.old_todos)||[],ee=((me=O.parameters)==null?void 0:me.todos)||[]);const B=T(W),oe=T(ee);return`调用前(${B}) -> 调用后(${oe})`},k=O=>{var ee;const T=O.parameters||{};switch(((ee=O.tool_name)==null?void 0:ee.toLowerCase())||""){case"edit":return T.filePath||T.file_path||"";case"glob":return T.pattern||"";case"grep":const B=T.path||"",oe=T.pattern||"";return`${B} | ${oe}`;case"read":return T.file_path||"";case"skill":return T.skill||"";case"todowrite":return w(O);case"write":return T.file_path||"";case"bash":return T.command||"";default:const se=Object.keys(T)[0];return se?String(T[se]):""}},$=O=>{if(O.type==="agent_child"){const T=O.subagent_type||"未知",W=b(O.parameters);return`${T} | ${W}`}if(O.type==="tool_call"){const T=O.tool_name||"未知工具",W=k(O);return`${T} | ${W}`}return""},S=O=>{if(O.type==="agent_child")return b(O.parameters)||"无参数信息";if(O.type==="tool_call"){const T=O.parameters||{};return JSON.stringify(T,null,2)}return""},P=O=>{if(O.type==="tool_call"){let T=JSON.stringify(O.parameters||{},null,2);if(O.toolResult){const W=K(O,!0);T+=`
|
|
38
38
|
`+W}return T}else if(O.type==="tool_result")return K(O,!0);return O.content||""},_=O=>{if(!O.toolResult||!O.timestamp||!O.toolResult.timestamp)return null;try{const T=new Date(O.timestamp).getTime(),W=new Date(O.toolResult.timestamp).getTime();if(isNaN(T)||isNaN(W))return null;const ee=W-T;let B="",oe="";if(ee<1e3)B=`耗时:${ee}毫秒`,oe="duration-fast";else if(ee<6e4){const se=Math.floor(ee/1e3),me=ee%1e3;me>0?B=`耗时:${se}.${Math.floor(me/100)}秒`:B=`耗时:${se}秒`,ee<3e3?oe="duration-fast":ee<3e4?oe="duration-medium":oe="duration-slow"}else{const se=Math.floor(ee/6e4),me=Math.floor(ee%6e4/1e3);me>0?B=`耗时:${se}分${me}秒`:B=`耗时:${se}分钟`,ee<12e4?oe="duration-slow":oe="duration-very-slow"}return{text:B,class:oe}}catch(T){return console.warn("计算耗时失败:",T),null}},I=O=>{if(!c.value||!O)return O;const T=c.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`(${T})`,"gi");return O.replace(W,'<mark class="search-highlight-keyword">$1</mark>')},D=O=>{if(!O)return"";const T=c.value;let W=O;return T&&(W=I(O)),W.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,function(ee){let B="json-number";return/^"/.test(ee)?/:$/.test(ee)?B="json-key":B="json-string":/true|false/.test(ee)?B="json-boolean":/null/.test(ee)&&(B="json-null"),'<span class="'+B+'">'+ee+"</span>"}).replace(/([{}[\],])/g,'<span class="json-bracket">$1</span>')},H=(O,T)=>{c.value;const W=r.isExpanded(O.id);let ee=T;return ee||(O.type==="tool_result"||O.type==="tool_call"&&O.toolResult?ee=K(O,W):ee=O.content||""),W?I(ee):m(O)?I(z(ee,150)):I(z(ee,350))},N=(O,T)=>{let W=T;return W||(W=O.content||""),D(W)},X=(O,T=!1)=>{const W=K(O,!0);return D(W)},Z=(O,T)=>{if(typeof window<"u"){const ee=document.querySelector(`[data-step-id="${O.id}"] .card-content`);if(ee){const B=ee.scrollHeight,oe=ee.clientHeight;return B>oe}}const W=T||O.content||"";if(!m(O)){const B=Math.floor(15.5)*50;return W.length>B}if(r.isExpanded(O.id)){const B=Math.floor(15.5)*50;return W.length>B}else{const B=Math.floor(5.5)*50;return W.length>B}},z=(O,T)=>{if(!O)return"";const ee=Math.floor((T-40)/20)*50;if(O.length<=ee)return O;const B=O.substring(0,ee),oe=B.lastIndexOf(`
|
|
39
39
|
`);return oe>ee*.8?B.substring(0,oe)+`
|
|
40
40
|
...`:B+"..."},Y=O=>{if(!O)return"";const T=new Date(O);return isNaN(T.getTime())?"":T.toLocaleTimeString({hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})},F=O=>({user_message:"User_Query",assistant_thinking:"Agent_Thinking",assistant_message:"Agent_Message",tool_call:"Tool_Use",tool_result:"Tool_Result",agent_child:"Sub_Agent",agent_end:"Sub_Agent",sub_agent:"Sub_Agent"})[O]||O,V=O=>{const T=F(O.type),W=Y(O.timestamp);return`${T} - ${W}`},R=O=>({user_message:"#1890ff",assistant_thinking:"#faad14",assistant_message:"#52c41a",tool_call:"#722ed1",tool_result:"#13c2c2",agent_child:"#eb2f96",agent_end:"#eb2f96",sub_agent:"#eb2f96"})[O]||"#d9d9d9",j=O=>({user_message:"用户查询 - 用户向AI助手提出的问题或请求",assistant_thinking:"AI思考 - AI助手的内部思考过程",assistant_message:"AI回复 - AI助手对用户的回应",tool_call:"工具调用 - AI助手调用外部工具或函数",tool_result:"工具结果 - 外部工具返回的执行结果",agent_child:"子代理 - 启动的子代理进程",agent_end:"对话结束 - 当前对话会话结束",sub_agent:"子代理 - 启动的子代理进程"})[O]||O,M=(O,T=500)=>O?O.length<=T?O:O.substring(0,T)+"...":"",K=(O,T=!1)=>{var W;if(l("🔍 getToolResultContent called:",{stepId:O.id,stepType:O.type,isExpanded:T,hasToolResult:!!O.toolResult,hasContent:!!O.content,contentLength:((W=O.content)==null?void 0:W.length)||0,rawLogEntry:O.rawLogEntry?Object.keys(O.rawLogEntry):[]}),(O.type==="tool_call"||O.type==="agent_child")&&O.toolResult){l("🎯 使用关联的toolResult内容");const ee=O.toolResult.rawLogEntry;if(ee!=null&&ee.toolUseResult)try{const B=JSON.stringify(ee.toolUseResult,null,2);return!T&&B.length>500?(l("📏 toolUseResult JSON truncated (collapsed):",B.length),B.substring(0,500)+"..."):(l("📄 toolUseResult JSON full content (expanded):",B.length),B)}catch(B){return o("toolUseResult JSON序列化失败:",B),""}return l("⚠️ 未找到toolUseResult,返回空内容"),""}return l("⚠️ 无法提取Tool Result内容,使用兜底显示"),"No result content available"};lt(()=>{});const te=async O=>{var T,W;if(!(!O.subagent_type||O.subagent_type==="未知"))try{const ee=r.selectedMainLog;if(!ee||!ee.agentLogs){console.warn("未找到当前主日志或其子代理日志列表");return}let B=ee.agentLogs.find(oe=>oe.agentName===O.subagent_type);if(!B&&((W=(T=O.rawLogEntry)==null?void 0:T.toolUseResult)!=null&&W.agentId)){const oe=O.rawLogEntry.toolUseResult.agentId;B=ee.agentLogs.find(se=>se.agentId===oe)}B&&r.loadFile(B.id)}catch(ee){console.error("加载子代理日志失败:",ee)}};return t({formatTime:Y,getNodeTypeLabel:F,getNodeTooltip:V,getNodeColor:R,getStepTypeDescription:j,truncateContent:M,getToolResultContent:K,selectConversation:f,selectStep:v,isCollapsible:y,shouldShowExpandButton:m,getContentForMeasurement:P,getDisplayContent:H,isContentTruncated:Z,truncateContentByHeight:z,truncateText:g,extractPromptParam:b,getToolSpecificInfo:k,getSummaryText:$,getSummaryTooltip:S,handleSubAgentClick:te}),(O,T)=>{const W=ne("a-spin"),ee=ne("a-empty");return C(),E("div",$N,[a.value?(C(),E("div",SN,[d(W,{size:32}),T[0]||(T[0]=A("p",null,"加载中...",-1))])):(C(),E("div",PN,[!i.value||!i.value.steps||i.value.steps.length===0?(C(),E("div",ON,[d(ee,{description:""},{image:ue(()=>[d(ct(YC),{size:48})]),default:ue(()=>[T[1]||(T[1]=A("div",{class:"empty-message"},[A("p",{class:"empty-title"},"无对话数据"),A("p",{class:"empty-description"},"未从当前会话日志中提取到对话数据,请选择其他会话。"),A("p",{class:"empty-hint"},"此文件可能是会话摘要或尚未记录任何交互")],-1))]),_:1})])):i.value?(C(),E("div",_N,[A("h2",TN,we(i.value.title),1),A("div",LN,[(C(!0),E(Ve,null,Ct(u.value,(B,oe)=>{var se;return C(),E("div",{key:B.id,class:L(["timeline-item",[`step-${B.type.toLowerCase().replace("_","-")}`,{selected:((se=s.value)==null?void 0:se.id)===B.id,"has-tool-result":B.toolResult,expanded:ct(r).isExpanded(B.id)}]]),onClick:me=>v(B)},[Y(B.timestamp)?(C(),E("div",IN,we(Y(B.timestamp)),1)):le("",!0),A("div",BN,[A("div",{class:"timeline-dot",style:Ee({backgroundColor:R(B.type)}),title:`${F(B.type)} - ${Y(B.timestamp)}`},[A("span",VN,we(B.originalIndex),1)],12,AN),oe<u.value.length-1?(C(),E("div",xN)):le("",!0)]),A("div",{class:"timeline-content-card","data-step-id":B.id},[A("div",{class:"card-header",onClick:sn(me=>h(B),["stop"])},[A("div",RN,[!ct(r).isExpanded(B.id)&&y(B)?(C(),E(Ve,{key:0},[A("div",zN,[A("span",DN,we(F(B.type)),1)]),d(ct(qn),{content:S(B),position:"tl","background-color":"#3491FA",theme:"light"},{default:ue(()=>[A("span",jN,[B.type==="tool_call"?(C(),E("span",FN,we(B.tool_name||"未知工具"),1)):B.type==="agent_child"?(C(),E("span",HN,we(B.subagent_type||"未知"),1)):le("",!0),T[2]||(T[2]=A("span",{class:"separator"}," | ",-1)),B.type==="tool_call"?(C(),E("span",WN,we(k(B)),1)):B.type==="agent_child"?(C(),E("span",KN,we(b(B.parameters)),1)):le("",!0)])]),_:2},1032,["content"]),_(B)?(C(),E("span",{key:0,class:L(["duration-tag",_(B).class])},we(_(B).text),3)):le("",!0)],64)):(C(),E(Ve,{key:1},[A("div",qN,[!y(B)||ct(r).isExpanded(B.id)?(C(),E("span",{key:0,class:"step-type-tag",title:j(B.type)},we(F(B.type)),9,UN)):le("",!0)]),ct(r).isExpanded(B.id)&&y(B)?(C(),E("span",YN,[B.type==="tool_call"?(C(),E("span",ZN,we(B.tool_name||"未知工具"),1)):B.type==="agent_child"?(C(),E("span",GN,we(B.subagent_type||"未知"),1)):le("",!0)])):le("",!0),_(B)?(C(),E("span",{key:1,class:L(["duration-tag",_(B).class])},we(_(B).text),3)):le("",!0)],64))]),m(B)?(C(),E("div",{key:0,class:L(["expand-icon",{expanded:ct(r).isExpanded(B.id)}]),onClick:sn(me=>ct(r).toggleExpanded(B.id),["stop"])},we(ct(r).isExpanded(B.id)?"▼":"▶"),11,XN)):le("",!0)],8,NN),!y(B)||ct(r).isExpanded(B.id)?(C(),E("div",{key:0,class:L(["card-content",{"content-collapsed":!ct(r).isExpanded(B.id)&&m(B),"content-expanded":ct(r).isExpanded(B.id)}])},[B.type==="user_message"?(C(),E("div",JN,[A("div",{class:"content-text",innerHTML:H(B)},null,8,QN)])):B.type==="assistant_thinking"?(C(),E("div",eR,[T[3]||(T[3]=A("div",{class:"thinking-indicator"},[A("span",null,"思考中...")],-1)),A("div",{class:"content-text",innerHTML:H(B)},null,8,tR)])):B.type==="assistant_message"?(C(),E("div",nR,[A("div",{class:"content-text",innerHTML:H(B)},null,8,lR)])):B.type==="tool_call"?(C(),E("div",oR,[ct(r).isExpanded(B.id)?(C(),E("div",aR,[A("div",rR,[A("span",iR,"工具名称:"+we(B.tool_name||"工具调用"),1),T[4]||(T[4]=A("br",null,null,-1)),T[5]||(T[5]=A("span",{class:"tool-name"},"工具参数:",-1))]),A("div",sR,[A("pre",{innerHTML:N(B,JSON.stringify(B.parameters||{},null,2))},null,8,uR)]),B.toolResult?(C(),E("div",cR,[T[7]||(T[7]=A("div",{class:"connection-line"},null,-1)),A("div",dR,[T[6]||(T[6]=A("div",{class:"result-header"},[A("span",{class:"result-type-tag"},"Tool Result")],-1)),A("div",fR,[A("pre",{innerHTML:X(B,!0)},null,8,pR)])])])):le("",!0)])):le("",!0)])):B.type==="agent_child"?(C(),E("div",vR,[ct(r).isExpanded(B.id)?(C(),E("div",hR,[A("div",mR,[T[8]||(T[8]=A("span",{class:"sub-agent-type"},"子代理类型:",-1)),B.subagent_type&&B.subagent_type!=="未知"?(C(),E("a",{key:0,class:"sub-agent-link",onClick:sn(me=>te(B),["stop"]),title:`点击跳转到 ${B.subagent_type} 的日志文件`},we(B.subagent_type),9,gR)):(C(),E("span",yR,we(B.subagent_type||"未知"),1)),T[9]||(T[9]=A("br",null,null,-1)),T[10]||(T[10]=A("span",{class:"sub-agent-name"},"调用参数:",-1))]),A("div",bR,[A("pre",{innerHTML:N(B,JSON.stringify(B.parameters||{},null,2))},null,8,CR)]),B.toolResult?(C(),E("div",kR,[T[12]||(T[12]=A("div",{class:"connection-line"},null,-1)),A("div",wR,[T[11]||(T[11]=A("div",{class:"result-header"},[A("span",{class:"result-type-tag"},"Sub Agent Result")],-1)),A("div",$R,[A("pre",{innerHTML:X(B,!0)},null,8,SR)])])])):le("",!0)])):le("",!0)])):(C(),E("div",PR,[A("div",{class:"content-text",innerHTML:H(B)},null,8,OR)]))],2)):le("",!0)],8,MN)],10,EN)}),128))])])):le("",!0)]))])}}}),TR=xo(_R,[["__scopeId","data-v-fbd47217"]]),LR={class:"step-detail"},ER={key:0,class:"step-detail-content"},IR={class:"step-info-header"},BR={class:"detail-item"},AR={class:"value"},VR={class:"detail-item"},xR={class:"value"},MR={class:"detail-item"},NR={class:"value"},RR={key:0,class:"detail-item"},zR={class:"value"},DR={key:0,class:"metadata-section"},jR={class:"metadata-grid"},FR={class:"metadata-key"},HR={class:"metadata-value"},WR={class:"content-container"},KR={class:"content-display"},qR={key:0},UR={class:"log-section"},YR=["innerHTML"],ZR={key:0,class:"log-section"},GR=["innerHTML"],XR={key:1},JR=["innerHTML"],QR=Q({__name:"StepDetail",setup(e){const t=hi(),n=p(()=>t.selectedStep),l=p(()=>t.currentFileId),o=c=>c?c.type==="assistant_message"||c.type==="tool_call":!1,r=()=>{if(!n.value||!l.value)return;const c=`/debug.html?fileId=${l.value}&stepId=${n.value.id}&stepType=${n.value.type}`;window.open(c,"_blank")},a=c=>{if(!c)return"";const u=t.searchKeyword;let v=JSON.stringify(c,null,2).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,function(h){let m="json-number";return/^"/.test(h)?/:$/.test(h)?m="json-key":m="json-string":/true|false/.test(h)?m="json-boolean":/null/.test(h)&&(m="json-null"),'<span class="'+m+'">'+h+"</span>"});if(u){const h=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),m=new RegExp(`(${h})`,"gi");v=v.replace(m,'<mark class="search-highlight-keyword">$1</mark>')}return v},i=c=>new Date(c).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),s=c=>typeof c=="object"?JSON.stringify(c,null,2):String(c);return(c,u)=>{const f=ne("a-button"),v=ne("a-card");return C(),E("div",LR,[n.value?(C(),E("div",ER,[d(v,{bordered:!1,class:"step-info-card"},{title:ue(()=>[A("div",IR,[u[1]||(u[1]=A("span",null,"步骤信息",-1)),o(n.value)?(C(),ce(f,{key:0,type:"primary",size:"small",onClick:r,class:"debug-button"},{icon:ue(()=>[d(ct(MM))]),default:ue(()=>[u[0]||(u[0]=ze(" 调试 ",-1))]),_:1})):le("",!0)])]),default:ue(()=>[A("div",BR,[u[2]||(u[2]=A("span",{class:"label"},"步骤ID:",-1)),A("span",AR,we(n.value.id),1)]),A("div",VR,[u[3]||(u[3]=A("span",{class:"label"},"类型:",-1)),A("span",xR,we(n.value.type),1)]),A("div",MR,[u[4]||(u[4]=A("span",{class:"label"},"时间:",-1)),A("span",NR,we(i(n.value.timestamp)),1)]),n.value.tool_name?(C(),E("div",RR,[u[5]||(u[5]=A("span",{class:"label"},"工具名称:",-1)),A("span",zR,we(n.value.tool_name),1)])):le("",!0)]),_:1}),n.value.metadata&&Object.keys(n.value.metadata).length>0?(C(),E("div",DR,[u[6]||(u[6]=A("h4",null,"元数据",-1)),A("div",jR,[(C(!0),E(Ve,null,Ct(Object.entries(n.value.metadata),([h,m])=>(C(),E("div",{key:h,class:"metadata-item"},[A("span",FR,we(h)+":",1),A("span",HR,we(s(m)),1)]))),128))])])):le("",!0),d(v,{title:"完整日志",bordered:!1,class:"log-card"},{default:ue(()=>[A("div",WR,[A("div",KR,[n.value.type==="tool_call"?(C(),E("div",qR,[A("div",UR,[u[7]||(u[7]=A("h5",{class:"log-section-title"},"Tool_Use 日志",-1)),A("pre",{class:"json-content",innerHTML:a(n.value.rawLogEntry||{})},null,8,YR)]),n.value.toolResult?(C(),E("div",ZR,[u[8]||(u[8]=A("h5",{class:"log-section-title"},"Tool_Result 日志",-1)),A("pre",{class:"json-content",innerHTML:a(n.value.toolResult.rawLogEntry||{})},null,8,GR)])):le("",!0)])):(C(),E("div",XR,[A("pre",{class:"json-content",innerHTML:a(n.value.rawLogEntry||{})},null,8,JR)]))])])]),_:1})])):le("",!0)])}}}),ez=xo(QR,[["__scopeId","data-v-a56f8487"]]),tz={class:"search-panel"},nz={class:"search-header"},lz={key:0,class:"search-summary"},oz={class:"search-content"},az={key:0,class:"loading-container"},rz={key:1,class:"empty-state"},iz={key:2,class:"results-container"},sz={class:"file-results"},uz=["onClick"],cz={class:"result-header"},dz={class:"step-index"},fz={class:"step-time"},pz={class:"result-content"},vz=["innerHTML"],hz={class:"matched-field"},mz={key:3,class:"initial-state"},gz=Q({__name:"SearchPanel",setup(e){const t=hi(),n=x(""),l=x(!1),o=x([]),r=x([]),a=p(()=>o.value.reduce((y,g)=>y+g.resultCount,0)),i=async y=>{if(!y.trim()){Oo.warning("请输入搜索关键字");return}l.value=!0,r.value=[];try{o.value=await t.performSearch(y.trim()),o.value.length>0&&(r.value=[o.value[0].fileId])}catch(g){console.error("搜索失败:",g),Oo.error("搜索失败,请重试")}finally{l.value=!1}},s=()=>{n.value="",o.value=[],r.value=[],t.searchKeyword=""},c=async y=>{try{y.fileId!==t.currentFileId&&await t.loadFile(y.fileId),setTimeout(()=>{var b,w;let g=(b=t.currentConversation)==null?void 0:b.steps.find(k=>k.id===y.stepId);if(g&&(g.type==="tool_result"||g.type==="agent_child_result")){const k=(w=t.currentConversation)==null?void 0:w.steps.find($=>($.type==="tool_call"||$.type==="agent_child")&&$.tool_use_id?$.tool_use_id===g.tool_use_id:!1);k?g=k:console.warn(`无法找到对应的父节点,${g.type} id:`,g.id)}g&&(t.selectStep(g),t.ensureStepExpanded(g.id),setTimeout(()=>{const k=document.querySelector('.detail-tabs [data-key="detail"]');k&&k.click()},100))},200)}catch(g){console.error("跳转失败:",g),Oo.error("跳转失败,请重试")}},u=y=>{if(!n.value)return y;const g=n.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),b=new RegExp(`(${g})`,"gi");return y.replace(b,'<mark class="search-highlight">$1</mark>')},f=(y,g)=>{var w;return y==="tool_result"&&g&&g.tool_use_id&&((w=t.currentConversation)!=null&&w.steps.find($=>$.type==="agent_child"&&$.tool_use_id===g.tool_use_id))&&(y="agent_child_result"),{user_message:"#1890ff",assistant_thinking:"#faad14",assistant_message:"#52c41a",tool_call:"#722ed1",tool_result:"#722ed1",agent_child:"#eb2f96",agent_child_result:"cyan",agent_end:"cyan",sub_agent:"cyan"}[y]||"gray"},v=(y,g)=>{var k;return y==="tool_result"&&g&&g.tool_use_id&&((k=t.currentConversation)!=null&&k.steps.find(S=>S.type==="agent_child"&&S.tool_use_id===g.tool_use_id))&&(y="agent_child_result"),{user_message:"User_Query",assistant_thinking:"Agent_Thinking",assistant_message:"Agent_Message",tool_call:"Tool_Use",tool_result:"Tool_Result",agent_child:"Sub_Agent",agent_child_result:"Sub_Agent_Result",agent_end:"Sub_Agent",sub_agent:"Sub_Agent"}[y]||y},h=y=>new Date(y).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"});let m=null;return Ie(n,y=>{m&&clearTimeout(m),y.trim()?m=setTimeout(()=>{i(y)},300):s()}),(y,g)=>{const b=ne("a-input-search"),w=ne("a-spin"),k=ne("a-empty"),$=ne("a-tag"),S=ne("a-collapse-item"),P=ne("a-collapse");return C(),E("div",tz,[A("div",nz,[d(b,{modelValue:n.value,"onUpdate:modelValue":g[0]||(g[0]=_=>n.value=_),placeholder:"请输入搜索关键字",loading:l.value,onSearch:i,onClear:s,class:"search-input"},null,8,["modelValue","loading"]),o.value.length>0?(C(),E("div",lz," 找到 "+we(a.value)+" 个结果,分布在 "+we(o.value.length)+" 个文件中 ",1)):le("",!0)]),A("div",oz,[l.value?(C(),E("div",az,[d(w,{size:"large"}),g[2]||(g[2]=A("p",null,"正在搜索中...",-1))])):!l.value&&n.value&&o.value.length===0?(C(),E("div",rz,[d(k,{description:"未找到匹配的结果"})])):o.value.length>0?(C(),E("div",iz,[d(P,{"active-key":r.value,"onUpdate:activeKey":g[1]||(g[1]=_=>r.value=_),bordered:!1,class:"search-collapse"},{default:ue(()=>[(C(!0),E(Ve,null,Ct(o.value,_=>(C(),ce(S,{key:_.fileId,header:`${_.fileName} (${_.resultCount}个结果)`,class:"file-result-item"},{default:ue(()=>[A("div",sz,[(C(!0),E(Ve,null,Ct(_.results,(I,D)=>(C(),E("div",{key:I.stepId,class:"result-item",onClick:H=>c(I)},[A("div",cz,[d($,{color:f(I.stepType,I),size:"small",class:"step-type-tag"},{default:ue(()=>[ze(we(v(I.stepType,I)),1)]),_:2},1032,["color"]),A("span",dz,"#"+we(I.stepIndex),1),A("span",fz,we(h(I.timestamp)),1)]),A("div",pz,[A("div",{class:"matched-text",innerHTML:u(I.matchedContent)},null,8,vz),A("div",hz,"匹配字段: "+we(I.matchedField),1)])],8,uz))),128))])]),_:2},1032,["header"]))),128))]),_:1},8,["active-key"])])):(C(),E("div",mz,[d(k,{description:"请输入关键字开始搜索"})]))])])}}}),yz=xo(gz,[["__scopeId","data-v-ffbd5663"]]),bz={class:"detail-panel"},Cz={class:"detail-content"},kz=Q({__name:"DetailPanel",setup(e){return(t,n)=>{const l=ne("a-tab-pane"),o=ne("a-tabs");return C(),E("div",bz,[A("div",Cz,[d(o,{"default-active-key":"search",class:"detail-tabs"},{default:ue(()=>[d(l,{key:"search",title:"全局搜索"},{default:ue(()=>[d(yz)]),_:1}),d(l,{key:"detail",title:"步骤详情"},{default:ue(()=>[d(ez)]),_:1})]),_:1})])])}}}),wz={class:"main-layout"},$z={class:"header-content"},Sz={class:"header-actions"},Pz={class:"content-wrapper"},Oz={class:"timeline-section"},_z=Q({__name:"MainLayout",setup(e){const t=hi(),n=x(!1),l=x(500),o=x(360),r=x(!1),a=x(!1),i=x(0),s=x(0),c=async()=>{var g;try{const b=new URL(window.location.href);if(b.searchParams.delete("project"),b.searchParams.delete("file"),b.searchParams.delete("step"),b.searchParams.delete("sessionid"),t.currentFileId){b.searchParams.set("file",t.currentFileId),t.selectedStep&&b.searchParams.set("step",t.selectedStep.id);let k=null;(g=t.currentProject)!=null&&g.projectDir?k=t.currentProject.projectDir:k=new URL(window.location.href).searchParams.get("project"),k&&b.searchParams.set("project",k)}const w=b.toString();if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(w);else{const k=document.createElement("textarea");k.value=w,k.style.position="fixed",k.style.left="-999999px",k.style.top="-999999px",document.body.appendChild(k),k.focus(),k.select();try{document.execCommand("copy")}finally{document.body.removeChild(k)}}Oo.success("分享链接已复制到剪贴板")}catch(b){console.error("复制链接失败:",b),Oo.error("复制链接失败,请重试")}},u=g=>{r.value=!0,i.value=g.clientX,s.value=l.value,document.addEventListener("mousemove",v),document.addEventListener("mouseup",m),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},f=g=>{a.value=!0,i.value=g.clientX,s.value=o.value,document.addEventListener("mousemove",h),document.addEventListener("mouseup",y),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},v=g=>{if(!r.value)return;const b=i.value-g.clientX,w=s.value+b,k=300,$=window.innerWidth*.6;l.value=Math.max(k,Math.min($,w))},h=g=>{if(!a.value)return;const b=g.clientX-i.value,w=s.value+b,k=200,$=window.innerWidth*.5;o.value=Math.max(k,Math.min($,w))},m=()=>{r.value=!1,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect=""},y=()=>{a.value=!1,document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};return lt(()=>{t.initialize()}),Xt(()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",m),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",y)}),(g,b)=>{const w=ne("a-button"),k=ne("a-layout-header"),$=ne("a-layout-sider"),S=ne("a-layout-content"),P=ne("a-layout");return C(),E("div",wz,[d(P,{class:"layout"},{default:ue(()=>[d(k,{class:"header"},{default:ue(()=>[A("div",$z,[b[1]||(b[1]=A("h1",{class:"title"},"Claude Code Debug",-1)),A("div",Sz,[d(w,{type:"outline",size:"small",disabled:!ct(t).currentFileId,onClick:c,title:"复制分享链接"},{icon:ue(()=>[d(ct(BM))]),default:ue(()=>[b[0]||(b[0]=ze(" 复制链接 ",-1))]),_:1},8,["disabled"])])])]),_:1}),d(P,{class:"body"},{default:ue(()=>[d($,{width:o.value,collapsed:!1,collapsible:!1,class:"sidebar"},{default:ue(()=>[d(wN)]),_:1},8,["width"]),A("div",{class:"resize-handle resize-handle-left",onMousedown:f},null,32),d(S,{class:"main-content"},{default:ue(()=>[A("div",Pz,[A("div",Oz,[d(TR)]),n.value?le("",!0):(C(),E("div",{key:0,class:"resize-handle",onMousedown:u},null,32)),n.value?le("",!0):(C(),E("div",{key:1,class:"detail-section",style:Ee({width:l.value+"px"})},[d(kz)],4))])]),_:1})]),_:1})]),_:1})])}}}),Tz=xo(_z,[["__scopeId","data-v-9f52bc01"]]),Lz={class:"debug-page"},Ez={class:"header"},Iz={class:"params-info"},Bz={class:"param-item"},Az={class:"value"},Vz={class:"param-item"},xz={class:"value"},Mz={class:"param-item"},Nz={class:"value"},Rz={class:"param-item"},zz={class:"value"},Dz={class:"content"},jz={key:0,class:"loading"},Fz={key:1,class:"error"},Hz={key:2,class:"llm-log-container"},Wz={class:"main-layout"},Kz={class:"left-panel"},qz={class:"section"},Uz={class:"user-messages"},Yz={class:"user-messages-header"},Zz={class:"messages-container"},Gz={class:"message-header"},Xz=["onUpdate:modelValue"],Jz=["onClick"],Qz={key:0,class:"content-list"},eD={class:"content-header"},tD={class:"content-type"},nD=["onClick"],lD=["onUpdate:modelValue"],oD=["value","onInput"],aD=["onUpdate:modelValue"],rD=["onClick"],iD={key:1,class:"single-content"},sD=["onUpdate:modelValue"],uD=["onClick"],cD={class:"right-panel"},dD={class:"section"},fD={class:"response-tabs"},pD={class:"tab-headers"},vD=["onClick"],hD=["onClick"],mD={class:"tab-content"},gD={key:0,class:"response-content"},yD=["innerHTML"],bD={class:"actions"},CD=["disabled"],kD=["disabled"],wD={key:3,class:"no-data"},$D=Q({__name:"DebugPage",setup(e){const t=oV(),n=(()=>{try{return new URLSearchParams(window.location.search).get("debug")==="1"||window.localStorage.getItem("CCDEBUG_DEBUG")==="1"}catch{return!1}})(),l=(...z)=>{n&&console.warn(...z)},o=x(null),r=x(""),a=x(""),i=x(""),s=x(""),c=x(!1),u=x(""),f=x(!1),v=x(!1),h=x([]),m=x({});p(()=>m.value?{...m.value,body:{...m.value.body,messages:h.value}}:{});const y=x([]),g=x(0);function b(){return{fileId:t.query.fileId,stepId:t.query.stepId,stepType:t.query.stepType}}function w(z){return z?JSON.stringify(z,null,2).replace(/(".*?")\s*:/g,'<span class="json-key">$1</span>:').replace(/:\s*(".*?")/g,': <span class="json-string">$1</span>').replace(/:\s*(true|false)/g,': <span class="json-boolean">$1</span>').replace(/:\s*(null)/g,': <span class="json-null">$1</span>').replace(/:\s*(\d+\.?\d*)/g,': <span class="json-number">$1</span>'):""}function k(z){var F,V;if(!z)return;const Y=((V=(F=z.request)==null?void 0:F.body)==null?void 0:V.messages)||[];h.value=Y.map(R=>({role:R.role||"user",content:(typeof R.content=="string",R.content)})),m.value=JSON.parse(JSON.stringify(z.request||{})),y.value=[{title:"原始响应",data:z.response||{}}],g.value=0}function $(){h.value.push({role:"user",content:""})}function S(z){h.value.splice(z,1)}function P(z){const Y=h.value[z];Array.isArray(Y.content)||(Y.content=[{type:"text",text:Y.content||""}]),Y.content.push({type:"text",text:""})}function _(z,Y){const F=h.value[z];Array.isArray(F.content)&&(F.content.splice(Y,1),F.content.length===1&&(F.content=F.content[0].text))}function I(z){const Y=h.value[z];Array.isArray(Y.content)||(Y.content=[{type:"text",text:Y.content||""}])}function D(){if(!o.value){alert("暂无日志数据");return}const z=window.open("","_blank","width=1200,height=800,scrollbars=yes,resizable=yes");if(z){const Y=JSON.stringify(o.value.request,null,2),R=["<!DOCTYPE html>","<html>","<head>"," <title>完整LLM请求日志</title>"," <style>"," body { ",' font-family: "Monaco", "Menlo", "Consolas", "Courier New", monospace; '," margin: 20px; "," background: #f8f9fa; "," line-height: 1.5;"," }"," .container {"," max-width: 100%;"," background: white;"," border-radius: 8px;"," box-shadow: 0 2px 10px rgba(0,0,0,0.1);"," overflow: hidden;"," }"," .header {"," background: #2c3e50;"," color: white;"," padding: 15px 20px;"," margin: 0;"," font-size: 18px;"," font-weight: 500;"," }"," pre { "," background: #ffffff; "," padding: 20px; "," margin: 0;"," overflow: auto; "," white-space: pre-wrap; "," word-break: break-all;"," font-size: 13px;"," line-height: 1.6;"," }"," "," /* JSON语法高亮样式 */"," .json-key {"," color: #0066cc;"," font-weight: 600;"," }"," .json-string {"," color: #22863a;"," }"," .json-number {"," color: #005cc5;"," }"," .json-boolean {"," color: #d73a49;"," font-weight: 600;"," }"," .json-null {"," color: #6f42c1;"," font-weight: 600;"," }"," "," /* 复制按钮 */"," .copy-btn {"," position: fixed;"," top: 20px;"," right: 20px;"," background: #28a745;"," color: white;"," border: none;"," padding: 10px 15px;"," border-radius: 5px;"," cursor: pointer;"," font-size: 14px;"," z-index: 1000;"," }"," .copy-btn:hover {"," background: #218838;"," }"," .copy-btn:active {"," background: #1e7e34;"," }"," </style>","</head>","<body>",' <button class="copy-btn" onclick="copyToClipboard()">复制JSON</button>',' <div class="container">',' <h1 class="header">完整LLM请求日志</h1>',' <pre id="json-content">'+(j=>j.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,M=>{let K="json-number";return/^"/.test(M)?/:$/.test(M)?K="json-key":K="json-string":/true|false/.test(M)?K="json-boolean":/null/.test(M)&&(K="json-null"),'<span class="'+K+'">'+M+"</span>"}))(Y)+"</pre>"," </div>"," "," <script>"," function copyToClipboard() {"," const jsonText = "+JSON.stringify(Y)+";"," navigator.clipboard.writeText(jsonText).then(() => {",' const btn = document.querySelector(".copy-btn");'," const originalText = btn.textContent;",' btn.textContent = "已复制!";',' btn.style.background = "#17a2b8";'," setTimeout(() => {"," btn.textContent = originalText;",' btn.style.background = "#28a745";'," }, 2000);"," }).catch(err => {",' console.error("复制失败:", err);',' alert("复制失败,请手动选择文本复制");'," });"," }"," <\/script>","</body>","</html>"].join(`
|
|
41
41
|
`);z.document.write(R),z.document.close()}}function H(z){z!==0&&(y.value.splice(z,1),g.value>=z&&(g.value=Math.max(0,g.value-1)))}async function N(){if(!s.value){alert("缺少消息ID");return}f.value=!0;try{const z={...m.value,body:{...m.value.body,messages:h.value}};if(!(await fetch(`/api/llm-requests/${s.value}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)})).ok)throw new Error("保存失败");alert("保存成功")}catch(z){console.error("保存失败:",z),alert("保存失败: "+z.message)}finally{f.value=!1}}async function X(){v.value=!0;try{const z=o.value.request,Y=await(await fetch("/api/llm-request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)})).json();if(!Y.success)throw new Error(`请求失败:${Y.error}`);const V={title:`请求 ${y.value.length}`,data:Y.data};y.value.push(V),g.value=y.value.length-1}catch(z){console.error("发送请求失败:",z),alert("发送请求失败: "+z.message),y.value.length>0&&(y.value[g.value].data={success:!1,error:z.message})}finally{v.value=!1}}async function Z(){var Y,F;const z=b();if(!z.fileId||!z.stepId){u.value="缺少必要的参数";return}r.value=z.fileId,a.value=z.stepId,i.value=z.stepType||"",c.value=!0,u.value="";try{let V=z.messageId||z.stepId;if(!z.messageId)try{const j=await fetch(`/api/conversations/${z.fileId}/steps/${z.stepId}`);if(j.ok){const M=await j.json();M.success&&M.data&&((F=(Y=M.data.rawLogEntry)==null?void 0:Y.message)!=null&&F.id)&&(V=M.data.rawLogEntry.message.id)}}catch(j){l("无法获取步骤信息,使用stepId作为messageId:",j)}s.value=V;const R=await(await fetch(`/api/conversations/${z.fileId}/llm-logs/${V}`)).json();if(!R.success)throw new Error(R.error);o.value=R.data,k(R.data)}catch(V){console.error("加载LLM日志失败:",V),u.value=V.message||"加载LLM日志失败"}finally{c.value=!1}}return lt(()=>{Z()}),(z,Y)=>{const F=ne("a-alert");return C(),E("div",Lz,[A("div",Ez,[Y[4]||(Y[4]=A("h1",null,"LLM请求调试",-1)),A("div",Iz,[A("div",Bz,[Y[0]||(Y[0]=A("span",{class:"label"},"文件ID:",-1)),A("span",Az,we(r.value||"-"),1)]),A("div",Vz,[Y[1]||(Y[1]=A("span",{class:"label"},"步骤ID:",-1)),A("span",xz,we(a.value||"-"),1)]),A("div",Mz,[Y[2]||(Y[2]=A("span",{class:"label"},"步骤类型:",-1)),A("span",Nz,we(i.value||"-"),1)]),A("div",Rz,[Y[3]||(Y[3]=A("span",{class:"label"},"消息ID:",-1)),A("span",zz,we(s.value||"-"),1)])])]),A("div",Dz,[c.value?(C(),E("div",jz," 正在加载LLM请求日志... ")):u.value?(C(),E("div",Fz,[ze(we(u.value)+" ",1),A("button",{onClick:Z,class:"retry-button"},"重试")])):o.value?(C(),E("div",Hz,[A("div",Wz,[A("div",Kz,[A("div",qz,[Y[6]||(Y[6]=A("div",{class:"section-header"},[A("h2",null,"LLM请求数据")],-1)),A("div",Uz,[A("div",Yz,[d(F,{title:"您可以修改请求数据,并重新发送请求,以便反复验证LLM回复",type:"info","show-icon":""},{action:ue(()=>[A("button",{onClick:$,class:"add-message-btn-top"},"添加消息")]),_:1})]),A("div",Zz,[(C(!0),E(Ve,null,Ct(h.value,(V,R)=>(C(),E("div",{key:R,class:"message-item"},[A("div",Gz,[_n(A("select",{"onUpdate:modelValue":j=>V.role=j,class:"role-select"},[...Y[5]||(Y[5]=[A("option",{value:"user"},"user",-1),A("option",{value:"assistant"},"assistant",-1),A("option",{value:"system"},"system",-1)])],8,Xz),[[w4,V.role]]),A("button",{onClick:j=>S(R),class:"delete-btn"},"删除",8,Jz)]),Array.isArray(V.content)?(C(),E("div",Qz,[(C(!0),E(Ve,null,Ct(V.content,(j,M)=>(C(),E("div",{key:M,class:"content-item"},[A("div",eD,[A("span",tD,we(j.type||"text"),1),A("button",{onClick:K=>_(R,M),class:"delete-content-btn"},"删除内容",8,nD)]),j.type==="text"?_n((C(),E("textarea",{key:0,"onUpdate:modelValue":K=>j.text=K,class:"content-textarea",placeholder:"请输入工具使用的内容..."},null,8,lD)),[[Fc,j.text]]):le("",!0),j.type==="tool_use"?(C(),E("textarea",{key:1,value:JSON.stringify(j.input,null,2),onInput:K=>{try{j.input=JSON.parse(K.target.value)}catch{j.input=K.target.value}},class:"content-textarea-tool_use",placeholder:"输入内容..."},null,40,oD)):le("",!0),j.type==="tool_result"?_n((C(),E("textarea",{key:2,"onUpdate:modelValue":K=>j.content=K,class:"content-textarea-tool_use",placeholder:"输入内容..."},null,8,aD)),[[Fc,j.content]]):le("",!0)]))),128)),A("button",{onClick:j=>P(R),class:"add-content-btn"},"添加内容",8,rD)])):(C(),E("div",iD,[_n(A("textarea",{"onUpdate:modelValue":j=>V.content=j,class:"message-content",rows:"4",placeholder:"输入消息内容..."},null,8,sD),[[Fc,V.content]]),A("button",{onClick:j=>I(R),class:"convert-btn"},"转换为多内容",8,uD)]))]))),128))])])])]),A("div",cD,[A("div",dD,[Y[7]||(Y[7]=A("div",{class:"section-header"},[A("h2",null,"LLM响应数据")],-1)),A("div",fD,[A("div",pD,[(C(!0),E(Ve,null,Ct(y.value,(V,R)=>(C(),E("div",{key:R,class:L(["tab-header",{active:g.value===R}]),onClick:j=>g.value=R},[ze(we(V.title)+" ",1),R>0?(C(),E("button",{key:0,onClick:sn(j=>H(R),["stop"]),class:"close-tab-btn"},"×",8,hD)):le("",!0)],10,vD))),128))]),A("div",mD,[y.value[g.value]?(C(),E("div",gD,[A("pre",{class:"json-display",innerHTML:w(y.value[g.value].data)},null,8,yD)])):le("",!0)])])])])]),A("div",bD,[A("button",{onClick:N,disabled:f.value,class:"save-button"},we(f.value?"保存中...":"保存"),9,CD),A("button",{onClick:X,disabled:v.value,class:"send-button"},we(v.value?"发送中...":"单次请求"),9,kD),A("button",{onClick:D,class:"view-log-button"}," 查看请求完整数据 ")])])):(C(),E("div",wD," 暂无数据 "))])])}}}),Uy=xo($D,[["__scopeId","data-v-d1788e3c"]]),SD=[{path:"/",name:"Home",component:Tz},{path:"/debug",name:"Debug",component:Uy},{path:"/debug.html",name:"DebugHtml",component:Uy}],PD=lV({history:xA(),routes:SD}),OD={id:"app"},_D=Q({__name:"App",setup(e){return(t,n)=>{const l=ne("router-view");return C(),E("div",OD,[d(l)])}}}),Cc=Yv(_D),TD=L4();Cc.use(TD);Cc.use(XB);Cc.use(PD);Cc.mount("#app");
|
|
42
|
-
//# sourceMappingURL=index-
|
|
42
|
+
//# sourceMappingURL=index-xbz65MKz.js.map
|