1import{ac as c,a0 as M,ar as b,ae as u,$ as S,c as d,aE as A,bc as r,U as O,ay as R,bd as T,be as y,w as g,z as L}from"./Cd_nNH93.js";import{A as F}from"./DSGWNljW.js";import{O as v}from"./fQJp7kNU.js";import{e as f}from"./Cc8XaAEn.js";import{a as N,s as _,b as G}from"./DpWrbLnI.js";import"./K8mPX5Ll.js";import"./Wo4AIfge.js";import"./BguSgUCX.js";class I{timestamp;message;attributes;level;constructor(e,i,s={},t=c.INFO){this.timestamp=e,this.message=i,this.attributes={...s,pageUrl:M(""+b)},this.level=t.toUpperCase()}}const h="Logging/Event/";class j extends F{static featureName=u;constructor(e){super(e,u);const i=(s,t)=>{this.loggingMode={auto:s,api:t},t===void 0&&(this.loggingMode.api=s)};this.harvestOpts.raw=!0,super.customAttributesAreSeparate=!0,this.obfuscator=new v(e,S.LOG),this.ee.on(d.RESET,()=>{this.abort(f.RESET)}),this.ee.on(d.UPDATE,(s,t)=>{this.blocked||s!==A.CROSS_TAB||(t.loggingMode===r.OFF&&(!t.logApiMode||t.logApiMode===r.OFF)?this.abort(f.CROSS_TAB):i(t.loggingMode,t.logApiMode))}),this.waitForFlags(["log","logapi"]).then(([s,t])=>{if(this.blocked)return;this.loggingMode??={auto:s,api:t};const o=this.agentRef.runtime.session;if(O(e.init)&&o&&(o.state.loggingMode===null||o.state.logApiMode===null?this.#t(this.loggingMode):i(o.state.loggingMode,o.state.logApiMode)),this.loggingMode.auto===r.OFF&&this.loggingMode.api===r.OFF){this.blocked=!0,this.deregisterDrain();return}R(T,this.handleLog.bind(this),this.featureName,this.ee),this.drain(),e.runtime.harvester.triggerHarvestFor(this)})}handleLog(e,i,s={},t=c.INFO,o,a){if(this.blocked)return;const p=o?this.loggingMode.auto:this.loggingMode.api;if(!p)return;if((!s||typeof s!="object")&&(s={}),typeof t=="string"&&(t=t.toUpperCase()),!y(t))return g(30,t);if(p<(r[t]||1/0)){this.reportSupportabilityMetric(h+"Dropped/Sampling");return}try{if(typeof i!="string"){const n=L(i);n&&n!=="{}"?i=n:i=String(i)}}catch{g(16,i),this.reportSupportabilityMetric(h+"Dropped/Casting");return}if(typeof i!="string"||!i)return g(32);const l=n=>{const E=new I(Math.floor(this.agentRef.runtime.timeKeeper.correctRelativeTimestamp(e)),i,n,t);this.events.add(E)&&this.reportSupportabilityMetric(h+(o?"Auto":"API")+"/Added")};l({...s,...N(a,this)}),_(a,this)&&l({...s,...G(a,this)})}serializer(e){const i=this.agentRef.runtime.session;return[{common:{attributes:{...this.obfuscator.traverseAndObfuscateEvents(this.agentRef.info.jsAttributes),...this.harvestEndpointVersion===1&&{"entity.guid":this.agentRef.runtime.appMetadata.agents[0].entityGuid,appId:this.agentRef.info.applicationID},...i&&{session:i.state.value||"0",hasReplay:i.state.sessionReplayMode===1,hasTrace:i.state.sessionTraceMode===1},ptid:this.agentRef.runtime.ptid,standalone:!!this.agentRef.info.sa,agentVersion:this.agentRef.runtime.version,"instrumentation.provider":"browser","instrumentation.version":this.agentRef.runtime.version,"instrumentation.name":this.agentRef.runtime.loaderType}},logs:this.obfuscator.traverseAndObfuscateEvents(e)}]}queryStringsBuilder(){return{browser_monitoring_key:this.agentRef.info.licenseKey}}abort(e={}){this.reportSupportabilityMetric("Logging/Abort/".concat(e.sm)),this.blocked=!0,this.events&&(this.events.clear(),this.events.clearSave()),this.loggingMode={auto:r.OFF,api:r.OFF},this.#t(this.loggingMode),this.deregisterDrain()}#t(e){this.agentRef.runtime.session?.write({loggingMode:e.auto,logApiMode:e.api})}}export{j as Aggregate};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.