@xysfe/bug-tap 0.1.0 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 与语义化版本。
4
4
 
5
+ ## [0.1.2] - 2026-11-19
6
+
7
+ ### Added
8
+
9
+ - `ext.libVersion`:与 `xys-util` 的 `RealTimeReport` 对齐,日志平台可按该字段区分上报来源。与 `sdkVersion` 同值,后者保持不变以兼容已有查询。
10
+
11
+ ## [0.1.1] - 2026-11-18
12
+
13
+ ### Changed
14
+
15
+ - 图片上传的默认 `bizId` 从 `1008` 调整为 `1086`。上传接口按业务类型区分存储,旧默认值会把截图写进错误的业务桶。仍可通过 `upload.bizId` 覆盖。
16
+
5
17
  ## [0.1.0] - 2026-11-18
6
18
 
7
19
  ### Added
package/README.md CHANGED
@@ -150,7 +150,7 @@ interface BugTapConfig {
150
150
  upload?: {
151
151
  enabled?: boolean; // 默认 true,提交前把截图上传成 URL
152
152
  url?: string; // 默认 /platform/file/uploadPicture
153
- bizId?: string; // 默认 '1008',上传接口要求的业务类型
153
+ bizId?: string; // 默认 '1086',上传接口要求的业务类型
154
154
  timeoutMs?: number; // 默认 30000
155
155
  };
156
156
  }
@@ -1,4 +1,4 @@
1
- var BugTapBundle=(function(){"use strict";/*! @xysfe/bug-tap v0.1.0 | MIT *//*!
1
+ var BugTapBundle=(function(){"use strict";/*! @xysfe/bug-tap v0.1.2 | MIT *//*!
2
2
  * html2canvas-pro 1.6.7 <https://yorickshan.github.io/html2canvas-pro/>
3
3
  * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
4
4
  * Released under MIT License
@@ -1,2 +1,2 @@
1
- "use strict";/*! @xysfe/bug-tap v0.1.0 | MIT */Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function g(){if(typeof window=="undefined")return null;const e=window.BugTap;return e&&typeof e.captureException=="function"?e:null}function l(e){if(!e||typeof e!="object")return;const t=e,r=typeof t.fullPath=="string"?t.fullPath:t.path;return typeof r=="string"?r.slice(0,500):void 0}function v(e){if(!e||typeof e!="object")return;const t=e.name;return typeof t=="string"?t.slice(0,100):void 0}function b(){try{return`${location.pathname}${location.search}${location.hash}`.slice(0,500)}catch(e){return}}function E(e){var f,n,c,i,u,d,p,s,y,h;if(!e||typeof e!="object")return;const t=e,r=(n=(f=t.$)==null?void 0:f.type)!=null?n:t.type,o=t.$options,a=(h=(y=(p=(u=(i=(c=o==null?void 0:o.name)!=null?c:o==null?void 0:o.__name)!=null?i:r==null?void 0:r.name)!=null?u:r==null?void 0:r.__name)!=null?p:(d=t.type)==null?void 0:d.name)!=null?y:(s=t.type)==null?void 0:s.__name)!=null?h:o==null?void 0:o._componentTag;return typeof a=="string"&&a?a:void 0}function _(e){if(!(!e||typeof e!="object"))return l(e.$route)}function P(e){var t;return(t=_(e))!=null?t:b()}function m(e){return{install(t,r={}){const o=r.client||e||g();if(!o)return()=>{};const a=t.config,f=[];if(r.captureErrors!==!1&&a){const n=a.errorHandler,c=(i,u,d)=>{try{o.captureException(i,{source:"vue",info:d,component:E(u),route:P(u)})}catch(p){}typeof n=="function"&&n(i,u,d)};a.errorHandler=c,f.push(()=>{a.errorHandler===c&&(a.errorHandler=n||null)})}if(r.router&&typeof r.router.afterEach=="function"){try{o.disableRouteCapture()}catch(c){}const n=r.router.afterEach((c,i,u)=>{try{if(u){o.captureException(u instanceof Error?u:new Error(String(u)),{source:"vue-router",from:l(i),to:l(c)});return}o.addBreadcrumb({type:"route",from:l(i),to:l(c),data:{name:v(c),source:"vue-router"}})}catch(d){}});f.push(()=>{typeof n=="function"&&n()})}return()=>{f.forEach(n=>{try{n()}catch(c){}})}}}}const $=m();exports.createVuePlugin=m;exports.default=$;
1
+ "use strict";/*! @xysfe/bug-tap v0.1.2 | MIT */Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function g(){if(typeof window=="undefined")return null;const e=window.BugTap;return e&&typeof e.captureException=="function"?e:null}function l(e){if(!e||typeof e!="object")return;const t=e,r=typeof t.fullPath=="string"?t.fullPath:t.path;return typeof r=="string"?r.slice(0,500):void 0}function v(e){if(!e||typeof e!="object")return;const t=e.name;return typeof t=="string"?t.slice(0,100):void 0}function b(){try{return`${location.pathname}${location.search}${location.hash}`.slice(0,500)}catch(e){return}}function E(e){var f,n,c,i,u,d,p,s,y,h;if(!e||typeof e!="object")return;const t=e,r=(n=(f=t.$)==null?void 0:f.type)!=null?n:t.type,o=t.$options,a=(h=(y=(p=(u=(i=(c=o==null?void 0:o.name)!=null?c:o==null?void 0:o.__name)!=null?i:r==null?void 0:r.name)!=null?u:r==null?void 0:r.__name)!=null?p:(d=t.type)==null?void 0:d.name)!=null?y:(s=t.type)==null?void 0:s.__name)!=null?h:o==null?void 0:o._componentTag;return typeof a=="string"&&a?a:void 0}function _(e){if(!(!e||typeof e!="object"))return l(e.$route)}function P(e){var t;return(t=_(e))!=null?t:b()}function m(e){return{install(t,r={}){const o=r.client||e||g();if(!o)return()=>{};const a=t.config,f=[];if(r.captureErrors!==!1&&a){const n=a.errorHandler,c=(i,u,d)=>{try{o.captureException(i,{source:"vue",info:d,component:E(u),route:P(u)})}catch(p){}typeof n=="function"&&n(i,u,d)};a.errorHandler=c,f.push(()=>{a.errorHandler===c&&(a.errorHandler=n||null)})}if(r.router&&typeof r.router.afterEach=="function"){try{o.disableRouteCapture()}catch(c){}const n=r.router.afterEach((c,i,u)=>{try{if(u){o.captureException(u instanceof Error?u:new Error(String(u)),{source:"vue-router",from:l(i),to:l(c)});return}o.addBreadcrumb({type:"route",from:l(i),to:l(c),data:{name:v(c),source:"vue-router"}})}catch(d){}});f.push(()=>{typeof n=="function"&&n()})}return()=>{f.forEach(n=>{try{n()}catch(c){}})}}}}const $=m();exports.createVuePlugin=m;exports.default=$;
2
2
  //# sourceMappingURL=bug-tap-vue.cjs.map
@@ -1,4 +1,4 @@
1
- /*! @xysfe/bug-tap v0.1.0 | MIT */
1
+ /*! @xysfe/bug-tap v0.1.2 | MIT */
2
2
  function m() {
3
3
  if (typeof window == "undefined") return null;
4
4
  const t = window.BugTap;
@@ -1,2 +1,2 @@
1
- var BugTapBundle=(function(){"use strict";/*! @xysfe/bug-tap v0.1.0 | MIT */function g(){if(typeof window=="undefined")return null;const t=window.BugTap;return t&&typeof t.captureException=="function"?t:null}function p(t){if(!t||typeof t!="object")return;const e=t,r=typeof e.fullPath=="string"?e.fullPath:e.path;return typeof r=="string"?r.slice(0,500):void 0}function v(t){if(!t||typeof t!="object")return;const e=t.name;return typeof e=="string"?e.slice(0,100):void 0}function w(){try{return`${location.pathname}${location.search}${location.hash}`.slice(0,500)}catch(t){return}}function E(t){var a,o,c,i,u,d,s,y,h,m;if(!t||typeof t!="object")return;const e=t,r=(o=(a=e.$)==null?void 0:a.type)!=null?o:e.type,n=e.$options,f=(m=(h=(s=(u=(i=(c=n==null?void 0:n.name)!=null?c:n==null?void 0:n.__name)!=null?i:r==null?void 0:r.name)!=null?u:r==null?void 0:r.__name)!=null?s:(d=e.type)==null?void 0:d.name)!=null?h:(y=e.type)==null?void 0:y.__name)!=null?m:n==null?void 0:n._componentTag;return typeof f=="string"&&f?f:void 0}function b(t){if(!(!t||typeof t!="object"))return p(t.$route)}function _(t){var e;return(e=b(t))!=null?e:w()}function $(t){return{install(e,r={}){const n=r.client||t||g();if(!n)return()=>{};const f=e.config,a=[];if(r.captureErrors!==!1&&f){const o=f.errorHandler,c=(i,u,d)=>{try{n.captureException(i,{source:"vue",info:d,component:E(u),route:_(u)})}catch(s){}typeof o=="function"&&o(i,u,d)};f.errorHandler=c,a.push(()=>{f.errorHandler===c&&(f.errorHandler=o||null)})}if(r.router&&typeof r.router.afterEach=="function"){try{n.disableRouteCapture()}catch(c){}const o=r.router.afterEach((c,i,u)=>{try{if(u){n.captureException(u instanceof Error?u:new Error(String(u)),{source:"vue-router",from:p(i),to:p(c)});return}n.addBreadcrumb({type:"route",from:p(i),to:p(c),data:{name:v(c),source:"vue-router"}})}catch(d){}});a.push(()=>{typeof o=="function"&&o()})}return()=>{a.forEach(o=>{try{o()}catch(c){}})}}}}const l=$();return typeof window!="undefined"&&(window.BugTapVue=l),l})();
1
+ var BugTapBundle=(function(){"use strict";/*! @xysfe/bug-tap v0.1.2 | MIT */function g(){if(typeof window=="undefined")return null;const t=window.BugTap;return t&&typeof t.captureException=="function"?t:null}function p(t){if(!t||typeof t!="object")return;const e=t,r=typeof e.fullPath=="string"?e.fullPath:e.path;return typeof r=="string"?r.slice(0,500):void 0}function v(t){if(!t||typeof t!="object")return;const e=t.name;return typeof e=="string"?e.slice(0,100):void 0}function w(){try{return`${location.pathname}${location.search}${location.hash}`.slice(0,500)}catch(t){return}}function E(t){var a,o,c,i,u,d,s,y,h,m;if(!t||typeof t!="object")return;const e=t,r=(o=(a=e.$)==null?void 0:a.type)!=null?o:e.type,n=e.$options,f=(m=(h=(s=(u=(i=(c=n==null?void 0:n.name)!=null?c:n==null?void 0:n.__name)!=null?i:r==null?void 0:r.name)!=null?u:r==null?void 0:r.__name)!=null?s:(d=e.type)==null?void 0:d.name)!=null?h:(y=e.type)==null?void 0:y.__name)!=null?m:n==null?void 0:n._componentTag;return typeof f=="string"&&f?f:void 0}function b(t){if(!(!t||typeof t!="object"))return p(t.$route)}function _(t){var e;return(e=b(t))!=null?e:w()}function $(t){return{install(e,r={}){const n=r.client||t||g();if(!n)return()=>{};const f=e.config,a=[];if(r.captureErrors!==!1&&f){const o=f.errorHandler,c=(i,u,d)=>{try{n.captureException(i,{source:"vue",info:d,component:E(u),route:_(u)})}catch(s){}typeof o=="function"&&o(i,u,d)};f.errorHandler=c,a.push(()=>{f.errorHandler===c&&(f.errorHandler=o||null)})}if(r.router&&typeof r.router.afterEach=="function"){try{n.disableRouteCapture()}catch(c){}const o=r.router.afterEach((c,i,u)=>{try{if(u){n.captureException(u instanceof Error?u:new Error(String(u)),{source:"vue-router",from:p(i),to:p(c)});return}n.addBreadcrumb({type:"route",from:p(i),to:p(c),data:{name:v(c),source:"vue-router"}})}catch(d){}});a.push(()=>{typeof o=="function"&&o()})}return()=>{a.forEach(o=>{try{o()}catch(c){}})}}}}const l=$();return typeof window!="undefined"&&(window.BugTapVue=l),l})();
2
2
  //# sourceMappingURL=bug-tap-vue.min.js.map
package/dist/bug-tap.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";/*! @xysfe/bug-tap v0.1.0 | MIT */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DCLLRJxX.cjs");exports.BugTap=e.BugTap;exports.createClient=e.createClient;exports.createVuePlugin=e.createVuePlugin;exports.init=e.init;exports.installVueErrorHandler=e.installVueErrorHandler;exports.reactErrorHandlers=e.reactErrorHandlers;exports.version=e.version;exports.vuePlugin=e.plugin;
1
+ "use strict";/*! @xysfe/bug-tap v0.1.2 | MIT */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-RD4QHe1D.cjs");exports.BugTap=e.BugTap;exports.createClient=e.createClient;exports.createVuePlugin=e.createVuePlugin;exports.init=e.init;exports.installVueErrorHandler=e.installVueErrorHandler;exports.reactErrorHandlers=e.reactErrorHandlers;exports.version=e.version;exports.vuePlugin=e.plugin;
2
2
  //# sourceMappingURL=bug-tap.cjs.map
package/dist/bug-tap.js CHANGED
@@ -1,5 +1,5 @@
1
- import { B as e, c as s, a as i, i as n, b as l, r as t, v as u, p as o } from "./index-BBRuTNvo.js";
2
- /*! @xysfe/bug-tap v0.1.0 | MIT */
1
+ import { B as e, c as s, a as i, i as n, b as l, r as t, v as u, p as o } from "./index-CyYSr1VU.js";
2
+ /*! @xysfe/bug-tap v0.1.2 | MIT */
3
3
  export {
4
4
  e as BugTap,
5
5
  s as createClient,
@@ -1,5 +1,5 @@
1
- var BugTapBundle=(function(Wt){"use strict";/*! @xysfe/bug-tap v0.1.0 | MIT */const $r=["x-request-id","x-trace-id","traceparent","tracestate","x-b3-traceid","x-b3-spanid","server-timing","content-length"];function qe(t,e){try{return t instanceof RegExp?(t.lastIndex=0,t.test(e)):e.includes(t)}catch(r){return!1}}const pa=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications\.$/,/^Cannot redefine property: googletag$/,/can't redefine non-configurable property "solana"/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/],Yi=/^(?:<anonymous>|\[native code\]|data:|blob:|about:|chrome-extension:|moz-extension:)/i,ga=/\bat\s+(?:.*?\s+\()?([^\s()]+):(\d+):(\d+)\)?\s*$/;function Pn(t){if(t)for(const e of t.split(`
2
- `)){const r=ga.exec(e);if(!r)continue;const n=r[1];if(!n||Yi.test(n))continue;const i=Number(r[2]),s=Number(r[3]);return{url:n,line:Number.isFinite(i)&&i>0?i:void 0,column:Number.isFinite(s)&&s>=0?s:void 0}}}function ma(t,e){const r=Pn(t);if(r)return r.url;if(e&&!Yi.test(e))return e}const ba=/^\[(?:setTimeout|setInterval|requestAnimationFrame)\] /,ya=/^[A-Za-z]*Error: /;function wa(t){const e=new Set([t]),r=t.replace(ba,"");e.add(r);const n=r.replace(ya,"");return e.add(n),Array.from(e)}function va(t,e){return wa(t).some(r=>e.some(n=>qe(n,r)))}function xa(t){const e=(t.message||"").trim(),r=(t.stack||"").trim();return e.length===0&&r.length===0}function Sa(t,e,r){return!(e.length>0&&(!t||!e.some(n=>qe(n,t)))||t&&r.some(n=>qe(n,t)))}const Ea=[/\.(?:js|css|map|png|jpe?g|gif|svg|webp|ico|bmp|woff2?|ttf|eot|otf|mp4|webm|mp3|wav|ogg|avi|mov|zip|gz|pdf)(?:[?#]|$)/i],Gi="/go/SupportTools/logreport",Ji="/platform/file/uploadPicture",Qi="1008";function _a(t){return(String(t!=null?t:"").trim()||Gi).replace(/\/+$/,"")||Gi}function In(t){return Object.prototype.toString.call(t)==="[object Object]"}function Zi(t){if(typeof t=="function")return t;if(!In(t))return;const e={};for(const r of Object.keys(t)){const n=t[r],i=typeof n;(i==="string"||i==="number"||i==="boolean")&&(e[r]=n)}return Object.keys(e).length>0?e:void 0}function it(t,e,r,n){return Math.round(es(t,e,r,n))}function Ca(t){const e=String(t.release||"").trim();if(e)return e;const r=String(t.appVersion||"").trim(),n=String(t.buildId||"").trim();return r&&n?`${r}+${n}`:r||n}function ts(t){return t===!0?!0:Array.isArray(t)?Array.from(new Set(t.map(e=>String(e||"").trim().toLowerCase()).filter(e=>e.length>0))):[]}function Ta(t){if(t===!0)return!0;const e=ts(t);return Array.from(new Set([...$r,"content-type",...e]))}function es(t,e,r,n){const i=typeof t=="number"?t:Number(t);return Number.isFinite(i)?Math.min(r,Math.max(e,i)):n}function rs(t,e){if(!In(t)||!In(e))return e===void 0?t:e;const r={...t};for(const n of Object.keys(e))r[n]=rs(t[n],e[n]);return r}function ka(t,e){return rs(t,e||{})}function Ln(t){var o,l,a,u,c,d,p,x,R,k,N,z,j,F,I,Q,Et,ht,vt,ge,Pt,It,me,xt,ke,lt,J,K,V,at,be,Tt,rt,nt,Fe,rr,qt,ye,ze,Lt,Nr,f,h,m,S,b,v,C,_,E,y,A,T,M,g,w,O,L,U,B,tt,_t,Nt;const e={excludeUrls:Ea.concat(((o=t.privacy)==null?void 0:o.excludeUrls)||[]),excludeConsolePatterns:(((l=t.privacy)==null?void 0:l.excludeConsolePatterns)||[]).slice(),excludeBreadcrumbUrls:(((a=t.privacy)==null?void 0:a.excludeBreadcrumbUrls)||[]).slice()},r=t.filtering||{},n={ignoreErrors:(r.ignoreErrors||[]).slice().concat(r.disableErrorDefaults?[]:pa),denyUrls:(r.denyUrls||[]).slice(),allowUrls:(r.allowUrls||[]).slice()},i=t.hooks||{},s={beforeSend:typeof i.beforeSend=="function"?i.beforeSend:void 0,beforeBreadcrumb:typeof i.beforeBreadcrumb=="function"?i.beforeBreadcrumb:void 0};return{project:String(t.project||"").trim(),endpoint:_a(t.endpoint),environment:String(t.environment||"production").trim()||"production",appVersion:String(t.appVersion||"").trim(),buildId:String(t.buildId||"").trim(),release:Ca(t),debug:t.debug===!0,user:Zi(t.user),reporter:{enabled:((u=t.reporter)==null?void 0:u.enabled)!==!1,position:((c=t.reporter)==null?void 0:c.position)==="bottom-left"?"bottom-left":"bottom-right",theme:((d=t.reporter)==null?void 0:d.theme)==="light"||((p=t.reporter)==null?void 0:p.theme)==="dark"?t.reporter.theme:"auto",text:String(((x=t.reporter)==null?void 0:x.text)||"反馈").slice(0,20),zIndex:it((R=t.reporter)==null?void 0:R.zIndex,1,2147483647,2147483e3),visibility:{mode:((N=(k=t.reporter)==null?void 0:k.visibility)==null?void 0:N.mode)==="triggered"?"triggered":"always",queryParam:String(((j=(z=t.reporter)==null?void 0:z.visibility)==null?void 0:j.queryParam)||"bugtap").trim(),queryValue:((I=(F=t.reporter)==null?void 0:F.visibility)==null?void 0:I.queryValue)===void 0?"1":String(t.reporter.visibility.queryValue),closable:((Et=(Q=t.reporter)==null?void 0:Q.visibility)==null?void 0:Et.closable)!==!1}},collect:{console:((ht=t.collect)==null?void 0:ht.console)!==!1,error:((vt=t.collect)==null?void 0:vt.error)!==!1,network:((ge=t.collect)==null?void 0:ge.network)!==!1,networkBody:((Pt=t.collect)==null?void 0:Pt.networkBody)!==!1,realtime:((It=t.collect)==null?void 0:It.realtime)!==!1,resourceErrors:((me=t.collect)==null?void 0:me.resourceErrors)!==!1,environment:((xt=t.collect)==null?void 0:xt.environment)!==!1,trackIds:((ke=t.collect)==null?void 0:ke.trackIds)!==!1,breadcrumbs:((lt=t.collect)==null?void 0:lt.breadcrumbs)!==!1,maxBreadcrumbs:it((J=t.collect)==null?void 0:J.maxBreadcrumbs,1,200,100),maxConsoleLogs:it((K=t.collect)==null?void 0:K.maxConsoleLogs,1,500,100),maxNetworkRecords:it((V=t.collect)==null?void 0:V.maxNetworkRecords,1,500,200),maxErrors:it((at=t.collect)==null?void 0:at.maxErrors,1,200,50),maxNetworkBytes:it((be=t.collect)==null?void 0:be.maxNetworkBytes,8192,8e6,524288),maxCloneBytes:it((Tt=t.collect)==null?void 0:Tt.maxCloneBytes,1024,5e6,262144),requestHeaders:ts((rt=t.collect)==null?void 0:rt.requestHeaders),responseHeaders:Ta((nt=t.collect)==null?void 0:nt.responseHeaders),maxElements:it((Fe=t.collect)==null?void 0:Fe.maxElements,1,20,5),eventListenerErrors:((rr=t.collect)==null?void 0:rr.eventListenerErrors)!==!1},privacy:e,filtering:n,hooks:s,screenshot:{enabled:((qt=t.screenshot)==null?void 0:qt.enabled)!==!1,auto:((ye=t.screenshot)==null?void 0:ye.auto)!==!1,quality:es((ze=t.screenshot)==null?void 0:ze.quality,.1,1,.8),maxWidth:it((Lt=t.screenshot)==null?void 0:Lt.maxWidth,320,4096,1600),maxSizeKB:it((Nr=t.screenshot)==null?void 0:Nr.maxSizeKB,50,2048,400),scriptUrl:String(((f=t.screenshot)==null?void 0:f.scriptUrl)||"").trim()},transport:{timeoutMs:it((h=t.transport)==null?void 0:h.timeoutMs,1e3,6e4,15e3),retries:it((m=t.transport)==null?void 0:m.retries,0,5,2),headers:{...((S=t.transport)==null?void 0:S.headers)||{}},maxItemBytes:it((b=t.transport)==null?void 0:b.maxItemBytes,5e4,5e6,8e5),totalTimeoutMs:it((v=t.transport)==null?void 0:v.totalTimeoutMs,3e3,6e4,3e4),maxConcurrent:it((C=t.transport)==null?void 0:C.maxConcurrent,1,50,10),logLevel:((_=t.transport)==null?void 0:_.logLevel)===1||((E=t.transport)==null?void 0:E.logLevel)===2||((y=t.transport)==null?void 0:y.logLevel)===3?t.transport.logLevel:void 0,offline:{enabled:((T=(A=t.transport)==null?void 0:A.offline)==null?void 0:T.enabled)!==!1,ttlMs:it((g=(M=t.transport)==null?void 0:M.offline)==null?void 0:g.ttlMs,6e4,6048e5,864e5),maxItems:it((O=(w=t.transport)==null?void 0:w.offline)==null?void 0:O.maxItems,1,100,20)},maxReportsPerSession:it((L=t.transport)==null?void 0:L.maxReportsPerSession,0,1e3,0)},upload:{enabled:((U=t.upload)==null?void 0:U.enabled)!==!1,url:String(((B=t.upload)==null?void 0:B.url)||Ji).trim()||Ji,bizId:String((_t=(tt=t.upload)==null?void 0:tt.bizId)!=null?_t:Qi).trim()||Qi,timeoutMs:it((Nt=t.upload)==null?void 0:Nt.timeoutMs,1e3,12e4,3e4)}}}function Nn(t){const e=[];if(!t||typeof t!="object")return e.push("配置不是对象"),e;if((!t.project||typeof t.project!="string")&&e.push("缺少 project"),t.endpoint!==void 0&&t.endpoint!==null&&String(t.endpoint).trim()!=="")try{const r=new URL(t.endpoint,location.href);r.protocol!=="http:"&&r.protocol!=="https:"&&e.push("endpoint 必须是 http/https 地址")}catch(r){e.push("endpoint 不是合法 URL")}return e}class $n{constructor(e){this.start=0,this.length=0,this.evicted=0,this.capacity=Math.max(1,Math.floor(e)),this.items=new Array(this.capacity)}get size(){return this.length}get limit(){return this.capacity}get droppedCount(){return this.evicted}push(e){if(this.length<this.capacity){this.items[(this.start+this.length)%this.capacity]=e,this.length+=1;return}this.items[this.start]=e,this.start=(this.start+1)%this.capacity,this.evicted+=1}last(){if(this.length!==0)return this.items[(this.start+this.length-1)%this.capacity]}toArray(){const e=[];for(let r=0;r<this.length;r+=1){const n=this.items[(this.start+r)%this.capacity];n!==void 0&&e.push(n)}return e}includes(e){for(let r=0;r<this.length;r+=1)if(this.items[(this.start+r)%this.capacity]===e)return!0;return!1}update(e,r){for(let n=0;n<this.length;n+=1){const i=(this.start+n)%this.capacity,s=this.items[i];if(s!==void 0&&e(s))return this.items[i]=r(s),!0}return!1}updateLast(e){if(this.length===0)return!1;const r=(this.start+this.length-1)%this.capacity,n=this.items[r];return n===void 0?!1:(this.items[r]=e(n),!0)}clear(){this.items=new Array(this.capacity),this.start=0,this.length=0,this.evicted=0}}function ns(t){return t.ok===!1||!!t.error||(t.status||0)>=400}function Ra(t){return t.ok===!0}function is(t){return t?t.droppedCount+t.evictedCount+(t.trimmedCount||0):0}const Aa=60,Ma=40;function ss(t){var e,r,n,i;try{if(!t)return;const s=t.tagName?t.tagName.toLowerCase():"";if(!s)return;const o=t.id?`#${t.id}`:"",l=((e=t.getAttribute)==null?void 0:e.call(t,"data-testid"))||((r=t.getAttribute)==null?void 0:r.call(t,"data-test"))||((n=t.getAttribute)==null?void 0:n.call(t,"data-qa"))||"",a=!o&&l?`[data-testid="${l}"]`:"",u=((i=t.getAttribute)==null?void 0:i.call(t,"name"))||"",c=!o&&!a&&u?`[name="${u}"]`:"",d=typeof t.className=="string"?t.className.trim():"",p=!o&&!a&&!c&&d?`.${d.split(/\s+/).slice(0,2).join(".")}`:"";return`${s}${o}${a}${c}${p}`.slice(0,Aa)}catch(s){return}}function Oa(t,e=Ma){try{const r=((t==null?void 0:t.textContent)||"").replace(/\s+/g," ").trim();return r?r.slice(0,e):void 0}catch(r){return}}function Pa(t){var e;try{const r=(((e=t==null?void 0:t.getAttribute)==null?void 0:e.call(t,"type"))||"").toLowerCase();return r==="password"||r==="hidden"}catch(r){return!0}}function os(t){var r,n;try{if(document.documentElement.hasAttribute("data-bug-tap-picking"))return!0}catch(i){}let e=t;for(;e;)try{if((r=e.hasAttribute)!=null&&r.call(e,"data-bug-tap")||(n=e.hasAttribute)!=null&&n.call(e,"data-bug-tap-picker"))return!0;const i=e.getRootNode?e.getRootNode():null;if(i&&i.host){e=i.host;continue}e=e.parentElement}catch(i){return!1}return!1}function Bn(t){try{const e=new URL(t);return`${e.pathname}${e.search}${e.hash}`.slice(0,300)}catch(e){return t.slice(0,300)}}function Ia(t,e){if(t===e)return!0;if(!t||!e)return!1;try{return JSON.stringify(t)===JSON.stringify(e)}catch(r){return!1}}class La{constructor(e){this.options=e,this.started=!1,this.lastRoute="",this.lastVisibility="",this.navigationDisabled=!1,this.tailSignature="",this.onClick=r=>{if(!(!this.started||!this.options.dom))try{const n=r.target;if(os(n))return;const i=ss(n);if(!i)return;this.push({t:Date.now(),type:"click",selector:i,text:Oa(n)})}catch(n){}},this.onChange=r=>{if(!(!this.started||!this.options.dom))try{const n=r.target;if(!n||os(n)||Pa(n))return;const i=ss(n);if(!i)return;this.push({t:Date.now(),type:"input",selector:i})}catch(n){}},this.onVisibility=()=>{if(this.started)try{const r=document.visibilityState;if(r===this.lastVisibility)return;this.lastVisibility=r,this.push({t:Date.now(),type:"visibility",state:r})}catch(r){}},this.checkRoute=()=>{if(!(!this.started||!this.options.navigation||this.navigationDisabled))try{const r=location.href;if(r===this.lastRoute)return;const n=this.lastRoute;this.lastRoute=r,this.push({t:Date.now(),type:"route",from:Bn(n),to:Bn(r)})}catch(r){}},this.onHistory=()=>{this.navigationDisabled||setTimeout(this.checkRoute,0)},this.originalPush=null,this.originalReplace=null,this.wrappedPush=null,this.wrappedReplace=null,this.routeHook=null,this.buffer=new $n(e.max)}get limit(){return this.buffer.limit}get size(){return this.buffer.size}get evicted(){return this.buffer.droppedCount}start(){if(!this.started){this.started=!0;try{this.lastRoute=location.href,this.lastVisibility=document.visibilityState}catch(e){}this.options.dom&&(window.addEventListener("click",this.onClick,!0),window.addEventListener("change",this.onChange,!0)),this.options.navigation&&!this.navigationDisabled&&(window.addEventListener("popstate",this.checkRoute),window.addEventListener("hashchange",this.checkRoute),window.addEventListener("visibilitychange",this.onVisibility),this.patchHistory())}}stop(){this.started&&(this.started=!1,window.removeEventListener("click",this.onClick,!0),window.removeEventListener("change",this.onChange,!0),window.removeEventListener("popstate",this.checkRoute),window.removeEventListener("hashchange",this.checkRoute),window.removeEventListener("visibilitychange",this.onVisibility),this.unpatchHistory())}getBreadcrumbs(){return this.buffer.toArray()}add(e){this.started&&this.push(e)}disableNavigationCapture(){this.options.navigation&&(this.navigationDisabled=!0,window.removeEventListener("popstate",this.checkRoute),window.removeEventListener("hashchange",this.checkRoute),this.unpatchHistory())}clear(){this.buffer.clear(),this.tailSignature=""}addNetwork(e){var o;if(!this.started||!this.options.network||this.options.excludeUrls&&this.options.excludeUrls.some(l=>qe(l,e.url)))return;const r=Bn(e.url),n=ns(e),i=`${e.method} ${r} ${(o=e.status)!=null?o:""} ${n?1:0}`,s=this.buffer.last();if(s&&s.type==="http"&&this.tailSignature===i){this.buffer.updateLast(l=>({...l,repeat:(l.repeat||1)+1,ref:e.id}));return}this.tailSignature=i,this.push({t:Date.now(),type:"http",method:e.method,url:r,status:e.status,durationMs:e.durationMs,httpError:e.error,ref:e.id})}addError(e){!this.started||!this.options.error||this.push({t:e.timestamp,type:"error",message:e.message.slice(0,200),count:e.count})}push(e){if(!this.started)return;const r=this.applyHook(e);if(!r)return;const n=r;n.type!=="http"&&(this.tailSignature="");const i=this.buffer.last();i&&i.type===n.type&&i.selector===n.selector&&i.to===n.to&&i.state===n.state&&i.ref===n.ref&&i.message===n.message&&Ia(i.data,n.data)||this.buffer.push(n)}applyHook(e){const r=this.options.beforeBreadcrumb;if(!r)return e;try{const n=r(e);return n===null?null:n&&typeof n=="object"?n:e}catch(n){return e}}wrapHistory(e){const r=this,n=function(...i){var o;const s=e.apply(this,i);return(o=r.routeHook)==null||o.call(r),s};return n.__bugTap=!0,n}patchHistory(){try{if(typeof history=="undefined")return;const e=history.pushState,r=history.replaceState;this.originalPush=e,this.originalReplace=r,this.routeHook=()=>this.onHistory(),this.wrappedPush=this.wrapHistory(e),this.wrappedReplace=this.wrapHistory(r),history.pushState=this.wrappedPush,history.replaceState=this.wrappedReplace}catch(e){}}unpatchHistory(){try{this.wrappedPush&&history.pushState===this.wrappedPush&&this.originalPush&&(history.pushState=this.originalPush),this.wrappedReplace&&history.replaceState===this.wrappedReplace&&this.originalReplace&&(history.replaceState=this.originalReplace)}catch(e){}this.routeHook=null,this.originalPush=null,this.originalReplace=null,this.wrappedPush=null,this.wrappedReplace=null}}const ls="__bugTapCaptured";let nr=0,Br=0;function Na(t){try{t&&(typeof t=="object"||typeof t=="function")&&(t[ls]=!0)}catch(e){}}function as(t){try{return!!(t&&typeof t=="object"&&t[ls])}catch(e){return!1}}function $a(){return nr<=0?!1:(nr-=1,!0)}function Ba(){nr+=1;try{Br&&clearTimeout(Br),Br=setTimeout(()=>{nr=0,Br=0},0)}catch(t){nr=0}}const Da="__bugTapWrapped",cs="__bugTapHandleEvent";class Ha{constructor(e){this.options=e,this.patched=[],this.registry=new WeakMap,this.started=!1}start(){this.started||(this.started=!0,this.patchTimer("setTimeout","setTimeout"),this.patchTimer("setInterval","setInterval"),this.patchTimer("requestAnimationFrame","requestAnimationFrame"),this.options.eventListeners!==!1&&this.patchEventTarget())}stop(){if(this.started){this.started=!1;for(const{target:e,key:r,original:n}of this.patched)try{const i=e[r];typeof i=="function"&&i.__bugTap&&(e[r]=n)}catch(i){}this.patched.length=0}}patchTimer(e,r){try{const n=window,i=n[e];if(typeof i!="function"||i.__bugTap)return;this.patched.push({target:n,key:e,original:i});const s=this,o=function(l,...a){if(!s.started||typeof l!="function")return i.apply(this,[l,...a]);const u=s.wrapCallback(l,r);return i.apply(this,[u,...a])};o.__bugTap=!0,n[e]=o}catch(n){}}patchEventTarget(){try{if(typeof EventTarget=="undefined"||!EventTarget.prototype)return;const e=EventTarget.prototype,r=e.addEventListener,n=e.removeEventListener;if(typeof r!="function"||typeof n!="function"||r.__bugTap)return;this.patched.push({target:e,key:"addEventListener",original:r}),this.patched.push({target:e,key:"removeEventListener",original:n});const i=this,s=function(l,a,u){if(!i.started||!a)return r.call(this,l,a,u);if(typeof a=="object"){const d=a;if(typeof d.handleEvent=="function")try{d.handleEvent[cs]||(d.handleEvent=i.wrapCallback(d.handleEvent.bind(a),l,cs))}catch(p){}return r.call(this,l,a,u)}if(typeof a!="function")return r.call(this,l,a,u);const c=i.listenerFor(this,l,a,u);return r.call(this,l,c,u)},o=function(l,a,u){var c,d,p,x;try{const k=a&&(typeof a=="object"||typeof a=="function")?(d=(c=i.registry.get(this))==null?void 0:c.get(Dn(l,u)))==null?void 0:d.get(a):void 0;k&&k!==a&&(n.call(this,l,k,u),(x=(p=i.registry.get(this))==null?void 0:p.get(Dn(l,u)))==null||x.delete(a))}catch(R){}return n.call(this,l,a,u)};s.__bugTap=!0,o.__bugTap=!0,e.addEventListener=s,e.removeEventListener=o}catch(e){}}listenerFor(e,r,n,i){let s=this.registry.get(e);s||(s=new Map,this.registry.set(e,s));const o=Dn(r,i);let l=s.get(o);l||(l=new WeakMap,s.set(o,l));const a=l.get(n);if(a)return a;const u=this.wrapCallback(n,r);return l.set(n,u),u}wrapCallback(e,r,n=Da){const i=this,s=function(...o){try{return e.apply(this,o)}catch(l){try{Na(l),Ba(),i.options.capture(l,r)}catch(a){}throw l}};try{s[n]=e}catch(o){}return s}}function Dn(t,e){const r=typeof e=="boolean"?e:!!(e&&typeof e=="object"&&e.capture);return`${t}|${r?1:0}`}const ja=4,Rt=50,Ua=2e3,us=4e3;function Re(t,e=Ua){return t.length>e?`${t.slice(0,e)}…[${t.length-e} chars truncated]`:t}function Fa(t){const e=typeof t;if(t===null)return"null";if(e==="undefined")return"undefined";if(e==="string")return Re(t);if(e==="number")return Number.isFinite(t),String(t);if(e==="boolean")return String(t);if(e==="bigint")return`${String(t)}n`;if(e==="symbol")return String(t);if(e==="function"){const r=t.name;return`[Function${r?` ${r}`:""}]`}return null}function We(t,e=0,r){const n=Fa(t);if(n!==null)return n;const i=r||new WeakSet,s=t;if(typeof s!="object"||s===null)return String(s);if(i.has(s))return"[Circular]";i.add(s);try{if(t instanceof Error){const a=typeof t.stack=="string"?t.stack.split(`
1
+ var BugTapBundle=(function(Wt){"use strict";/*! @xysfe/bug-tap v0.1.2 | MIT */const $r=["x-request-id","x-trace-id","traceparent","tracestate","x-b3-traceid","x-b3-spanid","server-timing","content-length"];function qe(t,e){try{return t instanceof RegExp?(t.lastIndex=0,t.test(e)):e.includes(t)}catch(r){return!1}}const pa=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications\.$/,/^Cannot redefine property: googletag$/,/can't redefine non-configurable property "solana"/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/],Yi=/^(?:<anonymous>|\[native code\]|data:|blob:|about:|chrome-extension:|moz-extension:)/i,ga=/\bat\s+(?:.*?\s+\()?([^\s()]+):(\d+):(\d+)\)?\s*$/;function Pn(t){if(t)for(const e of t.split(`
2
+ `)){const r=ga.exec(e);if(!r)continue;const n=r[1];if(!n||Yi.test(n))continue;const i=Number(r[2]),s=Number(r[3]);return{url:n,line:Number.isFinite(i)&&i>0?i:void 0,column:Number.isFinite(s)&&s>=0?s:void 0}}}function ma(t,e){const r=Pn(t);if(r)return r.url;if(e&&!Yi.test(e))return e}const ba=/^\[(?:setTimeout|setInterval|requestAnimationFrame)\] /,ya=/^[A-Za-z]*Error: /;function wa(t){const e=new Set([t]),r=t.replace(ba,"");e.add(r);const n=r.replace(ya,"");return e.add(n),Array.from(e)}function va(t,e){return wa(t).some(r=>e.some(n=>qe(n,r)))}function xa(t){const e=(t.message||"").trim(),r=(t.stack||"").trim();return e.length===0&&r.length===0}function Sa(t,e,r){return!(e.length>0&&(!t||!e.some(n=>qe(n,t)))||t&&r.some(n=>qe(n,t)))}const Ea=[/\.(?:js|css|map|png|jpe?g|gif|svg|webp|ico|bmp|woff2?|ttf|eot|otf|mp4|webm|mp3|wav|ogg|avi|mov|zip|gz|pdf)(?:[?#]|$)/i],Gi="/go/SupportTools/logreport",Ji="/platform/file/uploadPicture",Qi="1086";function _a(t){return(String(t!=null?t:"").trim()||Gi).replace(/\/+$/,"")||Gi}function In(t){return Object.prototype.toString.call(t)==="[object Object]"}function Zi(t){if(typeof t=="function")return t;if(!In(t))return;const e={};for(const r of Object.keys(t)){const n=t[r],i=typeof n;(i==="string"||i==="number"||i==="boolean")&&(e[r]=n)}return Object.keys(e).length>0?e:void 0}function it(t,e,r,n){return Math.round(es(t,e,r,n))}function Ca(t){const e=String(t.release||"").trim();if(e)return e;const r=String(t.appVersion||"").trim(),n=String(t.buildId||"").trim();return r&&n?`${r}+${n}`:r||n}function ts(t){return t===!0?!0:Array.isArray(t)?Array.from(new Set(t.map(e=>String(e||"").trim().toLowerCase()).filter(e=>e.length>0))):[]}function Ta(t){if(t===!0)return!0;const e=ts(t);return Array.from(new Set([...$r,"content-type",...e]))}function es(t,e,r,n){const i=typeof t=="number"?t:Number(t);return Number.isFinite(i)?Math.min(r,Math.max(e,i)):n}function rs(t,e){if(!In(t)||!In(e))return e===void 0?t:e;const r={...t};for(const n of Object.keys(e))r[n]=rs(t[n],e[n]);return r}function ka(t,e){return rs(t,e||{})}function Ln(t){var o,l,a,u,c,d,p,x,R,k,N,z,j,F,I,Q,Et,ht,vt,ge,Pt,It,me,xt,ke,lt,J,K,V,at,be,Tt,rt,nt,Fe,rr,qt,ye,ze,Lt,Nr,f,h,m,S,b,v,C,_,E,y,A,T,M,g,w,O,L,U,B,tt,_t,Nt;const e={excludeUrls:Ea.concat(((o=t.privacy)==null?void 0:o.excludeUrls)||[]),excludeConsolePatterns:(((l=t.privacy)==null?void 0:l.excludeConsolePatterns)||[]).slice(),excludeBreadcrumbUrls:(((a=t.privacy)==null?void 0:a.excludeBreadcrumbUrls)||[]).slice()},r=t.filtering||{},n={ignoreErrors:(r.ignoreErrors||[]).slice().concat(r.disableErrorDefaults?[]:pa),denyUrls:(r.denyUrls||[]).slice(),allowUrls:(r.allowUrls||[]).slice()},i=t.hooks||{},s={beforeSend:typeof i.beforeSend=="function"?i.beforeSend:void 0,beforeBreadcrumb:typeof i.beforeBreadcrumb=="function"?i.beforeBreadcrumb:void 0};return{project:String(t.project||"").trim(),endpoint:_a(t.endpoint),environment:String(t.environment||"production").trim()||"production",appVersion:String(t.appVersion||"").trim(),buildId:String(t.buildId||"").trim(),release:Ca(t),debug:t.debug===!0,user:Zi(t.user),reporter:{enabled:((u=t.reporter)==null?void 0:u.enabled)!==!1,position:((c=t.reporter)==null?void 0:c.position)==="bottom-left"?"bottom-left":"bottom-right",theme:((d=t.reporter)==null?void 0:d.theme)==="light"||((p=t.reporter)==null?void 0:p.theme)==="dark"?t.reporter.theme:"auto",text:String(((x=t.reporter)==null?void 0:x.text)||"反馈").slice(0,20),zIndex:it((R=t.reporter)==null?void 0:R.zIndex,1,2147483647,2147483e3),visibility:{mode:((N=(k=t.reporter)==null?void 0:k.visibility)==null?void 0:N.mode)==="triggered"?"triggered":"always",queryParam:String(((j=(z=t.reporter)==null?void 0:z.visibility)==null?void 0:j.queryParam)||"bugtap").trim(),queryValue:((I=(F=t.reporter)==null?void 0:F.visibility)==null?void 0:I.queryValue)===void 0?"1":String(t.reporter.visibility.queryValue),closable:((Et=(Q=t.reporter)==null?void 0:Q.visibility)==null?void 0:Et.closable)!==!1}},collect:{console:((ht=t.collect)==null?void 0:ht.console)!==!1,error:((vt=t.collect)==null?void 0:vt.error)!==!1,network:((ge=t.collect)==null?void 0:ge.network)!==!1,networkBody:((Pt=t.collect)==null?void 0:Pt.networkBody)!==!1,realtime:((It=t.collect)==null?void 0:It.realtime)!==!1,resourceErrors:((me=t.collect)==null?void 0:me.resourceErrors)!==!1,environment:((xt=t.collect)==null?void 0:xt.environment)!==!1,trackIds:((ke=t.collect)==null?void 0:ke.trackIds)!==!1,breadcrumbs:((lt=t.collect)==null?void 0:lt.breadcrumbs)!==!1,maxBreadcrumbs:it((J=t.collect)==null?void 0:J.maxBreadcrumbs,1,200,100),maxConsoleLogs:it((K=t.collect)==null?void 0:K.maxConsoleLogs,1,500,100),maxNetworkRecords:it((V=t.collect)==null?void 0:V.maxNetworkRecords,1,500,200),maxErrors:it((at=t.collect)==null?void 0:at.maxErrors,1,200,50),maxNetworkBytes:it((be=t.collect)==null?void 0:be.maxNetworkBytes,8192,8e6,524288),maxCloneBytes:it((Tt=t.collect)==null?void 0:Tt.maxCloneBytes,1024,5e6,262144),requestHeaders:ts((rt=t.collect)==null?void 0:rt.requestHeaders),responseHeaders:Ta((nt=t.collect)==null?void 0:nt.responseHeaders),maxElements:it((Fe=t.collect)==null?void 0:Fe.maxElements,1,20,5),eventListenerErrors:((rr=t.collect)==null?void 0:rr.eventListenerErrors)!==!1},privacy:e,filtering:n,hooks:s,screenshot:{enabled:((qt=t.screenshot)==null?void 0:qt.enabled)!==!1,auto:((ye=t.screenshot)==null?void 0:ye.auto)!==!1,quality:es((ze=t.screenshot)==null?void 0:ze.quality,.1,1,.8),maxWidth:it((Lt=t.screenshot)==null?void 0:Lt.maxWidth,320,4096,1600),maxSizeKB:it((Nr=t.screenshot)==null?void 0:Nr.maxSizeKB,50,2048,400),scriptUrl:String(((f=t.screenshot)==null?void 0:f.scriptUrl)||"").trim()},transport:{timeoutMs:it((h=t.transport)==null?void 0:h.timeoutMs,1e3,6e4,15e3),retries:it((m=t.transport)==null?void 0:m.retries,0,5,2),headers:{...((S=t.transport)==null?void 0:S.headers)||{}},maxItemBytes:it((b=t.transport)==null?void 0:b.maxItemBytes,5e4,5e6,8e5),totalTimeoutMs:it((v=t.transport)==null?void 0:v.totalTimeoutMs,3e3,6e4,3e4),maxConcurrent:it((C=t.transport)==null?void 0:C.maxConcurrent,1,50,10),logLevel:((_=t.transport)==null?void 0:_.logLevel)===1||((E=t.transport)==null?void 0:E.logLevel)===2||((y=t.transport)==null?void 0:y.logLevel)===3?t.transport.logLevel:void 0,offline:{enabled:((T=(A=t.transport)==null?void 0:A.offline)==null?void 0:T.enabled)!==!1,ttlMs:it((g=(M=t.transport)==null?void 0:M.offline)==null?void 0:g.ttlMs,6e4,6048e5,864e5),maxItems:it((O=(w=t.transport)==null?void 0:w.offline)==null?void 0:O.maxItems,1,100,20)},maxReportsPerSession:it((L=t.transport)==null?void 0:L.maxReportsPerSession,0,1e3,0)},upload:{enabled:((U=t.upload)==null?void 0:U.enabled)!==!1,url:String(((B=t.upload)==null?void 0:B.url)||Ji).trim()||Ji,bizId:String((_t=(tt=t.upload)==null?void 0:tt.bizId)!=null?_t:Qi).trim()||Qi,timeoutMs:it((Nt=t.upload)==null?void 0:Nt.timeoutMs,1e3,12e4,3e4)}}}function Nn(t){const e=[];if(!t||typeof t!="object")return e.push("配置不是对象"),e;if((!t.project||typeof t.project!="string")&&e.push("缺少 project"),t.endpoint!==void 0&&t.endpoint!==null&&String(t.endpoint).trim()!=="")try{const r=new URL(t.endpoint,location.href);r.protocol!=="http:"&&r.protocol!=="https:"&&e.push("endpoint 必须是 http/https 地址")}catch(r){e.push("endpoint 不是合法 URL")}return e}class $n{constructor(e){this.start=0,this.length=0,this.evicted=0,this.capacity=Math.max(1,Math.floor(e)),this.items=new Array(this.capacity)}get size(){return this.length}get limit(){return this.capacity}get droppedCount(){return this.evicted}push(e){if(this.length<this.capacity){this.items[(this.start+this.length)%this.capacity]=e,this.length+=1;return}this.items[this.start]=e,this.start=(this.start+1)%this.capacity,this.evicted+=1}last(){if(this.length!==0)return this.items[(this.start+this.length-1)%this.capacity]}toArray(){const e=[];for(let r=0;r<this.length;r+=1){const n=this.items[(this.start+r)%this.capacity];n!==void 0&&e.push(n)}return e}includes(e){for(let r=0;r<this.length;r+=1)if(this.items[(this.start+r)%this.capacity]===e)return!0;return!1}update(e,r){for(let n=0;n<this.length;n+=1){const i=(this.start+n)%this.capacity,s=this.items[i];if(s!==void 0&&e(s))return this.items[i]=r(s),!0}return!1}updateLast(e){if(this.length===0)return!1;const r=(this.start+this.length-1)%this.capacity,n=this.items[r];return n===void 0?!1:(this.items[r]=e(n),!0)}clear(){this.items=new Array(this.capacity),this.start=0,this.length=0,this.evicted=0}}function ns(t){return t.ok===!1||!!t.error||(t.status||0)>=400}function Ra(t){return t.ok===!0}function is(t){return t?t.droppedCount+t.evictedCount+(t.trimmedCount||0):0}const Aa=60,Ma=40;function ss(t){var e,r,n,i;try{if(!t)return;const s=t.tagName?t.tagName.toLowerCase():"";if(!s)return;const o=t.id?`#${t.id}`:"",l=((e=t.getAttribute)==null?void 0:e.call(t,"data-testid"))||((r=t.getAttribute)==null?void 0:r.call(t,"data-test"))||((n=t.getAttribute)==null?void 0:n.call(t,"data-qa"))||"",a=!o&&l?`[data-testid="${l}"]`:"",u=((i=t.getAttribute)==null?void 0:i.call(t,"name"))||"",c=!o&&!a&&u?`[name="${u}"]`:"",d=typeof t.className=="string"?t.className.trim():"",p=!o&&!a&&!c&&d?`.${d.split(/\s+/).slice(0,2).join(".")}`:"";return`${s}${o}${a}${c}${p}`.slice(0,Aa)}catch(s){return}}function Oa(t,e=Ma){try{const r=((t==null?void 0:t.textContent)||"").replace(/\s+/g," ").trim();return r?r.slice(0,e):void 0}catch(r){return}}function Pa(t){var e;try{const r=(((e=t==null?void 0:t.getAttribute)==null?void 0:e.call(t,"type"))||"").toLowerCase();return r==="password"||r==="hidden"}catch(r){return!0}}function os(t){var r,n;try{if(document.documentElement.hasAttribute("data-bug-tap-picking"))return!0}catch(i){}let e=t;for(;e;)try{if((r=e.hasAttribute)!=null&&r.call(e,"data-bug-tap")||(n=e.hasAttribute)!=null&&n.call(e,"data-bug-tap-picker"))return!0;const i=e.getRootNode?e.getRootNode():null;if(i&&i.host){e=i.host;continue}e=e.parentElement}catch(i){return!1}return!1}function Bn(t){try{const e=new URL(t);return`${e.pathname}${e.search}${e.hash}`.slice(0,300)}catch(e){return t.slice(0,300)}}function Ia(t,e){if(t===e)return!0;if(!t||!e)return!1;try{return JSON.stringify(t)===JSON.stringify(e)}catch(r){return!1}}class La{constructor(e){this.options=e,this.started=!1,this.lastRoute="",this.lastVisibility="",this.navigationDisabled=!1,this.tailSignature="",this.onClick=r=>{if(!(!this.started||!this.options.dom))try{const n=r.target;if(os(n))return;const i=ss(n);if(!i)return;this.push({t:Date.now(),type:"click",selector:i,text:Oa(n)})}catch(n){}},this.onChange=r=>{if(!(!this.started||!this.options.dom))try{const n=r.target;if(!n||os(n)||Pa(n))return;const i=ss(n);if(!i)return;this.push({t:Date.now(),type:"input",selector:i})}catch(n){}},this.onVisibility=()=>{if(this.started)try{const r=document.visibilityState;if(r===this.lastVisibility)return;this.lastVisibility=r,this.push({t:Date.now(),type:"visibility",state:r})}catch(r){}},this.checkRoute=()=>{if(!(!this.started||!this.options.navigation||this.navigationDisabled))try{const r=location.href;if(r===this.lastRoute)return;const n=this.lastRoute;this.lastRoute=r,this.push({t:Date.now(),type:"route",from:Bn(n),to:Bn(r)})}catch(r){}},this.onHistory=()=>{this.navigationDisabled||setTimeout(this.checkRoute,0)},this.originalPush=null,this.originalReplace=null,this.wrappedPush=null,this.wrappedReplace=null,this.routeHook=null,this.buffer=new $n(e.max)}get limit(){return this.buffer.limit}get size(){return this.buffer.size}get evicted(){return this.buffer.droppedCount}start(){if(!this.started){this.started=!0;try{this.lastRoute=location.href,this.lastVisibility=document.visibilityState}catch(e){}this.options.dom&&(window.addEventListener("click",this.onClick,!0),window.addEventListener("change",this.onChange,!0)),this.options.navigation&&!this.navigationDisabled&&(window.addEventListener("popstate",this.checkRoute),window.addEventListener("hashchange",this.checkRoute),window.addEventListener("visibilitychange",this.onVisibility),this.patchHistory())}}stop(){this.started&&(this.started=!1,window.removeEventListener("click",this.onClick,!0),window.removeEventListener("change",this.onChange,!0),window.removeEventListener("popstate",this.checkRoute),window.removeEventListener("hashchange",this.checkRoute),window.removeEventListener("visibilitychange",this.onVisibility),this.unpatchHistory())}getBreadcrumbs(){return this.buffer.toArray()}add(e){this.started&&this.push(e)}disableNavigationCapture(){this.options.navigation&&(this.navigationDisabled=!0,window.removeEventListener("popstate",this.checkRoute),window.removeEventListener("hashchange",this.checkRoute),this.unpatchHistory())}clear(){this.buffer.clear(),this.tailSignature=""}addNetwork(e){var o;if(!this.started||!this.options.network||this.options.excludeUrls&&this.options.excludeUrls.some(l=>qe(l,e.url)))return;const r=Bn(e.url),n=ns(e),i=`${e.method} ${r} ${(o=e.status)!=null?o:""} ${n?1:0}`,s=this.buffer.last();if(s&&s.type==="http"&&this.tailSignature===i){this.buffer.updateLast(l=>({...l,repeat:(l.repeat||1)+1,ref:e.id}));return}this.tailSignature=i,this.push({t:Date.now(),type:"http",method:e.method,url:r,status:e.status,durationMs:e.durationMs,httpError:e.error,ref:e.id})}addError(e){!this.started||!this.options.error||this.push({t:e.timestamp,type:"error",message:e.message.slice(0,200),count:e.count})}push(e){if(!this.started)return;const r=this.applyHook(e);if(!r)return;const n=r;n.type!=="http"&&(this.tailSignature="");const i=this.buffer.last();i&&i.type===n.type&&i.selector===n.selector&&i.to===n.to&&i.state===n.state&&i.ref===n.ref&&i.message===n.message&&Ia(i.data,n.data)||this.buffer.push(n)}applyHook(e){const r=this.options.beforeBreadcrumb;if(!r)return e;try{const n=r(e);return n===null?null:n&&typeof n=="object"?n:e}catch(n){return e}}wrapHistory(e){const r=this,n=function(...i){var o;const s=e.apply(this,i);return(o=r.routeHook)==null||o.call(r),s};return n.__bugTap=!0,n}patchHistory(){try{if(typeof history=="undefined")return;const e=history.pushState,r=history.replaceState;this.originalPush=e,this.originalReplace=r,this.routeHook=()=>this.onHistory(),this.wrappedPush=this.wrapHistory(e),this.wrappedReplace=this.wrapHistory(r),history.pushState=this.wrappedPush,history.replaceState=this.wrappedReplace}catch(e){}}unpatchHistory(){try{this.wrappedPush&&history.pushState===this.wrappedPush&&this.originalPush&&(history.pushState=this.originalPush),this.wrappedReplace&&history.replaceState===this.wrappedReplace&&this.originalReplace&&(history.replaceState=this.originalReplace)}catch(e){}this.routeHook=null,this.originalPush=null,this.originalReplace=null,this.wrappedPush=null,this.wrappedReplace=null}}const ls="__bugTapCaptured";let nr=0,Br=0;function Na(t){try{t&&(typeof t=="object"||typeof t=="function")&&(t[ls]=!0)}catch(e){}}function as(t){try{return!!(t&&typeof t=="object"&&t[ls])}catch(e){return!1}}function $a(){return nr<=0?!1:(nr-=1,!0)}function Ba(){nr+=1;try{Br&&clearTimeout(Br),Br=setTimeout(()=>{nr=0,Br=0},0)}catch(t){nr=0}}const Da="__bugTapWrapped",cs="__bugTapHandleEvent";class Ha{constructor(e){this.options=e,this.patched=[],this.registry=new WeakMap,this.started=!1}start(){this.started||(this.started=!0,this.patchTimer("setTimeout","setTimeout"),this.patchTimer("setInterval","setInterval"),this.patchTimer("requestAnimationFrame","requestAnimationFrame"),this.options.eventListeners!==!1&&this.patchEventTarget())}stop(){if(this.started){this.started=!1;for(const{target:e,key:r,original:n}of this.patched)try{const i=e[r];typeof i=="function"&&i.__bugTap&&(e[r]=n)}catch(i){}this.patched.length=0}}patchTimer(e,r){try{const n=window,i=n[e];if(typeof i!="function"||i.__bugTap)return;this.patched.push({target:n,key:e,original:i});const s=this,o=function(l,...a){if(!s.started||typeof l!="function")return i.apply(this,[l,...a]);const u=s.wrapCallback(l,r);return i.apply(this,[u,...a])};o.__bugTap=!0,n[e]=o}catch(n){}}patchEventTarget(){try{if(typeof EventTarget=="undefined"||!EventTarget.prototype)return;const e=EventTarget.prototype,r=e.addEventListener,n=e.removeEventListener;if(typeof r!="function"||typeof n!="function"||r.__bugTap)return;this.patched.push({target:e,key:"addEventListener",original:r}),this.patched.push({target:e,key:"removeEventListener",original:n});const i=this,s=function(l,a,u){if(!i.started||!a)return r.call(this,l,a,u);if(typeof a=="object"){const d=a;if(typeof d.handleEvent=="function")try{d.handleEvent[cs]||(d.handleEvent=i.wrapCallback(d.handleEvent.bind(a),l,cs))}catch(p){}return r.call(this,l,a,u)}if(typeof a!="function")return r.call(this,l,a,u);const c=i.listenerFor(this,l,a,u);return r.call(this,l,c,u)},o=function(l,a,u){var c,d,p,x;try{const k=a&&(typeof a=="object"||typeof a=="function")?(d=(c=i.registry.get(this))==null?void 0:c.get(Dn(l,u)))==null?void 0:d.get(a):void 0;k&&k!==a&&(n.call(this,l,k,u),(x=(p=i.registry.get(this))==null?void 0:p.get(Dn(l,u)))==null||x.delete(a))}catch(R){}return n.call(this,l,a,u)};s.__bugTap=!0,o.__bugTap=!0,e.addEventListener=s,e.removeEventListener=o}catch(e){}}listenerFor(e,r,n,i){let s=this.registry.get(e);s||(s=new Map,this.registry.set(e,s));const o=Dn(r,i);let l=s.get(o);l||(l=new WeakMap,s.set(o,l));const a=l.get(n);if(a)return a;const u=this.wrapCallback(n,r);return l.set(n,u),u}wrapCallback(e,r,n=Da){const i=this,s=function(...o){try{return e.apply(this,o)}catch(l){try{Na(l),Ba(),i.options.capture(l,r)}catch(a){}throw l}};try{s[n]=e}catch(o){}return s}}function Dn(t,e){const r=typeof e=="boolean"?e:!!(e&&typeof e=="object"&&e.capture);return`${t}|${r?1:0}`}const ja=4,Rt=50,Ua=2e3,us=4e3;function Re(t,e=Ua){return t.length>e?`${t.slice(0,e)}…[${t.length-e} chars truncated]`:t}function Fa(t){const e=typeof t;if(t===null)return"null";if(e==="undefined")return"undefined";if(e==="string")return Re(t);if(e==="number")return Number.isFinite(t),String(t);if(e==="boolean")return String(t);if(e==="bigint")return`${String(t)}n`;if(e==="symbol")return String(t);if(e==="function"){const r=t.name;return`[Function${r?` ${r}`:""}]`}return null}function We(t,e=0,r){const n=Fa(t);if(n!==null)return n;const i=r||new WeakSet,s=t;if(typeof s!="object"||s===null)return String(s);if(i.has(s))return"[Circular]";i.add(s);try{if(t instanceof Error){const a=typeof t.stack=="string"?t.stack.split(`
3
3
  `).slice(0,6).join(`
4
4
  `):"";return Re(`${t.name||"Error"}: ${t.message}${a?`
5
5
  ${a}`:""}`,us)}if(t instanceof Date)try{return t.toISOString()}catch(a){return"[Invalid Date]"}if(t instanceof RegExp)return String(t);if(typeof Element!="undefined"&&t instanceof Element){const a=t.tagName.toLowerCase(),u=t.id?`#${t.id}`:"",c=typeof t.className=="string"&&t.className.trim()?`.${t.className.trim().split(/\s+/).slice(0,3).join(".")}`:"";return`<${a}${u}${c}>`}if(typeof Node!="undefined"&&t instanceof Node)return`[Node ${t.nodeName}]`;if(e>=ja)return"[MaxDepth]";if(Array.isArray(t)){const a=t.slice(0,Rt).map(u=>We(u,e+1,i));return t.length>Rt&&a.push(`…[${t.length-Rt} more]`),Re(`[${a.join(", ")}]`)}if(t instanceof Map){const a=[];let u=0;return t.forEach((c,d)=>{u<Rt&&a.push(`${We(d,e+1,i)} => ${We(c,e+1,i)}`),u+=1}),u>Rt&&a.push(`…[${u-Rt} more]`),Re(`Map(${t.size}) {${a.join(", ")}}`)}if(t instanceof Set){const a=[];let u=0;return t.forEach(c=>{u<Rt&&a.push(We(c,e+1,i)),u+=1}),u>Rt&&a.push(`…[${u-Rt} more]`),Re(`Set(${t.size}) {${a.join(", ")}}`)}const o=Object.keys(t),l=[];for(const a of o.slice(0,Rt))try{const u=t[a];l.push(`${a}: ${We(u,e+1,i)}`)}catch(u){l.push(`${a}: [Thrown]`)}return o.length>Rt&&l.push(`…[${o.length-Rt} more keys]`),Re(`{${l.join(", ")}}`)}catch(o){return"[Unserializable]"}finally{i.delete(s)}}function za(t){const e=t.map(n=>We(n)),r=Re(e.join(" "),us);return{args:e,text:r}}const Hn=["log","info","warn","error","debug","trace","assert"];class qa{constructor(e){this.options=e,this.originals=new Map,this.wrapped=new Map,this.originalClear=null,this.wrappedClear=null,this.started=!1,this.capturing=!1,this.dispatching=!1,this.buffer=new $n(e.max)}start(){if(this.started)return;this.started=!0;const e=window.console;for(const n of Hn){const i=e[n];if(typeof i!="function")continue;const s=i;this.originals.set(n,s);const o=this,l=function(...a){o.capture(n,a),o.dispatching=!0;try{return s.apply(this,a)}finally{o.dispatching=!1}};l.__bugTap=!0,this.wrapped.set(n,l);try{e[n]=l}catch(a){}}const r=e.clear;if(typeof r=="function"){this.originalClear=r;const n=this,i=function(){return n.buffer.clear(),n.originalClear.apply(this)};i.__bugTap=!0,this.wrappedClear=i;try{e.clear=i}catch(s){}}}stop(){if(!this.started)return;this.started=!1;const e=window.console;for(const r of Hn){const n=this.wrapped.get(r),i=this.originals.get(r);if(!(!n||!i)&&e[r]===n)try{e[r]=i}catch(s){}}if(this.wrappedClear&&this.originalClear&&e.clear===this.wrappedClear)try{e.clear=this.originalClear}catch(r){}this.wrapped.clear(),this.originals.clear(),this.wrappedClear=null,this.originalClear=null}getLogs(){return this.buffer.toArray()}getPatchState(){if(!this.started)return!1;const e=window.console;for(const r of Hn){const n=this.wrapped.get(r);if(n&&e[r]===n)return!0}return!1}clear(){this.buffer.clear()}capture(e,r){if(!(!this.started||this.capturing||this.dispatching)){this.capturing=!0;try{if(e==="assert"&&r[0])return;const{args:n,text:i}=za(e==="assert"?r.slice(1):r);if(this.options.excludePatterns.some(o=>qe(o,i)))return;const s=this.buffer.last();if(s&&s.level===e&&s.text===i){this.buffer.updateLast(o=>({...o,count:(o.count||1)+1,timestamp:Date.now()}));return}this.buffer.push({level:e,timestamp:Date.now(),args:n,text:i})}catch(n){}finally{this.capturing=!1}}}}const Wa=1e3,fs=200,Va=6e4,Ka=20,Xa=50,Dr=2e3;function ds(t){if(t!=null)try{if(t instanceof Error){const e=`${t.name||"Error"}: ${t.message}`,r=typeof t.stack=="string"?t.stack.split(`
@@ -8,7 +8,7 @@ ${a}`:""}`,us)}if(t instanceof Date)try{return t.toISOString()}catch(a){return"[
8
8
  ${r}`:e).slice(0,Dr)}return typeof t=="string"?t.slice(0,Dr):JSON.stringify(t).slice(0,Dr)}catch(e){return String(t).slice(0,Dr)}}const Ya=/(?:[\\/]src[\\/](?:core|ui|transport)[\\/](?:browser-api-errors|error-collector|console-collector|network-collector|breadcrumbs|collector|resource-timing|body|serialize|selector|user|tongji|error-noise|network-record|ring-buffer|byte-buffer|panel(?:-mount)?|screenshot|element-picker|floating-button|shadow-host|visibility|transport|payload|log-item|upload|offline-queue)\.(?:ts|vue)|[\\/]src[\\/](?:index|sdk|config|integrations)\.ts|@xysfe[\\/]bug-tap|[\\/]bug-tap(?:\.min)?\.js|\bsafeCallback\b)/i;function hs(t){if(!t)return;const e=t.split(`
9
9
  `),r=e[0]||"",n=e.slice(1).filter(s=>!Ya.test(s));return[r,...n].slice(0,Ka).join(`
10
10
  `)}class Ga{constructor(e){this.options=e,this.signatures=new Map,this.started=!1,this.listener=null,this.onError=r=>{try{if(r.target&&r.target!==window){this.options.resourceErrors!==!1&&this.pushResourceError(r);return}if(as(r.error)||r.error===void 0&&$a())return;const n=(r.message||"Script error.").replace(/^Uncaught\s+/,""),i=r.error,s=i&&typeof i.stack=="string"?i.stack:"";this.push({type:"error",message:this.sanitize(n),filename:r.filename?this.sanitize(r.filename):void 0,lineno:r.lineno||void 0,colno:r.colno||void 0,stack:s?this.sanitize(hs(s)||""):void 0,cause:ds(i==null?void 0:i.cause),timestamp:Date.now(),count:1})}catch(n){}},this.onRejection=r=>{try{const n=r.reason;if(as(n))return;this.push({...this.fromUnknown(n),type:"unhandledrejection"})}catch(n){}},this.buffer=new $n(e.max)}setListener(e){this.listener=e}pushResourceError(e){const r=e.target;if(!r||typeof r.tagName!="string")return;const n=r.tagName.toLowerCase(),i=r.currentSrc||r.getAttribute("src")||r.getAttribute("href")||"";this.push({type:"resource",message:this.sanitize(`Resource load failed: <${n}>${i?` ${i}`:""}`),filename:i?this.sanitize(i):void 0,timestamp:Date.now(),count:1})}captureFromBrowserApi(e,r){try{this.push(this.fromUnknown(e,`[${r}]`,r))}catch(n){}}captureException(e,r){try{this.push(this.fromUnknown(e,"",void 0,r),!1)}catch(n){}}captureMessage(e,r){try{this.push({type:"error",message:this.sanitize(String(e!=null?e:"")),context:r&&Object.keys(r).length>0?r:void 0,timestamp:Date.now(),count:1},!1)}catch(n){}}fromUnknown(e,r="",n,i){let s,o,l;if(e instanceof Error)s=`${e.name||"Error"}: ${e.message}`,o=e.stack,l=ds(e.cause);else if(typeof e=="string")s=e;else try{s=JSON.stringify(e)}catch(c){s=String(e)}const a=o?hs(o):void 0,u=Pn(a);return{type:"error",message:this.sanitize(n?`${r} ${s}`:`${r}${s}`),filename:u!=null&&u.url?this.sanitize(u.url):void 0,lineno:u==null?void 0:u.line,colno:u==null?void 0:u.column,stack:a?this.sanitize(a):void 0,cause:l,context:i&&Object.keys(i).length>0?i:void 0,timestamp:Date.now(),count:1}}start(){if(!this.started){this.started=!0;try{this.previousStackTraceLimit=Error.stackTraceLimit,Error.stackTraceLimit=Xa}catch(e){}window.addEventListener("error",this.onError,!0),window.addEventListener("unhandledrejection",this.onRejection)}}stop(){if(this.started&&(this.started=!1,window.removeEventListener("error",this.onError,!0),window.removeEventListener("unhandledrejection",this.onRejection),this.previousStackTraceLimit!==void 0)){try{Error.stackTraceLimit=this.previousStackTraceLimit}catch(e){}this.previousStackTraceLimit=void 0}}getErrors(){return this.buffer.toArray()}getPatchState(){return this.started}clear(){this.buffer.clear(),this.signatures.clear()}push(e,r=!0){if(r&&this.shouldDrop(e))return;const n=`${e.type}|${e.message}|${e.filename||""}|${e.lineno||""}`,i=this.signatures.get(n),s=e.timestamp;if(r&&i&&s-i.lastTs<Wa){if(this.buffer.includes(i.record)){i.record.count+=1,i.lastTs=s;return}this.signatures.delete(n)}if(this.signatures.size>=fs&&(this.pruneSignatures(s),this.signatures.size>=fs&&this.signatures.clear()),this.signatures.set(n,{record:e,lastTs:s}),this.buffer.push(e),this.listener)try{this.listener(e)}catch(o){}}pruneSignatures(e){for(const[r,n]of this.signatures)(e-n.lastTs>=Va||!this.buffer.includes(n.record))&&this.signatures.delete(r)}shouldDrop(e){const r=this.options.ignoreErrors||[];if(r.length>0&&va(e.message,r)||xa(e))return!0;const n=ma(e.stack,e.filename);return!Sa(n,this.options.allowUrls||[],this.options.denyUrls||[])}sanitize(e){return String(e).slice(0,4e3)}}class Ja{constructor(e,r,n){this.maxItems=e,this.maxBytes=r,this.sizeOf=n,this.items=[],this.sizes=[],this.head=0,this.total=0,this.droppedItems=0,this.droppedBytes=0,this.evictedItems=0,this.evictedBytes=0}get size(){return this.items.length-this.head}get bytes(){return this.total}get dropped(){return{count:this.droppedItems,bytes:this.droppedBytes}}get evicted(){return{count:this.evictedItems,bytes:this.evictedBytes}}push(e){const r=this.sizeOf(e);if(r>this.maxBytes)return this.droppedItems+=1,this.droppedBytes+=r,"dropped";let n=!1;for(;this.size>0&&(this.total+r>this.maxBytes||this.size>=this.maxItems);)this.shift(),n=!0;return this.items.push(e),this.sizes.push(r),this.total+=r,n?"evicted":"ok"}toArray(){return this.items.slice(this.head)}update(e,r){for(let n=this.head;n<this.items.length;n+=1){const i=this.items[n];if(!e(i))continue;const s=r(i),o=this.sizeOf(s),l=o-(this.sizes[n]||0);return this.total+l>this.maxBytes?"dropped":(this.items[n]=s,this.sizes[n]=o,this.total+=l,"ok")}return"missed"}clear(){this.items=[],this.sizes=[],this.head=0,this.total=0,this.droppedItems=0,this.droppedBytes=0,this.evictedItems=0,this.evictedBytes=0}shift(){const e=this.sizes[this.head]||0;this.items[this.head]=void 0,this.head+=1,this.total-=e,this.evictedItems+=1,this.evictedBytes+=e,this.head>=this.items.length?(this.items=[],this.sizes=[],this.head=0):this.head>64&&this.head*2>this.items.length&&(this.items=this.items.slice(this.head),this.sizes=this.sizes.slice(this.head),this.head=0)}}const Qa=/text\/event-stream/i,Za=/^(?:image|video|audio|font)\/|^application\/(?:octet-stream|x-protobuf|protobuf|zip|gzip|x-zip-compressed|pdf|wasm|vnd\.ms-fontobject)/i;function jn(t,e){if(e<=0)return t;let r=0,n=0;for(;n<t.length;){const i=t.charCodeAt(n);let s,o=1;if(i<128?s=1:i<2048?s=2:i<55296||i>=57344?s=3:(s=4,o=i>=56320?1:2),r+s>e)break;r+=s,n+=o}return n>=t.length?t:`${t.slice(0,n)}…[truncated]`}function Vt(t){let e=0;for(let r=0;r<t.length;r+=1){const n=t.charCodeAt(r);n<128?e+=1:n<2048?e+=2:n<55296||n>=57344?e+=3:(e+=4,r+=1)}return e}function tc(t){if(t!=null)try{if(typeof t=="string")return t;if(typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams)return t.toString();if(typeof FormData!="undefined"&&t instanceof FormData){const e=[];return t.forEach((r,n)=>{if(typeof File!="undefined"&&r instanceof File){const i=r.name||"blob",s=r.type||"unknown";e.push(`${n}=[File ${i} ${r.size}B ${s}]`);return}if(typeof Blob!="undefined"&&r instanceof Blob){e.push(`${n}=[Blob ${r.size}B ${r.type||"unknown"}]`);return}e.push(`${n}=${String(r)}`)}),e.join("&")}return typeof Blob!="undefined"&&t instanceof Blob?`[Blob ${t.size}B ${t.type||"unknown"}]`:typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?`[Binary ${t.byteLength}B]`:typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView(t)?`[Binary ${t.byteLength}B]`:typeof ReadableStream!="undefined"&&t instanceof ReadableStream?"[ReadableStream]":`[${Object.prototype.toString.call(t).slice(8,-1)}]`}catch(e){return"[Unreadable]"}}function Ae(t,e=Number.MAX_SAFE_INTEGER){try{return Vt(JSON.stringify(t))}catch(r){return e}}function ps(t,e,r){const n=(t||"").toLowerCase();return!(Qa.test(n)||Za.test(n)||e>0&&e>r)}function gs(t,e){if(typeof t.getReader!="function"||typeof TextDecoder=="undefined")return new Response(t).text();const r=t.getReader(),n=new TextDecoder("utf-8",{fatal:!1}),i=[];let s=0,o=!1;const l=()=>{try{Promise.resolve(r.cancel()).catch(()=>{})}catch(c){}},a=()=>r.read().then(({done:c,value:d})=>c?(i.push(n.decode()),u()):d?(s+=d.byteLength,s>e?(o=!0,l(),u()):(i.push(n.decode(d,{stream:!0})),a())):a(),()=>(o=!0,l(),u())),u=()=>{const c=i.join("");return o?`${c}…[truncated]`:c};return a()}function ec(t,e){try{const r=t.getResponseHeader("content-type"),n=Number(t.getResponseHeader("content-length")||0);if(!ps(r,n,e))return;const i=t.responseType;if(i===""||i==="text"){const s=t.responseText;return s?jn(s,e):void 0}if(i==="json"){const s=t.response;if(s==null)return;try{return jn(JSON.stringify(s),e)}catch(o){return}}return`[${i}]`}catch(r){return}}const rc=2e3,nc=500,ic=1e3;function ir(t){return Number.isFinite(t)&&t>0?Math.round(t):0}function sc(t){return{dns:ir(t.domainLookupEnd-t.domainLookupStart),connect:ir(t.connectEnd-t.connectStart),ttfb:ir(t.responseStart-t.startTime),download:ir(t.responseEnd-t.responseStart),total:ir(t.responseEnd-t.startTime)}}class oc{constructor(){this.started=new Map,this.enabled=!0}remember(e,r,n){if(!(!this.enabled||!Number.isFinite(n))&&(this.started.set(e,{url:r,start:n}),this.started.size>ic)){const i=this.started.keys().next();i.done||this.started.delete(i.value)}}attach(e){if(e.timing)return e;const r=this.started.get(e.id);if(!r)return e;const n=this.find(r.url,r.start);return n?{...e,timing:n}:e}clear(){this.started.clear()}find(e,r){if(this.enabled)try{if(typeof performance=="undefined"||typeof performance.getEntriesByName!="function")return;const n=performance.getEntriesByName(e);if(!n.length||n.length>nc)return;let i,s=1/0;for(const o of n){if(typeof o.responseEnd!="number"||o.responseEnd<=0)continue;const l=Math.abs(o.startTime-r);l<s&&(s=l,i=o)}return!i||s>rc?void 0:sc(i)}catch(n){this.enabled=!1;return}}}function sr(t){try{return new URL(t,location.href).href}catch(e){return t}}const lc=4096,ac=40;function cc(t,e){return e===!0||e.indexOf(t)>=0}function we(t,e,r,n){const i=String(e||"").trim().toLowerCase();if(!i||!cc(i,n)||!(i in t)&&Object.keys(t).length>=ac)return;const s=String(r!=null?r:"").slice(0,lc);s&&(t[i]=s)}function Un(t,e){if(!t)return;const r={};try{if(t&&typeof t.forEach=="function"&&(typeof Headers=="undefined"||t instanceof Headers||typeof t.get=="function"))t.forEach((n,i)=>we(r,i,n,e));else if(t&&typeof t.get=="function"){const n=e===!0?[...$r]:e;for(const i of n){const s=t.get(i);s&&we(r,i,s,!0)}}else if(Array.isArray(t))for(const n of t)Array.isArray(n)&&n.length>=2&&we(r,String(n[0]),n[1],e);else if(typeof t=="object")for(const[n,i]of Object.entries(t))Array.isArray(i)?i.forEach(s=>we(r,n,s,e)):we(r,n,i,e)}catch(n){}return Object.keys(r).length>0?r:void 0}function uc(t,e){return t?e?{...t,...e}:t:e}function fc(t,e){const r={};return t.trim().split(/[\r\n]+/).forEach(n=>{const i=n.indexOf(":");i<=0||we(r,n.slice(0,i),n.slice(i+1).trim(),e)}),Object.keys(r).length>0?r:void 0}function ve(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}function ms(t){try{const e=new URL(t,location.href);return`${e.origin}${e.pathname.replace(/\/+$/,"")||"/"}`}catch(e){return null}}function dc(t){return typeof t=="string"?t:typeof URL!="undefined"&&t instanceof URL?t.href:typeof Request!="undefined"&&t instanceof Request?t.url:String(t)}class hc{constructor(e){this.options=e,this.timing=new oc,this.pendingXhr=new WeakMap,this.originalFetch=null,this.wrappedFetch=null,this.originalOpen=null,this.wrappedOpen=null,this.originalSend=null,this.wrappedSend=null,this.originalSetRequestHeader=null,this.wrappedSetRequestHeader=null,this.originalWebSocket=null,this.wrappedWebSocket=null,this.originalEventSource=null,this.wrappedEventSource=null,this.started=!1,this.seq=0,this.listener=null,this.buffer=new Ja(e.max,e.maxBytes,r=>this.sizeOf(r)),this.selfUrls=(e.selfUrls||[]).filter(Boolean).map(r=>ms(r)).filter(r=>r!==null),this.matchers=(e.excludeUrls||[]).slice(),this.requestHeaderAllow=e.requestHeaders===!0?!0:(e.requestHeaders||[]).map(r=>r.toLowerCase()),this.responseHeaderAllow=e.responseHeaders===!0?!0:Array.from(new Set([...$r,...(e.responseHeaders||[]).map(r=>r.toLowerCase())]))}setListener(e){this.listener=e}skipped(e){try{const r=ms(e);if(r&&this.selfUrls.indexOf(r)>=0)return!0;for(const n of this.matchers)if(qe(n,e))return!0;return!1}catch(r){return!1}}sizeOf(e){let r=0;for(const n of[e.reqHeaders,e.resHeaders])if(n)for(const i of Object.keys(n))r+=Vt(i)+Vt(n[i]||"")+6;return Vt(e.url||"")+Vt(e.reqBody||"")+Vt(e.resBody||"")+Vt(e.error||"")+Vt(e.contentType||"")+r+(e.timing?80:0)+96}start(){if(!this.started&&(this.started=!0,this.patchFetch(),this.patchXhr(),this.options.realtime!==!1))try{this.patchRealtime()}catch(e){}}stop(){if(this.started){if(this.started=!1,this.wrappedFetch&&typeof window.fetch=="function"&&window.fetch===this.wrappedFetch)try{window.fetch=this.originalFetch}catch(e){}if(this.wrappedOpen&&XMLHttpRequest.prototype.open===this.wrappedOpen)try{XMLHttpRequest.prototype.open=this.originalOpen}catch(e){}if(this.wrappedSend&&XMLHttpRequest.prototype.send===this.wrappedSend)try{XMLHttpRequest.prototype.send=this.originalSend}catch(e){}if(this.wrappedSetRequestHeader&&XMLHttpRequest.prototype.setRequestHeader===this.wrappedSetRequestHeader)try{XMLHttpRequest.prototype.setRequestHeader=this.originalSetRequestHeader}catch(e){}if(this.wrappedWebSocket&&window.WebSocket===this.wrappedWebSocket)try{window.WebSocket=this.originalWebSocket}catch(e){}if(this.wrappedEventSource&&window.EventSource===this.wrappedEventSource)try{window.EventSource=this.originalEventSource}catch(e){}this.originalFetch=null,this.wrappedFetch=null,this.originalOpen=null,this.wrappedOpen=null,this.originalSend=null,this.wrappedSend=null,this.originalSetRequestHeader=null,this.wrappedSetRequestHeader=null,this.originalWebSocket=null,this.wrappedWebSocket=null,this.originalEventSource=null,this.wrappedEventSource=null}}getRecords(){return this.buffer.toArray().map(e=>this.timing.attach(e)).sort((e,r)=>e.timestamp-r.timestamp)}getPatchState(){return{fetch:!!this.wrappedFetch&&typeof window.fetch=="function"&&window.fetch===this.wrappedFetch,xhr:typeof XMLHttpRequest!="undefined"&&!!this.wrappedOpen&&!!this.wrappedSend&&XMLHttpRequest.prototype.open===this.wrappedOpen&&XMLHttpRequest.prototype.send===this.wrappedSend,websocket:!!this.wrappedWebSocket&&typeof window.WebSocket=="function"&&window.WebSocket===this.wrappedWebSocket,eventsource:!!this.wrappedEventSource&&typeof window.EventSource=="function"&&window.EventSource===this.wrappedEventSource}}getDropped(){const e=this.buffer.dropped,r=this.buffer.evicted;return{droppedCount:e.count,droppedBytes:e.bytes,evictedCount:r.count,evictedBytes:r.bytes}}clear(){this.buffer.clear(),this.timing.clear()}patchFetch(){if(typeof window.fetch!="function")return;const e=window.fetch;this.originalFetch=e;const r=this,n=function(i,s){if(!r.started)return e.apply(this,arguments);const o=ve(),l=r.nextId(),a=Date.now(),u=dc(i),c=sr(u);if(r.skipped(c))return e.apply(this,arguments);r.timing.remember(l,c,o);const d=(s&&s.method||(typeof Request!="undefined"&&i instanceof Request?i.method:"GET")).toUpperCase(),p=r.requestHeadersOf(s&&s.headers,i),x=r.bodyOf(s&&s.body),R=x===void 0&&r.options.captureBody&&typeof Request!="undefined"&&i instanceof Request?r.requestBodyOf(i):Promise.resolve(x);let k;try{k=e.apply(this,arguments)}catch(N){throw r.record({id:l,type:"fetch",method:d,url:c,reqHeaders:p,reqBody:x,durationMs:Math.round(ve()-o),error:N instanceof Error?N.message:String(N),timestamp:a}),N}return k.then(N=>(r.started&&r.observeResponse(N,{id:l,method:d,url:c,start:o,timestamp:a,reqHeaders:p,reqBody:x,reqBodyLater:R}),N),N=>{throw r.started&&r.recordWithBody({id:l,type:"fetch",method:d,url:c,reqHeaders:p,durationMs:Math.round(ve()-o),error:N instanceof Error?N.message:String(N),timestamp:a},R),N})};n.__bugTap=!0,this.wrappedFetch=n;try{window.fetch=n}catch(i){}}patchXhr(){if(typeof XMLHttpRequest=="undefined")return;const e=this,r=XMLHttpRequest.prototype,n=r.open,i=r.send,s=r.setRequestHeader;this.originalOpen=n,this.originalSend=i,this.originalSetRequestHeader=s;const o=function(u,c){const d=e.requestHeaderAllow;if(e.started&&(d===!0||d.length>0))try{const p=e.pendingXhr.get(this);if(p){const x=p.reqHeaders||{};we(x,String(u),c,d),p.reqHeaders=Object.keys(x).length>0?x:void 0}}catch(p){}return s.call(this,u,c)},l=function(u,c,...d){if(!e.started)return n.apply(this,[u,c,...d]);try{e.pendingXhr.set(this,{id:e.nextId(),method:String(u||"GET").toUpperCase(),url:sr(String(c)),start:0,timestamp:Date.now()})}catch(p){}return n.apply(this,[u,c,...d])},a=function(u){if(!e.started)return i.apply(this,[u]);const c=e.pendingXhr.get(this);if(c&&e.skipped(c.url))return e.pendingXhr.delete(this),i.apply(this,[u]);if(c){c.start=ve(),c.timestamp=Date.now(),c.reqBody=e.bodyOf(u),e.timing.remember(c.id,c.url,c.start);try{this.addEventListener("abort",()=>{c.aborted=!0},{once:!0})}catch(d){}try{this.addEventListener("loadend",()=>{if(e.started)try{const d=this.status,p=c.aborted===!0;e.record({id:c.id,type:"xhr",method:c.method,url:c.url,reqHeaders:c.reqHeaders,reqBody:c.reqBody,resBody:e.options.captureBody?ec(this,e.options.maxCloneBytes):void 0,status:d||void 0,ok:p?void 0:d>=200&&d<400,durationMs:Math.round(ve()-c.start),error:d===0&&!p?"Network Error":void 0,resHeaders:e.xhrResponseHeaders(this),timestamp:c.timestamp})}catch(d){}},{once:!0})}catch(d){}}return i.apply(this,[u])};this.wrappedOpen=l,this.wrappedSend=a,this.wrappedSetRequestHeader=o,this.wrappedOpen.__bugTap=!0,this.wrappedSend.__bugTap=!0,this.wrappedSetRequestHeader.__bugTap=!0;try{r.open=this.wrappedOpen,r.send=this.wrappedSend,r.setRequestHeader=this.wrappedSetRequestHeader}catch(u){}}patchRealtime(){this.patchWebSocket(),this.patchEventSource()}wrapRealtime(e,r,n){if(e.__bugTap)return null;const i=this,s=function(o,l){const a=n(o,l);try{i.observeRealtime(a,r,String(o))}catch(u){}return a};return Object.setPrototypeOf(s,e),s.prototype=e.prototype,s.__bugTap=!0,s}patchWebSocket(){if(typeof window=="undefined"||typeof window.WebSocket!="function")return;const e=window.WebSocket,r=this.wrapRealtime(e,"websocket",(n,i)=>i===void 0?new e(n):new e(n,i));if(r){this.originalWebSocket=e,this.wrappedWebSocket=r;try{window.WebSocket=this.wrappedWebSocket}catch(n){this.originalWebSocket=null,this.wrappedWebSocket=null}}}patchEventSource(){if(typeof window=="undefined"||typeof window.EventSource!="function")return;const e=window.EventSource,r=this.wrapRealtime(e,"eventsource",(n,i)=>i===void 0?new e(n):new e(n,i));if(r){this.originalEventSource=e,this.wrappedEventSource=r;try{window.EventSource=this.wrappedEventSource}catch(n){this.originalEventSource=null,this.wrappedEventSource=null}}}observeRealtime(e,r,n){if(this.started===!1)return;const i=sr(n);if(this.skipped(i))return;const s=this.nextId(),o=ve(),l=Date.now();this.pushRecord({id:s,type:r,method:r==="websocket"?"WS":"SSE",url:i,durationMs:0,timestamp:l});const a=u=>{if(this.started)try{this.buffer.update(c=>c.id===s,c=>({...c,...u,durationMs:Math.round(ve()-o)}))}catch(c){}};try{e.addEventListener("open",()=>a({ok:!0,error:void 0})),e.addEventListener("error",()=>a({ok:!1,error:r==="websocket"?"WebSocket error":"EventSource error"})),e.addEventListener("close",u=>{const c=u,d=typeof c.code=="number"?c.code:void 0,p=typeof c.reason=="string"?c.reason:"";a({status:d,ok:d===1e3||d===1005,error:d!==void 0&&d!==1e3&&d!==1005?`closed (${d}${p?`: ${p}`:""})`:void 0})})}catch(u){}}bodyOf(e){if(this.options.captureBody)return tc(e)}requestHeadersOf(e,r){if(this.requestHeaderAllow!==!0&&this.requestHeaderAllow.length===0)return;const n=Un(e,this.requestHeaderAllow),i=typeof Request!="undefined"&&r instanceof Request?Un(r.headers,this.requestHeaderAllow):void 0;return uc(i,n)}xhrResponseHeaders(e){try{let r;if(this.responseHeaderAllow===!0){const i=e.getAllResponseHeaders?e.getAllResponseHeaders():"";if(i)return fc(i,!0);r=[...$r]}else r=this.responseHeaderAllow;const n={};for(const i of r){const s=e.getResponseHeader(i);s&&we(n,i,s,!0)}return Object.keys(n).length>0?n:void 0}catch(r){return}}textOf(e){return e||void 0}observeResponse(e,r){var i;const{reqBodyLater:n}=r;try{const s={id:r.id,type:"fetch",method:r.method,url:r.url,status:e.status,ok:e.ok,durationMs:Math.round(ve()-r.start),timestamp:r.timestamp,contentType:e.headers.get("content-type")||void 0,reqHeaders:r.reqHeaders,resHeaders:Un(e.headers,this.responseHeaderAllow)};if(!this.options.captureBody){this.recordWithBody(s,n);return}const o=Number(e.headers.get("content-length")||0);if(!ps((i=s.contentType)!=null?i:null,o,this.options.maxCloneBytes)){this.recordWithBody(s,n);return}let l;try{l=e.clone()}catch(u){this.recordWithBody(s,n);return}const a=l.body;if(!a||typeof TextDecoder=="undefined"){l.text().then(u=>this.recordWithBody({...s,resBody:this.textOf(jn(u,this.options.maxCloneBytes))},n),()=>this.recordWithBody(s,n));return}this.recordStreaming(s,n,gs(a,this.options.maxCloneBytes))}catch(s){}}requestBodyOf(e){if(!e.body)return Promise.resolve(void 0);try{const r=e.clone().body;return!r||typeof TextDecoder=="undefined"?Promise.resolve(void 0):gs(r,this.options.maxCloneBytes).then(n=>this.textOf(n),()=>{})}catch(r){return Promise.resolve(void 0)}}recordStreaming(e,r,n){const i=this.recordWithBody(e,r);Promise.all([i,n.catch(()=>"")]).then(([,s])=>{if(!this.started)return;const o=this.textOf(s);o&&this.buffer.update(l=>l.id===e.id,l=>l.resBody?l:{...l,resBody:o})}).catch(()=>{})}record(e){this.recordWithBody(e,Promise.resolve(e.reqBody))}recordWithBody(e,r){return r.catch(()=>{}).then(n=>{this.started&&this.pushRecord(n?{...e,reqBody:n}:e)})}pushRecord(e){try{if(!e.url||e.url.startsWith("data:")||e.url.startsWith("blob:")||this.skipped(e.url))return;if(this.buffer.push({...e}),this.listener)try{this.listener(e)}catch(r){}}catch(r){}}nextId(){return this.seq+=1,`n${Date.now().toString(36)}${this.seq}`}}function pc(){try{if(typeof performance=="undefined")return 0;const t=typeof performance.timeOrigin=="number"?performance.timeOrigin:0,e=typeof performance.getEntriesByType=="function"?performance.getEntriesByType("navigation")[0]:void 0;if(t>0){const r=e&&Number.isFinite(e.startTime)&&e.startTime>0?e.startTime:0;return t+r}if(typeof performance.now=="function"){const r=performance.now();if(Number.isFinite(r)&&r>=0)return Date.now()-r}}catch(t){}return 0}function gc(t){const e=Math.max(1024,Math.floor((t.transport.maxItemBytes-32768)/2));return Math.min(t.collect.maxCloneBytes,e)}class bs{constructor(e){this.config=e,this.consoleCollector=null,this.errorCollector=null,this.networkCollector=null,this.breadcrumbCollector=null,this.browserApiErrors=null,this.startedAt=0}start(){var r,n;const e=this.config;this.startedAt=Date.now(),e.collect.console&&(this.consoleCollector=new qa({max:e.collect.maxConsoleLogs,excludePatterns:e.privacy.excludeConsolePatterns}),this.consoleCollector.start()),this.errorCollector=new Ga({max:e.collect.maxErrors,ignoreErrors:e.filtering.ignoreErrors,denyUrls:e.filtering.denyUrls,allowUrls:e.filtering.allowUrls,resourceErrors:e.collect.resourceErrors}),e.collect.error&&(this.errorCollector.start(),this.browserApiErrors=new Ha({capture:(i,s)=>{var o;return(o=this.errorCollector)==null?void 0:o.captureFromBrowserApi(i,s)},eventListeners:e.collect.eventListenerErrors}),this.browserApiErrors.start()),e.collect.network&&(this.networkCollector=new hc({max:e.collect.maxNetworkRecords,excludeUrls:e.privacy.excludeUrls,selfUrls:[e.endpoint,e.upload.url],captureBody:e.collect.networkBody,realtime:e.collect.realtime,requestHeaders:e.collect.requestHeaders,responseHeaders:e.collect.responseHeaders,maxBytes:e.collect.maxNetworkBytes,maxCloneBytes:gc(e)}),this.networkCollector.start()),e.collect.breadcrumbs&&(this.breadcrumbCollector=new La({max:e.collect.maxBreadcrumbs,dom:!0,navigation:!0,network:e.collect.network,error:e.collect.error,excludeUrls:e.privacy.excludeBreadcrumbUrls,beforeBreadcrumb:e.hooks.beforeBreadcrumb}),this.breadcrumbCollector.start(),(r=this.networkCollector)==null||r.setListener(i=>{var s;return(s=this.breadcrumbCollector)==null?void 0:s.addNetwork(i)}),(n=this.errorCollector)==null||n.setListener(i=>{var s;return(s=this.breadcrumbCollector)==null?void 0:s.addError({message:i.message,timestamp:i.timestamp,count:i.count})}))}stop(){var e,r,n,i,s;(e=this.consoleCollector)==null||e.stop(),(r=this.browserApiErrors)==null||r.stop(),(n=this.errorCollector)==null||n.stop(),(i=this.networkCollector)==null||i.stop(),(s=this.breadcrumbCollector)==null||s.stop(),this.consoleCollector=null,this.errorCollector=null,this.browserApiErrors=null,this.networkCollector=null,this.breadcrumbCollector=null}getData(){const e=this.networkCollector?this.networkCollector.getRecords():[],r=this.consoleCollector?this.consoleCollector.getLogs():[],n=this.errorCollector?this.errorCollector.getErrors():[],i=this.networkCollector?this.networkCollector.getPatchState():{fetch:!1,xhr:!1,websocket:!1,eventsource:!1},s=pc(),o=this.breadcrumbCollector?this.breadcrumbCollector.getBreadcrumbs():void 0;return{logs:r,errors:n,network:e,networkDropped:this.networkCollector?this.networkCollector.getDropped():void 0,collector:{startedAt:this.startedAt,earlyGapMs:s>0&&this.startedAt>s?Math.round(this.startedAt-s):0,patched:{console:this.consoleCollector?this.consoleCollector.getPatchState():!1,fetch:i.fetch,xhr:i.xhr,error:this.errorCollector?this.errorCollector.getPatchState():!1,websocket:i.websocket,eventsource:i.eventsource},counts:{logs:r.length,errors:n.length,network:e.length,breadcrumbs:o?o.length:0},breadcrumbLimit:this.breadcrumbCollector?this.breadcrumbCollector.limit:void 0,breadcrumbEvicted:this.breadcrumbCollector?this.breadcrumbCollector.evicted:void 0},breadcrumbs:o}}clear(){var e,r,n,i;(e=this.consoleCollector)==null||e.clear(),(r=this.errorCollector)==null||r.clear(),(n=this.networkCollector)==null||n.clear(),(i=this.breadcrumbCollector)==null||i.clear()}captureException(e,r){var n;(n=this.errorCollector)==null||n.captureException(e,r)}captureMessage(e,r){var n;(n=this.errorCollector)==null||n.captureMessage(e,r)}addBreadcrumb(e){var r;(r=this.breadcrumbCollector)==null||r.add(e)}disableRouteCapture(){var e;(e=this.breadcrumbCollector)==null||e.disableNavigationCapture()}}const ys="__mcl_session_track__",Fn="_xys_s_id",zn=2628e4,ws="abcdefhijklmnopqrstuvwxyz1234567890",mc=/^cps.*\.(xinhulu|cxmuc)\.com$|^.+\.(kachabao|kachabao100)\.com$/;function vs(){try{return typeof location!="undefined"?location.host:""}catch(t){return""}}function xs(t){return/^niubao.*\.(xinhulu|cxmuc)\.com$/.test(t)||/^.+\.(niubao100|baichuan100)\.com$/.test(t)}function bc(t){return mc.test(t)}function Hr(t){try{const e=new RegExp("(?:^|;+|\\s+)"+t+"=([^;]*)"),r=document.cookie.match(e);return r&&r[1]?r[1]:""}catch(e){return""}}function qn(t,e,r){try{const n=new Date;n.setMinutes(n.getMinutes()+r),document.cookie=`${t}=${escape(e)};expires=${n.toUTCString()};path=/`}catch(n){}}function yc(t){try{if(typeof localStorage!="undefined")return localStorage.getItem(t)}catch(e){}return Hr(t)}function wc(t,e){try{if(typeof localStorage!="undefined"){localStorage.setItem(t,e);return}}catch(r){}qn(t,e,zn)}function Ss(t){let e="";for(let r=0;r<t;r+=1)e+=ws.charAt(Math.floor(Math.random()*ws.length));return e}function vc(){const t=vs();let e="xxid";return bc(t)?e="cps_xxid":xs(t)&&(e="niubao_xxid"),Hr(e)}function xc(){return xs(vs())?Hr("niubao_subid"):null}function Sc(){let t=yc(ys);const e=Hr(Fn);return t?(t!==e&&qn(Fn,t,zn),t):(e?t=e:(t=Ss(24)+Ss(8),qn(Fn,t,zn)),wc(ys,t),t)}function Es(){try{const t=window.tongji;return t&&typeof t=="object"?t:null}catch(t){return null}}function Wn(t,e){let r;if(typeof t=="function")try{r=t.call(Es())}catch(n){}if((r==null||r==="")&&(r=e()),!(r==null||r===""))return String(r)}let Vn,jr=0;const Ec=3e4;function _c(){if(typeof document=="undefined")return;const t=Date.now();if(jr>0&&t-jr<Ec)return Vn;try{const e=Es(),r=Wn(e==null?void 0:e.getXid,vc),n=Wn(e==null?void 0:e.getSubId,xc),i=Wn(e==null?void 0:e.getSessionId,Sc),s=r||n||i?{xid:r,subId:n,sessionId:i}:void 0;return Vn=s,jr=t,s}catch(e){return}}function Cc(){Vn=void 0,jr=0}function _s(t,e){for(const[r,n]of e){const i=t.match(r);if(i)return{name:n,version:i[1]}}return null}function Tc(t){const e=String(t||""),r=_s(e,[[/MicroMessenger\/([\d.]+)/i,"WeChat"],[/AlipayClient\/([\d.]+)/i,"Alipay"],[/Edg\/([\d.]+)/i,"Edge"],[/OPR\/([\d.]+)/i,"Opera"],[/Firefox\/([\d.]+)/i,"Firefox"],[/Chrome\/([\d.]+)/i,"Chrome"],[/Version\/([\d.]+).*Safari/i,"Safari"],[/MSIE ([\d.]+)/i,"IE"],[/Trident\/.*rv:([\d.]+)/i,"IE"]]),n=_s(e,[[/HarmonyOS/i,"HarmonyOS"],[/Windows NT 10\.0/i,"Windows"],[/Windows NT/i,"Windows"],[/Android[ /]([\d.]+)/i,"Android"],[/(?:iPhone|iPad|iPod).*OS ([\d_]+)/i,"iOS"],[/Mac OS X/i,"macOS"],[/Linux/i,"Linux"]]);return{browser:r==null?void 0:r.name,browserVersion:r==null?void 0:r.version,os:n==null?void 0:n.name}}function Cs(){return{url:location.href,referrer:document.referrer&&document.referrer!==location.href?document.referrer:void 0,title:document.title||void 0}}function Ts(t){const e=Number.isFinite(t)&&t>0?t:1;return Math.round(e*100)/100}function kc(t,e,r){return`${t||0}*${e||0} @ ${Ts(r)}x`}function Rc(t){const e=navigator.userAgent,r=Tc(e);let n="";try{n=Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch(a){n=""}const i=typeof window.screen!="undefined"?window.screen:void 0,s=i&&(i.width||i.availWidth)||0,o=i&&(i.height||i.availHeight)||0,l=Ts(window.devicePixelRatio||1);return{userAgent:e,platform:navigator.platform||void 0,browser:r.browser,browserVersion:r.browserVersion,os:r.os,screenWidth:s,screenHeight:o,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,dpr:l,device:kc(s,o,l),language:navigator.language||"",timezone:n}}function Ac(t){return{page:Cs(),browser:Rc()}}const Mc=30,ks=200;function Oc(t){if(!t)return;let e=t;if(typeof t=="function")try{e=t()}catch(s){return}const r=Zi(e);if(!r||typeof r=="function")return;const n={};let i=0;for(const s of Object.keys(r)){if(i>=Mc)break;const o=String(r[s]).trim();o&&(n[s]=o.length>ks?o.slice(0,ks):o,i+=1)}return i>0?n:void 0}const Pc=200,Ic=5e3,$t=15e5;function se(t,e){return t.length>e?t.slice(0,e):t}function Rs(t){return((String(t||"").split(`
11
- `)[0]||"").trim()||"页面反馈").slice(0,60)}function Lc(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(t){}return`r${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}const Nc={userAgent:"",screenWidth:0,screenHeight:0,viewportWidth:0,viewportHeight:0,dpr:1,device:"0*0 @ 1x",language:"",timezone:""};function Kn(t){return t&&t.length>0?t:void 0}function $c(t){const{values:e,data:r,config:n}=t,i=n.collect.environment?Ac():{page:Cs(),browser:{...Nc}},s=se(String(e.description||"").trim(),Ic),o=se(String(e.title||"").trim()||Rs(s),Pc),l=Bc(t.elements,n.collect.maxElements),a={project:n.project,environment:n.environment,title:o,description:s,category:e.category?se(String(e.category),40):void 0,severity:e.severity?se(String(e.severity),20):void 0,contact:e.contact?se(String(e.contact),200):void 0,user:Oc(n.user),track:n.collect.trackIds?_c():void 0,page:i.page,browser:i.browser,logs:r.logs,errors:r.errors,network:r.network,networkDropped:Hc(r,n.collect.network),screenshots:Kn(t.screenshots),elements:Kn(l),breadcrumbs:Kn(r.breadcrumbs),collector:r.collector,app:Dc(n),release:n.release||void 0,tags:Xn(t.tags),extra:Xn(t.extra),contexts:Xn(t.contexts),timestamp:Date.now(),sdkVersion:"0.1.0",clientReportId:t.clientReportId||Lc()};return Uc(a)}function Bc(t,e){if(!(!t||t.length===0))return t.slice(-Math.max(1,e)).map(r=>{const n={};return Object.keys(r.attributes||{}).slice(0,20).forEach(i=>{var s;n[i]=se(String((s=r.attributes[i])!=null?s:""),200)}),{...r,selector:se(r.selector,300),text:r.text?se(r.text,200):void 0,attributes:n,path:se(r.path,300)}})}function Xn(t){return t&&Object.keys(t).length>0?t:void 0}function Dc(t){if(!(!t.appVersion&&!t.buildId))return{version:t.appVersion||void 0,buildId:t.buildId||void 0}}function Hc(t,e){if(!e)return{droppedCount:0,droppedBytes:0,evictedCount:0,evictedBytes:0,totalCount:null,sentCount:0};const r=t.networkDropped||{droppedCount:0,droppedBytes:0,evictedCount:0,evictedBytes:0},n=is(r);return{...r,totalCount:n+t.network.length,sentCount:t.network.length}}function Me(t){return Ae(t,$t+1)}function jc(t){return t.map(e=>Ae(e,$t+1)+1)}function or(t,e,r,n){const i=t[e];if(!i||i.length<=r)return;const s=jc(i),o=Ae({...t,[e]:[]},$t+1),l=new Array(i.length+1);l[0]=0;for(let c=0;c<s.length;c+=1)l[c+1]=(l[c]||0)+(s[c]||0);const a=l[i.length]||0;let u=0;for(;i.length-u>r;){const c=i.length-u;if(o+(a-(l[u]||0))-1<=$t)break;u+=Math.max(1,Math.min(n(c),c-r))}u>0&&(t[e]=i.slice(u))}function Ur(t){return e=>Math.ceil(e/t)}function As(t,e){return t.map(r=>e&&!e(r)?r:{...r,reqBody:void 0,resBody:void 0})}function Uc(t){if(Me(t)<=$t)return t;const e=t.network.length;if(t.network=As(t.network,Ra),Me(t)<=$t||(t.network=As(t.network),Me(t)<=$t))return Yn(t,e);if(or(t,"network",0,Ur(8)),or(t,"logs",0,Ur(4)),or(t,"errors",0,Ur(2)),t.screenshots&&Me(t)>$t){const n=t.screenshots.filter(i=>i.source==="manual");n.length>0?t.screenshots=n:delete t.screenshots}return Ms(t,"extra"),Ms(t,"contexts"),or(t,"elements",1,()=>1),t.elements&&Me(t)>$t&&delete t.elements,or(t,"breadcrumbs",10,Ur(2)),t.screenshots&&Me(t)>$t&&delete t.screenshots,Fc(t),zc(t),Yn(t,e)}function Ms(t,e){const r=t[e];if(!r)return;const n=Object.keys(r);for(;n.length>0&&Me(t)>$t;){const i=n.shift();if(i===void 0)break;delete r[i]}Object.keys(r).length===0&&delete t[e]}function Fc(t){if(!t.breadcrumbs||t.breadcrumbs.length===0)return;const e=new Set(t.network.map(r=>r.id));t.breadcrumbs=t.breadcrumbs.map(r=>r.type!=="http"||!r.ref||e.has(r.ref)?r:{...r,ref:void 0,httpError:r.httpError||"[record trimmed]"})}function zc(t){t.collector&&(t.collector={...t.collector,counts:{logs:t.logs.length,errors:t.errors.length,network:t.network.length,breadcrumbs:t.breadcrumbs?t.breadcrumbs.length:0}})}function Yn(t,e){const r=e-t.network.length;return t.networkDropped&&(t.networkDropped={...t.networkDropped,trimmedCount:r,sentCount:t.network.length}),t}const qc=200,Wc=500,Os=32,xe=64,Vc=512;function Kt(t,e){const r=String(t!=null?t:"").replace(/\s+/g," ").trim();return r.length>e?`${r.slice(0,e)}…`:r}function Kc(t){return t.severity==="normal"?2:3}function Xc(t,e){return e===1||e===2||e===3?e:Kc(t)}function Yc(t){return(t.clientReportId.replace(/[^0-9a-zA-Z]/g,"")+"0".repeat(Os)).slice(0,Os)}function Gc(t){let e=t.browser.userAgent;return!e&&typeof navigator!="undefined"&&(e=navigator.userAgent),`H5, ${e||"unknown userAgent"}`}function Ps(t){return t.page.url?t.page.url:typeof location!="undefined"?location.href:""}function Jc(t){var l;const e=t.errors;let r=e.findIndex(a=>a.type!=="resource"&&!!a.stack);r<0&&(r=e.findIndex(a=>a.type!=="resource")),r<0&&(r=e.length>0?0:-1);const n=r>=0?e[r]:void 0,i=n&&(((l=Pn(n.stack))==null?void 0:l.url)||n.filename)||"",s=n?`${n.type}|${n.message}|${i}`:`feedback|${t.project}|${t.title}`;let o=2166136261;for(let a=0;a<s.length;a+=1)o^=s.charCodeAt(a),o=Math.imul(o,16777619);return{primaryIndex:r,fingerprint:`bt-${(o>>>0).toString(16).padStart(8,"0")}`}}function Qc(t){if(!t)return"";const e=Object.keys(t).slice(0,5).map(r=>`${r}=${Kt(t[r],xe)}`);return e.length>0?` ${e.join(" ")}`:""}function Zc(t,e,r){var R,k;const n=Kt(t.title,qc),i=Kt(t.description,Wc),s=i&&i===n?"":i,o=is(t.networkDropped),l=ru(t.user),a=tu(t.track),u=t.collector?Math.round(t.collector.earlyGapMs):0,c=eu(t),d=((R=t.collector)==null?void 0:R.breadcrumbEvicted)||0,p=((k=t.networkDropped)==null?void 0:k.totalCount)===null,x=["【Bug反馈】",n||"(无标题)",s?` | ${s}`:"",t.elements&&t.elements.length>0?` | element=${t.elements.map(N=>N.selector).join(",")}`:"",` | project=${t.project}`,` env=${t.environment}`,l?` user=${l}`:"",a,t.release?` release=${Kt(t.release,xe)}`:"",` fp=${e.fingerprint}`,Qc(t.tags),` reportId=${t.clientReportId}`,p?" | networkDisabled":"",o>0?` | networkDropped=${o}`:"",u>0?` | earlyGap=${u}ms`:"",d>0?` | timelineEvicted=${d}`:"",c?` | ${c}`:""].join("");return!r||r.total<=1?x:`${x} | part=${r.index}/${r.total}`}function tu(t){if(!t)return"";const e=[];return t.xid&&e.push(`xid=${Kt(t.xid,xe)}`),t.subId&&e.push(`subId=${Kt(t.subId,xe)}`),t.sessionId&&e.push(`si=${Kt(t.sessionId,xe)}`),e.length>0?` ${e.join(" ")}`:""}function eu(t){if(!t.app)return"";const e=[];return t.app.version&&e.push(`app=${Kt(t.app.version,xe)}`),t.app.buildId&&e.push(`build=${Kt(t.app.buildId,xe)}`),e.join(" ")}function ru(t){var r,n,i,s;if(!t)return"";const e=(s=(i=(n=(r=t.id)!=null?r:t.name)!=null?n:t.userId)!=null?i:t.account)!=null?s:Object.values(t)[0];return e===void 0?"":Kt(e,xe)}function nu(t){const e={...t.page};return(!e.url||e.url===Ps(t))&&delete e.url,e}function iu(t,e){return{project:t.project,environment:t.environment,sdkVersion:t.sdkVersion,clientReportId:t.clientReportId,release:t.release,fingerprint:e.fingerprint,primaryErrorIndex:e.primaryIndex,title:t.title,description:t.description,category:t.category,severity:t.severity,contact:t.contact,user:t.user,track:t.track,page:nu(t),browser:t.browser,networkDropped:t.networkDropped,collector:t.collector,app:t.app,breadcrumbs:t.breadcrumbs,tags:t.tags,extra:t.extra,contexts:t.contexts}}function su(t){return Ae(t)+1}function Fr(){return{network:[],errors:[],logs:[],bytes:0}}function ou(t,e){const r=[Fr()];let n=e;const i=(l,a)=>{for(const u of l){const c=su(u),d=r[r.length-1],p=d.network.length+d.errors.length+d.logs.length;c>n&&p>0&&(r.push(Fr()),n=e);const x=r[r.length-1];x[a].push(u),x.bytes+=c,n-=c}},s=[],o=[];for(const l of t.network)(ns(l)?s:o).push(l);return i(s,"network"),i(t.errors,"errors"),i(o,"network"),i(t.logs,"logs"),r}function lu(t,e,r){const n=Jc(t),i=iu(t,n),s=t.screenshots&&t.screenshots.length>0?t.screenshots:void 0,o=t.elements&&t.elements.length>0?t.elements:void 0,l=o?Ae(o):0,a=Ae(i)+Vc+(s?Ae(s):0),u=Math.max(1024,e-a),c=ou(t,u),d=c.length>0?c:[Fr()];let p=-1;return o&&(a+d[0].bytes+l+1<=e?p=0:(d.push(Fr()),p=d.length-1)),d.map((x,R)=>{const k={...i};return k.network=x.network.slice().sort((N,z)=>N.timestamp-z.timestamp),k.errors=x.errors,k.logs=x.logs,d.length>1&&(k.part={index:R+1,total:d.length}),R===0&&s&&(k.screenshots=s),R===p&&o&&(k.elements=o),{timestamp:t.timestamp,logLevel:Xc(t,r),userAgent:Gc(t),url:Ps(t),content:Zc(t,n,{index:R+1,total:d.length}),traceId:Yc(t),ext:JSON.stringify(k)}})}const au="bug-tap",Xt="pending",cu=1;function uu(){return typeof indexedDB=="undefined"?Promise.resolve(null):new Promise(t=>{try{const e=indexedDB.open(au,cu);e.onupgradeneeded=()=>{const r=e.result;r.objectStoreNames.contains(Xt)||r.createObjectStore(Xt,{keyPath:"id"})},e.onsuccess=()=>t(e.result),e.onerror=()=>t(null),e.onblocked=()=>t(null)}catch(e){t(null)}})}class fu{constructor(e){this.options=e,this.memory=[],this.db=null}database(){return this.db||(this.db=uu()),this.db}enqueue(e){return this.database().then(r=>{if(!r){this.putMemory(e);return}return this.put(r,e).then(n=>(n||this.putMemory(e),this.prune(r)))})}put(e,r){return new Promise(n=>{try{const i=e.transaction(Xt,"readwrite");i.objectStore(Xt).put(r),i.oncomplete=()=>n(!0),i.onerror=()=>n(!1),i.onabort=()=>n(!1)}catch(i){n(!1)}})}prune(e){return new Promise(r=>{try{const n=e.transaction(Xt,"readwrite"),i=n.objectStore(Xt),s=i.getAll();s.onsuccess=()=>{const o=(s.result||[]).sort((c,d)=>c.createdAt-d.createdAt),l=[],a=[];for(const c of o)(this.isExpired(c)?l:a).push(c);const u=Math.max(0,a.length-this.options.maxItems);l.concat(a.slice(0,u)).forEach(c=>{try{i.delete(c.id)}catch(d){}})},s.onerror=()=>r(),n.oncomplete=()=>r(),n.onerror=()=>r(),n.onabort=()=>r()}catch(n){r()}})}peek(){return this.database().then(e=>e?new Promise(r=>{try{const i=e.transaction(Xt,"readonly").objectStore(Xt).getAll();i.onsuccess=()=>{const s=i.result||[],o=new Set(s.map(a=>a.id)),l=s.concat(this.memory.filter(a=>!o.has(a.id)));r(l.filter(a=>!this.isExpired(a)).sort((a,u)=>a.createdAt-u.createdAt))},i.onerror=()=>r(this.memoryItems())}catch(n){r(this.memoryItems())}}):this.memoryItems())}memoryItems(){return this.memory.filter(e=>!this.isExpired(e)).sort((e,r)=>e.createdAt-r.createdAt)}remove(e){const r=this.memory.findIndex(n=>n.id===e);return r>=0&&this.memory.splice(r,1),this.database().then(n=>{if(n)return new Promise(i=>{try{const s=n.transaction(Xt,"readwrite");s.objectStore(Xt).delete(e),s.oncomplete=()=>i(),s.onerror=()=>i(),s.onabort=()=>i()}catch(s){i()}})})}size(){return this.peek().then(e=>e.length)}isExpired(e){return Date.now()-e.createdAt>this.options.ttlMs}trimMemory(){const e=this.memory.filter(r=>!this.isExpired(r));this.memory.length=0,this.memory.push(...e.slice(-this.options.maxItems))}putMemory(e){const r=this.memory.findIndex(n=>n.id===e.id);r>=0&&this.memory.splice(r,1),this.memory.push(e),this.trimMemory()}}class ct extends Error{constructor(e,r){super(e),this.name="TransportError",this.failure=r.failure,this.status=r.status,this.retryable=r.retryable,this.details=r.details,this.retryAfterMs=r.retryAfterMs,this.queued=r.queued}asQueued(){return new ct(this.message,{failure:this.failure,status:this.status,retryable:this.retryable,details:this.details,retryAfterMs:this.retryAfterMs,queued:!0})}}const du=6e4,hu=15,pu=6e4;function gu(t){return new Promise(e=>setTimeout(e,t))}function mu(t){return 1e3*Math.pow(3,t)+Math.floor(Math.random()*250)}function bu(t,e=Date.now()){if(!t)return;const r=parseInt(t,10);if(!isNaN(r))return r*1e3;const n=Date.parse(t);return isNaN(n)?6e4:Math.max(0,n-e)}class Is{constructor(e){this.config=e,this.pendingCount=0,this.pendingBytes=0,this.successCount=0,this.flushing=null,this.started=!1,this.onOnline=()=>{this.flush()},this.onVisibility=()=>{document.visibilityState==="hidden"&&this.beacon()},this.onPageHide=()=>{this.beacon()};const r=e.transport.offline;this.queue=r.enabled?new fu({ttlMs:r.ttlMs,maxItems:r.maxItems}):null}start(){this.started||typeof window=="undefined"||(this.started=!0,window.addEventListener("online",this.onOnline),window.addEventListener("pagehide",this.onPageHide),document.addEventListener("visibilitychange",this.onVisibility),this.flush())}stop(){this.started&&(this.started=!1,window.removeEventListener("online",this.onOnline),window.removeEventListener("pagehide",this.onPageHide),document.removeEventListener("visibilitychange",this.onVisibility))}send(e){const r=this.config.transport;if(r.maxReportsPerSession>0&&this.successCount>=r.maxReportsPerSession)return Promise.reject(new ct(`本次会话反馈次数已达上限(${r.maxReportsPerSession} 次)`,{failure:"limited",retryable:!1}));if(this.pendingCount>=r.maxConcurrent)return Promise.reject(new ct("正在提交中,请稍后重试",{failure:"busy",retryable:!1}));let n;try{n=JSON.stringify(lu(e,r.maxItemBytes,r.logLevel))}catch(o){return Promise.reject(new ct(`报告序列化失败:${o instanceof Error?o.message:String(o)}`,{failure:"protocol",retryable:!1,details:o}))}const i=Date.now()+r.totalTimeoutMs,s=Vt(n);return this.attempt(n,s,e.clientReportId,0,i,this.config.endpoint).then(o=>(this.successCount+=1,o)).catch(o=>{const l=o instanceof ct?o:this.toTransportError(o);if(!this.shouldQueue(l)||!this.queue)throw l;return this.enqueue(n,s,e.clientReportId).then(()=>{throw l.asQueued()})})}flush(){return this.queue?this.flushing?this.flushing:(this.flushing=this.queue.peek().then(e=>this.flushItems(e,0)).catch(()=>0).finally(()=>{this.flushing=null}),this.flushing):Promise.resolve(0)}flushItems(e,r){var o;const n=e[r];if(!n)return Promise.resolve(0);const i=Date.now()+this.config.transport.timeoutMs,s=(o=n.size)!=null?o:Vt(n.body);return this.once(n.body,s,n.id,i,n.endpoint).then(()=>this.queue.remove(n.id).then(()=>this.flushItems(e,r+1).then(l=>l+1))).catch(l=>{const a=l instanceof ct?l:this.toTransportError(l);return this.shouldQueue(a)?0:this.queue.remove(n.id).then(()=>this.flushItems(e,r+1))})}beacon(){if(this.queue)try{if(typeof navigator=="undefined"||typeof navigator.sendBeacon!="function")return;this.queue.peek().then(e=>{e.forEach(r=>{var n;try{const i=new Blob([r.body],{type:"application/json"});if(i.size>pu)return;navigator.sendBeacon(r.endpoint,i)&&((n=this.queue)==null||n.remove(r.id))}catch(i){}})}).catch(()=>{})}catch(e){}}enqueue(e,r,n){return this.queue?this.queue.enqueue({id:n,endpoint:sr(this.config.endpoint),body:e,size:r,createdAt:Date.now()}):Promise.resolve()}shouldQueue(e){return e.failure==="network"||e.failure==="timeout"?!0:e.failure==="http"&&(e.status===429||(e.status||0)>=500)}attempt(e,r,n,i,s,o){return this.once(e,r,n,s,o).catch(l=>{const a=l instanceof ct?l:this.toTransportError(l),u=this.config.transport.retries;if(i<u&&a.retryable){const c=a.retryAfterMs!==void 0?a.retryAfterMs:mu(i);if(Date.now()+c>=s)throw this.deadlineError(s);return gu(c).then(()=>this.attempt(e,r,n,i+1,s,o))}throw a})}deadlineError(e){return new ct(`提交超时(${Math.round(this.config.transport.totalTimeoutMs/1e3)}s)`,{failure:"timeout",retryable:!1,details:{deadline:e}})}once(e,r,n,i,s){const o=i-Date.now();if(o<=0)return Promise.reject(this.deadlineError(i));const l=new AbortController,a=Math.min(this.config.transport.timeoutMs,o),u=setTimeout(()=>l.abort(),a),c={"Content-Type":"application/json",...this.config.transport.headers};this.pendingCount+=1,this.pendingBytes+=r;const d=this.pendingBytes<=du&&this.pendingCount<hu;return fetch(s,{method:"POST",headers:c,body:e,signal:l.signal,mode:"cors",credentials:"omit",keepalive:d}).then(p=>p.text().then(x=>({response:p,text:x}))).then(({response:p,text:x})=>{let R=null;if(x)try{R=JSON.parse(x)}catch(N){R=x}if(!p.ok){const N=p.status===429||p.status>=500,z=p.status===429?bu(p.headers.get("retry-after")):void 0,j=this.extractMessage(R)||`服务端返回 HTTP ${p.status}`;throw new ct(j,{failure:"http",status:p.status,retryable:N,details:R,retryAfterMs:z})}if(!R||typeof R!="object")throw new ct("服务端响应不是合法 JSON",{failure:"protocol",retryable:!1,details:R});if(R.errCode!==0)throw new ct(this.extractMessage(R)||"上报接口返回失败",{failure:"protocol",retryable:!1,details:R});return{success:!0,reportId:n}}).catch(p=>{throw p instanceof ct?p:p instanceof DOMException&&p.name==="AbortError"?new ct(`请求超时(${Math.round(a/1e3)}s)`,{failure:"timeout",retryable:!0}):new ct(p instanceof Error?p.message:String(p),{failure:"network",retryable:!0})}).finally(()=>{clearTimeout(u),this.pendingCount-=1,this.pendingBytes-=r})}toTransportError(e){return new ct(e instanceof Error?e.message:String(e),{failure:"network",retryable:!0})}extractMessage(e){if(!e||typeof e!="object")return"";const r=e;if(typeof r.errMsg=="string"&&r.errMsg)return r.errMsg;if(typeof r.message=="string")return r.message;const n=r.error;if(n&&typeof n=="object"){const i=n;if(typeof i.message=="string")return i.message}return""}}function yu(t){return Object.keys(t).map(e=>{var r;return`${encodeURIComponent(e)}=${encodeURIComponent((r=t[e])!=null?r:"")}`}).join("&")}function oe(t){return t instanceof Error?t.message:String(t)}function wu(t){if(typeof t=="string")return t;if(t&&typeof t=="object"){const e=t;if(typeof e.url=="string")return e.url;if(typeof e.file_url=="string")return e.file_url}return""}function vu(t,e){if(!t.dataBase64)return Promise.resolve(t.url||"");const r=new AbortController,n=setTimeout(()=>r.abort(),e.timeoutMs),i=`data:${t.mime};base64,${t.dataBase64}`,s=yu({imgdata:i,bizid:e.bizId,name:`bug-report-${Date.now()}.jpg`});return fetch(e.url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s,credentials:"include",signal:r.signal}).then(o=>o.text().then(l=>({response:o,text:l}))).then(({response:o,text:l})=>{let a=null;try{a=JSON.parse(l)}catch(d){a=null}if(!o.ok)throw new Error(`图片上传失败:HTTP ${o.status}`);if(!a||typeof a!="object")throw new Error("图片上传接口响应不是合法 JSON");const u=a;if(u.ret!==0){const d=typeof u.errmsg=="string"?u.errmsg:"";throw new Error(d||"图片上传失败")}const c=wu(u.data);if(!c)throw new Error("图片上传接口未返回 url");return c}).catch(o=>{throw o instanceof DOMException&&o.name==="AbortError"?new Error(`图片上传超时(${Math.round(e.timeoutMs/1e3)}s)`):new Error(oe(o))}).finally(()=>clearTimeout(n))}const Ls=`
11
+ `)[0]||"").trim()||"页面反馈").slice(0,60)}function Lc(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(t){}return`r${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}const Nc={userAgent:"",screenWidth:0,screenHeight:0,viewportWidth:0,viewportHeight:0,dpr:1,device:"0*0 @ 1x",language:"",timezone:""};function Kn(t){return t&&t.length>0?t:void 0}function $c(t){const{values:e,data:r,config:n}=t,i=n.collect.environment?Ac():{page:Cs(),browser:{...Nc}},s=se(String(e.description||"").trim(),Ic),o=se(String(e.title||"").trim()||Rs(s),Pc),l=Bc(t.elements,n.collect.maxElements),a={project:n.project,environment:n.environment,title:o,description:s,category:e.category?se(String(e.category),40):void 0,severity:e.severity?se(String(e.severity),20):void 0,contact:e.contact?se(String(e.contact),200):void 0,user:Oc(n.user),track:n.collect.trackIds?_c():void 0,page:i.page,browser:i.browser,logs:r.logs,errors:r.errors,network:r.network,networkDropped:Hc(r,n.collect.network),screenshots:Kn(t.screenshots),elements:Kn(l),breadcrumbs:Kn(r.breadcrumbs),collector:r.collector,app:Dc(n),release:n.release||void 0,tags:Xn(t.tags),extra:Xn(t.extra),contexts:Xn(t.contexts),timestamp:Date.now(),sdkVersion:"0.1.2",clientReportId:t.clientReportId||Lc()};return Uc(a)}function Bc(t,e){if(!(!t||t.length===0))return t.slice(-Math.max(1,e)).map(r=>{const n={};return Object.keys(r.attributes||{}).slice(0,20).forEach(i=>{var s;n[i]=se(String((s=r.attributes[i])!=null?s:""),200)}),{...r,selector:se(r.selector,300),text:r.text?se(r.text,200):void 0,attributes:n,path:se(r.path,300)}})}function Xn(t){return t&&Object.keys(t).length>0?t:void 0}function Dc(t){if(!(!t.appVersion&&!t.buildId))return{version:t.appVersion||void 0,buildId:t.buildId||void 0}}function Hc(t,e){if(!e)return{droppedCount:0,droppedBytes:0,evictedCount:0,evictedBytes:0,totalCount:null,sentCount:0};const r=t.networkDropped||{droppedCount:0,droppedBytes:0,evictedCount:0,evictedBytes:0},n=is(r);return{...r,totalCount:n+t.network.length,sentCount:t.network.length}}function Me(t){return Ae(t,$t+1)}function jc(t){return t.map(e=>Ae(e,$t+1)+1)}function or(t,e,r,n){const i=t[e];if(!i||i.length<=r)return;const s=jc(i),o=Ae({...t,[e]:[]},$t+1),l=new Array(i.length+1);l[0]=0;for(let c=0;c<s.length;c+=1)l[c+1]=(l[c]||0)+(s[c]||0);const a=l[i.length]||0;let u=0;for(;i.length-u>r;){const c=i.length-u;if(o+(a-(l[u]||0))-1<=$t)break;u+=Math.max(1,Math.min(n(c),c-r))}u>0&&(t[e]=i.slice(u))}function Ur(t){return e=>Math.ceil(e/t)}function As(t,e){return t.map(r=>e&&!e(r)?r:{...r,reqBody:void 0,resBody:void 0})}function Uc(t){if(Me(t)<=$t)return t;const e=t.network.length;if(t.network=As(t.network,Ra),Me(t)<=$t||(t.network=As(t.network),Me(t)<=$t))return Yn(t,e);if(or(t,"network",0,Ur(8)),or(t,"logs",0,Ur(4)),or(t,"errors",0,Ur(2)),t.screenshots&&Me(t)>$t){const n=t.screenshots.filter(i=>i.source==="manual");n.length>0?t.screenshots=n:delete t.screenshots}return Ms(t,"extra"),Ms(t,"contexts"),or(t,"elements",1,()=>1),t.elements&&Me(t)>$t&&delete t.elements,or(t,"breadcrumbs",10,Ur(2)),t.screenshots&&Me(t)>$t&&delete t.screenshots,Fc(t),zc(t),Yn(t,e)}function Ms(t,e){const r=t[e];if(!r)return;const n=Object.keys(r);for(;n.length>0&&Me(t)>$t;){const i=n.shift();if(i===void 0)break;delete r[i]}Object.keys(r).length===0&&delete t[e]}function Fc(t){if(!t.breadcrumbs||t.breadcrumbs.length===0)return;const e=new Set(t.network.map(r=>r.id));t.breadcrumbs=t.breadcrumbs.map(r=>r.type!=="http"||!r.ref||e.has(r.ref)?r:{...r,ref:void 0,httpError:r.httpError||"[record trimmed]"})}function zc(t){t.collector&&(t.collector={...t.collector,counts:{logs:t.logs.length,errors:t.errors.length,network:t.network.length,breadcrumbs:t.breadcrumbs?t.breadcrumbs.length:0}})}function Yn(t,e){const r=e-t.network.length;return t.networkDropped&&(t.networkDropped={...t.networkDropped,trimmedCount:r,sentCount:t.network.length}),t}const qc=200,Wc=500,Os=32,xe=64,Vc=512;function Kt(t,e){const r=String(t!=null?t:"").replace(/\s+/g," ").trim();return r.length>e?`${r.slice(0,e)}…`:r}function Kc(t){return t.severity==="normal"?2:3}function Xc(t,e){return e===1||e===2||e===3?e:Kc(t)}function Yc(t){return(t.clientReportId.replace(/[^0-9a-zA-Z]/g,"")+"0".repeat(Os)).slice(0,Os)}function Gc(t){let e=t.browser.userAgent;return!e&&typeof navigator!="undefined"&&(e=navigator.userAgent),`H5, ${e||"unknown userAgent"}`}function Ps(t){return t.page.url?t.page.url:typeof location!="undefined"?location.href:""}function Jc(t){var l;const e=t.errors;let r=e.findIndex(a=>a.type!=="resource"&&!!a.stack);r<0&&(r=e.findIndex(a=>a.type!=="resource")),r<0&&(r=e.length>0?0:-1);const n=r>=0?e[r]:void 0,i=n&&(((l=Pn(n.stack))==null?void 0:l.url)||n.filename)||"",s=n?`${n.type}|${n.message}|${i}`:`feedback|${t.project}|${t.title}`;let o=2166136261;for(let a=0;a<s.length;a+=1)o^=s.charCodeAt(a),o=Math.imul(o,16777619);return{primaryIndex:r,fingerprint:`bt-${(o>>>0).toString(16).padStart(8,"0")}`}}function Qc(t){if(!t)return"";const e=Object.keys(t).slice(0,5).map(r=>`${r}=${Kt(t[r],xe)}`);return e.length>0?` ${e.join(" ")}`:""}function Zc(t,e,r){var R,k;const n=Kt(t.title,qc),i=Kt(t.description,Wc),s=i&&i===n?"":i,o=is(t.networkDropped),l=ru(t.user),a=tu(t.track),u=t.collector?Math.round(t.collector.earlyGapMs):0,c=eu(t),d=((R=t.collector)==null?void 0:R.breadcrumbEvicted)||0,p=((k=t.networkDropped)==null?void 0:k.totalCount)===null,x=["【Bug反馈】",n||"(无标题)",s?` | ${s}`:"",t.elements&&t.elements.length>0?` | element=${t.elements.map(N=>N.selector).join(",")}`:"",` | project=${t.project}`,` env=${t.environment}`,l?` user=${l}`:"",a,t.release?` release=${Kt(t.release,xe)}`:"",` fp=${e.fingerprint}`,Qc(t.tags),` reportId=${t.clientReportId}`,p?" | networkDisabled":"",o>0?` | networkDropped=${o}`:"",u>0?` | earlyGap=${u}ms`:"",d>0?` | timelineEvicted=${d}`:"",c?` | ${c}`:""].join("");return!r||r.total<=1?x:`${x} | part=${r.index}/${r.total}`}function tu(t){if(!t)return"";const e=[];return t.xid&&e.push(`xid=${Kt(t.xid,xe)}`),t.subId&&e.push(`subId=${Kt(t.subId,xe)}`),t.sessionId&&e.push(`si=${Kt(t.sessionId,xe)}`),e.length>0?` ${e.join(" ")}`:""}function eu(t){if(!t.app)return"";const e=[];return t.app.version&&e.push(`app=${Kt(t.app.version,xe)}`),t.app.buildId&&e.push(`build=${Kt(t.app.buildId,xe)}`),e.join(" ")}function ru(t){var r,n,i,s;if(!t)return"";const e=(s=(i=(n=(r=t.id)!=null?r:t.name)!=null?n:t.userId)!=null?i:t.account)!=null?s:Object.values(t)[0];return e===void 0?"":Kt(e,xe)}function nu(t){const e={...t.page};return(!e.url||e.url===Ps(t))&&delete e.url,e}function iu(t,e){return{project:t.project,environment:t.environment,libVersion:t.sdkVersion,sdkVersion:t.sdkVersion,clientReportId:t.clientReportId,release:t.release,fingerprint:e.fingerprint,primaryErrorIndex:e.primaryIndex,title:t.title,description:t.description,category:t.category,severity:t.severity,contact:t.contact,user:t.user,track:t.track,page:nu(t),browser:t.browser,networkDropped:t.networkDropped,collector:t.collector,app:t.app,breadcrumbs:t.breadcrumbs,tags:t.tags,extra:t.extra,contexts:t.contexts}}function su(t){return Ae(t)+1}function Fr(){return{network:[],errors:[],logs:[],bytes:0}}function ou(t,e){const r=[Fr()];let n=e;const i=(l,a)=>{for(const u of l){const c=su(u),d=r[r.length-1],p=d.network.length+d.errors.length+d.logs.length;c>n&&p>0&&(r.push(Fr()),n=e);const x=r[r.length-1];x[a].push(u),x.bytes+=c,n-=c}},s=[],o=[];for(const l of t.network)(ns(l)?s:o).push(l);return i(s,"network"),i(t.errors,"errors"),i(o,"network"),i(t.logs,"logs"),r}function lu(t,e,r){const n=Jc(t),i=iu(t,n),s=t.screenshots&&t.screenshots.length>0?t.screenshots:void 0,o=t.elements&&t.elements.length>0?t.elements:void 0,l=o?Ae(o):0,a=Ae(i)+Vc+(s?Ae(s):0),u=Math.max(1024,e-a),c=ou(t,u),d=c.length>0?c:[Fr()];let p=-1;return o&&(a+d[0].bytes+l+1<=e?p=0:(d.push(Fr()),p=d.length-1)),d.map((x,R)=>{const k={...i};return k.network=x.network.slice().sort((N,z)=>N.timestamp-z.timestamp),k.errors=x.errors,k.logs=x.logs,d.length>1&&(k.part={index:R+1,total:d.length}),R===0&&s&&(k.screenshots=s),R===p&&o&&(k.elements=o),{timestamp:t.timestamp,logLevel:Xc(t,r),userAgent:Gc(t),url:Ps(t),content:Zc(t,n,{index:R+1,total:d.length}),traceId:Yc(t),ext:JSON.stringify(k)}})}const au="bug-tap",Xt="pending",cu=1;function uu(){return typeof indexedDB=="undefined"?Promise.resolve(null):new Promise(t=>{try{const e=indexedDB.open(au,cu);e.onupgradeneeded=()=>{const r=e.result;r.objectStoreNames.contains(Xt)||r.createObjectStore(Xt,{keyPath:"id"})},e.onsuccess=()=>t(e.result),e.onerror=()=>t(null),e.onblocked=()=>t(null)}catch(e){t(null)}})}class fu{constructor(e){this.options=e,this.memory=[],this.db=null}database(){return this.db||(this.db=uu()),this.db}enqueue(e){return this.database().then(r=>{if(!r){this.putMemory(e);return}return this.put(r,e).then(n=>(n||this.putMemory(e),this.prune(r)))})}put(e,r){return new Promise(n=>{try{const i=e.transaction(Xt,"readwrite");i.objectStore(Xt).put(r),i.oncomplete=()=>n(!0),i.onerror=()=>n(!1),i.onabort=()=>n(!1)}catch(i){n(!1)}})}prune(e){return new Promise(r=>{try{const n=e.transaction(Xt,"readwrite"),i=n.objectStore(Xt),s=i.getAll();s.onsuccess=()=>{const o=(s.result||[]).sort((c,d)=>c.createdAt-d.createdAt),l=[],a=[];for(const c of o)(this.isExpired(c)?l:a).push(c);const u=Math.max(0,a.length-this.options.maxItems);l.concat(a.slice(0,u)).forEach(c=>{try{i.delete(c.id)}catch(d){}})},s.onerror=()=>r(),n.oncomplete=()=>r(),n.onerror=()=>r(),n.onabort=()=>r()}catch(n){r()}})}peek(){return this.database().then(e=>e?new Promise(r=>{try{const i=e.transaction(Xt,"readonly").objectStore(Xt).getAll();i.onsuccess=()=>{const s=i.result||[],o=new Set(s.map(a=>a.id)),l=s.concat(this.memory.filter(a=>!o.has(a.id)));r(l.filter(a=>!this.isExpired(a)).sort((a,u)=>a.createdAt-u.createdAt))},i.onerror=()=>r(this.memoryItems())}catch(n){r(this.memoryItems())}}):this.memoryItems())}memoryItems(){return this.memory.filter(e=>!this.isExpired(e)).sort((e,r)=>e.createdAt-r.createdAt)}remove(e){const r=this.memory.findIndex(n=>n.id===e);return r>=0&&this.memory.splice(r,1),this.database().then(n=>{if(n)return new Promise(i=>{try{const s=n.transaction(Xt,"readwrite");s.objectStore(Xt).delete(e),s.oncomplete=()=>i(),s.onerror=()=>i(),s.onabort=()=>i()}catch(s){i()}})})}size(){return this.peek().then(e=>e.length)}isExpired(e){return Date.now()-e.createdAt>this.options.ttlMs}trimMemory(){const e=this.memory.filter(r=>!this.isExpired(r));this.memory.length=0,this.memory.push(...e.slice(-this.options.maxItems))}putMemory(e){const r=this.memory.findIndex(n=>n.id===e.id);r>=0&&this.memory.splice(r,1),this.memory.push(e),this.trimMemory()}}class ct extends Error{constructor(e,r){super(e),this.name="TransportError",this.failure=r.failure,this.status=r.status,this.retryable=r.retryable,this.details=r.details,this.retryAfterMs=r.retryAfterMs,this.queued=r.queued}asQueued(){return new ct(this.message,{failure:this.failure,status:this.status,retryable:this.retryable,details:this.details,retryAfterMs:this.retryAfterMs,queued:!0})}}const du=6e4,hu=15,pu=6e4;function gu(t){return new Promise(e=>setTimeout(e,t))}function mu(t){return 1e3*Math.pow(3,t)+Math.floor(Math.random()*250)}function bu(t,e=Date.now()){if(!t)return;const r=parseInt(t,10);if(!isNaN(r))return r*1e3;const n=Date.parse(t);return isNaN(n)?6e4:Math.max(0,n-e)}class Is{constructor(e){this.config=e,this.pendingCount=0,this.pendingBytes=0,this.successCount=0,this.flushing=null,this.started=!1,this.onOnline=()=>{this.flush()},this.onVisibility=()=>{document.visibilityState==="hidden"&&this.beacon()},this.onPageHide=()=>{this.beacon()};const r=e.transport.offline;this.queue=r.enabled?new fu({ttlMs:r.ttlMs,maxItems:r.maxItems}):null}start(){this.started||typeof window=="undefined"||(this.started=!0,window.addEventListener("online",this.onOnline),window.addEventListener("pagehide",this.onPageHide),document.addEventListener("visibilitychange",this.onVisibility),this.flush())}stop(){this.started&&(this.started=!1,window.removeEventListener("online",this.onOnline),window.removeEventListener("pagehide",this.onPageHide),document.removeEventListener("visibilitychange",this.onVisibility))}send(e){const r=this.config.transport;if(r.maxReportsPerSession>0&&this.successCount>=r.maxReportsPerSession)return Promise.reject(new ct(`本次会话反馈次数已达上限(${r.maxReportsPerSession} 次)`,{failure:"limited",retryable:!1}));if(this.pendingCount>=r.maxConcurrent)return Promise.reject(new ct("正在提交中,请稍后重试",{failure:"busy",retryable:!1}));let n;try{n=JSON.stringify(lu(e,r.maxItemBytes,r.logLevel))}catch(o){return Promise.reject(new ct(`报告序列化失败:${o instanceof Error?o.message:String(o)}`,{failure:"protocol",retryable:!1,details:o}))}const i=Date.now()+r.totalTimeoutMs,s=Vt(n);return this.attempt(n,s,e.clientReportId,0,i,this.config.endpoint).then(o=>(this.successCount+=1,o)).catch(o=>{const l=o instanceof ct?o:this.toTransportError(o);if(!this.shouldQueue(l)||!this.queue)throw l;return this.enqueue(n,s,e.clientReportId).then(()=>{throw l.asQueued()})})}flush(){return this.queue?this.flushing?this.flushing:(this.flushing=this.queue.peek().then(e=>this.flushItems(e,0)).catch(()=>0).finally(()=>{this.flushing=null}),this.flushing):Promise.resolve(0)}flushItems(e,r){var o;const n=e[r];if(!n)return Promise.resolve(0);const i=Date.now()+this.config.transport.timeoutMs,s=(o=n.size)!=null?o:Vt(n.body);return this.once(n.body,s,n.id,i,n.endpoint).then(()=>this.queue.remove(n.id).then(()=>this.flushItems(e,r+1).then(l=>l+1))).catch(l=>{const a=l instanceof ct?l:this.toTransportError(l);return this.shouldQueue(a)?0:this.queue.remove(n.id).then(()=>this.flushItems(e,r+1))})}beacon(){if(this.queue)try{if(typeof navigator=="undefined"||typeof navigator.sendBeacon!="function")return;this.queue.peek().then(e=>{e.forEach(r=>{var n;try{const i=new Blob([r.body],{type:"application/json"});if(i.size>pu)return;navigator.sendBeacon(r.endpoint,i)&&((n=this.queue)==null||n.remove(r.id))}catch(i){}})}).catch(()=>{})}catch(e){}}enqueue(e,r,n){return this.queue?this.queue.enqueue({id:n,endpoint:sr(this.config.endpoint),body:e,size:r,createdAt:Date.now()}):Promise.resolve()}shouldQueue(e){return e.failure==="network"||e.failure==="timeout"?!0:e.failure==="http"&&(e.status===429||(e.status||0)>=500)}attempt(e,r,n,i,s,o){return this.once(e,r,n,s,o).catch(l=>{const a=l instanceof ct?l:this.toTransportError(l),u=this.config.transport.retries;if(i<u&&a.retryable){const c=a.retryAfterMs!==void 0?a.retryAfterMs:mu(i);if(Date.now()+c>=s)throw this.deadlineError(s);return gu(c).then(()=>this.attempt(e,r,n,i+1,s,o))}throw a})}deadlineError(e){return new ct(`提交超时(${Math.round(this.config.transport.totalTimeoutMs/1e3)}s)`,{failure:"timeout",retryable:!1,details:{deadline:e}})}once(e,r,n,i,s){const o=i-Date.now();if(o<=0)return Promise.reject(this.deadlineError(i));const l=new AbortController,a=Math.min(this.config.transport.timeoutMs,o),u=setTimeout(()=>l.abort(),a),c={"Content-Type":"application/json",...this.config.transport.headers};this.pendingCount+=1,this.pendingBytes+=r;const d=this.pendingBytes<=du&&this.pendingCount<hu;return fetch(s,{method:"POST",headers:c,body:e,signal:l.signal,mode:"cors",credentials:"omit",keepalive:d}).then(p=>p.text().then(x=>({response:p,text:x}))).then(({response:p,text:x})=>{let R=null;if(x)try{R=JSON.parse(x)}catch(N){R=x}if(!p.ok){const N=p.status===429||p.status>=500,z=p.status===429?bu(p.headers.get("retry-after")):void 0,j=this.extractMessage(R)||`服务端返回 HTTP ${p.status}`;throw new ct(j,{failure:"http",status:p.status,retryable:N,details:R,retryAfterMs:z})}if(!R||typeof R!="object")throw new ct("服务端响应不是合法 JSON",{failure:"protocol",retryable:!1,details:R});if(R.errCode!==0)throw new ct(this.extractMessage(R)||"上报接口返回失败",{failure:"protocol",retryable:!1,details:R});return{success:!0,reportId:n}}).catch(p=>{throw p instanceof ct?p:p instanceof DOMException&&p.name==="AbortError"?new ct(`请求超时(${Math.round(a/1e3)}s)`,{failure:"timeout",retryable:!0}):new ct(p instanceof Error?p.message:String(p),{failure:"network",retryable:!0})}).finally(()=>{clearTimeout(u),this.pendingCount-=1,this.pendingBytes-=r})}toTransportError(e){return new ct(e instanceof Error?e.message:String(e),{failure:"network",retryable:!0})}extractMessage(e){if(!e||typeof e!="object")return"";const r=e;if(typeof r.errMsg=="string"&&r.errMsg)return r.errMsg;if(typeof r.message=="string")return r.message;const n=r.error;if(n&&typeof n=="object"){const i=n;if(typeof i.message=="string")return i.message}return""}}function yu(t){return Object.keys(t).map(e=>{var r;return`${encodeURIComponent(e)}=${encodeURIComponent((r=t[e])!=null?r:"")}`}).join("&")}function oe(t){return t instanceof Error?t.message:String(t)}function wu(t){if(typeof t=="string")return t;if(t&&typeof t=="object"){const e=t;if(typeof e.url=="string")return e.url;if(typeof e.file_url=="string")return e.file_url}return""}function vu(t,e){if(!t.dataBase64)return Promise.resolve(t.url||"");const r=new AbortController,n=setTimeout(()=>r.abort(),e.timeoutMs),i=`data:${t.mime};base64,${t.dataBase64}`,s=yu({imgdata:i,bizid:e.bizId,name:`bug-report-${Date.now()}.jpg`});return fetch(e.url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s,credentials:"include",signal:r.signal}).then(o=>o.text().then(l=>({response:o,text:l}))).then(({response:o,text:l})=>{let a=null;try{a=JSON.parse(l)}catch(d){a=null}if(!o.ok)throw new Error(`图片上传失败:HTTP ${o.status}`);if(!a||typeof a!="object")throw new Error("图片上传接口响应不是合法 JSON");const u=a;if(u.ret!==0){const d=typeof u.errmsg=="string"?u.errmsg:"";throw new Error(d||"图片上传失败")}const c=wu(u.data);if(!c)throw new Error("图片上传接口未返回 url");return c}).catch(o=>{throw o instanceof DOMException&&o.name==="AbortError"?new Error(`图片上传超时(${Math.round(e.timeoutMs/1e3)}s)`):new Error(oe(o))}).finally(()=>clearTimeout(n))}const Ls=`
12
12
  :host {
13
13
  all: initial;
14
14
  --br-bg: #ffffff;
@@ -484,7 +484,7 @@ ${r}`:e).slice(0,Dr)}return typeof t=="string"?t.slice(0,Dr):JSON.stringify(t).s
484
484
  }
485
485
  .confirm .ok { background: #fff; color: #1d64e0; font-weight: 600; }
486
486
  .confirm .no { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .5); }
487
- `;class Gf{constructor(){this.host=null,this.root=null,this.box=null,this.badge=null,this.confirmBar=null,this.confirmText=null,this.hovered=null,this.pending=null,this.raf=0,this.active=!1,this.lastX=0,this.lastY=0,this.pointerKnown=!1,this.resolve=null,this.previousCursor="",this.altPressed=!1,this.coarsePointer=!1,this.touchStartX=0,this.touchStartY=0,this.touchMoved=!1,this.ignoreElements=[],this.onMouseMove=e=>{this.active&&(this.lastX=e.clientX,this.lastY=e.clientY,this.pointerKnown=!0,!(this.coarsePointer||this.pending)&&this.scheduleUpdate())},this.onScroll=()=>{if(!this.active)return;const e=this.pending||this.hovered;if(e){if(!e.isConnected){this.pending?this.clearPending():this.updateHighlight(null);return}this.scheduleUpdate(e);return}this.pointerKnown&&!this.coarsePointer&&this.scheduleUpdate()},this.onClick=e=>{if(!this.active)return;const r=this.hitTest(e.clientX,e.clientY);if(r){if(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.coarsePointer){this.setPending(r);return}this.finish(ri(r))}},this.onMousePress=e=>{this.active&&(this.isOwnUi(e.target)||(e.preventDefault(),e.stopPropagation()))},this.onPointerPress=e=>{this.active&&e.pointerType!=="touch"&&(this.isOwnUi(e.target)||(e.preventDefault(),e.stopPropagation()))},this.onSuppress=e=>{this.active&&(this.isOwnUi(e.target)||(e.preventDefault(),e.stopPropagation()))},this.onTouchStart=e=>{if(!this.active||this.isOwnUi(e.target))return;e.stopPropagation();const r=e.touches&&e.touches[0];r&&(this.touchStartX=r.clientX,this.touchStartY=r.clientY,this.touchMoved=!1)},this.onTouchEnd=e=>{if(!this.active||this.isOwnUi(e.target))return;const r=e.changedTouches&&e.changedTouches[0];if(!r||this.touchMoved||Math.abs(r.clientX-this.touchStartX)>Xr||Math.abs(r.clientY-this.touchStartY)>Xr)return;e.preventDefault(),e.stopPropagation();const i=this.hitTest(r.clientX,r.clientY);i&&this.setPending(i)},this.onTouchMove=e=>{if(!this.active)return;const r=e.touches&&e.touches[0];r&&(Math.abs(r.clientX-this.touchStartX)>Xr||Math.abs(r.clientY-this.touchStartY)>Xr)&&(this.touchMoved=!0)},this.onKeyDown=e=>{if(this.active){if(e.key==="Escape"){if(e.preventDefault(),e.stopPropagation(),this.pending){this.clearPending();return}this.finish(null);return}e.key==="Alt"&&(this.altPressed=!0)}},this.onKeyUp=e=>{e.key==="Alt"&&(this.altPressed=!1)}}start(e={}){return this.active?Promise.resolve(null):(this.active=!0,this.coarsePointer=this.detectCoarsePointer(),this.mount(e),new Promise(r=>{this.resolve=r,window.addEventListener("mousemove",this.onMouseMove,!0),window.addEventListener("click",this.onClick,!0),window.addEventListener("dblclick",this.onSuppress,!0),window.addEventListener("contextmenu",this.onSuppress,!0),window.addEventListener("mousedown",this.onMousePress,!0),window.addEventListener("pointerdown",this.onPointerPress,!0),window.addEventListener("touchstart",this.onTouchStart,{capture:!0,passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{capture:!0,passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{capture:!0,passive:!1}),window.addEventListener("keydown",this.onKeyDown,!0),window.addEventListener("keyup",this.onKeyUp,!0),window.addEventListener("scroll",this.onScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this.onScroll,{passive:!0})}))}detectCoarsePointer(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches?!0:window.innerWidth<=560}catch(e){return!1}}stop(){this.finish(null)}mount(e){const r=document.createElement("div");r.setAttribute("data-bug-tap-picker",""),this.host=r;const n=r.attachShadow({mode:"open"});this.root=n;let i=null;try{if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n){const R=new CSSStyleSheet;R.replaceSync(ni),n.adoptedStyleSheets=[...n.adoptedStyleSheets,R]}else i=document.createElement("style"),i.textContent=ni}catch(R){i=document.createElement("style"),i.textContent=ni}const s=document.createElement("div");s.className="box",s.style.display="none",this.box=s;const o=document.createElement("div");o.className="badge",o.style.display="none",this.badge=o;const l=document.createElement("div");l.className="bar";const a=document.createElement("span");a.innerHTML=this.coarsePointer?"轻点要反馈的页面元素":`${e.hint||"点击要反馈的页面元素"} <kbd>Alt</kbd> 选中父级 <kbd>Esc</kbd> 取消`;const u=document.createElement("button");u.type="button",u.textContent="取消",u.addEventListener("click",()=>this.finish(null)),l.append(a,u);const c=document.createElement("div");c.className="confirm";const d=document.createElement("div");d.className="confirm-text";const p=document.createElement("button");p.type="button",p.className="no",p.textContent="重选",p.addEventListener("click",()=>this.clearPending());const x=document.createElement("button");x.type="button",x.className="ok",x.textContent="确认",x.addEventListener("click",()=>{this.pending&&this.finish(ri(this.pending))}),c.append(d,p,x),this.confirmBar=c,this.confirmText=d,n.append(l,s,o,c),i&&n.append(i),document.documentElement.appendChild(r),this.previousCursor=document.documentElement.style.cursor,document.documentElement.style.cursor=this.coarsePointer?"default":"crosshair";try{document.documentElement.setAttribute("data-bug-tap-picking","")}catch(R){}this.ignoreElements=e.ignoreElements||[]}isIgnored(e){if(!e)return!0;let r=e;for(;r;){if(this.ignoreElements.indexOf(r)>=0||r.hasAttribute&&r.hasAttribute("data-bug-tap-picker"))return!0;const n=r.getRootNode?r.getRootNode():null;if(n&&n.host){r=n.host;continue}r=r.parentElement}return!1}hitTest(e,r){const n=document.elementFromPoint(e,r);if(!n||this.isIgnored(n))return null;if(this.altPressed&&n.parentElement){const i=n.parentElement;if(!this.isIgnored(i))return i}return n}scheduleUpdate(e){this.raf||(this.raf=requestAnimationFrame(()=>{if(this.raf=0,e){this.updateHighlight(e);return}this.updateHighlight(this.hitTest(this.lastX,this.lastY))}))}updateHighlight(e){if(!this.box||!this.badge)return;if(!e){this.box.style.display="none",this.badge.style.display="none",this.hovered=null;return}this.hovered=e;const r=e.getBoundingClientRect();this.box.style.display="block",this.box.style.top=`${r.top}px`,this.box.style.left=`${r.left}px`,this.box.style.width=`${r.width}px`,this.box.style.height=`${r.height}px`;const n=`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}`;this.badge.style.display="block",this.badge.textContent=n,this.badge.style.left=`${Math.max(4,r.left)}px`,this.badge.style.top=`${r.top>26?r.top-24:r.bottom+4}px`}isOwnUi(e){if(!e)return!0;let r=e;for(;r;){if(r.hasAttribute&&r.hasAttribute("data-bug-tap-picker"))return!0;const n=r.getRootNode?r.getRootNode():null;if(n&&n.host){r=n.host;continue}r=r.parentElement}return!1}setPending(e){this.pending=e,this.updateHighlight(e),this.confirmBar&&this.confirmText&&(this.confirmText.textContent=ri(e).selector,this.confirmBar.classList.add("confirm--show"))}clearPending(){var e;this.pending=null,(e=this.confirmBar)==null||e.classList.remove("confirm--show"),this.updateHighlight(null)}finish(e){var n;if(!this.active)return;this.active=!1,window.removeEventListener("mousemove",this.onMouseMove,!0),window.removeEventListener("click",this.onClick,!0),window.removeEventListener("dblclick",this.onSuppress,!0),window.removeEventListener("contextmenu",this.onSuppress,!0),window.removeEventListener("mousedown",this.onMousePress,!0),window.removeEventListener("pointerdown",this.onPointerPress,!0),window.removeEventListener("touchstart",this.onTouchStart,{capture:!0}),window.removeEventListener("touchmove",this.onTouchMove,{capture:!0}),window.removeEventListener("touchend",this.onTouchEnd,{capture:!0}),window.removeEventListener("keydown",this.onKeyDown,!0),window.removeEventListener("keyup",this.onKeyUp,!0),window.removeEventListener("scroll",this.onScroll,{capture:!0}),window.removeEventListener("resize",this.onScroll),this.raf&&(cancelAnimationFrame(this.raf),this.raf=0),document.documentElement.style.cursor=this.previousCursor;try{document.documentElement.removeAttribute("data-bug-tap-picking")}catch(i){}(n=this.host)==null||n.remove(),this.host=null,this.root=null,this.box=null,this.badge=null,this.confirmBar=null,this.confirmText=null,this.hovered=null,this.pending=null,this.altPressed=!1,this.ignoreElements=[],this.pointerKnown=!1;const r=this.resolve;this.resolve=null,r&&r(e)}}const ao="bug-tap-enabled";function Jf(){try{const t=localStorage.getItem(ao);return t==="1"||t==="0"?t:null}catch(t){return null}}function co(t){try{localStorage.setItem(ao,t?"1":"0")}catch(e){}}function Qf(t){if(typeof location=="undefined")return null;try{const e=new URLSearchParams(location.search);if(!e.has(t.queryParam)){const r=location.hash.includes("?")?location.hash.slice(location.hash.indexOf("?")+1):"";if(!r)return null;const n=new URLSearchParams(r);return n.has(t.queryParam)?uo(n.get(t.queryParam),t.queryValue):null}return uo(e.get(t.queryParam),t.queryValue)}catch(e){return null}}function uo(t,e){return e?t===e||t==="1"||t==="true":!0}function Zf(t){const e=Qf(t);if(e===!0)return co(!0),!0;if(e===!1)return!1;const r=Jf();return r==="0"?!1:t.mode==="triggered"?r==="1":!0}function td(){if(typeof window=="undefined")return null;const t=window.BugTap;return t&&typeof t.captureException=="function"?t:null}function ur(t){if(!t||typeof t!="object")return;const e=t,r=typeof e.fullPath=="string"?e.fullPath:e.path;return typeof r=="string"?r.slice(0,500):void 0}function ed(t){if(!t||typeof t!="object")return;const e=t.name;return typeof e=="string"?e.slice(0,100):void 0}function rd(){try{return`${location.pathname}${location.search}${location.hash}`.slice(0,500)}catch(t){return}}function nd(t){var s,o,l,a,u,c,d,p,x,R;if(!t||typeof t!="object")return;const e=t,r=(o=(s=e.$)==null?void 0:s.type)!=null?o:e.type,n=e.$options,i=(R=(x=(d=(u=(a=(l=n==null?void 0:n.name)!=null?l:n==null?void 0:n.__name)!=null?a:r==null?void 0:r.name)!=null?u:r==null?void 0:r.__name)!=null?d:(c=e.type)==null?void 0:c.name)!=null?x:(p=e.type)==null?void 0:p.__name)!=null?R:n==null?void 0:n._componentTag;return typeof i=="string"&&i?i:void 0}function id(t){if(!(!t||typeof t!="object"))return ur(t.$route)}function sd(t){var e;return(e=id(t))!=null?e:rd()}function ii(t){return{install(e,r={}){const n=r.client||t||td();if(!n)return()=>{};const i=e.config,s=[];if(r.captureErrors!==!1&&i){const o=i.errorHandler,l=(a,u,c)=>{try{n.captureException(a,{source:"vue",info:c,component:nd(u),route:sd(u)})}catch(d){}typeof o=="function"&&o(a,u,c)};i.errorHandler=l,s.push(()=>{i.errorHandler===l&&(i.errorHandler=o||null)})}if(r.router&&typeof r.router.afterEach=="function"){try{n.disableRouteCapture()}catch(l){}const o=r.router.afterEach((l,a,u)=>{try{if(u){n.captureException(u instanceof Error?u:new Error(String(u)),{source:"vue-router",from:ur(a),to:ur(l)});return}n.addBreadcrumb({type:"route",from:ur(a),to:ur(l),data:{name:ed(l),source:"vue-router"}})}catch(c){}});s.push(()=>{typeof o=="function"&&o()})}return()=>{s.forEach(o=>{try{o()}catch(l){}})}}}}const od=ii();function fo(t,e){return!t||!t.config?()=>{}:ii(e).install(t,{client:e,captureErrors:!0})}function ho(t){const e=(r,n)=>{try{t.captureException(r,{source:"react",componentStack:n&&n.componentStack?n.componentStack.slice(0,4e3):void 0})}catch(i){}};return{onUncaughtError:e,onCaughtError:e,onRecoverableError:e}}const ld=typeof window!="undefined"&&window.console&&typeof window.console.debug=="function"?window.console.debug.bind(window.console):()=>{};class si{constructor(e){this.host=null,this.fab=null,this.panel=null,this.panelLoading=null,this.openCancelled=!1,this.picker=null,this.lastClientReportId=null,this.pendingMount=0,this.configErrors=[],this.tags=new Map,this.extras=new Map,this.contexts=new Map,this.initialized=!1,this.routeCaptureOwned=!1,this.rawConfig=e,this.config=Ln(e),this.collector=new bs(this.config),this.transport=new Is(this.config),Ds(this.config.screenshot.scriptUrl),this.configErrors=Nn(e),this.configErrors.length>0&&this.warn(`配置不完整:${this.configErrors.join(";")}。上报按钮不会显示。`)}init(){this.initialized||(this.initialized=!0,this.collector.start(),this.transport.start(),this.config.reporter.enabled&&this.isConfigured()&&(this.mountFab(),this.applyFabVisibility()))}open(){this.openReporter()}close(){this.closeReporter()}openReporter(){var e,r;if(!this.config.reporter.enabled){this.warn("上报入口已被 reporter.enabled=false 关闭");return}if(!this.isConfigured()){this.warn("缺少 project,无法打开上报面板");return}if(this.panel!==null){this.panel.open(this.config.screenshot.enabled&&this.config.screenshot.auto);return}if(this.panelLoading){this.openCancelled=!1;const n=this.panelLoading;(e=this.fab)==null||e.setLoading(!0),n.then(i=>{var s,o;!i||this.openCancelled||((s=this.panel)==null||s.open(this.config.screenshot.enabled&&this.config.screenshot.auto),(o=this.fab)==null||o.setLoading(!1))});return}this.openCancelled=!1,(r=this.fab)==null||r.setLoading(!0),this.cancelPendingMount(),this.pendingMount=requestAnimationFrame(()=>{this.pendingMount=0;const n=this.mountPanel();this.panelLoading=n,n.then(i=>{var s;!i||this.openCancelled||(s=this.panel)==null||s.open(this.config.screenshot.enabled&&this.config.screenshot.auto)}).catch(i=>{this.warn(`面板挂载失败:${oe(i)}`)}).finally(()=>{var i;this.panelLoading===n&&(this.panelLoading=null),(i=this.fab)==null||i.setLoading(!1)})})}cancelPendingMount(){this.pendingMount&&(cancelAnimationFrame(this.pendingMount),this.pendingMount=0)}closeReporter(){var e,r;this.cancelPendingMount(),this.openCancelled=!0,(e=this.fab)==null||e.setLoading(!1),(r=this.panel)==null||r.close()}setConfig(e){const r=ka(this.rawConfig,e),n=this.config;this.rawConfig=r,this.config=Ln(r),Ds(this.config.screenshot.scriptUrl),this.initialized&&this.transport.stop(),this.transport=new Is(this.config),this.initialized&&this.transport.start(),this.configErrors=Nn(r),this.configErrors.length>0&&this.warn(`配置不完整:${this.configErrors.join(";")}。上报按钮不会显示。`),(JSON.stringify(n.collect)!==JSON.stringify(this.config.collect)||!Ke(n.privacy.excludeUrls,this.config.privacy.excludeUrls)||!Ke(n.privacy.excludeConsolePatterns,this.config.privacy.excludeConsolePatterns)||!Ke(n.privacy.excludeBreadcrumbUrls,this.config.privacy.excludeBreadcrumbUrls)||!Ke(n.filtering.ignoreErrors,this.config.filtering.ignoreErrors)||!Ke(n.filtering.denyUrls,this.config.filtering.denyUrls)||!Ke(n.filtering.allowUrls,this.config.filtering.allowUrls)||n.hooks.beforeBreadcrumb!==this.config.hooks.beforeBreadcrumb||n.endpoint!==this.config.endpoint||n.upload.url!==this.config.upload.url||n.transport.maxItemBytes!==this.config.transport.maxItemBytes)&&(this.collector.stop(),this.collector=new bs(this.config),this.routeCaptureOwned&&this.collector.disableRouteCapture(),this.initialized&&this.collector.start()),this.cancelPendingMount(),this.panelLoading=null;const s=this.panel!==null;this.unmountUi(),this.initialized&&this.config.reporter.enabled&&this.isConfigured()&&(this.mountFab(),s&&this.mountPanel(),this.applyFabVisibility())}setUser(e){this.rawConfig={...this.rawConfig,user:e||void 0},this.config=Ln(this.rawConfig),Cc()}setTag(e,r){oi(this.tags,e,typeof r=="string"?r.slice(0,64):r)}setExtra(e,r){oi(this.extras,e,Gr(r))}setContext(e,r){oi(this.contexts,e,Gr(r))}addBreadcrumb(e){const r={...e,t:Date.now(),type:e.type||"manual"};this.collector.addBreadcrumb(r)}captureException(e,r){this.collector.captureException(e,r)}captureMessage(e,r){this.collector.captureMessage(e,r)}disableRouteCapture(){this.routeCaptureOwned=!0,this.collector.disableRouteCapture()}installVueErrorHandler(e){return fo(e,this)}reactErrorHandlers(){return ho(this)}flush(){return this.transport.flush()}destroy(){var e,r;this.cancelPendingMount(),(e=this.panel)==null||e.close(),(r=this.picker)==null||r.stop(),this.picker=null,this.unmountUi(),this.collector.stop(),this.transport.stop(),this.initialized=!1,this.tags.clear(),this.extras.clear(),this.contexts.clear(),this.lastClientReportId=null}getReport(){const e=this.buildWithHooks({values:{title:"",description:""},data:this.collector.getData(),config:this.config,clientReportId:this.lastClientReportId||void 0,...this.runtimeContext()});if(po(e))throw new Error("hooks.beforeSend 返回了 Promise,getReport 只支持同步钩子");if(!e)throw new Error("报告已被 hooks.beforeSend 丢弃");return e}buildWithHooks(e){const r=$c(e),n=this.config.hooks.beforeSend;if(!n)return r;const i=s=>s===null?null:s&&typeof s=="object"?s:r;try{const s=n(r);return po(s)?s.then(i,o=>(this.warn(`beforeSend 执行失败:${oe(o)}`),r)):i(s)}catch(s){return this.warn(`beforeSend 执行失败:${oe(s)}`),r}}runtimeContext(){const e=r=>r.size>0?Object.fromEntries(r):void 0;return{tags:e(this.tags),extra:e(this.extras),contexts:e(this.contexts)}}mountFab(){this.fab||(this.host=new xu(this.config.reporter.theme,this.config.reporter.zIndex),this.fab=new Tu({text:this.config.reporter.text,position:this.config.reporter.position,onClick:()=>this.openReporter()}),this.host.root.append(this.fab.element),this.host.mount(),this.fab.restorePosition())}mountPanel(){if(this.panel)return Promise.resolve(this.panel);this.host||this.mountFab();const e=this.host;return e?Promise.resolve().then(()=>Cg).then(r=>new r.ReporterPanel({onSubmit:(n,i,s)=>this.submit(n,i,s),onCapture:()=>this.capture(),onUpload:n=>this.upload(n),onPickElement:()=>this.pickElement(),canUploadScreenshot:this.config.screenshot.enabled,maxElements:this.config.collect.maxElements,onDisable:this.config.reporter.visibility.closable?()=>{var n;co(!1),(n=this.fab)==null||n.hide()}:void 0})).then(r=>this.host!==e?(r.unmount(),null):this.panel?(r.unmount(),this.panel):(this.panel=r,e.root.append(r.overlay),r)):Promise.resolve(null)}applyFabVisibility(){if(!this.fab)return;Zf(this.config.reporter.visibility)?this.fab.show():this.fab.hide()}unmountUi(){var e,r,n,i,s;(e=this.picker)==null||e.stop(),this.picker=null,(r=this.panel)==null||r.close(),(n=this.panel)==null||n.unmount(),(i=this.fab)==null||i.destroy(),(s=this.host)==null||s.unmount(),this.host=null,this.fab=null,this.panel=null}capture(){return this.config.screenshot.enabled?this.host?Nu({ignoreElement:this.host.host,quality:this.config.screenshot.quality,maxWidth:this.config.screenshot.maxWidth,maxSizeKB:this.config.screenshot.maxSizeKB,source:"auto"}):Promise.reject(new Error("上报面板未初始化")):Promise.reject(new Error("截图功能已关闭"))}upload(e){return this.config.screenshot.enabled?$u(e,{quality:this.config.screenshot.quality,maxWidth:this.config.screenshot.maxWidth,maxSizeKB:this.config.screenshot.maxSizeKB,source:"manual"}):Promise.reject(new Error("截图功能已关闭"))}submit(e,r,n){return this.isConfigured()?this.prepareScreenshots(r).then(i=>{const s=this.collector.getData(),o=this.buildWithHooks({values:e,data:s,config:this.config,clientReportId:this.lastClientReportId||void 0,screenshots:i.length>0?i:void 0,elements:n.length>0?n:void 0,...this.runtimeContext()});return Promise.resolve(o).then(l=>{if(!l)throw new Error("报告已被 hooks.beforeSend 丢弃");return this.lastClientReportId=l.clientReportId,this.transport.send(l).catch(a=>{if(a instanceof ct&&a.queued)return{success:!0,queued:!0,reportId:l.clientReportId,message:"网络异常,反馈已保存,恢复后会自动提交"};throw a}).finally(()=>{this.lastClientReportId=null})})}):Promise.reject(new Error("缺少 project,无法提交"))}pickElement(){return this.host?(this.picker||(this.picker=new Gf),this.picker.start({ignoreElements:[this.host.host]})):Promise.reject(new Error("上报面板未初始化"))}prepareScreenshots(e){return e.length===0?Promise.resolve([]):Promise.all(e.map(r=>this.prepareScreenshot(r)))}prepareScreenshot(e){return this.config.upload.enabled?vu(e,this.config.upload).then(r=>({...e,url:r,dataBase64:void 0})).catch(r=>(this.warn(`截图上传失败,改为内联提交:${oe(r)}`),e)):Promise.resolve(e)}isConfigured(){return this.configErrors.length===0}warn(e){this.config.debug&&ld(`[bug-tap] ${e}`)}}function po(t){return!!(t&&typeof t.then=="function")}const ad=6,Yr=50,cd=50;function oi(t,e,r){const n=String(e||"").slice(0,64);if(n){if(t.delete(n),t.size>=cd){const i=t.keys().next();i.done||t.delete(i.value)}t.set(n,r)}}function Gr(t,e=0,r){const n=typeof t;if(t===null||n==="string"||n==="number"||n==="boolean")return t;if(n==="undefined"||n==="function"||n==="symbol"||n==="bigint")return n==="bigint"?String(t):void 0;if(t instanceof Date)try{return t.toISOString()}catch(o){return}if(t instanceof Error)return`[Error] ${t.name}: ${t.message}`.slice(0,500);if(t instanceof RegExp)return String(t);if(e>=ad)return"[MaxDepth]";const i=r||new WeakSet,s=t;if(i.has(s))return"[Circular]";i.add(s);try{if(Array.isArray(t)){const a=t.slice(0,Yr).map(u=>{const c=Gr(u,e+1,i);return c===void 0?null:c});return t.length>Yr&&a.push(`…[${t.length-Yr} more]`),a}const o={},l=Object.keys(s).slice(0,Yr);for(const a of l){let u;try{u=s[a]}catch(d){continue}const c=Gr(u,e+1,i);c!==void 0&&(o[a]=c)}return o}catch(o){return"[Unserializable]"}finally{i.delete(s)}}function Ke(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r+=1){const n=t[r],i=e[r];if(n instanceof RegExp||i instanceof RegExp){if(!(n instanceof RegExp)||!(i instanceof RegExp)||n.source!==i.source||n.flags!==i.flags)return!1}else if(n!==i)return!1}return!0}const go="0.1.0";let P=null;function mo(t){if(typeof window=="undefined")return null;try{const e=new si(t);return e.init(),e}catch(e){return Jr(`初始化失败:${e instanceof Error?e.message:String(e)}`),null}}function li(t){if(typeof window=="undefined")return null;if(P)return P;const e=t||window.BugTapConfig||ai();if(!e)return Jr("缺少配置:请在引入脚本前设置 window.BugTapConfig,或调用 BugTap.init(config)"),null;const r=Nn(e);if(r.length>0)return Jr(`配置不完整:${r.join(";")}。未初始化。`),null;try{const n=new si(e);return P=n,n.init(),n}catch(n){try{P==null||P.destroy()}catch(i){}return Jr(`初始化失败:${n instanceof Error?n.message:String(n)}`),P=null,null}}function ai(){try{if(typeof document=="undefined")return null;const t=document.currentScript,e=t&&t.dataset&&t.dataset.project?t:document.querySelector("script[data-project]");if(!e||!e.dataset)return null;const r=e.dataset;return r.project?{project:r.project,endpoint:r.endpoint,environment:r.environment,appVersion:r.appVersion,buildId:r.buildId,release:r.release,debug:r.debug==="true"}:null}catch(t){return null}}const ud={version:go,init:li,createClient:mo,open(){P==null||P.open()},close(){P==null||P.close()},openReporter(){P==null||P.openReporter()},closeReporter(){P==null||P.closeReporter()},setConfig(t){P==null||P.setConfig(t)},setUser(t){P==null||P.setUser(t)},setTag(t,e){P==null||P.setTag(t,e)},setExtra(t,e){P==null||P.setExtra(t,e)},setContext(t,e){P==null||P.setContext(t,e)},addBreadcrumb(t){P==null||P.addBreadcrumb(t)},captureException(t,e){P==null||P.captureException(t,e)},captureMessage(t,e){P==null||P.captureMessage(t,e)},disableRouteCapture(){P==null||P.disableRouteCapture()},installVueErrorHandler(t){return P?P.installVueErrorHandler(t):()=>{}},reactErrorHandlers(){if(P)return P.reactErrorHandlers();const t=()=>{};return{onUncaughtError:t,onCaughtError:t,onRecoverableError:t}},flush(){return P?P.flush():Promise.resolve(0)},destroy(){P==null||P.destroy(),P=null},getReport(){if(!P)throw new Error("[bug-tap] 尚未初始化");return P.getReport()}};function Jr(t){try{window.console&&typeof window.console.warn=="function"&&window.console.warn(`[bug-tap] ${t}`)}catch(e){}}function bo(){if(window.__BUG_TAP__)return;const t=window.BugTapConfig||ai();t&&li(t)&&(window.__BUG_TAP__=!0)}typeof window!="undefined"&&(window.BugTap=ud,window.BugTapConfig||ai()?bo():document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",bo,{once:!0}));/**
487
+ `;class Gf{constructor(){this.host=null,this.root=null,this.box=null,this.badge=null,this.confirmBar=null,this.confirmText=null,this.hovered=null,this.pending=null,this.raf=0,this.active=!1,this.lastX=0,this.lastY=0,this.pointerKnown=!1,this.resolve=null,this.previousCursor="",this.altPressed=!1,this.coarsePointer=!1,this.touchStartX=0,this.touchStartY=0,this.touchMoved=!1,this.ignoreElements=[],this.onMouseMove=e=>{this.active&&(this.lastX=e.clientX,this.lastY=e.clientY,this.pointerKnown=!0,!(this.coarsePointer||this.pending)&&this.scheduleUpdate())},this.onScroll=()=>{if(!this.active)return;const e=this.pending||this.hovered;if(e){if(!e.isConnected){this.pending?this.clearPending():this.updateHighlight(null);return}this.scheduleUpdate(e);return}this.pointerKnown&&!this.coarsePointer&&this.scheduleUpdate()},this.onClick=e=>{if(!this.active)return;const r=this.hitTest(e.clientX,e.clientY);if(r){if(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.coarsePointer){this.setPending(r);return}this.finish(ri(r))}},this.onMousePress=e=>{this.active&&(this.isOwnUi(e.target)||(e.preventDefault(),e.stopPropagation()))},this.onPointerPress=e=>{this.active&&e.pointerType!=="touch"&&(this.isOwnUi(e.target)||(e.preventDefault(),e.stopPropagation()))},this.onSuppress=e=>{this.active&&(this.isOwnUi(e.target)||(e.preventDefault(),e.stopPropagation()))},this.onTouchStart=e=>{if(!this.active||this.isOwnUi(e.target))return;e.stopPropagation();const r=e.touches&&e.touches[0];r&&(this.touchStartX=r.clientX,this.touchStartY=r.clientY,this.touchMoved=!1)},this.onTouchEnd=e=>{if(!this.active||this.isOwnUi(e.target))return;const r=e.changedTouches&&e.changedTouches[0];if(!r||this.touchMoved||Math.abs(r.clientX-this.touchStartX)>Xr||Math.abs(r.clientY-this.touchStartY)>Xr)return;e.preventDefault(),e.stopPropagation();const i=this.hitTest(r.clientX,r.clientY);i&&this.setPending(i)},this.onTouchMove=e=>{if(!this.active)return;const r=e.touches&&e.touches[0];r&&(Math.abs(r.clientX-this.touchStartX)>Xr||Math.abs(r.clientY-this.touchStartY)>Xr)&&(this.touchMoved=!0)},this.onKeyDown=e=>{if(this.active){if(e.key==="Escape"){if(e.preventDefault(),e.stopPropagation(),this.pending){this.clearPending();return}this.finish(null);return}e.key==="Alt"&&(this.altPressed=!0)}},this.onKeyUp=e=>{e.key==="Alt"&&(this.altPressed=!1)}}start(e={}){return this.active?Promise.resolve(null):(this.active=!0,this.coarsePointer=this.detectCoarsePointer(),this.mount(e),new Promise(r=>{this.resolve=r,window.addEventListener("mousemove",this.onMouseMove,!0),window.addEventListener("click",this.onClick,!0),window.addEventListener("dblclick",this.onSuppress,!0),window.addEventListener("contextmenu",this.onSuppress,!0),window.addEventListener("mousedown",this.onMousePress,!0),window.addEventListener("pointerdown",this.onPointerPress,!0),window.addEventListener("touchstart",this.onTouchStart,{capture:!0,passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{capture:!0,passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{capture:!0,passive:!1}),window.addEventListener("keydown",this.onKeyDown,!0),window.addEventListener("keyup",this.onKeyUp,!0),window.addEventListener("scroll",this.onScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this.onScroll,{passive:!0})}))}detectCoarsePointer(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches?!0:window.innerWidth<=560}catch(e){return!1}}stop(){this.finish(null)}mount(e){const r=document.createElement("div");r.setAttribute("data-bug-tap-picker",""),this.host=r;const n=r.attachShadow({mode:"open"});this.root=n;let i=null;try{if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n){const R=new CSSStyleSheet;R.replaceSync(ni),n.adoptedStyleSheets=[...n.adoptedStyleSheets,R]}else i=document.createElement("style"),i.textContent=ni}catch(R){i=document.createElement("style"),i.textContent=ni}const s=document.createElement("div");s.className="box",s.style.display="none",this.box=s;const o=document.createElement("div");o.className="badge",o.style.display="none",this.badge=o;const l=document.createElement("div");l.className="bar";const a=document.createElement("span");a.innerHTML=this.coarsePointer?"轻点要反馈的页面元素":`${e.hint||"点击要反馈的页面元素"} <kbd>Alt</kbd> 选中父级 <kbd>Esc</kbd> 取消`;const u=document.createElement("button");u.type="button",u.textContent="取消",u.addEventListener("click",()=>this.finish(null)),l.append(a,u);const c=document.createElement("div");c.className="confirm";const d=document.createElement("div");d.className="confirm-text";const p=document.createElement("button");p.type="button",p.className="no",p.textContent="重选",p.addEventListener("click",()=>this.clearPending());const x=document.createElement("button");x.type="button",x.className="ok",x.textContent="确认",x.addEventListener("click",()=>{this.pending&&this.finish(ri(this.pending))}),c.append(d,p,x),this.confirmBar=c,this.confirmText=d,n.append(l,s,o,c),i&&n.append(i),document.documentElement.appendChild(r),this.previousCursor=document.documentElement.style.cursor,document.documentElement.style.cursor=this.coarsePointer?"default":"crosshair";try{document.documentElement.setAttribute("data-bug-tap-picking","")}catch(R){}this.ignoreElements=e.ignoreElements||[]}isIgnored(e){if(!e)return!0;let r=e;for(;r;){if(this.ignoreElements.indexOf(r)>=0||r.hasAttribute&&r.hasAttribute("data-bug-tap-picker"))return!0;const n=r.getRootNode?r.getRootNode():null;if(n&&n.host){r=n.host;continue}r=r.parentElement}return!1}hitTest(e,r){const n=document.elementFromPoint(e,r);if(!n||this.isIgnored(n))return null;if(this.altPressed&&n.parentElement){const i=n.parentElement;if(!this.isIgnored(i))return i}return n}scheduleUpdate(e){this.raf||(this.raf=requestAnimationFrame(()=>{if(this.raf=0,e){this.updateHighlight(e);return}this.updateHighlight(this.hitTest(this.lastX,this.lastY))}))}updateHighlight(e){if(!this.box||!this.badge)return;if(!e){this.box.style.display="none",this.badge.style.display="none",this.hovered=null;return}this.hovered=e;const r=e.getBoundingClientRect();this.box.style.display="block",this.box.style.top=`${r.top}px`,this.box.style.left=`${r.left}px`,this.box.style.width=`${r.width}px`,this.box.style.height=`${r.height}px`;const n=`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}`;this.badge.style.display="block",this.badge.textContent=n,this.badge.style.left=`${Math.max(4,r.left)}px`,this.badge.style.top=`${r.top>26?r.top-24:r.bottom+4}px`}isOwnUi(e){if(!e)return!0;let r=e;for(;r;){if(r.hasAttribute&&r.hasAttribute("data-bug-tap-picker"))return!0;const n=r.getRootNode?r.getRootNode():null;if(n&&n.host){r=n.host;continue}r=r.parentElement}return!1}setPending(e){this.pending=e,this.updateHighlight(e),this.confirmBar&&this.confirmText&&(this.confirmText.textContent=ri(e).selector,this.confirmBar.classList.add("confirm--show"))}clearPending(){var e;this.pending=null,(e=this.confirmBar)==null||e.classList.remove("confirm--show"),this.updateHighlight(null)}finish(e){var n;if(!this.active)return;this.active=!1,window.removeEventListener("mousemove",this.onMouseMove,!0),window.removeEventListener("click",this.onClick,!0),window.removeEventListener("dblclick",this.onSuppress,!0),window.removeEventListener("contextmenu",this.onSuppress,!0),window.removeEventListener("mousedown",this.onMousePress,!0),window.removeEventListener("pointerdown",this.onPointerPress,!0),window.removeEventListener("touchstart",this.onTouchStart,{capture:!0}),window.removeEventListener("touchmove",this.onTouchMove,{capture:!0}),window.removeEventListener("touchend",this.onTouchEnd,{capture:!0}),window.removeEventListener("keydown",this.onKeyDown,!0),window.removeEventListener("keyup",this.onKeyUp,!0),window.removeEventListener("scroll",this.onScroll,{capture:!0}),window.removeEventListener("resize",this.onScroll),this.raf&&(cancelAnimationFrame(this.raf),this.raf=0),document.documentElement.style.cursor=this.previousCursor;try{document.documentElement.removeAttribute("data-bug-tap-picking")}catch(i){}(n=this.host)==null||n.remove(),this.host=null,this.root=null,this.box=null,this.badge=null,this.confirmBar=null,this.confirmText=null,this.hovered=null,this.pending=null,this.altPressed=!1,this.ignoreElements=[],this.pointerKnown=!1;const r=this.resolve;this.resolve=null,r&&r(e)}}const ao="bug-tap-enabled";function Jf(){try{const t=localStorage.getItem(ao);return t==="1"||t==="0"?t:null}catch(t){return null}}function co(t){try{localStorage.setItem(ao,t?"1":"0")}catch(e){}}function Qf(t){if(typeof location=="undefined")return null;try{const e=new URLSearchParams(location.search);if(!e.has(t.queryParam)){const r=location.hash.includes("?")?location.hash.slice(location.hash.indexOf("?")+1):"";if(!r)return null;const n=new URLSearchParams(r);return n.has(t.queryParam)?uo(n.get(t.queryParam),t.queryValue):null}return uo(e.get(t.queryParam),t.queryValue)}catch(e){return null}}function uo(t,e){return e?t===e||t==="1"||t==="true":!0}function Zf(t){const e=Qf(t);if(e===!0)return co(!0),!0;if(e===!1)return!1;const r=Jf();return r==="0"?!1:t.mode==="triggered"?r==="1":!0}function td(){if(typeof window=="undefined")return null;const t=window.BugTap;return t&&typeof t.captureException=="function"?t:null}function ur(t){if(!t||typeof t!="object")return;const e=t,r=typeof e.fullPath=="string"?e.fullPath:e.path;return typeof r=="string"?r.slice(0,500):void 0}function ed(t){if(!t||typeof t!="object")return;const e=t.name;return typeof e=="string"?e.slice(0,100):void 0}function rd(){try{return`${location.pathname}${location.search}${location.hash}`.slice(0,500)}catch(t){return}}function nd(t){var s,o,l,a,u,c,d,p,x,R;if(!t||typeof t!="object")return;const e=t,r=(o=(s=e.$)==null?void 0:s.type)!=null?o:e.type,n=e.$options,i=(R=(x=(d=(u=(a=(l=n==null?void 0:n.name)!=null?l:n==null?void 0:n.__name)!=null?a:r==null?void 0:r.name)!=null?u:r==null?void 0:r.__name)!=null?d:(c=e.type)==null?void 0:c.name)!=null?x:(p=e.type)==null?void 0:p.__name)!=null?R:n==null?void 0:n._componentTag;return typeof i=="string"&&i?i:void 0}function id(t){if(!(!t||typeof t!="object"))return ur(t.$route)}function sd(t){var e;return(e=id(t))!=null?e:rd()}function ii(t){return{install(e,r={}){const n=r.client||t||td();if(!n)return()=>{};const i=e.config,s=[];if(r.captureErrors!==!1&&i){const o=i.errorHandler,l=(a,u,c)=>{try{n.captureException(a,{source:"vue",info:c,component:nd(u),route:sd(u)})}catch(d){}typeof o=="function"&&o(a,u,c)};i.errorHandler=l,s.push(()=>{i.errorHandler===l&&(i.errorHandler=o||null)})}if(r.router&&typeof r.router.afterEach=="function"){try{n.disableRouteCapture()}catch(l){}const o=r.router.afterEach((l,a,u)=>{try{if(u){n.captureException(u instanceof Error?u:new Error(String(u)),{source:"vue-router",from:ur(a),to:ur(l)});return}n.addBreadcrumb({type:"route",from:ur(a),to:ur(l),data:{name:ed(l),source:"vue-router"}})}catch(c){}});s.push(()=>{typeof o=="function"&&o()})}return()=>{s.forEach(o=>{try{o()}catch(l){}})}}}}const od=ii();function fo(t,e){return!t||!t.config?()=>{}:ii(e).install(t,{client:e,captureErrors:!0})}function ho(t){const e=(r,n)=>{try{t.captureException(r,{source:"react",componentStack:n&&n.componentStack?n.componentStack.slice(0,4e3):void 0})}catch(i){}};return{onUncaughtError:e,onCaughtError:e,onRecoverableError:e}}const ld=typeof window!="undefined"&&window.console&&typeof window.console.debug=="function"?window.console.debug.bind(window.console):()=>{};class si{constructor(e){this.host=null,this.fab=null,this.panel=null,this.panelLoading=null,this.openCancelled=!1,this.picker=null,this.lastClientReportId=null,this.pendingMount=0,this.configErrors=[],this.tags=new Map,this.extras=new Map,this.contexts=new Map,this.initialized=!1,this.routeCaptureOwned=!1,this.rawConfig=e,this.config=Ln(e),this.collector=new bs(this.config),this.transport=new Is(this.config),Ds(this.config.screenshot.scriptUrl),this.configErrors=Nn(e),this.configErrors.length>0&&this.warn(`配置不完整:${this.configErrors.join(";")}。上报按钮不会显示。`)}init(){this.initialized||(this.initialized=!0,this.collector.start(),this.transport.start(),this.config.reporter.enabled&&this.isConfigured()&&(this.mountFab(),this.applyFabVisibility()))}open(){this.openReporter()}close(){this.closeReporter()}openReporter(){var e,r;if(!this.config.reporter.enabled){this.warn("上报入口已被 reporter.enabled=false 关闭");return}if(!this.isConfigured()){this.warn("缺少 project,无法打开上报面板");return}if(this.panel!==null){this.panel.open(this.config.screenshot.enabled&&this.config.screenshot.auto);return}if(this.panelLoading){this.openCancelled=!1;const n=this.panelLoading;(e=this.fab)==null||e.setLoading(!0),n.then(i=>{var s,o;!i||this.openCancelled||((s=this.panel)==null||s.open(this.config.screenshot.enabled&&this.config.screenshot.auto),(o=this.fab)==null||o.setLoading(!1))});return}this.openCancelled=!1,(r=this.fab)==null||r.setLoading(!0),this.cancelPendingMount(),this.pendingMount=requestAnimationFrame(()=>{this.pendingMount=0;const n=this.mountPanel();this.panelLoading=n,n.then(i=>{var s;!i||this.openCancelled||(s=this.panel)==null||s.open(this.config.screenshot.enabled&&this.config.screenshot.auto)}).catch(i=>{this.warn(`面板挂载失败:${oe(i)}`)}).finally(()=>{var i;this.panelLoading===n&&(this.panelLoading=null),(i=this.fab)==null||i.setLoading(!1)})})}cancelPendingMount(){this.pendingMount&&(cancelAnimationFrame(this.pendingMount),this.pendingMount=0)}closeReporter(){var e,r;this.cancelPendingMount(),this.openCancelled=!0,(e=this.fab)==null||e.setLoading(!1),(r=this.panel)==null||r.close()}setConfig(e){const r=ka(this.rawConfig,e),n=this.config;this.rawConfig=r,this.config=Ln(r),Ds(this.config.screenshot.scriptUrl),this.initialized&&this.transport.stop(),this.transport=new Is(this.config),this.initialized&&this.transport.start(),this.configErrors=Nn(r),this.configErrors.length>0&&this.warn(`配置不完整:${this.configErrors.join(";")}。上报按钮不会显示。`),(JSON.stringify(n.collect)!==JSON.stringify(this.config.collect)||!Ke(n.privacy.excludeUrls,this.config.privacy.excludeUrls)||!Ke(n.privacy.excludeConsolePatterns,this.config.privacy.excludeConsolePatterns)||!Ke(n.privacy.excludeBreadcrumbUrls,this.config.privacy.excludeBreadcrumbUrls)||!Ke(n.filtering.ignoreErrors,this.config.filtering.ignoreErrors)||!Ke(n.filtering.denyUrls,this.config.filtering.denyUrls)||!Ke(n.filtering.allowUrls,this.config.filtering.allowUrls)||n.hooks.beforeBreadcrumb!==this.config.hooks.beforeBreadcrumb||n.endpoint!==this.config.endpoint||n.upload.url!==this.config.upload.url||n.transport.maxItemBytes!==this.config.transport.maxItemBytes)&&(this.collector.stop(),this.collector=new bs(this.config),this.routeCaptureOwned&&this.collector.disableRouteCapture(),this.initialized&&this.collector.start()),this.cancelPendingMount(),this.panelLoading=null;const s=this.panel!==null;this.unmountUi(),this.initialized&&this.config.reporter.enabled&&this.isConfigured()&&(this.mountFab(),s&&this.mountPanel(),this.applyFabVisibility())}setUser(e){this.rawConfig={...this.rawConfig,user:e||void 0},this.config=Ln(this.rawConfig),Cc()}setTag(e,r){oi(this.tags,e,typeof r=="string"?r.slice(0,64):r)}setExtra(e,r){oi(this.extras,e,Gr(r))}setContext(e,r){oi(this.contexts,e,Gr(r))}addBreadcrumb(e){const r={...e,t:Date.now(),type:e.type||"manual"};this.collector.addBreadcrumb(r)}captureException(e,r){this.collector.captureException(e,r)}captureMessage(e,r){this.collector.captureMessage(e,r)}disableRouteCapture(){this.routeCaptureOwned=!0,this.collector.disableRouteCapture()}installVueErrorHandler(e){return fo(e,this)}reactErrorHandlers(){return ho(this)}flush(){return this.transport.flush()}destroy(){var e,r;this.cancelPendingMount(),(e=this.panel)==null||e.close(),(r=this.picker)==null||r.stop(),this.picker=null,this.unmountUi(),this.collector.stop(),this.transport.stop(),this.initialized=!1,this.tags.clear(),this.extras.clear(),this.contexts.clear(),this.lastClientReportId=null}getReport(){const e=this.buildWithHooks({values:{title:"",description:""},data:this.collector.getData(),config:this.config,clientReportId:this.lastClientReportId||void 0,...this.runtimeContext()});if(po(e))throw new Error("hooks.beforeSend 返回了 Promise,getReport 只支持同步钩子");if(!e)throw new Error("报告已被 hooks.beforeSend 丢弃");return e}buildWithHooks(e){const r=$c(e),n=this.config.hooks.beforeSend;if(!n)return r;const i=s=>s===null?null:s&&typeof s=="object"?s:r;try{const s=n(r);return po(s)?s.then(i,o=>(this.warn(`beforeSend 执行失败:${oe(o)}`),r)):i(s)}catch(s){return this.warn(`beforeSend 执行失败:${oe(s)}`),r}}runtimeContext(){const e=r=>r.size>0?Object.fromEntries(r):void 0;return{tags:e(this.tags),extra:e(this.extras),contexts:e(this.contexts)}}mountFab(){this.fab||(this.host=new xu(this.config.reporter.theme,this.config.reporter.zIndex),this.fab=new Tu({text:this.config.reporter.text,position:this.config.reporter.position,onClick:()=>this.openReporter()}),this.host.root.append(this.fab.element),this.host.mount(),this.fab.restorePosition())}mountPanel(){if(this.panel)return Promise.resolve(this.panel);this.host||this.mountFab();const e=this.host;return e?Promise.resolve().then(()=>Cg).then(r=>new r.ReporterPanel({onSubmit:(n,i,s)=>this.submit(n,i,s),onCapture:()=>this.capture(),onUpload:n=>this.upload(n),onPickElement:()=>this.pickElement(),canUploadScreenshot:this.config.screenshot.enabled,maxElements:this.config.collect.maxElements,onDisable:this.config.reporter.visibility.closable?()=>{var n;co(!1),(n=this.fab)==null||n.hide()}:void 0})).then(r=>this.host!==e?(r.unmount(),null):this.panel?(r.unmount(),this.panel):(this.panel=r,e.root.append(r.overlay),r)):Promise.resolve(null)}applyFabVisibility(){if(!this.fab)return;Zf(this.config.reporter.visibility)?this.fab.show():this.fab.hide()}unmountUi(){var e,r,n,i,s;(e=this.picker)==null||e.stop(),this.picker=null,(r=this.panel)==null||r.close(),(n=this.panel)==null||n.unmount(),(i=this.fab)==null||i.destroy(),(s=this.host)==null||s.unmount(),this.host=null,this.fab=null,this.panel=null}capture(){return this.config.screenshot.enabled?this.host?Nu({ignoreElement:this.host.host,quality:this.config.screenshot.quality,maxWidth:this.config.screenshot.maxWidth,maxSizeKB:this.config.screenshot.maxSizeKB,source:"auto"}):Promise.reject(new Error("上报面板未初始化")):Promise.reject(new Error("截图功能已关闭"))}upload(e){return this.config.screenshot.enabled?$u(e,{quality:this.config.screenshot.quality,maxWidth:this.config.screenshot.maxWidth,maxSizeKB:this.config.screenshot.maxSizeKB,source:"manual"}):Promise.reject(new Error("截图功能已关闭"))}submit(e,r,n){return this.isConfigured()?this.prepareScreenshots(r).then(i=>{const s=this.collector.getData(),o=this.buildWithHooks({values:e,data:s,config:this.config,clientReportId:this.lastClientReportId||void 0,screenshots:i.length>0?i:void 0,elements:n.length>0?n:void 0,...this.runtimeContext()});return Promise.resolve(o).then(l=>{if(!l)throw new Error("报告已被 hooks.beforeSend 丢弃");return this.lastClientReportId=l.clientReportId,this.transport.send(l).catch(a=>{if(a instanceof ct&&a.queued)return{success:!0,queued:!0,reportId:l.clientReportId,message:"网络异常,反馈已保存,恢复后会自动提交"};throw a}).finally(()=>{this.lastClientReportId=null})})}):Promise.reject(new Error("缺少 project,无法提交"))}pickElement(){return this.host?(this.picker||(this.picker=new Gf),this.picker.start({ignoreElements:[this.host.host]})):Promise.reject(new Error("上报面板未初始化"))}prepareScreenshots(e){return e.length===0?Promise.resolve([]):Promise.all(e.map(r=>this.prepareScreenshot(r)))}prepareScreenshot(e){return this.config.upload.enabled?vu(e,this.config.upload).then(r=>({...e,url:r,dataBase64:void 0})).catch(r=>(this.warn(`截图上传失败,改为内联提交:${oe(r)}`),e)):Promise.resolve(e)}isConfigured(){return this.configErrors.length===0}warn(e){this.config.debug&&ld(`[bug-tap] ${e}`)}}function po(t){return!!(t&&typeof t.then=="function")}const ad=6,Yr=50,cd=50;function oi(t,e,r){const n=String(e||"").slice(0,64);if(n){if(t.delete(n),t.size>=cd){const i=t.keys().next();i.done||t.delete(i.value)}t.set(n,r)}}function Gr(t,e=0,r){const n=typeof t;if(t===null||n==="string"||n==="number"||n==="boolean")return t;if(n==="undefined"||n==="function"||n==="symbol"||n==="bigint")return n==="bigint"?String(t):void 0;if(t instanceof Date)try{return t.toISOString()}catch(o){return}if(t instanceof Error)return`[Error] ${t.name}: ${t.message}`.slice(0,500);if(t instanceof RegExp)return String(t);if(e>=ad)return"[MaxDepth]";const i=r||new WeakSet,s=t;if(i.has(s))return"[Circular]";i.add(s);try{if(Array.isArray(t)){const a=t.slice(0,Yr).map(u=>{const c=Gr(u,e+1,i);return c===void 0?null:c});return t.length>Yr&&a.push(`…[${t.length-Yr} more]`),a}const o={},l=Object.keys(s).slice(0,Yr);for(const a of l){let u;try{u=s[a]}catch(d){continue}const c=Gr(u,e+1,i);c!==void 0&&(o[a]=c)}return o}catch(o){return"[Unserializable]"}finally{i.delete(s)}}function Ke(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r+=1){const n=t[r],i=e[r];if(n instanceof RegExp||i instanceof RegExp){if(!(n instanceof RegExp)||!(i instanceof RegExp)||n.source!==i.source||n.flags!==i.flags)return!1}else if(n!==i)return!1}return!0}const go="0.1.2";let P=null;function mo(t){if(typeof window=="undefined")return null;try{const e=new si(t);return e.init(),e}catch(e){return Jr(`初始化失败:${e instanceof Error?e.message:String(e)}`),null}}function li(t){if(typeof window=="undefined")return null;if(P)return P;const e=t||window.BugTapConfig||ai();if(!e)return Jr("缺少配置:请在引入脚本前设置 window.BugTapConfig,或调用 BugTap.init(config)"),null;const r=Nn(e);if(r.length>0)return Jr(`配置不完整:${r.join(";")}。未初始化。`),null;try{const n=new si(e);return P=n,n.init(),n}catch(n){try{P==null||P.destroy()}catch(i){}return Jr(`初始化失败:${n instanceof Error?n.message:String(n)}`),P=null,null}}function ai(){try{if(typeof document=="undefined")return null;const t=document.currentScript,e=t&&t.dataset&&t.dataset.project?t:document.querySelector("script[data-project]");if(!e||!e.dataset)return null;const r=e.dataset;return r.project?{project:r.project,endpoint:r.endpoint,environment:r.environment,appVersion:r.appVersion,buildId:r.buildId,release:r.release,debug:r.debug==="true"}:null}catch(t){return null}}const ud={version:go,init:li,createClient:mo,open(){P==null||P.open()},close(){P==null||P.close()},openReporter(){P==null||P.openReporter()},closeReporter(){P==null||P.closeReporter()},setConfig(t){P==null||P.setConfig(t)},setUser(t){P==null||P.setUser(t)},setTag(t,e){P==null||P.setTag(t,e)},setExtra(t,e){P==null||P.setExtra(t,e)},setContext(t,e){P==null||P.setContext(t,e)},addBreadcrumb(t){P==null||P.addBreadcrumb(t)},captureException(t,e){P==null||P.captureException(t,e)},captureMessage(t,e){P==null||P.captureMessage(t,e)},disableRouteCapture(){P==null||P.disableRouteCapture()},installVueErrorHandler(t){return P?P.installVueErrorHandler(t):()=>{}},reactErrorHandlers(){if(P)return P.reactErrorHandlers();const t=()=>{};return{onUncaughtError:t,onCaughtError:t,onRecoverableError:t}},flush(){return P?P.flush():Promise.resolve(0)},destroy(){P==null||P.destroy(),P=null},getReport(){if(!P)throw new Error("[bug-tap] 尚未初始化");return P.getReport()}};function Jr(t){try{window.console&&typeof window.console.warn=="function"&&window.console.warn(`[bug-tap] ${t}`)}catch(e){}}function bo(){if(window.__BUG_TAP__)return;const t=window.BugTapConfig||ai();t&&li(t)&&(window.__BUG_TAP__=!0)}typeof window!="undefined"&&(window.BugTap=ud,window.BugTapConfig||ai()?bo():document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",bo,{once:!0}));/**
488
488
  * @vue/shared v3.5.45
489
489
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
490
490
  * @license MIT