sentry-miniapp 1.8.1 → 1.8.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.
@@ -1,8 +1,8 @@
1
- "use strict";var os=Object.defineProperty,as=Object.defineProperties;var cs=Object.getOwnPropertyDescriptors;var Te=Object.getOwnPropertySymbols;var hn=Object.prototype.hasOwnProperty,_n=Object.prototype.propertyIsEnumerable;var mt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),us=t=>{throw TypeError(t)};var dn=(t,e,n)=>e in t?os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l=(t,e)=>{for(var n in e||(e={}))hn.call(e,n)&&dn(t,n,e[n]);if(Te)for(var n of Te(e))_n.call(e,n)&&dn(t,n,e[n]);return t},E=(t,e)=>as(t,cs(e));var gn=(t,e)=>{var n={};for(var r in t)hn.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Te)for(var r of Te(t))e.indexOf(r)<0&&_n.call(t,r)&&(n[r]=t[r]);return n};var C=(t,e,n)=>new Promise((r,s)=>{var i=c=>{try{a(n.next(c))}catch(u){s(u)}},o=c=>{try{a(n.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,o);a((n=n.apply(t,e)).next())}),fs=function(t,e){this[0]=t,this[1]=e};var mn=t=>{var e=t[mt("asyncIterator")],n=!1,r,s={};return e==null?(e=t[mt("iterator")](),r=i=>s[i]=o=>e[i](o)):(e=e.call(t),r=i=>s[i]=o=>{if(n){if(n=!1,i==="throw")throw o;return o}return n=!0,{done:!1,value:new fs(new Promise(a=>{var c=e[i](o);c instanceof Object||us("Object expected"),a(c)}),1)}}),s[mt("iterator")]=()=>s,r("next"),"throw"in e?r("throw"):s.throw=i=>{throw i},"return"in e&&r("return"),s};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class oe{constructor(e){if(this._entries=[],typeof e=="string")this._parseString(e);else if(Array.isArray(e))for(const n of e)Array.isArray(n)&&n.length>=2&&this._entries.push([n[0]||"",n[1]||""]);else if(e&&typeof e=="object")if(e instanceof oe)this._entries=e._entries.map(([n,r])=>[n,r]);else for(const[n,r]of Object.entries(e))this._entries.push([n,r])}get size(){return this._entries.length}_parseString(e){if(e.startsWith("?")&&(e=e.slice(1)),!e)return;const n=e.split("&");for(const r of n){const s=r.indexOf("=");if(s===-1)r&&this._entries.push([decodeURIComponent(r),""]);else{const i=r.slice(0,s),o=r.slice(s+1);i&&this._entries.push([decodeURIComponent(i),decodeURIComponent(o)])}}}append(e,n){this._entries.push([e,String(n)])}delete(e){this._entries=this._entries.filter(([n])=>n!==e)}get(e){const n=this._entries.find(([r])=>r===e);return n?n[1]:null}getAll(e){return this._entries.filter(([n])=>n===e).map(([,n])=>n)}has(e){return this._entries.some(([n])=>n===e)}set(e,n){const r=String(n);let s=!1;if(this._entries=this._entries.filter(([i])=>i===e?s?!1:(s=!0,!0):!0),s){const i=this._entries.findIndex(([o])=>o===e);i!==-1&&(this._entries[i]=[e,r])}else this._entries.push([e,r])}sort(){this._entries.sort(([e],[n])=>e<n?-1:e>n?1:0)}toString(){return this._entries.map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&")}forEach(e){for(const[n,r]of this._entries)e(r,n,this)}*keys(){for(const[e]of this._entries)yield e}*values(){for(const[,e]of this._entries)yield e}*entries(){for(const e of this._entries)yield e}*[Symbol.iterator](){yield*mn(this.entries())}}function ls(){const t=Function("return this")();return t&&typeof t.wx!="undefined"&&t.wx?t.wx:t&&typeof t.my!="undefined"&&t.my?t.my:t&&typeof t.swan!="undefined"&&t.swan?t.swan:t&&typeof t.tt!="undefined"&&t.tt?t.tt:t&&typeof t.qq!="undefined"&&t.qq?t.qq:typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:t}function ps(){try{const t=ls();if(!t){console.warn("[sentry-miniapp] Unable to detect global object, polyfills may not work correctly");return}typeof t.URLSearchParams=="undefined"&&(t.URLSearchParams=oe);const e=Function("return this")();e&&typeof e.URLSearchParams=="undefined"&&(e.URLSearchParams=oe),typeof globalThis!="undefined"&&typeof globalThis.URLSearchParams=="undefined"&&(globalThis.URLSearchParams=oe)}catch(t){console.warn("[sentry-miniapp] Failed to install polyfills:",t)}}function ir(){ps()}ir();const m=typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__,A=globalThis,ae="10.50.0";function _e(){return at(A),A}function at(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ae,e[ae]=e[ae]||{}}function te(t,e,n=A){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[ae]=r[ae]||{};return s[t]||(s[t]=e())}const ds="Sentry Logger ",yn={};function ge(t){if(!("console"in A))return t();const e=A.console,n={},r=Object.keys(yn);r.forEach(s=>{const i=yn[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function hs(){Kt().enabled=!0}function _s(){Kt().enabled=!1}function or(){return Kt().enabled}function gs(...t){Vt("log",...t)}function ms(...t){Vt("warn",...t)}function ys(...t){Vt("error",...t)}function Vt(t,...e){m&&or()&&ge(()=>{A.console[t](`${ds}[${t}]:`,...e)})}function Kt(){return m?te("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const g={enable:hs,disable:_s,isEnabled:or,log:gs,warn:ms,error:ys},ar=50,ct="?",Sn=/\(error: (.*)\)/,bn=/captureMessage|captureException/;function Ss(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],o=n.split(`
2
- `);for(let a=r;a<o.length;a++){let c=o[a];c.length>1024&&(c=c.slice(0,1024));const u=Sn.test(c)?c.replace(Sn,"$1"):c;if(!u.includes("Error: ")){for(const p of e){const f=p(u);if(f){i.push(f);break}}if(i.length>=ar+s)break}}return bs(i.slice(s))}}function bs(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Ie(e).function||"")&&e.pop(),e.reverse(),bn.test(Ie(e).function||"")&&(e.pop(),bn.test(Ie(e).function||"")&&e.pop()),e.slice(0,ar).map(n=>E(l({},n),{filename:n.filename||Ie(e).filename,function:n.function||ct}))}function Ie(t){return t[t.length-1]||{}}const yt="<anonymous>";function Es(t){try{return!t||typeof t!="function"?yt:t.name||yt}catch(e){return yt}}function Ts(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const cr=Object.prototype.toString;function ur(t){switch(cr.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ut(t,Error)}}function Gt(t,e){return cr.call(t)===`[object ${e}]`}function Re(t){return Gt(t,"String")}function fr(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function lr(t){return t===null||fr(t)||typeof t!="object"&&typeof t!="function"}function Ae(t){return Gt(t,"Object")}function Is(t){return typeof Event!="undefined"&&ut(t,Event)}function ws(t){return typeof Element!="undefined"&&ut(t,Element)}function vs(t){return Gt(t,"RegExp")}function ne(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function Rs(t){return Ae(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function ut(t,e){try{return t instanceof e}catch(n){return!1}}function As(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}const Ps=A,Ns=80;function Cs(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,s=[];let i=0,o=0;const a=" > ",c=a.length;let u;const p=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Ns;for(;n&&i++<r&&(u=xs(n,p),!(u==="html"||i>1&&o+s.length*c+u.length>=f));)s.push(u),o+=u.length,n=n.parentNode;return s.reverse().join(a)}catch(n){return"<unknown>"}}function xs(t,e){const n=t,r=[];if(!(n!=null&&n.tagName))return"";if(Ps.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=e!=null&&e.length?e.filter(i=>n.getAttribute(i)).map(i=>[i,n.getAttribute(i)]):null;if(s!=null&&s.length)s.forEach(i=>{r.push(`[${i[0]}="${i[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const i=n.className;if(i&&Re(i)){const o=i.split(/\s+/);for(const a of o)r.push(`.${a}`)}}for(const i of["aria-label","type","name","title","alt"]){const o=n.getAttribute(i);o&&r.push(`[${i}="${o}"]`)}return r.join("")}function z(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch(r){m&&g.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Ds(t){if(ur(t))return l({message:t.message,name:t.name,stack:t.stack},Tn(t));if(Is(t)){const e=l({type:t.type,target:En(t.target),currentTarget:En(t.currentTarget)},Tn(t));return typeof CustomEvent!="undefined"&&ut(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function En(t){try{return ws(t)?Cs(t):Object.prototype.toString.call(t)}catch(e){return"<unknown>"}}function Tn(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}let Y;function ft(t){if(Y!==void 0)return Y?Y(t):t();const e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=A;return e in n&&typeof n[e]=="function"?(Y=n[e],Y(t)):(Y=null,t())}function Pe(){return ft(()=>Math.random())}function lt(){return ft(()=>Date.now())}function Ct(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function St(t,e,n=!1){return Re(t)?vs(e)?e.test(t):Re(e)?n?t===e:t.includes(e):typeof e=="function"?e(t):!1:!1}function Os(){const t=A;return t.crypto||t.msCrypto}let bt;function Ms(){return Pe()*16}function x(t=Os()){try{if(t!=null&&t.randomUUID)return ft(()=>t.randomUUID()).replace(/-/g,"")}catch(e){}return bt||(bt="10000000100040008000"+1e11),bt.replace(/[018]/g,e=>(e^(Ms()&15)>>e/4).toString(16))}function Ls(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function Fs(t,e){const n=Ls(t);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism=l(l(l({},r),s),e),e&&"data"in e){const i=l(l({},s==null?void 0:s.data),e.data);n.mechanism.data=i}}function In(t){if($s(t))return!0;try{z(t,"__sentry_captured__",!0)}catch(e){}return!1}function $s(t){try{return t.__sentry_captured__}catch(e){}}const pr=1e3;function me(){return lt()/pr}function js(){const{performance:t}=A;if(!(t!=null&&t.now)||!t.timeOrigin)return me;const e=t.timeOrigin;return()=>(e+ft(()=>t.now()))/pr}let we;function fe(){return(we!=null?we:we=js())()}function dr(t){const e=fe(),n={sid:x(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Us(n)};return t&&q(n,t),n}function q(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||fe(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:x()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function hr(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),q(t,n)}function Us(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function ye(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r=l({},t);for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=ye(r[s],e[s],n-1));return r}function Ne(){return x()}function pt(){return x().substring(16)}const xt="_sentrySpan";function Ce(t,e){e?z(t,xt,e):delete t[xt]}function Dt(t){return t[xt]}const Bs=100;class O{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ne(),sampleRand:Pe()}}clone(){const e=new O;return e._breadcrumbs=[...this._breadcrumbs],e._tags=l({},this._tags),e._attributes=l({},this._attributes),e._extra=l({},this._extra),e._contexts=l({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=l({},this._sdkProcessingMetadata),e._propagationContext=l({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Ce(e,Dt(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&q(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags=l(l({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes=l(l({},this._attributes),e),this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra=l(l({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,n){return this._extra=E(l({},this._extra),{[e]:n}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof O?n.getScopeData():Ae(n)?e:void 0,{tags:s,attributes:i,extra:o,user:a,contexts:c,level:u,fingerprint:p=[],propagationContext:f,conversationId:h}=r||{};return this._tags=l(l({},this._tags),s),this._attributes=l(l({},this._attributes),i),this._extra=l(l({},this._extra),o),this._contexts=l(l({},this._contexts),c),a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),p.length&&(this._fingerprint=p),f&&(this._propagationContext=f),h&&(this._conversationId=h),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Ce(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ne(),sampleRand:Pe()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var i;const r=typeof n=="number"?n:Bs;if(r<=0)return this;const s=E(l({timestamp:me()},e),{message:e.message?Ct(e.message,2048):e.message});return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(i=this._client)==null||i.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Dt(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ye(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=(n==null?void 0:n.event_id)||x();if(!this._client)return m&&g.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(e,E(l({originalException:e,syntheticException:s},n),{event_id:r}),this),r}captureMessage(e,n,r){var o;const s=(r==null?void 0:r.event_id)||x();if(!this._client)return m&&g.warn("No client configured on scope - will not capture message!"),s;const i=(o=r==null?void 0:r.syntheticException)!=null?o:new Error(e);return this._client.captureMessage(e,n,E(l({originalException:e,syntheticException:i},r),{event_id:s}),this),s}captureEvent(e,n){const r=e.event_id||(n==null?void 0:n.event_id)||x();return this._client?(this._client.captureEvent(e,E(l({},n),{event_id:r}),this),r):(m&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Hs(){return te("defaultCurrentScope",()=>new O)}function zs(){return te("defaultIsolationScope",()=>new O)}const wn=t=>t instanceof Promise&&!t[_r],_r=Symbol("chained PromiseLike"),gr=(t,e,n)=>{const r=t.then(s=>(e(s),s),s=>{throw n(s),s});return wn(r)&&wn(t)?r:qs(t,r)},qs=(t,e)=>{let n=!1;for(const r in t){if(r in e)continue;n=!0;const s=t[r];typeof s=="function"?Object.defineProperty(e,r,{value:(...i)=>s.apply(t,i),enumerable:!0,configurable:!0,writable:!0}):e[r]=s}return n&&Object.assign(e,{[_r]:!0}),e};class Ws{constructor(e,n){let r;e?r=e:r=new O;let s;n?s=n:s=new O,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(s){throw this._popScope(),s}return ne(r)?gr(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Z(){const t=_e(),e=at(t);return e.stack=e.stack||new Ws(Hs(),zs())}function Vs(t){return Z().withScope(t)}function Ks(t,e){const n=Z();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function vn(t){return Z().withScope(()=>t(Z().getIsolationScope()))}function Gs(){return{withIsolationScope:vn,withScope:Vs,withSetScope:Ks,withSetIsolationScope:(t,e)=>vn(e),getCurrentScope:()=>Z().getScope(),getIsolationScope:()=>Z().getIsolationScope()}}function dt(t){const e=at(t);return e.acs?e.acs:Gs()}function y(){const t=_e();return dt(t).getCurrentScope()}function R(){const t=_e();return dt(t).getIsolationScope()}function Ys(){return te("globalScope",()=>new O)}function Se(...t){const e=_e(),n=dt(e);if(t.length===2){const[r,s]=t;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(t[0])}function v(){return y().getClient()}function Js(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=e,i={trace_id:n,span_id:s||pt()};return r&&(i.parent_span_id=r),i}const xe="sentry.source",mr="sentry.sample_rate",Xs="sentry.previous_trace_sample_rate",De="sentry.op",Ot="sentry.origin",Zs="sentry.measurement_unit",Qs="sentry.measurement_value",kn="sentry.custom_span_name",Yt="sentry.profile_id",Jt="sentry.exclusive_time",yr=0,Sr=1,ei=2;function ti(t){try{const e=A.WeakRef;if(typeof e=="function")return new e(t)}catch(e){}return t}function ni(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch(e){return}return t}}const br="_sentryScope",Er="_sentryIsolationScope";function ri(t,e,n){t&&(z(t,Er,ti(n)),z(t,br,e))}function Oe(t){const e=t;return{scope:e[br],isolationScope:ni(e[Er])}}const Rn="sentry-";function si(t){const e=ii(t);if(!e)return;const n=Object.entries(e).reduce((r,[s,i])=>{if(s.startsWith(Rn)){const o=s.slice(Rn.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function ii(t){if(!(!t||!Re(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=An(n);return Object.entries(r).forEach(([s,i])=>{e[s]=i}),e},{}):An(t)}function An(t){return t.split(",").map(e=>{const n=e.indexOf("=");if(n===-1)return[];const r=e.slice(0,n),s=e.slice(n+1);return[r,s].map(i=>{try{return decodeURIComponent(i.trim())}catch(o){return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}const oi=/^o(\d+)\./,ai=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function ci(t){return t==="http"||t==="https"}function re(t,e=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function ui(t){const e=ai.exec(t);if(!e){ge(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,s="",i="",o="",a=""]=e.slice(1);let c="",u=a;const p=u.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),u=p.pop()),u){const f=u.match(/^\d+/);f&&(u=f[0])}return Tr({host:i,pass:s,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function Tr(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function fi(t){if(!m)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(g.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?ci(r)?e&&isNaN(parseInt(e,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function li(t){const e=t.match(oi);return e==null?void 0:e[1]}function pi(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=li(n)),r}function di(t){const e=typeof t=="string"?ui(t):Tr(t);if(!(!e||!fi(e)))return e}function Xt(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const Ir=0,ht=1;let Pn=!1;function hi(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:s,parent_span_id:i,status:o,origin:a,links:c}=P(t);return{parent_span_id:i,span_id:e,trace_id:n,data:r,op:s,status:o,origin:a,links:c}}function _i(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),s=r?e:P(t).parent_span_id,i=Oe(t).scope,o=r?(i==null?void 0:i.getPropagationContext().propagationSpanId)||pt():e;return{parent_span_id:s,span_id:o,trace_id:n}}function wr(t){if(t&&t.length>0)return t.map(o=>{var a=o,{context:c}=a,u=c,{spanId:e,traceId:n,traceFlags:r}=u,s=gn(u,["spanId","traceId","traceFlags"]),{attributes:i}=a;return l({span_id:e,trace_id:n,sampled:r===ht,attributes:i},s)})}function gi(t){if(t!=null&&t.length)return t.map(({context:{spanId:e,traceId:n,traceFlags:r},attributes:s})=>({span_id:e,trace_id:n,sampled:r===ht,attributes:s}))}function X(t){return typeof t=="number"?Nn(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Nn(t.getTime()):fe()}function Nn(t){return t>9999999999?t/1e3:t}function P(t){if(Si(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(yi(t)){const{attributes:r,startTime:s,name:i,endTime:o,status:a,links:c}=t;return{span_id:e,trace_id:n,data:r,description:i,parent_span_id:mi(t),start_timestamp:X(s),timestamp:X(o)||void 0,status:vr(a),op:r[De],origin:r[Ot],links:wr(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function mi(t){var e;return"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?(e=t.parentSpanContext)==null?void 0:e.spanId:void 0}function yi(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Si(t){return typeof t.getSpanJSON=="function"}function be(t){const{traceFlags:e}=t.spanContext();return e===ht}function vr(t){if(!(!t||t.code===yr))return t.code===Sr?"ok":t.message||"internal_error"}function bi(t){return!t||t.code===Sr||t.code===yr||t.message==="cancelled"?"ok":"error"}const ce="_sentryChildSpans",Mt="_sentryRootSpan";function kr(t,e){const n=t[Mt]||t;z(e,Mt,n),t[ce]?t[ce].add(e):z(t,ce,new Set([e]))}function Ei(t){const e=new Set;function n(r){if(!e.has(r)&&be(r)){e.add(r);const s=r[ce]?Array.from(r[ce]):[];for(const i of s)n(i)}}return n(t),Array.from(e)}const F=Ti;function Ti(t){return t[Mt]||t}function Lt(){Pn||(ge(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Pn=!0)}function Zt(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=t||((n=v())==null?void 0:n.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function Cn(t){g.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Me(t,e){if(!(e!=null&&e.length)||!t.description)return!1;for(const n of e){if(wi(n)){if(St(t.description,n))return m&&Cn(t),!0;continue}if(!n.name&&!n.op)continue;const r=n.name?St(t.description,n.name):!0,s=n.op?t.op&&St(t.op,n.op):!0;if(r&&s)return m&&Cn(t),!0}return!1}function Ii(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const s of t)s.parent_span_id===r&&(s.parent_span_id=n)}function wi(t){return typeof t=="string"||t instanceof RegExp}const Qt="production",Rr="_frozenDsc";function Et(t,e){z(t,Rr,e)}function Ar(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},s={environment:n.environment||Qt,release:n.release,public_key:r,trace_id:t,org_id:pi(e)};return e.emit("createDsc",s),s}function vi(t,e){const n=e.getPropagationContext();return n.dsc||Ar(n.traceId,t)}function le(t){var _,b,I,k,M;const e=v();if(!e)return{};const n=F(t),r=P(n),s=r.data,i=n.spanContext().traceState,o=(b=(_=i==null?void 0:i.get("sentry.sample_rate"))!=null?_:s[mr])!=null?b:s[Xs];function a($){return(typeof o=="number"||typeof o=="string")&&($.sample_rate=`${o}`),$}const c=n[Rr];if(c)return a(c);const u=i==null?void 0:i.get("sentry.dsc"),p=u&&si(u);if(p)return a(p);const f=Ar(t.spanContext().traceId,e),h=(I=s[xe])!=null?I:s["sentry.span.source"],d=r.description;return h!=="url"&&d&&(f.transaction=d),Zt()&&(f.sampled=String(be(n)),f.sample_rand=(M=i==null?void 0:i.get("sentry.sample_rand"))!=null?M:(k=Oe(n).scope)==null?void 0:k.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,n),f}class B{constructor(e={}){this._traceId=e.traceId||Ne(),this._spanId=e.spanId||pt(),this.dropReason=e.dropReason}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Ir}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}}function Pr(t){return!!t&&typeof t=="function"&&"_streamed"in t&&!!t._streamed}function U(t,e=100,n=1/0){try{return Ft("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Ft(t,e,n=1/0,r=1/0,s=Ai()){const[i,o]=s;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=ki(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(i(e))return"[Circular ~]";const u=e;if(u&&typeof u.toJSON=="function")try{const d=u.toJSON();return Ft("",d,c-1,r,s)}catch(d){}const p=Array.isArray(e)?[]:{};let f=0;const h=Ds(e);for(const d in h){if(!Object.prototype.hasOwnProperty.call(h,d))continue;if(f>=r){p[d]="[MaxProperties ~]";break}const _=h[d];p[d]=Ft(d,_,c-1,r,s),f++}return o(e),p}function ki(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global!="undefined"&&e===global)return"[Global]";if(typeof window!="undefined"&&e===window)return"[Window]";if(typeof document!="undefined"&&e===document)return"[Document]";if(As(e))return Ts(e);if(Rs(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Es(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=Ri(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Ri(t){const e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function Ai(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function W(t,e=[]){return[t,e]}function Pi(t,e){const[n,r]=t;return[n,[...r,e]]}function $t(t,e){const n=t[1];for(const r of n){const s=r[0].type;if(e(r,s))return!0}return!1}function jt(t,e){return $t(t,(n,r)=>e.includes(r))}function Ut(t){const e=at(A);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Ni(t){const[e,n]=t;let r=JSON.stringify(e);function s(i){typeof r=="string"?r=typeof i=="string"?r+i:[Ut(r),i]:r.push(typeof i=="string"?Ut(i):i)}for(const i of n){const[o,a]=i;if(s(`
1
+ "use strict";var os=Object.defineProperty,as=Object.defineProperties;var cs=Object.getOwnPropertyDescriptors;var Te=Object.getOwnPropertySymbols;var hn=Object.prototype.hasOwnProperty,_n=Object.prototype.propertyIsEnumerable;var yt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),us=t=>{throw TypeError(t)};var dn=(t,e,n)=>e in t?os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l=(t,e)=>{for(var n in e||(e={}))hn.call(e,n)&&dn(t,n,e[n]);if(Te)for(var n of Te(e))_n.call(e,n)&&dn(t,n,e[n]);return t},E=(t,e)=>as(t,cs(e));var gn=(t,e)=>{var n={};for(var r in t)hn.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Te)for(var r of Te(t))e.indexOf(r)<0&&_n.call(t,r)&&(n[r]=t[r]);return n};var C=(t,e,n)=>new Promise((r,s)=>{var i=c=>{try{a(n.next(c))}catch(u){s(u)}},o=c=>{try{a(n.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,o);a((n=n.apply(t,e)).next())}),fs=function(t,e){this[0]=t,this[1]=e};var mn=t=>{var e=t[yt("asyncIterator")],n=!1,r,s={};return e==null?(e=t[yt("iterator")](),r=i=>s[i]=o=>e[i](o)):(e=e.call(t),r=i=>s[i]=o=>{if(n){if(n=!1,i==="throw")throw o;return o}return n=!0,{done:!1,value:new fs(new Promise(a=>{var c=e[i](o);c instanceof Object||us("Object expected"),a(c)}),1)}}),s[yt("iterator")]=()=>s,r("next"),"throw"in e?r("throw"):s.throw=i=>{throw i},"return"in e&&r("return"),s};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class oe{constructor(e){if(this._entries=[],typeof e=="string")this._parseString(e);else if(Array.isArray(e))for(const n of e)Array.isArray(n)&&n.length>=2&&this._entries.push([n[0]||"",n[1]||""]);else if(e&&typeof e=="object")if(e instanceof oe)this._entries=e._entries.map(([n,r])=>[n,r]);else for(const[n,r]of Object.entries(e))this._entries.push([n,r])}get size(){return this._entries.length}_parseString(e){if(e.startsWith("?")&&(e=e.slice(1)),!e)return;const n=e.split("&");for(const r of n){const s=r.indexOf("=");if(s===-1)r&&this._entries.push([decodeURIComponent(r),""]);else{const i=r.slice(0,s),o=r.slice(s+1);i&&this._entries.push([decodeURIComponent(i),decodeURIComponent(o)])}}}append(e,n){this._entries.push([e,String(n)])}delete(e){this._entries=this._entries.filter(([n])=>n!==e)}get(e){const n=this._entries.find(([r])=>r===e);return n?n[1]:null}getAll(e){return this._entries.filter(([n])=>n===e).map(([,n])=>n)}has(e){return this._entries.some(([n])=>n===e)}set(e,n){const r=String(n);let s=!1;if(this._entries=this._entries.filter(([i])=>i===e?s?!1:(s=!0,!0):!0),s){const i=this._entries.findIndex(([o])=>o===e);i!==-1&&(this._entries[i]=[e,r])}else this._entries.push([e,r])}sort(){this._entries.sort(([e],[n])=>e<n?-1:e>n?1:0)}toString(){return this._entries.map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&")}forEach(e){for(const[n,r]of this._entries)e(r,n,this)}*keys(){for(const[e]of this._entries)yield e}*values(){for(const[,e]of this._entries)yield e}*entries(){for(const e of this._entries)yield e}*[Symbol.iterator](){yield*mn(this.entries())}}function ls(){const t=Function("return this")();return t&&typeof t.wx!="undefined"&&t.wx?t.wx:t&&typeof t.my!="undefined"&&t.my?t.my:t&&typeof t.swan!="undefined"&&t.swan?t.swan:t&&typeof t.tt!="undefined"&&t.tt?t.tt:t&&typeof t.qq!="undefined"&&t.qq?t.qq:typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:t}function ps(){try{const t=ls();if(!t){console.warn("[sentry-miniapp] Unable to detect global object, polyfills may not work correctly");return}typeof t.URLSearchParams=="undefined"&&(t.URLSearchParams=oe);const e=Function("return this")();e&&typeof e.URLSearchParams=="undefined"&&(e.URLSearchParams=oe),typeof globalThis!="undefined"&&typeof globalThis.URLSearchParams=="undefined"&&(globalThis.URLSearchParams=oe)}catch(t){console.warn("[sentry-miniapp] Failed to install polyfills:",t)}}function ir(){ps()}ir();const m=typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__,A=globalThis,ae="10.51.0";function _e(){return ct(A),A}function ct(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ae,e[ae]=e[ae]||{}}function te(t,e,n=A){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[ae]=r[ae]||{};return s[t]||(s[t]=e())}const ds="Sentry Logger ",yn={};function ge(t){if(!("console"in A))return t();const e=A.console,n={},r=Object.keys(yn);r.forEach(s=>{const i=yn[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function hs(){Kt().enabled=!0}function _s(){Kt().enabled=!1}function or(){return Kt().enabled}function gs(...t){Vt("log",...t)}function ms(...t){Vt("warn",...t)}function ys(...t){Vt("error",...t)}function Vt(t,...e){m&&or()&&ge(()=>{A.console[t](`${ds}[${t}]:`,...e)})}function Kt(){return m?te("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const g={enable:hs,disable:_s,isEnabled:or,log:gs,warn:ms,error:ys},ar=50,ut="?",Sn=/\(error: (.*)\)/,bn=/captureMessage|captureException/;function Ss(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],o=n.split(`
2
+ `);for(let a=r;a<o.length;a++){let c=o[a];c.length>1024&&(c=c.slice(0,1024));const u=Sn.test(c)?c.replace(Sn,"$1"):c;if(!u.includes("Error: ")){for(const p of e){const f=p(u);if(f){i.push(f);break}}if(i.length>=ar+s)break}}return bs(i.slice(s))}}function bs(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Ie(e).function||"")&&e.pop(),e.reverse(),bn.test(Ie(e).function||"")&&(e.pop(),bn.test(Ie(e).function||"")&&e.pop()),e.slice(0,ar).map(n=>E(l({},n),{filename:n.filename||Ie(e).filename,function:n.function||ut}))}function Ie(t){return t[t.length-1]||{}}const St="<anonymous>";function Es(t){try{return!t||typeof t!="function"?St:t.name||St}catch(e){return St}}function Ts(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const cr=Object.prototype.toString;function ur(t){switch(cr.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ft(t,Error)}}function Gt(t,e){return cr.call(t)===`[object ${e}]`}function Ae(t){return Gt(t,"String")}function fr(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function lr(t){return t===null||fr(t)||typeof t!="object"&&typeof t!="function"}function Ne(t){return Gt(t,"Object")}function Is(t){return typeof Event!="undefined"&&ft(t,Event)}function ws(t){return typeof Element!="undefined"&&ft(t,Element)}function vs(t){return Gt(t,"RegExp")}function ne(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function Rs(t){return Ne(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function ft(t,e){try{return t instanceof e}catch(n){return!1}}function As(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}const Ns=A,Ps=80;function Cs(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,s=[];let i=0,o=0;const a=" > ",c=a.length;let u;const p=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||Ps;for(;n&&i++<r&&(u=xs(n,p),!(u==="html"||i>1&&o+s.length*c+u.length>=f));)s.push(u),o+=u.length,n=n.parentNode;return s.reverse().join(a)}catch(n){return"<unknown>"}}function xs(t,e){const n=t,r=[];if(!(n!=null&&n.tagName))return"";if(Ns.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=e!=null&&e.length?e.filter(i=>n.getAttribute(i)).map(i=>[i,n.getAttribute(i)]):null;if(s!=null&&s.length)s.forEach(i=>{r.push(`[${i[0]}="${i[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const i=n.className;if(i&&Ae(i)){const o=i.split(/\s+/);for(const a of o)r.push(`.${a}`)}}for(const i of["aria-label","type","name","title","alt"]){const o=n.getAttribute(i);o&&r.push(`[${i}="${o}"]`)}return r.join("")}function z(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch(r){m&&g.log(`Failed to add non-enumerable property "${String(e)}" to object`,t)}}function Os(t){if(ur(t))return l({message:t.message,name:t.name,stack:t.stack},Tn(t));if(Is(t)){const e=l({type:t.type,target:En(t.target),currentTarget:En(t.currentTarget)},Tn(t));return typeof CustomEvent!="undefined"&&ft(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function En(t){try{return ws(t)?Cs(t):Object.prototype.toString.call(t)}catch(e){return"<unknown>"}}function Tn(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}let Y;function lt(t){if(Y!==void 0)return Y?Y(t):t();const e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=A;return e in n&&typeof n[e]=="function"?(Y=n[e],Y(t)):(Y=null,t())}function Pe(){return lt(()=>Math.random())}function pt(){return lt(()=>Date.now())}function Ct(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function ve(t,e,n=!1){return Ae(t)?vs(e)?e.test(t):Ae(e)?n?t===e:t.includes(e):typeof e=="function"?e(t):!1:!1}function Ds(){const t=A;return t.crypto||t.msCrypto}let bt;function Ms(){return Pe()*16}function x(t=Ds()){try{if(t!=null&&t.randomUUID)return lt(()=>t.randomUUID()).replace(/-/g,"")}catch(e){}return bt||(bt="10000000100040008000"+1e11),bt.replace(/[018]/g,e=>(e^(Ms()&15)>>e/4).toString(16))}function Ls(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function Fs(t,e){const n=Ls(t);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism=l(l(l({},r),s),e),e&&"data"in e){const i=l(l({},s==null?void 0:s.data),e.data);n.mechanism.data=i}}function In(t){if($s(t))return!0;try{z(t,"__sentry_captured__",!0)}catch(e){}return!1}function $s(t){try{return t.__sentry_captured__}catch(e){}}const pr=1e3;function me(){return pt()/pr}function js(){const{performance:t}=A;if(!(t!=null&&t.now)||!t.timeOrigin)return me;const e=t.timeOrigin;return()=>(e+lt(()=>t.now()))/pr}let we;function fe(){return(we!=null?we:we=js())()}function dr(t){const e=fe(),n={sid:x(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Us(n)};return t&&q(n,t),n}function q(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||fe(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:x()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function hr(t,e){let n={};e?n={status:e}:t.status==="ok"&&(n={status:"exited"}),q(t,n)}function Us(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function ye(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r=l({},t);for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=ye(r[s],e[s],n-1));return r}function Ce(){return x()}function dt(){return x().substring(16)}const xt="_sentrySpan";function xe(t,e){e?z(t,xt,e):delete t[xt]}function Ot(t){return t[xt]}const Bs=100;class D{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ce(),sampleRand:Pe()}}clone(){const e=new D;return e._breadcrumbs=[...this._breadcrumbs],e._tags=l({},this._tags),e._attributes=l({},this._attributes),e._extra=l({},this._extra),e._contexts=l({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=l({},this._sdkProcessingMetadata),e._propagationContext=l({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,xe(e,Ot(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&q(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags=l(l({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes=l(l({},this._attributes),e),this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra=l(l({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,n){return this._extra=E(l({},this._extra),{[e]:n}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof D?n.getScopeData():Ne(n)?e:void 0,{tags:s,attributes:i,extra:o,user:a,contexts:c,level:u,fingerprint:p=[],propagationContext:f,conversationId:h}=r||{};return this._tags=l(l({},this._tags),s),this._attributes=l(l({},this._attributes),i),this._extra=l(l({},this._extra),o),this._contexts=l(l({},this._contexts),c),a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),p.length&&(this._fingerprint=p),f&&(this._propagationContext=f),h&&(this._conversationId=h),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,xe(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ce(),sampleRand:Pe()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var i;const r=typeof n=="number"?n:Bs;if(r<=0)return this;const s=E(l({timestamp:me()},e),{message:e.message?Ct(e.message,2048):e.message});return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(i=this._client)==null||i.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Ot(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ye(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=(n==null?void 0:n.event_id)||x();if(!this._client)return m&&g.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(e,E(l({originalException:e,syntheticException:s},n),{event_id:r}),this),r}captureMessage(e,n,r){var o;const s=(r==null?void 0:r.event_id)||x();if(!this._client)return m&&g.warn("No client configured on scope - will not capture message!"),s;const i=(o=r==null?void 0:r.syntheticException)!=null?o:new Error(e);return this._client.captureMessage(e,n,E(l({originalException:e,syntheticException:i},r),{event_id:s}),this),s}captureEvent(e,n){const r=e.event_id||(n==null?void 0:n.event_id)||x();return this._client?(this._client.captureEvent(e,E(l({},n),{event_id:r}),this),r):(m&&g.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Hs(){return te("defaultCurrentScope",()=>new D)}function zs(){return te("defaultIsolationScope",()=>new D)}const wn=t=>t instanceof Promise&&!t[_r],_r=Symbol("chained PromiseLike"),gr=(t,e,n)=>{const r=t.then(s=>(e(s),s),s=>{throw n(s),s});return wn(r)&&wn(t)?r:qs(t,r)},qs=(t,e)=>{let n=!1;for(const r in t){if(r in e)continue;n=!0;const s=t[r];typeof s=="function"?Object.defineProperty(e,r,{value:(...i)=>s.apply(t,i),enumerable:!0,configurable:!0,writable:!0}):e[r]=s}return n&&Object.assign(e,{[_r]:!0}),e};class Ws{constructor(e,n){let r;e?r=e:r=new D;let s;n?s=n:s=new D,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(s){throw this._popScope(),s}return ne(r)?gr(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Z(){const t=_e(),e=ct(t);return e.stack=e.stack||new Ws(Hs(),zs())}function Vs(t){return Z().withScope(t)}function Ks(t,e){const n=Z();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function vn(t){return Z().withScope(()=>t(Z().getIsolationScope()))}function Gs(){return{withIsolationScope:vn,withScope:Vs,withSetScope:Ks,withSetIsolationScope:(t,e)=>vn(e),getCurrentScope:()=>Z().getScope(),getIsolationScope:()=>Z().getIsolationScope()}}function ht(t){const e=ct(t);return e.acs?e.acs:Gs()}function y(){const t=_e();return ht(t).getCurrentScope()}function R(){const t=_e();return ht(t).getIsolationScope()}function Ys(){return te("globalScope",()=>new D)}function Se(...t){const e=_e(),n=ht(e);if(t.length===2){const[r,s]=t;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(t[0])}function v(){return y().getClient()}function Js(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=e,i={trace_id:n,span_id:s||dt()};return r&&(i.parent_span_id=r),i}const Oe="sentry.source",mr="sentry.sample_rate",Xs="sentry.previous_trace_sample_rate",De="sentry.op",Dt="sentry.origin",Zs="sentry.measurement_unit",Qs="sentry.measurement_value",kn="sentry.custom_span_name",Yt="sentry.profile_id",Jt="sentry.exclusive_time",yr=0,Sr=1,ei=2;function ti(t){try{const e=A.WeakRef;if(typeof e=="function")return new e(t)}catch(e){}return t}function ni(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch(e){return}return t}}const br="_sentryScope",Er="_sentryIsolationScope";function ri(t,e,n){t&&(z(t,Er,ti(n)),z(t,br,e))}function Me(t){const e=t;return{scope:e[br],isolationScope:ni(e[Er])}}const Rn="sentry-";function si(t){const e=ii(t);if(!e)return;const n=Object.entries(e).reduce((r,[s,i])=>{if(s.startsWith(Rn)){const o=s.slice(Rn.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function ii(t){if(!(!t||!Ae(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=An(n);return Object.entries(r).forEach(([s,i])=>{e[s]=i}),e},{}):An(t)}function An(t){return t.split(",").map(e=>{const n=e.indexOf("=");if(n===-1)return[];const r=e.slice(0,n),s=e.slice(n+1);return[r,s].map(i=>{try{return decodeURIComponent(i.trim())}catch(o){return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}const oi=/^o(\d+)\./,ai=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function ci(t){return t==="http"||t==="https"}function re(t,e=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function ui(t){const e=ai.exec(t);if(!e){ge(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,s="",i="",o="",a=""]=e.slice(1);let c="",u=a;const p=u.split("/");if(p.length>1&&(c=p.slice(0,-1).join("/"),u=p.pop()),u){const f=u.match(/^\d+/);f&&(u=f[0])}return Tr({host:i,pass:s,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function Tr(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function fi(t){if(!m)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(g.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?ci(r)?e&&isNaN(parseInt(e,10))?(g.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(g.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(g.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function li(t){const e=t.match(oi);return e==null?void 0:e[1]}function pi(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=li(n)),r}function di(t){const e=typeof t=="string"?ui(t):Tr(t);if(!(!e||!fi(e)))return e}function Xt(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const Ir=0,_t=1;let Nn=!1;function hi(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:s,parent_span_id:i,status:o,origin:a,links:c}=N(t);return{parent_span_id:i,span_id:e,trace_id:n,data:r,op:s,status:o,origin:a,links:c}}function _i(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),s=r?e:N(t).parent_span_id,i=Me(t).scope,o=r?(i==null?void 0:i.getPropagationContext().propagationSpanId)||dt():e;return{parent_span_id:s,span_id:o,trace_id:n}}function wr(t){if(t&&t.length>0)return t.map(o=>{var a=o,{context:c}=a,u=c,{spanId:e,traceId:n,traceFlags:r}=u,s=gn(u,["spanId","traceId","traceFlags"]),{attributes:i}=a;return l({span_id:e,trace_id:n,sampled:r===_t,attributes:i},s)})}function gi(t){if(t!=null&&t.length)return t.map(({context:{spanId:e,traceId:n,traceFlags:r},attributes:s})=>({span_id:e,trace_id:n,sampled:r===_t,attributes:s}))}function X(t){return typeof t=="number"?Pn(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Pn(t.getTime()):fe()}function Pn(t){return t>9999999999?t/1e3:t}function N(t){if(Si(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(yi(t)){const{attributes:r,startTime:s,name:i,endTime:o,status:a,links:c}=t;return{span_id:e,trace_id:n,data:r,description:i,parent_span_id:mi(t),start_timestamp:X(s),timestamp:X(o)||void 0,status:vr(a),op:r[De],origin:r[Dt],links:wr(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function mi(t){var e;return"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?(e=t.parentSpanContext)==null?void 0:e.spanId:void 0}function yi(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function Si(t){return typeof t.getSpanJSON=="function"}function be(t){const{traceFlags:e}=t.spanContext();return e===_t}function vr(t){if(!(!t||t.code===yr))return t.code===Sr?"ok":t.message||"internal_error"}function bi(t){return!t||t.code===Sr||t.code===yr||t.message==="cancelled"?"ok":"error"}const ce="_sentryChildSpans",Mt="_sentryRootSpan";function kr(t,e){const n=t[Mt]||t;z(e,Mt,n),t[ce]?t[ce].add(e):z(t,ce,new Set([e]))}function Ei(t){const e=new Set;function n(r){if(!e.has(r)&&be(r)){e.add(r);const s=r[ce]?Array.from(r[ce]):[];for(const i of s)n(i)}}return n(t),Array.from(e)}const F=Ti;function Ti(t){return t[Mt]||t}function Lt(){Nn||(ge(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Nn=!0)}function Zt(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=t||((n=v())==null?void 0:n.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function Cn(t){g.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Le(t,e){if(!(e!=null&&e.length))return!1;for(const n of e){if(vi(n)){if(t.description&&ve(t.description,n))return m&&Cn(t),!0;continue}const r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;const s=n.name?t.description&&ve(t.description,n.name):!0,i=n.op?t.op&&ve(t.op,n.op):!0,o=n.attributes?Object.entries(n.attributes).every(([a,c])=>{var u;return Ii((u=t.attributes)==null?void 0:u[a],c)}):!0;if(s&&i&&o)return m&&Cn(t),!0}return!1}function Ii(t,e){return typeof t=="string"&&(typeof e=="string"||e instanceof RegExp)?ve(t,e):Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((n,r)=>n===e[r]):t===e}function wi(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const s of t)s.parent_span_id===r&&(s.parent_span_id=n)}function vi(t){return typeof t=="string"||t instanceof RegExp}const Qt="production",Rr="_frozenDsc";function Et(t,e){z(t,Rr,e)}function Ar(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},s={environment:n.environment||Qt,release:n.release,public_key:r,trace_id:t,org_id:pi(e)};return e.emit("createDsc",s),s}function ki(t,e){const n=e.getPropagationContext();return n.dsc||Ar(n.traceId,t)}function le(t){var _,b,I,k,M;const e=v();if(!e)return{};const n=F(t),r=N(n),s=r.data,i=n.spanContext().traceState,o=(b=(_=i==null?void 0:i.get("sentry.sample_rate"))!=null?_:s[mr])!=null?b:s[Xs];function a($){return(typeof o=="number"||typeof o=="string")&&($.sample_rate=`${o}`),$}const c=n[Rr];if(c)return a(c);const u=i==null?void 0:i.get("sentry.dsc"),p=u&&si(u);if(p)return a(p);const f=Ar(t.spanContext().traceId,e),h=(I=s[Oe])!=null?I:s["sentry.span.source"],d=r.description;return h!=="url"&&d&&(f.transaction=d),Zt()&&(f.sampled=String(be(n)),f.sample_rand=(M=i==null?void 0:i.get("sentry.sample_rand"))!=null?M:(k=Me(n).scope)==null?void 0:k.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,n),f}class B{constructor(e={}){this._traceId=e.traceId||Ce(),this._spanId=e.spanId||dt(),this.dropReason=e.dropReason}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Ir}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}}function Nr(t){return!!t&&typeof t=="function"&&"_streamed"in t&&!!t._streamed}const Ri=Symbol.for("sentry.skipNormalization"),Ai=Symbol.for("sentry.overrideNormalizationDepth");function Ni(t){return!!t[Ri]}function Pi(t){const e=t[Ai];return typeof e=="number"?e:void 0}function U(t,e=100,n=1/0){try{return Ft("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Ft(t,e,n=1/0,r=1/0,s=Oi()){const[i,o]=s;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=Ci(t,e);if(!a.startsWith("[object "))return a;if(Ni(e))return e;const c=Pi(e),u=c!==void 0?c:n;if(u===0)return a.replace("object ","");if(i(e))return"[Circular ~]";const p=e;if(p&&typeof p.toJSON=="function")try{const _=p.toJSON();return Ft("",_,u-1,r,s)}catch(_){}const f=Array.isArray(e)?[]:{};let h=0;const d=Os(e);for(const _ in d){if(!Object.prototype.hasOwnProperty.call(d,_))continue;if(h>=r){f[_]="[MaxProperties ~]";break}const b=d[_];f[_]=Ft(_,b,u-1,r,s),h++}return o(e),f}function Ci(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global!="undefined"&&e===global)return"[Global]";if(typeof window!="undefined"&&e===window)return"[Window]";if(typeof document!="undefined"&&e===document)return"[Document]";if(As(e))return Ts(e);if(Rs(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Es(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=xi(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function xi(t){const e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function Oi(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function W(t,e=[]){return[t,e]}function Di(t,e){const[n,r]=t;return[n,[...r,e]]}function $t(t,e){const n=t[1];for(const r of n){const s=r[0].type;if(e(r,s))return!0}return!1}function jt(t,e){return $t(t,(n,r)=>e.includes(r))}function Ut(t){const e=ct(A);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Mi(t){const[e,n]=t;let r=JSON.stringify(e);function s(i){typeof r=="string"?r=typeof i=="string"?r+i:[Ut(r),i]:r.push(typeof i=="string"?Ut(i):i)}for(const i of n){const[o,a]=i;if(s(`
3
3
  ${JSON.stringify(o)}
4
- `),typeof a=="string"||a instanceof Uint8Array)s(a);else{let c;try{c=JSON.stringify(a)}catch(u){c=JSON.stringify(U(a))}s(c)}}return typeof r=="string"?r:Ci(r)}function Ci(t){const e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function xi(t){return[{type:"span"},t]}function Di(t){const e=typeof t.data=="string"?Ut(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const Nr={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function Oi(t){return t in Nr}function xn(t){return Oi(t)?Nr[t]:t}function Cr(t){if(!(t!=null&&t.sdk))return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Mi(t,e,n,r){var i;const s=(i=t.sdkProcessingMetadata)==null?void 0:i.dynamicSamplingContext;return l(l(l({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!n&&r&&{dsn:re(r)}),s&&{trace:s})}function Li(t,e){var r,s,i,o;if(!e)return t;const n=t.sdk||{};return t.sdk=E(l({},n),{name:n.name||e.name,version:n.version||e.version,integrations:[...((r=t.sdk)==null?void 0:r.integrations)||[],...e.integrations||[]],packages:[...((s=t.sdk)==null?void 0:s.packages)||[],...e.packages||[]],settings:(i=t.sdk)!=null&&i.settings||e.settings?l(l({},(o=t.sdk)==null?void 0:o.settings),e.settings):void 0}),t}function Fi(t,e,n,r){const s=Cr(n),i=l(l({sent_at:new Date().toISOString()},s&&{sdk:s}),!!r&&e&&{dsn:re(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return W(i,[o])}function $i(t,e,n,r){const s=Cr(n),i=t.type&&t.type!=="replay_event"?t.type:"event";Li(t,n==null?void 0:n.sdk);const o=Mi(t,s,r,e);return delete t.sdkProcessingMetadata,W(o,[[{type:i},t]])}function ji(t,e){function n(d){return!!d.trace_id&&!!d.public_key}const r=le(t[0]),s=e==null?void 0:e.getDsn(),i=e==null?void 0:e.getOptions().tunnel,o=l(l({sent_at:new Date().toISOString()},n(r)&&{trace:r}),!!i&&s&&{dsn:re(s)}),{beforeSendSpan:a,ignoreSpans:c}=(e==null?void 0:e.getOptions())||{},u=c!=null&&c.length?t.filter(d=>!Me(P(d),c)):t,p=t.length-u.length;p&&(e==null||e.recordDroppedEvent("before_send","span",p));const f=a?d=>{const _=P(d),b=Pr(a)?_:a(_);return b||(Lt(),_)}:P,h=[];for(const d of u){const _=f(d);_&&h.push(xi(_))}return W(o,h)}function Ui(t){if(!m)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=P(t),{spanId:s}=t.spanContext(),i=be(t),o=F(t),a=o===t,c=`[Tracing] Starting ${i?"sampled":"unsampled"} ${a?"root ":""}span`,u=[`op: ${n}`,`name: ${e}`,`ID: ${s}`];if(r&&u.push(`parent ID: ${r}`),!a){const{op:p,description:f}=P(o);u.push(`root ID: ${o.spanContext().spanId}`),p&&u.push(`root op: ${p}`),f&&u.push(`root description: ${f}`)}g.log(`${c}
4
+ `),typeof a=="string"||a instanceof Uint8Array)s(a);else{let c;try{c=JSON.stringify(a)}catch(u){c=JSON.stringify(U(a))}s(c)}}return typeof r=="string"?r:Li(r)}function Li(t){const e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function Fi(t){return[{type:"span"},t]}function $i(t){const e=typeof t.data=="string"?Ut(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const Pr={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function ji(t){return t in Pr}function xn(t){return ji(t)?Pr[t]:t}function Cr(t){if(!(t!=null&&t.sdk))return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Ui(t,e,n,r){var i;const s=(i=t.sdkProcessingMetadata)==null?void 0:i.dynamicSamplingContext;return l(l(l({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!n&&r&&{dsn:re(r)}),s&&{trace:s})}function Bi(t,e){var r,s,i,o;if(!e)return t;const n=t.sdk||{};return t.sdk=E(l({},n),{name:n.name||e.name,version:n.version||e.version,integrations:[...((r=t.sdk)==null?void 0:r.integrations)||[],...e.integrations||[]],packages:[...((s=t.sdk)==null?void 0:s.packages)||[],...e.packages||[]],settings:(i=t.sdk)!=null&&i.settings||e.settings?l(l({},(o=t.sdk)==null?void 0:o.settings),e.settings):void 0}),t}function Hi(t,e,n,r){const s=Cr(n),i=l(l({sent_at:new Date().toISOString()},s&&{sdk:s}),!!r&&e&&{dsn:re(e)}),o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return W(i,[o])}function zi(t,e,n,r){const s=Cr(n),i=t.type&&t.type!=="replay_event"?t.type:"event";Bi(t,n==null?void 0:n.sdk);const o=Ui(t,s,r,e);return delete t.sdkProcessingMetadata,W(o,[[{type:i},t]])}function qi(t,e){function n(d){return!!d.trace_id&&!!d.public_key}const r=le(t[0]),s=e==null?void 0:e.getDsn(),i=e==null?void 0:e.getOptions().tunnel,o=l(l({sent_at:new Date().toISOString()},n(r)&&{trace:r}),!!i&&s&&{dsn:re(s)}),{beforeSendSpan:a,ignoreSpans:c}=(e==null?void 0:e.getOptions())||{},u=c!=null&&c.length?t.filter(d=>{const _=N(d);return!Le({description:_.description,op:_.op,attributes:_.data},c)}):t,p=t.length-u.length;p&&(e==null||e.recordDroppedEvent("before_send","span",p));const f=a?d=>{const _=N(d),b=Nr(a)?_:a(_);return b||(Lt(),_)}:N,h=[];for(const d of u){const _=f(d);_&&h.push(Fi(_))}return W(o,h)}function Wi(t){if(!m)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=N(t),{spanId:s}=t.spanContext(),i=be(t),o=F(t),a=o===t,c=`[Tracing] Starting ${i?"sampled":"unsampled"} ${a?"root ":""}span`,u=[`op: ${n}`,`name: ${e}`,`ID: ${s}`];if(r&&u.push(`parent ID: ${r}`),!a){const{op:p,description:f}=N(o);u.push(`root ID: ${o.spanContext().spanId}`),p&&u.push(`root op: ${p}`),f&&u.push(`root description: ${f}`)}g.log(`${c}
5
5
  ${u.join(`
6
- `)}`)}function Bi(t){if(!m)return;const{description:e="< unknown name >",op:n="< unknown op >"}=P(t),{spanId:r}=t.spanContext(),i=F(t)===t,o=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${e}" with ID ${r}`;g.log(o)}function Dn(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const r=n.attributes||{},s=r[Zs],i=r[Qs];typeof s=="string"&&typeof i=="number"&&(e[n.name]={value:i,unit:s})}),e}function _t(t){return t.getOptions().traceLifecycle==="stream"}const On=1e3;class en{constructor(e={}){this._traceId=e.traceId||Ne(),this._spanId=e.spanId||pt(),this._startTime=e.startTimestamp||fe(),this._links=e.links,this._attributes={},this.setAttributes(l({[Ot]:"manual",[De]:e.op},e.attributes)),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?ht:Ir}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=X(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(xe,"custom"),this}end(e){this._endTime||(this._endTime=X(e),Bi(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[De],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:vr(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Ot],profile_id:this._attributes[Yt],exclusive_time:this._attributes[Jt],measurements:Dn(this._events),is_segment:this._isStandaloneSpan&&F(this)===this||void 0,segment_id:this._isStandaloneSpan?F(this).spanContext().spanId:void 0,links:wr(this._links)}}getStreamedSpanJSON(){var e,n;return{name:(e=this._name)!=null?e:"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:(n=this._endTime)!=null?n:this._startTime,is_segment:this._isStandaloneSpan||this===F(this),status:bi(this._status),attributes:this._attributes,links:gi(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){m&&g.log("[Tracing] Adding an event to span:",e);const s=Mn(n)?n:r||fe(),i=Mn(n)?{}:n||{},o={name:e,time:X(s),attributes:i};return this._events.push(o),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=v();if(e&&(e.emit("spanEnd",this),this._isStandaloneSpan||e.emit("afterSpanEnd",this)),!(this._isStandaloneSpan||this===F(this)))return;if(this._isStandaloneSpan){this._sampled?zi(ji([this],e)):(m&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}else if(e&&_t(e)){e.emit("afterSegmentSpanEnd",this);return}const r=this._convertSpanToTransaction();r&&(Oe(this).scope||y()).captureEvent(r)}_convertSpanToTransaction(){var p;if(!Ln(P(this)))return;this._name||(m&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=Oe(this),r=(p=e==null?void 0:e.getScopeData().sdkProcessingMetadata)==null?void 0:p.normalizedRequest;if(this._sampled!==!0)return;const i=Ei(this).filter(f=>f!==this&&!Hi(f)).map(f=>P(f)).filter(Ln),o=this._attributes[xe];delete this._attributes[kn],i.forEach(f=>{delete f.data[kn]});const a=l({contexts:{trace:hi(this)},spans:i.length>On?i.sort((f,h)=>f.start_timestamp-h.start_timestamp).slice(0,On):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:le(this)},request:r},o&&{transaction_info:{source:o}}),c=Dn(this._events);return c&&Object.keys(c).length&&(m&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}}function Mn(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function Ln(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function Hi(t){return t instanceof en&&t.isStandaloneSpan()}function zi(t){const e=v();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function qi(t,e,n=()=>{},r=()=>{}){let s;try{s=t()}catch(i){throw e(i),n(),i}return Wi(s,e,n,r)}function Wi(t,e,n,r){return ne(t)?gr(t,s=>{n(),r(s)},s=>{e(s),n()}):(n(),r(t),t)}function Vi(t,e,n){if(!Zt(t))return[!1];let r,s;typeof t.tracesSampler=="function"?(s=t.tracesSampler(E(l({},e),{inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a})),r=!0):e.parentSampled!==void 0?s=e.parentSampled:typeof t.tracesSampleRate!="undefined"&&(s=t.tracesSampleRate,r=!0);const i=Xt(s);if(i===void 0)return m&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(s)} of type ${JSON.stringify(typeof s)}.`),[!1];if(!i)return m&&g.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,i,r];const o=n<i;return o||m&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(s)})`),[o,i,r]}const Ki="__SENTRY_SUPPRESS_TRACING__";function ie(t,e){const n=tn();if(n.startSpan)return n.startSpan(t,e);const r=Or(t),{forceTransaction:s,parentSpan:i,scope:o}=t,a=o==null?void 0:o.clone();return Se(a,()=>Ji(i)(()=>{const u=y(),p=Mr(u,i),f=v(),h=t.onlyIfParent&&!p,d=h?new B:Dr({parentSpan:p,spanArguments:r,forceTransaction:s,scope:u});return h&&(f==null||f.recordDroppedEvent("no_parent_span","span")),(!Zi(d)||!p)&&Ce(u,d),qi(()=>e(d),()=>{const{status:_}=P(d);d.isRecording()&&(!_||_==="ok")&&d.setStatus({code:ei,message:"internal_error"})},()=>{d.end()})}))}function Gi(t){const e=tn();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=Or(t),{forceTransaction:r,parentSpan:s}=t;return(t.scope?o=>Se(t.scope,o):s!==void 0?o=>xr(s,o):o=>o())(()=>{const o=y(),a=Mr(o,s),c=v();return t.onlyIfParent&&!a?(c==null||c.recordDroppedEvent("no_parent_span","span"),new B):Dr({parentSpan:a,spanArguments:n,forceTransaction:r,scope:o})})}function xr(t,e){const n=tn();return n.withActiveSpan?n.withActiveSpan(t,e):Se(r=>(Ce(r,t||void 0),e(r)))}function Dr({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){var a;if(!Zt()){const c=new B;if(n||!t){const u=l({sampled:"false",sample_rate:"0",transaction:e.name},le(c));Et(c,u)}return c}const s=v();if(Xi(s,e))return nn(r)||s==null||s.recordDroppedEvent("ignored","span"),new B({dropReason:"ignored",traceId:(a=t==null?void 0:t.spanContext().traceId)!=null?a:r.getPropagationContext().traceId});const i=R();let o;if(t&&!n)o=Yi(t,r,e),kr(t,o);else if(t){const c=le(t),{traceId:u,spanId:p}=t.spanContext(),f=be(t);o=Fn(l({traceId:u,parentSpanId:p},e),r,f),Et(o,c)}else{const{traceId:c,dsc:u,parentSpanId:p,sampled:f}=l(l({},i.getPropagationContext()),r.getPropagationContext());o=Fn(l({traceId:c,parentSpanId:p},e),r,f),u&&Et(o,u)}return Ui(o),ri(o,r,i),o}function Or(t){const e=t.experimental||{},n=l({isStandalone:e.standalone},t);if(t.startTime){const r=l({},n);return r.startTimestamp=X(t.startTime),delete r.startTime,r}return n}function tn(){const t=_e();return dt(t)}function Fn(t,e,n){var b,I;const r=v(),s=(r==null?void 0:r.getOptions())||{},{name:i=""}=t,o={spanAttributes:l({},t.attributes),spanName:i,parentSampled:n};r==null||r.emit("beforeSampling",o,{decision:!1});const a=(b=o.parentSampled)!=null?b:n,c=o.spanAttributes,u=e.getPropagationContext(),p=nn(e),[f,h,d]=p?[!1]:Vi(s,{name:i,parentSampled:a,attributes:c,parentSampleRate:Xt((I=u.dsc)==null?void 0:I.sample_rate)},u.sampleRand),_=new en(E(l({},t),{attributes:l({[xe]:"custom",[mr]:h!==void 0&&d?h:void 0},c),sampled:f}));return!f&&r&&!p&&(m&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate",_t(r)?"span":"transaction")),r&&r.emit("spanStart",_),_}function Yi(t,e,n){const{spanId:r,traceId:s}=t.spanContext(),i=nn(e),o=i?!1:be(t),a=o?new en(E(l({},n),{parentSpanId:r,traceId:s,sampled:o})):new B({traceId:s});kr(t,a);const c=v();return c&&(_t(c)&&a instanceof B&&(t instanceof B&&t.dropReason?(a.dropReason=t.dropReason,c.recordDroppedEvent(t.dropReason,"span")):i||(a.dropReason="sample_rate",c.recordDroppedEvent("sample_rate","span"))),c.emit("spanStart",a),n.endTimestamp&&(c.emit("spanEnd",a),c.emit("afterSpanEnd",a))),a}function Mr(t,e){if(e)return e;if(e===null)return;const n=Dt(t);if(!n)return;const r=v();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?F(n):n}function Ji(t){return t!==void 0?e=>xr(t,e):e=>e()}function Xi(t,e){var r;const n=t==null?void 0:t.getOptions().ignoreSpans;return!t||!_t(t)||!(n!=null&&n.length)?!1:Me({description:e.name||"",op:((r=e.attributes)==null?void 0:r[De])||e.op},n)}function Zi(t){return t instanceof B&&t.dropReason==="ignored"}function nn(t){return t.getScopeData().sdkProcessingMetadata[Ki]===!0}function Qi(t,e){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=e;eo(t,e),r&&ro(t,r),so(t,n),to(t,s),no(t,i)}function $n(t,e){const{extra:n,tags:r,attributes:s,user:i,contexts:o,level:a,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:p,eventProcessors:f,attachments:h,propagationContext:d,transactionName:_,span:b}=e;se(t,"extra",n),se(t,"tags",r),se(t,"attributes",s),se(t,"user",i),se(t,"contexts",o),t.sdkProcessingMetadata=ye(t.sdkProcessingMetadata,c,2),a&&(t.level=a),_&&(t.transactionName=_),b&&(t.span=b),u.length&&(t.breadcrumbs=[...t.breadcrumbs,...u]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),f.length&&(t.eventProcessors=[...t.eventProcessors,...f]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=l(l({},t.propagationContext),d)}function se(t,e,n){t[e]=ye(t[e],n,1)}function Lr(t,e){const n=Ys().getScopeData();return t&&$n(n,t.getScopeData()),e&&$n(n,e.getScopeData()),n}function eo(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra=l(l({},n),t.extra)),Object.keys(r).length&&(t.tags=l(l({},r),t.tags)),Object.keys(s).length&&(t.user=l(l({},s),t.user)),Object.keys(i).length&&(t.contexts=l(l({},i),t.contexts)),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function to(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function no(t,e){t.sdkProcessingMetadata=l(l({},t.sdkProcessingMetadata),e)}function ro(t,e){t.contexts=l({trace:_i(e)},t.contexts),t.sdkProcessingMetadata=l({dynamicSamplingContext:le(e)},t.sdkProcessingMetadata);const n=F(e),r=P(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function so(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}const Tt=0,jn=1,Un=2;function rn(t){return new pe(e=>{e(t)})}function sn(t){return new pe((e,n)=>{n(t)})}class pe{constructor(e){this._state=Tt,this._handlers=[],this._runExecutor(e)}then(e,n){return new pe((r,s)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new pe((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,e&&e()},o=>{i=!0,s=o,e&&e()}).then(()=>{if(i){r(s);return}n(s)})})}_executeHandlers(){if(this._state===Tt)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===jn&&n[1](this._value),this._state===Un&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(i,o)=>{if(this._state===Tt){if(ne(o)){o.then(r,s);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(jn,i)},s=i=>{n(Un,i)};try{e(r,s)}catch(i){s(i)}}}function io(t,e,n,r=0){try{const s=Bt(e,n,t,r);return ne(s)?s:rn(s)}catch(s){return sn(s)}}function Bt(t,e,n,r){const s=n[r];if(!t||!s)return t;const i=s(l({},t),e);return m&&i===null&&g.log(`Event processor "${s.id||"?"}" dropped event`),ne(i)?i.then(o=>Bt(o,e,n,r+1)):Bt(i,e,n,r+1)}let L,Bn,Hn,j;function oo(t){const e=A._sentryDebugIds,n=A._debugIds;if(!e&&!n)return{};const r=e?Object.keys(e):[],s=n?Object.keys(n):[];if(j&&r.length===Bn&&s.length===Hn)return j;Bn=r.length,Hn=s.length,j={},L||(L={});const i=(o,a)=>{for(const c of o){const u=a[c],p=L==null?void 0:L[c];if(p&&j&&u)j[p[0]]=u,L&&(L[c]=[p[0],u]);else if(u){const f=t(c);for(let h=f.length-1;h>=0;h--){const d=f[h],_=d==null?void 0:d.filename;if(_&&j&&L){j[_]=u,L[c]=[_,u];break}}}}};return e&&i(r,e),n&&i(s,n),j}function ao(t,e,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,c=E(l({},e),{event_id:e.event_id||n.event_id||x(),timestamp:e.timestamp||me()}),u=n.integrations||t.integrations.map(k=>k.name);co(c,t),lo(c,u),s&&s.emit("applyFrameMetadata",e),e.type===void 0&&uo(c,t.stackParser);const p=ho(r,n.captureContext);n.mechanism&&Fs(c,n.mechanism);const f=s?s.getEventProcessors():[],h=Lr(i,p),d=[...n.attachments||[],...h.attachments];d.length&&(n.attachments=d),Qi(c,h);const _=[...f,...h.eventProcessors];return(n.data&&n.data.__sentry__===!0?rn(c):io(_,c,n)).then(k=>(k&&fo(k),typeof o=="number"&&o>0?po(k,o,a):k))}function co(t,e){var a,c;const{environment:n,release:r,dist:s,maxValueLength:i}=e;t.environment=t.environment||n||Qt,!t.release&&r&&(t.release=r),!t.dist&&s&&(t.dist=s);const o=t.request;o!=null&&o.url&&i&&(o.url=Ct(o.url,i)),i&&((c=(a=t.exception)==null?void 0:a.values)==null||c.forEach(u=>{u.value&&(u.value=Ct(u.value,i))}))}function uo(t,e){var r,s;const n=oo(e);(s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(c=>{c.filename&&(c.debug_id=n[c.filename])})})}function fo(t){var r,s;const e={};if((s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(c=>{c.debug_id&&(c.abs_path?e[c.abs_path]=c.debug_id:c.filename&&(e[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([i,o])=>{n.push({type:"sourcemap",code_file:i,debug_id:o})})}function lo(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function po(t,e,n){var s,i;if(!t)return null;const r=l(l(l(l(l({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>l(l({},o),o.data&&{data:U(o.data,e,n)}))}),t.user&&{user:U(t.user,e,n)}),t.contexts&&{contexts:U(t.contexts,e,n)}),t.extra&&{extra:U(t.extra,e,n)});return(s=t.contexts)!=null&&s.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=U(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>l(l({},o),o.data&&{data:U(o.data,e,n)}))),(i=t.contexts)!=null&&i.flags&&r.contexts&&(r.contexts.flags=U(t.contexts.flags,3,n)),r}function ho(t,e){if(!e)return t;const n=t?t.clone():new O;return n.update(e),n}function _o(t){if(t)return go(t)?{captureContext:t}:yo(t)?{captureContext:t}:t}function go(t){return t instanceof O||typeof t=="function"}const mo=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function yo(t){return Object.keys(t).some(e=>mo.includes(e))}function J(t,e){return y().captureException(t,_o(e))}function So(t,e){const n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return y().captureMessage(t,n,r)}function bo(t,e){return y().captureEvent(t,e)}function H(t,e){R().setContext(t,e)}function Eo(t){R().setExtras(t)}function To(t,e){R().setExtra(t,e)}function Io(t){R().setTags(t)}function wo(t,e){R().setTag(t,e)}function vo(t){R().setUser(t)}function ko(){return R().lastEventId()}function Ro(t){return C(this,null,function*(){const e=v();return e?e.flush(t):(m&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))})}function Ao(t){return C(this,null,function*(){const e=v();return e?e.close(t):(m&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))})}function Po(){const t=v();return(t==null?void 0:t.getOptions().enabled)!==!1&&!!(t!=null&&t.getTransport())}function No(t){R().addEventProcessor(t)}function Fr(t){const e=R(),{user:n}=Lr(e,y()),{userAgent:r}=A.navigator||{},s=dr(l(l({user:n},r&&{userAgent:r}),t)),i=e.getSession();return(i==null?void 0:i.status)==="ok"&&q(i,{status:"exited"}),gt(),e.setSession(s),s}function gt(){const t=R(),n=y().getSession()||t.getSession();n&&hr(n),$r(),t.setSession()}function $r(){const t=R(),e=v(),n=t.getSession();n&&e&&e.captureSession(n)}function Ht(t=!1){if(t){gt();return}$r()}const Co="7";function xo(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function Do(t){return`${xo(t)}${t.projectId}/envelope/`}function Oo(t,e){const n={sentry_version:Co};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function Mo(t,e,n){return e||`${Do(t)}?${Oo(t,n)}`}const zn=[];function Lo(t,e){const n={};return e.forEach(r=>{r!=null&&r.beforeSetup&&r.beforeSetup(t)}),e.forEach(r=>{r&&jr(t,r,n)}),n}function qn(t,e){for(const n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function jr(t,e,n){if(n[e.name]){m&&g.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!zn.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),zn.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(s,i)=>r(s,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),s=Object.assign((i,o)=>r(i,o,t),{id:e.name});t.addEventProcessor(s)}["processSpan","processSegmentSpan"].forEach(r=>{const s=e[r];typeof s=="function"&&t.on(r,i=>s.call(e,i,t))}),m&&g.log(`Integration installed: ${e.name}`)}function Fo(t){const e=v();if(!e){m&&g.warn(`Cannot add integration "${t.name}" because no SDK Client is available.`);return}e.addIntegration(t)}function $o(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function jo(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=re(r)),W(s,[$o(t)])}function Wn(t,e){var i;const n=(i=e!=null?e:Uo(t))!=null?i:[];if(n.length===0)return;const r=t.getOptions(),s=jo(n,r._metadata,r.tunnel,t.getDsn());Ur().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(s)}function Uo(t){return Ur().get(t)}function Ur(){return te("clientToLogBufferMap",()=>new WeakMap)}function Bo(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function Ho(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=re(r)),W(s,[Bo(t)])}function zo(t,e){var i;const n=(i=e!=null?e:qo(t))!=null?i:[];if(n.length===0)return;const r=t.getOptions(),s=Ho(n,r._metadata,r.tunnel,t.getDsn());Br().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(s)}function qo(t){return Br().get(t)}function Br(){return te("clientToMetricBufferMap",()=>new WeakMap)}function on(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}const an=Symbol.for("SentryBufferFullError");function Hr(t=100){const e=new Set;function n(){return e.size<t}function r(o){e.delete(o)}function s(o){if(!n())return sn(an);const a=o();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function i(o){if(!e.size)return rn(!0);const a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!o)return a;const c=[a,new Promise(u=>on(setTimeout(()=>u(!1),o)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:s,drain:i}}const Wo=60*1e3;function zr(t,e=lt()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?Wo:r-e}function Vo(t,e){return t[e]||t.all||0}function Ko(t,e,n=lt()){return Vo(t,e)>n}function Go(t,{statusCode:e,headers:n},r=lt()){const s=l({},t),i=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(i)for(const a of i.trim().split(",")){const[c,u,,,p]=a.split(":",5),f=parseInt(c,10),h=(isNaN(f)?60:f)*1e3;if(!u)s.all=r+h;else for(const d of u.split(";"))d==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(s[d]=r+h):s[d]=r+h}else o?s.all=r+zr(o,r):e===429&&(s.all=r+60*1e3);return s}const qr=64;function Yo(t,e,n=Hr(t.bufferSize||qr)){let r={};const s=o=>n.drain(o);function i(o){const a=[];if($t(o,(f,h)=>{const d=xn(h);Ko(r,d)?t.recordDroppedEvent("ratelimit_backoff",d):a.push(f)}),a.length===0)return Promise.resolve({});const c=W(o[0],a),u=f=>{if(jt(c,["client_report"])){m&&g.warn(`Dropping client report. Will not send outcomes (reason: ${f}).`);return}$t(c,(h,d)=>{t.recordDroppedEvent(f,xn(d))})},p=()=>e({body:Ni(c)}).then(f=>f.statusCode===413?(m&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),u("send_error"),f):(m&&f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&g.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),r=Go(r,f),f),f=>{throw u("network_error"),m&&g.error("Encountered error running transport request:",f),f});return n.add(p).then(f=>f,f=>{if(f===an)return m&&g.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw f})}return{send:i,flush:s}}function Jo(t,e,n){const r=[{type:"client_report"},{timestamp:me(),discarded_events:t}];return W(e?{dsn:e}:{},[r])}function Xo(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch(n){}return e}function Zo(t){var c,u,p;const{trace_id:e,parent_span_id:n,span_id:r,status:s,origin:i,data:o,op:a}=(u=(c=t.contexts)==null?void 0:c.trace)!=null?u:{};return{data:o!=null?o:{},description:t.transaction,op:a,parent_span_id:n,span_id:r!=null?r:"",start_timestamp:(p=t.start_timestamp)!=null?p:0,status:s,timestamp:t.timestamp,trace_id:e!=null?e:"",origin:i,profile_id:o==null?void 0:o[Yt],exclusive_time:o==null?void 0:o[Jt],measurements:t.measurements,is_segment:!0}}function Qo(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:l(l(l({},t.data),t.profile_id&&{[Yt]:t.profile_id}),t.exclusive_time&&{[Jt]:t.exclusive_time})}},measurements:t.measurements}}const Vn="Not capturing exception because it's already been captured.",Kn="Discarded session because of missing or non-string release",Wr=Symbol.for("SentryInternalError"),Vr=Symbol.for("SentryDoNotSendEventError"),ea=5e3;function ve(t){return{message:t,[Wr]:!0}}function It(t){return{message:t,[Vr]:!0}}function Gn(t){return!!t&&typeof t=="object"&&Wr in t}function Yn(t){return!!t&&typeof t=="object"&&Vr in t}function Jn(t,e,n,r,s){let i=0,o,a=!1;t.on(n,()=>{i=0,clearTimeout(o),a=!1}),t.on(e,c=>{i+=r(c),i>=8e5?s(t):a||(a=!0,o=on(setTimeout(()=>{s(t)},ea)))}),t.on("flush",()=>{s(t)})}class ta{constructor(e){var r,s,i,o,a,c,u;if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Hr((s=(r=e.transportOptions)==null?void 0:r.bufferSize)!=null?s:qr),e.dsn?this._dsn=di(e.dsn):m&&g.warn("No DSN provided, client will not send events."),this._dsn){const p=Mo(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(E(l({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:p}))}this._options.enableLogs=(o=this._options.enableLogs)!=null?o:(i=this._options._experiments)==null?void 0:i.enableLogs,this._options.enableLogs&&Jn(this,"afterCaptureLog","flushLogs",ia,Wn),((u=(c=this._options.enableMetrics)!=null?c:(a=this._options._experiments)==null?void 0:a.enableMetrics)!=null?u:!0)&&Jn(this,"afterCaptureMetric","flushMetrics",sa,zo)}captureException(e,n,r){const s=x();if(In(e))return m&&g.log(Vn),s;const i=l({event_id:s},n);return this._process(()=>this.eventFromException(e,i).then(o=>this._captureEvent(o,i,r)).then(o=>o),"error"),i.event_id}captureMessage(e,n,r,s){const i=l({event_id:x()},r),o=fr(e)?e:String(e),a=lr(e),c=a?this.eventFromMessage(o,n,i):this.eventFromException(e,i);return this._process(()=>c.then(u=>this._captureEvent(u,i,s)),a?"unknown":"error"),i.event_id}captureEvent(e,n,r){const s=x();if(n!=null&&n.originalException&&In(n.originalException))return m&&g.log(Vn),s;const i=l({event_id:s},n),o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,c=o.capturedSpanIsolationScope,u=Xn(e.type);return this._process(()=>this._captureEvent(e,i,a||r,c),u),i.event_id}captureSession(e){this.sendSession(e),q(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){return C(this,null,function*(){const n=this._transport;if(!n)return!0;this.emit("flush");const r=yield this._isClientDoneProcessing(e),s=yield n.flush(e);return r&&s})}close(e){return C(this,null,function*(){Wn(this);const n=yield this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n})}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];!n&&e.beforeSetup&&e.beforeSetup(this),jr(this,e,this._integrations),n||qn(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=$i(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=Pi(r,Di(s));this.sendEnvelope(r).then(s=>this.emit("afterSendEvent",e,s))}sendSession(e){const{release:n,environment:r=Qt}=this._options;if("aggregates"in e){const i=e.attrs||{};if(!i.release&&!n){m&&g.warn(Kn);return}i.release=i.release||n,i.environment=i.environment||r,e.attrs=i}else{if(!e.release&&!n){m&&g.warn(Kn);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const s=Fi(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(s)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const s=`${e}:${n}`;m&&g.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||new Set,s=(...i)=>n(...i);return r.add(s),()=>{r.delete(s)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(s=>s(...n))}sendEnvelope(e){return C(this,null,function*(){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return yield this._transport.send(e)}catch(n){return m&&g.error("Error while sending envelope:",n),{}}return m&&g.error("Transport disabled"),{}})}dispose(){}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=Lo(this,e),qn(this,e)}_updateSessionFromEvent(e,n){var c,u;let r=n.level==="fatal",s=!1;const i=(c=n.exception)==null?void 0:c.values;if(i){s=!0,r=!1;for(const p of i)if(((u=p.mechanism)==null?void 0:u.handled)===!1){r=!0;break}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(q(e,E(l({},r&&{status:"crashed"}),{errors:e.errors||Number(s||r)})),this.captureSession(e))}_isClientDoneProcessing(e){return C(this,null,function*(){let n=0;for(;!e||n<e;){if(yield new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,s){const i=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&(o!=null&&o.length)&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||s.setLastEventId(e.event_id||n.event_id),ao(i,e,n,r,this,s).then(a=>{var u;if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts=l({trace:l(l({},(u=a.contexts)==null?void 0:u.trace),Js(r))},a.contexts);const c=vi(this,r);return a.sdkProcessingMetadata=l({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,n={},r=y(),s=R()){return m&&zt(e)&&g.log(`Captured error event \`${Xo(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,s).then(i=>i.event_id,i=>{m&&(Yn(i)?g.log(i.message):Gn(i)?g.warn(i.message):g.warn(i))})}_processEvent(e,n,r,s){const i=this.getOptions(),{sampleRate:o}=i,a=Kr(e),c=zt(e),p=`before send for type \`${e.type||"error"}\``,f=typeof o=="undefined"?void 0:Xt(o);if(c&&typeof f=="number"&&Pe()>f)return this.recordDroppedEvent("sample_rate","error"),sn(It(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const h=Xn(e.type);return this._prepareEvent(e,n,r,s).then(d=>{var I;if(d===null)throw this.recordDroppedEvent("event_processor",h),It("An event processor returned `null`, will not send event.");if(((I=n.data)==null?void 0:I.__sentry__)===!0)return d;const b=ra(this,i,d,n);return na(b,p)}).then(d=>{var I;if(d===null){if(this.recordDroppedEvent("before_send",h),a){const M=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",M)}throw It(`${p} returned \`null\`, will not send event.`)}const _=r.getSession()||s.getSession();if(c&&_&&this._updateSessionFromEvent(_,d),a){const k=((I=d.sdkProcessingMetadata)==null?void 0:I.spanCountBeforeProcessing)||0,M=d.spans?d.spans.length:0,$=k-M;$>0&&this.recordDroppedEvent("before_send","span",$)}const b=d.transaction_info;if(a&&b&&d.transaction!==e.transaction){const k="custom";d.transaction_info=E(l({},b),{source:k})}return this.sendEvent(d,n),d}).then(null,d=>{throw Yn(d)||Gn(d)?d:(this.captureException(d,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:d}),ve(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
7
- Reason: ${d}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===an&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[s,i]=n.split(":");return{reason:s,category:i,quantity:r}})}_flushOutcomes(){m&&g.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){m&&g.log("No outcomes to send");return}if(!this._dsn){m&&g.log("No dsn provided, will not send outcomes");return}m&&g.log("Sending outcomes:",e);const n=Jo(e,this._options.tunnel&&re(this._dsn));this.sendEnvelope(n)}}function Xn(t){return t==="replay_event"?"replay":t||"error"}function na(t,e){const n=`${e} must return \`null\` or a valid event.`;if(ne(t))return t.then(r=>{if(!Ae(r)&&r!==null)throw ve(n);return r},r=>{throw ve(`${e} rejected with ${r}`)});if(!Ae(t)&&t!==null)throw ve(n);return t}function ra(t,e,n,r){const{beforeSend:s,beforeSendTransaction:i,ignoreSpans:o}=e,a=!Pr(e.beforeSendSpan)&&e.beforeSendSpan;let c=n;if(zt(c)&&s)return s(c,r);if(Kr(c)){if(a||o){const u=Zo(c);if(o!=null&&o.length&&Me(u,o))return null;if(a){const p=a(u);p?c=ye(n,Qo(p)):Lt()}if(c.spans){const p=[],f=c.spans;for(const d of f){if(o!=null&&o.length&&Me(d,o)){Ii(f,d);continue}if(a){const _=a(d);_?p.push(_):(Lt(),p.push(d))}else p.push(d)}const h=c.spans.length-p.length;h&&t.recordDroppedEvent("before_send","span",h),c.spans=p}}if(i){if(c.spans){const u=c.spans.length;c.sdkProcessingMetadata=E(l({},n.sdkProcessingMetadata),{spanCountBeforeProcessing:u})}return i(c,r)}}return c}function zt(t){return t.type===void 0}function Kr(t){return t.type==="transaction"}function sa(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+Gr(t.attributes)}function ia(t){let e=0;return t.message&&(e+=t.message.length*2),e+Gr(t.attributes)}function Gr(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*Zn(n[0]):lr(n)?e+=Zn(n):e+=100}),e}function Zn(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function oa(t,e){return t(e.stack||"",1)}function aa(t){return ur(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function ca(t){return aa(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function ua(t,e){const n={type:e.name||e.constructor.name,value:ca(e)},r=oa(t,e);return r.length&&(n.stacktrace={frames:r}),n}function fa(t,e){e.debug===!0&&(m?g.enable():ge(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),y().update(e.initialScope);const r=new t(e);return la(r),r.init(),r}function la(t){y().setClient(t)}const wt=100,vt=5e3,pa=36e5;function da(t){function e(...n){m&&g.log("[Offline]:",...n)}return n=>{const r=t(n);if(!n.createStore)throw new Error("No `createStore` function was provided");const s=n.createStore(n);let i=vt,o;function a(f,h,d){return jt(f,["client_report"])?!1:n.shouldStore?n.shouldStore(f,h,d):!0}function c(f){o&&clearTimeout(o),o=on(setTimeout(()=>C(null,null,function*(){o=void 0;const h=yield s.shift();h&&(e("Attempting to send previously queued event"),h[0].sent_at=new Date().toISOString(),p(h,!0).catch(d=>{e("Failed to retry sending",d)}))}),f))}function u(){o||(c(i),i=Math.min(i*2,pa))}function p(f,h=!1){return C(this,null,function*(){var d,_;if(!h&&jt(f,["replay_event","replay_recording"]))return yield s.push(f),c(wt),{};try{if(n.shouldSend&&(yield n.shouldSend(f))===!1)throw new Error("Envelope not sent because `shouldSend` callback returned false");const b=yield r.send(f);let I=wt;if(b){if((d=b.headers)!=null&&d["retry-after"])I=zr(b.headers["retry-after"]);else if((_=b.headers)!=null&&_["x-sentry-rate-limits"])I=6e4;else if((b.statusCode||0)>=400)return b}return c(I),i=vt,b}catch(b){if(yield a(f,b,i))return h?yield s.unshift(f):yield s.push(f),u(),e("Error sending. Event queued.",b),{};throw b}})}return n.flushAtStartup&&u(),{send:p,flush:f=>(f===void 0&&(i=vt,c(wt)),r.flush(f))}}}const ha=100;function N(t,e){const n=v(),r=R();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=ha}=n.getOptions();if(i<=0)return;const o=me(),a=l({timestamp:o},t),c=s?ge(()=>s(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,i))}const ke="1.8.1",Yr="sentry.javascript.miniapp",_a=/^\s*at\s+(?:(.+?)\s+\()?([^\s():]+):(\d+):(\d+)\)?$/,ga=/^\s*(?:([^@]*)@)?([^\s@:]+(?:\.[a-z]+)+):(\d+)(?::(\d+))?\s*$/,ma=/^\s*((?:pages|utils|components|subpackages|app-service|appservice)\/[^\s:]+):(\d+):(\d+)\s*$/;function Q(t){if(!t)return 0;const e=parseInt(t,10);return isNaN(e)?0:e}function ya(t){const e=_a.exec(t);if(!e)return;const[,n,r,s,i]=e,o={filename:r||"<anonymous>",function:n||ct,in_app:cn(r)},a=Q(s),c=Q(i);return a&&(o.lineno=a),c&&(o.colno=c),o}function Sa(t){const e=ga.exec(t);if(!e)return;const[,n,r,s,i]=e,o={filename:r||"<anonymous>",function:n||ct,in_app:cn(r)},a=Q(s),c=Q(i);return a&&(o.lineno=a),c&&(o.colno=c),o}function ba(t){const e=ma.exec(t);if(!e)return;const[,n,r,s]=e,i={filename:n||"<anonymous>",function:ct,in_app:cn(n)},o=Q(r),a=Q(s);return o&&(i.lineno=o),a&&(i.colno=a),i}function cn(t){return t?!(t.includes("sentry-miniapp")||t.includes("@sentry")||t.includes("WAService")||t.includes("WASubContext")||t.includes("aframeworkx")||t.includes("__dev__")):!0}const Jr=Ss([90,ya],[80,Sa],[70,ba]),Xr=()=>{let t={request:()=>{},httpRequest:()=>{},getSystemInfoSync:()=>({}),URLSearchParams:()=>{}};if(typeof wx=="object"&&wx!==null)t=wx;else if(typeof my=="object"&&my!==null)t=my;else if(typeof tt=="object"&&tt!==null)t=tt;else if(typeof dd=="object"&&dd!==null)t=dd;else if(typeof qq=="object"&&qq!==null)t=qq;else if(typeof swan=="object"&&swan!==null)t=swan;else if(typeof ks=="object"&&ks!==null)t=ks;else return console.warn("[sentry-miniapp] 未检测到已支持的小程序平台,SDK 将以降级模式运行"),t;if(typeof my=="object"&&my!==null&&t===my&&!t.request&&t.httpRequest&&(t.request=t.httpRequest),typeof my=="object"&&my!==null&&t===my||typeof dd=="object"&&dd!==null&&t===dd){if(t.getStorageSync){const e=t.getStorageSync;t.getStorageSync=n=>{const r=e.call(t,{key:n});return r?r.data:null}}if(t.setStorageSync){const e=t.setStorageSync;t.setStorageSync=(n,r)=>{e.call(t,{key:n,data:r})}}if(t.removeStorageSync){const e=t.removeStorageSync;t.removeStorageSync=n=>{e.call(t,{key:n})}}}return t},Zr=()=>{let t="unknown";return typeof wx=="object"&&wx!==null?t="wechat":typeof my=="object"&&my!==null?t="alipay":typeof tt=="object"&&tt!==null?t="bytedance":typeof dd=="object"&&dd!==null?t="dingtalk":typeof qq=="object"&&qq!==null?t="qq":typeof swan=="object"&&swan!==null?t="swan":typeof ks=="object"&&ks!==null&&(t="kuaishou"),t},ee=()=>{try{const t=Xr(),e={};let n=!1;if(t.getAppBaseInfo){const r=t.getAppBaseInfo();Object.assign(e,r),n=!0}if(t.getWindowInfo){const r=t.getWindowInfo();Object.assign(e,r),n=!0}if(t.getDeviceInfo){const r=t.getDeviceInfo();Object.assign(e,r),n=!0}if(t.getAppAuthorizeSetting){const r=t.getAppAuthorizeSetting();e.albumAuthorized=r.albumAuthorized==="authorized",e.cameraAuthorized=r.cameraAuthorized==="authorized",e.locationAuthorized=r.locationAuthorized==="authorized",e.microphoneAuthorized=r.microphoneAuthorized==="authorized",e.notificationAuthorized=r.notificationAuthorized==="authorized"}if(t.getSystemSetting){const r=t.getSystemSetting();Object.assign(e,r)}if(n)return e;if(t.getSystemInfoSync){const r=t.getSystemInfoSync();return!r.SDKVersion&&r.version&&(r.SDKVersion=r.version),r}return null}catch(t){return console.warn("[sentry-miniapp] Failed to get system info:",t),null}},Ea=()=>Zr()!=="unknown";let kt=null,Rt=null;const S=()=>(kt===null&&(kt=Xr()),kt),Qr=()=>(Rt===null&&(Rt=Zr()),Rt),es=()=>{try{const t=S();if(t.getPerformance&&typeof t.getPerformance=="function")return t.getPerformance()}catch(t){console.warn("Failed to get performance manager:",t)}return null};function ts(t){const e=t.url;function n(r){return new Promise((s,i)=>{var a,c,u,p;const o={url:e,method:"POST",data:r.body,header:l({"Content-Type":"application/json"},r.headers),headers:l({"Content-Type":"application/json"},r.headers),timeout:1e4,success:f=>{const h=f.statusCode||f.status,d=f.header||f.headers||{};s({statusCode:h,headers:{"x-sentry-rate-limits":d["x-sentry-rate-limits"],"retry-after":d["retry-after"]}})},fail:f=>{i(new Error(`Network request failed: ${f.errMsg||f.errorMessage||f.message||"Unknown error"}`))}};S().request?(c=(a=S()).request)==null||c.call(a,o):S().httpRequest?(p=(u=S()).httpRequest)==null||p.call(u,o):i(new Error("No request method available in current miniapp environment"))})}return Yo(t,n)}const Ta=30,Ia=864e5,ns="sentry_offline_store";function rs(t){const e=t.offlineCacheLimit||Ta,n=t.offlineCacheMaxAge||Ia;return{push:r=>C(null,null,function*(){try{let s=Pt();for(s=At(s,n),s.push({envelope:r,timestamp:Date.now()});s.length>e;){const i=s.findIndex(o=>!Qn(o.envelope));i>=0?s.splice(i,1):s.shift()}Nt(s)}catch(s){console.warn("[sentry-miniapp] Failed to push to offline store",s)}}),unshift:r=>C(null,null,function*(){try{let s=Pt();for(s=At(s,n),s.unshift({envelope:r,timestamp:Date.now()});s.length>e;){const i=wa(s,o=>!Qn(o.envelope));i>=0?s.splice(i,1):s.pop()}Nt(s)}catch(s){console.warn("[sentry-miniapp] Failed to unshift to offline store",s)}}),shift:()=>C(null,null,function*(){try{let r=Pt();if(r=At(r,n),r.length===0)return;const s=r.shift();return Nt(r),s==null?void 0:s.envelope}catch(r){console.warn("[sentry-miniapp] Failed to shift from offline store",r);return}})}}function Qn(t){try{return(t[1]||[]).some(n=>{var s;const r=(s=n[0])==null?void 0:s.type;return r==="event"||r==="error"})}catch(e){return!0}}function At(t,e){const n=Date.now();return t.filter(r=>n-r.timestamp<e)}function wa(t,e){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1}function Pt(){try{const t=S().getStorageSync;if(t){const e=t(ns);if(e){const n=typeof e=="string"?JSON.parse(e):e;if(Array.isArray(n)&&n.length>0)return n[0]&&"envelope"in n[0]&&"timestamp"in n[0]?n:n.map(r=>({envelope:r,timestamp:Date.now()}))}}}catch(t){}return[]}function Nt(t){try{const e=S().setStorageSync;e&&e(ns,JSON.stringify(t))}catch(e){}}const va=Object.freeze(Object.defineProperty({__proto__:null,createMiniappOfflineStore:rs,createMiniappTransport:ts},Symbol.toStringTag,{value:"Module"}));class ss extends ta{constructor(e={}){super(E(l({},e),{transport:e.transport||(n=>{const r=ts(E(l({},n),{headers:{}}));return e.enableOfflineCache!==!1?da(()=>r)(E(l({},n),{createStore:s=>rs(E(l({},s),{offlineCacheLimit:e.offlineCacheLimit})),flushAtStartup:!0})):r})}))}eventFromException(e){const n={type:e.name||"Error",value:e.message||String(e)};if(e.stack){const r=this.getOptions().stackParser;if(r&&typeof r=="function"){const s=r(e.stack,1);s.length&&(n.stacktrace={frames:s})}}return Promise.resolve({exception:{values:[n]},level:"error"})}eventFromMessage(e,n="info"){return Promise.resolve({message:e,level:n})}_prepareEvent(e,n,r){e.platform=e.platform||this.getOptions().platform||"javascript",e.sdk=E(l({},e.sdk),{name:Yr,packages:[...e.sdk&&e.sdk.packages||[],{name:"npm:@sentry/miniapp",version:ke}],version:ke}),e.contexts||(e.contexts={}),e.contexts.miniapp={platform:Qr(),sdk_version:ke};const s=ee();s?(e.contexts.device={brand:s.brand||"unknown",model:s.model||"unknown",screen_resolution:`${s.screenWidth||0}x${s.screenHeight||0}`,language:s.language||"unknown",version:s.version||"unknown",system:s.system||"unknown",platform:s.platform||"unknown"},e.contexts.os={name:s.system||"unknown",version:s.version||"unknown"},e.contexts.app={app_version:s.SDKVersion||"unknown"}):(e.contexts.device={brand:"unknown",model:"unknown",screen_resolution:"0x0",language:"unknown",version:"unknown",system:"unknown",platform:"unknown"},e.contexts.os={name:"unknown",version:"unknown"},e.contexts.app={app_version:"unknown"});try{const i=r||y(),o=R();return super._prepareEvent(e,n||{},i,o)}catch(i){return Promise.resolve(e)}}close(e){const n=this._integrations;if(n&&typeof n=="object")for(const r of Object.keys(n)){const s=n[r];if(s&&typeof s.cleanup=="function")try{s.cleanup()}catch(i){}}return super.close(e)}showReportDialog(e={}){console.warn("[sentry-miniapp] showReportDialog is deprecated and does nothing. Please build your own UI and use `Sentry.captureFeedback()` instead.")}captureFeedback(e){const n={contexts:{feedback:{contact_email:e.email,name:e.name,message:e.message,url:e.url,source:e.source,associated_event_id:e.associatedEventId}},type:"feedback",level:"info",tags:e.tags||{}};return y().captureEvent(n)}}const Ve=class Ve{constructor(e){this.name=Ve.id,this._onErrorHandlerInstalled=!1,this._onUnhandledRejectionHandlerInstalled=!1,this._onPageNotFoundHandlerInstalled=!1,this._onMemoryWarningHandlerInstalled=!1,this._errorHandler=null,this._rejectionHandler=null,this._pageNotFoundHandler=null,this._memoryWarningHandler=null,this._options=l({onerror:!0,onunhandledrejection:!0,onpagenotfound:!0,onmemorywarning:!0},e)}setupOnce(){Error.stackTraceLimit=50,this._options.onerror&&this._installGlobalOnErrorHandler(),this._options.onunhandledrejection&&this._installGlobalOnUnhandledRejectionHandler(),this._options.onpagenotfound&&this._installGlobalOnPageNotFoundHandler(),this._options.onmemorywarning&&this._installGlobalOnMemoryWarningHandler()}_installGlobalOnErrorHandler(){var e,n;this._onErrorHandlerInstalled||(S().onError&&(this._errorHandler=r=>{const s=typeof r=="string"?new Error(r):r;J(s,{mechanism:{type:"onerror",handled:!1}})},(n=(e=S()).onError)==null||n.call(e,this._errorHandler)),this._onErrorHandlerInstalled=!0)}_installGlobalOnUnhandledRejectionHandler(){var e,n;this._onUnhandledRejectionHandlerInstalled||(S().onUnhandledRejection&&(this._rejectionHandler=({reason:r,promise:s})=>{const i=typeof r=="string"?new Error(r):r;J(i,{mechanism:{type:"onunhandledrejection",handled:!1},data:{promise:s}})},(n=(e=S()).onUnhandledRejection)==null||n.call(e,this._rejectionHandler)),this._onUnhandledRejectionHandlerInstalled=!0)}_installGlobalOnPageNotFoundHandler(){var e,n;this._onPageNotFoundHandlerInstalled||(S().onPageNotFound&&(this._pageNotFoundHandler=r=>{const s=y(),i=r.path.split("?")[0];s.setTag("pagenotfound",i),s.setContext("page_not_found",{path:r.path,query:r.query,isEntryPage:r.isEntryPage}),J(new Error(`页面无法找到: ${i}`),{mechanism:{type:"onpagenotfound",handled:!0}})},(n=(e=S()).onPageNotFound)==null||n.call(e,this._pageNotFoundHandler)),this._onPageNotFoundHandlerInstalled=!0)}_installGlobalOnMemoryWarningHandler(){var e,n;this._onMemoryWarningHandlerInstalled||(S().onMemoryWarning&&(this._memoryWarningHandler=({level:r=-1})=>{let s="没有获取到告警级别信息";switch(r){case 5:s="TRIM_MEMORY_RUNNING_MODERATE";break;case 10:s="TRIM_MEMORY_RUNNING_LOW";break;case 15:s="TRIM_MEMORY_RUNNING_CRITICAL";break;default:return}const i=y();i.setTag("memory-warning",String(r)),i.setContext("memory_warning",{level:r,message:s}),J(new Error("内存不足告警"),{mechanism:{type:"onmemorywarning",handled:!0}})},(n=(e=S()).onMemoryWarning)==null||n.call(e,this._memoryWarningHandler)),this._onMemoryWarningHandlerInstalled=!0)}cleanup(){try{const e=S();this._errorHandler&&e.offError&&e.offError(this._errorHandler),this._rejectionHandler&&e.offUnhandledRejection&&e.offUnhandledRejection(this._rejectionHandler),this._pageNotFoundHandler&&e.offPageNotFound&&e.offPageNotFound(this._pageNotFoundHandler),this._memoryWarningHandler&&e.offMemoryWarning&&e.offMemoryWarning(this._memoryWarningHandler)}catch(e){}this._errorHandler=null,this._rejectionHandler=null,this._pageNotFoundHandler=null,this._memoryWarningHandler=null,this._onErrorHandlerInstalled=!1,this._onUnhandledRejectionHandlerInstalled=!1,this._onPageNotFoundHandlerInstalled=!1,this._onMemoryWarningHandlerInstalled=!1}};Ve.id="GlobalHandlers";let Le=Ve;function er(t,e={},n){if(typeof t!="function")return t;try{if(t.__sentry__)return t;if(t.__sentry_wrapped__)return t.__sentry_wrapped__}catch(s){return t}const r=function(...s){try{return t.apply(this,s)}catch(i){throw y().addEventProcessor(a=>{const c=l({},a);return e.mechanism&&(c.exception=c.exception||{},c.exception.mechanism=e.mechanism),c.extra=E(l({},c.extra),{arguments:s}),c}),J(i),i}};try{for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}catch(s){}t.prototype=t.prototype||{},r.prototype=t.prototype,Object.defineProperty(t,"__sentry_wrapped__",{enumerable:!1,value:r}),Object.defineProperties(r,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:t}});try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch(s){}return r}function tr(t){try{return t&&t.name||"<anonymous>"}catch(e){return"<anonymous>"}}function ue(t,e,n){if(!(e in t))return;const r=t[e],s=n(r);if(typeof s=="function")try{s.prototype=s.prototype||{},s.prototype.constructor=s}catch(i){}t[e]=s}const Ke=class Ke{constructor(){this.name=Ke.id}_wrapTimeFunction(e){return function(...n){const r=n[0];return n[0]=er(r,{mechanism:{data:{function:tr(e)},handled:!0,type:"instrument"}}),e.apply(this,n)}}_wrapRAF(e){return function(n){return e(er(n,{mechanism:{data:{function:"requestAnimationFrame",handler:tr(e)},handled:!0,type:"instrument"}}))}}setupOnce(){const e=globalThis;e.setTimeout&&ue(e,"setTimeout",this._wrapTimeFunction.bind(this)),e.setInterval&&ue(e,"setInterval",this._wrapTimeFunction.bind(this)),e.requestAnimationFrame&&ue(e,"requestAnimationFrame",this._wrapRAF.bind(this))}};Ke.id="TryCatch";let Fe=Ke;const ka="cause",Ra=5,Ge=class Ge{constructor(e={}){this.name=Ge.id,this._key=e.key||ka,this._limit=e.limit||Ra}setupOnce(){}processEvent(e,n){return y().getClient()?this._handler(e,n):e}_handler(e,n){if(!e.exception||!e.exception.values||!n||!nr(n.originalException,Error))return e;const r=this._walkErrorTree(n.originalException,this._key);return e.exception.values=[...r,...e.exception.values],e}_walkErrorTree(e,n,r=[]){if(!nr(e[n],Error)||r.length+1>=this._limit)return r;const s=ua(()=>[],e[n]);return this._walkErrorTree(e[n],n,[s,...r])}};Ge.id="LinkedErrors";let $e=Ge;function nr(t,e){try{return t instanceof e}catch(n){return!1}}const Ye=class Ye{constructor(){this.name=Ye.id}setupOnce(){}processEvent(e){const n=y(),r={runtime:{name:"miniapp",version:this._getMiniappVersion()},app:{name:this._getAppName(),version:this._getAppVersion()},device:this._getDeviceInfo(),network:this._getNetworkInfo()};return n.setContext("runtime",r.runtime),n.setContext("app",r.app),n.setContext("device",r.device),n.setContext("network",r.network),e}_getMiniappVersion(){const e=ee();return(e==null?void 0:e.version)||(e==null?void 0:e.SDKVersion)||"unknown"}_getAppName(){var e,n,r;try{if(S().getAccountInfoSync)return((r=((n=(e=S()).getAccountInfoSync)==null?void 0:n.call(e)).miniProgram)==null?void 0:r.appId)||"unknown"}catch(s){}return"unknown"}_getAppVersion(){var e,n,r;try{if(S().getAccountInfoSync){const s=(n=(e=S()).getAccountInfoSync)==null?void 0:n.call(e);return((r=s==null?void 0:s.miniProgram)==null?void 0:r.version)||"unknown"}}catch(s){}return"unknown"}_getDeviceInfo(){const e=ee();return e?{brand:e.brand,model:e.model,system:e.system,platform:e.platform,screenWidth:e.screenWidth,screenHeight:e.screenHeight,windowWidth:e.windowWidth,windowHeight:e.windowHeight,pixelRatio:e.pixelRatio,language:e.language}:{}}_getNetworkInfo(){try{S().getNetworkType&&S().getNetworkType({success:e=>{const n=y();n.setTag("network.type",e.networkType),n.setContext("network",{type:e.networkType})}})}catch(e){}return{}}};Ye.id="HttpContext";let je=Ye;const Je=class Je{constructor(e={}){this.name=Je.id,this._fuzzyMatch=!!e.fuzzyMatch}setupOnce(){}processEvent(e,n){if(e.type)return e;try{if(this._shouldDropEvent(e,this._previousEvent))return null}catch(r){return this._previousEvent=this._cloneEventForComparison(e),e}return this._previousEvent=this._cloneEventForComparison(e),e}_shouldDropEvent(e,n){return n?!!(this._isSameMessageEvent(e,n)||this._isSameExceptionEvent(e,n)):!1}_isSameMessageEvent(e,n){const r=e.message,s=n.message;return!(!r&&!s||r&&!s||!r&&s||r!==s||!this._isSameFingerprint(e,n)||!this._isSameStacktrace(e,n))}_isSameExceptionEvent(e,n){const r=this._getExceptionFromEvent(e),s=this._getExceptionFromEvent(n);if(!r||!s||r.type!==s.type)return!1;if(this._fuzzyMatch){if(!Aa(r.value,s.value))return!1}else if(r.value!==s.value)return!1;return!(!this._isSameFingerprint(e,n)||!this._isSameStacktrace(e,n))}_isSameStacktrace(e,n){let r=this._getFramesFromEvent(e),s=this._getFramesFromEvent(n);if(!r&&!s)return!0;if(r&&!s||!r&&s||(r=r,s=s,s.length!==r.length))return!1;for(let i=0;i<s.length;i++){const o=s[i],a=r[i];if(o.filename!==a.filename||o.lineno!==a.lineno||o.colno!==a.colno||o.function!==a.function)return!1}return!0}_isSameFingerprint(e,n){let r=e.fingerprint,s=n.fingerprint;if(!r&&!s)return!0;if(r&&!s||!r&&s)return!1;r=r,s=s;try{return r.join("")===s.join("")}catch(i){return!1}}_getExceptionFromEvent(e){return e.exception&&e.exception.values&&e.exception.values[0]}_cloneEventForComparison(e){var n;return{message:e.message,fingerprint:e.fingerprint?[...e.fingerprint]:void 0,exception:e.exception?{values:(n=e.exception.values)==null?void 0:n.map(r=>{var s;return{type:r.type,value:r.value,stacktrace:r.stacktrace?{frames:(s=r.stacktrace.frames)==null?void 0:s.map(i=>l({},i))}:void 0}})}:void 0}}_getFramesFromEvent(e){const n=e.exception;if(n)try{return n.values[0].stacktrace.frames}catch(r){}}};Je.id="Dedupe";let Ue=Je;const rr=/\d{10,}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/g;function Aa(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=t.replace(rr,"<dynamic>"),r=e.replace(rr,"<dynamic>");return n===r}const Xe=class Xe{constructor(){this.name=Xe.id}setupOnce(){this._addSystemContext(),this._addNetworkContext(),this._addLocationContext(),this._addStorageContext(),this._checkAppUpdate()}_addSystemContext(){var e,n,r,s;try{const i=ee();if(i){const o=y();o.setContext("device",{name:i.model,model:i.model,brand:i.brand,family:i.platform,arch:i.platform}),o.setContext("os",{name:((e=i.system)==null?void 0:e.split(" ")[0])||"unknown",version:((n=i.system)==null?void 0:n.split(" ")[1])||"unknown",kernel_version:i.version}),o.setContext("app",{app_name:i.appName||"unknown",app_version:i.version}),o.setContext("screen",{screen_width:i.screenWidth,screen_height:i.screenHeight,screen_density:i.pixelRatio}),o.setTag("device.model",i.model),o.setTag("device.brand",i.brand),o.setTag("os.name",((r=i.system)==null?void 0:r.split(" ")[0])||"unknown"),o.setTag("os.version",((s=i.system)==null?void 0:s.split(" ")[1])||"unknown"),o.setTag("app.version",i.version),o.setTag("language",i.language)}}catch(i){}}_addNetworkContext(){try{S().getNetworkType&&S().getNetworkType({success:e=>{const n=y();n.setContext("network",{type:e.networkType,connected:e.isConnected!==!1}),n.setTag("network.type",e.networkType)},fail:()=>{}})}catch(e){}}_addLocationContext(){try{S().getLocation&&S().getLocation({type:"gcj02",success:e=>{y().setContext("location",{latitude:e.latitude,longitude:e.longitude,accuracy:e.accuracy})},fail:()=>{}})}catch(e){}}_addStorageContext(){try{const e=S();if(e&&typeof e.getStorageInfoSync=="function"){const n=e.getStorageInfoSync();if(n){const r=n.currentSize||0,s=n.limitSize||0,i=s>0?Math.round(r/s*100):0;y().setContext("storage",{currentSize:r,limitSize:s,usagePercent:i}),i>=80&&N({category:"storage.warning",message:`存储使用率 ${i}%(${r}KB / ${s}KB)`,level:"warning",data:{currentSize:r,limitSize:s,usagePercent:i}})}}}catch(e){}}_checkAppUpdate(){try{const e=S();if(e&&typeof e.getUpdateManager=="function"){const n=e.getUpdateManager();n&&(typeof n.onCheckForUpdate=="function"&&n.onCheckForUpdate(r=>{r&&r.hasUpdate&&(y().setTag("has_update","true"),N({category:"app.update",message:"检测到新版本可用",level:"info",data:{hasUpdate:!0}}))}),typeof n.onUpdateReady=="function"&&n.onUpdateReady(()=>{N({category:"app.update",message:"新版本已下载完成",level:"info",data:{updateReady:!0}})}))}}catch(e){}}};Xe.id="System";let qt=Xe;const Ze=class Ze{constructor(){this.name=Ze.id,this._lastRoute="",this._monitorTimer=null}setupOnce(){this._instrumentNavigation(),this._startRouteMonitoring()}_instrumentNavigation(){let e;try{e=S()}catch(r){return}const n=["navigateTo","redirectTo","switchTab","reLaunch"];for(const r of n)if(e[r]){const s=e[r];e[r]=i=>(this._recordNavigation(r,i.url,this._getCurrentRoute()),s.call(e,i))}if(e.navigateBack){const r=e.navigateBack;e.navigateBack=(s={})=>(this._recordNavigation("navigateBack","back",this._getCurrentRoute(),s.delta),r.call(e,s))}}_startRouteMonitoring(){this._monitorTimer=setInterval(()=>{const e=this._getCurrentRoute();e&&e!==this._lastRoute&&(this._recordRouteChange(this._lastRoute,e),this._lastRoute=e)},1e3)}cleanup(){this._monitorTimer&&(clearInterval(this._monitorTimer),this._monitorTimer=null)}_getCurrentRoute(){try{const e=globalThis;if(e.getCurrentPages){const n=e.getCurrentPages();if(n&&n.length>0){const r=n[n.length-1];return r.route||r.__route__||""}}}catch(e){}return""}_recordNavigation(e,n,r,s){const i=y();N({category:"navigation",data:{action:e,from:r,to:n,delta:s},message:`Navigation ${e}: ${r} -> ${n}`,type:"navigation"}),i.setTag("route",n==="back"?r:n),i.setContext("navigation",{action:e,from:r,to:n,delta:s,timestamp:Date.now()})}_recordRouteChange(e,n){const r=y();N({category:"navigation",data:{from:e,to:n},message:`Route changed: ${e} -> ${n}`,type:"navigation"}),r.setTag("route",n),r.setContext("route",{current:n,previous:e,timestamp:Date.now()})}};Ze.id="Router";let Wt=Ze;const Qe=class Qe{constructor(e={}){this.name=Qe.id,this._performanceManager=null,this._observers=[],this._entryBuffer=[],this._reportTimer=null,this._options=E(l({enableNavigation:!0,enableRender:!0,enableResource:!0,enableUserTiming:!1,sampleRate:1,bufferSize:100,reportInterval:3e4,enableMemory:!1},e),{thresholds:l({navigation:3e3,render:1e3,resource:2e3,setData:50},e==null?void 0:e.thresholds)})}setupOnce(){this._initializePerformanceManager(),this._setupPerformanceObservers(),this._startAutoReporting(),this._addPerformanceContext()}_initializePerformanceManager(){try{if(this._performanceManager=es(),!this._performanceManager){console.warn("[sentry-miniapp] Performance API not available");return}const e=y();e.setTag("performance.api.available",!0),e.setContext("performance",{api_version:"miniapp-1.0",sample_rate:this._options.sampleRate,buffer_size:this._options.bufferSize})}catch(e){console.warn("[sentry-miniapp] Failed to initialize performance manager:",e)}}_setupPerformanceObservers(){if(this._performanceManager)try{const e=[];this._options.enableNavigation&&e.push("navigation"),this._options.enableRender&&e.push("render"),this._options.enableResource&&e.push("resource");let n=this._options.enableUserTiming;if(n)try{const i=ee();if(i&&i.platform==="devtools"&&(n=!1),n){const a=(typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{}).PerformanceObserver,c=a&&Array.isArray(a.supportedEntryTypes)?a.supportedEntryTypes:void 0;(!c||!c.includes("measure")||!c.includes("mark"))&&(n=!1)}}catch(i){n=!1}if(n&&e.push("measure","mark"),e.length===0)return;const r=this._performanceManager.createObserver(i=>{this._handlePerformanceEntries(i)});try{r.observe({entryTypes:e})}catch(i){const o=e.filter(a=>a!=="measure"&&a!=="mark");if(o.length<e.length&&o.length>0)r.observe({entryTypes:o}),console.warn("[sentry-miniapp] Failed to observe all types, falling back to:",o),e.length=0,e.push(...o);else throw i}this._observers.push(r);const s=typeof globalThis!="undefined"?globalThis.process:void 0;s&&s.env&&s.env.NODE_ENV!=="production"&&console.log("[sentry-miniapp] Performance observers setup for:",e)}catch(e){console.warn("[sentry-miniapp] Failed to setup performance observers:",e)}}_handlePerformanceEntries(e){if(!e)return;let n;if(Array.isArray(e))n=e;else if(typeof e=="object"&&e.getEntries)n=e.getEntries();else if(typeof e=="object")n=[e];else{console.warn("[sentry-miniapp] Invalid entries format:",typeof e);return}n.length!==0&&(Math.random()>this._options.sampleRate||n.forEach(r=>{try{this._processPerformanceEntry(r),this._addToBuffer(r)}catch(s){console.warn("[sentry-miniapp] Failed to process performance entry:",s)}}))}_processPerformanceEntry(e){switch(e.entryType){case"navigation":this._processNavigationEntry(e);break;case"render":this._processRenderEntry(e);break;case"resource":this._processResourceEntry(e);break;case"measure":case"mark":this._processUserTimingEntry(e);break;default:console.log("[sentry-miniapp] Unknown entry type:",e.entryType)}}_processNavigationEntry(e){y().addBreadcrumb({message:`页面导航: ${e.name}`,category:"performance.navigation",level:"info",data:{duration:e.duration,appLaunchTime:e.appLaunchTime,pageReadyTime:e.pageReadyTime}}),ie({name:`Navigation: ${e.name}`,op:"navigation",startTime:e.startTime/1e3},r=>{r.setAttributes({"navigation.name":e.name,"navigation.duration":e.duration,"navigation.app_launch_time":e.appLaunchTime||0,"navigation.page_ready_time":e.pageReadyTime||0,"navigation.first_render_time":e.firstRenderTime||0}),r.end((e.startTime+e.duration)/1e3)})}_processRenderEntry(e){var r,s;ie({name:`Render: ${e.name}`,op:"render",startTime:e.startTime/1e3},i=>{i.setAttributes({"render.name":e.name,"render.duration":e.duration,"render.start":e.renderStart||0,"render.end":e.renderEnd||0,"render.script_start":e.scriptStart||0,"render.script_end":e.scriptEnd||0}),i.end((e.startTime+e.duration)/1e3)});const n=(s=(r=this._options.thresholds)==null?void 0:r.setData)!=null?s:50;e.duration>n&&y().addBreadcrumb({message:`慢渲染检测: ${e.name} (${e.duration.toFixed(1)}ms)`,category:"performance.setData.slow",level:"warning",data:{name:e.name,duration:e.duration,threshold:n,renderStart:e.renderStart,renderEnd:e.renderEnd,scriptStart:e.scriptStart,scriptEnd:e.scriptEnd}})}_processResourceEntry(e){ie({name:`Resource: ${e.name}`,op:"resource",startTime:e.startTime/1e3},n=>{n.setAttributes({"resource.name":e.name,"resource.duration":e.duration,"resource.type":e.initiatorType||"unknown","resource.transfer_size":e.transferSize||0,"resource.encoded_size":e.encodedBodySize||0,"resource.decoded_size":e.decodedBodySize||0}),e.fetchStart&&e.responseEnd&&n.setAttributes({"resource.fetch_start":e.fetchStart,"resource.response_end":e.responseEnd,"resource.network_time":e.responseEnd-e.fetchStart}),n.end((e.startTime+e.duration)/1e3)})}_processUserTimingEntry(e){e.entryType==="measure"?ie({name:`Measure: ${e.name}`,op:"measure",startTime:e.startTime/1e3},n=>{n.setAttributes({"measure.name":e.name,"measure.duration":e.duration,"measure.detail":e.detail?JSON.stringify(e.detail):void 0}),n.end((e.startTime+e.duration)/1e3)}):e.entryType==="mark"&&y().addBreadcrumb({message:`性能标记: ${e.name}`,category:"performance.mark",level:"info",data:{timestamp:e.startTime,detail:e.detail}})}_addToBuffer(e){for(this._entryBuffer.push(e);this._entryBuffer.length>this._options.bufferSize;)this._entryBuffer.shift()}_startAutoReporting(){this._options.reportInterval<=0||(this._reportTimer=setInterval(()=>{this._reportBufferedEntries()},this._options.reportInterval))}_reportBufferedEntries(){if(this._entryBuffer.length!==0)try{const e=y(),n=this._calculatePerformanceStats(),r=this._collectMemoryInfo();r&&(n.memory=r),e.setContext("performance_summary",l({total_entries:this._entryBuffer.length,navigation_count:this._entryBuffer.filter(s=>s.entryType==="navigation").length,render_count:this._entryBuffer.filter(s=>s.entryType==="render").length,resource_count:this._entryBuffer.filter(s=>s.entryType==="resource").length,measure_count:this._entryBuffer.filter(s=>s.entryType==="measure").length,mark_count:this._entryBuffer.filter(s=>s.entryType==="mark").length,report_time:new Date().toISOString()},n)),this._checkPerformanceThresholds(n),this._reportToNativeAPI(),this._entryBuffer=[]}catch(e){console.warn("[sentry-miniapp] Failed to report buffered entries:",e)}}_calculatePerformanceStats(){const e=this._entryBuffer.filter(i=>i.entryType==="navigation"),n=this._entryBuffer.filter(i=>i.entryType==="render"),r=this._entryBuffer.filter(i=>i.entryType==="resource"),s={};if(e.length>0){const i=e.map(o=>o.duration);s.navigation_stats={avg_duration:i.reduce((o,a)=>o+a,0)/i.length,max_duration:Math.max(...i),min_duration:Math.min(...i)}}if(n.length>0){const i=n.map(a=>a.duration);s.render_stats={avg_duration:i.reduce((a,c)=>a+c,0)/i.length,max_duration:Math.max(...i),min_duration:Math.min(...i)};const o=n.filter(a=>{var c,u;return a.duration>((u=(c=this._options.thresholds)==null?void 0:c.setData)!=null?u:50)});s.render_stats.slow_render_count=o.length,s.render_stats.slow_render_ratio=o.length/n.length}if(r.length>0){const i=r.map(a=>a.duration),o=r.map(a=>a.transferSize||0).filter(a=>a>0);s.resource_stats={avg_load_time:i.reduce((a,c)=>a+c,0)/i.length,max_load_time:Math.max(...i),total_transfer_size:o.reduce((a,c)=>a+c,0),avg_transfer_size:o.length>0?o.reduce((a,c)=>a+c,0)/o.length:0}}return s}_checkPerformanceThresholds(e){var o,a,c,u,p,f,h,d,_;const n=y(),r=(a=(o=this._options.thresholds)==null?void 0:o.navigation)!=null?a:3e3;((c=e.navigation_stats)==null?void 0:c.avg_duration)>r&&n.addBreadcrumb({message:"页面导航性能较慢",category:"performance.warning",level:"warning",data:{avg_duration:e.navigation_stats.avg_duration,threshold:r}});const s=(p=(u=this._options.thresholds)==null?void 0:u.render)!=null?p:1e3;((f=e.render_stats)==null?void 0:f.avg_duration)>s&&n.addBreadcrumb({message:"页面渲染性能较慢",category:"performance.warning",level:"warning",data:{avg_duration:e.render_stats.avg_duration,threshold:s}});const i=(d=(h=this._options.thresholds)==null?void 0:h.resource)!=null?d:2e3;((_=e.resource_stats)==null?void 0:_.avg_load_time)>i&&n.addBreadcrumb({message:"资源加载性能较慢",category:"performance.warning",level:"warning",data:{avg_load_time:e.resource_stats.avg_load_time,threshold:i}})}_reportToNativeAPI(){try{const e=S();if(e.reportPerformance&&this._entryBuffer.length>0){const n={entries:this._entryBuffer.map(r=>({name:r.name,entryType:r.entryType,startTime:r.startTime,duration:r.duration})),timestamp:Date.now(),sampleRate:this._options.sampleRate};e.reportPerformance(n)}}catch(e){console.warn("[sentry-miniapp] Failed to report to native API:",e)}}_collectMemoryInfo(){if(!this._options.enableMemory)return null;try{const e=S();if(e.getPerformance){const n=e.getPerformance();if(n&&n.memory)return{jsHeapSizeUsed:n.memory.jsHeapSizeUsed,jsHeapSizeLimit:n.memory.jsHeapSizeLimit}}}catch(e){}return null}_addPerformanceContext(){try{const e=y(),n=S(),r=!!n.getPerformance,s=!!n.reportPerformance;e.setContext("performance_support",{has_performance_api:r,has_report_api:s,integration_enabled:!0,options:this._options}),e.setTag("performance.integration","enabled")}catch(e){console.warn("[sentry-miniapp] Failed to add performance context:",e)}}cleanup(){this._observers.forEach(e=>{try{e.disconnect()}catch(n){console.warn("[sentry-miniapp] Failed to disconnect observer:",n)}}),this._observers=[],this._reportTimer&&(clearInterval(this._reportTimer),this._reportTimer=null),this._reportBufferedEntries()}};Qe.id="PerformanceAPI";let Be=Qe;const un=t=>()=>new Be(t),et=class et{constructor(e={}){this.name=et.id,this._prefix=e.prefix||"app:///"}setupOnce(){}processEvent(e){return e.exception&&e.exception.values&&e.exception.values.forEach(n=>{n.stacktrace&&n.stacktrace.frames&&n.stacktrace.frames.forEach(r=>{r.filename&&(r.filename=this._normalizeFilename(r.filename))})}),e}_normalizeFilename(e){let n=e;return n=n.replace(/^(appservice|app-service|WAService)\//i,"").replace(/^https?:\/\/[^/]+\//i,"").replace(/^[a-z]+:\/\//i,"").replace(/^\//,""),n.startsWith(this._prefix)?n:`${this._prefix}${n}`}};et.id="RewriteFrames";let He=et;const nt=class nt{constructor(e={}){this.name=nt.id,this._originalRequest=null,this._originalHttpRequest=null,this._traceNetworkBody=!!e.traceNetworkBody,this._sensitiveKeys=(e.sensitiveKeys||["password","passwd","secret","token","access_token","refresh_token","authorization","cookie","session","creditcard","credit_card","card_number","cvv","ssn","id_card"]).map(n=>n.toLowerCase()),this._denyUrls=(e.denyBodyUrls||[]).map(n=>typeof n=="string"?new RegExp(n):n),this._enableTracePropagation=e.enableTracePropagation!==!1,this._tracePropagationTargets=e.tracePropagationTargets||[]}setupOnce(){const e=S();e&&typeof e.request=="function"&&(this._originalRequest=e.request,ue(e,"request",this._createRequestWrapper.bind(this))),e&&typeof e.httpRequest=="function"&&(this._originalHttpRequest=e.httpRequest,ue(e,"httpRequest",this._createRequestWrapper.bind(this)))}cleanup(){const e=S();e&&(this._originalRequest&&typeof e.request=="function"&&(e.request=this._originalRequest),this._originalHttpRequest&&typeof e.httpRequest=="function"&&(e.httpRequest=this._originalHttpRequest)),this._originalRequest=null,this._originalHttpRequest=null}_createRequestWrapper(e){const n=this._traceNetworkBody,r=this._sanitizeBody.bind(this),s=this._shouldDenyBodyUrl.bind(this),i=this._enableTracePropagation,o=this._shouldPropagateTrace.bind(this);return function(a){var k,M,$;if(!a||typeof a!="object")return e.call(this,a);const c=a.url||"",u=v();let p="";if(u){const w=u.getOptions().dsn;if(w)try{const T=w.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?([^:/\n]+)/i);T&&T[1]&&(p=T[1])}catch(T){}}if(typeof c=="string"){const w=c.match(/^https?:\/\/([^:/\n]+)/i),T=w&&w[1]?w[1]:"";if(p&&T===p||T==="sentry.io"||T.endsWith(".sentry.io"))return e.call(this,a)}if(i&&o(c))try{const T=y().getPropagationContext();if(T){const{traceId:D,parentSpanId:Ee}=T;if(D){const V=a.header||a.headers||{};V["sentry-trace"]=`${D}-${Ee||"0000000000000000"}-1`;const K=((k=u==null?void 0:u.getOptions())==null?void 0:k.dsn)||"",ln=((M=u==null?void 0:u.getOptions())==null?void 0:M.release)||"",pn=(($=u==null?void 0:u.getOptions())==null?void 0:$.environment)||"",G=[];D&&G.push(`sentry-trace_id=${D}`),K&&G.push(`sentry-public_key=${Pa(K)}`),ln&&G.push(`sentry-release=${ln}`),pn&&G.push(`sentry-environment=${pn}`),G.length>0&&(V.baggage=G.join(",")),a.header=V,a.headers=V}}}catch(w){}const f=(a.method||"GET").toUpperCase(),h=a.data,d=Date.now(),_={url:c,method:f};if(n&&h&&!s(c))try{const w=typeof h=="string"?h:JSON.stringify(h);_.request_body=r(w),_.request_size=w.length}catch(w){_.request_body="[Cannot serialize request body]"}const b=a.success,I=a.fail;return a.success=function(...w){const T=w[0]||{},D=T.statusCode||T.status,Ee=Date.now()-d;if(_.status_code=D,_.duration=Ee,n&&T.data&&!s(c))try{const K=typeof T.data=="string"?T.data:JSON.stringify(T.data);_.response_body=r(K),_.response_size=K.length}catch(K){_.response_body="[Cannot serialize response body]"}const V=D>=400||Ee>3e3?"warning":"info";if(N({type:"http",category:"xhr",data:_,level:V}),typeof b=="function")return b.apply(this,w)},a.fail=function(...w){const T=w[0]||{},D=Date.now()-d;if(_.error=T.errMsg||T.errorMessage||"Network request failed",_.duration=D,N({type:"http",category:"xhr",data:_,level:"error"}),typeof I=="function")return I.apply(this,w)},e.call(this,a)}}_shouldPropagateTrace(e){return this._tracePropagationTargets.length===0?!0:this._tracePropagationTargets.some(n=>typeof n=="string"?e.includes(n):n.test(e))}_shouldDenyBodyUrl(e){return this._denyUrls.some(n=>n.test(e))}_sanitizeBody(e){if(this._sensitiveKeys.length===0)return e;try{const n=JSON.parse(e);if(typeof n=="object"&&n!==null)return this._sanitizeObject(n),JSON.stringify(n)}catch(n){for(const r of this._sensitiveKeys){const s=new RegExp(`(${r})=[^&]*`,"gi");e=e.replace(s,"$1=[Filtered]")}}return e}_sanitizeObject(e){for(const n of Object.keys(e))this._sensitiveKeys.includes(n.toLowerCase())?e[n]="[Filtered]":typeof e[n]=="object"&&e[n]!==null&&this._sanitizeObject(e[n])}};nt.id="NetworkBreadcrumbs";let ze=nt;function Pa(t){try{const e=t.match(/^https?:\/\/([^@]+)@/);return e?e[1]:""}catch(e){return""}}const is=["onLoad","onShow","onHide","onUnload","onReady"],Na=["onLaunch","onShow","onHide"];function Ca(t){return is.includes(t)||t.startsWith("_")?!1:/^(on|handle|bind)[A-Z]/.test(t)||/[Tt]ap$/.test(t)||/[Cc]lick$/.test(t)||/[Cc]hange$/.test(t)||/[Ss]ubmit$/.test(t)||/[Ss]croll$/.test(t)||/[Ii]nput$/.test(t)}const rt=class rt{constructor(e={}){this.name=rt.id,this._originalPage=null,this._originalApp=null,this._launchTime=0,this._firstPageReady=!1,this._options=l({enableLifecycle:!0,enableUserInteraction:!0},e)}setupOnce(){this._wrapPage(),this._wrapApp()}_wrapPage(){const e=globalThis;if(typeof e.Page!="function")return;this._originalPage=e.Page;const n=e.Page,r=this._options,s=()=>this._firstPageReady,i=a=>{this._firstPageReady=a},o=()=>this._launchTime;e.Page=function(a){if(a&&typeof a=="object"){if(r.enableLifecycle){for(const c of is)if(typeof a[c]=="function"){const u=a[c];a[c]=function(...p){const f=(this==null?void 0:this.route)||(this==null?void 0:this.__route__)||"unknown",h={action:c,page:f};if(c==="onLoad"&&p[0]&&typeof p[0]=="object"&&(h.query=p[0]),c==="onReady"&&!s()&&o()>0){i(!0);const d=Date.now()-o();h.coldStartDuration=d,H("startup",{coldStartDuration:d,firstPage:f})}return N({category:"page.lifecycle",message:`${c}: ${f}`,level:"info",data:h}),u.apply(this,p)}}}if(r.enableUserInteraction){for(const c of Object.keys(a))if(typeof a[c]=="function"&&Ca(c)){const u=a[c];a[c]=function(p,...f){const h=(this==null?void 0:this.route)||(this==null?void 0:this.__route__)||"unknown",d={handler:c,page:h};if(p&&typeof p=="object"&&(p.target&&(p.target.id&&(d.targetId=p.target.id),p.target.dataset&&(d.dataset=p.target.dataset)),p.type&&(d.eventType=p.type),p.detail&&(typeof p.detail.x=="number"&&(d.x=p.detail.x),typeof p.detail.y=="number"&&(d.y=p.detail.y)),p.touches&&p.touches.length>0)){const _=p.touches[0];_&&(d.touchX=_.pageX,d.touchY=_.pageY)}return N({category:"user.interaction",message:`${c} on ${h}`,level:"info",data:d}),u.apply(this,[p,...f])}}}}return n(a)}}_wrapApp(){const e=globalThis;if(typeof e.App!="function")return;this._originalApp=e.App;const n=e.App,r=this._options,s=i=>{this._launchTime=i};e.App=function(i){if(i&&typeof i=="object"&&r.enableLifecycle){for(const o of Na)if(typeof i[o]=="function"){const a=i[o];i[o]=function(...c){return o==="onLaunch"&&s(Date.now()),N({category:"app.lifecycle",message:`App.${o}`,level:"info",data:{action:o}}),a.apply(this,c)}}}return n(i)}}cleanup(){const e=globalThis;this._originalPage&&(e.Page=this._originalPage,this._originalPage=null),this._originalApp&&(e.App=this._originalApp,this._originalApp=null)}};rt.id="PageBreadcrumbs";let de=rt;const xa=t=>new de(t),Da=["debug","info","warn","error","log"],Oa={debug:"debug",info:"info",log:"info",warn:"warning",error:"error"},st=class st{constructor(e={}){this.name=st.id,this._originalMethods={},this._levels=e.levels||[...Da]}setupOnce(){for(const e of this._levels){if(typeof console[e]!="function")continue;const n=console[e];this._originalMethods[e]=n,console[e]=function(...r){return N({category:"console",level:Oa[e],message:r.map(s=>{if(typeof s=="string")return s;try{return JSON.stringify(s)}catch(i){return String(s)}}).join(" ")}),n.apply(console,r)}}}cleanup(){for(const e of this._levels){const n=this._originalMethods[e];n&&(console[e]=n)}this._originalMethods={}}};st.id="ConsoleBreadcrumbs";let he=st;const Ma=t=>new he(t),it=class it{constructor(){this.name=it.id,this._originalApp=null,this._isSessionActive=!1}setupOnce(){this._wrapApp()}_wrapApp(){const e=sr();if(!e||typeof e.App!="function")return;this._originalApp=e.App;const n=this._startSession.bind(this),r=this._endSession.bind(this),s=this._markSessionCrashed.bind(this),i=()=>this._isSessionActive,o=this._originalApp;e.App=function(a={}){const c=a.onLaunch,u=a.onShow,p=a.onHide,f=a.onError;return a.onLaunch=function(...h){if(n(),typeof c=="function")return c.apply(this,h)},a.onShow=function(...h){if(i()||n(),typeof u=="function")return u.apply(this,h)},a.onHide=function(...h){if(r(),typeof p=="function")return p.apply(this,h)},a.onError=function(...h){if(s(),typeof f=="function")return f.apply(this,h)},o.call(this,a)}}_startSession(){try{Fr({ignoreDuration:!0}),Ht(),this._isSessionActive=!0}catch(e){}}_endSession(){try{gt(),Ht(),this._isSessionActive=!1}catch(e){}}_markSessionCrashed(){try{const n=y().getSession();n&&(n.status="crashed")}catch(e){}}cleanup(){const e=sr();e&&this._originalApp&&(e.App=this._originalApp),this._originalApp=null,this._isSessionActive=!1}};it.id="Session";let qe=it;function sr(){if(typeof wx!="undefined")return wx;if(typeof my!="undefined")return my;if(typeof tt!="undefined")return tt;if(typeof dd!="undefined")return dd;if(typeof qq!="undefined")return qq;if(typeof swan!="undefined")return swan;if(typeof globalThis!="undefined")return globalThis}const ot=class ot{constructor(){this.name=ot.id,this._statusChangeHandler=null}setupOnce(){const e=S();if(e){if(typeof e.getNetworkType=="function")try{e.getNetworkType({success:n=>{const r=n.networkType||"unknown";H("network",{type:r,isConnected:r!=="none"})}})}catch(n){}typeof e.onNetworkStatusChange=="function"&&(this._statusChangeHandler=n=>{const r=n.networkType||"unknown",s=n.isConnected!==void 0?n.isConnected:r!=="none";H("network",{type:r,isConnected:s}),N({category:"network.change",message:`网络状态变化: ${r}`,level:s?"info":"warning",data:{networkType:r,isConnected:s}})},e.onNetworkStatusChange(this._statusChangeHandler))}}cleanup(){if(this._statusChangeHandler){const e=S();if(e&&typeof e.offNetworkStatusChange=="function")try{e.offNetworkStatusChange(this._statusChangeHandler)}catch(n){}this._statusChangeHandler=null}}};ot.id="NetworkStatus";let We=ot;const La=Object.freeze(Object.defineProperty({__proto__:null,ConsoleBreadcrumbs:he,Dedupe:Ue,GlobalHandlers:Le,HttpContext:je,LinkedErrors:$e,NetworkBreadcrumbs:ze,NetworkStatusIntegration:We,PageBreadcrumbs:de,PerformanceIntegration:Be,RewriteFrames:He,Router:Wt,SessionIntegration:qe,System:qt,TryCatch:Fe,consoleBreadcrumbsIntegration:Ma,pageBreadcrumbsIntegration:xa,performanceIntegration:un},Symbol.toStringTag,{value:"Module"})),fn=[new je,new Ue,new Le,new Fe,new $e,un({enableNavigation:!0,enableRender:!0,enableResource:!0,enableUserTiming:!0,sampleRate:1,reportInterval:3e4})];function Fa(){return[...fn]}function $a(t={}){if(!Ea()){console.warn("[sentry-miniapp] Not running in a supported miniapp environment");return}const e=E(l({},t),{integrations:t.integrations||fn,stackParser:Jr,transport:t.transport});e.enableSourceMap!==!1&&e.integrations.push(new He);const n={traceNetworkBody:e.traceNetworkBody};e.enableTracePropagation!==void 0&&(n.enableTracePropagation=e.enableTracePropagation),e.tracePropagationTargets!==void 0&&(n.tracePropagationTargets=e.tracePropagationTargets),e.integrations.push(new ze(n)),e.enableAutoSessionTracking!==!1&&e.integrations.push(new qe),e.enableUserInteractionBreadcrumbs!==!1&&e.integrations.push(new de),e.enableNetworkStatusMonitoring!==!1&&e.integrations.push(new We),e.enableConsoleBreadcrumbs&&e.integrations.push(new he),H("miniapp",{platform:Qr,environment:"miniapp"});const r=ee();return r&&(H("device",{brand:r.brand,model:r.model,language:r.language,system:r.system,platform:r.platform,screen_resolution:`${r.screenWidth}x${r.screenHeight}`}),H("app",{sdk_version:r.SDKVersion,version:r.version})),fa(ss,e),y().getClient()}function ja(t={}){console.warn("[sentry-miniapp] showReportDialog is deprecated and does nothing. Please build your own UI and use `Sentry.captureFeedback()` instead.")}function Ua(t){return function(...e){return Se(()=>{try{return t.apply(this,e)}catch(n){throw y().captureException(n),n}})}}function Ba(t){const e=y().getClient();return e?e.captureFeedback(t):(console.warn("[sentry-miniapp] No client available for captureFeedback"),"")}ir();exports.Integrations=La;exports.MiniappClient=ss;exports.SDK_NAME=Yr;exports.SDK_VERSION=ke;exports.Transports=va;exports.addBreadcrumb=N;exports.addEventProcessor=No;exports.addIntegration=Fo;exports.captureEvent=bo;exports.captureException=J;exports.captureFeedback=Ba;exports.captureMessage=So;exports.captureSession=Ht;exports.close=Ao;exports.closeSession=hr;exports.defaultIntegrations=fn;exports.endSession=gt;exports.flush=Ro;exports.getClient=v;exports.getCurrentScope=y;exports.getDefaultIntegrations=Fa;exports.getIsolationScope=R;exports.getPerformanceManager=es;exports.init=$a;exports.isEnabled=Po;exports.lastEventId=ko;exports.makeSession=dr;exports.miniappStackParser=Jr;exports.performanceIntegration=un;exports.setContext=H;exports.setExtra=To;exports.setExtras=Eo;exports.setTag=wo;exports.setTags=Io;exports.setUser=vo;exports.showReportDialog=ja;exports.startInactiveSpan=Gi;exports.startSession=Fr;exports.startSpan=ie;exports.updateSession=q;exports.withScope=Se;exports.wrap=Ua;
6
+ `)}`)}function Vi(t){if(!m)return;const{description:e="< unknown name >",op:n="< unknown op >"}=N(t),{spanId:r}=t.spanContext(),i=F(t)===t,o=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${e}" with ID ${r}`;g.log(o)}function On(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const r=n.attributes||{},s=r[Zs],i=r[Qs];typeof s=="string"&&typeof i=="number"&&(e[n.name]={value:i,unit:s})}),e}function gt(t){return t.getOptions().traceLifecycle==="stream"}const Dn=1e3;class en{constructor(e={}){this._traceId=e.traceId||Ce(),this._spanId=e.spanId||dt(),this._startTime=e.startTimestamp||fe(),this._links=e.links,this._attributes={},this.setAttributes(l({[Dt]:"manual",[De]:e.op},e.attributes)),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?_t:Ir}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=X(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(Oe,"custom"),this}end(e){this._endTime||(this._endTime=X(e),Vi(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[De],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:vr(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Dt],profile_id:this._attributes[Yt],exclusive_time:this._attributes[Jt],measurements:On(this._events),is_segment:this._isStandaloneSpan&&F(this)===this||void 0,segment_id:this._isStandaloneSpan?F(this).spanContext().spanId:void 0,links:wr(this._links)}}getStreamedSpanJSON(){var e,n;return{name:(e=this._name)!=null?e:"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:(n=this._endTime)!=null?n:this._startTime,is_segment:this._isStandaloneSpan||this===F(this),status:bi(this._status),attributes:this._attributes,links:gi(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){m&&g.log("[Tracing] Adding an event to span:",e);const s=Mn(n)?n:r||fe(),i=Mn(n)?{}:n||{},o={name:e,time:X(s),attributes:i};return this._events.push(o),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=v();if(e&&(e.emit("spanEnd",this),this._isStandaloneSpan||e.emit("afterSpanEnd",this)),!(this._isStandaloneSpan||this===F(this)))return;if(this._isStandaloneSpan){this._sampled?Gi(qi([this],e)):(m&&g.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}else if(e&&gt(e)){e.emit("afterSegmentSpanEnd",this);return}const r=this._convertSpanToTransaction();r&&(Me(this).scope||y()).captureEvent(r)}_convertSpanToTransaction(){var p;if(!Ln(N(this)))return;this._name||(m&&g.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=Me(this),r=(p=e==null?void 0:e.getScopeData().sdkProcessingMetadata)==null?void 0:p.normalizedRequest;if(this._sampled!==!0)return;const i=Ei(this).filter(f=>f!==this&&!Ki(f)).map(f=>N(f)).filter(Ln),o=this._attributes[Oe];delete this._attributes[kn],i.forEach(f=>{delete f.data[kn]});const a=l({contexts:{trace:hi(this)},spans:i.length>Dn?i.sort((f,h)=>f.start_timestamp-h.start_timestamp).slice(0,Dn):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:le(this)},request:r},o&&{transaction_info:{source:o}}),c=On(this._events);return c&&Object.keys(c).length&&(m&&g.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}}function Mn(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function Ln(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function Ki(t){return t instanceof en&&t.isStandaloneSpan()}function Gi(t){const e=v();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}function Yi(t,e,n=()=>{},r=()=>{}){let s;try{s=t()}catch(i){throw e(i),n(),i}return Ji(s,e,n,r)}function Ji(t,e,n,r){return ne(t)?gr(t,s=>{n(),r(s)},s=>{e(s),n()}):(n(),r(t),t)}function Xi(t,e,n){if(!Zt(t))return[!1];let r,s;typeof t.tracesSampler=="function"?(s=t.tracesSampler(E(l({},e),{inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a})),r=!0):e.parentSampled!==void 0?s=e.parentSampled:typeof t.tracesSampleRate!="undefined"&&(s=t.tracesSampleRate,r=!0);const i=Xt(s);if(i===void 0)return m&&g.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(s)} of type ${JSON.stringify(typeof s)}.`),[!1];if(!i)return m&&g.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,i,r];const o=n<i;return o||m&&g.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(s)})`),[o,i,r]}const Zi="__SENTRY_SUPPRESS_TRACING__";function ie(t,e){const n=tn();if(n.startSpan)return n.startSpan(t,e);const r=Dr(t),{forceTransaction:s,parentSpan:i,scope:o}=t,a=o==null?void 0:o.clone();return Se(a,()=>to(i)(()=>{const u=y(),p=Mr(u,i),f=v(),h=t.onlyIfParent&&!p,d=h?new B:Or({parentSpan:p,spanArguments:r,forceTransaction:s,scope:u});return h&&(f==null||f.recordDroppedEvent("no_parent_span","span")),(!ro(d)||!p)&&xe(u,d),Yi(()=>e(d),()=>{const{status:_}=N(d);d.isRecording()&&(!_||_==="ok")&&d.setStatus({code:ei,message:"internal_error"})},()=>{d.end()})}))}function Qi(t){const e=tn();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=Dr(t),{forceTransaction:r,parentSpan:s}=t;return(t.scope?o=>Se(t.scope,o):s!==void 0?o=>xr(s,o):o=>o())(()=>{const o=y(),a=Mr(o,s),c=v();return t.onlyIfParent&&!a?(c==null||c.recordDroppedEvent("no_parent_span","span"),new B):Or({parentSpan:a,spanArguments:n,forceTransaction:r,scope:o})})}function xr(t,e){const n=tn();return n.withActiveSpan?n.withActiveSpan(t,e):Se(r=>(xe(r,t||void 0),e(r)))}function Or({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){var a;if(!Zt()){const c=new B;if(n||!t){const u=l({sampled:"false",sample_rate:"0",transaction:e.name},le(c));Et(c,u)}return c}const s=v();if(no(s,e))return nn(r)||s==null||s.recordDroppedEvent("ignored","span"),new B({dropReason:"ignored",traceId:(a=t==null?void 0:t.spanContext().traceId)!=null?a:r.getPropagationContext().traceId});const i=R();let o;if(t&&!n)o=eo(t,r,e),kr(t,o);else if(t){const c=le(t),{traceId:u,spanId:p}=t.spanContext(),f=be(t);o=Fn(l({traceId:u,parentSpanId:p},e),r,f),Et(o,c)}else{const{traceId:c,dsc:u,parentSpanId:p,sampled:f}=l(l({},i.getPropagationContext()),r.getPropagationContext());o=Fn(l({traceId:c,parentSpanId:p},e),r,f),u&&Et(o,u)}return Wi(o),ri(o,r,i),o}function Dr(t){const e=t.experimental||{},n=l({isStandalone:e.standalone},t);if(t.startTime){const r=l({},n);return r.startTimestamp=X(t.startTime),delete r.startTime,r}return n}function tn(){const t=_e();return ht(t)}function Fn(t,e,n){var b,I;const r=v(),s=(r==null?void 0:r.getOptions())||{},{name:i=""}=t,o={spanAttributes:l({},t.attributes),spanName:i,parentSampled:n};r==null||r.emit("beforeSampling",o,{decision:!1});const a=(b=o.parentSampled)!=null?b:n,c=o.spanAttributes,u=e.getPropagationContext(),p=nn(e),[f,h,d]=p?[!1]:Xi(s,{name:i,parentSampled:a,attributes:c,parentSampleRate:Xt((I=u.dsc)==null?void 0:I.sample_rate)},u.sampleRand),_=new en(E(l({},t),{attributes:l({[Oe]:"custom",[mr]:h!==void 0&&d?h:void 0},c),sampled:f}));return!f&&r&&!p&&(m&&g.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate",gt(r)?"span":"transaction")),r&&r.emit("spanStart",_),_}function eo(t,e,n){const{spanId:r,traceId:s}=t.spanContext(),i=nn(e),o=i?!1:be(t),a=o?new en(E(l({},n),{parentSpanId:r,traceId:s,sampled:o})):new B({traceId:s});kr(t,a);const c=v();return c&&(gt(c)&&a instanceof B&&(t instanceof B&&t.dropReason?(a.dropReason=t.dropReason,c.recordDroppedEvent(t.dropReason,"span")):i||(a.dropReason="sample_rate",c.recordDroppedEvent("sample_rate","span"))),c.emit("spanStart",a),n.endTimestamp&&(c.emit("spanEnd",a),c.emit("afterSpanEnd",a))),a}function Mr(t,e){if(e)return e;if(e===null)return;const n=Ot(t);if(!n)return;const r=v();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?F(n):n}function to(t){return t!==void 0?e=>xr(t,e):e=>e()}function no(t,e){var r;const n=t==null?void 0:t.getOptions().ignoreSpans;return!t||!gt(t)||!(n!=null&&n.length)?!1:Le({description:e.name||"",op:((r=e.attributes)==null?void 0:r[De])||e.op,attributes:e.attributes},n)}function ro(t){return t instanceof B&&t.dropReason==="ignored"}function nn(t){return t.getScopeData().sdkProcessingMetadata[Zi]===!0}function so(t,e){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=e;io(t,e),r&&co(t,r),uo(t,n),oo(t,s),ao(t,i)}function $n(t,e){const{extra:n,tags:r,attributes:s,user:i,contexts:o,level:a,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:p,eventProcessors:f,attachments:h,propagationContext:d,transactionName:_,span:b}=e;se(t,"extra",n),se(t,"tags",r),se(t,"attributes",s),se(t,"user",i),se(t,"contexts",o),t.sdkProcessingMetadata=ye(t.sdkProcessingMetadata,c,2),a&&(t.level=a),_&&(t.transactionName=_),b&&(t.span=b),u.length&&(t.breadcrumbs=[...t.breadcrumbs,...u]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),f.length&&(t.eventProcessors=[...t.eventProcessors,...f]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext=l(l({},t.propagationContext),d)}function se(t,e,n){t[e]=ye(t[e],n,1)}function Lr(t,e){const n=Ys().getScopeData();return t&&$n(n,t.getScopeData()),e&&$n(n,e.getScopeData()),n}function io(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra=l(l({},n),t.extra)),Object.keys(r).length&&(t.tags=l(l({},r),t.tags)),Object.keys(s).length&&(t.user=l(l({},s),t.user)),Object.keys(i).length&&(t.contexts=l(l({},i),t.contexts)),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function oo(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function ao(t,e){t.sdkProcessingMetadata=l(l({},t.sdkProcessingMetadata),e)}function co(t,e){t.contexts=l({trace:_i(e)},t.contexts),t.sdkProcessingMetadata=l({dynamicSamplingContext:le(e)},t.sdkProcessingMetadata);const n=F(e),r=N(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function uo(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}const Tt=0,jn=1,Un=2;function rn(t){return new pe(e=>{e(t)})}function sn(t){return new pe((e,n)=>{n(t)})}class pe{constructor(e){this._state=Tt,this._handlers=[],this._runExecutor(e)}then(e,n){return new pe((r,s)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new pe((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,e&&e()},o=>{i=!0,s=o,e&&e()}).then(()=>{if(i){r(s);return}n(s)})})}_executeHandlers(){if(this._state===Tt)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===jn&&n[1](this._value),this._state===Un&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(i,o)=>{if(this._state===Tt){if(ne(o)){o.then(r,s);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(jn,i)},s=i=>{n(Un,i)};try{e(r,s)}catch(i){s(i)}}}function fo(t,e,n,r=0){try{const s=Bt(e,n,t,r);return ne(s)?s:rn(s)}catch(s){return sn(s)}}function Bt(t,e,n,r){const s=n[r];if(!t||!s)return t;const i=s(l({},t),e);return m&&i===null&&g.log(`Event processor "${s.id||"?"}" dropped event`),ne(i)?i.then(o=>Bt(o,e,n,r+1)):Bt(i,e,n,r+1)}let L,Bn,Hn,j;function lo(t){const e=A._sentryDebugIds,n=A._debugIds;if(!e&&!n)return{};const r=e?Object.keys(e):[],s=n?Object.keys(n):[];if(j&&r.length===Bn&&s.length===Hn)return j;Bn=r.length,Hn=s.length,j={},L||(L={});const i=(o,a)=>{for(const c of o){const u=a[c],p=L==null?void 0:L[c];if(p&&j&&u)j[p[0]]=u,L&&(L[c]=[p[0],u]);else if(u){const f=t(c);for(let h=f.length-1;h>=0;h--){const d=f[h],_=d==null?void 0:d.filename;if(_&&j&&L){j[_]=u,L[c]=[_,u];break}}}}};return e&&i(r,e),n&&i(s,n),j}function po(t,e,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,c=E(l({},e),{event_id:e.event_id||n.event_id||x(),timestamp:e.timestamp||me()}),u=n.integrations||t.integrations.map(k=>k.name);ho(c,t),mo(c,u),s&&s.emit("applyFrameMetadata",e),e.type===void 0&&_o(c,t.stackParser);const p=So(r,n.captureContext);n.mechanism&&Fs(c,n.mechanism);const f=s?s.getEventProcessors():[],h=Lr(i,p),d=[...n.attachments||[],...h.attachments];d.length&&(n.attachments=d),so(c,h);const _=[...f,...h.eventProcessors];return(n.data&&n.data.__sentry__===!0?rn(c):fo(_,c,n)).then(k=>(k&&go(k),typeof o=="number"&&o>0?yo(k,o,a):k))}function ho(t,e){var a,c;const{environment:n,release:r,dist:s,maxValueLength:i}=e;t.environment=t.environment||n||Qt,!t.release&&r&&(t.release=r),!t.dist&&s&&(t.dist=s);const o=t.request;o!=null&&o.url&&i&&(o.url=Ct(o.url,i)),i&&((c=(a=t.exception)==null?void 0:a.values)==null||c.forEach(u=>{u.value&&(u.value=Ct(u.value,i))}))}function _o(t,e){var r,s;const n=lo(e);(s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(c=>{c.filename&&(c.debug_id=n[c.filename])})})}function go(t){var r,s;const e={};if((s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(c=>{c.debug_id&&(c.abs_path?e[c.abs_path]=c.debug_id:c.filename&&(e[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([i,o])=>{n.push({type:"sourcemap",code_file:i,debug_id:o})})}function mo(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function yo(t,e,n){var s,i;if(!t)return null;const r=l(l(l(l(l({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>l(l({},o),o.data&&{data:U(o.data,e,n)}))}),t.user&&{user:U(t.user,e,n)}),t.contexts&&{contexts:U(t.contexts,e,n)}),t.extra&&{extra:U(t.extra,e,n)});return(s=t.contexts)!=null&&s.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=U(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>l(l({},o),o.data&&{data:U(o.data,e,n)}))),(i=t.contexts)!=null&&i.flags&&r.contexts&&(r.contexts.flags=U(t.contexts.flags,3,n)),r}function So(t,e){if(!e)return t;const n=t?t.clone():new D;return n.update(e),n}function bo(t){if(t)return Eo(t)?{captureContext:t}:Io(t)?{captureContext:t}:t}function Eo(t){return t instanceof D||typeof t=="function"}const To=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Io(t){return Object.keys(t).some(e=>To.includes(e))}function J(t,e){return y().captureException(t,bo(e))}function wo(t,e){const n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return y().captureMessage(t,n,r)}function vo(t,e){return y().captureEvent(t,e)}function H(t,e){R().setContext(t,e)}function ko(t){R().setExtras(t)}function Ro(t,e){R().setExtra(t,e)}function Ao(t){R().setTags(t)}function No(t,e){R().setTag(t,e)}function Po(t){R().setUser(t)}function Co(){return R().lastEventId()}function xo(t){return C(this,null,function*(){const e=v();return e?e.flush(t):(m&&g.warn("Cannot flush events. No client defined."),Promise.resolve(!1))})}function Oo(t){return C(this,null,function*(){const e=v();return e?e.close(t):(m&&g.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))})}function Do(){const t=v();return(t==null?void 0:t.getOptions().enabled)!==!1&&!!(t!=null&&t.getTransport())}function Mo(t){R().addEventProcessor(t)}function Fr(t){const e=R(),{user:n}=Lr(e,y()),{userAgent:r}=A.navigator||{},s=dr(l(l({user:n},r&&{userAgent:r}),t)),i=e.getSession();return(i==null?void 0:i.status)==="ok"&&q(i,{status:"exited"}),mt(),e.setSession(s),s}function mt(){const t=R(),n=y().getSession()||t.getSession();n&&hr(n),$r(),t.setSession()}function $r(){const t=R(),e=v(),n=t.getSession();n&&e&&e.captureSession(n)}function Ht(t=!1){if(t){mt();return}$r()}const Lo="7";function Fo(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function $o(t){return`${Fo(t)}${t.projectId}/envelope/`}function jo(t,e){const n={sentry_version:Lo};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function Uo(t,e,n){return e||`${$o(t)}?${jo(t,n)}`}const zn=[];function Bo(t,e){const n={};return e.forEach(r=>{r!=null&&r.beforeSetup&&r.beforeSetup(t)}),e.forEach(r=>{r&&jr(t,r,n)}),n}function qn(t,e){for(const n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function jr(t,e,n){if(n[e.name]){m&&g.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!zn.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),zn.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(s,i)=>r(s,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),s=Object.assign((i,o)=>r(i,o,t),{id:e.name});t.addEventProcessor(s)}["processSpan","processSegmentSpan"].forEach(r=>{const s=e[r];typeof s=="function"&&t.on(r,i=>s.call(e,i,t))}),m&&g.log(`Integration installed: ${e.name}`)}function Ho(t){const e=v();if(!e){m&&g.warn(`Cannot add integration "${t.name}" because no SDK Client is available.`);return}e.addIntegration(t)}function zo(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function qo(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=re(r)),W(s,[zo(t)])}function Wn(t,e){var i;const n=(i=e!=null?e:Wo(t))!=null?i:[];if(n.length===0)return;const r=t.getOptions(),s=qo(n,r._metadata,r.tunnel,t.getDsn());Ur().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(s)}function Wo(t){return Ur().get(t)}function Ur(){return te("clientToLogBufferMap",()=>new WeakMap)}function Vo(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function Ko(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=re(r)),W(s,[Vo(t)])}function Go(t,e){var i;const n=(i=e!=null?e:Yo(t))!=null?i:[];if(n.length===0)return;const r=t.getOptions(),s=Ko(n,r._metadata,r.tunnel,t.getDsn());Br().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(s)}function Yo(t){return Br().get(t)}function Br(){return te("clientToMetricBufferMap",()=>new WeakMap)}function on(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}const an=Symbol.for("SentryBufferFullError");function Hr(t=100){const e=new Set;function n(){return e.size<t}function r(o){e.delete(o)}function s(o){if(!n())return sn(an);const a=o();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function i(o){if(!e.size)return rn(!0);const a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!o)return a;const c=[a,new Promise(u=>on(setTimeout(()=>u(!1),o)))];return Promise.race(c)}return{get $(){return Array.from(e)},add:s,drain:i}}const Jo=60*1e3;function zr(t,e=pt()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?Jo:r-e}function Xo(t,e){return t[e]||t.all||0}function Zo(t,e,n=pt()){return Xo(t,e)>n}function Qo(t,{statusCode:e,headers:n},r=pt()){const s=l({},t),i=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(i)for(const a of i.trim().split(",")){const[c,u,,,p]=a.split(":",5),f=parseInt(c,10),h=(isNaN(f)?60:f)*1e3;if(!u)s.all=r+h;else for(const d of u.split(";"))d==="metric_bucket"?(!p||p.split(";").includes("custom"))&&(s[d]=r+h):s[d]=r+h}else o?s.all=r+zr(o,r):e===429&&(s.all=r+60*1e3);return s}const qr=64;function ea(t,e,n=Hr(t.bufferSize||qr)){let r={};const s=o=>n.drain(o);function i(o){const a=[];if($t(o,(f,h)=>{const d=xn(h);Zo(r,d)?t.recordDroppedEvent("ratelimit_backoff",d):a.push(f)}),a.length===0)return Promise.resolve({});const c=W(o[0],a),u=f=>{if(jt(c,["client_report"])){m&&g.warn(`Dropping client report. Will not send outcomes (reason: ${f}).`);return}$t(c,(h,d)=>{t.recordDroppedEvent(f,xn(d))})},p=()=>e({body:Mi(c)}).then(f=>f.statusCode===413?(m&&g.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),u("send_error"),f):(m&&f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&g.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),r=Qo(r,f),f),f=>{throw u("network_error"),m&&g.error("Encountered error running transport request:",f),f});return n.add(p).then(f=>f,f=>{if(f===an)return m&&g.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw f})}return{send:i,flush:s}}function ta(t,e,n){const r=[{type:"client_report"},{timestamp:me(),discarded_events:t}];return W(e?{dsn:e}:{},[r])}function na(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch(n){}return e}function ra(t){var c,u,p;const{trace_id:e,parent_span_id:n,span_id:r,status:s,origin:i,data:o,op:a}=(u=(c=t.contexts)==null?void 0:c.trace)!=null?u:{};return{data:o!=null?o:{},description:t.transaction,op:a,parent_span_id:n,span_id:r!=null?r:"",start_timestamp:(p=t.start_timestamp)!=null?p:0,status:s,timestamp:t.timestamp,trace_id:e!=null?e:"",origin:i,profile_id:o==null?void 0:o[Yt],exclusive_time:o==null?void 0:o[Jt],measurements:t.measurements,is_segment:!0}}function sa(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:l(l(l({},t.data),t.profile_id&&{[Yt]:t.profile_id}),t.exclusive_time&&{[Jt]:t.exclusive_time})}},measurements:t.measurements}}const Vn="Not capturing exception because it's already been captured.",Kn="Discarded session because of missing or non-string release",Wr=Symbol.for("SentryInternalError"),Vr=Symbol.for("SentryDoNotSendEventError"),ia=5e3;function ke(t){return{message:t,[Wr]:!0}}function It(t){return{message:t,[Vr]:!0}}function Gn(t){return!!t&&typeof t=="object"&&Wr in t}function Yn(t){return!!t&&typeof t=="object"&&Vr in t}function Jn(t,e,n,r,s){let i=0,o,a=!1;t.on(n,()=>{i=0,clearTimeout(o),a=!1}),t.on(e,c=>{i+=r(c),i>=8e5?s(t):a||(a=!0,o=on(setTimeout(()=>{s(t)},ia)))}),t.on("flush",()=>{s(t)})}class oa{constructor(e){var r,s,i,o,a,c,u;if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Hr((s=(r=e.transportOptions)==null?void 0:r.bufferSize)!=null?s:qr),e.dsn?this._dsn=di(e.dsn):m&&g.warn("No DSN provided, client will not send events."),this._dsn){const p=Uo(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(E(l({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:p}))}this._options.enableLogs=(o=this._options.enableLogs)!=null?o:(i=this._options._experiments)==null?void 0:i.enableLogs,this._options.enableLogs&&Jn(this,"afterCaptureLog","flushLogs",fa,Wn),((u=(c=this._options.enableMetrics)!=null?c:(a=this._options._experiments)==null?void 0:a.enableMetrics)!=null?u:!0)&&Jn(this,"afterCaptureMetric","flushMetrics",ua,Go)}captureException(e,n,r){const s=x();if(In(e))return m&&g.log(Vn),s;const i=l({event_id:s},n);return this._process(()=>this.eventFromException(e,i).then(o=>this._captureEvent(o,i,r)).then(o=>o),"error"),i.event_id}captureMessage(e,n,r,s){const i=l({event_id:x()},r),o=fr(e)?e:String(e),a=lr(e),c=a?this.eventFromMessage(o,n,i):this.eventFromException(e,i);return this._process(()=>c.then(u=>this._captureEvent(u,i,s)),a?"unknown":"error"),i.event_id}captureEvent(e,n,r){const s=x();if(n!=null&&n.originalException&&In(n.originalException))return m&&g.log(Vn),s;const i=l({event_id:s},n),o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,c=o.capturedSpanIsolationScope,u=Xn(e.type);return this._process(()=>this._captureEvent(e,i,a||r,c),u),i.event_id}captureSession(e){this.sendSession(e),q(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){return C(this,null,function*(){const n=this._transport;if(!n)return!0;this.emit("flush");const r=yield this._isClientDoneProcessing(e),s=yield n.flush(e);return r&&s})}close(e){return C(this,null,function*(){Wn(this);const n=yield this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n})}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];!n&&e.beforeSetup&&e.beforeSetup(this),jr(this,e,this._integrations),n||qn(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=zi(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=Di(r,$i(s));this.sendEnvelope(r).then(s=>this.emit("afterSendEvent",e,s))}sendSession(e){const{release:n,environment:r=Qt}=this._options;if("aggregates"in e){const i=e.attrs||{};if(!i.release&&!n){m&&g.warn(Kn);return}i.release=i.release||n,i.environment=i.environment||r,e.attrs=i}else{if(!e.release&&!n){m&&g.warn(Kn);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const s=Hi(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(s)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const s=`${e}:${n}`;m&&g.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||new Set,s=(...i)=>n(...i);return r.add(s),()=>{r.delete(s)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(s=>s(...n))}sendEnvelope(e){return C(this,null,function*(){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return yield this._transport.send(e)}catch(n){return m&&g.error("Error while sending envelope:",n),{}}return m&&g.error("Transport disabled"),{}})}registerCleanup(e){}dispose(){}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=Bo(this,e),qn(this,e)}_updateSessionFromEvent(e,n){var c,u;let r=n.level==="fatal",s=!1;const i=(c=n.exception)==null?void 0:c.values;if(i){s=!0,r=!1;for(const p of i)if(((u=p.mechanism)==null?void 0:u.handled)===!1){r=!0;break}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(q(e,E(l({},r&&{status:"crashed"}),{errors:e.errors||Number(s||r)})),this.captureSession(e))}_isClientDoneProcessing(e){return C(this,null,function*(){let n=0;for(;!e||n<e;){if(yield new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,s){const i=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&(o!=null&&o.length)&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||s.setLastEventId(e.event_id||n.event_id),po(i,e,n,r,this,s).then(a=>{var u;if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts=l({trace:l(l({},(u=a.contexts)==null?void 0:u.trace),Js(r))},a.contexts);const c=ki(this,r);return a.sdkProcessingMetadata=l({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,n={},r=y(),s=R()){return m&&zt(e)&&g.log(`Captured error event \`${na(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,s).then(i=>i.event_id,i=>{m&&(Yn(i)?g.log(i.message):Gn(i)?g.warn(i.message):g.warn(i))})}_processEvent(e,n,r,s){const i=this.getOptions(),{sampleRate:o}=i,a=Kr(e),c=zt(e),p=`before send for type \`${e.type||"error"}\``,f=typeof o=="undefined"?void 0:Xt(o);if(c&&typeof f=="number"&&Pe()>f)return this.recordDroppedEvent("sample_rate","error"),sn(It(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const h=Xn(e.type);return this._prepareEvent(e,n,r,s).then(d=>{var I;if(d===null)throw this.recordDroppedEvent("event_processor",h),It("An event processor returned `null`, will not send event.");if(((I=n.data)==null?void 0:I.__sentry__)===!0)return d;const b=ca(this,i,d,n);return aa(b,p)}).then(d=>{var I;if(d===null){if(this.recordDroppedEvent("before_send",h),a){const M=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",M)}throw It(`${p} returned \`null\`, will not send event.`)}const _=r.getSession()||s.getSession();if(c&&_&&this._updateSessionFromEvent(_,d),a){const k=((I=d.sdkProcessingMetadata)==null?void 0:I.spanCountBeforeProcessing)||0,M=d.spans?d.spans.length:0,$=k-M;$>0&&this.recordDroppedEvent("before_send","span",$)}const b=d.transaction_info;if(a&&b&&d.transaction!==e.transaction){const k="custom";d.transaction_info=E(l({},b),{source:k})}return this.sendEvent(d,n),d}).then(null,d=>{throw Yn(d)||Gn(d)?d:(this.captureException(d,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:d}),ke(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
7
+ Reason: ${d}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===an&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[s,i]=n.split(":");return{reason:s,category:i,quantity:r}})}_flushOutcomes(){m&&g.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){m&&g.log("No outcomes to send");return}if(!this._dsn){m&&g.log("No dsn provided, will not send outcomes");return}m&&g.log("Sending outcomes:",e);const n=ta(e,this._options.tunnel&&re(this._dsn));this.sendEnvelope(n)}}function Xn(t){return t==="replay_event"?"replay":t||"error"}function aa(t,e){const n=`${e} must return \`null\` or a valid event.`;if(ne(t))return t.then(r=>{if(!Ne(r)&&r!==null)throw ke(n);return r},r=>{throw ke(`${e} rejected with ${r}`)});if(!Ne(t)&&t!==null)throw ke(n);return t}function ca(t,e,n,r){const{beforeSend:s,beforeSendTransaction:i,ignoreSpans:o}=e,a=!Nr(e.beforeSendSpan)&&e.beforeSendSpan;let c=n;if(zt(c)&&s)return s(c,r);if(Kr(c)){if(a||o){const u=ra(c);if(o!=null&&o.length&&Le({description:u.description,op:u.op,attributes:u.data},o))return null;if(a){const p=a(u);p?c=ye(n,sa(p)):Lt()}if(c.spans){const p=[],f=c.spans;for(const d of f){if(o!=null&&o.length&&Le({description:d.description,op:d.op,attributes:d.data},o)){wi(f,d);continue}if(a){const _=a(d);_?p.push(_):(Lt(),p.push(d))}else p.push(d)}const h=c.spans.length-p.length;h&&t.recordDroppedEvent("before_send","span",h),c.spans=p}}if(i){if(c.spans){const u=c.spans.length;c.sdkProcessingMetadata=E(l({},n.sdkProcessingMetadata),{spanCountBeforeProcessing:u})}return i(c,r)}}return c}function zt(t){return t.type===void 0}function Kr(t){return t.type==="transaction"}function ua(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+Gr(t.attributes)}function fa(t){let e=0;return t.message&&(e+=t.message.length*2),e+Gr(t.attributes)}function Gr(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*Zn(n[0]):lr(n)?e+=Zn(n):e+=100}),e}function Zn(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function la(t,e){return t(e.stack||"",1)}function pa(t){return ur(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function da(t){return pa(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function ha(t,e){const n={type:e.name||e.constructor.name,value:da(e)},r=la(t,e);return r.length&&(n.stacktrace={frames:r}),n}function _a(t,e){e.debug===!0&&(m?g.enable():ge(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),y().update(e.initialScope);const r=new t(e);return ga(r),r.init(),r}function ga(t){y().setClient(t)}const wt=100,vt=5e3,ma=36e5;function ya(t){function e(...n){m&&g.log("[Offline]:",...n)}return n=>{const r=t(n);if(!n.createStore)throw new Error("No `createStore` function was provided");const s=n.createStore(n);let i=vt,o;function a(f,h,d){return jt(f,["client_report"])?!1:n.shouldStore?n.shouldStore(f,h,d):!0}function c(f){o&&clearTimeout(o),o=on(setTimeout(()=>C(null,null,function*(){o=void 0;const h=yield s.shift();h&&(e("Attempting to send previously queued event"),h[0].sent_at=new Date().toISOString(),p(h,!0).catch(d=>{e("Failed to retry sending",d)}))}),f))}function u(){o||(c(i),i=Math.min(i*2,ma))}function p(f,h=!1){return C(this,null,function*(){var d,_;if(!h&&jt(f,["replay_event","replay_recording"]))return yield s.push(f),c(wt),{};try{if(n.shouldSend&&(yield n.shouldSend(f))===!1)throw new Error("Envelope not sent because `shouldSend` callback returned false");const b=yield r.send(f);let I=wt;if(b){if((d=b.headers)!=null&&d["retry-after"])I=zr(b.headers["retry-after"]);else if((_=b.headers)!=null&&_["x-sentry-rate-limits"])I=6e4;else if((b.statusCode||0)>=400)return b}return c(I),i=vt,b}catch(b){if(yield a(f,b,i))return h?yield s.unshift(f):yield s.push(f),u(),e("Error sending. Event queued.",b),{};throw b}})}return n.flushAtStartup&&u(),{send:p,flush:f=>(f===void 0&&(i=vt,c(wt)),r.flush(f))}}}const Sa=100;function P(t,e){const n=v(),r=R();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=Sa}=n.getOptions();if(i<=0)return;const o=me(),a=l({timestamp:o},t),c=s?ge(()=>s(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,i))}const Re="1.8.2",Yr="sentry.javascript.miniapp",ba=/^\s*at\s+(?:(.+?)\s+\()?([^\s():]+):(\d+):(\d+)\)?$/,Ea=/^\s*(?:([^@]*)@)?([^\s@:]+(?:\.[a-z]+)+):(\d+)(?::(\d+))?\s*$/,Ta=/^\s*((?:pages|utils|components|subpackages|app-service|appservice)\/[^\s:]+):(\d+):(\d+)\s*$/;function Q(t){if(!t)return 0;const e=parseInt(t,10);return isNaN(e)?0:e}function Ia(t){const e=ba.exec(t);if(!e)return;const[,n,r,s,i]=e,o={filename:r||"<anonymous>",function:n||ut,in_app:cn(r)},a=Q(s),c=Q(i);return a&&(o.lineno=a),c&&(o.colno=c),o}function wa(t){const e=Ea.exec(t);if(!e)return;const[,n,r,s,i]=e,o={filename:r||"<anonymous>",function:n||ut,in_app:cn(r)},a=Q(s),c=Q(i);return a&&(o.lineno=a),c&&(o.colno=c),o}function va(t){const e=Ta.exec(t);if(!e)return;const[,n,r,s]=e,i={filename:n||"<anonymous>",function:ut,in_app:cn(n)},o=Q(r),a=Q(s);return o&&(i.lineno=o),a&&(i.colno=a),i}function cn(t){return t?!(t.includes("sentry-miniapp")||t.includes("@sentry")||t.includes("WAService")||t.includes("WASubContext")||t.includes("aframeworkx")||t.includes("__dev__")):!0}const Jr=Ss([90,Ia],[80,wa],[70,va]),Xr=()=>{let t={request:()=>{},httpRequest:()=>{},getSystemInfoSync:()=>({}),URLSearchParams:()=>{}};if(typeof wx=="object"&&wx!==null)t=wx;else if(typeof my=="object"&&my!==null)t=my;else if(typeof tt=="object"&&tt!==null)t=tt;else if(typeof dd=="object"&&dd!==null)t=dd;else if(typeof qq=="object"&&qq!==null)t=qq;else if(typeof swan=="object"&&swan!==null)t=swan;else if(typeof ks=="object"&&ks!==null)t=ks;else return console.warn("[sentry-miniapp] 未检测到已支持的小程序平台,SDK 将以降级模式运行"),t;if(typeof my=="object"&&my!==null&&t===my&&!t.request&&t.httpRequest&&(t.request=t.httpRequest),typeof my=="object"&&my!==null&&t===my||typeof dd=="object"&&dd!==null&&t===dd){if(t.getStorageSync){const e=t.getStorageSync;t.getStorageSync=n=>{const r=e.call(t,{key:n});return r?r.data:null}}if(t.setStorageSync){const e=t.setStorageSync;t.setStorageSync=(n,r)=>{e.call(t,{key:n,data:r})}}if(t.removeStorageSync){const e=t.removeStorageSync;t.removeStorageSync=n=>{e.call(t,{key:n})}}}return t},Zr=()=>{let t="unknown";return typeof wx=="object"&&wx!==null?t="wechat":typeof my=="object"&&my!==null?t="alipay":typeof tt=="object"&&tt!==null?t="bytedance":typeof dd=="object"&&dd!==null?t="dingtalk":typeof qq=="object"&&qq!==null?t="qq":typeof swan=="object"&&swan!==null?t="swan":typeof ks=="object"&&ks!==null&&(t="kuaishou"),t},ee=()=>{try{const t=Xr(),e={};let n=!1;if(t.getAppBaseInfo){const r=t.getAppBaseInfo();Object.assign(e,r),n=!0}if(t.getWindowInfo){const r=t.getWindowInfo();Object.assign(e,r),n=!0}if(t.getDeviceInfo){const r=t.getDeviceInfo();Object.assign(e,r),n=!0}if(t.getAppAuthorizeSetting){const r=t.getAppAuthorizeSetting();e.albumAuthorized=r.albumAuthorized==="authorized",e.cameraAuthorized=r.cameraAuthorized==="authorized",e.locationAuthorized=r.locationAuthorized==="authorized",e.microphoneAuthorized=r.microphoneAuthorized==="authorized",e.notificationAuthorized=r.notificationAuthorized==="authorized"}if(t.getSystemSetting){const r=t.getSystemSetting();Object.assign(e,r)}if(n)return e;if(t.getSystemInfoSync){const r=t.getSystemInfoSync();return!r.SDKVersion&&r.version&&(r.SDKVersion=r.version),r}return null}catch(t){return console.warn("[sentry-miniapp] Failed to get system info:",t),null}},ka=()=>Zr()!=="unknown";let kt=null,Rt=null;const S=()=>(kt===null&&(kt=Xr()),kt),Qr=()=>(Rt===null&&(Rt=Zr()),Rt),es=()=>{try{const t=S();if(t.getPerformance&&typeof t.getPerformance=="function")return t.getPerformance()}catch(t){console.warn("Failed to get performance manager:",t)}return null};function ts(t){const e=t.url;function n(r){return new Promise((s,i)=>{var a,c,u,p;const o={url:e,method:"POST",data:r.body,header:l({"Content-Type":"application/json"},r.headers),headers:l({"Content-Type":"application/json"},r.headers),timeout:1e4,success:f=>{const h=f.statusCode||f.status,d=f.header||f.headers||{};s({statusCode:h,headers:{"x-sentry-rate-limits":d["x-sentry-rate-limits"],"retry-after":d["retry-after"]}})},fail:f=>{i(new Error(`Network request failed: ${f.errMsg||f.errorMessage||f.message||"Unknown error"}`))}};S().request?(c=(a=S()).request)==null||c.call(a,o):S().httpRequest?(p=(u=S()).httpRequest)==null||p.call(u,o):i(new Error("No request method available in current miniapp environment"))})}return ea(t,n)}const Ra=30,Aa=864e5,ns="sentry_offline_store";function rs(t){const e=t.offlineCacheLimit||Ra,n=t.offlineCacheMaxAge||Aa;return{push:r=>C(null,null,function*(){try{let s=Nt();for(s=At(s,n),s.push({envelope:r,timestamp:Date.now()});s.length>e;){const i=s.findIndex(o=>!Qn(o.envelope));i>=0?s.splice(i,1):s.shift()}Pt(s)}catch(s){console.warn("[sentry-miniapp] Failed to push to offline store",s)}}),unshift:r=>C(null,null,function*(){try{let s=Nt();for(s=At(s,n),s.unshift({envelope:r,timestamp:Date.now()});s.length>e;){const i=Na(s,o=>!Qn(o.envelope));i>=0?s.splice(i,1):s.pop()}Pt(s)}catch(s){console.warn("[sentry-miniapp] Failed to unshift to offline store",s)}}),shift:()=>C(null,null,function*(){try{let r=Nt();if(r=At(r,n),r.length===0)return;const s=r.shift();return Pt(r),s==null?void 0:s.envelope}catch(r){console.warn("[sentry-miniapp] Failed to shift from offline store",r);return}})}}function Qn(t){try{return(t[1]||[]).some(n=>{var s;const r=(s=n[0])==null?void 0:s.type;return r==="event"||r==="error"})}catch(e){return!0}}function At(t,e){const n=Date.now();return t.filter(r=>n-r.timestamp<e)}function Na(t,e){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1}function Nt(){try{const t=S().getStorageSync;if(t){const e=t(ns);if(e){const n=typeof e=="string"?JSON.parse(e):e;if(Array.isArray(n)&&n.length>0)return n[0]&&"envelope"in n[0]&&"timestamp"in n[0]?n:n.map(r=>({envelope:r,timestamp:Date.now()}))}}}catch(t){}return[]}function Pt(t){try{const e=S().setStorageSync;e&&e(ns,JSON.stringify(t))}catch(e){}}const Pa=Object.freeze(Object.defineProperty({__proto__:null,createMiniappOfflineStore:rs,createMiniappTransport:ts},Symbol.toStringTag,{value:"Module"}));class ss extends oa{constructor(e={}){super(E(l({},e),{transport:e.transport||(n=>{const r=ts(E(l({},n),{headers:{}}));return e.enableOfflineCache!==!1?ya(()=>r)(E(l({},n),{createStore:s=>rs(E(l({},s),{offlineCacheLimit:e.offlineCacheLimit,offlineCacheMaxAge:e.offlineCacheMaxAge})),flushAtStartup:!0})):r})}))}eventFromException(e){const n={type:e.name||"Error",value:e.message||String(e)};if(e.stack){const r=this.getOptions().stackParser;if(r&&typeof r=="function"){const s=r(e.stack,1);s.length&&(n.stacktrace={frames:s})}}return Promise.resolve({exception:{values:[n]},level:"error"})}eventFromMessage(e,n="info"){return Promise.resolve({message:e,level:n})}_prepareEvent(e,n,r){if(e.platform=e.platform||this.getOptions().platform||"javascript",e.sdk=E(l({},e.sdk),{name:Yr,packages:[...e.sdk&&e.sdk.packages||[],{name:"npm:@sentry/miniapp",version:Re}],version:Re}),e.contexts||(e.contexts={}),e.contexts.miniapp={platform:Qr(),sdk_version:Re},this.getOptions().enableSystemInfo!==!1){const s=ee();s?(e.contexts.device={brand:s.brand||"unknown",model:s.model||"unknown",screen_resolution:`${s.screenWidth||0}x${s.screenHeight||0}`,language:s.language||"unknown",version:s.version||"unknown",system:s.system||"unknown",platform:s.platform||"unknown"},e.contexts.os={name:s.system||"unknown",version:s.version||"unknown"},e.contexts.app={app_version:s.SDKVersion||"unknown"}):(e.contexts.device={brand:"unknown",model:"unknown",screen_resolution:"0x0",language:"unknown",version:"unknown",system:"unknown",platform:"unknown"},e.contexts.os={name:"unknown",version:"unknown"},e.contexts.app={app_version:"unknown"})}try{const s=r||y(),i=R();return super._prepareEvent(e,n||{},s,i)}catch(s){return Promise.resolve(e)}}close(e){const n=this._integrations;if(n&&typeof n=="object")for(const r of Object.keys(n)){const s=n[r];if(s&&typeof s.cleanup=="function")try{s.cleanup()}catch(i){}}return super.close(e)}showReportDialog(e={}){console.warn("[sentry-miniapp] showReportDialog is deprecated and does nothing. Please build your own UI and use `Sentry.captureFeedback()` instead.")}captureFeedback(e){const n={contexts:{feedback:{contact_email:e.email,name:e.name,message:e.message,url:e.url,source:e.source,associated_event_id:e.associatedEventId}},type:"feedback",level:"info",tags:e.tags||{}};return y().captureEvent(n)}}const Ke=class Ke{constructor(e){this.name=Ke.id,this._onErrorHandlerInstalled=!1,this._onUnhandledRejectionHandlerInstalled=!1,this._onPageNotFoundHandlerInstalled=!1,this._onMemoryWarningHandlerInstalled=!1,this._errorHandler=null,this._rejectionHandler=null,this._pageNotFoundHandler=null,this._memoryWarningHandler=null,this._options=l({onerror:!0,onunhandledrejection:!0,onpagenotfound:!0,onmemorywarning:!0},e)}setupOnce(){Error.stackTraceLimit=50,this._options.onerror&&this._installGlobalOnErrorHandler(),this._options.onunhandledrejection&&this._installGlobalOnUnhandledRejectionHandler(),this._options.onpagenotfound&&this._installGlobalOnPageNotFoundHandler(),this._options.onmemorywarning&&this._installGlobalOnMemoryWarningHandler()}_installGlobalOnErrorHandler(){var e,n;this._onErrorHandlerInstalled||(S().onError&&(this._errorHandler=r=>{const s=typeof r=="string"?new Error(r):r;J(s,{mechanism:{type:"onerror",handled:!1}})},(n=(e=S()).onError)==null||n.call(e,this._errorHandler)),this._onErrorHandlerInstalled=!0)}_installGlobalOnUnhandledRejectionHandler(){var e,n;this._onUnhandledRejectionHandlerInstalled||(S().onUnhandledRejection&&(this._rejectionHandler=({reason:r,promise:s})=>{const i=typeof r=="string"?new Error(r):r;J(i,{mechanism:{type:"onunhandledrejection",handled:!1},data:{promise:s}})},(n=(e=S()).onUnhandledRejection)==null||n.call(e,this._rejectionHandler)),this._onUnhandledRejectionHandlerInstalled=!0)}_installGlobalOnPageNotFoundHandler(){var e,n;this._onPageNotFoundHandlerInstalled||(S().onPageNotFound&&(this._pageNotFoundHandler=r=>{const s=y(),i=r.path.split("?")[0];s.setTag("pagenotfound",i),s.setContext("page_not_found",{path:r.path,query:r.query,isEntryPage:r.isEntryPage}),J(new Error(`页面无法找到: ${i}`),{mechanism:{type:"onpagenotfound",handled:!0}})},(n=(e=S()).onPageNotFound)==null||n.call(e,this._pageNotFoundHandler)),this._onPageNotFoundHandlerInstalled=!0)}_installGlobalOnMemoryWarningHandler(){var e,n;this._onMemoryWarningHandlerInstalled||(S().onMemoryWarning&&(this._memoryWarningHandler=({level:r=-1})=>{let s="没有获取到告警级别信息";switch(r){case 5:s="TRIM_MEMORY_RUNNING_MODERATE";break;case 10:s="TRIM_MEMORY_RUNNING_LOW";break;case 15:s="TRIM_MEMORY_RUNNING_CRITICAL";break;default:return}const i=y();i.setTag("memory-warning",String(r)),i.setContext("memory_warning",{level:r,message:s}),J(new Error("内存不足告警"),{mechanism:{type:"onmemorywarning",handled:!0}})},(n=(e=S()).onMemoryWarning)==null||n.call(e,this._memoryWarningHandler)),this._onMemoryWarningHandlerInstalled=!0)}cleanup(){try{const e=S();this._errorHandler&&e.offError&&e.offError(this._errorHandler),this._rejectionHandler&&e.offUnhandledRejection&&e.offUnhandledRejection(this._rejectionHandler),this._pageNotFoundHandler&&e.offPageNotFound&&e.offPageNotFound(this._pageNotFoundHandler),this._memoryWarningHandler&&e.offMemoryWarning&&e.offMemoryWarning(this._memoryWarningHandler)}catch(e){}this._errorHandler=null,this._rejectionHandler=null,this._pageNotFoundHandler=null,this._memoryWarningHandler=null,this._onErrorHandlerInstalled=!1,this._onUnhandledRejectionHandlerInstalled=!1,this._onPageNotFoundHandlerInstalled=!1,this._onMemoryWarningHandlerInstalled=!1}};Ke.id="GlobalHandlers";let Fe=Ke;function er(t,e={},n){if(typeof t!="function")return t;try{if(t.__sentry__)return t;if(t.__sentry_wrapped__)return t.__sentry_wrapped__}catch(s){return t}const r=function(...s){try{return t.apply(this,s)}catch(i){throw y().addEventProcessor(a=>{const c=l({},a);return e.mechanism&&(c.exception=c.exception||{},c.exception.mechanism=e.mechanism),c.extra=E(l({},c.extra),{arguments:s}),c}),J(i),i}};try{for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}catch(s){}t.prototype=t.prototype||{},r.prototype=t.prototype,Object.defineProperty(t,"__sentry_wrapped__",{enumerable:!1,value:r}),Object.defineProperties(r,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:t}});try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch(s){}return r}function tr(t){try{return t&&t.name||"<anonymous>"}catch(e){return"<anonymous>"}}function ue(t,e,n){if(!(e in t))return;const r=t[e],s=n(r);if(typeof s=="function")try{s.prototype=s.prototype||{},s.prototype.constructor=s}catch(i){}t[e]=s}const Ge=class Ge{constructor(){this.name=Ge.id}_wrapTimeFunction(e){return function(...n){const r=n[0];return n[0]=er(r,{mechanism:{data:{function:tr(e)},handled:!0,type:"instrument"}}),e.apply(this,n)}}_wrapRAF(e){return function(n){return e(er(n,{mechanism:{data:{function:"requestAnimationFrame",handler:tr(e)},handled:!0,type:"instrument"}}))}}setupOnce(){const e=globalThis;e.setTimeout&&ue(e,"setTimeout",this._wrapTimeFunction.bind(this)),e.setInterval&&ue(e,"setInterval",this._wrapTimeFunction.bind(this)),e.requestAnimationFrame&&ue(e,"requestAnimationFrame",this._wrapRAF.bind(this))}};Ge.id="TryCatch";let $e=Ge;const Ca="cause",xa=5,Ye=class Ye{constructor(e={}){this.name=Ye.id,this._key=e.key||Ca,this._limit=e.limit||xa}setupOnce(){}processEvent(e,n){return y().getClient()?this._handler(e,n):e}_handler(e,n){if(!e.exception||!e.exception.values||!n||!nr(n.originalException,Error))return e;const r=this._walkErrorTree(n.originalException,this._key);return e.exception.values=[...r,...e.exception.values],e}_walkErrorTree(e,n,r=[]){if(!nr(e[n],Error)||r.length+1>=this._limit)return r;const s=ha(()=>[],e[n]);return this._walkErrorTree(e[n],n,[s,...r])}};Ye.id="LinkedErrors";let je=Ye;function nr(t,e){try{return t instanceof e}catch(n){return!1}}const Je=class Je{constructor(){this.name=Je.id}setupOnce(){}processEvent(e){const n=y(),r={runtime:{name:"miniapp",version:this._getMiniappVersion()},app:{name:this._getAppName(),version:this._getAppVersion()},device:this._getDeviceInfo(),network:this._getNetworkInfo()};return n.setContext("runtime",r.runtime),n.setContext("app",r.app),n.setContext("device",r.device),n.setContext("network",r.network),e}_getMiniappVersion(){const e=ee();return(e==null?void 0:e.version)||(e==null?void 0:e.SDKVersion)||"unknown"}_getAppName(){var e,n,r;try{if(S().getAccountInfoSync)return((r=((n=(e=S()).getAccountInfoSync)==null?void 0:n.call(e)).miniProgram)==null?void 0:r.appId)||"unknown"}catch(s){}return"unknown"}_getAppVersion(){var e,n,r;try{if(S().getAccountInfoSync){const s=(n=(e=S()).getAccountInfoSync)==null?void 0:n.call(e);return((r=s==null?void 0:s.miniProgram)==null?void 0:r.version)||"unknown"}}catch(s){}return"unknown"}_getDeviceInfo(){const e=ee();return e?{brand:e.brand,model:e.model,system:e.system,platform:e.platform,screenWidth:e.screenWidth,screenHeight:e.screenHeight,windowWidth:e.windowWidth,windowHeight:e.windowHeight,pixelRatio:e.pixelRatio,language:e.language}:{}}_getNetworkInfo(){try{S().getNetworkType&&S().getNetworkType({success:e=>{const n=y();n.setTag("network.type",e.networkType),n.setContext("network",{type:e.networkType})}})}catch(e){}return{}}};Je.id="HttpContext";let Ue=Je;const Xe=class Xe{constructor(e={}){this.name=Xe.id,this._fuzzyMatch=!!e.fuzzyMatch}setupOnce(){}processEvent(e,n){if(e.type)return e;try{if(this._shouldDropEvent(e,this._previousEvent))return null}catch(r){return this._previousEvent=this._cloneEventForComparison(e),e}return this._previousEvent=this._cloneEventForComparison(e),e}_shouldDropEvent(e,n){return n?!!(this._isSameMessageEvent(e,n)||this._isSameExceptionEvent(e,n)):!1}_isSameMessageEvent(e,n){const r=e.message,s=n.message;return!(!r&&!s||r&&!s||!r&&s||r!==s||!this._isSameFingerprint(e,n)||!this._isSameStacktrace(e,n))}_isSameExceptionEvent(e,n){const r=this._getExceptionFromEvent(e),s=this._getExceptionFromEvent(n);if(!r||!s||r.type!==s.type)return!1;if(this._fuzzyMatch){if(!Oa(r.value,s.value))return!1}else if(r.value!==s.value)return!1;return!(!this._isSameFingerprint(e,n)||!this._isSameStacktrace(e,n))}_isSameStacktrace(e,n){let r=this._getFramesFromEvent(e),s=this._getFramesFromEvent(n);if(!r&&!s)return!0;if(r&&!s||!r&&s||(r=r,s=s,s.length!==r.length))return!1;for(let i=0;i<s.length;i++){const o=s[i],a=r[i];if(o.filename!==a.filename||o.lineno!==a.lineno||o.colno!==a.colno||o.function!==a.function)return!1}return!0}_isSameFingerprint(e,n){let r=e.fingerprint,s=n.fingerprint;if(!r&&!s)return!0;if(r&&!s||!r&&s)return!1;r=r,s=s;try{return r.join("")===s.join("")}catch(i){return!1}}_getExceptionFromEvent(e){return e.exception&&e.exception.values&&e.exception.values[0]}_cloneEventForComparison(e){var n;return{message:e.message,fingerprint:e.fingerprint?[...e.fingerprint]:void 0,exception:e.exception?{values:(n=e.exception.values)==null?void 0:n.map(r=>{var s;return{type:r.type,value:r.value,stacktrace:r.stacktrace?{frames:(s=r.stacktrace.frames)==null?void 0:s.map(i=>l({},i))}:void 0}})}:void 0}}_getFramesFromEvent(e){const n=e.exception;if(n)try{return n.values[0].stacktrace.frames}catch(r){}}};Xe.id="Dedupe";let Be=Xe;const rr=/\d{10,}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/g;function Oa(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=t.replace(rr,"<dynamic>"),r=e.replace(rr,"<dynamic>");return n===r}const Ze=class Ze{constructor(){this.name=Ze.id}setupOnce(){this._addSystemContext(),this._addNetworkContext(),this._addLocationContext(),this._addStorageContext(),this._checkAppUpdate()}_addSystemContext(){var e,n,r,s;try{const i=ee();if(i){const o=y();o.setContext("device",{name:i.model,model:i.model,brand:i.brand,family:i.platform,arch:i.platform}),o.setContext("os",{name:((e=i.system)==null?void 0:e.split(" ")[0])||"unknown",version:((n=i.system)==null?void 0:n.split(" ")[1])||"unknown",kernel_version:i.version}),o.setContext("app",{app_name:i.appName||"unknown",app_version:i.version}),o.setContext("screen",{screen_width:i.screenWidth,screen_height:i.screenHeight,screen_density:i.pixelRatio}),o.setTag("device.model",i.model),o.setTag("device.brand",i.brand),o.setTag("os.name",((r=i.system)==null?void 0:r.split(" ")[0])||"unknown"),o.setTag("os.version",((s=i.system)==null?void 0:s.split(" ")[1])||"unknown"),o.setTag("app.version",i.version),o.setTag("language",i.language)}}catch(i){}}_addNetworkContext(){try{S().getNetworkType&&S().getNetworkType({success:e=>{const n=y();n.setContext("network",{type:e.networkType,connected:e.isConnected!==!1}),n.setTag("network.type",e.networkType)},fail:()=>{}})}catch(e){}}_addLocationContext(){try{S().getLocation&&S().getLocation({type:"gcj02",success:e=>{y().setContext("location",{latitude:e.latitude,longitude:e.longitude,accuracy:e.accuracy})},fail:()=>{}})}catch(e){}}_addStorageContext(){try{const e=S();if(e&&typeof e.getStorageInfoSync=="function"){const n=e.getStorageInfoSync();if(n){const r=n.currentSize||0,s=n.limitSize||0,i=s>0?Math.round(r/s*100):0;y().setContext("storage",{currentSize:r,limitSize:s,usagePercent:i}),i>=80&&P({category:"storage.warning",message:`存储使用率 ${i}%(${r}KB / ${s}KB)`,level:"warning",data:{currentSize:r,limitSize:s,usagePercent:i}})}}}catch(e){}}_checkAppUpdate(){try{const e=S();if(e&&typeof e.getUpdateManager=="function"){const n=e.getUpdateManager();n&&(typeof n.onCheckForUpdate=="function"&&n.onCheckForUpdate(r=>{r&&r.hasUpdate&&(y().setTag("has_update","true"),P({category:"app.update",message:"检测到新版本可用",level:"info",data:{hasUpdate:!0}}))}),typeof n.onUpdateReady=="function"&&n.onUpdateReady(()=>{P({category:"app.update",message:"新版本已下载完成",level:"info",data:{updateReady:!0}})}))}}catch(e){}}};Ze.id="System";let qt=Ze;const Qe=class Qe{constructor(){this.name=Qe.id,this._lastRoute="",this._monitorTimer=null}setupOnce(){this._instrumentNavigation(),this._startRouteMonitoring()}_instrumentNavigation(){let e;try{e=S()}catch(r){return}const n=["navigateTo","redirectTo","switchTab","reLaunch"];for(const r of n)if(e[r]){const s=e[r];e[r]=i=>(this._recordNavigation(r,i.url,this._getCurrentRoute()),s.call(e,i))}if(e.navigateBack){const r=e.navigateBack;e.navigateBack=(s={})=>(this._recordNavigation("navigateBack","back",this._getCurrentRoute(),s.delta),r.call(e,s))}}_startRouteMonitoring(){this._monitorTimer=setInterval(()=>{const e=this._getCurrentRoute();e&&e!==this._lastRoute&&(this._recordRouteChange(this._lastRoute,e),this._lastRoute=e)},1e3)}cleanup(){this._monitorTimer&&(clearInterval(this._monitorTimer),this._monitorTimer=null)}_getCurrentRoute(){try{const e=globalThis;if(e.getCurrentPages){const n=e.getCurrentPages();if(n&&n.length>0){const r=n[n.length-1];return r.route||r.__route__||""}}}catch(e){}return""}_recordNavigation(e,n,r,s){const i=y();P({category:"navigation",data:{action:e,from:r,to:n,delta:s},message:`Navigation ${e}: ${r} -> ${n}`,type:"navigation"}),i.setTag("route",n==="back"?r:n),i.setContext("navigation",{action:e,from:r,to:n,delta:s,timestamp:Date.now()})}_recordRouteChange(e,n){const r=y();P({category:"navigation",data:{from:e,to:n},message:`Route changed: ${e} -> ${n}`,type:"navigation"}),r.setTag("route",n),r.setContext("route",{current:n,previous:e,timestamp:Date.now()})}};Qe.id="Router";let Wt=Qe;const et=class et{constructor(e={}){this.name=et.id,this._performanceManager=null,this._observers=[],this._entryBuffer=[],this._reportTimer=null,this._options=E(l({enableNavigation:!0,enableRender:!0,enableResource:!0,enableUserTiming:!1,sampleRate:1,bufferSize:100,reportInterval:3e4,enableMemory:!1},e),{thresholds:l({navigation:3e3,render:1e3,resource:2e3,setData:50},e==null?void 0:e.thresholds)})}setupOnce(){this._initializePerformanceManager(),this._setupPerformanceObservers(),this._startAutoReporting(),this._addPerformanceContext()}_initializePerformanceManager(){try{if(this._performanceManager=es(),!this._performanceManager){console.warn("[sentry-miniapp] Performance API not available");return}const e=y();e.setTag("performance.api.available",!0),e.setContext("performance",{api_version:"miniapp-1.0",sample_rate:this._options.sampleRate,buffer_size:this._options.bufferSize})}catch(e){console.warn("[sentry-miniapp] Failed to initialize performance manager:",e)}}_setupPerformanceObservers(){if(this._performanceManager)try{const e=[];this._options.enableNavigation&&e.push("navigation"),this._options.enableRender&&e.push("render"),this._options.enableResource&&e.push("resource");let n=this._options.enableUserTiming;if(n)try{const i=ee();if(i&&i.platform==="devtools"&&(n=!1),n){const a=(typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{}).PerformanceObserver,c=a&&Array.isArray(a.supportedEntryTypes)?a.supportedEntryTypes:void 0;(!c||!c.includes("measure")||!c.includes("mark"))&&(n=!1)}}catch(i){n=!1}if(n&&e.push("measure","mark"),e.length===0)return;const r=this._performanceManager.createObserver(i=>{this._handlePerformanceEntries(i)});try{r.observe({entryTypes:e})}catch(i){const o=e.filter(a=>a!=="measure"&&a!=="mark");if(o.length<e.length&&o.length>0)r.observe({entryTypes:o}),console.warn("[sentry-miniapp] Failed to observe all types, falling back to:",o),e.length=0,e.push(...o);else throw i}this._observers.push(r);const s=typeof globalThis!="undefined"?globalThis.process:void 0;s&&s.env&&s.env.NODE_ENV!=="production"&&console.log("[sentry-miniapp] Performance observers setup for:",e)}catch(e){console.warn("[sentry-miniapp] Failed to setup performance observers:",e)}}_handlePerformanceEntries(e){if(!e)return;let n;if(Array.isArray(e))n=e;else if(typeof e=="object"&&e.getEntries)n=e.getEntries();else if(typeof e=="object")n=[e];else{console.warn("[sentry-miniapp] Invalid entries format:",typeof e);return}n.length!==0&&(Math.random()>this._options.sampleRate||n.forEach(r=>{try{this._processPerformanceEntry(r),this._addToBuffer(r)}catch(s){console.warn("[sentry-miniapp] Failed to process performance entry:",s)}}))}_processPerformanceEntry(e){switch(e.entryType){case"navigation":this._processNavigationEntry(e);break;case"render":this._processRenderEntry(e);break;case"resource":this._processResourceEntry(e);break;case"measure":case"mark":this._processUserTimingEntry(e);break;default:console.log("[sentry-miniapp] Unknown entry type:",e.entryType)}}_processNavigationEntry(e){y().addBreadcrumb({message:`页面导航: ${e.name}`,category:"performance.navigation",level:"info",data:{duration:e.duration,appLaunchTime:e.appLaunchTime,pageReadyTime:e.pageReadyTime}}),ie({name:`Navigation: ${e.name}`,op:"navigation",startTime:e.startTime/1e3},r=>{r.setAttributes({"navigation.name":e.name,"navigation.duration":e.duration,"navigation.app_launch_time":e.appLaunchTime||0,"navigation.page_ready_time":e.pageReadyTime||0,"navigation.first_render_time":e.firstRenderTime||0}),r.end((e.startTime+e.duration)/1e3)})}_processRenderEntry(e){var r,s;ie({name:`Render: ${e.name}`,op:"render",startTime:e.startTime/1e3},i=>{i.setAttributes({"render.name":e.name,"render.duration":e.duration,"render.start":e.renderStart||0,"render.end":e.renderEnd||0,"render.script_start":e.scriptStart||0,"render.script_end":e.scriptEnd||0}),i.end((e.startTime+e.duration)/1e3)});const n=(s=(r=this._options.thresholds)==null?void 0:r.setData)!=null?s:50;e.duration>n&&y().addBreadcrumb({message:`慢渲染检测: ${e.name} (${e.duration.toFixed(1)}ms)`,category:"performance.setData.slow",level:"warning",data:{name:e.name,duration:e.duration,threshold:n,renderStart:e.renderStart,renderEnd:e.renderEnd,scriptStart:e.scriptStart,scriptEnd:e.scriptEnd}})}_processResourceEntry(e){ie({name:`Resource: ${e.name}`,op:"resource",startTime:e.startTime/1e3},n=>{n.setAttributes({"resource.name":e.name,"resource.duration":e.duration,"resource.type":e.initiatorType||"unknown","resource.transfer_size":e.transferSize||0,"resource.encoded_size":e.encodedBodySize||0,"resource.decoded_size":e.decodedBodySize||0}),e.fetchStart&&e.responseEnd&&n.setAttributes({"resource.fetch_start":e.fetchStart,"resource.response_end":e.responseEnd,"resource.network_time":e.responseEnd-e.fetchStart}),n.end((e.startTime+e.duration)/1e3)})}_processUserTimingEntry(e){e.entryType==="measure"?ie({name:`Measure: ${e.name}`,op:"measure",startTime:e.startTime/1e3},n=>{n.setAttributes({"measure.name":e.name,"measure.duration":e.duration,"measure.detail":e.detail?JSON.stringify(e.detail):void 0}),n.end((e.startTime+e.duration)/1e3)}):e.entryType==="mark"&&y().addBreadcrumb({message:`性能标记: ${e.name}`,category:"performance.mark",level:"info",data:{timestamp:e.startTime,detail:e.detail}})}_addToBuffer(e){for(this._entryBuffer.push(e);this._entryBuffer.length>this._options.bufferSize;)this._entryBuffer.shift()}_startAutoReporting(){this._options.reportInterval<=0||(this._reportTimer=setInterval(()=>{this._reportBufferedEntries()},this._options.reportInterval))}_reportBufferedEntries(){if(this._entryBuffer.length!==0)try{const e=y(),n=this._calculatePerformanceStats(),r=this._collectMemoryInfo();r&&(n.memory=r),e.setContext("performance_summary",l({total_entries:this._entryBuffer.length,navigation_count:this._entryBuffer.filter(s=>s.entryType==="navigation").length,render_count:this._entryBuffer.filter(s=>s.entryType==="render").length,resource_count:this._entryBuffer.filter(s=>s.entryType==="resource").length,measure_count:this._entryBuffer.filter(s=>s.entryType==="measure").length,mark_count:this._entryBuffer.filter(s=>s.entryType==="mark").length,report_time:new Date().toISOString()},n)),this._checkPerformanceThresholds(n),this._reportToNativeAPI(),this._entryBuffer=[]}catch(e){console.warn("[sentry-miniapp] Failed to report buffered entries:",e)}}_calculatePerformanceStats(){const e=this._entryBuffer.filter(i=>i.entryType==="navigation"),n=this._entryBuffer.filter(i=>i.entryType==="render"),r=this._entryBuffer.filter(i=>i.entryType==="resource"),s={};if(e.length>0){const i=e.map(o=>o.duration);s.navigation_stats={avg_duration:i.reduce((o,a)=>o+a,0)/i.length,max_duration:Math.max(...i),min_duration:Math.min(...i)}}if(n.length>0){const i=n.map(a=>a.duration);s.render_stats={avg_duration:i.reduce((a,c)=>a+c,0)/i.length,max_duration:Math.max(...i),min_duration:Math.min(...i)};const o=n.filter(a=>{var c,u;return a.duration>((u=(c=this._options.thresholds)==null?void 0:c.setData)!=null?u:50)});s.render_stats.slow_render_count=o.length,s.render_stats.slow_render_ratio=o.length/n.length}if(r.length>0){const i=r.map(a=>a.duration),o=r.map(a=>a.transferSize||0).filter(a=>a>0);s.resource_stats={avg_load_time:i.reduce((a,c)=>a+c,0)/i.length,max_load_time:Math.max(...i),total_transfer_size:o.reduce((a,c)=>a+c,0),avg_transfer_size:o.length>0?o.reduce((a,c)=>a+c,0)/o.length:0}}return s}_checkPerformanceThresholds(e){var o,a,c,u,p,f,h,d,_;const n=y(),r=(a=(o=this._options.thresholds)==null?void 0:o.navigation)!=null?a:3e3;((c=e.navigation_stats)==null?void 0:c.avg_duration)>r&&n.addBreadcrumb({message:"页面导航性能较慢",category:"performance.warning",level:"warning",data:{avg_duration:e.navigation_stats.avg_duration,threshold:r}});const s=(p=(u=this._options.thresholds)==null?void 0:u.render)!=null?p:1e3;((f=e.render_stats)==null?void 0:f.avg_duration)>s&&n.addBreadcrumb({message:"页面渲染性能较慢",category:"performance.warning",level:"warning",data:{avg_duration:e.render_stats.avg_duration,threshold:s}});const i=(d=(h=this._options.thresholds)==null?void 0:h.resource)!=null?d:2e3;((_=e.resource_stats)==null?void 0:_.avg_load_time)>i&&n.addBreadcrumb({message:"资源加载性能较慢",category:"performance.warning",level:"warning",data:{avg_load_time:e.resource_stats.avg_load_time,threshold:i}})}_reportToNativeAPI(){try{const e=S();if(e.reportPerformance&&this._entryBuffer.length>0){const n={entries:this._entryBuffer.map(r=>({name:r.name,entryType:r.entryType,startTime:r.startTime,duration:r.duration})),timestamp:Date.now(),sampleRate:this._options.sampleRate};e.reportPerformance(n)}}catch(e){console.warn("[sentry-miniapp] Failed to report to native API:",e)}}_collectMemoryInfo(){if(!this._options.enableMemory)return null;try{const e=S();if(e.getPerformance){const n=e.getPerformance();if(n&&n.memory)return{jsHeapSizeUsed:n.memory.jsHeapSizeUsed,jsHeapSizeLimit:n.memory.jsHeapSizeLimit}}}catch(e){}return null}_addPerformanceContext(){try{const e=y(),n=S(),r=!!n.getPerformance,s=!!n.reportPerformance;e.setContext("performance_support",{has_performance_api:r,has_report_api:s,integration_enabled:!0,options:this._options}),e.setTag("performance.integration","enabled")}catch(e){console.warn("[sentry-miniapp] Failed to add performance context:",e)}}cleanup(){this._observers.forEach(e=>{try{e.disconnect()}catch(n){console.warn("[sentry-miniapp] Failed to disconnect observer:",n)}}),this._observers=[],this._reportTimer&&(clearInterval(this._reportTimer),this._reportTimer=null),this._reportBufferedEntries()}};et.id="PerformanceAPI";let He=et;const un=t=>()=>new He(t),nt=class nt{constructor(e={}){this.name=nt.id,this._prefix=e.prefix||"app:///"}setupOnce(){}processEvent(e){return e.exception&&e.exception.values&&e.exception.values.forEach(n=>{n.stacktrace&&n.stacktrace.frames&&n.stacktrace.frames.forEach(r=>{r.filename&&(r.filename=this._normalizeFilename(r.filename))})}),e}_normalizeFilename(e){let n=e;return n=n.replace(/^(appservice|app-service|WAService)\//i,"").replace(/^https?:\/\/[^/]+\//i,"").replace(/^[a-z]+:\/\//i,"").replace(/^\//,""),n.startsWith(this._prefix)?n:`${this._prefix}${n}`}};nt.id="RewriteFrames";let ze=nt;const rt=class rt{constructor(e={}){this.name=rt.id,this._originalRequest=null,this._originalHttpRequest=null,this._traceNetworkBody=!!e.traceNetworkBody,this._sensitiveKeys=(e.sensitiveKeys||["password","passwd","secret","token","access_token","refresh_token","authorization","cookie","session","creditcard","credit_card","card_number","cvv","ssn","id_card"]).map(n=>n.toLowerCase()),this._denyUrls=(e.denyBodyUrls||[]).map(n=>typeof n=="string"?new RegExp(n):n),this._enableTracePropagation=e.enableTracePropagation!==!1,this._tracePropagationTargets=e.tracePropagationTargets||[]}setupOnce(){const e=S();e&&typeof e.request=="function"&&(this._originalRequest=e.request,ue(e,"request",this._createRequestWrapper.bind(this))),e&&typeof e.httpRequest=="function"&&(this._originalHttpRequest=e.httpRequest,ue(e,"httpRequest",this._createRequestWrapper.bind(this)))}cleanup(){const e=S();e&&(this._originalRequest&&typeof e.request=="function"&&(e.request=this._originalRequest),this._originalHttpRequest&&typeof e.httpRequest=="function"&&(e.httpRequest=this._originalHttpRequest)),this._originalRequest=null,this._originalHttpRequest=null}_createRequestWrapper(e){const n=this._traceNetworkBody,r=this._sanitizeBody.bind(this),s=this._shouldDenyBodyUrl.bind(this),i=this._enableTracePropagation,o=this._shouldPropagateTrace.bind(this);return function(a){var k,M,$;if(!a||typeof a!="object")return e.call(this,a);const c=a.url||"",u=v();let p="";if(u){const w=u.getOptions().dsn;if(w)try{const T=w.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?([^:/\n]+)/i);T&&T[1]&&(p=T[1])}catch(T){}}if(typeof c=="string"){const w=c.match(/^https?:\/\/([^:/\n]+)/i),T=w&&w[1]?w[1]:"";if(p&&T===p||T==="sentry.io"||T.endsWith(".sentry.io"))return e.call(this,a)}if(i&&o(c))try{const T=y().getPropagationContext();if(T){const{traceId:O,parentSpanId:Ee}=T;if(O){const V=a.header||a.headers||{};V["sentry-trace"]=`${O}-${Ee||"0000000000000000"}-1`;const K=((k=u==null?void 0:u.getOptions())==null?void 0:k.dsn)||"",ln=((M=u==null?void 0:u.getOptions())==null?void 0:M.release)||"",pn=(($=u==null?void 0:u.getOptions())==null?void 0:$.environment)||"",G=[];O&&G.push(`sentry-trace_id=${O}`),K&&G.push(`sentry-public_key=${Da(K)}`),ln&&G.push(`sentry-release=${ln}`),pn&&G.push(`sentry-environment=${pn}`),G.length>0&&(V.baggage=G.join(",")),a.header=V,a.headers=V}}}catch(w){}const f=(a.method||"GET").toUpperCase(),h=a.data,d=Date.now(),_={url:c,method:f};if(n&&h&&!s(c))try{const w=typeof h=="string"?h:JSON.stringify(h);_.request_body=r(w),_.request_size=w.length}catch(w){_.request_body="[Cannot serialize request body]"}const b=a.success,I=a.fail;return a.success=function(...w){const T=w[0]||{},O=T.statusCode||T.status,Ee=Date.now()-d;if(_.status_code=O,_.duration=Ee,n&&T.data&&!s(c))try{const K=typeof T.data=="string"?T.data:JSON.stringify(T.data);_.response_body=r(K),_.response_size=K.length}catch(K){_.response_body="[Cannot serialize response body]"}const V=O>=400||Ee>3e3?"warning":"info";if(P({type:"http",category:"xhr",data:_,level:V}),typeof b=="function")return b.apply(this,w)},a.fail=function(...w){const T=w[0]||{},O=Date.now()-d;if(_.error=T.errMsg||T.errorMessage||"Network request failed",_.duration=O,P({type:"http",category:"xhr",data:_,level:"error"}),typeof I=="function")return I.apply(this,w)},e.call(this,a)}}_shouldPropagateTrace(e){return this._tracePropagationTargets.length===0?!0:this._tracePropagationTargets.some(n=>typeof n=="string"?e.includes(n):n.test(e))}_shouldDenyBodyUrl(e){return this._denyUrls.some(n=>n.test(e))}_sanitizeBody(e){if(this._sensitiveKeys.length===0)return e;try{const n=JSON.parse(e);if(typeof n=="object"&&n!==null)return this._sanitizeObject(n),JSON.stringify(n)}catch(n){for(const r of this._sensitiveKeys){const s=new RegExp(`(${r})=[^&]*`,"gi");e=e.replace(s,"$1=[Filtered]")}}return e}_sanitizeObject(e){for(const n of Object.keys(e))this._sensitiveKeys.includes(n.toLowerCase())?e[n]="[Filtered]":typeof e[n]=="object"&&e[n]!==null&&this._sanitizeObject(e[n])}};rt.id="NetworkBreadcrumbs";let qe=rt;function Da(t){try{const e=t.match(/^https?:\/\/([^@]+)@/);return e?e[1]:""}catch(e){return""}}const is=["onLoad","onShow","onHide","onUnload","onReady"],Ma=["onLaunch","onShow","onHide"];function La(t){return is.includes(t)||t.startsWith("_")?!1:/^(on|handle|bind)[A-Z]/.test(t)||/[Tt]ap$/.test(t)||/[Cc]lick$/.test(t)||/[Cc]hange$/.test(t)||/[Ss]ubmit$/.test(t)||/[Ss]croll$/.test(t)||/[Ii]nput$/.test(t)}const st=class st{constructor(e={}){this.name=st.id,this._originalPage=null,this._originalApp=null,this._launchTime=0,this._firstPageReady=!1,this._options=l({enableLifecycle:!0,enableUserInteraction:!0},e)}setupOnce(){this._wrapPage(),this._wrapApp()}_wrapPage(){const e=globalThis;if(typeof e.Page!="function")return;this._originalPage=e.Page;const n=e.Page,r=this._options,s=()=>this._firstPageReady,i=a=>{this._firstPageReady=a},o=()=>this._launchTime;e.Page=function(a){if(a&&typeof a=="object"){if(r.enableLifecycle){for(const c of is)if(typeof a[c]=="function"){const u=a[c];a[c]=function(...p){const f=(this==null?void 0:this.route)||(this==null?void 0:this.__route__)||"unknown",h={action:c,page:f};if(c==="onLoad"&&p[0]&&typeof p[0]=="object"&&(h.query=p[0]),c==="onReady"&&!s()&&o()>0){i(!0);const d=Date.now()-o();h.coldStartDuration=d,H("startup",{coldStartDuration:d,firstPage:f})}return P({category:"page.lifecycle",message:`${c}: ${f}`,level:"info",data:h}),u.apply(this,p)}}}if(r.enableUserInteraction){for(const c of Object.keys(a))if(typeof a[c]=="function"&&La(c)){const u=a[c];a[c]=function(p,...f){const h=(this==null?void 0:this.route)||(this==null?void 0:this.__route__)||"unknown",d={handler:c,page:h};if(p&&typeof p=="object"&&(p.target&&(p.target.id&&(d.targetId=p.target.id),p.target.dataset&&(d.dataset=p.target.dataset)),p.type&&(d.eventType=p.type),p.detail&&(typeof p.detail.x=="number"&&(d.x=p.detail.x),typeof p.detail.y=="number"&&(d.y=p.detail.y)),p.touches&&p.touches.length>0)){const _=p.touches[0];_&&(d.touchX=_.pageX,d.touchY=_.pageY)}return P({category:"user.interaction",message:`${c} on ${h}`,level:"info",data:d}),u.apply(this,[p,...f])}}}}return n(a)}}_wrapApp(){const e=globalThis;if(typeof e.App!="function")return;this._originalApp=e.App;const n=e.App,r=this._options,s=i=>{this._launchTime=i};e.App=function(i){if(i&&typeof i=="object"&&r.enableLifecycle){for(const o of Ma)if(typeof i[o]=="function"){const a=i[o];i[o]=function(...c){return o==="onLaunch"&&s(Date.now()),P({category:"app.lifecycle",message:`App.${o}`,level:"info",data:{action:o}}),a.apply(this,c)}}}return n(i)}}cleanup(){const e=globalThis;this._originalPage&&(e.Page=this._originalPage,this._originalPage=null),this._originalApp&&(e.App=this._originalApp,this._originalApp=null)}};st.id="PageBreadcrumbs";let de=st;const Fa=t=>new de(t),$a=["debug","info","warn","error","log"],ja={debug:"debug",info:"info",log:"info",warn:"warning",error:"error"},it=class it{constructor(e={}){this.name=it.id,this._originalMethods={},this._levels=e.levels||[...$a]}setupOnce(){for(const e of this._levels){if(typeof console[e]!="function")continue;const n=console[e];this._originalMethods[e]=n,console[e]=function(...r){return P({category:"console",level:ja[e],message:r.map(s=>{if(typeof s=="string")return s;try{return JSON.stringify(s)}catch(i){return String(s)}}).join(" ")}),n.apply(console,r)}}}cleanup(){for(const e of this._levels){const n=this._originalMethods[e];n&&(console[e]=n)}this._originalMethods={}}};it.id="ConsoleBreadcrumbs";let he=it;const Ua=t=>new he(t),ot=class ot{constructor(){this.name=ot.id,this._originalApp=null,this._isSessionActive=!1}setupOnce(){this._wrapApp()}_wrapApp(){const e=sr();if(!e||typeof e.App!="function")return;this._originalApp=e.App;const n=this._startSession.bind(this),r=this._endSession.bind(this),s=this._markSessionCrashed.bind(this),i=()=>this._isSessionActive,o=this._originalApp;e.App=function(a={}){const c=a.onLaunch,u=a.onShow,p=a.onHide,f=a.onError;return a.onLaunch=function(...h){if(n(),typeof c=="function")return c.apply(this,h)},a.onShow=function(...h){if(i()||n(),typeof u=="function")return u.apply(this,h)},a.onHide=function(...h){if(r(),typeof p=="function")return p.apply(this,h)},a.onError=function(...h){if(s(),typeof f=="function")return f.apply(this,h)},o.call(this,a)}}_startSession(){try{Fr({ignoreDuration:!0}),Ht(),this._isSessionActive=!0}catch(e){}}_endSession(){try{mt(),Ht(),this._isSessionActive=!1}catch(e){}}_markSessionCrashed(){try{const n=y().getSession();n&&(n.status="crashed")}catch(e){}}cleanup(){const e=sr();e&&this._originalApp&&(e.App=this._originalApp),this._originalApp=null,this._isSessionActive=!1}};ot.id="Session";let We=ot;function sr(){if(typeof wx!="undefined")return wx;if(typeof my!="undefined")return my;if(typeof tt!="undefined")return tt;if(typeof dd!="undefined")return dd;if(typeof qq!="undefined")return qq;if(typeof swan!="undefined")return swan;if(typeof globalThis!="undefined")return globalThis}const at=class at{constructor(){this.name=at.id,this._statusChangeHandler=null}setupOnce(){const e=S();if(e){if(typeof e.getNetworkType=="function")try{e.getNetworkType({success:n=>{const r=n.networkType||"unknown";H("network",{type:r,isConnected:r!=="none"})}})}catch(n){}typeof e.onNetworkStatusChange=="function"&&(this._statusChangeHandler=n=>{const r=n.networkType||"unknown",s=n.isConnected!==void 0?n.isConnected:r!=="none";H("network",{type:r,isConnected:s}),P({category:"network.change",message:`网络状态变化: ${r}`,level:s?"info":"warning",data:{networkType:r,isConnected:s}})},e.onNetworkStatusChange(this._statusChangeHandler))}}cleanup(){if(this._statusChangeHandler){const e=S();if(e&&typeof e.offNetworkStatusChange=="function")try{e.offNetworkStatusChange(this._statusChangeHandler)}catch(n){}this._statusChangeHandler=null}}};at.id="NetworkStatus";let Ve=at;const Ba=Object.freeze(Object.defineProperty({__proto__:null,ConsoleBreadcrumbs:he,Dedupe:Be,GlobalHandlers:Fe,HttpContext:Ue,LinkedErrors:je,NetworkBreadcrumbs:qe,NetworkStatusIntegration:Ve,PageBreadcrumbs:de,PerformanceIntegration:He,RewriteFrames:ze,Router:Wt,SessionIntegration:We,System:qt,TryCatch:$e,consoleBreadcrumbsIntegration:Ua,pageBreadcrumbsIntegration:Fa,performanceIntegration:un},Symbol.toStringTag,{value:"Module"})),fn=[new Ue,new Be,new Fe,new $e,new je,un({enableNavigation:!0,enableRender:!0,enableResource:!0,enableUserTiming:!0,sampleRate:1,reportInterval:3e4})];function Ha(){return[...fn]}function za(t={}){if(!ka()){console.warn("[sentry-miniapp] Not running in a supported miniapp environment");return}const e=[...t.integrations||fn],n=E(l({},t),{integrations:e,stackParser:Jr,transport:t.transport});n.enableSourceMap!==!1&&n.integrations.push(new ze);const r={traceNetworkBody:n.traceNetworkBody};n.enableTracePropagation!==void 0&&(r.enableTracePropagation=n.enableTracePropagation),n.tracePropagationTargets!==void 0&&(r.tracePropagationTargets=n.tracePropagationTargets),n.integrations.push(new qe(r)),n.enableAutoSessionTracking!==!1&&n.integrations.push(new We);const s=n.enableNavigationBreadcrumbs!==!1,i=n.enableUserInteractionBreadcrumbs!==!1;(s||i)&&n.integrations.push(new de({enableLifecycle:s,enableUserInteraction:i})),n.enableNetworkStatusMonitoring!==!1&&n.integrations.push(new Ve),n.enableConsoleBreadcrumbs&&n.integrations.push(new he),H("miniapp",{platform:Qr(),environment:"miniapp"});const o=n.enableSystemInfo===!1?null:ee();return o&&(H("device",{brand:o.brand,model:o.model,language:o.language,system:o.system,platform:o.platform,screen_resolution:`${o.screenWidth}x${o.screenHeight}`}),H("app",{sdk_version:o.SDKVersion,version:o.version})),_a(ss,n),y().getClient()}function qa(t={}){console.warn("[sentry-miniapp] showReportDialog is deprecated and does nothing. Please build your own UI and use `Sentry.captureFeedback()` instead.")}function Wa(t){return function(...e){return Se(()=>{try{return t.apply(this,e)}catch(n){throw y().captureException(n),n}})}}function Va(t){const e=y().getClient();return e?e.captureFeedback(t):(console.warn("[sentry-miniapp] No client available for captureFeedback"),"")}ir();exports.Integrations=Ba;exports.MiniappClient=ss;exports.SDK_NAME=Yr;exports.SDK_VERSION=Re;exports.Transports=Pa;exports.addBreadcrumb=P;exports.addEventProcessor=Mo;exports.addIntegration=Ho;exports.captureEvent=vo;exports.captureException=J;exports.captureFeedback=Va;exports.captureMessage=wo;exports.captureSession=Ht;exports.close=Oo;exports.closeSession=hr;exports.defaultIntegrations=fn;exports.endSession=mt;exports.flush=xo;exports.getClient=v;exports.getCurrentScope=y;exports.getDefaultIntegrations=Ha;exports.getIsolationScope=R;exports.getPerformanceManager=es;exports.init=za;exports.isEnabled=Do;exports.lastEventId=Co;exports.makeSession=dr;exports.miniappStackParser=Jr;exports.performanceIntegration=un;exports.setContext=H;exports.setExtra=Ro;exports.setExtras=ko;exports.setTag=No;exports.setTags=Ao;exports.setUser=Po;exports.showReportDialog=qa;exports.startInactiveSpan=Qi;exports.startSession=Fr;exports.startSpan=ie;exports.updateSession=q;exports.withScope=Se;exports.wrap=Wa;
8
8
  //# sourceMappingURL=sentry-miniapp.cjs.js.map