1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4570],{45130:e=>{var t={single_source_shortest_paths:function(e,s,r){var i,n,o,h,a,l,u,c={},f={};f[s]=0;var d=t.PriorityQueue.make();for(d.push(s,0);!d.empty();)for(o in n=(i=d.pop()).value,h=i.cost,a=e[n]||{})a.hasOwnProperty(o)&&(l=h+a[o],u=f[o],(void 0===f[o]||u>l)&&(f[o]=l,d.push(o,l),c[o]=n));if(void 0!==r&&void 0===f[r])throw Error(["Could not find a path from ",s," to ",r,"."].join(""));return c},extract_shortest_path_from_predecessor_list:function(e,t){for(var s=[],r=t;r;)s.push(r),e[r],r=e[r];return s.reverse(),s},find_path:function(e,s,r){var i=t.single_source_shortest_paths(e,s,r);return t.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var s,r=t.PriorityQueue,i={};for(s in e=e||{},r)r.hasOwnProperty(s)&&(i[s]=r[s]);return i.queue=[],i.sorter=e.sorter||r.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){this.queue.push({value:e,cost:t}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},25778:e=>{var t=Object.prototype.hasOwnProperty,s="~";function r(){}function i(e,t,s){this.fn=e,this.context=t,this.once=s||!1}function n(e,t,r,n,o){if("function"!=typeof r)throw TypeError("The listener must be a function");var h=new i(r,n||e,o),a=s?s+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],h]:e._events[a].push(h):(e._events[a]=h,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function h(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(s=!1)),h.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(s?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},h.prototype.listeners=function(e){var t=s?s+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,n=r.length,o=Array(n);i<n;i++)o[i]=r[i].fn;return o},h.prototype.listenerCount=function(e){var t=s?s+e:e,r=this._events[t];return r?r.fn?1:r.length:0},h.prototype.emit=function(e,t,r,i,n,o){var h=s?s+e:e;if(!this._events[h])return!1;var a,l,u=this._events[h],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,n),!0;case 6:return u.fn.call(u.context,t,r,i,n,o),!0}for(l=1,a=Array(c-1);l<c;l++)a[l-1]=arguments[l];u.fn.apply(u.context,a)}else{var f,d=u.length;for(l=0;l<d;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),c){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,r);break;case 4:u[l].fn.call(u[l].context,t,r,i);break;default:if(!a)for(f=1,a=Array(c-1);f<c;f++)a[f-1]=arguments[f];u[l].fn.apply(u[l].context,a)}}return!0},h.prototype.on=function(e,t,s){return n(this,e,t,s,!1)},h.prototype.once=function(e,t,s){return n(this,e,t,s,!0)},h.prototype.removeListener=function(e,t,r,i){var n=s?s+e:e;if(!this._events[n])return this;if(!t)return o(this,n),this;var h=this._events[n];if(h.fn)h.fn!==t||i&&!h.once||r&&h.context!==r||o(this,n);else{for(var a=0,l=[],u=h.length;a<u;a++)(h[a].fn!==t||i&&!h[a].once||r&&h[a].context!==r)&&l.push(h[a]);l.length?this._events[n]=1===l.length?l[0]:l:o(this,n)}return this},h.prototype.removeAllListeners=function(e){var t;return e?(t=s?s+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=s,h.EventEmitter=h,e.exports=h},62207:(e,t,s)=>{s.d(t,{$:()=>i});var r=class{constructor(e){this.queue=[],this.timer=null,this.flushing=!1,this.pendingFlush=!1,this._sent=0,this._failed=0,this._overflowed=0,this.batchSize=e.batchSize,this.flushIntervalMs=e.flushIntervalMs,this.sendBatch=e.sendBatch,this.onError=e.onError,this.maxQueueSize=Math.max(1,e.maxQueueSize??1e4),this.onOverflow=e.onOverflow,this.startTimer()}add(e){if(this.queue.length>=this.maxQueueSize){let e=this.queue.shift();if(this._overflowed++,e&&this.onOverflow)try{this.onOverflow(e)}catch{}}this.queue.push(e),this.queue.length>=this.batchSize&&this.flush()}async flush(){if(this.flushing){this.pendingFlush=!0;return}if(0!==this.queue.length){this.flushing=!0;try{for(;this.queue.length>0;){let e=this.queue.splice(0,this.batchSize);try{await this.sendBatch(e),this._sent+=e.length}catch(t){this._failed+=e.length,this.onError&&t instanceof Error&&this.onError(t)}this.pendingFlush=!1}}finally{this.flushing=!1,this.pendingFlush&&(this.pendingFlush=!1,this.flush())}}}destroy(){this.timer&&(clearInterval(this.timer),this.timer=null)}get size(){return this.queue.length}getStats(){return{sent:this._sent,failed:this._failed,overflowed:this._overflowed}}resetStats(){this._sent=0,this._failed=0,this._overflowed=0}startTimer(){this.timer=setInterval(()=>{this.flush()},this.flushIntervalMs)}},i=class{constructor(e){this.disabledPatterns=new Set,this.configRefreshTimer=null,this.initialized=!1,this._lastConfig=null,this._dropped=0,this.config={batchSize:10,flushIntervalMs:5e3,configRefreshSec:300,debug:!1,...e},this.queue=new r({batchSize:this.config.batchSize,flushIntervalMs:this.config.flushIntervalMs,maxQueueSize:this.config.maxQueueSize,sendBatch:e=>this.sendBatch(e),onError:e.onError?t=>e.onError(t,"sendBatch"):void 0})}
1async init(){await this.refreshConfig(),this.configRefreshTimer=setInterval(()=>this.refreshConfig(),1e3*this.config.configRefreshSec),this.initialized=!0,this.log_debug("Collector initialized")}async flush(){await this.queue.flush()}destroy(){return this.queue.destroy(),this.configRefreshTimer&&(clearInterval(this.configRefreshTimer),this.configRefreshTimer=null),this.flush()}setUser(e){this._userId=e,this.log_debug("User set:",e)}setSession(e){this._sessionId=e,this.log_debug("Session set:",e)}setModule(e){this._module=e,this.log_debug("Module set:",e)}setDevice(e){this._deviceId=e,this.log_debug("Device set:",e)}error(e,t){let{stackTrace:s,...r}=t??{};this.enqueue({type:"error",level:"error",message:e,params:Object.keys(r).length>0?r:void 0,stackTrace:s?{raw:s}:void 0})}log(e,t,s){this.enqueue({type:"log",level:e,message:t,params:s})}fatal(e,t){this.log("fatal",e,t)}warn(e,t){this.log("warn",e,t)}info(e,t){this.log("info",e,t)}debug(e,t){this.log("debug",e,t)}analytics(e,t,s){this.enqueue({type:"analytics",event:e,message:t,params:s})}async revenue(e){let t;try{t=this.buildRevenueEvent(e)}catch(e){throw this.handleError(e,"revenue"),e}if(t)try{let e=await this.doFetch("/api/collect",{method:"POST",body:JSON.stringify(t)});this.handleServerSuppression(e,t)}catch(e){this.handleError(e,"revenue")}}async revenueBatch(e){let t=[];for(let s=0;s<e.length;s++){let r;try{r=this.buildRevenueEvent(e[s])}catch(t){let e=Error(`collector.revenueBatch: input[${s}] failed validation \u2014 ${t.message}`);throw this.handleError(e,"revenueBatch"),e}r&&t.push(r)}if(0!==t.length)try{let e=await this.doFetch("/api/collect/batch",{method:"POST",body:JSON.stringify({events:t})});if(e?.errors?.length)for(let s of e.errors){let e=/pattern:\s*([^)]+)/i.exec(s.reason??"");e&&t[s.index]&&this.fireSuppressed(t[s.index],e[1].trim(),"server")}}catch(e){this.handleError(e,"revenueBatch")}}async metric(e,t){try{await this.doFetch("/api/metrics/set",{method:"POST",body:JSON.stringify({key:e,value:t})})}catch(e){this.handleError(e,"metric")}}async metricBatch(e){try{await this.doFetch("/api/metrics/batch",{method:"POST",body:JSON.stringify({ops:e})})}catch(e){this.handleError(e,"metricBatch")}}async send(e){let t=this.buildEvent(e);if(t)try{let e=await this.doFetch("/api/collect",{method:"POST",body:JSON.stringify(t)});this.handleServerSuppression(e,t)}catch(e){this.handleError(e,"send")}}async refreshConfig(){try{let e=await this.doFetch("/api/config");this.disabledPatterns=new Set(e.disabled),this._lastConfig=e,this.log_debug("Config refreshed, disabled:",e.disabled)}catch(e){this.handleError(e,"refreshConfig")}}getConfig(){return this._lastConfig}getStats(){let e=this.queue.getStats();return{sent:e.sent,dropped:this._dropped,failed:e.failed,queueSize:this.queue.size,queueOverflow:e.overflowed}}get isInitialized(){return this.initialized}buildEvent(e){let t=this.computeClassPath(e),s={type:e.type,level:e.level,event:e.event,message:e.message,params:e.params,stackTrace:e.stackTrace,platform:e.platform??this.config.platform,deviceModel:e.deviceModel??this.config.deviceModel,version:e.version??this.config.version,userId:this._userId,sessionId:this._sessionId,module:e.module??this._module,deviceId:e.deviceId??this._deviceId,timestamp:e.timestamp??new Date().toISOString(),amount:e.amount,rawAmount:e.rawAmount,token:e.token,usdValue:e.usdValue,recipientWallet:e.recipientWallet,txHash:e.txHash,reason:e.reason};return(Object.keys(s).forEach(e=>{void 0===s[e]&&delete s[e]}),this.isDisabled(t))?(this._dropped++,this.log_debug(`Event disabled: ${t}`),this.fireSuppressed(s,t,"client"),null):s}computeClassPath(e){return"analytics"===e.type||"revenue"===e.type?`${e.type}.${e.event}`:`${e.type}.${e.level}`}buildRevenueEvent(e){let t=void 0!==e.amount,s=void 0!==e.rawAmount;if(!t&&!s)throw Error("collector.revenue: one of `amount` (number) or `rawAmount` (string) is required");if(t&&s)throw Error("collector.revenue: provide either `amount` or `rawAmount`, not both");let r=e.message??this.synthesizeRevenueMessage(e);return this.buildEvent({type:"revenue",event:e.source,message:r,params:e.params,amount:e.amount,rawAmount:e.rawAmount,token:e.token,usdValue:e.usdValue,recipientWallet:e.recipientWallet,txHash:e.txHash,reason:e.reason})}synthesizeRevenueMessage(e){let t;let s=e.token.symbol,r=!1;if("number"==typeof e.amount)r=e.amount<0,t=Math.abs(e.amount).toString();else if("string"==typeof e.rawAmount){let s=e.rawAmount.trim(),i=(r=s.startsWith("-"))?s.slice(1):s;t="number"==typeof e.token.decimals?function(e,t){if("string"!=typeof e||0===e.length)return String(e);let s=e.trim().startsWith("-"),r=s?e.trim().slice(1):e.trim();if(!/^\d+$/.test(r))return e;
1if(t<=0)return(s?"-":"")+r;let i=r.padStart(t+1,"0"),n=i.slice(0,i.length-t),o=i.slice(i.length-t).replace(/0+$/,"");return(s?"-":"")+(o.length>0?`${n}.${o}`:n)}(i,e.token.decimals):i}else t="?";if(r){let r=e.reason??"cost";return`Cost (${r}): ${t} ${s}`}return`Revenue: ${t} ${s}`}enqueue(e){let t=this.buildEvent(e);t&&this.queue.add(t)}isDisabled(e){if(this.disabledPatterns.has(e))return!0;let t=e.split(".")[0];return!!(this.disabledPatterns.has(`${t}.*`)||this.disabledPatterns.has(t)||this.disabledPatterns.has("*"))}async sendBatch(e){let t=await this.doFetch("/api/collect/batch",{method:"POST",body:JSON.stringify({events:e})});if(t?.errors?.length)for(let s of t.errors){let t=/pattern:\s*([^)]+)/i.exec(s.reason??"");t&&e[s.index]&&this.fireSuppressed(e[s.index],t[1].trim(),"server")}this.log_debug(`Sent batch of ${e.length} events`)}async doFetch(e,t){let s=await globalThis.fetch(`${this.config.baseUrl}${e}`,{...t,cache:"no-store",headers:{"Content-Type":"application/json","x-api-key":this.config.apiKey,"Cache-Control":"no-cache",...t?.headers}});if(!s.ok)throw Error(`Collector API error: ${s.status} ${s.statusText}`);return s.json()}handleError(e,t){this.log_debug(`Failed ${t}:`,e),this.config.onError&&e instanceof Error&&this.config.onError(e,t)}handleServerSuppression(e,t){e&&!1===e.ok&&e.pattern&&this.fireSuppressed(t,e.pattern,"server")}fireSuppressed(e,t,s){if(this.config.onSuppressed)try{this.config.onSuppressed(e,t,s)}catch(e){this.log_debug("onSuppressed callback threw:",e)}}log_debug(...e){this.config.debug&&console.debug("[collector]",...e)}}},29761:(e,t,s)=>{s.d(t,{A:()=>i,b:()=>r});var r=s(25778);let i=r}}]);
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.