define("metaserver/static/js/modules/clean/devtools/panels/performance/perf_hub_actions",["require","exports","metaserver/static/js/modules/clean/devtools/panels/performance/perf_hub_action_types","metaserver/static/js/modules/clean/flux/dispatcher"],(function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PerfHubActions=void 0;t.PerfHubActions=new class{add_ajax_profile(e,t,s,r){const o=r;return i.Dispatcher.dispatch({type:n.ActionTypes.PROFILED_AJAX_LOAD_FINISHED,data:{url:e,serverResponseTime:t,profileRequestId:s,traceId:o}})}add_web_timing_details(e){return i.Dispatcher.dispatch({type:n.ActionTypes.WEB_TIMING_FETCHED,data:e})}add_visually_complete(e){return i.Dispatcher.dispatch({type:n.ActionTypes.VISUALLY_COMPLETE,time:e})}}})),define("metaserver/static/js/modules/clean/metrics/coin",["require","exports","apex-metrics/index","metaserver/static/js/dropbox/proto/apex_metrics_web/apex_metrics_web","metaserver/static/js/google/protobuf/timestamp","metaserver/static/js/google/protobuf/empty"],(function(e,t,n,i,s,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observeCoin=t.APIv2CoinToProtobufCoin=t.protobufCoinToAPIv2Coin=t.newCoinState=void 0,t.newCoinState=function(){return i.apex_metrics_web.ApexMetricsCacheData.CoinState.create({lastFlipTime:null,lastResult:!1,numTimesChecked:0})},t.protobufCoinToAPIv2Coin=function(e){let t=void 0;if(e.stickiness&&e.stickiness.limit)switch(e.stickiness.limit){case"independent":t={".tag":"independent"};break;case"permanent":t={".tag":"permanent"};break;case"nResults":t={".tag":"n_results",n_results:e.stickiness.nResults};break;case"nSeconds":t={".tag":"n_seconds",n_seconds:e.stickiness.nSeconds}}return{fraction:null!==e.fraction?e.fraction:void 0,stickiness:t?{limit:t}:void 0}},t.APIv2CoinToProtobufCoin=function(e){let t=void 0;if(e.stickiness&&e.stickiness.limit)switch(e.stickiness.limit[".tag"]){case"independent":t={independent:r.google.protobuf.Empty.create()};break;case"permanent":t={permanent:r.google.protobuf.Empty.create()};break;case"n_results":t={nResults:e.stickiness.limit.n_results};break;case"n_seconds":t={nSeconds:e.stickiness.limit.n_seconds}}return i.apex_metrics_web.RecordNamespace.StickyBiasedCoinV2.create({fraction:e.fraction,stickiness:t?i.apex_metrics_web.RecordNamespace.StickinessV2.create(t):void 0})},t.observeCoin=function(e,t,i){if(!t.stickiness||!t.stickiness.limit)return{nextState:i,result:!1};const r=Date.now()/1e3,{lastFlipTime:o=s.google.protobuf.Timestamp.create({seconds:0,nanos:0}),lastResult:a,numTimesChecked:c=0}=i;let l=!1;switch(t.stickiness.limit[".tag"]){case"n_results":l=null===c||c%t.stickiness.limit.n_results==0;break;case"n_seconds":if(!o){l=!0;break}l=n.Instant.toMilliseconds({value:(d=r,u=o.seconds,"number"!=typeof d?d.sub(u).toNumber():"number"==typeof u?d-u:u.sub(d).negate().toNumber()),unit:n.TimeUnit.SECONDS})>n.Instant.toMilliseconds({value:t.stickiness.limit.n_seconds,unit:n.TimeUnit.SECONDS});break;case"permanent":l=0===c;break;case"independent":l=!0;break;case"other":default:return{nextState:i,result:!1}}var d,u;if(l){const n=e()<(t.fraction||0);return{nextState:{lastFlipTime:s.google.protobuf.Timestamp.create({seconds:r,nanos:0}),lastResult:n,numTimesChecked:c?c+1:1},result:n}}return{nextState:Object.assign(Object.assign({},i),{numTimesChecked:c?c+1:1}),result:!!a}}})),define("metaserver/static/js/modules/clean/metrics/database",["require","exports","tslib","metaserver/static/js/modules/clean/metrics/instrumentation"],(function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadInstrumentation=t.storeInstrumentation=t.storeIncomingSetSpans=t.storeIncomingSpans=t.checkAndSetPublishTime=t.getDatabase=t.getNamespaceRange=t.INSTRUMENTATION_STORE_KEY=t.INSTRUMENTATION_STORE=t.CONTROL_VALUE_LASTPUBLISHTIME=t.CONTROL_VALUE_STORE=t.NAMESPACE_INDEX=t.SET_STORE=t.SPAN_STORE=t.DATABASE_VERSION=void 0;function s(e,n,i){const s=e.result,r=e=>{s.removeEventListener("error",r),i(e)};s.addEventListener("error",r),e.transaction.addEventListener("complete",()=>{s.removeEventListener("error",r)}),e.transaction.addEventListener("error",e=>{s.removeEventListener("error",r),i(e)});const o=(e,t)=>e.oldVersion=t);if(o(n,1))try{s.createObjectStore(t.SPAN_STORE,{keyPath:["namespace","tagNames","tagValues"]}).createIndex(t.NAMESPACE_INDEX,"namespace",{unique:!1}),s.createObjectStore(t.CONTROL_VALUE_STORE,{keyPath:"name"})}catch(e){return void r(e)}if(o(n,2)){const n=e.transaction.objectStore(t.SPAN_STORE).openCursor();n.addEventListener("success",e=>{const t=n.result;if(!t)return;let i=!1;for(const e in t.value.spans)t.value.spans.hasOwnProperty(e)&&(i=!0,t.value.spans[e]={spanCount:0,samples:t.value.spans[e]});i&&t.update(t.value),t.continue()})}if(o(n,3))try{s.createObjectStore(t.INSTRUMENTATION_STORE,{keyPath:"name"})}catch(e){return void r(e)}if(o(n,4))try{e.transaction.objectStore(t.SPAN_STORE).clear(),e.transaction.objectStore(t.INSTRUMENTATION_STORE).clear()}catch(e){return void r(e)}if(o(n,5))try{s.createObjectStore(t.SET_STORE,{keyPath:["namespace","tagNames","tagValues"]}).createIndex(t.NAMESPACE_INDEX,"namespace",{unique:!1})}catch(e){return void r(e)}if(o(n,6))try{e.transaction.objectStore(t.SPAN_STORE).clear(),e.transaction.objectStore(t.SET_STORE).clear(),e.transaction.objectStore(t.INSTRUMENTATION_STORE).clear()}catch(e){return void r(e)}}function r(e,t,n,i){return Promise.all(t.map(t=>new Promise((s,r)=>{let o;try{o=e.transaction(n,"readwrite")}catch(e){if(e instanceof DOMException&&("InvalidStateError"===e.name||11===e.code))return void s();throw e}const a=o.objectStore(n);o.addEventListener("complete",e=>s()),o.addEventListener("error",e=>r(e));const c=[],l=[];for(const e in t.tags)t.tags.hasOwnProperty(e)&&(c.push(e),l.push(t.tags[e]));const d=a.get([t.namespace,c,l]);d.addEventListener("success",e=>{const n=d.result?d.result:{namespace:t.namespace,tagNames:c,tagValues:l,spans:{}};n.spans[t.metricName]||(n.spans[t.metricName]={spanCount:0,samples:[]}),n.spans[t.metricName].spanCount++,n.spans[t.metricName].samples=i(n.spans[t.metricName].samples.concat(t.samples)),a.put(n)})})))}function o(e,t,n){try{return e.transaction(t,n)}catch(e){if(e instanceof DOMException&&("InvalidStateError"===e.name||11===e.code))return null;throw e}}function a(e,t){return new Promise((n,i)=>{const s=e.get(t);s.addEventListener("success",e=>{n(s.result)}),s.addEventListener("error",e=>{i(e)})})}t.DATABASE_VERSION=6,t.SPAN_STORE="spans",t.SET_STORE="set_spans",t.NAMESPACE_INDEX="namespace",t.CONTROL_VALUE_STORE="controlValues",t.CONTROL_VALUE_LASTPUBLISHTIME="lastPublishTime",t.INSTRUMENTATION_STORE="selfInstrumentation",t.INSTRUMENTATION_STORE_KEY="instrumentation",t.getNamespaceRange=function(e,n){return new Promise((i,s)=>{const r=e.index(t.NAMESPACE_INDEX).getKey(IDBKeyRange.lowerBound(n,!0));r.addEventListener("success",e=>{if(r.result){const e=r.result[0];i(IDBKeyRange.bound([n],[e],!1,!0))}else i(IDBKeyRange.lowerBound([n]))}),r.addEventListener("error",e=>{s(e)})})},t.getDatabase=function(e=t.DATABASE_VERSION){return n.__awaiter(this,void 0,void 0,(function*(){let t=null;if("undefined"==typeof indexedDB)return t;try{t=yield new Promise((t,n)=>{indexedDB.open("unused",1);const i=indexedDB.open("apexMetrics",e);i.addEventListener("success",()=>{t(i.result)}),i.addEventListener("error",e=>{n(e)}),i.addEventListener("upgradeneeded",e=>{try{s(i,e,n)}catch(e){n(e)}})})}catch(n){n.target&&n.target.error&&n.target.error.name&&"VersionError"===n.target.error.name&&(yield new Promise((e,t)=>{const n=indexedDB.deleteDatabase("apexMetrics");n.addEventListener("success",()=>e()),n.addEventListener("error",e=>t(e))}),t=yield new Promise((t,n)=>{const i=indexedDB.open("apexMetrics",e);i.addEventListener("success",()=>t(i.result)),i.addEventListener("error",e=>n(e)),i.addEventListener("upgradeneeded",e=>{try{s(i,e,n)}catch(e){n(e)}})}))}return t}))},t.checkAndSetPublishTime=function(e,i,s){return new Promise((r,o)=>n.__awaiter(this,void 0,void 0,(function*(){let n;try{n=e.transaction(t.CONTROL_VALUE_STORE,"readwrite").objectStore(t.CONTROL_VALUE_STORE)}catch(e){if(e instanceof DOMException&&("InvalidStateError"===e.name||11===e.code))return void r(!1);throw e}const a=n.get(t.CONTROL_VALUE_LASTPUBLISHTIME);a.addEventListener("success",e=>{const c=a.result;if(c&&i-+c.value{r(!0)}),l.addEventListener("error",e=>{o(e)})}),a.addEventListener("error",e=>{o(e)})})))},t.storeIncomingSpans=function(e,n){return r(e,n,t.SPAN_STORE,e=>(e.sort(),e))},t.storeIncomingSetSpans=function(e,n){return r(e,n,t.SET_STORE,e=>[...new Set(e)])},t.storeInstrumentation=function(e,s){return new Promise((r,c)=>n.__awaiter(this,void 0,void 0,(function*(){var n,l;const d=o(e,t.INSTRUMENTATION_STORE,"readwrite");if(null===d)return void r();const u=d.objectStore(t.INSTRUMENTATION_STORE);d.addEventListener("complete",()=>{r()}),d.addEventListener("error",c);const p=null!==(l=null===(n=yield a(u,t.INSTRUMENTATION_STORE_KEY))||void 0===n?void 0:n.value)&&void 0!==l?l:i.Instrumentation.empty(),m=i.Instrumentation.merge(s,p);yield(function(e,t){return new Promise((n,i)=>{const s=e.put(t);s.addEventListener("success",e=>{n()}),s.addEventListener("error",e=>{i(e)})})})(u,{name:t.INSTRUMENTATION_STORE_KEY,value:m})})))},t.loadInstrumentation=function(e,s){return new Promise((r,c)=>n.__awaiter(this,void 0,void 0,(function*(){var n,l;const d=o(e,t.INSTRUMENTATION_STORE,"readwrite");if(null===d)return void r(s);d.addEventListener("error",c);const u=d.objectStore(t.INSTRUMENTATION_STORE),p=null!==(l=null===(n=yield a(u,t.INSTRUMENTATION_STORE_KEY))||void 0===n?void 0:n.value)&&void 0!==l?l:i.Instrumentation.empty();d.addEventListener("complete",()=>{r(i.Instrumentation.merge(s,p))}),(function(e,t){new Promise((n,i)=>{const s=e.delete(t);s.addEventListener("success",e=>{n()}),s.addEventListener("error",e=>{i(e)})})})(u,t.INSTRUMENTATION_STORE_KEY)})))}})),define("metaserver/static/js/modules/clean/metrics/filter",["require","exports","tslib","metaserver/static/js/modules/clean/metrics/coin","metaserver/static/js/modules/clean/metrics/database","metaserver/static/js/modules/clean/metrics/serialization","apex-metrics/hyperloglog"],(function(e,t,n,i,s,r,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SpanGroupFilter=t.makeNamespaceMap=void 0;function a(e,t){return n.__awaiter(this,void 0,void 0,(function*(){let n=null;if(crypto.subtle&&window.TextEncoder){const e=new TextEncoder,i=yield crypto.subtle.digest("SHA-256",e.encode(t));n=new Uint32Array(i).reduce((e,t)=>e^t)}return null===n?0:((n^e)>>>0)/4294967296}))}t.makeNamespaceMap=function(e,t){const n={};for(const s of e){const e=s.metric_namespace;n[e]={dropFractionOfHostsPerMetric:s.drop_fraction_of_hosts_per_metric||null,dropPeriodCoin:s.drop_periods?{config:s.drop_periods,state:t.namespaceCoinState&&t.namespaceCoinState[e]&&t.namespaceCoinState[e].dropPeriodCoin||i.newCoinState()}:null,dropSamplesCoin:s.drop_samples?{config:s.drop_samples,state:t.namespaceCoinState&&t.namespaceCoinState[e]&&t.namespaceCoinState[e].dropSamplesCoin||i.newCoinState()}:null}}return n};class c{constructor(e,t,n,i,s,r){this.filterID=e,this.randomEngine=t,this.clock=n,this.maxScopes=i,this.namespaceMap=s,this.configuredNamespaces=r}extend(e,t,n){return new c(this.filterID,this.randomEngine,this.clock,e||this.maxScopes,Object.assign(Object.assign({},this.namespaceMap),t),n)}getState(){const e={filterID:this.filterID,namespaceCoinState:{}};for(const t in this.namespaceMap)this.namespaceMap.hasOwnProperty(t)&&(e.namespaceCoinState[t]={dropPeriodCoin:this.namespaceMap[t].dropPeriodCoin?Object.assign({},this.namespaceMap[t].dropPeriodCoin.state):null,dropSamplesCoin:this.namespaceMap[t].dropSamplesCoin?Object.assign({},this.namespaceMap[t].dropSamplesCoin.state):null});return e}getConfiguredNamespaces(){return this.configuredNamespaces}partitionAndSerializeSpans(e,t,c,l){return n.__awaiter(this,void 0,void 0,(function*(){return new Promise((d,u)=>{const p=[];let m=0;const _=new Map;let h,g=0;const f=new Set;try{h=e.transaction([s.SPAN_STORE,s.SET_STORE],"readwrite")}catch(e){if(e instanceof DOMException&&("InvalidStateError"===e.name||11===e.code))return void d({scopes:[],storedNamespaces:f,spansRetained:0,samplesRetainedByNs:new Map,observationsRetained:0});throw e}const S=new Map,v=new Set;h.addEventListener("complete",()=>d({scopes:p,storedNamespaces:f,spansRetained:m,samplesRetainedByNs:_,observationsRetained:g})),h.addEventListener("error",e=>u(e));const w=[{storeName:s.SPAN_STORE,serializeSamplesFunc:(e,t,n,i,s)=>{var r;l.includes(i)||(m+=s,_.set(i,(null!==(r=_.get(i))&&void 0!==r?r:0)+n.length)),(function(e,t,n){t.metrics.push({name:{value:{".tag":"string_value",string_value:e}},data:{".tag":"numerical_data",samples:n}})})(e,t,n)}},{storeName:s.SET_STORE,serializeSamplesFunc:(e,t,n,i,s)=>{l.includes(i)||(g+=n.length),(function(e,t,n){n.length>80?t.metrics.push({name:{value:{".tag":"string_value",string_value:e}},data:{".tag":"set_data",hyperloglog:{registers:new o.HyperLogLog(n).compressed()}}}):t.metrics.push({name:{value:{".tag":"string_value",string_value:e}},data:{".tag":"set_data",samples:n}})})(e,t,n)}}];for(const{storeName:e,serializeSamplesFunc:o}of w){const l=h.objectStore(e);let d;try{d=l.index(s.NAMESPACE_INDEX)}catch(e){return void u(e)}const m=d.count();m.addEventListener("success",()=>{if(0===m.result)return;const e=d.openKeyCursor(null,"nextunique");e.addEventListener("success",()=>n.__awaiter(this,void 0,void 0,(function*(){var d;const m=e.result;if(!m)return;const _=m.key;if(0!==this.maxScopes&&p.length===this.maxScopes&&!v.has(_))return;if(f.add(_),!this.configuredNamespaces.has(_))return void m.continue();const{dropPeriodCoin:h,dropSamplesCoin:g,dropFractionOfHostsPerMetric:w}=this.namespaceMap[_]||{};let b;try{b=yield s.getNamespaceRange(l,_)}catch(e){return void u(e)}if(h){const{result:e,nextState:t}=i.observeCoin(this.randomEngine,h.config,h.state);if(h.state=t,e)return l.delete(b),void m.continue()}const T=null!==(d=S.get(_))&&void 0!==d?d:{metric_namespace:_,timestamp_sec:c,tags:r.formatTags(t),descendants:[]};S.set(_,T);const E=l.openCursor(b);E.addEventListener("success",()=>n.__awaiter(this,void 0,void 0,(function*(){const e=E.result;if(!e)return T.descendants.length>0&&!v.has(_)&&(p.push(T),v.add(_)),void m.continue();const t={tags:r.zipTags(e.value.tagNames,e.value.tagValues),metrics:[]},n=e.value.spans;for(const e in n){if(!n.hasOwnProperty(e))continue;if(w){if((yield a(this.filterID,e)){const{result:t,nextState:n}=i.observeCoin(this.randomEngine,g.config,g.state);return g.state=n,!t})),0===s.length)continue;const r=n[e].spanCount;o(e,t,s,_,r)}t.metrics.length>0&&T.descendants.push(t),e.delete(),e.continue()})))})))})}})}))}}t.SpanGroupFilter=c})),define("metaserver/static/js/modules/clean/metrics/index",["require","exports","tslib","apex-metrics/index","metaserver/static/js/modules/clean/metrics/database","metaserver/static/js/modules/clean/metrics/apiv2_sink","metaserver/static/js/modules/clean/metrics/unload","metaserver/static/js/modules/clean/metrics/server_view_sink","metaserver/static/js/modules/core/browser_detection","metaserver/static/js/modules/core/exception","metaserver/static/js/modules/clean/uuid/insecure_uuid"],(function(e,t,n,i,s,r,o,a,c,l,d){"use strict";function u(){return new i.BrowserPerformanceClock}function p(){return n.__awaiter(this,void 0,void 0,(function*(){const{NoAuthApiV2Client:t}=yield new Promise((t,n)=>{e(["metaserver/static/js/api_v2/noauth_client"],t,n)}).then(n.__importStar);return new t}))}function m(){const e=[[!!c.chrome,"chrome"],[!!c.edge,"edge"],[!!c.mozilla,"firefox"],[!!c.msie,"msie"],[!!c.safari,"safari"]];for(const t of e)if(t[0])return t[1];return"other"}function _(){return c.mac?{name:{".tag":"mac"},version:"unknown"}:c.windows?{name:{".tag":"windows"},version:(e=c.windowsInfo,e.windowsXP||e.windowsXPx64?"XP":e.windowsVista?"Vista":e.windows7?"7":e.windows8?"8":e.windows8_1?"8.1":e.windows10?"10 Unknown":"unknown")}:c.is_android()?{name:{".tag":"android"},version:"unknown"}:c.iOS?{name:{".tag":"ios"},version:"unknown"}:{name:{".tag":"unknown_os"},version:"unknown"};var e}Object.defineProperty(t,"__esModule",{value:!0}),t.getUnloadMetricsReporter=t.getMetricsReporter=void 0,c=n.__importStar(c),l=n.__importStar(l);const h=r.makeDefaultCacheFactory(),g={detectBrowser:m,detectOS:_};function f(e){if(void 0===e&&(e=window.sinkSingleton?window.sinkSingleton.clientFactory:p),window.sinkSingleton)return window.sinkSingleton.clientFactory=e,window.sinkSingleton;const t=new r.Apiv2MetricsSink(e,u(),r.makeDefaultInitialization(e,g,l),h,new i.SetTimeoutExecutor(()=>({value:5*Math.random(),unit:i.TimeUnit.SECONDS})),Math.random,s.getDatabase,g,l,()=>d.InsecureUUID.v4());return window.sinkSingleton=t,t}const S=new a.ServerViewMetricsSink;t.getMetricsReporter=function(){const e=f();return void 0!==window._clientBridge?i.MetricsReporterImpl.root(S,u(),e.getOriginId()):i.MetricsReporterImpl.root(e,u(),e.getOriginId())},t.getUnloadMetricsReporter=function(){const e=f(),t=(function(e){if(void 0===e&&(e=window.sinkSingleton?window.sinkSingleton.clientFactory:p),window.unloadSinkSingleton)return window.sinkSingleton.clientFactory=e,window.unloadSinkSingleton;const t=new o.UnloadSink(h,f(e));return window.unloadSinkSingleton=t,t})();return i.MetricsReporterImpl.root(t,u(),e.getOriginId())}})),define("metaserver/static/js/modules/clean/metrics/instrumentation",["require","exports","apex-metrics/index","metaserver/static/js/modules/clean/metrics/serialization"],(function(e,t,n,i){"use strict";function s(e,t,n,i){n("samples_sink/submitted_spans",e.submittedSpans),n("samples_sink/submitted_samples",e.submittedSamples);for(const[t,i]of Object.entries(e.submittedSamplesByNs))n("samples_sink/submitted_samples_by_ns",i,{namespace:t});n("samples_sink/retained_spans",e.retainedSpans),n("samples_sink/retained_samples",e.retainedSamples);for(const[t,i]of Object.entries(e.retainedSamplesByNs))n("samples_sink/retained_samples_by_ns",i,{namespace:t});n("samples_sink/request/dropped_samples",e.requestDroppedSamples),n("samples_sink/request/dropped_spans",e.requestDroppedSpans),n("samples_sink/request/attempts",e.requestAttempts),n("samples_sink/request/latency",t),n("samples_sink/submitted_set_observations",e.setObservations);for(const[t,i]of Object.entries(e.setObservationsByNs))n("samples_sink/submitted_set_observations_by_ns",i,{namespace:t});n("samples_sink/request/dropped_set_observations",e.requestDroppedSetObservations),i("samples_sink/reporting_hosts")}Object.defineProperty(t,"__esModule",{value:!0}),t.Instrumentation=t.SELF_INSTRUMENTATION_NAMESPACE=void 0,t.SELF_INSTRUMENTATION_NAMESPACE="amp_client",(function(e){function r(e,t){var n;const i=Object.assign({},e);for(const[e,s]of Object.entries(t))i[e]=(null!==(n=i[e])&&void 0!==n?n:0)+s;return i}e.empty=function(){return{submittedSpans:0,submittedSamples:0,submittedSamplesByNs:{},retainedSpans:0,retainedSamples:0,retainedSamplesByNs:{},requestDroppedSamples:0,requestDroppedSpans:0,requestAttempts:0,setObservations:0,setObservationsByNs:{},requestDroppedSetObservations:0}},e.incrementSubmittedSamples=function(e,t,n){e.submittedSamples+=n;const i=e.submittedSamplesByNs[t];e.submittedSamplesByNs[t]=(null!=i?i:0)+n},e.incrementSetObservations=function(e,t,n){e.setObservations+=n;const i=e.setObservationsByNs[t];e.setObservationsByNs[t]=(null!=i?i:0)+n},e.incrementRetainedSamples=function(e,t,n){e.retainedSamples+=n;const i=e.retainedSamplesByNs[t];e.retainedSamplesByNs[t]=(null!=i?i:0)+n},e.report=function(n,i,r,o){if(0===n.retainedSamples)return n.requestAttempts=0,n;const a=i.child({client_version:o.toString()});return s(n,r,(e,n,i)=>{a.createStats({ns:t.SELF_INSTRUMENTATION_NAMESPACE,name:e},i).record(n)},e=>{a.createSet({ns:t.SELF_INSTRUMENTATION_NAMESPACE,name:e}).observeOriginId()}),e.empty()},e.toScope=function(e,r,o,a){const c=[];return s(e,o,(e,t,n)=>{c.push({tags:n?i.formatTags(n):[],metrics:[{name:{value:{".tag":"string_value",string_value:e}},data:{".tag":"numerical_data",samples:[t]}}]})},e=>{c.push({metrics:[{name:{value:{".tag":"string_value",string_value:e}},data:{".tag":"set_data",samples:[n.hash(r)]}}]})}),{metric_namespace:t.SELF_INSTRUMENTATION_NAMESPACE,timestamp_sec:Math.floor(Date.now()/1e3),tags:i.formatTags(a),descendants:c}},e.merge=function(e,t){var n,i,s,o,a,c,l,d,u,p,m,_;return{submittedSpans:e.submittedSpans+(null!==(n=t.submittedSpans)&&void 0!==n?n:0),submittedSamples:e.submittedSamples+(null!==(i=t.submittedSamples)&&void 0!==i?i:0),submittedSamplesByNs:r(e.submittedSamplesByNs,null!==(s=t.submittedSamplesByNs)&&void 0!==s?s:{}),retainedSpans:e.retainedSpans+(null!==(o=t.retainedSpans)&&void 0!==o?o:0),retainedSamples:e.retainedSamples+(null!==(a=t.retainedSamples)&&void 0!==a?a:0),retainedSamplesByNs:r(e.retainedSamplesByNs,null!==(c=t.retainedSamplesByNs)&&void 0!==c?c:{}),requestDroppedSamples:e.requestDroppedSamples+(null!==(l=t.requestDroppedSamples)&&void 0!==l?l:0),requestDroppedSpans:e.requestDroppedSpans+(null!==(d=t.requestDroppedSpans)&&void 0!==d?d:0),requestAttempts:e.requestAttempts+(null!==(u=t.requestAttempts)&&void 0!==u?u:0),setObservations:e.setObservations+(null!==(p=t.setObservations)&&void 0!==p?p:0),setObservationsByNs:r(e.setObservationsByNs,null!==(m=t.setObservationsByNs)&&void 0!==m?m:{}),requestDroppedSetObservations:e.requestDroppedSetObservations+(null!==(_=t.requestDroppedSetObservations)&&void 0!==_?_:0)}}})(t.Instrumentation||(t.Instrumentation={}))})),define("metaserver/static/js/modules/clean/metrics/serialization",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zipTags=t.formatTags=void 0,t.formatTags=function(e){const t=[];for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t.push({name:{value:{".tag":"string_value",string_value:n}},value:{value:{".tag":"string_value",string_value:i}}})}return t},t.zipTags=function(e,t){if(e.length!==t.length)throw new Error("Cannot zip values of different dimensions!");return e.map((e,n)=>({name:{value:{".tag":"string_value",string_value:e}},value:{value:{".tag":"string_value",string_value:t[n]}}}))}})),define("metaserver/static/js/modules/clean/metrics/apiv2_sink",["require","exports","tslib","apex-metrics/index","eventemitter3","metaserver/static/js/modules/clean/metrics/coin","metaserver/static/js/modules/clean/metrics/database","metaserver/static/js/modules/clean/metrics/filter","metaserver/static/js/modules/clean/metrics/instrumentation","metaserver/static/js/google/protobuf/timestamp","metaserver/static/js/dropbox/proto/apex_metrics_web/apex_metrics_web","metaserver/static/js/proto_utils/unpack"],(function(e,t,n,i,s,r,o,a,c,l,d,u){"use strict";var p;Object.defineProperty(t,"__esModule",{value:!0}),t.Apiv2MetricsSink=t._ORIGIN_IDENTIFIER_KEY=t.makeDefaultCacheFactory=t._PERSISTENTCACHE_KEY=t.makeDefaultInitialization=t.makeNopPlatformDetector=t.CLIENT_VERSION=t.PublishType=void 0,s=n.__importDefault(s),(function(e){e.ALLOWED="allowed",e.DENIED="denied"})(p=t.PublishType||(t.PublishType={}));const m={".tag":"trigger_heartbeat"},_={".tag":"trigger_publish"};t.CLIENT_VERSION=21;function h(e,n,i,s,r){const o=[];return n.forEach(e=>o.push(e)),{scopes:e,known_namespaces:o,environment:"prod",artifact_name:"dropbox-web",artifact_version:"0000000000000000000000000000000000000000",client_metadata:{client_version:t.CLIENT_VERSION,implementation:{".tag":"typescript"}},trigger:i,os:s,origin_identifier:r}}t.makeNopPlatformDetector=function(){return{detectBrowser:()=>"other",detectOS:()=>({name:{".tag":"unknown_os"},version:"unknown"})}},t.makeDefaultInitialization=function(e,i,s){return(o,a)=>n.__awaiter(this,void 0,void 0,(function*(){let n=[];if(o){const e=(function(e,n){const i=e.getItem(t._PERSISTENTCACHE_KEY);if(null===i)return null;const s=Date.now()/1e3;let o,a=[];try{o=u.unpackProto(i,d.apex_metrics_web.ApexMetricsCacheData)}catch(e){return n.reportException({err:e,tags:["js:web:amp-sink","js:web:amp-sink/local-storage"],severity:"non-critical"}),null}if(!o.config||!o.state||!o.timeStored)return n.reportStack("Sink cache was missing data",{tags:["js:web:amp-sink","js:web:amp-sink/local-storage"]}),null;const c=(function(e,t){if("number"!=typeof e)return e.sub(t).toNumber();if("number"==typeof t)return e-t;return t.sub(e).negate().toNumber()})(s,o.timeStored.seconds);if(c<0)return n.reportStack("Sink cache was stored in the future instead of the past",{tags:["js:web:amp-sink","js:web:amp-sink/local-storage"],exc_extra:{cacheDataAge:c}}),null;const l={};o.config&&(a=o.config.reportingConfigs.map(e=>e.metricNamespace),l.reporting_configs=o.config.reportingConfigs?o.config.reportingConfigs.filter(e=>c({metric_namespace:e.metricNamespace,max_time_until_refresh_seconds:e.maxTimeUntilRefreshSeconds,stop_publication_for_seconds:e.stopPublicationForSeconds,drop_samples:e.dropSamples?r.protobufCoinToAPIv2Coin(e.dropSamples):void 0,drop_periods:e.dropPeriods?r.protobufCoinToAPIv2Coin(e.dropPeriods):void 0,drop_fraction_of_hosts_per_metric:e.dropFractionOfHostsPerMetric,aggregation_interval_seconds:e.aggregationIntervalSeconds})):[],l.publication_interval_seconds=o.config.publicationIntervalSeconds,l.max_scopes_per_request=o.config.maxScopesPerRequest,l.stop_publication_for_seconds=o.config.stopPublicationForSeconds,l.debug_infos=o.config.debugInfos);return{config:l,state:o.state,knownNamespaces:a}})(o,s);if(e){n=e.knownNamespaces;const t=new Set;if(e.config.reporting_configs.forEach(e=>t.add(e.metric_namespace)),!n.some(e=>!t.has(e)))return e}}const c=new Set;n.forEach(e=>c.add(e));const l=i.detectOS(),p=yield e();return{knownNamespaces:n,config:yield p.ns("client_metrics").rpc("record",h([],c,m,l,a),{}),state:{filterID:Math.floor(4294967296*Math.random())>>>0,namespaceCoinState:{}}}}))},t._PERSISTENTCACHE_KEY="amp-sink-cache",t.makeDefaultCacheFactory=function(){return()=>{try{return window.localStorage||null}catch(e){return null}}},t._ORIGIN_IDENTIFIER_KEY="amp-sink-origin-id";t.Apiv2MetricsSink=class{constructor(e,n,i,r,o,a,l,d,u,p){this.clientFactory=e,this.clock=n,this.initializer=i,this.cacheFactory=r,this.executor=o,this.randomEngine=a,this.databaseFactory=l,this.platformDetector=d,this.excReporter=u,this.nextRequest=null,this.knownNamespaces=new Set,this.bufferedSpans=[],this.bufferedSetSpans=[],this.instrumentation=c.Instrumentation.empty(),this.eventEmitter=new s.default,this.cache=this.cacheFactory(),this.originIdentifier=(function(e,n){if(e){let i=e.getItem(t._ORIGIN_IDENTIFIER_KEY);return null===i&&(i=n(),e.setItem(t._ORIGIN_IDENTIFIER_KEY,i)),i}return""})(this.cache,p),this.currentRequest=this.initializer(this.cache,this.originIdentifier).then(e=>(e&&this.updateConfiguration(e.config,e.state),this.eventEmitter.emit("initialized"),e.config||null))}getOriginId(){return this.originIdentifier}updateConfiguration(e,n){const{reporting_configs:s=[],stop_publication_for_seconds:o,publication_interval_seconds:a}=e,c=new Set;s.forEach(e=>{this.knownNamespaces.add(e.metric_namespace),c.add(e.metric_namespace)}),this.updateBlackoutCallback({value:o,unit:i.TimeUnit.SECONDS}),this.updatePublishTimer({value:a,unit:i.TimeUnit.SECONDS}),this.updateSpanGroupFilter(e,n,c),this.cache&&(function(e,n,i){try{const s=Math.floor(Date.now()/1e3),o=d.apex_metrics_web.ApexMetricsCacheData.create({config:d.apex_metrics_web.RecordNamespace.RecordResponse.create({reportingConfigs:n.reporting_configs?n.reporting_configs.map(e=>d.apex_metrics_web.RecordNamespace.MetricReportingConfigV2.create({metricNamespace:e.metric_namespace,maxTimeUntilRefreshSeconds:e.max_time_until_refresh_seconds,stopPublicationForSeconds:e.stop_publication_for_seconds,dropSamples:e.drop_samples?r.APIv2CoinToProtobufCoin(e.drop_samples):void 0,dropPeriods:e.drop_periods?r.APIv2CoinToProtobufCoin(e.drop_periods):void 0,dropFractionOfHostsPerMetric:e.drop_fraction_of_hosts_per_metric,aggregationIntervalSeconds:e.aggregation_interval_seconds})):[],publicationIntervalSeconds:n.publication_interval_seconds,maxScopesPerRequest:n.max_scopes_per_request,stopPublicationForSeconds:n.stop_publication_for_seconds,debugInfos:n.debug_infos||[]}),timeStored:l.google.protobuf.Timestamp.create({seconds:s,nanos:0}),state:i});e.setItem(t._PERSISTENTCACHE_KEY,u.packProto(o))}catch(e){}})(this.cache,e,n)}updateSpanGroupFilter(e,t,n){const{reporting_configs:i=[],max_scopes_per_request:s}=e,r=new Set,o=n.values();for(let e=o.next();!e.done;e=o.next())r.add(e.value);const c=a.makeNamespaceMap(i,t);this.spanGroupFilter=this.spanGroupFilter?this.spanGroupFilter.extend(s,c,r):new a.SpanGroupFilter(t.filterID,this.randomEngine,this.clock,s,c,r)}updateBlackoutCallback(e){0!==e.value?(this.blackoutCallback=()=>(this.blackoutCallback=null,this.eventEmitter.emit("publicationResumed"),!1),this.eventEmitter.emit("publicationPaused"),this.executor.executeEvery(e,this.blackoutCallback)):this.blackoutCallback=null}updatePublishTimer(e){const t=e.unit===i.TimeUnit.SECONDS?e.value:i.Instant.toMilliseconds(e)/1e3;if(0===e.value)return void(this.publishTimer=null);if(this.publishTimer&&i.Instant.toMilliseconds(this.publishTimer.period)===i.Instant.toMilliseconds(e))return;const s={period:e,callback:()=>this.publishTimer===s&&(this.nextRequest=this.currentRequest.then(()=>n.__awaiter(this,void 0,void 0,(function*(){this.nextRequest=null;const e=Math.floor(Date.now()/1e3),n=yield this.getDB();if(n)try{(yield o.checkAndSetPublishTime(n,e,t))&&(this.currentRequest=this.send())}catch(e){this.excReporter.reportException({err:e,tags:["js:web:amp-sink"],severity:"operational"})}}))),!0)};this.publishTimer=s,this.executor.executeEvery(this.publishTimer.period,this.publishTimer.callback)}send(){return n.__awaiter(this,void 0,void 0,(function*(){if(this.blackoutCallback)return this.eventEmitter.emit("publish",p.DENIED),null;const e=Math.floor(Date.now()/1e3),t={browser:this.platformDetector.detectBrowser()},n=yield this.getDB();if(!n)return null;let i,s,r,a,l;try{({scopes:i,storedNamespaces:s,spansRetained:r,samplesRetainedByNs:a,observationsRetained:l}=yield this.spanGroupFilter.partitionAndSerializeSpans(n,t,e,[c.SELF_INSTRUMENTATION_NAMESPACE]))}catch(e){return this.excReporter.reportException({err:e,tags:["js:web:amp-sink"],severity:"operational"}),null}let d=c.Instrumentation.empty();d.retainedSpans+=r;let u=0;a.forEach((e,t)=>{c.Instrumentation.incrementRetainedSamples(d,t,e),u+=e});let m=i.length>0;if(this.knownNamespaces.forEach(e=>s.add(e)),!m){const e=this.spanGroupFilter.getConfiguredNamespaces(),t=s.values();for(let n=t.next();!n.done;n=t.next())if(!e.has(n.value)){m=!0;break}}let g=null;if(m){d=yield o.loadInstrumentation(n,d);const e=this.platformDetector.detectOS(),a=h(i,s,_,e,this.originIdentifier),c=this.clock.now();d.requestAttempts++;try{const n=yield this.clientFactory();g=yield n.ns("client_metrics").rpc("record",a,{}),d=yield this.reportInstrumentation(e,d,c,t)}catch(e){d.requestDroppedSpans+=r,d.requestDroppedSamples+=u,d.requestDroppedSetObservations+=l}g&&this.updateConfiguration(g,this.spanGroupFilter.getState())}return yield o.storeInstrumentation(n,d),this.eventEmitter.emit("publish",p.ALLOWED),g}))}reportInstrumentation(e,s,r,o){return n.__awaiter(this,void 0,void 0,(function*(){const n=i.Instant.toMilliseconds(this.clock.now())-i.Instant.toMilliseconds(r);if((function(e){return!!e.name&&("android"===e.name[".tag"]||"ios"===e.name[".tag"])})(e))try{const i=Object.assign({client_version:t.CLIENT_VERSION.toString()},o),r=h([c.Instrumentation.toScope(s,this.originIdentifier,n,i)],new Set([c.SELF_INSTRUMENTATION_NAMESPACE]),_,e,this.originIdentifier),a=yield this.clientFactory();return yield a.ns("client_metrics").rpc("record",r,{}),c.Instrumentation.empty()}catch(e){return s}return c.Instrumentation.report(s,i.MetricsReporterImpl.root(this,this.clock,this.originIdentifier),n,t.CLIENT_VERSION)}))}getDB(){return n.__awaiter(this,void 0,void 0,(function*(){return this.database||(this.database=yield this.databaseFactory()),this.database}))}recordSpan(e){if(e.namespace!==c.SELF_INSTRUMENTATION_NAMESPACE){let t="UNCONFIGURED";this.spanGroupFilter&&this.spanGroupFilter.getConfiguredNamespaces().has(e.namespace)&&(t=e.namespace),this.instrumentation.submittedSpans++,c.Instrumentation.incrementSubmittedSamples(this.instrumentation,t,e.samples.length)}this.knownNamespaces.add(e.namespace),this.bufferedSpans.push(e),this.maybeScheduleNextRequest()}recordSetSpan(e){if(e.namespace!==c.SELF_INSTRUMENTATION_NAMESPACE){let t="UNCONFIGURED";this.spanGroupFilter&&this.spanGroupFilter.getConfiguredNamespaces().has(e.namespace)&&(t=e.namespace),c.Instrumentation.incrementSetObservations(this.instrumentation,t,e.samples.length)}this.knownNamespaces.add(e.namespace),this.bufferedSetSpans.push(e),this.maybeScheduleNextRequest()}maybeScheduleNextRequest(){this.nextRequest||(this.nextRequest=this.currentRequest.then(()=>n.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getDB();if(!e)return;const t=this.bufferedSpans,n=this.bufferedSetSpans;this.bufferedSpans=[],this.bufferedSetSpans=[];const i=this.instrumentation;this.instrumentation=c.Instrumentation.empty();try{yield Promise.all([o.storeIncomingSpans(e,t),o.storeIncomingSetSpans(e,n),o.storeInstrumentation(e,i)])}catch(e){this.excReporter.reportException({err:e,tags:["js:web:amp-sink"],severity:"operational"})}this.publishTimer||(this.currentRequest=this.send()),this.nextRequest=null}))))}}})),define("metaserver/static/js/modules/clean/metrics/server_view_sink",["require","exports","tslib"],(function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerViewMetricsSink=void 0;t.ServerViewMetricsSink=class{constructor(){this.spans=[],this.bridgeInitialized=!1}recordSpan(e){this.spans.push(e),this.bridgeInitialized||this.initializeBridgeSink()}recordSetSpan(e){}initializeBridgeSink(){return n.__awaiter(this,void 0,void 0,(function*(){this.bridgeInitialized=!0;const t=yield new Promise((t,n)=>{e(["metaserver/static/js/modules/clean/server_side_client_view_bridge"],t,n)}).then(n.__importStar);(yield t.IsBridgeFunctionSupported("reportMetricsV2"))?(setInterval(()=>{this.spans.length>0&&(t.ReportMetrics(this.spans),this.spans=[])},5e3),window.addEventListener("beforeunload",()=>{this.spans.length>0&&(console.log(`Attempting to send ${this.spans.length} pending AMP spans`),t.ReportMetrics(this.spans),this.spans=[])})):setInterval((function(){this.spans=[]}),6e4)}))}}})),define("metaserver/static/js/modules/clean/metrics/unload",["require","exports","tslib","eventemitter3"],(function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnloadSink=void 0,i=n.__importDefault(i);t.UnloadSink=class{constructor(e,t){this.cacheFactory=e,this.innerSink=t,this.eventEmitter=new i.default,this.onUnloadChange=()=>{this.isUnload()||this.flushToInner()},this.persistor=new r(this.cacheFactory()),this.listener=new s(this.onUnloadChange),this.onUnloadChange()}flushToInner(){this.persistor.getAllAndClear().forEach(e=>{this.recordSpanToInner(e)})}isUnload(){return Boolean(this.listener.isUnload)}recordSpan(e){if(this.isUnload())return this.persistor.persistSpans([e]),void this.eventEmitter.emit("spansPersistedInUnload");this.recordSpanToInner(e)}recordSetSpan(e){}recordSpanToInner(e){const t=Object.assign(Object.assign({},e),{fromUnloadSink:!0});this.innerSink.recordSpan(t)}};class s{constructor(e){this.onUnloadChange=e,this._isUnload=!1,this.listenForNavigationChanges()}get isUnload(){return this._isUnload}set isUnload(e){this._isUnload!==e&&(this._isUnload=e,this.onUnloadChange())}listenForNavigationChanges(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener&&"function"==typeof document.addEventListener){const e=()=>{"hidden"===document.visibilityState?this.isUnload=!0:"visible"===document.visibilityState&&(this.isUnload=!1)},t=()=>{this.isUnload=!0,window.removeEventListener("pagehide",t),document.removeEventListener("visibilitychange",e)};window.addEventListener("pagehide",t),document.addEventListener("visibilitychange",e)}}}class r{constructor(e){this.cache=e,this.CACHE_KEY="amp-persisted-spans-v2",this.OLD_CACHE_KEY="amp-persisted-spans"}getAllAndClear(){if(!this.cache)return[];const e=this.retrieveSpans();try{this.cache.setItem(this.CACHE_KEY,JSON.stringify([])),this.cache.removeItem(this.OLD_CACHE_KEY)}catch(e){}return e}persistSpans(e){if(!this.cache||!e)return;const t=this.retrieveSpans();t.push(...e);try{this.cache.setItem(this.CACHE_KEY,JSON.stringify(t))}catch(e){}}retrieveSpans(){let e=[];try{e=JSON.parse(this.cache.getItem(this.CACHE_KEY))}catch(e){}return e||[]}}})),define("metaserver/static/js/modules/clean/perf_tools/resource_utils",["require","exports","tslib","metaserver/static/js/modules/clean/js_client_stopwatch","metaserver/static/js/modules/clean/perf_tools/cpu_utils"],(function(e,t,n,i,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.summarizePerformanceResourceTimings=t.logResourceTiming=t.logResourcesData=void 0,s=n.__importStar(s),t.logResourcesData=function(e){(function(e){const t=window.requireContexts;if(!t)return;const n=s.listExecutionPerfMeasurementsForRequireContexts(t),r=i.JSStopwatch.createDetachedStopwatch("resource_init_timeline",e);n.forEach(e=>{const t=r.startSpan(e.name,{startTime:e.startTime});r.addSpanAnnotation(e.name,"totalTimeNs",Math.round(1e6*e.totalTime).toString(),t),r.endSpan(e.name,{endTime:e.startTime+e.totalTime,spanId:t})}),r.logData()})(e),(function(e){const t=i.JSStopwatch.createDetachedStopwatch("resource_timeline",e),n={},s=window.performance.getEntriesByType("resource");if(s instanceof Array)for(const e of s){let i=o(e);if(!i)continue;const s=n[i]||0;n[i]=s+1,s>0&&(i=`${i}-${s}`);const r=t.startSpan(i,{startTime:e.startTime,async:!0}),c=a(e);t.addSpanAnnotation(i,"type",c,r),0===e.transferSize?t.addSpanAnnotation(i,"cached","true",r):void 0===e.transferSize?t.addSpanAnnotation(i,"cached","unknown",r):t.addSpanAnnotation(i,"cached","false",r),e.responseEnd0){const e=t.substring(i);if([".png",".gif",".jpg",".svg"].indexOf(e)>-1)return"img";if(".js"===e)return"script";if(".css"===e)return"css"}return-1===["css","img","script","link"].indexOf(n)?"xmlhttprequest"===n?"ajax":"other":n}t.logResourceTiming=function(e){const t=window.performance.getEntriesByType("resource").filter(t=>-1!==t.name.indexOf(e))[0];if(!t||!t.responseEnd)return;const n=`resource_response_end_${e}`;return i.JSStopwatch.create_stopwatch_if_not_exist("resource_timing"),i.JSStopwatch.recordTrace(n,{stopwatchName:"resource_timing",traceTime:t.responseEnd}),t},t.summarizePerformanceResourceTimings=function(e,t){const n={pre:{},total:{}};if(i.JSStopwatch.create_stopwatch_if_not_exist("resource_timeline"),e instanceof Array)for(const i of e){const e=a(i),s=[];t&&i.responseEnd<=t&&(e in n.pre||(n.pre[e]={count:0,total_time:0,last_transfer_end:0}),s.push(n.pre[e])),e in n.total||(n.total[e]={count:0,total_time:0,last_transfer_end:0}),s.push(n.total[e]),s.forEach((function(t){var n;t.count++,t.total_time+=i.duration,t.last_transfer_end=Math.max(t.last_transfer_end,i.responseEnd),("css"===(n=e)||"script"===n||"img"===n)&&void 0!==i.transferSize&&void 0!==i.encodedBodySize&&i.encodedBodySize(e.endsWith("anon")&&(e+="-"+t++),{jsExecutionType:c(e),name:e,startTime:n,totalTime:i}))}{const t=e.module_callback_times;return Object.keys(t).filter(e=>t[e].callbackDuration&&t[e].callbackTime).map(e=>({jsExecutionType:c(e),name:e,startTime:t[e].callbackTime,totalTime:t[e].callbackDuration}))}}function r(e){let t=[];for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t=t.concat(s(i))}return t}function o(e){return Object.keys(e).map(t=>{const n=e[t];return{measurement:{jsExecutionType:a(t),name:t,startTime:n.start,totalTime:n.end-n.start},annotations:n.annotations}})}function a(e){return e.startsWith("dws-processChunk")?i.DWS:i.UNKNOWN}function c(e){return e.startsWith("execCb.anon")||e.startsWith("overhead.anon")||e.startsWith("execCb.require-tier")||e.startsWith("overhead.require-tier")?i.OTHER:e.startsWith("execCb")||e.startsWith("overhead")?i.MODULE:i.UNKNOWN}Object.defineProperty(t,"__esModule",{value:!0}),t.logCumulativeExecutionTimes=t.cumulativeExecutionTimesBefore=t.listAnnotatedExecutionPerfMeasurementsForEnsemble=t.listExecutionPerfMeasurementsForRequireContexts=t.getAllGlobalExecutionPerfMeasurements=t.ALL_JS_EXECUTION_TYPES=t.JSExecutionType=void 0,(function(e){e.DWS="dws",e.MODULE="module",e.OTHER="other",e.UNKNOWN="unknown"})(i=t.JSExecutionType||(t.JSExecutionType={})),t.ALL_JS_EXECUTION_TYPES=[i.DWS,i.MODULE,i.OTHER,i.UNKNOWN],t.getAllGlobalExecutionPerfMeasurements=function(){let e=[];return window.ensemble&&window.ensemble.getJSStopwatchData&&(e=e.concat(o(window.ensemble.getJSStopwatchData()).map(({measurement:e})=>e))),window.requireContexts&&(e=e.concat(r(window.requireContexts))),e},t.listExecutionPerfMeasurementsForRequireContexts=r,t.listAnnotatedExecutionPerfMeasurementsForEnsemble=o,t.cumulativeExecutionTimesBefore=function(e,t){const n={};for(const i in e)if(e.hasOwnProperty(i)){const s=e[i];n[i]={},t.forEach(e=>{0{s.recordTrace(`cpu_before_${e}_due_to_${t}`,i[e][t]||0)});s.logData()}})),define("metaserver/static/js/modules/clean/perf_tools/browser_perf_utils",["require","exports","tslib","metaserver/static/js/modules/core/xhr","metaserver/static/js/modules/constants/request","metaserver/static/js/modules/clean/js_client_stopwatch","metaserver/static/js/modules/constants/webtiming"],(function(e,t,n,i,s,r,o){"use strict";function a(e){const t=window.performance.timing,n={navigation_start:t.navigationStart,unload_event_start:t.unloadEventStart,unload_event_end:t.unloadEventEnd,redirect_start:t.redirectStart,redirect_end:t.redirectEnd,fetch_start:t.fetchStart,domain_lookup_start:t.domainLookupStart,domain_lookup_end:t.domainLookupEnd,connect_start:t.connectStart,secure_connect_start:t.secureConnectionStart,connect_end:t.connectEnd,request_start:t.requestStart,response_start:t.responseStart,response_end:t.responseEnd,dom_loading:t.domLoading,dom_interactive:t.domInteractive,dom_content_loaded_event_start:t.domContentLoadedEventStart,dom_content_loded_event_end:t.domContentLoadedEventEnd,dom_complete:t.domComplete,load_event_start:t.loadEventStart,load_event_end:t.loadEventEnd},a={};a.request_id=s.REQUEST_ID,a.referrer=document.referrer;const c=r.JSStopwatch.createDetachedStopwatch("browser_perf",e);for(const e in n)n.hasOwnProperty(e)&&(a[e]=n[e],n[e]&&c.recordTrace(e,n[e]-t.navigationStart));c.logData(),o.LOG_BROWSER_PERFORMANCE_INFO&&i.sendXhr("/alternate_wtl_browser_performance_info",a)}Object.defineProperty(t,"__esModule",{value:!0}),t.logBrowserPerformanceInfo=t.logBrowserPerfData=void 0,i=n.__importStar(i),s=n.__importStar(s),o=n.__importStar(o),t.logBrowserPerfData=function(e){(function(e){const t=r.JSStopwatch.createDetachedStopwatch("performance_marks",e),n=window.performance.getEntriesByType("mark");if(n instanceof Array)for(const e of n)t.recordTrace(e.name,e.startTime);t.logData()})(e),a(e)},t.logBrowserPerformanceInfo=a})),define("metaserver/static/js/modules/clean/perf_tools/web_timing_logger_types",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebTimerEvent=t.NavigationType=void 0;class n{static getFromNavigation(e){switch(e.type){case e.TYPE_NAVIGATE:return n.NAVIGATE;case e.TYPE_RELOAD:return n.RELOAD;case e.TYPE_BACK_FORWARD:return n.BACK_FORWARD}}}t.NavigationType=n,n.NAVIGATE="navigate",n.RELOAD="reload",n.BACK_FORWARD="back_forward";class i{constructor(e,t,n=!1,s=!0,r){this.name=e,this.flag=1<{let e,t;const n=[];for(t=0,e=t;t<=255;t++,e=t)n.push((e+256).toString(16).substr(1));return n})();t.InsecureUUID=class{static bytesToHex(e){return e.map(e=>n[e]).join("")}static toByte(e){return 255&e}static bytesToUUIDString(e){return[e.slice(0,4),e.slice(4,6),e.slice(6,8),e.slice(8,10),e.slice(10,16)].map(e=>this.bytesToHex(e)).join("-")}static getRandomBytes(){const e=new Array(16);return this.getInsecureRandomValues(e),e.map(e=>this.toByte(e))}static getInsecureRandomValues(e){const t=Math.pow(2,8);for(let n=0;n({type:i.TimingDataType.Trace,name:e.name,endTime:e.startTime}));if(t.length>0){const i=n.JSStopwatch.createDetachedStopwatch("paint",e);i.recordEntries(t),i.logData()}},t.logVisibilityChangeEvents=function(e,t){if(!window.performance||!window.performance.getEntriesByType)return;let s=Number.MAX_VALUE;e.time_to_interactive&&(s=e.time_to_interactive-e.start_time);const r=window.performance.getEntriesByType("mark").filter(e=>e.name.startsWith("VisibilityState.")).map(e=>({visibility:e.name,time:e.startTime})),o={"VisibilityState.visible":0,"VisibilityState.hidden":0};let a;const c=e=>{a&&a.time{c(e.time),l.push({type:i.TimingDataType.Trace,name:`visibility-change-${t}`,endTime:e.time,annotations:{visibility:e.visibility}}),a=0===t?{visibility:e.visibility,time:0}:e}),c(window.performance.now());for(const e in o)o.hasOwnProperty(e)&&l.push({type:i.TimingDataType.Trace,name:`total-${e}-time`,endTime:o[e]});const d=n.JSStopwatch.createDetachedStopwatch("visibility",t);d.recordEntries(l),d.logData()}})),define("metaserver/static/js/modules/clean/web_module_timing",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add_module=t.get_module_times=void 0,t.get_module_times=function(){const e=[];for(const t in window.requireContexts){const n=window.requireContexts[t].module_callback_times;for(const t in n)if(n.hasOwnProperty(t)){const i=n[t];if(null!=i.loadTime){const t={load_time:i.loadTime,callback_duration:i.callbackDuration,callback_time:i.callbackTime,name:i.name,url:i.url,parent:i.parent};e.push(t)}}}return e},t.add_module=function(){}})),define("metaserver/static/js/modules/clean/web_timing_logger",["require","exports","tslib","apex-metrics/index","metaserver/static/js/modules/clean/active_user","metaserver/static/js/modules/clean/metrics/index","metaserver/static/js/modules/clean/devtools/panels/performance/perf_hub_actions","metaserver/static/js/modules/clean/event_load","metaserver/static/js/modules/clean/web_module_timing","metaserver/static/js/modules/clean/window_util","metaserver/static/js/modules/clean/perf_tools/resource_utils","metaserver/static/js/modules/clean/perf_tools/web_timing_logger_types","metaserver/static/js/modules/clean/perf_tools/web_timing_utils","metaserver/static/js/modules/clean/js_client_stopwatch","metaserver/static/js/modules/clean/perf_tools/browser_perf_utils","metaserver/static/js/modules/clean/init_react","metaserver/static/js/modules/clean/perf_tools/cpu_utils","metaserver/static/js/modules/clean/js_basic_stopwatch","metaserver/static/js/modules/constants/request","metaserver/static/js/modules/constants/webtiming","metaserver/static/js/modules/constants/page_load","metaserver/static/js/modules/core/assert","metaserver/static/js/modules/core/browser","metaserver/static/js/modules/core/exception","metaserver/static/js/modules/core/xhr","metaserver/static/js/dropbox/proto/js_init_data/web_timing_logger/web_timing_logger","metaserver/static/js/modules/clean/visibility_logging","metaserver/static/js/modules/clean/user_centric_perf_metrics/metrics_logger"],(function(e,t,n,i,s,r,o,a,c,l,d,u,p,m,_,h,g,f,S,v,w,b,T,E,y,I,O,N){"use strict";var x;Object.defineProperty(t,"__esModule",{value:!0}),t.log_js_modules_fetched_data_required_for_tti=t.log_js_modules_application_code_start=t.waitForTTI=t.mark_time_to_interactive=t.mark_time_to_view=t.set_tti_exclusion_flow=t.time_since_start=t.start_time=t.reset=t.initialize=t.initialize_module=t.time_to_interactive=t.time_to_view=t.delete_timer=t.get_timer=t.perfHubClassName=void 0,a=n.__importStar(a),l=n.__importStar(l),S=n.__importStar(S),v=n.__importStar(v),w=n.__importStar(w),T=n.__importStar(T),E=n.__importStar(E),y=n.__importStar(y),(function(e){e[e.NEW=1]="NEW",e[e.RUNNING=2]="RUNNING",e[e.ABORTED=3]="ABORTED",e[e.CLOSED=4]="CLOSED"})(x||(x={})),t.perfHubClassName="perf-hub-link-container";const C=["navigation_type","referrer","repo_rev","source_type","active_user_id"],A=["tti_flow","tti_exclusion_flow","is_dws2"];function k(){return"hidden"===window.document.visibilityState}const R=[[u.WebTimerEvent.APPLICATION_START,u.WebTimerEvent.MARK_TIME_TO_VIEW,u.WebTimerEvent.FETCHED_DATA_FOR_TTI,u.WebTimerEvent.MARK_TIME_TO_INTERACTIVE],[u.WebTimerEvent.TIME_TO_INTERACTIVE]].reverse();let P=1;const D=["requirejs_start","ensemble_payload_start","body_start"];const M=["craft_fast_prefetch_done","dws_core_externals_loaded","dws_ensemble_init","dws-processChunk-embedded-app-done-1","dws-processChunk-embedded-app-require_config-1","module_init","last_js_const_end","pagelet_render_on_page_embedded-app","pagelet_css_loaded_embedded-app"];class j{constructor(){m.JSStopwatch.create_stopwatch_if_not_exist("web_timing_logger"),this.shouldLogJsModuleTimes=()=>Math.random()<.001}buildBaseParams(e,t,n={}){const i=e.start_time,r=e.subtypes||{};e.tti_flow&&(r.tti_flow=e.tti_flow);const o={log_source:t.name,subtypes:JSON.stringify(r),correlation_id:e.correlation_id};let a,c;e.extra_columns&&Object.keys(e.extra_columns).forEach(t=>{const n=e.extra_columns[t];n&&(o[t]=n)}),Object.keys(n).forEach(e=>{const t=n[e];t&&(o[e]=t)}),S.IS_HTTP2&&(o.is_spdy=!0),e.is_pagelet&&(o.is_pagelet=!0),e.is_dws&&(o.is_dws=!0),e.is_early_ensemble&&(o.is_early_ensemble=!0),o.delayed_tti_for_css=e.delayed_tti_for_css,""!==e.tti_exclusion_flow&&(o.tti_exclusion_flow=e.tti_exclusion_flow),a=e.log_time_to_view&&null!=e.time_to_view?e.time_to_view-i:null,c=e.log_time_to_interactive&&null!=e.time_to_interactive?e.time_to_interactive-i:null;const l={navigation_type:this.get_navigation_type(),server_request_start_time:S.REQUEST_START_TIME,extra_columns:JSON.stringify(o),subtypes:JSON.stringify(r),source_type:e.source_type,page_load_time:e.end_time-e.start_time,repo_rev:w.REPO_REV};return this.shouldLogJsModuleTimes()&&Z(l),e.log_time_to_view&&(l.time_to_view=a),e.log_time_to_interactive&&(l.time_to_interactive=c),l.url=T.get_href(),0===l.url.indexOf("/dws2/")&&(l.url=l.url.substring("/dws2/".length-1)),l.active_user_id=s.getActiveUserId(),l.referrer=document.referrer,l.request_id=e.request_id||S.REQUEST_ID,l.request_tracing_enabled=S.REQUEST_TRACING_ENABLED,window.ensemble&&window.ensemble.viewer&&(l.dws_page_name=window.ensemble.getPageName()),window.EDISON_PAGE_NAME&&(l.edison_page_name=window.EDISON_PAGE_NAME),l}get_navigation_type(){return u.NavigationType.getFromNavigation(window.performance.navigation)}log(e,n,i=!1){const s=m.JSStopwatch.startSpan("wtl_endpoint",{stopwatchName:"web_timing_logger"});m.JSStopwatch.addSpanAnnotation("wtl_endpoint","navigation_type",n.navigation_type,{stopwatchName:"web_timing_logger",spanId:s});const r=y.sendXhr("/alternate_wtl",n);r.onreadystatechange=e=>{if(r.readyState===XMLHttpRequest.DONE&&200===r.status){m.JSStopwatch.endSpan("wtl_endpoint",{stopwatchName:"web_timing_logger",spanId:s});const e=document.getElementsByClassName(t.perfHubClassName);if(i&&e.length){const e=JSON.parse(r.responseText);e.status&&o.PerfHubActions.add_web_timing_details(e)}}}}}class L extends j{constructor(){super()}shouldLog(e){return e.initialized&&!e.have_logged_web_timing&&void 0!==e.end_time&&(!e.log_time_to_view||null!=e.time_to_view)&&(!e.log_time_to_interactive||null!=e.time_to_interactive)}logTiming(e,t){e.have_logged_web_timing=!0;const n=this.buildBaseParams(e,t),i=G(e,n);return this.log(e,n,!1),i}get_navigation_type(){return"ajax"}}class U extends j{constructor(){super()}shouldLog(e){if(!e.initialized||e.have_logged_web_timing)return!1;const t=window.performance.timing,n=e.start_time,i=e.end_time;return!(!n||!i)&&(!(e.log_time_to_view&&!(e.ttv_at_dom_interactive&&t.domInteractive||null!=e.time_to_view))&&!(e.log_time_to_interactive&&!(e.tti_at_dom_interactive&&t.domInteractive||null!=e.time_to_interactive)))}logTiming(e,t){const n=window.performance,s=n.timing,o=g.getAllGlobalExecutionPerfMeasurements();let a=e.timesStagesWereReached["dws_embedded-app_require_config_callback"];void 0===a?a=e.timesStagesWereReached.application_code_start:e.timesStagesWereReached.hasOwnProperty("application_code_start")&&(a=Math.min(a,e.timesStagesWereReached.application_code_start)),m.JSStopwatch.startSpan("process_nav_timing",{stopwatchName:"web_timing_logger"});const c=this.buildBaseParams(e,t,{}),l=G(e,c),p=window.ensemble&&window.ensemble.getJSStopwatchData?window.ensemble.getJSStopwatchData():{},f="function"==typeof n.getEntriesByType?d.summarizePerformanceResourceTimings(n.getEntriesByType("resource"),a):{pre:{},total:{}};c.browser_time=(s.redirectStart||s.fetchStart)-e.start_time,c.redirect_time=s.fetchStart-e.start_time,c.dns_time=s.domainLookupEnd-e.start_time,c.tcp_connect_time=(s.secureConnectionStart||s.requestStart)-e.start_time,c.ssl_connect_time=s.requestStart-e.start_time,c.time_to_first_byte=s.responseStart-e.start_time,c.time_to_last_byte=s.responseEnd-e.start_time,c.dom_load_time=s.domContentLoadedEventEnd-e.start_time,c.idle_cpu_time=e.timing_results?Math.round(e.timing_results.idleCPUTime):void 0,c.total_tracked_cpu_time=e.timing_results?Math.round(e.timing_results.totalTrackedCPUTime):void 0,c.untracked_time_after_first_byte=e.timing_results&&null!=e.timing_results.untrackedTimeAfterFirstByte?Math.round(e.timing_results.untrackedTimeAfterFirstByte):void 0,(function(e,t){for(const n in e)e.hasOwnProperty(n)&&(t[`resource_${n}_count`]=e[n].count,t[`resource_${n}_avg_time`]=e[n].total_time/e[n].count||1,void 0!==e[n].total_size&&(t[`resource_${n}_total_size`]=e[n].total_size),void 0!==e[n].transfer_size&&(t[`resource_${n}_transfer_size`]=e[n].transfer_size))})(f.total,c),(function(e,t){let n;for(n in e)if(e.hasOwnProperty(n)){const i=e[n];for(const e in i)if(i.hasOwnProperty(e)){const s=i[e].transfer_size,r=i[e].total_size,o=i[e].count,a=i[e].total_time;if(t.recordTrace(`${n}_${e}_count`,o),t.recordTrace(`${n}_${e}_total_time`,a),void 0!==s&&void 0!==r&&r>0){const i=s/r;t.recordTrace(`${n}_${e}_transferred_size`,s),t.recordTrace(`${n}_${e}_total_size`,r),t.recordTrace(`${n}_percent_${e}_transferred`,100*i)}t.recordTrace(`${n}_last_${e}_transfer_end`,i[e].last_transfer_end)}}t.logData()})(f,m.JSStopwatch.createDetachedStopwatch("resources_percent_transferred",l)),m.JSStopwatch.addSpanAnnotation("process_nav_timing","logged_resources","1",{stopwatchName:"web_timing_logger"}),this.shouldLogJsModuleTimes()&&Z(c),m.JSStopwatch.addSpanAnnotation("process_nav_timing","logged_modules","1",{stopwatchName:"web_timing_logger"}),m.JSStopwatch.endSpan("process_nav_timing",{stopwatchName:"web_timing_logger"}),e.is_pagelet&&Object.getOwnPropertyNames(p).length>0&&(function(e,t,n){const i=(function(e,t){const n=g.listAnnotatedExecutionPerfMeasurementsForEnsemble(t),i=m.JSStopwatch.createDetachedStopwatch("ensemble",e),s=n.map(({measurement:e,annotations:t})=>({name:e.name,startTime:e.startTime,endTime:e.startTime+e.totalTime,annotations:t}));return Y(i,s),i})(n,t);let s=void 0,r=void 0;for(const n in t)t.hasOwnProperty(n)&&(X.includes(n)&&(e.timesStagesWereReached[n]=t[n].start),["dws_embedded-app_require_config_callback"].includes(n)&&(s=s?Math.min(s,t[n].end):t[n].end),Q.test(n)&&(r=r?Math.max(r,t[n].end):t[n].end));r&&i.recordTrace("last_js_const_end",r);s&&i.recordTrace("module_init",s)})(e,p,l),_.logBrowserPerfData(l),(function(e,t,n){g.logCumulativeExecutionTimes(e,g.cumulativeExecutionTimesBefore(t,n))})(l,e.timesStagesWereReached,o),this.get_navigation_type()===u.NavigationType.NAVIGATE&&((function(e){const t=h.getReactInitData();Y(m.JSStopwatch.createDetachedStopwatch("init_react",e),t)})(l),d.logResourcesData(l)),m.JSStopwatch.log_stored_results();const S=(function(e,t){const n={is_dws:String(e.is_dws),source_type:String(e.source_type),js_preloads_enabled:String(e.js_preloads_enabled),require_preloads_enabled:String(e.require_preloads_enabled),css_preloads_enabled:String(e.css_preloads_enabled),alternative_css_load_strategy_enabled:String(e.alternative_css_load_strategy_enabled),previews_preconnect_enabled:String(e.previews_preconnect_enabled),rollup_format:e.rollup_format};let i="";return e.subtypes.amp_tti_flow?i=e.subtypes.amp_tti_flow:t.dws_page_name?i=`dws_page_name:${t.dws_page_name}`:t.edison_page_name&&(i=`edison_page_name:${t.edison_page_name}`),""!==i&&(n.product=i),t.navigation_type&&(n.navigation_type=t.navigation_type),n})(e,c),v=r.getMetricsReporter().child(S),w=(function(e,t){return t.navigation_type===u.NavigationType.NAVIGATE||"ajax"===t.navigation_type})(0,c),b=r.getUnloadMetricsReporter().child(S);return N.logUserCentricPerfMetrics(b,w),w&&((function(e,t){if(e.time_to_interactive){t.createStats({ns:"web_timing",name:"temp/time-to-interactive"}).recordDuration(e.time_to_interactive,i.TimeUnit.MILLISECONDS)}})(c,v),(function(e,t){let n;for(n in e)if(e.hasOwnProperty(n)){const s=e[n];for(const e in s)if(s.hasOwnProperty(e)){const{transfer_size:r,total_size:o,count:a,total_time:c,last_transfer_end:l}=s[e];t.createStats({ns:"web_timing",name:`temp/resources/${n}/${e}/count`}).record(a),t.createStats({ns:"web_timing",name:`temp/resources/${n}/${e}/total-time`}).recordDuration(c,i.TimeUnit.MILLISECONDS),t.createStats({ns:"web_timing",name:`temp/resources/${n}/${e}/last-transfer-end`}).recordDuration(l,i.TimeUnit.MILLISECONDS),void 0!==r&&void 0!==o&&o>0&&(t.createStats({ns:"web_timing",name:`temp/resources/${n}/${e}/transferred-size`}).record(r),t.createStats({ns:"web_timing",name:`temp/resources/${n}/${e}/total-size`}).record(o))}}})(f,v),e.is_pagelet&&Object.getOwnPropertyNames(p).length>0&&(function(e,t,n){const s=g.listAnnotatedExecutionPerfMeasurementsForEnsemble(t);let r=void 0,o=void 0;s.forEach(({measurement:t})=>{const s=t.startTime+t.totalTime;-1!==M.indexOf(t.name)&&n.createStats({ns:"web_timing",name:`temp/ensemble-timing/${t.name}`}).recordDuration(s,i.TimeUnit.MILLISECONDS),X.includes(t.name)&&(e.timesStagesWereReached[t.name]=t.startTime),["dws_embedded-app_require_config_callback"].includes(t.name)&&(r=r?Math.min(r,s):s),Q.test(t.name)&&(o=o?Math.max(o,s):s)}),void 0!==o&&n.createStats({ns:"web_timing",name:"temp/last-js-const-end"}).recordDuration(o,i.TimeUnit.MILLISECONDS),void 0!==r&&n.createStats({ns:"web_timing",name:"temp/module-init"}).recordDuration(r,i.TimeUnit.MILLISECONDS)})(e,p,v),(function(e,t){e.getEntriesByType("mark").filter(e=>D.indexOf(e.name)>-1).forEach(e=>{t.createStats({ns:"web_timing",name:`temp/browser-perf/marks/${e.name}`}).recordDuration(e.startTime,i.TimeUnit.MILLISECONDS)})})(n,v),(function(e,t){const[n=null]=e.getEntriesByType("navigation");n&&([["temp/browser-perf/navigation/unload-event-start",n.unloadEventStart],["temp/browser-perf/navigation/unload-event-end",n.unloadEventEnd],["temp/browser-perf/navigation/dom-interactive",n.domInteractive],["temp/browser-perf/navigation/dom-content-loaded-event-start",n.domContentLoadedEventStart],["temp/browser-perf/navigation/dom-content-loaded-event-end",n.domContentLoadedEventEnd],["temp/browser-perf/navigation/dom-complete",n.domComplete],["temp/browser-perf/navigation/load-event-start",n.loadEventStart],["temp/browser-perf/navigation/load-event-end",n.loadEventEnd],["temp/browser-perf/navigation/redirect-count",n.redirectCount],["temp/browser-perf/navigation/worker-start",n.workerStart],["temp/browser-perf/navigation/redirect-start",n.redirectStart],["temp/browser-perf/navigation/redirect-end",n.redirectEnd],["temp/browser-perf/navigation/fetch-start",n.fetchStart],["temp/browser-perf/navigation/domain-lookup-start",n.domainLookupStart],["temp/browser-perf/navigation/domain-lookup-end",n.domainLookupEnd],["temp/browser-perf/navigation/connect-start",n.connectStart],["temp/browser-perf/navigation/connect-end",n.connectEnd],["temp/browser-perf/navigation/secure-connect-start",n.secureConnectionStart],["temp/browser-perf/navigation/request-start",n.requestStart],["temp/browser-perf/navigation/response-start",n.responseStart],["temp/browser-perf/navigation/response-end",n.responseEnd],["temp/browser-perf/navigation/transfer-size",n.transferSize]].forEach(([e,n])=>{if("number"==typeof n){t.createStats({ns:"web_timing",name:e}).recordDuration(n,i.TimeUnit.MILLISECONDS)}}),[["temp/browser-perf/navigation/encoded-body-size",n.encodedBodySize],["temp/browser-perf/navigation/decoded-body-size",n.decodedBodySize]].forEach(([e,n])=>{if("number"==typeof n){t.createStats({ns:"web_timing",name:e}).record(n)}}))})(n,v)),O.logPaintPerformance(l),O.logVisibilityChangeEvents(e,l),e.have_logged_web_timing=!0,this.log(e,c,!0),l}log(e,t,n=!1){super.log(e,t,n)}}class q{constructor(e,t,n,i){this.childSpans=[],this.spanName=e,this.startTime=void 0!==n?n:p.WebTimingUtil.getNow(),this.originTs=t,this.startTimeOffsetMS=this.startTime-t,this.endCallback=i}startSpan(e){const t=new q(e,this.originTs);return this.childSpans.push(t),t}markSpan(e,t){const n=new q(e,this.originTs,this.startTime);this.childSpans.push(n),n.endSpan(t)}endSpan(e){this.endTime=void 0!==e?e:p.WebTimingUtil.getNow(),this.childSpans.forEach(e=>{e.hasEnded()||e.endSpan(this.endTime)}),this.endCallback&&this.endCallback(this)}getEndTimeOffsetMS(){return void 0!==this.endTime?this.endTime-this.originTs:void 0}hasEnded(){return void 0!==this.endTime}}class F{constructor(e,t,n,i=!1){this.timerState=x.RUNNING,this.loggedEvents=0,this.activeSpans=[],this.endedSpans=[],this.context=e,this.timingStopwatch=t,this.userStopwatch=n,this.id=P++,this.strictAssert=i}startSpan(e){const t=new q(e,this.context.start_time,void 0,e=>{this.endSpan(e)});return this.activeSpans.push(t),t}markSpan(e,t={}){if(this.userStopwatch){const n=void 0===t.startTime?0:t.startTime,i=this.timeSinceStart(t.endTime),s=this.userStopwatch.startSpan(e,{startTime:n});this.userStopwatch.endSpan(e,{spanId:s,endTime:i})}else{const n=new q(e,this.context.start_time,t.startTime);n.endSpan(t.endTime),this.endedSpans.push(n)}}endSpan(e){const t=this.activeSpans.indexOf(e);t>=0&&(delete this.activeSpans[t],this.userStopwatch?this.recordSpan(e):this.endedSpans.push(e))}recordSpan(e){const t=this.userStopwatch.startSpan(e.spanName,{startTime:e.startTimeOffsetMS});e.childSpans.forEach(e=>{this.recordSpan(e)}),this.userStopwatch.endSpan(e.spanName,{spanId:t,endTime:e.getEndTimeOffsetMS()})}getContextName(){return this.context.context_name}applicationStart(){this.logEvent(u.WebTimerEvent.APPLICATION_START)}fetchedDataRequiredForTTI(){this.logEvent(u.WebTimerEvent.FETCHED_DATA_FOR_TTI)}startTime(){return this.context.start_time}timeSinceStart(e){return(e||p.WebTimingUtil.getNow())-this.context.start_time}timeToView(){return this.context.time_to_view}timeToInteractive(){return this.context.time_to_interactive}reportTTIAfterPaint(){const e=new p.CancellableCallback(()=>{this.reportTTI()});return window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{e.exec()})}),e}setExtraColumns(e){this.context.extra_columns=e}excludeFromTTI(e){""!==this.context.tti_exclusion_flow&&(this.context.tti_exclusion_flow=this.context.tti_exclusion_flow+","),this.context.tti_exclusion_flow=this.context.tti_exclusion_flow+e}logEvent(e,t){this.logEventInternal(e,!0,t)}logSilentEvent(e,t){this.logEventInternal(e,!1,t)}logEventInternal(e,t,n){this.loggedEvents|=e.flag,e.ordered&&this.validateEventOrder(e);const i=this.timeSinceStart(n);this.context.timesStagesWereReached[e.name]=i,this.timingStopwatch.recordTrace(e.name,i),console.timeStamp&&console.timeStamp(e.timestampPrefix),window.performance.mark&&window.performance.mark(e.name),t&&e.triggersLogging&&this.logIfReady(e)}validateEventOrder(e){let t=0;for(const n of R){if(n.includes(e))break;for(const e of n)t|=e.flag}const n=t&this.loggedEvents;if(n>0){const t=u.WebTimerEvent.allEvents.filter(e=>(e.flag&n)>0).map(e=>e.name);this.reportSwMisuse(`Received ${e.name} after [${t.join(",")}]`)}}logIfReady(e){if(this.logger.shouldLog(this.context)){this.addEventBasedTiming();const t=this.logger.logTiming(this.context,e);J(this.timingStopwatch,t),J(this.userStopwatch,t),this.timingStopwatch.logData(),this.userStopwatch.logData(),this.timerState=x.CLOSED}}addEventBasedTiming(){const e=window.performance.timing;this.context.ttv_at_dom_interactive&&(this.context.is_pagelet&&window.ensemble?this.context.time_to_view=window.ensemble.getEmbeddedAppDOMInteractive():this.context.time_to_view=e.domInteractive,this.logSilentEvent(u.WebTimerEvent.MARK_TIME_TO_VIEW,this.context.time_to_view)),this.context.tti_at_dom_interactive&&(this.context.time_to_interactive=e.domInteractive,this.logSilentEvent(u.WebTimerEvent.MARK_TIME_TO_INTERACTIVE,this.context.time_to_interactive),this.logSilentEvent(u.WebTimerEvent.TIME_TO_INTERACTIVE,this.context.time_to_interactive))}reportSwMisuse(e){e=`WebTimer: ${e}`,this.strictAssert?b.assert(!1,e):E.reportStack(e,{severity:E.SEVERITY.NONCRITICAL,tags:["web_timing_logger"]})}}class B extends F{constructor(e){super(e,m.JSStopwatch.createDetachedStopwatch("maestro_tracing",{correlation_id:e.correlation_id}),m.JSStopwatch.createDetachedStopwatch("user_tracing",{correlation_id:e.correlation_id}),!1),this.logger=new L}initialize(e){this.context.initialized||(this.context.initialized=!0,this.context.log_time_to_view=e.requireTTV,this.context.log_time_to_interactive=e.requireTTI,this.context.tti_flow=e.url,this.timingStopwatch.url=this.context.tti_flow,this.userStopwatch.url=this.context.tti_flow)}start(){this.isUsable()&&this.timerState===x.NEW&&(this.context.start_time=p.WebTimingUtil.getNow(),this.timerState=x.RUNNING)}restart(){this.TTICallback&&(this.TTICallback.cancel(),this.TTICallback=void 0),this.loggedEvents=0,this.context.have_logged_web_timing=!1,this.context.correlation_id=p.WebTimingUtil.generateCorrelationId(),this.context.start_time=p.WebTimingUtil.getNow(),this.context.end_time=void 0,this.context.time_to_view=null,this.context.time_to_interactive=null,this.timerState=x.RUNNING,m.JSStopwatch.deleteStopwatch(this.timingStopwatch),this.timingStopwatch=m.JSStopwatch.createDetachedStopwatch("maestro_tracing",{request_id:this.context.request_id,url:this.context.tti_flow,correlation_id:this.context.correlation_id}),m.JSStopwatch.deleteStopwatch(this.userStopwatch),this.userStopwatch=m.JSStopwatch.createDetachedStopwatch("user_tracing",{request_id:this.context.request_id,url:this.context.tti_flow,correlation_id:this.context.correlation_id})}abort(){this.timerState!==x.CLOSED&&(this.timerState=x.ABORTED)}markTimeToView(){this.isUsable()&&(null==this.context.time_to_view&&(this.context.time_to_view=p.WebTimingUtil.getNow()),this.logEvent(u.WebTimerEvent.MARK_TIME_TO_VIEW))}markTimeToInteractive(){this.isUsable()&&(this.logEvent(u.WebTimerEvent.MARK_TIME_TO_INTERACTIVE),k()?this.reportTTI():this.TTICallback=this.reportTTIAfterPaint())}reportTTI(){if(null!=this.context.time_to_interactive)return;this.context.time_to_interactive=p.WebTimingUtil.getNow(),this.logEvent(u.WebTimerEvent.TIME_TO_INTERACTIVE),new Promise((t,n)=>{e(["metaserver/static/js/modules/clean/logging/telemetry"],t,n)}).then(n.__importStar).then(({getGlobalTelemetrySingleton:e})=>{e().sendOnce()});const t=this.timeSinceStart(this.context.time_to_interactive);ee(this.id,t,!0)}end(e){this.isUsable()&&(void 0===this.context.end_time&&(this.context.end_time=p.WebTimingUtil.getNow()),this.context.request_id=e,this.timingStopwatch.request_id=e,this.userStopwatch.request_id=e,this.logEvent(u.WebTimerEvent.LOAD_END))}waitForTTI(e){return new Promise((t,n)=>{if(null!=this.context.time_to_interactive)return void t();let i;const s=e=>{window.removeEventListener("TTI."+this.id,s),clearTimeout(i),t()};window.addEventListener("TTI."+this.id,s),e&&void 0!==e.timeoutMS&&(i=setTimeout(s,e.timeoutMS))})}isUsable(){return this.timerState===x.NEW||this.timerState===x.RUNNING}}class V extends F{constructor(e){super(e,m.JSStopwatch.createDetachedStopwatch("maestro_tracing",{correlation_id:e.correlation_id}),m.JSStopwatch.createDetachedStopwatch("user_tracing",{correlation_id:e.correlation_id}),!1),this.logger=new U}initialize(e){if(!this.context.initialized){this.context.log_time_to_view=e.requireTTV,this.context.log_time_to_interactive=e.requireTTI,this.context.is_pagelet=!!e.is_pagelet,this.context.is_dws=!!e.is_dws,this.context.is_dws2=!!e.is_dws2,this.context.is_early_ensemble=!!e.is_early_ensemble,this.context.ttv_at_dom_interactive=!!e.ttv_at_dom_interactive,this.context.tti_at_dom_interactive=!!e.tti_at_dom_interactive,this.context.source_type=null!=e.source_type?e.source_type:"web",this.context.subtypes=null!=e.subtypes?e.subtypes:{},this.context.tti_exclusion_flow=null!=e.tti_exclusion_flow?e.tti_exclusion_flow:"",this.context.have_logged_web_timing=!1,this.context.delayed_tti_for_css=!1,this.context.js_preloads_enabled=e.js_preloads_enabled||!1,this.context.require_preloads_enabled=e.require_preloads_enabled||!1,this.context.css_preloads_enabled=e.css_preloads_enabled||!1,this.context.alternative_css_load_strategy_enabled=e.alternative_css_load_strategy_enabled||!1,this.context.previews_preconnect_enabled=e.previews_preconnect_enabled||!1,this.context.flushing_each_chunk_enabled=e.flushing_each_chunk_enabled||!1,this.context.rollup_format=e.rollup_format||"off",this.context.initialized=!0,e.url&&(this.context.tti_flow=e.url,this.timingStopwatch.url=e.url,this.userStopwatch.url=e.url),this.context.subtypes.tti_flow&&(this.context.tti_flow=this.context.subtypes.tti_flow);let t=0;if(v.LOG_TIMING_DELAY&&(t=600),m.JSStopwatch.create_stopwatch_if_not_exist("web_timing_logger"),a.window_load(()=>{setTimeout(()=>this.end(),t)}),l.onPageRestore(e=>{const t=m.JSStopwatch.createDetachedStopwatch("browser_perf",{correlation_id:this.context.correlation_id});t.recordTrace("page_restore"),t.logData()}),!this.context.ttv_at_dom_interactive&&window._timingData&&(null!=window._timingData.ttv&&(this.context.time_to_view=window._timingData.ttv.getTime(),this.logEvent(u.WebTimerEvent.MARK_TIME_TO_VIEW,this.context.time_to_view)),null!=window._timingData.tti)){this.context.time_to_interactive=window._timingData.tti.getTime(),this.logEvent(u.WebTimerEvent.TIME_TO_INTERACTIVE,this.context.time_to_interactive),ee(void 0,this.timeSinceStart(this.context.time_to_interactive))}}}start(){this.isUsable()&&this.timerState===x.NEW&&(this.timerState=x.RUNNING)}restart(){this.TTICallback&&(this.TTICallback.cancel(),this.TTICallback=void 0),this.loggedEvents=0,this.context.correlation_id=p.WebTimingUtil.generateCorrelationId(),this.context.end_time=void 0,this.context.time_to_view=null,this.context.time_to_interactive=null,this.timerState=x.RUNNING,this.timingStopwatch=m.JSStopwatch.createDetachedStopwatch("maestro_tracing",{correlation_id:this.context.correlation_id}),this.userStopwatch=m.JSStopwatch.createDetachedStopwatch("user_tracing",{correlation_id:this.context.correlation_id})}abort(){this.timerState!==x.CLOSED&&(this.timerState=x.ABORTED)}markTimeToView(){this.isUsable()&&(null!=this.context.time_to_view||this.context.ttv_at_dom_interactive||(window._timingData&&null!=window._timingData.ttv?this.context.time_to_view=window._timingData.ttv.getTime():this.context.time_to_view=p.WebTimingUtil.getNow(),this.logEvent(u.WebTimerEvent.MARK_TIME_TO_VIEW,this.context.time_to_view)))}markTimeToInteractive(){if(window.ensemble&&window.ensemble.waitingForCss)return this.context.delayed_tti_for_css=!0,void(window.ensemble.mark_tti_callback=()=>{this.markTimeToInteractive()});null!=this.context.time_to_interactive||this.context.tti_at_dom_interactive||(this.logEvent(u.WebTimerEvent.MARK_TIME_TO_INTERACTIVE),k()?this.reportTTI():this.TTICallback=this.reportTTIAfterPaint())}reportTTI(){if(null==this.context.time_to_interactive)if(window._timingData&&null!=window._timingData.tti?this.context.time_to_interactive=window._timingData.tti.getTime():this.context.time_to_interactive=p.WebTimingUtil.getNow(),console.timeStamp&&console.timeStamp("TTI"),window.ensemble&&window.ensemble.snapshotTimingProfile&&(this.context.timing_results=window.ensemble.snapshotTimingProfile()||null),window.RUNNING_IN_EDISON)new Promise((t,n)=>{e(["metaserver/static/js/modules/clean/edison/edison"],t,n)}).then(n.__importStar).then(({Edison:e})=>{const t=e.getPrefetchCounts(),n={};for(const e of Object.keys(t))n[e]=t[e].toString();this.context.subtypes=Object.assign(Object.assign({},n),this.context.subtypes),this.logEvent(u.WebTimerEvent.TIME_TO_INTERACTIVE,this.context.time_to_interactive),ee(void 0,this.timeSinceStart(this.context.time_to_interactive))});else{this.logEvent(u.WebTimerEvent.TIME_TO_INTERACTIVE,this.context.time_to_interactive),ee(void 0,this.timeSinceStart(this.context.time_to_interactive))}}end(e){this.isUsable()&&void 0===this.context.end_time&&(this.context.end_time=p.WebTimingUtil.getNow(),this.logEvent(u.WebTimerEvent.LOAD_END),this.context.tti_at_dom_interactive&&ee())}waitForTTI(e){return new Promise((t,n)=>{if(window.ensemble){if(window.ensemble.ttiMarked)return void t()}else if(null!=this.context.time_to_interactive)return void t();let i;const s=e=>{window.removeEventListener("TTI",s),clearTimeout(i),t()};window.addEventListener("TTI",s),e&&void 0!==e.timeoutMS&&(i=setTimeout(s,e.timeoutMS))})}isUsable(){return this.timerState===x.NEW||this.timerState===x.RUNNING}}const W={};let z;function G(e,t){const n={};for(const e of C){const i=t[e];i&&(n[e]=String(i))}const i=e;for(const e of A){const t=i[e];t&&(n[e]=String(t))}return{correlation_id:e.correlation_id,request_id:t.request_id,annotations:n}}function J(e,t){if(t.annotations)for(const n in t.annotations)if(t.annotations.hasOwnProperty(n)){const i=t.annotations[n];i&&e.addAnnotation(n,String(i))}t.correlation_id&&e.addAnnotation(m.ReservedAnnotationKey.CORRELATION_ID.id,t.correlation_id),t.request_id&&e.addAnnotation(m.ReservedAnnotationKey.REQUEST_ID.id,t.request_id),t.url&&e.addAnnotation(m.ReservedAnnotationKey.URL.id,t.url)}function $(e){return e?(function(e){const t=e;return W[t]||(W[t]=new B(p.WebTimingUtil.newContext(!0,e))),W[t]})(e):(z||H(),z)}function K(e={}){$().initialize({requireTTV:!!e.log_time_to_view,requireTTI:!!e.log_time_to_interactive,is_pagelet:e.is_pagelet,is_dws:e.is_dws,is_dws2:e.is_dws2,is_early_ensemble:e.is_early_ensemble,ttv_at_dom_interactive:e.ttv_at_dom_interactive,tti_at_dom_interactive:e.tti_at_dom_interactive,source_type:e.source_type,subtypes:e.subtypes,tti_exclusion_flow:e.tti_exclusion_flow,url:e.url,js_preloads_enabled:e.js_preloads_enabled,require_preloads_enabled:e.require_preloads_enabled,css_preloads_enabled:e.css_preloads_enabled,alternative_css_load_strategy_enabled:e.alternative_css_load_strategy_enabled,previews_preconnect_enabled:e.previews_preconnect_enabled,flushing_each_chunk_enabled:e.flushing_each_chunk_enabled,rollup_format:e.rollup_format})}function H(){z=new V(p.WebTimingUtil.newContext(!1,"default_timer"))}function Y(e,t){e.recordEntries(t.map(e=>({type:0!==e.startTime?f.TimingDataType.Span:f.TimingDataType.Trace,name:e.name,startTime:e.startTime,endTime:e.endTime,annotations:e.annotations}))),e.logData()}H(),t.get_timer=$,t.delete_timer=function(e){delete W[e]},t.time_to_view=function(){return $().timeToView()},t.time_to_interactive=function(){return $().timeToInteractive()},t.initialize_module=K,t.initialize=function(e,t){const n=t.dwsOpts;let i;switch(t.sourceType){case I.web_timing_logger.WebTimingLoggerServerContext.SourceType.UNKNOWN:i="unknown";break;case I.web_timing_logger.WebTimingLoggerServerContext.SourceType.MOBILE_WEB:i="mobile";break;case I.web_timing_logger.WebTimingLoggerServerContext.SourceType.DESKTOP_WEB:i="web"}const s={is_pagelet:t.isDws,is_dws:t.isDws,is_dws2:null!=n&&n.isDws2,is_early_ensemble:null!=n&&n.isEarlyEnsemble,subtypes:Object.assign(Object.assign({},t.subtypes),{js_preloading:null!=n&&n.jsPreloading?"true":"false"}),source_type:i,url:t.url};K(Object.assign(Object.assign({},s),e))},t.reset=H,t.start_time=function(){return $().startTime()},t.time_since_start=function(){return $().timeSinceStart()},t.set_tti_exclusion_flow=function(e){$().excludeFromTTI(e)};const X=["dws_ensemble_init","dws_embedded-app_require_config_callback","dws-processChunk-embedded-app-require_config-1"],Q=new RegExp("dws-processChunk-embedded-app-const_module.*");function Z(e){const t=c.get_module_times(),n=[];for(const e of t){const t=e.url;if(void 0===t&&e.name&&-1===e.name.indexOf("!")){E.reportStack(`Module ${e.name} with invalid map object fetched by requirejs`,{severity:E.SEVERITY.NONCRITICAL,tags:["log_js_module_timing"]});continue}let i=[];if(t&&(i=window.performance.getEntriesByName(t,"resource")),0!==i.length)e.start_time=i[0].startTime+i[0].duration;else{if(!("callback_duration"in e))continue;e.start_time=0}n.push(e)}e.js_module_times=JSON.stringify(n)}function ee(e,t,n=!1){if(window.ensemble&&window.ensemble.markTTI)window.ensemble.markTTI();else{const t=new CustomEvent(void 0!==e?`TTI.${e}`:"TTI",{bubbles:!0,cancelable:!0});window.dispatchEvent(t)}const i=new CustomEvent("time_to_interactive",{detail:{value:t,isAjax:n},bubbles:!0,cancelable:!0});window.dispatchEvent(i)}t.mark_time_to_view=function(){$().markTimeToView()},t.mark_time_to_interactive=function(e={}){const t=$();t.setExtraColumns(e),t.markTimeToInteractive()},t.waitForTTI=function(e){return $().waitForTTI(e)},t.log_js_modules_application_code_start=function(){$().applicationStart()},t.log_js_modules_fetched_data_required_for_tti=function(){$().fetchedDataRequiredForTTI()}})),define("metaserver/static/js/modules/clean/window_util",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onPageRestore=t.onBeforeUnload=void 0,t.onBeforeUnload=function(e){window.addEventListener("beforeunload",(function t(){e(),window.removeEventListener("beforeunload",t)}))},t.onPageRestore=function(e){window.addEventListener("pageshow",(function t(n){n.persisted&&(e(),window.removeEventListener("pageshow",t))}))}})),define("metaserver/static/js/modules/clean/js_basic_stopwatch",["require","exports","metaserver/static/js/modules/core/assert","metaserver/static/js/modules/core/exception"],(function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createStopwatch=t.NoopStopwatchInstance=t.JSBasicStopwatchImpl=t.TimingDataType=void 0;const s=!(!window.performance||!window.performance.now);let r=0;var o;(function(e){e[e.Span=1]="Span",e[e.AsyncSpan=2]="AsyncSpan",e[e.Trace=3]="Trace"})(o=t.TimingDataType||(t.TimingDataType={}));class a{constructor(e,t,n,i=!1,s){this.name=e,this.strictAssert=t,this.activeSpans={},this.aggregateSpans={},this._annotations=Object.assign({},s),this.spanStack=[],this.stopwatchTags=n||[],this.detached=i}reset(){this.activeSpans={},this.spanStack=[],this.aggregateSpans={},this._annotations={}}get annotations(){return this._annotations}addAnnotation(e,t){this._annotations[e]=t}removeAnnotation(e){delete this._annotations[e]}popResolvedSpans(){if(this.detached)return{};{const e=this.aggregateSpans;return this.aggregateSpans={},e}}peekResolvedSpans(){return this.detached?{}:this.aggregateSpans}static newSpanID(){const e=String(r);return r++,e}static resolveTime(e){return void 0===e&&(e=window.performance.now()),Math.round(e)}_resolveParent(e){if(e.type!==o.Span)return void(e.parent="");const t=this.spanStack[this.spanStack.length-1];if(t)if(t!==e.name)this._report_sw_misuse(`Closing ${t} while the latest open span is ${e.name}.\n You are either mixing sync and async spans or closing sync spans out of order.`);else{this.spanStack.pop();let t="";for(const e of this.spanStack)t+=`${e}#`;e.parent=t}else this._report_sw_misuse(`${e.name} isn't a synchronous span and has to be started with "async:true".`)}recordTrace(e,t={}){const n=a.resolveTime(t.traceTime),i=a.newSpanID(),s={name:e,span_id:i,start_time:0,end_time:n,annotations:Object.assign({},t.annotations),type:o.Trace,parent:""};return this.recordSpan(this.stopwatchTags,s),i}start(e,t={}){e||this._report_sw_misuse("Reporting a span without a name");const n=a.resolveTime(t.startTime);t.async||this.spanStack.push(e);const i=a.newSpanID(),s={name:e,span_id:i,start_time:n||0,annotations:Object.assign({},t.annotations),type:t.async?o.AsyncSpan:o.Span};return e in this.activeSpans||(this.activeSpans[e]=[]),this.activeSpans[e].push(s),i}end(e,t={}){const n=this.findTimerDataIndex(e,t.spanId);if(-1===n)return;const i=this.activeSpans[e],s=i[n];i.splice(n,1),this._resolveParent(s);const r=a.resolveTime(t.endTime);if(!(r0?t.annotations:void 0,parent:t.parent||"",stopwatch_tags:e.length>0?e:void 0,type:t.type});const i=this.aggregateSpans[n];if(void 0!==t.end_time){if(i.type===o.Trace?(i.total_time=t.end_time-t.start_time,i.num_calls=1):(i.total_time+=t.end_time-t.start_time,i.num_calls+=1),Object.keys(t.annotations).length>0)if(i.annotations)for(const e in t.annotations)t.annotations.hasOwnProperty(e)&&(i.annotations[e]=t.annotations[e]);else i.annotations=t.annotations}else this._report_sw_misuse(`Span ${n} reported with undefined end_time`)}}t.JSBasicStopwatchImpl=a;t.NoopStopwatchInstance=new class{constructor(){this.name="",this.annotations={}}reset(){}attach(){}addAnnotation(e,t){}removeAnnotation(e){}popResolvedSpans(){return{}}peekResolvedSpans(){return{}}start(e,t){}end(e,t){}recordTrace(e,t){}addSpanAnnotation(e,t,n,i){}},t.createStopwatch=function(e,n,i,r=!1,o){return s?new a(e,n,i,r,o):t.NoopStopwatchInstance}})),define("metaserver/static/js/modules/clean/js_client_stopwatch",["require","exports","tslib","metaserver/static/js/modules/core/xhr","metaserver/static/js/modules/clean/js_basic_stopwatch","metaserver/static/js/modules/constants/request","metaserver/static/js/modules/core/assert","metaserver/static/js/modules/core/browser","metaserver/static/js/modules/core/exception"],(function(e,t,n,i,s,r,o,a,c){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSStopwatch=t.ReservedAnnotationKey=void 0,r=n.__importStar(r),a=n.__importStar(a);class l{constructor(e){this.id=e}}t.ReservedAnnotationKey=l,l.REQUEST_ID=new l("dropbox.js_client_stopwatch.request_id"),l.CORRELATION_ID=new l("dropbox.js_client_stopwatch.correlation_id"),l.URL=new l("dropbox.js_client_stopwatch.url");class d{constructor(){this.GLOBAL_SW_NAME="GLOBAL_STOPWATCH",this.flush_interval=6e4,this.debugEnabled=!0,this.strictAssert=!1,this.intervalId=null,this.clientStopwatchCounter=1,this.reset()}reset(){this.globalStopwatches={},this.clientStopwatches={},this.clientStopwatchCounter=1,this.sentInitialData=!1,this.create_stopwatch(this.GLOBAL_SW_NAME),this.intervalId&&clearInterval(this.intervalId),this.intervalId=null}reset_individual_stopwatch(e){this.stopwatch_exists(e)?this.globalStopwatches[e].reset():this._report_sw_misuse(`tried to reset the stopwatch ${e} but it does not exist`)}stopwatch_exists(e){return e in this.globalStopwatches}create_stopwatch(e,t){this.stopwatch_exists(e)?this._report_sw_misuse(`tried to create a new stopwatch ${e} but it already exists`):this.globalStopwatches[e]=s.createStopwatch(e,this.strictAssert,t)}createDetachedStopwatch(e,t={}){const n=s.createStopwatch(e,this.strictAssert,t.tags,!0,t.annotations),i=new u(this.clientStopwatchCounter++,e,n,t.request_id,t.correlation_id,t.url);return this.clientStopwatches[i.id]=i,i}deleteStopwatch(e){delete this.clientStopwatches[e.id]}create_stopwatch_if_not_exist(e,t){this.stopwatch_exists(e)||this.create_stopwatch(e,t)}getStopwatch(e){return this.stopwatch_exists(e)?this.globalStopwatches[e]:(this._report_sw_misuse(`${e} doesn't exist`),null)}recordTrace(e,t={}){const n=this.getStopwatch(t.stopwatchName||this.GLOBAL_SW_NAME);if(null==n)return;const i={traceTime:t.traceTime};return n.recordTrace(e,i)}startSpan(e,t={}){const n=this.getStopwatch(t.stopwatchName||this.GLOBAL_SW_NAME);if(null==n)return;const i={startTime:t.startTime,async:t.async};return n.start(e,i)}endSpan(e,t={}){const n=this.getStopwatch(t.stopwatchName||this.GLOBAL_SW_NAME);if(null!=n)return n.end(e,{spanId:t.spanId,endTime:t.endTime})}addSpanAnnotation(e,t,n,i={}){const s=this.getStopwatch(i.stopwatchName||this.GLOBAL_SW_NAME);null!=s&&s.addSpanAnnotation(e,t,n,i.spanId)}log_stored_results(){this.sentInitialData?this._report_sw_misuse("ClientStopwatch tried to log stored results, but the stopwatch is set to log immediately"):(this.flush_current_data(),this.sentInitialData=!0,this.intervalId=setInterval(this.flush_current_data.bind(this),this.flush_interval))}_report_sw_misuse(e){e=`ClientStopwatch: ${e}`,this.strictAssert?o.assert(!1,e):c.reportStack(e,{severity:c.SEVERITY.NONCRITICAL,tags:["log_js_stopwatch"]})}flush_current_data(){for(const e in this.globalStopwatches)this.globalStopwatches.hasOwnProperty(e)&&d.logStopwatchData(this.globalStopwatches[e]);for(const e in this.clientStopwatches)this.clientStopwatches.hasOwnProperty(e)&&d.logStopwatchData(this.clientStopwatches[e].stopwatch)}static logStopwatchData(e){const t=e.popResolvedSpans(),n=e.name,i={};if(Object.keys(t).length>d.MAXSPANS){let s=0;i[n]={};for(const r in t)t.hasOwnProperty(r)&&(i[n][r]=t[r],s===d.MAXSPANS&&(i[n].annotations=e.annotations,d.send_spans(i),s=0,i[n]={}),s++)}else i[n]=t;0!==Object.keys(i[n]).length&&(i[n].annotations=e.annotations,d.send_spans(i))}static send_spans(e){const t=JSON.stringify(e),n={request_id:r.REQUEST_ID,url:a.get_href().replace("/dws2",""),aggregated_sw_data:t};i.sendXhr("/log_js_sw_data",n)}print_stopwatches_debug(){const e=this.get_debug_data();console.table&&console.groupCollapsed&&console.groupEnd&&e&&e.length>0&&(console.groupCollapsed("Request timeline"),console.table(e),console.groupEnd())}get_debug_data(){const e=[];for(const t in this.globalStopwatches)if(this.globalStopwatches.hasOwnProperty(t)){const n=this.globalStopwatches[t].peekResolvedSpans();for(const i in n)if(n.hasOwnProperty(i)){const r=n[i],o={stopwatchName:t,spanName:r.name,time:r.start_time+r.total_time};r.type!==s.TimingDataType.AsyncSpan&&r.type!==s.TimingDataType.Span||(o.startTime=r.start_time),r.type===s.TimingDataType.Span&&(o.info=`Total time: ${r.total_time}ms`),e.push(o)}}return e.sort((e,t)=>e.time-t.time),e}}d.MAXSPANS=2e3,t.JSStopwatch=new d;class u{constructor(e,t,n,i,s,r){this.sentInitialData=!1,this.strictAssert=!1,this.id=e,this.stopwatch=n,this._request_id=i,this._correlation_id=s,this._url=r,this._request_id&&this.stopwatch.addAnnotation(l.REQUEST_ID.id,this._request_id),this._correlation_id&&this.stopwatch.addAnnotation(l.CORRELATION_ID.id,this._correlation_id),this._url&&this.stopwatch.addAnnotation(l.URL.id,this._url)}set request_id(e){this._request_id=e,this._request_id?this.stopwatch.addAnnotation(l.REQUEST_ID.id,this._request_id):this.stopwatch.removeAnnotation(l.REQUEST_ID.id)}set correlation_id(e){this._correlation_id=e,this._correlation_id?this.stopwatch.addAnnotation(l.CORRELATION_ID.id,this._correlation_id):this.stopwatch.removeAnnotation(l.CORRELATION_ID.id)}set url(e){this._url=e,this._url?this.stopwatch.addAnnotation(l.URL.id,this._url):this.stopwatch.removeAnnotation(l.URL.id)}startSpan(e,t){return this.stopwatch.start(e,t)}endSpan(e,t){return this.stopwatch.end(e,t)}addSpanAnnotation(e,t,n,i){this.stopwatch.addSpanAnnotation(e,t,n,i)}recordTrace(e,t,n){this.stopwatch.recordTrace(e,{traceTime:t,annotations:n})}recordEntries(e){for(const t of e)if(t.type===s.TimingDataType.Trace)this.recordTrace(t.name,t.endTime,t.annotations);else{const e=t.startTime||0,n=this.startSpan(t.name,{startTime:Math.min(e,t.endTime),async:t.type===s.TimingDataType.AsyncSpan,annotations:t.annotations});t.endTime{t.JSStopwatch.flush_current_data()},0))}addAnnotation(e,t){this.stopwatch.addAnnotation(e,t)}removeAnnotation(e){this.stopwatch.removeAnnotation(e)}reportMisuse(e){e=`ClientStopwatch: ${e}`,this.strictAssert?o.assert(!1,e):c.reportStack(e,{severity:c.SEVERITY.NONCRITICAL,tags:["log_js_stopwatch"]})}}})),define("metaserver/static/js/dropbox/proto/js_init_data/web_timing_logger/web_timing_logger",["require","exports","tslib","protobufjs/minimal"],(function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.web_timing_logger=void 0;const s=(i=n.__importStar(i)).Reader,r=i.Writer,o=i.util,a=i.roots.default||(i.roots.default={});var c;t.default=a,t.web_timing_logger=a.web_timing_logger=((c=a.web_timing_logger||{}).WebTimingLoggerServerContext=(function(e){function e(e){if(this.subtypes={},e)for(let t=Object.keys(e),n=0;n>>3){case 1:c.isDws=e.bool();break;case 2:c.dwsOpts=a.web_timing_logger.WebTimingLoggerServerContext.DWSOptions.decode(e,e.uint32());break;case 3:c.sourceType=e.int32();break;case 4:{c.subtypes===o.emptyObject&&(c.subtypes={});let t=e.uint32()+e.pos;for(n="",i="";e.pos>>3){case 1:n=e.string();break;case 2:i=e.string();break;default:e.skipType(7&t)}}c.subtypes[n]=i;break}case 5:c.url=e.string();break;default:e.skipType(7&t)}}return c},e.getTypeUrl=function(){return"type.googleapis.com/web_timing_logger.WebTimingLoggerServerContext"},e.DWSOptions=(function(e){function e(e){if(e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.isDws2=e.bool();break;case 2:i.isEarlyEnsemble=e.bool();break;case 3:i.jsPreloading=e.bool();break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/web_timing_logger.WebTimingLoggerServerContext.DWSOptions"},e})(e.DWSOptions||{}),e.SourceType=(function(){const e={},t=Object.create(e);return t[e[0]="UNKNOWN"]=0,t[e[1]="DESKTOP_WEB"]=1,t[e[2]="MOBILE_WEB"]=2,t})(),e})(c.WebTimingLoggerServerContext||{}),c)})),define("metaserver/static/js/dropbox/proto/apex_metrics_web/apex_metrics_web",["require","exports","tslib","protobufjs/minimal","metaserver/static/js/google/protobuf/empty","metaserver/static/js/google/protobuf/timestamp"],(function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.apex_metrics_web=void 0;const s=(i=n.__importStar(i)).Reader,r=i.Writer,o=i.util,a=i.roots.default||(i.roots.default={});var c;t.default=a,t.apex_metrics_web=a.apex_metrics_web=((c=a.apex_metrics_web||{}).RecordNamespace=(function(e){function e(e){if(e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.metricNamespace=e.string();break;case 2:i.maxTimeUntilRefreshSeconds=e.uint32();break;case 3:i.stopPublicationForSeconds=e.uint32();break;case 4:i.dropSamples=a.apex_metrics_web.RecordNamespace.StickyBiasedCoinV2.decode(e,e.uint32());break;case 5:i.dropPeriods=a.apex_metrics_web.RecordNamespace.StickyBiasedCoinV2.decode(e,e.uint32());break;case 6:i.dropFractionOfHostsPerMetric=e.double();break;case 7:i.aggregationIntervalSeconds=e.uint32();break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.RecordNamespace.MetricReportingConfigV2"},e})(e.MetricReportingConfigV2||{}),e.StickyBiasedCoinV2=(function(e){function e(e){if(e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.fraction=e.double();break;case 2:i.stickiness=a.apex_metrics_web.RecordNamespace.StickinessV2.decode(e,e.uint32());break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.RecordNamespace.StickyBiasedCoinV2"},e})(e.StickyBiasedCoinV2||{}),e.StickinessV2=(function(e){function e(e){if(e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.independent=a.google.protobuf.Empty.decode(e,e.uint32());break;case 2:i.permanent=a.google.protobuf.Empty.decode(e,e.uint32());break;case 3:i.nResults=e.uint32();break;case 4:i.nSeconds=e.float();break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.RecordNamespace.StickinessV2"},e})(e.StickinessV2||{}),e.RecordResponse=(function(e){function e(e){if(this.reportingConfigs=[],this.debugInfos=[],e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.reportingConfigs&&i.reportingConfigs.length||(i.reportingConfigs=[]),i.reportingConfigs.push(a.apex_metrics_web.RecordNamespace.MetricReportingConfigV2.decode(e,e.uint32()));break;case 3:i.publicationIntervalSeconds=e.uint32();break;case 4:i.maxScopesPerRequest=e.uint32();break;case 5:i.stopPublicationForSeconds=e.uint32();break;case 6:i.debugInfos&&i.debugInfos.length||(i.debugInfos=[]),i.debugInfos.push(e.string());break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.RecordNamespace.RecordResponse"},e})(e.RecordResponse||{}),e})(c.RecordNamespace||{}),c.ApexMetricsCacheData=(function(e){function e(e){if(e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.config=a.apex_metrics_web.RecordNamespace.RecordResponse.decode(e,e.uint32());break;case 2:i.timeStored=a.google.protobuf.Timestamp.decode(e,e.uint32());break;case 3:i.state=a.apex_metrics_web.ApexMetricsCacheData.FilterState.decode(e,e.uint32());break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.ApexMetricsCacheData"},e.CoinState=(function(e){function e(e){if(e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.lastFlipTime=a.google.protobuf.Timestamp.decode(e,e.uint32());break;case 2:i.lastResult=e.bool();break;case 3:i.numTimesChecked=e.uint32();break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.ApexMetricsCacheData.CoinState"},e})(e.CoinState||{}),e.NamespaceCoinState=(function(e){function e(e){if(e)for(let t=Object.keys(e),n=0;n>>3){case 1:i.dropPeriodCoin=a.apex_metrics_web.ApexMetricsCacheData.CoinState.decode(e,e.uint32());break;case 2:i.dropSamplesCoin=a.apex_metrics_web.ApexMetricsCacheData.CoinState.decode(e,e.uint32());break;default:e.skipType(7&t)}}return i},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.ApexMetricsCacheData.NamespaceCoinState"},e})(e.NamespaceCoinState||{}),e.FilterState=(function(e){function e(e){if(this.namespaceCoinState={},e)for(let t=Object.keys(e),n=0;n>>3){case 1:c.filterID=e.uint32();break;case 2:{c.namespaceCoinState===o.emptyObject&&(c.namespaceCoinState={});let t=e.uint32()+e.pos;for(n="",i=null;e.pos>>3){case 1:n=e.string();break;case 2:i=a.apex_metrics_web.ApexMetricsCacheData.NamespaceCoinState.decode(e,e.uint32());break;default:e.skipType(7&t)}}c.namespaceCoinState[n]=i;break}default:e.skipType(7&t)}}return c},e.getTypeUrl=function(){return"type.googleapis.com/apex_metrics_web.ApexMetricsCacheData.FilterState"},e})(e.FilterState||{}),e})(c.ApexMetricsCacheData||{}),c)})),define("metaserver/static/js/modules/clean/user_centric_perf_metrics/utils",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.waitForPageHidden=t.waitForPageLoad=void 0,t.waitForPageLoad=()=>"complete"===document.readyState?Promise.resolve():new Promise((e,t)=>{window.addEventListener("load",()=>{e()})}),t.waitForPageHidden=()=>new Promise((e,t)=>{const n=t=>{"pagehide"!==t.type&&"hidden"!==document.visibilityState||(document.removeEventListener("visibilitychange",n,!0),window.removeEventListener("pagehide",n,!0),e())};document.addEventListener("visibilitychange",n,!0),window.addEventListener("pagehide",n,!0)})})),define("metaserver/static/js/modules/clean/user_centric_perf_metrics/annotations",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationNameEnum=void 0,(function(e){e.LONG_INPUT_DELAY_CALLBACK_LATENCY_OVERHEAD_MS="long_input_delay_callback_latency_overhead_ms",e.AVG_LONG_INPUT_DELAY_MS="long_input_delay_ms"})(t.AnnotationNameEnum||(t.AnnotationNameEnum={}))})),define("metaserver/static/js/modules/clean/user_centric_perf_metrics/long_input_delay_observer",["require","exports","tslib","metaserver/static/js/modules/constants/webtiming","metaserver/static/js/modules/clean/user_centric_perf_metrics/annotations"],(function(e,t,n,i,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LongInputDelayObserver=void 0,i=n.__importStar(i);class r{constructor(e){var t;if(this.delayThresholdMS=50,this._isSupportedEnvironment=r.isSupportedEnvironment(),this.totalInputDelayCallbackLatencyOverheadMS=0,this.totalInputDelayMS=0,this.totalInputEntryCount=0,this.avgInputDelayMS=0,this.performanceObserverCallback=e=>{const t=performance.now(),n=[],i=e.getEntries(),r=i.length;for(let e=0;e=this.delayThresholdMS&&(t.delay=s,n.push(t),this.totalInputDelayMS+=s)}n.length&&(this.totalInputEntryCount+=n.length,this.avgInputDelayMS=this.totalInputDelayMS/this.totalInputEntryCount,this.callback(n)),this.totalInputDelayCallbackLatencyOverheadMS+=performance.now()-t,this.addAnnotation(s.AnnotationNameEnum.LONG_INPUT_DELAY_CALLBACK_LATENCY_OVERHEAD_MS,this.totalInputDelayCallbackLatencyOverheadMS),this.addAnnotation(s.AnnotationNameEnum.AVG_LONG_INPUT_DELAY_MS,this.avgInputDelayMS)},!this._isSupportedEnvironment)return;const n=null!==(t=e.PerformanceObserverClass)&&void 0!==t?t:window.PerformanceObserver;this.performanceObserver=new n(this.performanceObserverCallback),this.delayThresholdMS=e.delayThresholdMS||this.delayThresholdMS,this.addAnnotation=e.addAnnotation||(()=>{}),this.callback=e.callback}static isSupportedEnvironment(e=i.LOG_BETA_USER_CENTRIC_PERF_METRICS){return void 0!==window&&"PerformanceObserver"in window&&"PerformanceEventTiming"in window&&e}observe(){this._isSupportedEnvironment&&this.performanceObserver.observe({entryTypes:["event"]})}disconnect(){this.performanceObserver&&this.performanceObserver.disconnect()}}t.LongInputDelayObserver=r})),define("metaserver/static/js/modules/clean/user_centric_perf_metrics/metrics_collector",["require","exports","tslib","@dropbox-performance/ttvc","metaserver/static/js/modules/core/exception","web-vitals","metaserver/static/js/modules/clean/user_centric_perf_metrics/long_input_delay_observer","metaserver/static/js/modules/clean/user_centric_perf_metrics/utils"],(function(e,t,n,i,s,r,o,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MetricsCollector=void 0;t.MetricsCollector=class{constructor(e={}){var t;this.numLongInputDelays=0,this.annotations=new Map,this.getTTFB=r.getTTFB,this.getFCP=r.getFCP,this.getLCP=r.getLCP,this.getCLS=r.getCLS,this.getFID=r.getFID,this.getTTVC=i.getTTVC,this.onLongInputDelay=e=>{this.numLongInputDelays+=e.length},this.addAnnotation=(e,t)=>{this.annotations.set(e,t)};const n=null!==(t=e.LongInputDelayObserverClass)&&void 0!==t?t:o.LongInputDelayObserver;this.longInputDelayObserver=new n({callback:this.onLongInputDelay,addAnnotation:this.addAnnotation});try{i.init({debug:!1,idleTimeout:2e3})}catch(e){s.reportException({err:e,severity:"non-critical",force:!0,tags:["user_centric_perf","ttvc"]})}}getLongInputDelays(e){return n.__awaiter(this,void 0,void 0,(function*(){yield a.waitForPageLoad(),this.longInputDelayObserver.observe(),yield a.waitForPageHidden(),this.longInputDelayObserver.disconnect(),e(this.numLongInputDelays)}))}}})),define("metaserver/static/js/modules/clean/user_centric_perf_metrics/metrics_logger",["require","exports","apex-metrics/index","metaserver/static/js/modules/clean/user_centric_perf_metrics/metrics_collector","metaserver/static/js/modules/clean/user_centric_perf_metrics/annotations","metaserver/static/js/modules/clean/user_centric_perf_metrics/visually_complete_logger","metaserver/static/js/modules/clean/logging/hive/schemas/web-visually_complete","metaserver/static/js/modules/clean/react/edison/spa_product_name"],(function(e,t,n,i,s,r,o,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.logUserCentricPerfMetrics=t.MetricsLogger=void 0;class c{constructor(e=null,t=new i.MetricsCollector){this.AMP_NAMESPACE="user_centric_perf",this.shouldLogToAmp=!1,e&&(this._metricsReporter=e),this.metricsCollector=t}static getSingleton(){return c.instance||(c.instance=new c),c.instance}get metricsReporter(){if(!this._metricsReporter)throw new Error("Must set `metricsReporter` on MetricsLogger before deriving metrics");return this._metricsReporter}set metricsReporter(e){this._metricsReporter=e}deriveAndLogAllMetrics(){this.deriveAndLogTimeToFirstByte(),this.deriveAndLogFirstContentfulPaint(),this.deriveAndLogLargestContentfulPaint(),this.deriveAndLogFirstInputDelay(),this.deriveAndLogCumulativeLayoutShift(),this.deriveAndLogTimeToVisuallyComplete(),this.deriveAndLogNumLongInputDelays(),this.deriveAndLogTimeToConsistentlyInteractive(),this.observeRageClicks()}deriveAndLogTimeToFirstByte(){this.metricsCollector.getTTFB(e=>{this.logMetricToAmp("time_to_first_byte_ms",e.value)})}deriveAndLogFirstContentfulPaint(){this.metricsCollector.getFCP(e=>{this.logMetricToAmp("time_to_first_contentful_paint_ms",e.value)})}deriveAndLogLargestContentfulPaint(){this.metricsCollector.getLCP(e=>{this.logMetricToAmp("time_to_largest_contentful_paint_ms",e.value);const t=new CustomEvent("largest_contentful_paint",{detail:{value:e.value}});window.dispatchEvent(t)})}deriveAndLogFirstInputDelay(){this.metricsCollector.getFID(e=>{const t=e.entries[0].startTime;this.logMetricToAmp("time_to_first_input_ms",t),this.logMetricToAmp("first_input_delay_ms",e.value)})}deriveAndLogCumulativeLayoutShift(){this.metricsCollector.getCLS(e=>{this.logMetricToAmp("cumulative_layout_shift",e.value,null)})}deriveAndLogTimeToVisuallyComplete(){this.metricsCollector.getTTVC(e=>{var t;if(e.duration<=0)return;const i=null!==(t=a.getSpaProductName())&&void 0!==t?t:"UNKNOWN";0===e.start?(this.logMetricToAmp("time_to_visually_complete_ms",e.duration,n.TimeUnit.MILLISECONDS,{did_network_timeout:e.detail.didNetworkTimeOut.toString()}),r.timeToVisuallyCompleteLogger.log(new o.VisuallyCompleteEventRow({time_to_visually_complete:Math.round(e.duration)}))):this.logMetricToAmp("time_to_visually_complete_ajax_ms",e.duration,n.TimeUnit.MILLISECONDS,{product:i,navigation_type:"ajax",did_network_timeout:e.detail.didNetworkTimeOut.toString()});const s={did_network_timeout:e.detail.didNetworkTimeOut.toString()};e.start>0&&(s.product=i,s.navigation_type="ajax"),this.logMetricToAmp("time_to_visually_complete_all_ms",e.duration,n.TimeUnit.MILLISECONDS,s,!0);const c=new CustomEvent("visually_complete",{detail:{value:e.duration,navigation_type:e.start>0?"ajax":"page_load"}});window.dispatchEvent(c),performance.mark("visually_complete",{startTime:e.duration})})}deriveAndLogNumLongInputDelays(){this.metricsCollector.getLongInputDelays(e=>{this.logMetricToAmp("num_long_input_delays",e,null);const t=this.metricsCollector.annotations.get(s.AnnotationNameEnum.LONG_INPUT_DELAY_CALLBACK_LATENCY_OVERHEAD_MS),n=this.metricsCollector.annotations.get(s.AnnotationNameEnum.AVG_LONG_INPUT_DELAY_MS);"number"==typeof t&&this.logMetricToAmp("long_input_delay_observation_overhead_ms",t),"number"==typeof n&&this.logMetricToAmp("avg_long_input_delay_ms",n)})}deriveAndLogTimeToConsistentlyInteractive(){}observeRageClicks(){}logMetricToAmp(e,t,i=n.TimeUnit.MILLISECONDS,s,r=!1){if(!r&&!this.shouldLogToAmp)return;const o=this.metricsReporter.createStats(this.createAMPMetric(e),s);i?o.recordDuration(t,n.TimeUnit.MILLISECONDS):o.record(t)}createAMPMetric(e){return{ns:this.AMP_NAMESPACE,name:`browser/${e}`}}}t.MetricsLogger=c,void 0!==window&&c.getSingleton(),t.logUserCentricPerfMetrics=(e,t)=>{const n=c.getSingleton();n.metricsReporter=e,n.shouldLogToAmp=t,n.deriveAndLogAllMetrics()}})),define("metaserver/static/js/modules/clean/user_centric_perf_metrics/visually_complete_logger",["require","exports","metaserver/static/js/modules/clean/logging/telemetry"],(function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeToVisuallyCompleteLogger=void 0,t.timeToVisuallyCompleteLogger=new n.HiveLogger})),define("metaserver/static/js/modules/clean/logging/hive/schemas/web-visually_complete",["require","exports","metaserver/static/js/modules/constants/request"],(function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VisuallyCompleteEventRow=void 0;t.VisuallyCompleteEventRow=class{constructor(e){this.category="web-visually_complete",this.user_id=null,this.country=null,this.referrer=null,this.session_id=null,this.user_agent=null,this.ua_browser_name=null,this.ua_browser_version=null,this.time_to_visually_complete=e.time_to_visually_complete,this.request_id=n.REQUEST_ID,Object.seal(this)}}})),define("metaserver/static/js/modules/core/transport/query_string_helpers",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TRACKING_PARAMS_LIST=t.parseQueryString=t.filterQueryObject=t.getQueryString=t.getTrackingParamsAsJSON=t.getTrackingParams=t.getParsedQueryString=void 0;const n=["gclid","oqa","trigger","_tk","_camp","_ad","_net","_kw","utm_campaign","utm_content","utm_medium","utm_source","utm_term","cont"];function i(e=window){return e.location.search}function s(e){const t={};if(e.length){const n=e.substring(1).replace(/&/g,"&").split("&");for(const e of n){let[n,i]=e.split("=");n&&i&&(n=n.trim(),i=i.trim(),n.length&&i.length&&(t[n]=decodeURIComponent(i.replace(/\+/g," "))))}}return t}function r(e,t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}function o(e){return r(e||s(i()),n)}t.TRACKING_PARAMS_LIST=n,t.getQueryString=i,t.parseQueryString=s,t.getParsedQueryString=function(){return s(i())},t.filterQueryObject=r,t.getTrackingParams=o,t.getTrackingParamsAsJSON=function(){const e=o();return JSON.stringify(e)}})); //# sourceMappingURL=pkg-timing.min.js-vflZ4qvhE.map