// /* Software Copyright License Agreement (BSD License) Copyright (c) 2011, Yahoo! Inc. Copyright (c) 2011-2012, Log-Normal, Inc. Copyright (c) 2012-2017, SOASTA, Inc. Copyright (c) 2017-2019, Akamai Technologies, Inc. All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ (()=>{"use strict";const t={r:void 0,autorun:!0,onloadfired:!1},e={BEACON_TYPE_SPAS:["spa","spa_hard"],MAX_GET_LENGTH:2e3,DEBUG:!1},i=t=>"[object Array]"===Object.prototype.toString.call(t),n=()=>!(window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.match(/Trident.*rv[ :]*11\./))&&window&&window.MutationObserver&&"function"==typeof window.MutationObserver,o=()=>{try{if(window)return"performance"in window&&window.performance?window.performance:window.msPerformance||window.webkitPerformance||window.mozPerformance}catch(t){}},s=i,a=(t,e)=>{var i;if(void 0===t||void 0===e||!e.length)return!1;for(i=0;i{if(!t||i(t))return"";if(void 0!==e&&t&&t.length>e){var n=t.indexOf("?");t=-1!==n&&nwindow.JSON?JSON.stringify(t):"",c=()=>window.innerHeight||window.document.documentElement.clientHeight||window.document.body.clientHeight,h=n,d=o,u={"c.b":"Page Busy percentage (Base-10)","c.c.r":"Rage click count (Base-10)","c.c":"Click count (Base-10)","c.cls":"Cumulative Layout Shift score (since last beacon) (Base-10 fraction)","c.e":"Continuity Epoch timestamp (when everything started measuring) (Base-36)","c.f.d":"Frame Rate duration (how long it has been measuring) (milliseconds) (Base-10)","c.f.l":"Number of Long Frames (>= 50ms) (Base-10)","c.f.m":"Minimum Frame Rate (Base-10) per `COLLECTION_INTERVAL`","c.f.s":"Frame Rate measurement start timestamp (Base-36)","c.f":"Average Frame Rate over the Frame Rate Duration (Base-10)","c.fid":"First Input Delay (milliseconds) (Base-10)","c.i.a":"Average interaction delay (milliseconds) (Base-10)","c.i.dc":"Delayed interaction count (Base-10)","c.i.dt":"Delayed interaction time (milliseconds) (Base-10)","c.k.e":"Keyboard ESC count (Base-10)","c.k":"Keyboard event count (Base-10)","c.l":"Log (compressed)","c.lb":"Last Beacon timestamp (Base-36)","c.lt.n":"Number of Long Tasks (Base-10)","c.lt.tt":"Total duration of Long Tasks (milliseconds) (Base-10)","c.lt":"Long Task data (compressed)","c.m.n":"Mouse movement pixels (Base-10)","c.m.p":"Mouse movement percentage (Base-10)","c.s.d":"Distinct scrolls (scrolls that happen 2 seconds after the last) (Base-10)","c.s.p":"Scroll percentage (Base-10)","c.s.y":"Scroll y (pixels) (Base-10)","c.s":"Scroll count (Base-10)","c.t.click":"Click timeline (compressed)","c.t.domln":"DOM Length timeline (compressed)","c.t.domsz":"DOM Size timeline (compressed)","c.t.fps":"Frame Rate timeline (compressed)","c.t.inter":"Interactions timeline (compressed)","c.t.interdly":"Delayed Interactions timeline (compressed)","c.t.key":"Keyboard press timeline (compressed)","c.t.longtask":"LongTask timeline (compressed)","c.t.mem":"Memory usage timeline (compressed)","c.t.mouse":"Mouse movements timeline (compressed)","c.t.mousepct":"Mouse movement percentage (of full screen) timeline (compressed)","c.t.scroll":"Scroll timeline (compressed)","c.t.scrollpct":"Scroll percentage (of full page) timeline (compressed)","c.t.mut":" DOM Mutations timeline (compressed)","c.ttfi":"Time to First Interaction (milliseconds) (Base-10)","c.tti.fr":"Framework Ready (milliseconds) (Base-10)","c.tti.hi":"Hero Images ready (milliseconds) (Base-10)","c.tti.m":"Time to Interactive Method (`lt`, `raf`, `b`)","c.tti.vr":"Visually Ready (milliseconds) (Base-10)","c.tti":"Time to Interactive (milliseconds) (Base-10)","et.fid":"First Input Delay (milliseconds) (Base-10)","pt.fp":"first-paint in DOMHighResTimestamp","pt.fcp":"first-contentful-paint in DOMHighResTimestamp","pt.lcp":"largest-contentful-paint in DOMHighResTimestamp","pt.hid":"The document was loaded hidden (at some point), so FP and FCP are user-driven events, and thus won't be added to the beacon",v:"Bolt version",sv:"Bolt Loader Snippet version",sm:"Bolt Loader Snippet method",u:"The page's URL (for most beacons), or the XMLHttpRequest URL",n:"The beacon number",pgu:"The page's URL (for XMLHttpRequest beacons)",pid:"Page ID (8 characters)",r:"Navigation referrer (from document.location)","vis.pre":"1 if the page transitioned from prerender to visible","vis.st":"Document's visibility state when beacon was sent","vis.lh":"Timestamp when page was last hidden","vis.lv":"Timestamp when page was last visible","xhr.pg":"The XMLHttpRequest page group",errors:"Error messages of errors detected in Bolt code, separated by a newline","rt.si":"Session ID","rt.ss":"Session start timestamp","rt.sl":"Session length (number of pages), can be increased by XHR beacons as well","ua.plt":"navigator.platform","ua.vnd":"navigator.vendor","c.expndlg":"Log (Decompressed)","c.expndta":"Expanded Timeline Data","c.expndlt":"Expanded Long Task Data","c.load":"Load event duration - start navigation to event fired (milliseconds) (Base-10)","c.dcl":"DOMContentLoaded event duration - start navigation to event fired (milliseconds) (Base-10)","c.vls":"Vice Loading Stage (possible values: 0/1)","c.vo":"Vice On - weather vice should be loaded or not (possible values: 0/1)","c.ttfb":"Page's HTML time to first byte in milliseconds"},m=t=>{const e={};return Object.entries(t).forEach((([t,i])=>{let n=u[t];n?(n=`"${t}" / ${n}`,e[n]=i):e[t]=i})),e},g=t=>u[t];class p{static excludeDataByKeys(t,e){const i=new Set(e);return p.filterObject(t,((t,e)=>!i.has(e)||!g(e)))}static includeDataByKeys(t,e){let i=e instanceof Array,n=i?e:Object.keys(e);const o=new Set(n);let s=p.filterObject(t,((t,e)=>o.has(e)&&g(e)));return i||(s=p.convertKeys(s,e)),s}static filterObject(t,e){return Object.fromEntries(Object.entries(t).filter((([t,i])=>e(i,t))))}static convertKeys(t,e){let i={},n=Object.keys(t);for(let o of n)e[o]&&(i[e[o]]=t[o]);return i}}const M=p;class v{constructor({beaconUrl:t,beaconUrlsAllowed:e=[],beaconUrlForceHttps:i=!1,beaconType:n="GET",beaconAuthToken:o,beaconAuthKey:s,beaconDisableSendBeacon:a=!1,beaconWithCredentials:r=!1,beaconFilterIncludeData:l=null,beaconFilterExcludeData:c=[]}){this.beaconQueued=!1,this.beaconsSent=0,this.hasSentPageLoadBeacon=!1,this.beaconUrl=t,this.beaconUrlsAllowed=e,this.beaconUrlForceHttps=i,this.beaconType=n,this.beaconAuthToken=o,this.beaconAuthKey=s,this.beaconDisableSendBeacon=a,this.beaconWithCredentials=r,this.beaconFilterExcludeData=c,this.beaconFilterIncludeData=l}addToBeacon(t,e,i){0!==e&&void 0!==e||i?v.Bolt.variableManager.addVar(t,e,!0):v.Bolt.variableManager.removeVar(t)}realSendBeacon(){let e,i=[],n={};if(!this.beaconQueued)return!1;const o=v.Bolt.variableManager;this.beaconQueued=!1;const s=v.Bolt.pluginManager.getPlugins();for(e in s)if(!s[e].isComplete())return!1;if(!(window&&window.Image&&window.navigator&&v.Bolt.window))return console.warn("DOM not fully available, not sending a beacon"),!1;const l=a(o.getVar("http.initiator"),v.Bolt.CONSTANTS.BEACON_TYPE_SPAS),c=void 0===o.getVar("http.initiator")||l;if(!o.getVar("pgu")){const t=l?v.Bolt.document.URL:v.Bolt.document.URL.replace(/#.*/,"");o.setVar("pgu",t)}o.setVar("pgu",r(v.Bolt.variableManager.getVar("pgu"))),o.getVar("u")&&!l||o.setVar("u",v.Bolt.variableManager.getVar("pgu")),o.getVar("pgu")===v.Bolt.variableManager.getVar("u")&&o.removeVar("pgu"),t.r?o.setVar("r",r(t.r)):o.removeVar("r"),o.setVar("v",v.Bolt.version),v.Bolt.snippetVersion&&o.setVar("sv",v.Bolt.snippetVersion),o.setVar("sm",v.Bolt.snippetMethod||"i");const h=v.Bolt.eventManager;v.Bolt.visibilityState()&&(o.setVar("vis.st",v.Bolt.visibilityState()),h.getLastVisibilityEvent().visible&&o.setVar("vis.lv",v.Bolt.now()-h.getLastVisibilityEvent().visible),h.getLastVisibilityEvent().hidden&&o.setVar("vis.lh",v.Bolt.now()-h.getLastVisibilityEvent().hidden)),o.setVar("ua.plt",navigator.platform),o.setVar("ua.vnd",navigator.vendor),v.Bolt.pageId&&o.setVar("pid",v.Bolt.pageId),o.setVar("n",++this.beaconsSent),v.Bolt.window!==window&&o.setVar("if","");const d=v.Bolt.errorManager,u=d.getErrors();for(e in u)u[e]&&i.push(e+(u[e]>1?" (*"+u[e]+")":""));i.length>0&&o.setVar("errors",i.join("\n")),d.clearErrors(),h.fireEvent("before_beacon",o.getVars());const m=o.getVars();for(e in m)m[e]&&(n[e]=m[e]);if(o.removeVar(["qt","pgu"]),void 0===o.getVar("early")){const t=o.getSingleBeaconVars();for(let e in t)t[e]&&o.removeVar(e);o.clearSingleBeaconVars(),!this.hasSentPageLoadBeacon&&c&&(this.hasSentPageLoadBeacon=!0,v.Bolt.setImmediate((function(){h.fireEvent("page_load_beacon",n)})))}return this.beaconInQueue=!1,this.sendBeaconData(n),!0}beaconUrlAllowed(t){if(!this.beaconUrlsAllowed||0===this.beaconUrlsAllowed.length)return!0;for(let e=0;e{this.sendBeaconWhenReady(t,e,i)}),null,this,!0);else{this.beaconInQueue=!0;for(let e in t)t[e]&&v.Bolt.variableManager.addVar(e,t[e],!0);"function"==typeof e&&void 0!==i&&e.apply(i),this.sendBeacon()}}sendBeaconData(t){if(e.DEBUG&&console.log(m(t)),this.beaconUrl=this.beaconUrlOverride||this.beaconUrl,!this.beaconUrl)return!1;if(!this.beaconUrlAllowed(this.beaconUrl))return!1;if((t=>{for(let e in t)if(t[e])return!1;return!0})(t))return!1;const i=v.Bolt.eventManager;let n=null;this.beaconFilterIncludeData?n=M.includeDataByKeys(t,this.beaconFilterIncludeData):this.beaconFilterExcludeData&&(n=M.excludeDataByKeys(t,this.beaconFilterExcludeData)),e.DEBUG&&console.log(n||t),i.fireEvent("beacon",n||t),i.dispatchEvent("BOLT_DATA",n||t)}setBeaconFilterIncludeData(t){this.beaconFilterIncludeData=t}setBeaconFilterExcludeData(t){this.beaconFilterExcludeData=t}}const f=v;class b{static supportsPassive(){if(void 0===b.results.supportsPassive){if(b.results.supportsPassive=!1,!Object.defineProperty)return!1;try{const t=Object.defineProperty({},"passive",{get:function(){return b.results.supportsPassive=!0}});window.addEventListener("test",null,t)}catch(t){}}return b.results.supportsPassive}}b.results={};const w=b;class T{constructor(){this.lastVisibilityEvent={},this.events={},this.listenerCallbacks={},this.translateEvents={onbeacon:"beacon",onconfig:"config",onerror:"error",onxhrerror:"xhr_error"},this.publicEvents={before_beacon:"onBeforeBoltBeacon",beacon:"onBoltBeacon",onBoltLoaded:"onBoltLoaded"},this.unloadEventsCount=0,this.unloadEventCalled=0,this.setupCreateCustomEvent()}setupCreateCustomEvent(){try{void 0!==new window.CustomEvent("CustomEvent")&&(this.createCustomEvent=(t,e)=>new window.CustomEvent(t,e))}catch(t){}try{!this.createCustomEvent&&document.createEvent&&document.createEvent("CustomEvent")&&(this.createCustomEvent=(t,e)=>{const i=document.createEvent("CustomEvent");return e=e||{cancelable:!1,bubbles:!1},i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i})}catch(t){}!this.createCustomEvent&&document.createEventObject&&(this.createCustomEvent=(t,e)=>{const i=document.createEventObject();return i.type=i.propertyName=t,i.detail=e.detail,i}),this.createCustomEvent||(this.createCustomEvent=()=>{})}getLastVisibilityEvent(){return this.lastVisibilityEvent}registerEvent(t){return this.events[t]||(this.events[t]=[]),this}disable(){this._clearEvents(),this._clearListeners()}createCustomEvent(){}dispatchEvent(t,e,i){const n=this.createCustomEvent(t,{detail:e});function o(){try{document.dispatchEvent?document.dispatchEvent(n):document.fireEvent&&document.fireEvent("onpropertychange",n)}catch(e){console.error("Error when dispatching "+t)}}n&&(i?T.Bolt.setImmediate(o):o())}fireEvent(t,e){let i,n,o,s;if(t=t.toLowerCase(),this.translateEvents[t]&&(t=this.translateEvents[t]),this.events[t]){for(this.publicEvents[t]&&this.dispatchEvent(this.publicEvents[t],e),o=this.events[t],"before_beacon"!==t&&"beacon"!==t&&"before_early_beacon"!==t&&T.Bolt.beaconManager.realSendBeacon(),s=o.length,i=0;i{i&&i.call(o,t||window.event,n),++this.unloadEventCalled===this.unloadEventsCount&&T.Bolt.beaconManager.realSendBeacon()};"page_unload"===e&&(T.Bolt.window.onpagehide||null===T.Bolt.window.onpagehide?T.Bolt.eventManager.addListener(T.Bolt.window,"pagehide",t):T.Bolt.eventManager.addListener(T.Bolt.window,"unload",t)),T.Bolt.eventManager.addListener(T.Bolt.window,"beforeunload",t)}return this}addListener(t,e,i,n){let o=!1;t.addEventListener?("object"==typeof n?o=n:"boolean"==typeof n&&n&&w.supportsPassive()&&(o={capture:!1,passive:!0}),t.addEventListener(e,i,o)):t.attachEvent&&t.attachEvent("on"+e,i),this.listenerCallbacks[e]=this.listenerCallbacks[e]||[],this.listenerCallbacks[e].push({el:t,fn:i})}removeListener(t,e,i){if(t.removeEventListener?t.removeEventListener(e,i,!1):t.detachEvent&&t.detachEvent("on"+e,i),this.listenerCallbacks[e])for(let n=0;n{const t=o();return document.readyState&&"complete"===document.readyState||t&&t.timing&&t.timing.loadEventStart>0})()?E.Bolt.setImmediate(t,null,null,E.Bolt):window.onpagehide||null===window.onpagehide?E.Bolt.eventManager.addListener(window,"pageshow",t):E.Bolt.eventManager.addListener(window,"load",t)}static pageReady(e,i){let n;i||"number"!=typeof e||(n=e,e=null),e||(e=window.event),e||(e={name:"load"}),i||(e.timing=e.timing||{},e.timing.loadEventEnd=n||E.Bolt.now(),E.Bolt.variableManager.addVar("pr",1,!0)),t.onloadfired||(E.Bolt.eventManager.fireEvent("page_ready",e),t.onloadfired=!0)}}const S=E;class B{constructor(){this.errors={}}addError(t,e,i){let n;"string"!=typeof t&&(n=String(t),n.match(/^\[object/)&&(n=t.name+": "+(t.description||t.message).replace(/\r\n$/,"")),t=n),void 0!==e&&(t="["+e+":"+B.Bolt.now()+"] "+t),i&&(t+=":: "+i),this.errors[t]?this.errors[t]++:this.errors[t]=1}getErrors(){return this.errors}clearErrors(){this.errors={}}}const O=B;class L{static injectMany(t,e,i){e.forEach((e=>L.inject(t,e,i)))}static inject(t,e,i){e[t]=i}}const _=L;class I{constructor(){return S.attachPageReady((()=>{setTimeout((()=>{this.getPerformanceResourceTiming()}),5e3)})),this}getPerformanceResourceTiming(){if(!this.isSupported())return;const t=d();t.setResourceTimingBufferSize(500);const e=t.getEntriesByType("resource").filter((t=>"script"===t.initiatorType)).map((t=>{const e={cs:Math.ceil(t.connectStart,!0),dbs:t.decodedBodySize,dle:Math.ceil(t.domainLookupEnd,!0),dls:Math.ceil(t.domainLookupStart,!0),ebs:t.encodedBodySize,et:t.entryType,fs:Math.ceil(t.fetchStart,!0),it:t.initiatorType,n:l(t.name),nhp:t.nextHopProtocol,rde:Math.ceil(t.redirectEnd,!0),d:Math.ceil(t.duration,!0),rds:Math.ceil(t.redirectStart,!0),rqs:Math.ceil(t.requestStart,!0),rse:Math.ceil(t.responseEnd,!0),scs:Math.ceil(t.secureConnectionStart,!0),strt:Math.ceil(t.startTime,!0),ts:t.transferSize,ws:Math.ceil(t.workerStart,!0),ce:Math.ceil(t.connectEnd,!0)};return Object.entries(e).forEach((([t,i])=>{0===i&&delete e[t]})),e}));I.Bolt.eventManager.dispatchEvent("BOLT_NETWORK",e)}isSupported(){let t=d();return t&&t.getEntries}}const P=I;class C{static init({beaconFilterData:t,environment:e}){if(t){const{includeDataByKeys:e,excludeDataByKeys:i}=t;e?C.beaconManager.setBeaconFilterIncludeData(e):i&&C.beaconManager.setBeaconFilterExcludeData(i)}C.environment=e,S.attachPageReady(C.pageReadyAutoRun)}static pageReadyAutoRun(e){t.autorun&&S.pageReady(e,!0)}static getPerformance(){try{if(C.window)return"performance"in C.window&&C.window.performance?C.window.performance:C.window.msPerformance||C.window.webkitPerformance||C.window.mozPerformance}catch(t){}}static setup(){_.injectMany("Bolt",[f,y,O,S,P],C),C._setupNowFunction(),C._setupVisibilityState(),C._setupFrame(),C.network||(C.network=new P)}static _setupFrame(){const t=C.document.createElement("iframe");return t.src="about:blank",t.setAttribute("style","visibility: hidden;position: absolute;height: 0px; width: 0px"),t.width=0,t.height=0,(C.document.head||C.document.documentElement).appendChild(t),t.contentWindow}static _setupNowFunction(){const t=this.getPerformance();try{t&&"function"==typeof t.now&&/\[native code\]/.test(String(t.now))&&t.timing&&t.timing.navigationStart&&(C.now=function(){return Math.round(t.now()+t.timing.navigationStart)})}catch(t){}}static _setupVisibilityState(){void 0!==C.document.hidden?(C.visibilityStateKey="visibilityState",C.visibilityChangeKey="visibilitychange"):void 0!==C.document.mozHidden?(C.visibilityStateKey="mozVisibilityState",C.visibilityChangeKey="mozvisibilitychange"):void 0!==C.document.msHidden?(C.visibilityStateKey="msVisibilityState",C.visibilityChangeKey="msvisibilitychange"):void 0!==C.document.webkitHidden&&(C.visibilityStateKey="webkitVisibilityState",C.visibilityChangeKey="webkitvisibilitychange")}static now(){return Date.now()||(new Date).getTime()}static visibilityState(){return void 0===C.visibilityStateKey?"visible":C.document[C.visibilityStateKey]}static setImmediate(t,e,i,n){let o;o=function(){t.call(n||null,e,i||{},void 0),o=null},C.window.requestIdleCallback?C.window.requestIdleCallback(o,{timeout:1e3}):C.window.setImmediate?C.window.setImmediate(o):setTimeout(o,10)}static hrNow(){let t,e=C.getPerformance();return e&&e.now?t=e.now():console.warn("Need RT plugin!"),t}}C.window=window,C.document=window.document,C.frame=C._setupFrame(),C.CONSTANTS=e,C.pluginManager=new class{constructor(){this.plugins={}}getPlugins(){return this.plugins}registerPlugin(t,e){this.plugins[t]=e}getPlugin(t){return this.plugins[t]}erasePlugin(t){delete this.plugins[t]}},C.variableManager=new class{constructor(){this.vars={},this.singleBeaconVars={},this.varPriority={}}getVars(){return this.vars}getSingleBeaconVars(){return this.singleBeaconVars}addVar(t,e,i){if("string"==typeof t)this.vars[t]=e,i&&(this.singleBeaconVars[t]=1);else if("object"==typeof t){const e=t;for(const t in e)e[t]&&(this.vars[t]=e[t],i&&(this.singleBeaconVars[t]=1))}return this}appendVar(t,e){let i=this.getVar(t)||"";return i&&(i+=","),this.addVar(t,i+e),this}removeVar(t){let e;if(!arguments.length)return this;e=1===arguments.length&&s(t)?t:arguments;for(let t=0;tk.entries.length,averageDuration:()=>{if(0===k.entries.length)return 0;for(var t=0,e=0;ek.firstInputDelay,timeToFirstInteraction:()=>k.timeToFirstInteraction},F=R.getPerformance(),U={COLLECTION_INTERVAL:100,DEFAULT_AFTER_ONLOAD_MAX_LENGTH:6e4,TIME_TO_INTERACTIVE_WAIT_POLL_PERIOD:500,COMPRESS_MODE_SMALL_NUMBERS:0,COMPRESS_MODE_LARGE_NUMBERS:1,COMPRESS_MODE_PERCENT:2,LOG_TYPE_SCROLL:0,LOG_TYPE_CLICK:1,LOG_TYPE_MOUSE:2,LOG_TYPE_KEY:3,LOG_TYPE_VIS:4,LOG_TYPE_ORIENTATION:5,BASE64_NUMBER:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_",LARGE_NUMBER_WRAP:".",listenerOpts:{passive:!0,capture:!0},p:F,externalMetrics:Object.assign({},V),epoch:F&&F.timing&&F.timing.navigationStart?F.timing.navigationStart:R.now(),compressJson:t=>window.JSON?JSON.stringify(t):""},Y={LONG_FRAME_MAX:50};class z{constructor(t,e){this.win=t,this.timeline=e,this.timeline.register("fps",U.COMPRESS_MODE_SMALL_NUMBERS),this.totalFrames=0,this.longFrames=0,this.frameStartTime,this.lastFrame,this.enabled=!0,this._setupFrameStartTime(),t.requestAnimationFrame(this.frame.bind(this)),this.setupExternalMetrics()}setupExternalMetrics(){const t=U.externalMetrics;t.fps=()=>{const e=t.fpsDuration();if(e)return Math.floor(this.totalFrames/(e/1e3))},t.fpsDuration=()=>{if(this.frameStartTime)return R.now()-this.frameStartTime},t.fpsMinimum=()=>{if(U.externalMetrics.fpsDuration()){const t=this.timeline.getStats("fps",this.frameStartTime).min;return t!==1/0?t:void 0}},t.fpsLongFrames=()=>this.longFrames,t.fpsStart=()=>this.frameStartTime?this.frameStartTime.toString(36):0}frame(t){this.enabled&&(t-this.lastFrame>=Y.LONG_FRAME_MAX&&this.longFrames++,this.lastFrame=t,this.totalFrames++,this.timeline.increment("fps"),this.win.requestAnimationFrame(this.frame.bind(this)))}analyze(t){const e=U.externalMetrics;R.beaconManager.addToBeacon("c.f",e.fps()),R.beaconManager.addToBeacon("c.f.d",e.fpsDuration()),R.beaconManager.addToBeacon("c.f.m",e.fpsMinimum()),R.beaconManager.addToBeacon("c.f.l",e.fpsLongFrames()),R.beaconManager.addToBeacon("c.f.s",e.fpsStart())}stop(){this.enabled=!1,this.frameStartTime=0}onBeacon(){this.enabled&&(this.frameStartTime=R.now()),this.totalFrames=0,this.longFrames=0}_setupFrameStartTime(){this.frameStartTime=R.now()}}z.CONSTANTS=Y;const H=z,K={monitorLongTasks:!0,monitorPageBusy:!0,monitorFrameRate:!0,monitorInteractions:!0,monitorStats:!0,monitorLayoutShifts:!0,monitorPageAndDOMMonitor:!0,afterOnload:!1,afterOnloadMaxLength:U.DEFAULT_AFTER_ONLOAD_MAX_LENGTH,afterOnloadMinWait:5e3,waitAfterOnload:7e3,ttiWaitForFrameworkReady:!1,ttiWaitForHeroImages:!1,sendLog:!0,sendTimeline:!0,logMaxEntries:100,initialized:!1,complete:!1,isSpa:!1,firedPageReady:!1,afterOnloadMonitoring:!0,frameworkReady:null,timeline:null,ttiMethod:null,longTaskMonitor:null,pageBusyMonitor:null,frameRateMonitor:null,interactionMonitor:null,scrollMonitor:null,clickMonitor:null,keyMonitor:null,mouseMonitor:null,visibilityMonitor:null,orientationMonitor:null,touchStartMonitor:null,mouseDownMonitor:null,pointerDownMonitor:null,statsMonitor:null,layoutShiftMonitor:null,pageAndDOMMonitor:null,monitors:["timeline","longTaskMonitor","pageBusyMonitor","frameRateMonitor","scrollMonitor","keyMonitor","clickMonitor","mouseMonitor","interactionMonitor","visibilityMonitor","orientationMonitor","statsMonitor","layoutShiftMonitor","pageAndDOMMonitor","touchStartMonitor","mouseDownMonitor","pointerDownMonitor"],timeOfLastBeacon:0,hasAddedDataToBeacon:!1,isSafari:window&&window.navigator&&window.navigator.vendor&&-1!==window.navigator.vendor.indexOf("Apple"),onBeforeBeacon:function(){K.runAllAnalyzers()},runAllAnalyzers:function(){if(K.hasAddedDataToBeacon)return;const t=K.monitors.length;for(let e=0;ei&&-1!==i?(K.complete=!0,R.beaconManager.sendBeacon()):(K.timeline.analyze(),U.externalMetrics.timeToInteractive()?(K.complete=!0,R.beaconManager.sendBeacon()):setTimeout(e,U.TIME_TO_INTERACTIVE_WAIT_POLL_PERIOD))}),U.TIME_TO_INTERACTIVE_WAIT_POLL_PERIOD)}else K.complete=!0},addToBeacon:function(t,e,i){0!==e&&void 0!==e||i?R.variableManager.addVar(t,e,!0):R.variableManager.removeVar(t)}},G=K,X={INTERACTION_MAX_DELAY:50,INTERACTION_MIN_WAIT_FOR_BEACON:0,INTERACTION_MAX_WAIT_FOR_BEACON:3e4},W=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,this.keyCount=0,this.escKeyCount=0,this.setupExternalMetrics(),this.setupBindings(),R.eventManager.addListener(t.document,"keydown",this.boundOnKeyDown,U.listenerOpts)}setupBindings(){this.boundOnKeyDown=this.onKeyDown.bind(this)}setupExternalMetrics(){U.externalMetrics.keyCount=()=>this.keyCount,U.externalMetrics.keyEscapes=()=>this.escKeyCount}onKeyDown(t){const e=R.now();this.keyCount++,27===t.keyCode&&this.escKeyCount++,this.timeline.increment("key"),this.timeline.log(U.LOG_TYPE_KEY,e),t.cancelable&&this.interactionMonitor.interact("key",e,t)}analyze(t){const e=R.beaconManager;e.addToBeacon("c.k",U.externalMetrics.keyCount()),e.addToBeacon("c.k.e",U.externalMetrics.keyEscapes())}stop(){R.eventManager.removeListener(this.win.document,"keydown",this.boundOnKeyDown)}onBeacon(){this.keyCount=0,this.escKeyCount=0}},j=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,this.enabled=!0,this.setupBindings(),R.eventManager.addListener(window,"mousedown",this.boundOnMouseDown,U.listenerOpts)}setupBindings(){this.boundOnMouseDown=this.onMouseDown.bind(this)}onMouseDown(t){if(!this.enabled||!t.cancelable)return;const e=R.now();this.interactionMonitor.interact("md",e,t)}stop(){this.enabled=!1,R.eventManager.removeListener(this.win,"mousedown",this.boundOnMouseDown)}},q=10,Q=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,e.register("mouse",U.COMPRESS_MODE_SMALL_NUMBERS),e.register("mousepct",U.COMPRESS_MODE_PERCENT),this.lastX=0,this.lastY=0,this.lastLogX=0,this.lastLogY=0,this.intervalMousePct=0,this.totalMousePct=0,this.totalMousePixels=0,this.reportMousePctInterval=!1,this.reportMouseLogInterval=!1,this.screenPixels=Math.round(Math.sqrt(Math.pow(c(),2)+Math.pow(window.innerWidth||window.document.documentElement.clientWidth||window.document.body.clientWidth,2))),this.setupExternalMetrics(),this.setupBindings(),this.reportMousePctInterval=setInterval(this.reportMousePct.bind(this),U.COLLECTION_INTERVAL),this.reportMouseLogInterval=setInterval(this.reportMouseLog.bind(this),U.REPORT_LOG_INTERVAL),R.eventManager.addListener(t.document,"mousemove",this.boundOnMouseMove,U.listenerOpts)}setupBindings(){this.boundOnMouseMove=this.onMouseMove.bind(this)}setupExternalMetrics(){U.externalMetrics.mousePct=()=>this.totalMousePct,U.externalMetrics.mousePixels=()=>this.totalMousePixels}onMouseMove(t){const e=t.clientX,i=t.clientY,n=Math.round(Math.sqrt(Math.pow(this.lastY-i,2)+Math.pow(this.lastX-e,2))),o=Math.round(n/this.screenPixels*100);this.intervalMousePct+=o,this.totalMousePct+=o,this.totalMousePixels+=n,this.lastX=e,this.lastY=i,this.timeline.increment("mouse",n)}reportMousePct(){const t=Math.min(this.intervalMousePct,100);0!==t&&this.timeline.set("mousepct",t),this.intervalMousePct=0}reportMouseLog(){this.lastLogX===this.lastX&&this.lastLogY===this.lastY||Math.round(Math.sqrt(Math.pow(this.lastLogY-this.lastY,2)+Math.pow(this.lastLogX-this.lastX,2)))>=q&&(this.timeline.log(U.LOG_TYPE_MOUSE,R.now(),{x:this.lastX,y:this.lastY}),this.lastLogX=this.lastX,this.lastLogY=this.lastY)}analyze(t){const e=R.beaconManager;e.addToBeacon("c.m.p",U.externalMetrics.mousePct()),e.addToBeacon("c.m.n",U.externalMetrics.mousePixels())}stop(){this.reportMousePctInterval&&(clearInterval(this.reportMousePctInterval),this.reportMousePctInterval=!1),this.reportMouseLogInterval&&(clearInterval(this.reportMouseLogInterval),this.reportMouseLogInterval=!1),R.eventManager.removeListener(this.win.document,"mousemove",this.boundOnMouseMove)}onBeacon(){this.totalMousePct=0,this.totalMousePixels=0}},J=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,e.register("orn",U.COMPRESS_MODE_SMALL_NUMBERS),this.enabled=!0,this.setupBindings(),R.eventManager.addListener(t,"orientationchange",this.boundOnOrientationChange,U.listenerOpts)}setupBindings(){this.boundOnOrientationChange=this.onOrientationChange.bind(this)}onOrientationChange(t){const e=R.now();let i=window.orientation;if(!this.enabled)return;this.timeline.increment("orn");const n=window.screen&&(screen.orientation||screen.msOrientation||screen.mozOrientation||{});n&&"number"==typeof n.angle&&(i=screen.orientation.angle),"number"==typeof i&&this.timeline.log(U.LOG_TYPE_ORIENTATION,e,{a:i})}stop(){this.enabled=!1,R.eventManager.removeListener(this.win,"orientationchange",this.boundOnOrientationChange)}},$=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,this.enabled=!0,this.now=null,this.originalEvent=null,this.setupBindings(),R.eventManager.addListener(t,"pointerdown",this.boundOnPointerDown,U.listenerOpts),R.eventManager.addListener(t,"pointercancel",this.boundStop,U.listenerOpts)}setupBindings(){this.boundOnPointerDown=this.onPointerDown.bind(this),this.boundOnPointerUp=this.onPointerUp.bind(this),this.boundStop=this.stop.bind(this)}onPointerUp(){this.enabled&&(this.interactionMonitor.interact("pd",this.now,this.originalEvent),this.now=null,this.originalEvent=null,R.eventManager.removeListener(this.win,"pointerup",this.boundOnPointerUp))}onPointerDown(t){this.enabled&&t.cancelable&&(this.now=R.now(),this.originalEvent=t,R.eventManager.addListener(this.win,"pointerup",this.boundOnPointerUp,U.listenerOpts))}stop(){this.enabled=!1,R.eventManager.removeListener(this.win,"pointerdown",this.boundOnPointerDown),R.eventManager.removeListener(this.win,"pointerup",this.boundOnPointerUp),R.eventManager.removeListener(this.win,"pointercancel",this.boundStop)}},Z=2e3,tt=20,et=class{constructor(t,e,i){t&&t.document&&t.document.documentElement&&(this.win=t,this.timeline=e,this.interactionMonitor=i,this.lastY=0,this.lastYLogged=0,this.intervalScrollPct=0,this.totalScrollPct=0,this.scrollCount=0,this.scrollPixels=0,this.distinctScrollCount=0,this.lastScroll=0,this.collectionInterval=!1,this.body=t.document.body,this.html=t.document.documentElement,e.register("scroll",U.COMPRESS_MODE_SMALL_NUMBERS),e.register("scrollpct",U.COMPRESS_MODE_PERCENT),this.documentHeight=Math.max(this.body.scrollHeight,this.body.offsetHeight,this.html.clientHeight,this.html.scrollHeight,this.html.offsetHeight)-c(),this.setupExternalMetrics(),this.setupBindings(),R.eventManager.addListener(t,"scroll",this.boundOnScroll,U.listenerOpts),this.collectionInterval=setInterval(this.reportScroll.bind(this),U.COLLECTION_INTERVAL))}setupBindings(){this.boundOnScroll=this.onScroll.bind(this)}setupExternalMetrics(){U.externalMetrics.scrollPct=()=>this.totalScrollPct,U.externalMetrics.scrollCount=()=>this.scrollCount,U.externalMetrics.scrollDistinct=()=>this.distinctScrollCount,U.externalMetrics.scrollPixels=()=>this.scrollPixels}onScroll(t){const e=R.now();this.scrollCount++,e-this.lastScroll>Z&&this.distinctScrollCount++,this.lastScroll=e;let i=Math.ceil((()=>{const t=void 0!==window.pageXOffset,e="CSS1Compat"===(window.document.compatMode||""),i={x:0,y:0};return t?"function"==typeof window.pageXOffset?(i.x=window.pageXOffset(),i.y=window.pageYOffset()):(i.x=window.pageXOffset,i.y=window.pageYOffset):e?(i.x=window.document.documentElement.scrollLeft,i.y=window.document.documentElement.scrollTop):(i.x=window.document.body.scrollLeft,i.y=window.document.body.scrollTop),"number"==typeof i.sx&&(i.sx=Math.round(i.sx)),"number"==typeof i.sy&&(i.sy=Math.round(i.sy)),i})().y),n=Math.abs(this.lastY-i);this.scrollPixels+=n,this.timeline.increment("scroll",n),(0===this.lastYLogged||Math.abs(this.lastYLogged-i)>tt)&&(this.timeline.log(U.LOG_TYPE_SCROLL,e,{y:i}),this.lastYLogged=i),this.intervalScrollPct+=Math.round(n/this.documentHeight*100),this.totalScrollPct+=Math.round(n/this.documentHeight*100),this.lastY=i}reportScroll(){const t=Math.min(this.intervalScrollPct,100);0!==t&&this.timeline.set("scrollpct",t),this.intervalScrollPct=0}analyze(t){const e=R.beaconManager;e.addToBeacon("c.s",U.externalMetrics.scrollCount()),e.addToBeacon("c.s.p",U.externalMetrics.scrollPct()),e.addToBeacon("c.s.y",U.externalMetrics.scrollPixels()),e.addToBeacon("c.s.d",U.externalMetrics.scrollDistinct())}stop(){this.collectionInterval&&(clearInterval(this.collectionInterval),this.collectionInterval=!1),R.eventManager.removeListener(this.win,"scroll",this.boundOnScroll)}onBeacon(){this.totalScrollPct=0,this.scrollCount=0,this.scrollPixels=0,this.distinctScrollCount=0}},it=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,this.enabled=!0,this.setupBindings(),R.eventManager.addListener(t,"touchstart",this.boundOnTouchStart,U.listenerOpts)}setupBindings(){this.boundOnTouchStart=this.onTouchStart.bind(this)}onTouchStart(t){if(!this.enabled||!t.cancelable)return;const e=R.now();this.interactionMonitor.interact("ts",e,t)}stop(){this.enabled=!1,R.eventManager.removeListener(this.win,"touchstart",this.boundOnTouchStart)}},nt={VIS_MAP:{visible:0,hidden:1,prerender:2,unloaded:3}},ot=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,e.register("vis",U.COMPRESS_MODE_SMALL_NUMBERS),this.enabled=!0,R.eventManager.subscribe("visibility_changed",(()=>{if(!this.enabled)return;const t=R.now();e.increment("vis"),e.log(U.LOG_TYPE_VIS,t,{s:nt.VIS_MAP[R.visibilityState()]})}))}stop(){this.enabled=!1}},st=class{constructor(t=[]){this.monitors=new Set,this.setupMonitors(t)}setupMonitors(t){for(let e of t)this.monitors.add(e)}isSwitchedOn(t){return!this.isAllMonitorsDisabled()&&(this.isMonitorsEmpty()||this.monitors.has(t))}isMonitorsEmpty(){return 0===this.monitors.size}isAllMonitorsDisabled(){return 1===this.monitors.size&&this.monitors.has(null)}},at=class{constructor(t,e,i,n){this.win=t,this.timeline=e,this.afterOnloadMinWait=i,this.monitorSwitch=n||new st,this.monitors=new Map,X.INTERACTION_MIN_WAIT_FOR_BEACON=i,e.register("inter",U.COMPRESS_MODE_SMALL_NUMBERS),e.register("interdly",U.COMPRESS_MODE_SMALL_NUMBERS),this.timeToFirstInteraction=0,this.firstInputDelay=null,this.interactions=0,this.interactionsDelay=0,this.delayedInteractions=0,this.delayedInteractionTime=0,this.enabled=!0,this.beaconStartTime=0,this.beaconEndTime=0,this.beaconMinTimeout=!1,this.beaconMaxTimeout=!1,this.isSpaNav=!1,this.sentTimers=!1,this.setupExternalMetrics(),R.eventManager.subscribe("spa_init",this.onSpaInit.bind(this),null,this),this.setupMonitors()}setupMonitors(){this.monitorSwitch.isSwitchedOn(W)&&this.monitors.set(W,new W(R.window,this.timeline,this)),this.monitorSwitch.isSwitchedOn(Q)&&this.monitors.set(Q,new Q(R.window,this.timeline,this)),this.monitorSwitch.isSwitchedOn(ot)&&this.monitors.set(ot,new ot(R.window,this.timeline,this)),this.monitorSwitch.isSwitchedOn(J)&&this.monitors.set(J,new J(R.window,this.timeline,this)),this.monitorSwitch.isSwitchedOn(it)&&this.monitors.set(it,new it(R.window,this.timeline,this)),this.monitorSwitch.isSwitchedOn(j)&&this.monitors.set(j,new j(R.window,this.timeline,this)),this.monitorSwitch.isSwitchedOn($)&&this.monitors.set($,new $(R.window,this.timeline,this)),this.deferUntilDocumentBodyExists((()=>{this.monitorSwitch.isSwitchedOn(et)&&this.monitors.set(et,new et(R.window,this.timeline,this))}))}getMonitorByType(t){return this.monitors.get(t)||null}setupExternalMetrics(){U.externalMetrics.interactionDelayed=()=>this.delayedInteractions,U.externalMetrics.interactionDelayedTime=()=>Math.ceil(this.delayedInteractionTime),U.externalMetrics.interactionAvgDelay=()=>{if(this.interactions>0)return Math.ceil(this.interactionsDelay/this.interactions)},U.externalMetrics.timeToFirstInteraction=()=>{if(this.timeToFirstInteraction)return this.timeToFirstInteraction-U.epoch},U.externalMetrics.firstInputDelay=()=>{if(null!==this.firstInputDelay)return this.firstInputDelay}}interact(t,e,i){let n=0;e=e||R.now(),this.enabled&&(this.interactions++,this.timeToFirstInteraction||(i&&i.timeStamp?this.timeToFirstInteraction=i.timeStamp+U.epoch:this.timeToFirstInteraction=e),!i||!i.timeStamp||G.isSafari&&R.window!==window||(n=i.timeStamp>14e11?e-i.timeStamp:R.hrNow()-i.timeStamp,this.interactionsDelay+=n,null===this.firstInputDelay&&(this.firstInputDelay=Math.ceil(n)),n>X.INTERACTION_MAX_DELAY&&(this.timeline.increment("interdly"),this.delayedInteractions++,this.delayedInteractionTime+=n)),this.timeline.increment("inter"),!this.isSpaNav&&G.afterOnloadMonitoring&&(this.beaconEndTime=R.now(),this.beaconStartTime||(this.beaconStartTime=this.beaconEndTime,this.beaconMaxTimeout=setTimeout(this.sendInteractionBeacon.bind(this),X.INTERACTION_MAX_WAIT_FOR_BEACON)),this.beaconMinTimeout&&(clearTimeout(this.beaconMinTimeout),this.beaconMinTimeout=!1),this.beaconMinTimeout=setTimeout(this.sendInteractionBeacon.bind(this),X.INTERACTION_MIN_WAIT_FOR_BEACON)))}onSpaInit(){this.isSpaNav=!0,this.clearBeaconTimers()}clearBeaconTimers(){this.beaconMinTimeout&&(clearTimeout(this.beaconMinTimeout),this.beaconMinTimeout=!1),this.beaconMaxTimeout&&(clearTimeout(this.beaconMaxTimeout),this.beaconMaxTimeout=!1)}sendInteractionBeacon(){R.beaconManager.sendBeaconWhenReady({"rt.start":"manual","http.initiator":"interaction","rt.tstart":this.beaconStartTime,"rt.end":this.beaconEndTime},(()=>{this.clearBeaconTimers(),R.eventManager.fireEvent("interaction")}),this)}analyze(t){const e=U.externalMetrics;R.beaconManager.addToBeacon("c.i.dc",e.interactionDelayed()),R.beaconManager.addToBeacon("c.i.dt",e.interactionDelayedTime()),R.beaconManager.addToBeacon("c.i.a",e.interactionAvgDelay())}stop(){this.enabled=!1}onBeacon(){this.delayedInteractionTime=0,this.delayedInteractions=0,this.interactions=0,this.interactionsDelay=0,this.beaconStartTime=0,this.beaconEndTime=0,this.isSpaNav=!1,this.clearBeaconTimers()}deferUntilDocumentBodyExists(t){if(document.body)return t();setTimeout((()=>{this.deferUntilDocumentBodyExists(t)}),100)}},rt=class{constructor(t){if(this.win=t,this.setupExternalMetrics(),t.PerformanceObserver&&t.LayoutShift){this.enabled=!0,this.clsScore=0,this.perfObserver=new t.PerformanceObserver(this.onLayoutShiftObserver.bind(this));try{this.perfObserver.observe({type:"layout-shift",buffered:!0})}catch(t){return}}}setupExternalMetrics(){U.externalMetrics.clsScore=()=>this.clsScore}onLayoutShiftObserver(t){if(!this.enabled)return;const e=t.getEntries();for(let t=0;tthis.longTasksTime,U.externalMetrics.longTasksCount=()=>this.longTasks.length}onPerformanceObserver(t){if(!this.enabled)return;const e=t.getEntries();Array.prototype.push.apply(this.longTasks,e);for(let t=0;t0&&(n.a=o),e.push(n)}R.beaconManager.addToBeacon("c.lt.n",U.externalMetrics.longTasksCount(),!0),R.beaconManager.addToBeacon("c.lt.tt",U.externalMetrics.longTasksTime()),R.beaconManager.addToBeacon("c.lt",U.compressJson(e))}}stop(){this.enabled=!1,this.perfObserver.disconnect(),this.clearTasks()}onBeacon(){this.clearTasks()}}ct.CONSTANTS=lt;const ht=ct,dt=class{constructor(t){this.win=t,t.Performance&&(this.setupExternalMetrics(),this.enabled=!0,this.loadEventDuration=0,this.domContentLoadedEventDuration=0,this.viceLoadingStage=0,this.viceOn=0,R.eventManager.subscribe("page_ready",this.onPageReady.bind(this),null,this))}setupExternalMetrics(){U.externalMetrics.loadEvent=()=>this.loadEventDuration,U.externalMetrics.domContentLoadedEvent=()=>this.domContentLoadedEventDuration,U.externalMetrics.viceLoadingStage=()=>this.viceLoadingStage,U.externalMetrics.viceOn=()=>this.viceOn}onPageReady(t){this.enabled&&(this.loadEventDuration=this.calcLoadEventDuration(),this.domContentLoadedEventDuration=this.calcDOMContentLoadEventDuration(),this.viceLoadingStage=this.getViceLoadingStage(),this.viceOn=this.getViceOn())}getPerformanceNavigationTiming(){const t=R.getPerformance();if(t&&t.getEntriesByType)return(t.getEntriesByType("navigation")||[])[0]||null}getViceOn(){const t=(document.head||document.documentElement).querySelectorAll("script[src$='bolt.js']");let e=-1;for(const i of t)if("viceOn"in i.dataset){e=i.dataset.viceOn;break}return e}getViceLoadingStage(){const{env:t}=R.environment,e="local-debug"===t,i=(document.head||document.documentElement).querySelectorAll("script[src$='bolt.js']");let n=-1;for(const t of i)if("viceLoadingStage"in t.dataset){n=t.dataset.viceLoadingStage;break}return-1===n&&e&&console.error("Bolt: Error identifying own script tag; not found"),n}calcLoadEventDuration(){const t=this.getPerformanceNavigationTiming();let e=-1;if(t)e=t.duration;else{const{timing:t}=performance;e=t.loadEventEnd-t.navigationStart}return Math.round(e)}calcDOMContentLoadEventDuration(){const t=this.getPerformanceNavigationTiming();let e=-1;if(t)e=t.domContentLoadedEventEnd;else{const{timing:t}=performance;e=t.domContentLoadedEventEnd-t.navigationStart}return Math.round(e)}analyze(t){const e=R.getPerformance();R.beaconManager.addToBeacon("c.ttfb",e.timing.responseStart-e.timing.navigationStart),R.beaconManager.addToBeacon("c.load",U.externalMetrics.loadEvent()),R.beaconManager.addToBeacon("c.dcl",U.externalMetrics.domContentLoadedEvent()),R.beaconManager.addToBeacon("c.vls",U.externalMetrics.viceLoadingStage()),R.beaconManager.addToBeacon("c.vo",U.externalMetrics.viceOn())}clearData(){this.loadEventDuration=0,this.domContentLoadedEventDuration=0}stop(){this.enabled=!1,this.clearData()}onBeacon(){this.clearData()}},ut=32,mt=4,gt=100,pt=Math.floor(3.125),Mt=100,vt=class{constructor(t,e){this.win=t,this.timeline=e,this.last=R.now(),this.total=0,this.late=0,this.overallTotal=0,this.overallLate=0,this.enabled=!0,this.pollInterval=!1,this.reportInterval=!1,this.setupExternalMetrics(),this.pollInterval=setInterval(this.onPoll.bind(this),ut),this.reportInterval=setInterval(this.onReport.bind(this),gt)}setupExternalMetrics(){U.externalMetrics.pageBusy=()=>0===this.overallTotal?0:Math.ceil(this.overallLate/this.overallTotal*100)}onPoll(){const t=R.now();let e=t-this.last;if(this.last=t,e>2*ut+mt){const t=Math.floor((e-ut)/ut);this.total+=t,this.late+=t,e-=t*ut}this.total++,e>ut+mt&&this.late++}onReport(){const t=this.timeline.getTimeBucket();let e=t,i=0;if(0!==this.total){for(;this.total>pt+1&&i<=Mt;)this.timeline.set("busy",100,--e),this.total-=pt,this.late=Math.max(this.late-pt,0),this.overallTotal+=pt,this.overallLate+=pt,i++;this.overallTotal+=this.total,this.overallLate+=this.late,this.timeline.set("busy",Math.ceil(this.late/this.total*100),t),this.total=0,this.late=0}}analyze(t){R.beaconManager.addToBeacon("c.b",U.externalMetrics.pageBusy())}stop(){this.enabled=!1,this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=!1),this.reportInterval&&(clearInterval(this.reportInterval),this.reportInterval=!1)}onBeacon(){this.overallTotal=0,this.overallLate=0}},ft=1e3,bt=class{constructor(t,e,i){this.win=t,this.timeline=e,this.interactionMonitor=i,this.initTimelineRegistration(),this.d=t.document,this.enabled=!0,this.reportInterval=!1,this.battery=null,this.mutationCount=0,this.domLength=0,this.domAllNodes=this.d.getElementsByTagName("*"),this.observer,this.setup()}setup(){this.reportInterval=setInterval(this.reportStats.bind(this),ft),this.win.navigator&&"function"==typeof this.win.navigator.getBattery&&this.win.navigator.getBattery().then((t=>{this.battery=t,this.battery.onlevelchange&&(this.battery.onlevelchange=this.onBatteryLevelChange.bind(this))})),h()&&(this.observer=((t,e,i,o,s,a)=>{let r,l,c={observer:null,timer:null};if(!n()||!o||!t)return null;function h(t){let e=!1;c.timer&&(clearTimeout(c.timer),c.timer=null),o&&(e=o.call(a,t,s),e||(o=null)),!e&&c.observer&&(c.observer.disconnect(),c.observer=null),"number"==typeof e&&e>0&&(c.timer=setTimeout(h,e))}return r=window.MutationObserver,window.Zone&&"function"==typeof window.Zone.__symbol__&&(l=window.Zone.__symbol__("MutationObserver"),l&&"string"==typeof l&&window[l]&&"function"==typeof window[l]&&(r=window[l])),c.observer=new r(h),i&&(c.timer=setTimeout(h,c.timeout)),c.observer.observe(t,e),c})(document,{childList:!0,subtree:!0},null,this.onMutationObserver.bind(this),null,this))}reportStats(){const t=R.getPerformance(),e=t&&t.memory&&t.memory.usedJSHeapSize;if(e&&this.timeline.set("mem",e),this.domLength=this.domAllNodes.length,this.timeline.set("domsz",this.d.documentElement.innerHTML.length),this.timeline.set("domln",this.domLength),this.mutationCount>0){const t=Math.min(Math.round(this.mutationCount/this.domLength*100),100);this.timeline.set("mut",t),this.mutationCount=0}}onBatteryLevelChange(){this.enabled&&this.battery&&this.timeline.set("bat",this.battery.level)}onMutationObserver(t){return t.forEach((t=>{if("childList"!==t.type)return!0;for(let e=0;e{if(this.tti)return this.tti-U.epoch},U.externalMetrics.timeToVisuallyReady=()=>{if(this.visuallyReady)return this.visuallyReady-U.epoch},U.externalMetrics.timeToHeroImagesReady=()=>{if(G.ttiWaitForHeroImages&&this.heroImagesReady)return this.heroImagesReady-U.epoch},U.externalMetrics.timeToFrameworkReady=()=>{if(G.ttiWaitForFrameworkReady&&G.frameworkReady)return G.frameworkReady-U.epoch},U.externalMetrics.log=()=>this.dataLog}stop(){this.data={},this.dataLog=[]}onBeacon(){for(let t in this.data)this.data[t]&&(this.data[t]=[]);this.dataLog=[]}register(t,e,i){this.data[t]||(this.data[t]=[]),this.dataOptions[t]={compressMode:e||U.COMPRESS_MODE_SMALL_NUMBERS,backfillLast:i}}getTimeBucket(){return Math.floor((R.now()-this.startTime)/U.COLLECTION_INTERVAL)}set(t,e,i){void 0===i&&(i=this.getTimeBucket()),this.data[t]&&(this.data[t][i]=e)}increment(t,e,i){void 0===i&&(i=this.getTimeBucket()),void 0===e&&(e=1),this.data[t]&&(this.data[t][i]||(this.data[t][i]=0),this.data[t][i]+=e)}log(t,e,i){void 0===e&&(e=this.getTimeBucket()),this.dataLog.push({type:t,val:i,time:e}),this.dataLog.length>G.logMaxEntries&&Array.prototype.splice.call(this.dataLog,0,this.dataLog.length-G.logMaxEntries)}getStats(t,e){let i,n=0,o=0,s=1/0,a=0,r=Math.floor((e-this.startTime)/U.COLLECTION_INTERVAL);if(!this.data[t])return 0;for(let e in this.data[t])e=parseInt(e,10),e>=r&&this.data[t][e]&&(i=this.data[t][e],n++,o+=i,s=Math.min(s,i),a=Math.max(a,i));return{total:o,count:n,min:s,max:a}}determineImageLoadTime(t){let e,i,n,o,s,a,r=0;const l=U.p;if(!R.window||!R.window.document||"function"!=typeof R.window.document.querySelectorAll)return 0;if(!l||"function"!=typeof l.getEntriesByType)return 0;if(e=t+", "+t+" * img, "+t+" * image",i=R.window.document.querySelectorAll(e),i&&i.length)for(n=0;n0&&(s=e[1])}}if(s&&(a=l.getEntriesByName(s),a&&a.length))for(o=0;oTt.TIME_TO_INTERACTIVE_MAX_PAGE_BUSY)i=0;else if(this.data.interdly&&this.data.interdly[t])i=0;else if(i++,i>=Tt.TIME_TO_INTERACTIVE_IDLE_INTERVALS){this.tti=this.startTime+(t-Tt.TIME_TO_INTERACTIVE_IDLE_INTERVALS)*U.COLLECTION_INTERVAL,this.tti=Math.max(this.tti,this.visuallyReady);break}this.tti>0&&n.addToBeacon("c.tti",U.externalMetrics.timeToInteractive())}}}yt.CONSTANTS=Tt;const Et=yt;class St{constructor(t,e){this.monitorSwitch=t||new st,this.interactionMonitorSwitch=e||new st,G.timeline=new Et(R.now()),R.window&&this.setupMonitors(),this.addVariables(),this.setupSubscriptions()}isComplete(){return G.complete}addVariables(){const t=R.variableManager;t.addVar("c.e",U.epoch.toString(36)),t.addVar("c.tti.m",G.ttiMethod)}setupSubscriptions(){const t=R.eventManager;t.subscribe("before_beacon",G.onBeforeBeacon,null,G),t.subscribe("beacon",G.onBeacon,null,G),t.subscribe("page_ready",G.onPageReady,null,G),t.subscribe("xhr_load",G.onXhrLoad,null,G)}setupMonitors(){this.shouldMonitorLongTasks()&&this.setupLongTaskMonitor(),this.shouldMonitorFps()&&this.setupFpsMonitor(),this.shouldMonitorPageBusy()&&this.setupPageBusyMonitor(),this.shouldMonitorInteractions()&&this.setupInteractionMonitors(),this.shouldMonitorStats()&&this.setupStatsMonitor(),this.shouldMonitorLayoutShifts()&&this.setupLayoutShiftMonitor(),this.shouldMonitorPageAndDOMMonitor()&&this.setupPageAndDOMMonitor()}shouldMonitorLongTasks(){return this.monitorSwitch.isSwitchedOn(ht)&&G.monitorLongTasks&&R.window.PerformanceObserver&&R.window.PerformanceLongTaskTiming}shouldMonitorFps(){return this.monitorSwitch.isSwitchedOn(H)&&G.monitorFrameRate&&"function"==typeof R.window.requestAnimationFrame}shouldMonitorPageBusy(){return this.monitorSwitch.isSwitchedOn(vt)&&G.monitorPageBusy&&(!R.window.PerformanceObserver||!R.window.PerformanceLongTaskTiming||!G.monitorLongTasks)}shouldMonitorInteractions(){return this.monitorSwitch.isSwitchedOn(at)&&G.monitorInteractions}shouldMonitorStats(){return this.monitorSwitch.isSwitchedOn(bt)&&G.monitorStats}shouldMonitorLayoutShifts(){return this.monitorSwitch.isSwitchedOn(rt)&&G.monitorLayoutShifts&&R.window.PerformanceObserver}shouldMonitorPageAndDOMMonitor(){return this.monitorSwitch.isSwitchedOn(dt)&&G.monitorPageAndDOMMonitor}setupPageBusyMonitor(){G.pageBusyMonitor=new vt(R.window,G.timeline),G.ttiMethod||(G.ttiMethod="b")}setupFpsMonitor(){G.frameRateMonitor=new H(R.window,G.timeline),G.ttiMethod||(G.ttiMethod="raf")}setupLongTaskMonitor(){G.longTaskMonitor=new ht(R.window,G.timeline),G.ttiMethod="lt"}setupLayoutShiftMonitor(){G.layoutShiftMonitor=new rt(R.window)}setupPageAndDOMMonitor(){G.pageAndDOMMonitor=new dt(R.window)}setupStatsMonitor(){G.statsMonitor=new bt(R.window,G.timeline,G.interactionMonitor)}setupInteractionMonitors(){const t=new at(R.window,G.timeline,G.afterOnloadMinWait,this.interactionMonitorSwitch);G.interactionMonitor=t,G.keyMonitor=t.getMonitorByType(W),G.mouseMonitor=t.getMonitorByType(Q),G.visibilityMonitor=t.getMonitorByType(ot),G.orientationMonitor=t.getMonitorByType(J),G.touchStartMonitor=t.getMonitorByType(it),G.mouseDownMonitor=t.getMonitorByType(j),G.pointerDownMonitor=t.getMonitorByType($),this.deferUntilDocumentBodyExists((()=>{G.scrollMonitor=t.getMonitorByType(et)}))}deferUntilDocumentBodyExists(t){if(document.body)return t();setTimeout((()=>{this.deferUntilDocumentBodyExists(t)}),100)}}St.CONSTANTS=U;const Bt=St,Ot={PAINT_TIMING_MAP:{"first-paint":"fp","first-contentful-paint":"fcp","largest-contentful-paint":"lcp"}},Lt={initialized:!1,complete:!1,supported:null,timingCache:{},observer:null,externalMetrics:{},done:function(t,e){let i,n,o;if(Lt.complete)return Lt;if("load"!==e&&(!t||"spa_hard"!==t.initiator))return Lt.complete=!0,Lt;if(i=R.getPerformance(),i&&"function"==typeof i.getEntriesByType){if(n=i.getEntriesByType("paint"),n&&n.length){for(o=0;o