1var c=Object.defineProperty;var m=(r,t,e)=>t in r?c(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var f=(r,t,e)=>(m(r,typeof t!="symbol"?t+"":t,e),e);import{c5 as b,W as p,H as d,bS as L,V as y,w as h,l as g,j as u,U as l}from"./index.3ec72d2e.js";import{H as R}from"./harvest-scheduler.67ce376d.js";import{c as v,A as T}from"./aggregate-base.0695104a.js";import{i as E}from"./configure.2bbcfbcf.js";import{a as S}from"./traverse.774c271e.js";import{M as H}from"./agent-constants.7157acc7.js";import{E as A}from"./event-buffer.9a33d263.js";import"./shared-context.ae8b129f.js";import"./page-visibility.2f62fa7f.js";import"./info.d5329f52.js";class N{timestamp;message;attributes;level;constructor(t,e,s={},i=p.INFO){this.timestamp=t,this.message=e,this.attributes={...s,pageUrl:v(""+b)},this.level=i.toUpperCase()}}class _ extends T{constructor(t){super(t,d),this.bufferedLogs=new A,this.harvestTimeSeconds=t.init.logging.harvestTimeSeconds,this.waitForFlags([]).then(()=>{this.scheduler=new R("browser/logs",{onFinished:this.onHarvestFinished.bind(this),retryDelay:this.harvestTimeSeconds,getPayload:this.prepareHarvest.bind(this),raw:!0},this),L(y,this.handleLog.bind(this),this.featureName,this.ee),this.drain(),this.scheduler.startTimer(this.harvestTimeSeconds,0)})}handleLog(t,e,s={},i=p.INFO){if(this.blocked)return;if((!s||typeof s!="object")&&(s={}),typeof i=="string"&&(i=i.toUpperCase()),!E(i))return h(30,i);try{if(typeof e!="string"){const o=g(e);!!o&&o!=="{}"?e=o:e=String(e)}}catch{h(16,e);return}if(typeof e!="string"||!e)return h(32);const a=new N(Math.floor(this.agentRef.runtime.timeKeeper.correctRelativeTimestamp(t)),e,s,i),n=a.message.length+g(a.attributes).length+a.level.length+10;if(!this.bufferedLogs.canMerge(n)){this.bufferedLogs.hasData?(u(l,["Logging/Harvest/Early/Seen",this.bufferedLogs.bytes+n]),this.scheduler.runHarvest({}),n<H&&this.bufferedLogs.add(a)):(u(l,["Logging/Harvest/Failed/Seen",n]),h(31,a.message.slice(0,25)+"..."));return}this.bufferedLogs.add(a)}prepareHarvest(t={}){if(this.blocked||!this.bufferedLogs.hasData)return;const e={"instrumentation.provider":"browser","instrumentation.version":this.agentRef.runtime.version,"instrumentation.name":this.agentRef.runtime.loaderType},s={qs:{browser_monitoring_key:this.agentRef.info.licenseKey},body:[{common:{attributes:{"entity.guid":this.agentRef.runtime.appMetadata?.agents?.[0]?.entityGuid,session:this.agentRef.runtime.session?.state.value||"0",hasReplay:this.agentRef.runtime.session?.state.sessionReplayMode===1,hasTrace:this.agentRef.runtime.session?.state.sessionTraceMode===1,ptid:this.agentRef.runtime.ptid,appId:this.agentRef.info.applicationID,standalone:Boolean(this.agentRef.info.sa),agentVersion:this.agentRef.runtime.version,...e}},logs:S(this.bufferedLogs.buffer,this.obfuscator.obfuscateString.bind(this.obfuscator),"string")}]};return t.retry?this.bufferedLogs.hold():this.bufferedLogs.clear(),s}onHarvestFinished(t){t.retry?this.bufferedLogs.unhold():this.bufferedLogs.held.clear()}}f(_,"featureName",d);export{_ 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.