@gram-ai/elements 1.33.1 → 1.33.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements.cjs +1 -1
- package/dist/elements.js +1 -1
- package/dist/{index-BqBo07H_.cjs → index-BCV7Zf9E.cjs} +3 -3
- package/dist/index-BCV7Zf9E.cjs.map +1 -0
- package/dist/{index-Dn0_JCoN.js → index-reVrRxP1.js} +19 -15
- package/dist/index-reVrRxP1.js.map +1 -0
- package/dist/{profiler-Ce0O8-iW.cjs → profiler-B3tfiOx4.cjs} +2 -2
- package/dist/{profiler-Ce0O8-iW.cjs.map → profiler-B3tfiOx4.cjs.map} +1 -1
- package/dist/{profiler-DtaHTumy.js → profiler-noho3NG9.js} +2 -2
- package/dist/{profiler-DtaHTumy.js.map → profiler-noho3NG9.js.map} +1 -1
- package/dist/{startRecording-Cpeh1_CL.cjs → startRecording-7Oy6wM18.cjs} +2 -2
- package/dist/{startRecording-Cpeh1_CL.cjs.map → startRecording-7Oy6wM18.cjs.map} +1 -1
- package/dist/{startRecording-DjP64hyw.js → startRecording-mkmig-2n.js} +2 -2
- package/dist/{startRecording-DjP64hyw.js.map → startRecording-mkmig-2n.js.map} +1 -1
- package/package.json +1 -1
- package/src/hooks/useAuth.ts +13 -1
- package/dist/index-BqBo07H_.cjs.map +0 -1
- package/dist/index-Dn0_JCoN.js.map +0 -1
|
@@ -36,7 +36,7 @@ ${u}`,f=>{r.notifyAfterAddMessage(f-d)})}function i(u){return u!==void 0&&a[u]!=
|
|
|
36
36
|
`);a={};const m=Kx(u.reason),f=m?t.sendOnExit:t.send;if(m&&e.isAsync){const g=e.finishSync();g.outputBytesCount&&f(Cf(g));const h=[g.pendingData,d].filter(Boolean).join(`
|
|
37
37
|
`);h&&f({data:h,bytesCount:Px(h)})}else d&&e.write(e.isEmpty?d:`
|
|
38
38
|
${d}`),e.finish(g=>{f(Cf(g))})}return{flushController:r,add:l,upsert:l,stop:n.unsubscribe}}function Cf(e){let t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}const kP=30*tt,SP=Xs?1:50;function Xx({pageMayExitObservable:e,sessionExpireObservable:t}){const r=e.subscribe(d=>s(d.reason)),a=t.subscribe(()=>s("session_expire")),n=new ge(()=>()=>{r.unsubscribe(),a.unsubscribe()});let o=0,i=0;function s(d){if(i===0)return;const m=i,f=o;i=0,o=0,u(),n.notify({reason:d,messagesCount:m,bytesCount:f})}let l;function c(){l===void 0&&(l=Qe(()=>{s("duration_limit")},kP))}function u(){_t(l),l=void 0}return{flushObservable:n,get messagesCount(){return i},notifyBeforeAddMessage(d){o+d>=Zc&&s("bytes_limit"),i+=1,o+=d,c()},notifyAfterAddMessage(d=0){o+=d,i>=SP?s("messages_limit"):o>=Zc&&s("bytes_limit")},notifyAfterRemoveMessage(d){o-=d,i-=1,i===0&&u()}}}const Ir="DISCARDED",kt="SKIPPED";function IP(){const e={};return{register(t,r){return e[t]||(e[t]=[]),e[t].push(r),{unregister:()=>{e[t]=e[t].filter(a=>a!==r)}}},triggerHook(t,r){const a=e[t]||[],n=[];for(const o of a){const i=o(r);if(i===Ir)return Ir;i!==kt&&n.push(i)}return cr(...n)}}}const wr={LOG:"log",CONFIGURATION:"configuration",USAGE:"usage"},EP=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],TP=1,$P=[ij],OP=15;let Fl;function Yn(){return Fl||(Fl=new cx(100)),Fl}function CP(e,t,r,a,n,o){const i=new ge,{stop:s}=AP(t,a,n,o,i),{enabled:l,metricsEnabled:c}=NP(e,t,r,i);return{stop:s,enabled:l,metricsEnabled:c}}function NP(e,t,r,a,n=TP,o=OP){const i={},s=!$P.includes(t.site)&&Mr(t.telemetrySampleRate),l={[wr.LOG]:s,[wr.CONFIGURATION]:s&&Mr(t.telemetryConfigurationSampleRate),[wr.USAGE]:s&&Mr(t.telemetryUsageSampleRate),metric:s&&Mr(n)},c=RP(),u=Yn();return u.subscribe(({rawEvent:m,metricName:f})=>{if(f&&!l.metric||!l[m.type])return;const g=f||m.status||m.type;let h=i[g];if(h||(h=i[g]=new Set),h.size>=o)return;const b=Jn(m);if(h.has(b))return;const w=r.triggerHook(1,{startTime:qe().relative});if(w===Ir)return;const x=d(w,e,m,c);a.notify(x),xm("telemetry",x),h.add(b)}),u.unbuffer(),cR(Im),{enabled:s,metricsEnabled:l.metric};function d(m,f,g,h){const w={type:"telemetry",date:qe().timeStamp,service:f,version:"6.24.1",source:"browser",_dd:{format_version:2},telemetry:cr(g,{runtime_env:h,connectivity:Fx(),sdk_setup:"npm"}),ddtags:_m(t).join(","),experimental_features:Array.from(_j())};return cr(w,m)}}function AP(e,t,r,a,n){const o=[];if(Gr()){const i=Kn(),s=n.subscribe(l=>i.send("internal_telemetry",l));o.push(s.unsubscribe)}else{const i=[e.rumEndpointBuilder];e.replica&&jP(e)&&i.push(e.replica.rumEndpointBuilder);const s=Yx({encoder:a(4),request:Sm(i,t),flushController:Xx({pageMayExitObservable:r,sessionExpireObservable:new ge})});o.push(s.stop);const l=n.subscribe(s.add);o.push(l.unsubscribe)}return{stop:()=>o.forEach(i=>i())}}function RP(){var e;return{is_local_file:((e=Xt.location)===null||e===void 0?void 0:e.protocol)==="file:",is_worker:Xs}}function jP(e){return e.site===Ox}function Xn(e,t){Mc(Ks.debug,e,t),Yn().notify({rawEvent:{type:wr.LOG,message:e,status:"debug",...t}})}function Im(e,t){Yn().notify({rawEvent:{type:wr.LOG,status:"error",...zP(e),...t}})}function PP(e){Yn().notify({rawEvent:{type:wr.CONFIGURATION,configuration:e}})}function Ao(e,t){Yn().notify({rawEvent:{type:wr.LOG,message:e,status:"debug",...t},metricName:e})}function Ge(e){Yn().notify({rawEvent:{type:wr.USAGE,usage:e}})}function zP(e){if(an(e)){const t=Co(e);return{error:{kind:t.name,stack:No(DP(t))},message:t.message}}return{error:{stack:Dx},message:`Uncaught ${Jn(e)}`}}function DP(e){return e.stack=e.stack.filter(t=>!t.url||EP.some(r=>t.url.startsWith(r))),e}function Qx(e,t){const r=e.indexOf(t);r>=0&&e.splice(r,1)}function Vr(e){return Array.isArray(e)&&e.length>0}const ei=1/0,MP=gt;let la=null;const ci=new Set;function UP(){ci.forEach(e=>e())}function Qn({expireDelay:e,maxEntries:t}){let r=[];la||(la=Gn(()=>UP(),MP));const a=()=>{const u=xt()-e;for(;r.length>0&&r[r.length-1].endTime<u;)r.pop()};ci.add(a);function n(u,d){const m={value:u,startTime:d,endTime:ei,remove:()=>{Qx(r,m)},close:f=>{m.endTime=f}};return t&&r.length>=t&&r.pop(),r.unshift(m),m}function o(u=ei,d={returnInactive:!1}){for(const m of r)if(m.startTime<=u){if(d.returnInactive||u<=m.endTime)return m.value;break}}function i(u){const d=r[0];d&&d.endTime===ei&&d.close(u)}function s(u=ei,d=0){const m=Hn(u,d);return r.filter(f=>f.startTime<=m&&u<=f.endTime).map(f=>f.value)}function l(){r=[]}function c(){ci.delete(a),ci.size===0&&la&&(Qs(la),la=null)}return{add:n,find:o,closeActive:i,findAll:s,reset:l,stop:c}}const LP="datadog-synthetics-public-id",FP="datadog-synthetics-result-id",VP="datadog-synthetics-injects-rum";function ek(){return Xs?!1:!!(Xt._DATADOG_SYNTHETICS_INJECTS_RUM||hr(VP))}function tk(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||hr(LP);return typeof e=="string"?e:void 0}function rk(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||hr(FP);return typeof e=="string"?e:void 0}function nk(){return!!(tk()&&rk())}const ZP=gt,qP=tn;function BP(e,t,r,a){const n=new ge,o=new ge,i=YR(e.sessionStoreStrategyType,e,t,r),s=Qn({expireDelay:qP});if(i.renewObservable.subscribe(()=>{s.add(l(),xt()),n.notify()}),i.expireObservable.subscribe(()=>{o.notify(),s.closeActive(xt())}),i.expandOrRenewSession(),s.add(l(),fm().relative),Oo(Sr.SHORT_SESSION_INVESTIGATION)){const c=i.getSession();c&&KP(e,c)}a.observable.subscribe(()=>{a.isGranted()?i.expandOrRenewSession():i.expire(!1)}),GP(e,()=>{a.isGranted()&&i.expandOrRenewSession()}),HP(e,()=>i.expandSession()),JP(e,()=>i.restartSession());function l(){const c=i.getSession();return c?{id:c.id,trackingType:c[t],isReplayForced:!!c.forcedReplay,anonymousId:c.anonymousId}:(WP(e).catch(()=>{}),{id:"invalid",trackingType:yx,isReplayForced:!1,anonymousId:void 0})}return{findSession:(c,u)=>s.find(c,u),renewObservable:n,expireObservable:o,sessionStateUpdateObservable:i.sessionStateUpdateObservable,expire:i.expire,updateSessionState:i.updateSessionState}}function GP(e,t){const{stop:r}=lr(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function HP(e,t){const r=()=>{document.visibilityState==="visible"&&t()},{stop:a}=je(e,document,"visibilitychange",r);Gn(r,ZP)}function JP(e,t){const{stop:r}=je(e,window,"resume",t,{capture:!0})}async function WP(e){const t=e.sessionStoreStrategyType;if(!t)return;let r,a;t.type===Dn.COOKIE?(r=kx(t.cookieOptions,e),a={cookie:await ak(),currentDomain:`${window.location.protocol}//${window.location.hostname}`}):r=Ex(),Xn("Unexpected session state",{sessionStoreStrategyType:t.type,session:r,isSyntheticsTest:nk(),createdTimestamp:r?.created,expireTimestamp:r?.expire,...a})}function KP(e,t){if(!window.cookieStore||!t.created)return;const r=Number(t.created),a=ft(),{stop:n}=je(e,cookieStore,"change",o);function o(i){const s=hx(i.changed,c=>c.name===sr);if(!s)return;const l=ft()-r;if(l>14*gt)n();else{const c=nl(s.value);if(c.id&&c.id!==t.id){n();const u=ft()-a;ak().then(d=>{Xn("Session cookie changed",{time:u,session_age:l,old:t,new:c,cookie:d})}).catch(ir)}}}}async function ak(){let e;return"cookieStore"in window?e=await window.cookieStore.getAll(sr):e=document.cookie.split(/\s*;\s*/).filter(t=>t.startsWith(sr)),{count:e.length,domain:gx()||"undefined",...e}}function YP(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(r,a){const n=Px(r);t+=n,e+=r,a&&a(n)},finish(r){r(this.finishSync())},finishSync(){const r={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,r},estimateEncodedBytesCount(r){return r.length}}}class XP{constructor(){this.callbacks={}}notify(t,r){const a=this.callbacks[t];a&&a.forEach(n=>n(r))}subscribe(t,r){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(r),{unsubscribe:()=>{this.callbacks[t]=this.callbacks[t].filter(a=>r!==a)}}}}const QP=3e3;function Vl(e,t,r=QP){let a=0,n=!1;return{isLimitReached(){if(a===0&&Qe(()=>{a=0},gt),a+=1,a<=r||n)return n=!1,!1;if(a===r+1){n=!0;try{t({message:`Reached max number of ${e}s by minute: ${r}`,source:Wn.AGENT,startClocks:qe()})}finally{n=!1}}return!0}}}function Em(e,t,r){return document.readyState===t||document.readyState==="complete"?(r(),{stop:ve}):je(e,window,t==="complete"?"load":"DOMContentLoaded",r,{once:!0})}function e2(e,t){return new Promise(r=>{Em(e,t,r)})}let Zl;const Tm=new WeakMap;function t2(e){return Zl||(Zl=r2(e)),Zl}function r2(e){return new ge(t=>{const{stop:r}=Vt(XMLHttpRequest.prototype,"open",n2),{stop:a}=Vt(XMLHttpRequest.prototype,"send",o=>{a2(o,e,t)},{computeHandlingStack:!0}),{stop:n}=Vt(XMLHttpRequest.prototype,"abort",o2);return()=>{r(),a(),n()}})}function n2({target:e,parameters:[t,r]}){Tm.set(e,{state:"open",method:String(t).toUpperCase(),url:vm(String(r))})}function a2({target:e,parameters:[t],handlingStack:r},a,n){const o=Tm.get(e);if(!o)return;const i=o;i.state="start",i.startClocks=qe(),i.isAborted=!1,i.xhr=e,i.handlingStack=r,i.requestBody=t;let s=!1;const{stop:l}=Vt(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&c()}),c=()=>{if(u(),l(),s)return;s=!0;const d=o;d.state="complete",d.duration=De(i.startClocks.timeStamp,Je()),d.status=e.status,typeof e.response=="string"&&(d.responseBody=e.response),n.notify(ja(d))},{stop:u}=je(a,e,"loadend",c);n.notify(i)}function o2({target:e}){const t=Tm.get(e);t&&(t.isAborted=!0)}async function i2(e,t){const r=e.getReader(),a=[];for(;;){const n=await r.read();if(n.done)break;t.collectStreamBody&&a.push(n.value)}return r.cancel().catch(ve),t.collectStreamBody?zx(a):void 0}let ql;const ok=[];function ik({responseBodyAction:e}={}){return e&&ok.push(e),ql||(ql=s2()),ql}function s2(){return new ge(e=>{if(!Xt.fetch)return;const{stop:t}=Vt(Xt,"fetch",r=>l2(r,e),{computeHandlingStack:!0});return t})}function l2({parameters:e,onPostCall:t,handlingStack:r},a){const[n,o]=e;let i=o&&o.method;i===void 0&&n instanceof Request&&(i=n.method);const s=i!==void 0?String(i).toUpperCase():"GET",l=n instanceof Request?n.url:vm(String(n)),c=qe(),u={state:"start",init:o,input:n,method:s,startClocks:c,url:l,handlingStack:r};a.notify(u),e[0]=u.input,e[1]=u.init,t(d=>{c2(a,d,u).catch(ir)})}async function c2(e,t,r){var a,n;const o=r;o.state="resolve";let i;try{i=await t}catch(l){o.status=0,o.isAborted=((n=(a=o.init)===null||a===void 0?void 0:a.signal)===null||n===void 0?void 0:n.aborted)||l instanceof DOMException&&l.code===DOMException.ABORT_ERR,o.error=l,e.notify(o);return}o.response=i,o.status=i.status,o.responseType=i.type,o.isAborted=!1;const s=ok.reduce((l,c)=>Math.max(l,c(o)),0);if(s!==0){const l=uP(i);if(l&&l.body)try{const c=await i2(l.body,{collectStreamBody:s===2});o.responseBody=c&&new TextDecoder().decode(c)}catch{}}e.notify(o)}function sk(e,t){if(window.requestIdleCallback&&window.cancelIdleCallback){const r=window.requestIdleCallback(oe(e),t);return()=>window.cancelIdleCallback(r)}return d2(e)}const u2=50;function d2(e){const t=ft(),r=Qe(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,u2-(ft()-t))})},0);return()=>_t(r)}const m2=tt,p2=30;function f2(){const e=[];function t(a){let n;if(a.didTimeout){const o=performance.now();n=()=>p2-(performance.now()-o)}else n=a.timeRemaining.bind(a);for(;n()>0&&e.length;)e.shift()();e.length&&r()}function r(){sk(t,{timeout:m2})}return{push(a){e.push(a)===1&&r()},stop(){e.length=0}}}let Bl={};function g2(e){const t=e.map(r=>(Bl[r]||(Bl[r]=h2(r)),Bl[r]));return lx(...t)}function h2(e){return new ge(t=>{const r=rr[e];return rr[e]=(...a)=>{r.apply(console,a);const n=Mi("console error");yr(()=>{t.notify(v2(a,e,n))})},()=>{rr[e]=r}})}function v2(e,t,r){const a=e.map(n=>b2(n)).join(" ");if(t===Ks.error){const n=e.find(an),o=wm({originalError:n,handlingStack:r,startClocks:qe(),source:Wn.CONSOLE,handling:"handled",nonErrorPrefix:"Provided",useFallbackStack:!1});return o.message=a,{api:t,message:a,handlingStack:r,error:o}}return{api:t,message:a,error:void 0,handlingStack:r}}function b2(e){return typeof e=="string"?Ce(e):an(e)?Rx(Co(e)):Jn(Ce(e),void 0,2)}const y2=500;function w2(){const e=[];return{add:n=>{e.push(n)>y2&&e.splice(0,1)},remove:n=>{Qx(e,n)},drain:n=>{e.forEach(o=>o(n)),e.length=0}}}function _2(e){const t=rn(e)==="object";return t||Q.error("Unsupported context:",e),t}function Gl(e,t,r){const a={...e};for(const[n,{required:o,type:i}]of Object.entries(t))i==="string"&&!Nf(a[n])&&(a[n]=String(a[n])),o&&Nf(a[n])&&Q.warn(`The property ${n} of ${r} is required; context will not be sent to the intake.`);return a}function Nf(e){return e==null||e===""}function ol(e="",{propertiesConfig:t={}}={}){let r={};const a=new ge,n={getContext:()=>km(r),setContext:o=>{_2(o)?r=Ce(Gl(o,t,e)):n.clearContext(),a.notify()},setContextProperty:(o,i)=>{r=Ce(Gl({...r,[o]:i},t,e)),a.notify()},removeContextProperty:o=>{delete r[o],Gl(r,t,e),a.notify()},clearContext:()=>{r={},a.notify()},changeObservable:a};return n}function st(e,t,r,a){return oe((...n)=>(a&&Ge({feature:a}),e()[t][r](...n)))}const x2="_dd_c",k2=[];function $m(e,t,r,a){const n=S2(r,a);k2.push(je(e,window,"storage",({key:c})=>{n===c&&i()})),t.changeObservable.subscribe(s);const o=cr(l(),t.getContext());$r(o)||t.setContext(o);function i(){t.setContext(l())}function s(){localStorage.setItem(n,JSON.stringify(t.getContext()))}function l(){const c=localStorage.getItem(n);return c?JSON.parse(c):{}}}function S2(e,t){return`${x2}_${e}_${t}`}function I2(e,t,r){const a=lk();return t.storeContextsAcrossPages&&$m(t,a,r,4),e.register(0,()=>{const n=a.getContext();return $r(n)||!n.id?kt:{account:n}}),a}function lk(){return ol("account",{propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}})}function E2(e,t,r,a){const n=ck();return t.storeContextsAcrossPages&&$m(t,n,r,2),e.register(0,()=>({context:n.getContext()})),n}function ck(){return ol("global context")}function T2(e,t,r,a){const n=uk();return t.storeContextsAcrossPages&&$m(t,n,a,1),e.register(0,({eventType:o,startTime:i})=>{const s=n.getContext(),l=r.findTrackedSession(i);return l&&l.anonymousId&&!s.anonymous_id&&t.trackAnonymousUser&&(s.anonymous_id=l.anonymousId),$r(s)?kt:{type:o,usr:s}}),e.register(1,({startTime:o})=>{var i;return{anonymous_id:(i=r.findTrackedSession(o))===null||i===void 0?void 0:i.anonymousId}}),n}function uk(){return ol("user",{propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}})}const He={userContext:"userContext",globalContext:"globalContext",accountContext:"accountContext"},lt={getContext:"getContext",setContext:"setContext",setContextProperty:"setContextProperty",removeContextProperty:"removeContextProperty",clearContext:"clearContext"},dt={DOCUMENT:"document",XHR:"xhr",BEACON:"beacon",FETCH:"fetch",CSS:"css",JS:"js",IMAGE:"image",FONT:"font",MEDIA:"media",OTHER:"other"},il={FETCH:dt.FETCH,XHR:dt.XHR},$2=500;function O2(e=Jj){const t=new cx($2),r=e().subscribe(a=>{t.notify({type:0,error:a})});return{observable:t,stop:()=>{r.unsubscribe()}}}function C2(){try{return new Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const ne={ACTION:"action",ERROR:"error",LONG_TASK:"long_task",VIEW:"view",RESOURCE:"resource",VITAL:"vital"},dk={LONG_TASK:"long-task",LONG_ANIMATION_FRAME:"long-animation-frame"},nr={INITIAL_LOAD:"initial_load",ROUTE_CHANGE:"route_change",BF_CACHE:"bf_cache"},sl={CLICK:"click",CUSTOM:"custom"},ca={RAGE_CLICK:"rage_click",ERROR_CLICK:"error_click",DEAD_CLICK:"dead_click"},Ma={DURATION:"duration",OPERATION_STEP:"operation_step"};function N2(){return{vitalsByName:new Map,vitalsByReference:new WeakMap}}function A2(e,t,r){function a(i){return!t.wasInPageStateDuringPeriod("frozen",i.startClocks.relative,i.duration)}function n(i){a(i)&&e.notify(12,Af(i))}function o(i,s,l,c){if(!Oo(Sr.FEATURE_OPERATION_VITAL))return;const{operationKey:u,context:d,description:m}=l||{},f={name:i,type:Ma.OPERATION_STEP,operationKey:u,failureReason:c,stepType:s,startClocks:qe(),context:Ce(d),description:m};e.notify(12,Af(f))}return{addOperationStepVital:o,addDurationVital:n,startDurationVital:(i,s={})=>mk(r,i,s),stopDurationVital:(i,s={})=>{pk(n,r,i,s)}}}function mk({vitalsByName:e,vitalsByReference:t},r,a={}){const n={name:r,startClocks:qe(),...a},o={__dd_vital_reference:!0};return e.set(r,n),t.set(o,n),o}function pk(e,{vitalsByName:t,vitalsByReference:r},a,n={}){const o=typeof a=="string"?t.get(a):r.get(a);o&&(e(R2(o,o.startClocks,n,qe())),typeof a=="string"?t.delete(a):r.delete(a))}function R2(e,t,r,a){var n;return{name:e.name,type:Ma.DURATION,startClocks:t,duration:De(t.timeStamp,a.timeStamp),context:cr(e.context,r.context),description:(n=r.description)!==null&&n!==void 0?n:e.description}}function Af(e){const{startClocks:t,type:r,name:a,description:n,context:o}=e,i={id:ot(),type:r,name:a,description:n,...r===Ma.DURATION?{duration:ie(e.duration)}:{step_type:e.stepType,operation_key:e.operationKey,failure_reason:e.failureReason}};return{rawRumEvent:{date:t.timeStamp,vital:i,type:ne.VITAL,context:o},startTime:t.relative,duration:r===Ma.DURATION?e.duration:void 0,domainContext:{}}}function fk(e,t,r){if(e)for(const a of e){const n=a[t];n&&n(r)}}const Rf=new Map;function gk(e,t){if(t===100)return!0;if(t===0)return!1;const r=Rf.get(t);if(r&&e===r.sessionId)return r.decision;let a;return window.BigInt?a=j2(BigInt(`0x${e.split("-")[4]}`),t):a=Mr(t),Rf.set(t,{sessionId:e,decision:a}),a}function j2(e,t){const r=BigInt("1111111111111111111"),a=BigInt("0x10000000000000000"),n=e*r%a;return Number(n)<=t/100*Number(a)}function P2(){return vk(64)}function hk(){return vk(63)}function vk(e){const t=crypto.getRandomValues(new Uint32Array(2));return e===63&&(t[t.length-1]>>>=1),{toString(r=10){let a=t[1],n=t[0],o="";do{const i=a%r*4294967296+n;a=Math.floor(a/r),n=Math.floor(i/r),o=(i%r).toString(r)+o}while(a||n);return o}}}function pn(e){return e.toString(16).padStart(16,"0")}function z2(e){const t=e;return rn(t)==="object"&&za(t.match)&&Array.isArray(t.propagatorTypes)}function D2(e){e.status===0&&!e.isAborted&&(e.traceId=void 0,e.spanId=void 0,e.traceSampled=void 0)}function M2(e,t,r,a){return{clearTracingIfNeeded:D2,traceFetch:n=>jf(e,n,t,r,a,o=>{var i;if(n.input instanceof Request&&!(!((i=n.init)===null||i===void 0)&&i.headers))n.input=new Request(n.input),Object.keys(o).forEach(s=>{n.input.headers.append(s,o[s])});else{n.init=ja(n.init);const s=[];n.init.headers instanceof Headers?n.init.headers.forEach((l,c)=>{s.push([c,l])}):Array.isArray(n.init.headers)?n.init.headers.forEach(l=>{s.push(l)}):n.init.headers&&Object.keys(n.init.headers).forEach(l=>{s.push([l,n.init.headers[l]])}),n.init.headers=s.concat(rl(o))}}),traceXhr:(n,o)=>jf(e,n,t,r,a,i=>{Object.keys(i).forEach(s=>{o.setRequestHeader(s,i[s])})})}}function jf(e,t,r,a,n,o){const i=r.findTrackedSession();if(!i)return;const s=e.allowedTracingUrls.find(u=>al([u.match],t.url,!0));if(!s)return;const l=gk(i.id,e.traceSampleRate);(l||e.traceContextInjection===Fc.ALL)&&(t.traceSampled=l,t.traceId=P2(),t.spanId=hk(),o(U2(t.traceId,t.spanId,t.traceSampled,i.id,s.propagatorTypes,a,n,e)))}function U2(e,t,r,a,n,o,i,s){const l={};if(n.forEach(c=>{switch(c){case"datadog":{Object.assign(l,{"x-datadog-origin":"rum","x-datadog-parent-id":t.toString(),"x-datadog-sampling-priority":r?"1":"0","x-datadog-trace-id":e.toString()});break}case"tracecontext":{Object.assign(l,{traceparent:`00-0000000000000000${pn(e)}-${pn(t)}-0${r?"1":"0"}`,tracestate:`dd=s:${r?"1":"0"};o:rum`});break}case"b3":{Object.assign(l,{b3:`${pn(e)}-${pn(t)}-${r?"1":"0"}`});break}case"b3multi":{Object.assign(l,{"X-B3-TraceId":pn(e),"X-B3-SpanId":pn(t),"X-B3-Sampled":r?"1":"0"});break}}}),s.propagateTraceBaggage){const c={"session.id":a},u=o.getContext().id;typeof u=="string"&&(c["user.id"]=u);const d=i.getContext().id;typeof d=="string"&&(c["account.id"]=d);const m=Object.entries(c).map(([f,g])=>`${f}=${encodeURIComponent(g)}`).join(",");m&&(l.baggage=m)}return l}const bk=["tracecontext","datadog"];function L2(e,t){var r,a,n,o,i,s,l;if(e.trackFeatureFlagsForEvents!==void 0&&!Array.isArray(e.trackFeatureFlagsForEvents)&&Q.warn("trackFeatureFlagsForEvents should be an array"),!e.applicationId){Q.error("Application ID is not configured, no RUM data will be collected.");return}if(!yn(e.sessionReplaySampleRate,"Session Replay")||!yn(e.traceSampleRate,"Trace"))return;if(e.excludedActivityUrls!==void 0&&!Array.isArray(e.excludedActivityUrls)){Q.error("Excluded Activity Urls should be an array");return}const c=F2(e);if(!c)return;const u=vj(e,t),d=Z2(e);if(!u)return;const m=(r=e.sessionReplaySampleRate)!==null&&r!==void 0?r:0;return{applicationId:e.applicationId,actionNameAttribute:e.actionNameAttribute,sessionReplaySampleRate:m,startSessionReplayRecordingManually:e.startSessionReplayRecordingManually!==void 0?!!e.startSessionReplayRecordingManually:m===0,traceSampleRate:(a=e.traceSampleRate)!==null&&a!==void 0?a:100,rulePsr:So(e.traceSampleRate)?e.traceSampleRate/100:void 0,allowedTracingUrls:c,excludedActivityUrls:(n=e.excludedActivityUrls)!==null&&n!==void 0?n:[],workerUrl:e.workerUrl,compressIntakeRequests:!!e.compressIntakeRequests,trackUserInteractions:!!(!((o=e.trackUserInteractions)!==null&&o!==void 0)||o),trackViewsManually:!!e.trackViewsManually,trackResources:!!(!((i=e.trackResources)!==null&&i!==void 0)||i),trackLongTasks:!!(!((s=e.trackLongTasks)!==null&&s!==void 0)||s),trackBfcacheViews:!!e.trackBfcacheViews,trackEarlyRequests:!!e.trackEarlyRequests,subdomain:e.subdomain,defaultPrivacyLevel:Di(bn,e.defaultPrivacyLevel)?e.defaultPrivacyLevel:bn.MASK,enablePrivacyForActionName:!!e.enablePrivacyForActionName,traceContextInjection:Di(Fc,e.traceContextInjection)?e.traceContextInjection:Fc.SAMPLED,plugins:e.plugins||[],trackFeatureFlagsForEvents:e.trackFeatureFlagsForEvents||[],profilingSampleRate:(l=e.profilingSampleRate)!==null&&l!==void 0?l:0,propagateTraceBaggage:!!e.propagateTraceBaggage,allowedGraphQlUrls:d,...u}}function F2(e){if(e.allowedTracingUrls===void 0)return[];if(!Array.isArray(e.allowedTracingUrls)){Q.error("Allowed Tracing URLs should be an array");return}if(e.allowedTracingUrls.length!==0&&e.service===void 0){Q.error("Service needs to be configured when tracing is enabled");return}const t=[];return e.allowedTracingUrls.forEach(r=>{za(r)?t.push({match:r,propagatorTypes:bk}):z2(r)?t.push(r):Q.warn("Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter",r)}),t}function V2(e){const t=new Set;return Vr(e.allowedTracingUrls)&&e.allowedTracingUrls.forEach(r=>{za(r)?bk.forEach(a=>t.add(a)):rn(r)==="object"&&Array.isArray(r.propagatorTypes)&&r.propagatorTypes.forEach(a=>t.add(a))}),Array.from(t)}function Z2(e){if(!e.allowedGraphQlUrls)return[];if(!Array.isArray(e.allowedGraphQlUrls))return Q.warn("allowedGraphQlUrls should be an array"),[];const t=[];return e.allowedGraphQlUrls.forEach(r=>{za(r)?t.push({match:r,trackPayload:!1,trackResponseErrors:!1}):r&&typeof r=="object"&&"match"in r&&za(r.match)&&t.push({match:r.match,trackPayload:!!r.trackPayload,trackResponseErrors:!!r.trackResponseErrors})}),t}function q2(e){return Vr(e)&&e.some(t=>typeof t=="object"&&"trackPayload"in t?!!t.trackPayload:!1)}function B2(e){return Vr(e)&&e.some(t=>typeof t=="object"&&"trackResponseErrors"in t?!!t.trackResponseErrors:!1)}function G2(e){var t;const r=bj(e);return{session_replay_sample_rate:e.sessionReplaySampleRate,start_session_replay_recording_manually:e.startSessionReplayRecordingManually,trace_sample_rate:e.traceSampleRate,trace_context_injection:e.traceContextInjection,propagate_trace_baggage:e.propagateTraceBaggage,action_name_attribute:e.actionNameAttribute,use_allowed_tracing_urls:Vr(e.allowedTracingUrls),use_allowed_graph_ql_urls:Vr(e.allowedGraphQlUrls),use_track_graph_ql_payload:q2(e.allowedGraphQlUrls),use_track_graph_ql_response_errors:B2(e.allowedGraphQlUrls),selected_tracing_propagators:V2(e),default_privacy_level:e.defaultPrivacyLevel,enable_privacy_for_action_name:e.enablePrivacyForActionName,use_excluded_activity_urls:Vr(e.excludedActivityUrls),use_worker_url:!!e.workerUrl,compress_intake_requests:e.compressIntakeRequests,track_views_manually:e.trackViewsManually,track_user_interactions:e.trackUserInteractions,track_resources:e.trackResources,track_long_task:e.trackLongTasks,track_bfcache_views:e.trackBfcacheViews,track_early_requests:e.trackEarlyRequests,plugins:(t=e.plugins)===null||t===void 0?void 0:t.map(a=>{var n;return{name:a.name,...(n=a.getConfigurationTelemetry)===null||n===void 0?void 0:n.call(a)}}),track_feature_flags_for_events:e.trackFeatureFlagsForEvents,remote_configuration_id:e.remoteConfigurationId,profiling_sample_rate:e.profilingSampleRate,use_remote_configuration_proxy:!!e.remoteConfigurationProxy,...r}}function H2(e){const t=[];let r=0,a;const n={quote:void 0,escapeSequence:void 0};let o="";for(const i of e){if(a=Pf[r].find(s=>Q2[s](i,n)),!a)return[];if(n.escapeSequence!==void 0&&a!==12){if(!r4(n.escapeSequence))return[];o+=a4(n.escapeSequence),n.escapeSequence=void 0}e4.includes(a)?o+=i:t4.includes(a)&&o!==""?(t.push(o),o=""):a===12?n.escapeSequence=n.escapeSequence?`${n.escapeSequence}${i}`:i:a===8?n.quote=i:a===9&&(n.quote=void 0),r=a}return Pf[r].includes(1)?(o!==""&&t.push(o),t):[]}const J2=/[a-zA-Z_$]/,W2=/[a-zA-Z0-9_$]/,K2=/[0-9]/,Y2=/[a-fA-F0-9]/,X2=`'"`,Q2={0:()=>!1,1:()=>!1,2:e=>J2.test(e),3:e=>W2.test(e),4:e=>e===".",5:e=>e==="[",6:e=>e==="]",7:e=>K2.test(e),8:e=>X2.includes(e),9:(e,t)=>e===t.quote,10:()=>!0,11:e=>e==="\\",12:(e,t)=>t.escapeSequence===void 0?`${t.quote}/\\bfnrtu`.includes(e):t.escapeSequence.startsWith("u")&&t.escapeSequence.length<5?Y2.test(e):!1},Pf={0:[2,5],1:[],2:[3,4,5,1],3:[3,4,5,1],4:[2],5:[8,7],6:[4,5,1],7:[7,6],8:[11,9,10],9:[6],10:[11,9,10],11:[12],12:[12,11,9,10]},e4=[2,3,7,10],t4=[4,5,6];function r4(e){return`"'/\\bfnrt`.includes(e)||e.startsWith("u")&&e.length===5}const n4={'"':'"',"'":"'","/":"/","\\":"\\",b:"\b",f:"\f",n:`
|
|
39
|
-
`,r:"\r",t:" "};function a4(e){return e.startsWith("u")?String.fromCharCode(parseInt(e.slice(1),16)):n4[e]}const o4="v1",i4=["applicationId","service","env","version","sessionSampleRate","sessionReplaySampleRate","defaultPrivacyLevel","enablePrivacyForActionName","traceSampleRate","trackSessionAcrossSubdomains","allowedTracingUrls","allowedTrackingOrigins"];async function s4(e,t){let r;const a=c4(),n=await p4(e);return n.ok?(a.increment("fetch","success"),r=l4(e,n.value,t,a)):(a.increment("fetch","failure"),Q.error(n.error)),Ao("remote configuration metrics",{metrics:a.get()}),r}function l4(e,t,r,a){const n={...e};return i4.forEach(m=>{m in t&&(n[m]=o(t[m]))}),Object.keys(r).forEach(m=>{t[m]!==void 0&&i(r[m],t[m])}),n;function o(m){if(Array.isArray(m))return m.map(o);if(u4(m)){if(d4(m)){const f=m.rcSerializedType;switch(f){case"string":return m.value;case"regex":return yk(m.value);case"dynamic":return s(m);default:Q.error(`Unsupported remote configuration: "rcSerializedType": "${f}"`);return}}return ix(m,o)}return m}function i(m,f){f.forEach(({key:g,value:h})=>{m.setContextProperty(g,o(h))})}function s(m){const f=m.strategy;let g;switch(f){case"cookie":g=l(m);break;case"dom":g=c(m);break;case"js":g=d(m);break;default:Q.error(`Unsupported remote configuration: "strategy": "${f}"`);return}const h=m.extractor;return h!==void 0&&typeof g=="string"?m4(h,g):g}function l({name:m}){const f=tl(m);return a.increment("cookie",f!==void 0?"success":"missing"),f}function c({selector:m,attribute:f}){let g;try{g=document.querySelector(m)}catch{Q.error(`Invalid selector in the remote configuration: '${m}'`),a.increment("dom","failure");return}if(!g){a.increment("dom","missing");return}if(u(g,f)){Q.error(`Forbidden element selected by the remote configuration: '${m}'`),a.increment("dom","failure");return}const h=f!==void 0?g.getAttribute(f):g.textContent;if(h===null){a.increment("dom","missing");return}return a.increment("dom","success"),h}function u(m,f){return m.getAttribute("type")==="password"&&f==="value"}function d({path:m}){let f=window;const g=H2(m);if(g.length===0){Q.error(`Invalid JSON path in the remote configuration: '${m}'`),a.increment("js","failure");return}for(const h of g){if(!(h in f)){a.increment("js","missing");return}try{f=f[h]}catch(b){Q.error(`Error accessing: '${m}'`,b),a.increment("js","failure");return}}return a.increment("js","success"),f}}function c4(){const e={fetch:{}};return{get:()=>e,increment:(t,r)=>{e[t]||(e[t]={}),e[t][r]||(e[t][r]=0),e[t][r]=e[t][r]+1}}}function u4(e){return typeof e=="object"&&e!==null}function d4(e){return"rcSerializedType"in e}function yk(e){try{return new RegExp(e)}catch{Q.error(`Invalid regex in the remote configuration: '${e}'`)}}function m4(e,t){const r=yk(e.value);if(r===void 0)return;const a=r.exec(t);if(a===null)return;const[n,o]=a;return o||n}async function p4(e){let t;try{t=await fetch(f4(e))}catch{t=void 0}if(!t||!t.ok)return{ok:!1,error:new Error("Error fetching the remote configuration.")};const r=await t.json();return r.rum?{ok:!0,value:r.rum}:{ok:!1,error:new Error("No remote configuration for RUM.")}}function f4(e){return e.remoteConfigurationProxy?e.remoteConfigurationProxy:`https://sdk-configuration.${Cx("rum",e)}/${o4}/${encodeURIComponent(e.remoteConfigurationId)}.json`}function g4({ignoreInitIfSyntheticsWillInjectRum:e=!0,startDeflateWorker:t},r,a,n){const o=w2(),i=ck();Hl(i,He.globalContext,o);const s=uk();Hl(s,He.userContext,o);const l=lk();Hl(l,He.accountContext,o);let c,u,d,m;const f=r.observable.subscribe(h),g={};function h(){if(!d||!m||!r.isGranted())return;f.unsubscribe();let y;if(m.trackViewsManually){if(!c)return;o.remove(c.callback),y=c.options}const $=n(m,u,y);o.drain($)}function b(y,$){const I=Gr();if(I&&(y=h4(y)),d=y,PP(G2(y)),m){Mx("DD_RUM",y);return}const E=L2(y,$);if(E){if(!I&&!E.sessionStoreStrategyType){Q.warn("No storage available for session. We will not send any data.");return}E.compressIntakeRequests&&!I&&t&&(u=t(E,"Datadog RUM",ve),!u)||(m=E,ik().subscribe(ve),r.tryToInit(E.trackingConsent),h())}}const w=y=>{o.add($=>$.addDurationVital(y))};return{init(y,$,I){if(!y){Q.error("Missing configuration");return}yj(y.enableExperimentalFeatures),d=y,!(e&&ek())&&(fk(y.plugins,"onInit",{initConfiguration:y,publicApi:$}),y.remoteConfigurationId?s4(y,{user:s,context:i}).then(E=>{E&&b(E,I)}).catch(ir):b(y,I))},get initConfiguration(){return d},getInternalContext:ve,stopSession:ve,addTiming(y,$=Je()){o.add(I=>I.addTiming(y,$))},startView(y,$=qe()){const I=E=>{E.startView(y,$)};o.add(I),c||(c={options:y,callback:I},h())},setViewName(y){o.add($=>$.setViewName(y))},setViewContext(y){o.add($=>$.setViewContext(y))},setViewContextProperty(y,$){o.add(I=>I.setViewContextProperty(y,$))},getViewContext:()=>g,globalContext:i,userContext:s,accountContext:l,addAction(y){o.add($=>$.addAction(y))},addError(y){o.add($=>$.addError(y))},addFeatureFlagEvaluation(y,$){o.add(I=>I.addFeatureFlagEvaluation(y,$))},startDurationVital(y,$){return mk(a,y,$)},stopDurationVital(y,$){pk(w,a,y,$)},addDurationVital:w,addOperationStepVital:(y,$,I,E)=>{o.add(A=>A.addOperationStepVital(Ce(y),$,Ce(I),Ce(E)))}}}function h4(e){var t,r;return{...e,applicationId:"00000000-aaaa-0000-aaaa-000000000000",clientToken:"empty",sessionSampleRate:100,defaultPrivacyLevel:(t=e.defaultPrivacyLevel)!==null&&t!==void 0?t:(r=Kn())===null||r===void 0?void 0:r.getPrivacyLevel()}}function Hl(e,t,r){e.changeObservable.subscribe(()=>{const a=e.getContext();r.add(n=>n[t].setContext(a))})}function v4(e,t,r,a={}){const n=XR(),o=N2(),i=O2().observable;let s=g4(a,n,o,(d,m,f)=>{const g=m&&a.createDeflateEncoder?b=>a.createDeflateEncoder(d,m,b):YP,h=e(d,t,r,f,g,n,o,i,a.sdkName);return t.onRumStart(h.lifeCycle,d,h.session,h.viewHistory,m,h.telemetry),r.onRumStart(h.lifeCycle,h.hooks,d,h.session,h.viewHistory,g),s=b4(s,h),fk(d.plugins,"onRumStart",{strategy:s,addEvent:h.addEvent}),h});const l=()=>s,c=oe(d=>{const m=typeof d=="object"?d:{name:d};s.startView(m),Ge({feature:"start-view"})}),u=Yj({init:d=>{const m=new Error().stack;yr(()=>s.init(d,u,m))},setTrackingConsent:oe(d=>{n.update(d),Ge({feature:"set-tracking-consent",tracking_consent:d})}),setViewName:oe(d=>{s.setViewName(d),Ge({feature:"set-view-name"})}),setViewContext:oe(d=>{s.setViewContext(d),Ge({feature:"set-view-context"})}),setViewContextProperty:oe((d,m)=>{s.setViewContextProperty(d,m),Ge({feature:"set-view-context-property"})}),getViewContext:oe(()=>(Ge({feature:"set-view-context-property"}),s.getViewContext())),getInternalContext:oe(d=>s.getInternalContext(d)),getInitConfiguration:oe(()=>km(s.initConfiguration)),addAction:(d,m)=>{const f=Mi("action");yr(()=>{s.addAction({name:Ce(d),context:Ce(m),startClocks:qe(),type:sl.CUSTOM,handlingStack:f}),Ge({feature:"add-action"})})},addError:(d,m)=>{const f=Mi("error");yr(()=>{s.addError({error:d,handlingStack:f,context:Ce(m),startClocks:qe()}),Ge({feature:"add-error"})})},addTiming:oe((d,m)=>{s.addTiming(Ce(d),m)}),setGlobalContext:st(l,He.globalContext,lt.setContext,"set-global-context"),getGlobalContext:st(l,He.globalContext,lt.getContext,"get-global-context"),setGlobalContextProperty:st(l,He.globalContext,lt.setContextProperty,"set-global-context-property"),removeGlobalContextProperty:st(l,He.globalContext,lt.removeContextProperty,"remove-global-context-property"),clearGlobalContext:st(l,He.globalContext,lt.clearContext,"clear-global-context"),setUser:st(l,He.userContext,lt.setContext,"set-user"),getUser:st(l,He.userContext,lt.getContext,"get-user"),setUserProperty:st(l,He.userContext,lt.setContextProperty,"set-user-property"),removeUserProperty:st(l,He.userContext,lt.removeContextProperty,"remove-user-property"),clearUser:st(l,He.userContext,lt.clearContext,"clear-user"),setAccount:st(l,He.accountContext,lt.setContext,"set-account"),getAccount:st(l,He.accountContext,lt.getContext,"get-account"),setAccountProperty:st(l,He.accountContext,lt.setContextProperty,"set-account-property"),removeAccountProperty:st(l,He.accountContext,lt.removeContextProperty,"remove-account-property"),clearAccount:st(l,He.accountContext,lt.clearContext,"clear-account"),startView:c,stopSession:oe(()=>{s.stopSession(),Ge({feature:"stop-session"})}),addFeatureFlagEvaluation:oe((d,m)=>{s.addFeatureFlagEvaluation(Ce(d),Ce(m)),Ge({feature:"add-feature-flag-evaluation"})}),getSessionReplayLink:oe(()=>t.getSessionReplayLink()),startSessionReplayRecording:oe(d=>{t.start(d),Ge({feature:"start-session-replay-recording",force:d&&d.force})}),stopSessionReplayRecording:oe(()=>t.stop()),addDurationVital:oe((d,m)=>{Ge({feature:"add-duration-vital"}),s.addDurationVital({name:Ce(d),type:Ma.DURATION,startClocks:mR(m.startTime),duration:m.duration,context:Ce(m&&m.context),description:Ce(m&&m.description)})}),startDurationVital:oe((d,m)=>(Ge({feature:"start-duration-vital"}),s.startDurationVital(Ce(d),{context:Ce(m&&m.context),description:Ce(m&&m.description)}))),stopDurationVital:oe((d,m)=>{Ge({feature:"stop-duration-vital"}),s.stopDurationVital(typeof d=="string"?Ce(d):d,{context:Ce(m&&m.context),description:Ce(m&&m.description)})}),startFeatureOperation:oe((d,m)=>{Ge({feature:"add-operation-step-vital",action_type:"start"}),s.addOperationStepVital(d,"start",m)}),succeedFeatureOperation:oe((d,m)=>{Ge({feature:"add-operation-step-vital",action_type:"succeed"}),s.addOperationStepVital(d,"end",m)}),failFeatureOperation:oe((d,m,f)=>{Ge({feature:"add-operation-step-vital",action_type:"fail"}),s.addOperationStepVital(d,"end",f,m)})});return u}function b4(e,t){return{init:r=>{Mx("DD_RUM",r)},initConfiguration:e.initConfiguration,...t}}function y4(){const e=wk();return new ge(t=>{if(!e)return;const r=new e(oe(a=>t.notify(a)));return r.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),()=>r.disconnect()})}function wk(){let e;const t=window;if(t.Zone&&(e=kr(t,"MutationObserver"),t.MutationObserver&&e===t.MutationObserver)){const r=new t.MutationObserver(ve),a=kr(r,"originalInstance");e=a&&a.constructor}return e||(e=t.MutationObserver),e}function w4(){const e=new ge,{stop:t}=Vt(window,"open",()=>e.notify());return{observable:e,stop:t}}function _4(e,t,r,a,n){return{get:o=>{const i=r.findView(o),s=n.findUrl(o),l=t.findTrackedSession(o);if(l&&i&&s){const c=a.findActionId(o);return{application_id:e,session_id:l.id,user_action:c?{id:c}:void 0,view:{id:i.id,name:i.name,referrer:s.referrer,url:s.url}}}}}}const x4=XP,k4=tn;function S4(e){const t=Qn({expireDelay:k4});e.subscribe(1,a=>{t.add(r(a),a.startClocks.relative)}),e.subscribe(6,({endClocks:a})=>{t.closeActive(a.relative)}),e.subscribe(3,a=>{const n=t.find(a.startClocks.relative);n&&(a.name&&(n.name=a.name),a.context&&(n.context=a.context),n.sessionIsActive=a.sessionIsActive)}),e.subscribe(10,()=>{t.reset()});function r(a){return{service:a.service,version:a.version,context:a.context,id:a.id,name:a.name,startClocks:a.startClocks}}return{findView:a=>t.find(a),stop:()=>{t.stop()}}}const _k="initial_document",I4=[[dt.DOCUMENT,e=>_k===e],[dt.XHR,e=>e==="xmlhttprequest"],[dt.FETCH,e=>e==="fetch"],[dt.BEACON,e=>e==="beacon"],[dt.CSS,(e,t)=>/\.css$/i.test(t)],[dt.JS,(e,t)=>/\.js$/i.test(t)],[dt.IMAGE,(e,t)=>["image","img","icon"].includes(e)||/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(t)!==null],[dt.FONT,(e,t)=>/\.(woff|eot|woff2|ttf)$/i.exec(t)!==null],[dt.MEDIA,(e,t)=>["audio","video"].includes(e)||/\.(mp3|mp4)$/i.exec(t)!==null]];function E4(e){const t=e.name;if(!_R(t))return dt.OTHER;const r=xR(t);for(const[a,n]of I4)if(n(e.initiatorType,r))return a;return dt.OTHER}function zf(...e){for(let t=1;t<e.length;t+=1)if(e[t-1]>e[t])return!1;return!0}function xk(e){return e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch"}function T4(e){const{duration:t,startTime:r,responseEnd:a}=e;return t===0&&r<a?De(r,a):t}function $4(e){if(!Sk(e))return;const{startTime:t,fetchStart:r,workerStart:a,redirectStart:n,redirectEnd:o,domainLookupStart:i,domainLookupEnd:s,connectStart:l,secureConnectionStart:c,connectEnd:u,requestStart:d,responseStart:m,responseEnd:f}=e,g={download:Nr(t,m,f),first_byte:Nr(t,d,m)};return 0<a&&a<r&&(g.worker=Nr(t,a,r)),r<u&&(g.connect=Nr(t,l,u),l<=c&&c<=u&&(g.ssl=Nr(t,c,u))),r<s&&(g.dns=Nr(t,i,s)),t<o&&(g.redirect=Nr(t,n,o)),g}function kk(e){return e.duration>=0}function Sk(e){const t=zf(e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd),r=O4(e)?zf(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart):!0;return t&&r}function O4(e){return e.redirectEnd>e.startTime}function Nr(e,t,r){if(e<=t&&t<=r)return{duration:ie(De(t,r)),start:ie(De(e,t))}}function C4(e){return e.nextHopProtocol===""?void 0:e.nextHopProtocol}function N4(e){return e.deliveryType===""?"other":e.deliveryType}function A4(e){if(e.startTime<e.responseStart){const{encodedBodySize:t,decodedBodySize:r,transferSize:a}=e;return{size:r,encoded_body_size:t,decoded_body_size:r,transfer_size:a}}return{size:void 0,encoded_body_size:void 0,decoded_body_size:void 0,transfer_size:void 0}}function Om(e){return e&&(!gj(e)||Oo(Sr.TRACK_INTAKE_REQUESTS))}const R4=/data:(.+)?(;base64)?,/g,j4=24e3;function Ik(e,t=j4){if(e.length<=t||!e.startsWith("data:"))return e;const r=e.substring(0,100).match(R4);return r?`${r[0]}[...]`:e}const P4=32*nn;function z4(e,t){const r=M4(e.requestBody,t.trackPayload);if(r){if(t.trackResponseErrors&&e.responseBody){const a=D4(e.responseBody);a&&(r.errors_count=a.length,r.errors=a)}return r}}function D4(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!="object")return;const r=t;return Vr(r.errors)?r.errors.map(n=>{var o;return{message:n.message,path:n.path,locations:n.locations,code:(o=n.extensions)===null||o===void 0?void 0:o.code}}):void 0}function Ek(e,t){return t.allowedGraphQlUrls.find(r=>al([r.match],e))}function M4(e,t=!1){if(!e||typeof e!="string")return;let r;try{r=JSON.parse(e)}catch{return}if(!r||!r.query)return;const a=r.query.trim(),n=U4(a),o=r.operationName;if(!n)return;let i;return r.variables&&(i=JSON.stringify(r.variables)),{operationType:n,operationName:o,variables:i,payload:t?hm(a,P4,"..."):void 0}}function U4(e){var t;return(t=e.match(/^\s*(query|mutation|subscription)\b/i))===null||t===void 0?void 0:t[1]}let Df=1;function L4(e,t,r,a,n){const o=M2(t,r,a,n);F4(e,t,o),V4(e,t,o)}function F4(e,t,r){const a=t2(t).subscribe(n=>{const o=n;if(Om(o.url))switch(o.state){case"start":r.traceXhr(o,o.xhr),o.requestIndex=Tk(),e.notify(7,{requestIndex:o.requestIndex,url:o.url});break;case"complete":r.clearTracingIfNeeded(o),e.notify(8,{duration:o.duration,method:o.method,requestIndex:o.requestIndex,spanId:o.spanId,startClocks:o.startClocks,status:o.status,traceId:o.traceId,traceSampled:o.traceSampled,type:il.XHR,url:o.url,xhr:o.xhr,isAborted:o.isAborted,handlingStack:o.handlingStack,requestBody:o.requestBody,responseBody:o.responseBody});break}});return{stop:()=>a.unsubscribe()}}function V4(e,t,r){const a=ik({responseBodyAction:n=>{var o;return!((o=Ek(n.url,t))===null||o===void 0)&&o.trackResponseErrors?2:1}}).subscribe(n=>{var o;const i=n;if(Om(i.url))switch(i.state){case"start":r.traceFetch(i),i.requestIndex=Tk(),e.notify(7,{requestIndex:i.requestIndex,url:i.url});break;case"resolve":r.clearTracingIfNeeded(i),e.notify(8,{duration:De(i.startClocks.timeStamp,Je()),method:i.method,requestIndex:i.requestIndex,responseType:i.responseType,spanId:i.spanId,startClocks:i.startClocks,status:i.status,traceId:i.traceId,traceSampled:i.traceSampled,type:il.FETCH,url:i.url,response:i.response,init:i.init,input:i.input,isAborted:i.isAborted,handlingStack:i.handlingStack,requestBody:(o=i.init)===null||o===void 0?void 0:o.body,responseBody:i.responseBody});break}});return{stop:()=>a.unsubscribe()}}function Tk(){const e=Df;return Df+=1,e}function $k(e){return So(e)&&e<0?void 0:e}function Ok({lifeCycle:e,isChildEvent:t,onChange:r=ve}){const a={errorCount:0,longTaskCount:0,resourceCount:0,actionCount:0,frustrationCount:0},n=e.subscribe(13,o=>{var i;if(!(o.type==="view"||o.type==="vital"||!t(o)))switch(o.type){case ne.ERROR:a.errorCount+=1,r();break;case ne.ACTION:a.actionCount+=1,o.action.frustration&&(a.frustrationCount+=o.action.frustration.type.length),r();break;case ne.LONG_TASK:a.longTaskCount+=1,r();break;case ne.RESOURCE:!((i=o._dd)===null||i===void 0)&&i.discarded||(a.resourceCount+=1,r());break}});return{stop:()=>{n.unsubscribe()},eventCounts:a}}function Z4(e,t){const r=ft();let a=!1;const{stop:n}=lr(e,window,["click","mousedown","keydown","touchstart","pointerdown"],s=>{if(!s.cancelable)return;const l={entryType:"first-input",processingStart:xt(),processingEnd:xt(),startTime:s.timeStamp,duration:0,name:"",cancelable:!1,target:null,toJSON:()=>({})};s.type==="pointerdown"?o(e,l):i(l)},{passive:!0,capture:!0});return{stop:n};function o(s,l){lr(s,window,["pointerup","pointercancel"],c=>{c.type==="pointerup"&&i(l)},{once:!0})}function i(s){if(!a){a=!0,n();const l=s.processingStart-s.startTime;l>=0&&l<ft()-r&&t(s)}}}exports.RumPerformanceEntryType=void 0;(function(e){e.EVENT="event",e.FIRST_INPUT="first-input",e.LARGEST_CONTENTFUL_PAINT="largest-contentful-paint",e.LAYOUT_SHIFT="layout-shift",e.LONG_TASK="longtask",e.LONG_ANIMATION_FRAME="long-animation-frame",e.NAVIGATION="navigation",e.PAINT="paint",e.RESOURCE="resource",e.VISIBILITY_STATE="visibility-state"})(exports.RumPerformanceEntryType||(exports.RumPerformanceEntryType={}));function Qt(e,t){return new ge(r=>{if(!window.PerformanceObserver)return;const a=l=>{const c=G4(l);c.length>0&&r.notify(c)};let n,o=!0;const i=new PerformanceObserver(oe(l=>{o?n=Qe(()=>a(l.getEntries())):a(l.getEntries())}));try{i.observe(t)}catch{if([exports.RumPerformanceEntryType.RESOURCE,exports.RumPerformanceEntryType.NAVIGATION,exports.RumPerformanceEntryType.LONG_TASK,exports.RumPerformanceEntryType.PAINT].includes(t.type)){t.buffered&&(n=Qe(()=>a(performance.getEntriesByType(t.type))));try{i.observe({entryTypes:[t.type]})}catch{return}}}o=!1,q4(e);let s;return!Or(exports.RumPerformanceEntryType.FIRST_INPUT)&&t.type===exports.RumPerformanceEntryType.FIRST_INPUT&&({stop:s}=Z4(e,l=>{a([l])})),()=>{i.disconnect(),s&&s(),_t(n)}})}let ua;function q4(e){return!ua&&B4()&&"addEventListener"in performance&&(ua=je(e,performance,"resourcetimingbufferfull",()=>{performance.clearResourceTimings()})),()=>{ua?.stop()}}function B4(){return window.performance!==void 0&&"getEntries"in performance}function Or(e){return window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes!==void 0&&PerformanceObserver.supportedEntryTypes.includes(e)}function G4(e){return e.filter(t=>!H4(t))}function H4(e){return e.entryType===exports.RumPerformanceEntryType.RESOURCE&&(!Om(e.name)||!kk(e))}function qc(e){return e.nodeType===Node.TEXT_NODE}function J4(e){return e.nodeType===Node.COMMENT_NODE}function ur(e){return e.nodeType===Node.ELEMENT_NODE}function Cm(e){return ur(e)&&!!e.shadowRoot}function Ck(e){const t=e;return!!t.host&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&ur(t.host)}function W4(e){return e.childNodes.length>0||Cm(e)}function K4(e,t){let r=e.firstChild;for(;r;)t(r),r=r.nextSibling;Cm(e)&&t(e.shadowRoot)}function Nk(e){return Ck(e)?e.host:e.parentNode}const Ak=100,Y4=100,Mf="data-dd-excluded-activity-mutations";function Nm(e,t,r,a,n,o){const i=Q4(e,t,r,a);return X4(i,n,o)}function X4(e,t,r){let a,n=!1;const o=Qe(oe(()=>c({hadActivity:!1})),Ak),i=r!==void 0?Qe(oe(()=>c({hadActivity:!0,end:Je()})),r):void 0,s=e.subscribe(({isBusy:u})=>{_t(o),_t(a);const d=Je();u||(a=Qe(oe(()=>c({hadActivity:!0,end:d})),Y4))}),l=()=>{n=!0,_t(o),_t(a),_t(i),s.unsubscribe()};function c(u){n||(l(),t(u))}return{stop:l}}function Q4(e,t,r,a){return new ge(n=>{const o=[];let i,s=0;return o.push(t.subscribe(c=>{c.every(ez)||l()}),r.subscribe(l),Qt(a,{type:exports.RumPerformanceEntryType.RESOURCE}).subscribe(c=>{c.some(u=>!Jl(a,u.name))&&l()}),e.subscribe(7,c=>{Jl(a,c.url)||(i===void 0&&(i=c.requestIndex),s+=1,l())}),e.subscribe(8,c=>{Jl(a,c.url)||i===void 0||c.requestIndex<i||(s-=1,l())})),()=>{o.forEach(c=>c.unsubscribe())};function l(){n.notify({isBusy:s>0})}})}function Jl(e,t){return al(e.excludedActivityUrls,t)}function ez(e){const t=e.type==="characterData"?e.target.parentElement:e.target;return!!(t&&ur(t)&&t.matches(`[${Mf}], [${Mf}] *`))}const ll="data-dd-action-name",Rk="Masked Element",jk=[ll,"data-testid","data-test","data-qa","data-cy","data-test-id","data-qa-id","data-testing","data-component","data-element","data-source-file"],tz=[zk,nz],rz=[zk,az,oz];function Ro(e,t){if(!e.isConnected)return;let r,a=e;for(;a&&a.nodeName!=="HTML";){const n=Uf(a,tz,sz,t,r);if(n)return n;r=Uf(a,rz,lz,t,r)||cl(iz(a),r),a=a.parentElement}return r}function Pk(e){return/[0-9]/.test(e)}function nz(e){if(e.id&&!Pk(e.id))return`#${CSS.escape(e.id)}`}function az(e){if(e.tagName==="BODY")return;const t=e.classList;for(let r=0;r<t.length;r+=1){const a=t[r];if(!Pk(a))return`${CSS.escape(e.tagName)}.${CSS.escape(a)}`}}function oz(e){return CSS.escape(e.tagName)}function zk(e,t){if(t){const a=r(t);if(a)return a}for(const a of jk){const n=r(a);if(n)return n}function r(a){if(e.hasAttribute(a))return`${CSS.escape(e.tagName)}[${a}="${CSS.escape(e.getAttribute(a))}"]`}}function iz(e){let t=e.parentElement.firstElementChild,r=1;for(;t&&t!==e;)t.tagName===e.tagName&&(r+=1),t=t.nextElementSibling;return`${CSS.escape(e.tagName)}:nth-of-type(${r})`}function Uf(e,t,r,a,n){for(const o of t){const i=o(e,a);if(i&&r(e,i,n))return cl(i,n)}}function sz(e,t,r){return e.ownerDocument.querySelectorAll(cl(t,r)).length===1}function lz(e,t,r){let a;if(r===void 0)a=i=>i.matches(t);else{const i=cl(`${t}:scope`,r);a=s=>s.querySelector(i)!==null}let o=e.parentElement.firstElementChild;for(;o;){if(o!==e&&a(o))return!1;o=o.nextElementSibling}return!0}function cl(e,t){return t?`${e}>${t}`:e}const ce={IGNORE:"ignore",HIDDEN:"hidden",ALLOW:bn.ALLOW,MASK:bn.MASK,MASK_USER_INPUT:bn.MASK_USER_INPUT,MASK_UNLESS_ALLOWLISTED:bn.MASK_UNLESS_ALLOWLISTED},Am="data-dd-privacy",cz="hidden",uz="dd-privacy-",ui="***",dz="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",mz={INPUT:!0,OUTPUT:!0,TEXTAREA:!0,SELECT:!0,OPTION:!0,DATALIST:!0,OPTGROUP:!0},pz="x";function Pr(e){return`[${Am}="${e}"], .${uz}${e}`}function jo(e,t,r){if(r&&r.has(e))return r.get(e);const a=Nk(e),n=a?jo(a,t,r):t,o=Mk(e),i=Dk(o,n);return r&&r.set(e,i),i}function Dk(e,t){switch(t){case ce.HIDDEN:case ce.IGNORE:return t}switch(e){case ce.ALLOW:case ce.MASK:case ce.MASK_USER_INPUT:case ce.MASK_UNLESS_ALLOWLISTED:case ce.HIDDEN:case ce.IGNORE:return e;default:return t}}function Mk(e){if(ur(e)){if(e.tagName==="BASE")return ce.ALLOW;if(e.tagName==="INPUT"){const t=e;if(t.type==="password"||t.type==="email"||t.type==="tel"||t.type==="hidden")return ce.MASK;const r=t.getAttribute("autocomplete");if(r&&(r.startsWith("cc-")||r.endsWith("-password")))return ce.MASK}if(e.matches(Pr(ce.HIDDEN)))return ce.HIDDEN;if(e.matches(Pr(ce.MASK)))return ce.MASK;if(e.matches(Pr(ce.MASK_UNLESS_ALLOWLISTED)))return ce.MASK_UNLESS_ALLOWLISTED;if(e.matches(Pr(ce.MASK_USER_INPUT)))return ce.MASK_USER_INPUT;if(e.matches(Pr(ce.ALLOW)))return ce.ALLOW;if(gz(e))return ce.IGNORE}}function Rm(e,t){switch(t){case ce.MASK:case ce.HIDDEN:case ce.IGNORE:return!0;case ce.MASK_UNLESS_ALLOWLISTED:return qc(e)?ti(e.parentNode)?!0:!Fk(e.textContent||""):ti(e);case ce.MASK_USER_INPUT:return qc(e)?ti(e.parentNode):ti(e);default:return!1}}function Uk(e,t,r,a,n){if(a!==ce.MASK&&a!==ce.MASK_UNLESS_ALLOWLISTED||t===Am||jk.includes(t)||t===n.actionNameAttribute)return!1;switch(t){case"title":case"alt":case"placeholder":return!0}return!!(e==="A"&&t==="href"||e==="IFRAME"&&t==="srcdoc"||r&&t.startsWith("data-")||(e==="IMG"||e==="SOURCE")&&(t==="src"||t==="srcset"))}function ti(e){if(!e||e.nodeType!==e.ELEMENT_NODE)return!1;const t=e;if(t.tagName==="INPUT")switch(t.type){case"button":case"color":case"reset":case"submit":return!1}return!!mz[t.tagName]}const Lk=e=>e.replace(/\S/g,pz);function fz(e,t){var r;const a=(r=e.parentElement)===null||r===void 0?void 0:r.tagName;let n=e.textContent||"";if(a==="HEAD"&&!n.trim())return;const i=t;if(a==="SCRIPT")n=ui;else if(i===ce.HIDDEN)n=ui;else if(Rm(e,i))if(a==="DATALIST"||a==="SELECT"||a==="OPTGROUP"){if(!n.trim())return}else a==="OPTION"?n=ui:i===ce.MASK_UNLESS_ALLOWLISTED?n=Vk(n):n=Lk(n);return n}function gz(e){if(e.nodeName==="SCRIPT")return!0;if(e.nodeName==="LINK"){const r=t("rel");return/preload|prefetch/i.test(r)&&t("as")==="script"||r==="shortcut icon"||r==="icon"}if(e.nodeName==="META"){const r=t("name"),a=t("rel"),n=t("property");return/^msapplication-tile(image|color)$/.test(r)||r==="application-name"||a==="icon"||a==="apple-touch-icon"||a==="shortcut icon"||r==="keywords"||r==="description"||/^(og|twitter|fb):/.test(n)||/^(og|twitter):/.test(r)||r==="pinterest"||r==="robots"||r==="googlebot"||r==="bingbot"||e.hasAttribute("http-equiv")||r==="author"||r==="generator"||r==="framework"||r==="publisher"||r==="progid"||/^article:/.test(n)||/^product:/.test(n)||r==="google-site-verification"||r==="yandex-verification"||r==="csrf-token"||r==="p:domain_verify"||r==="verify-v1"||r==="verification"||r==="shopify-checkout-api-token"}function t(r){return(e.getAttribute(r)||"").toLowerCase()}return!1}function Fk(e){var t;return!e||!e.trim()?!0:((t=window.$DD_ALLOW)===null||t===void 0?void 0:t.has(e.toLocaleLowerCase()))||!1}function Vk(e,t){return Fk(e)?e:t||Lk(e)}const Zk=tt,hz=100;function vz(e,t){const r=[];let a=0,n;o(e);function o(l){l.stopObservable.subscribe(i),r.push(l),_t(n),n=Qe(s,Zk)}function i(){a===1&&r.every(l=>l.isStopped())&&(a=2,t(r))}function s(){_t(n),a===0&&(a=1,i())}return{tryAppend:l=>a!==0?!1:r.length>0&&!bz(r[r.length-1].event,l.event)?(s(),!1):(o(l),!0),stop:()=>{s()}}}function bz(e,t){return e.target===t.target&&yz(e,t)<=hz&&e.timeStamp-t.timeStamp<=Zk}function yz(e,t){return Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2))}function wz(e,t,r=ce.ALLOW){const a=new Map,{actionNameAttribute:n}=t,o=Lf(e,ll)||n&&Lf(e,n);return o?{name:o,nameSource:"custom_attribute"}:r===ce.MASK?{name:Rk,nameSource:"mask_placeholder"}:Ff(e,_z,t,a)||Ff(e,xz,t,a)||{name:"",nameSource:"blank"}}function Lf(e,t){const r=e.closest(`[${t}]`);if(!r)return;const a=r.getAttribute(t);return Bk(qk(a.trim()))}const _z=[(e,t,r)=>{if("labels"in e&&e.labels&&e.labels.length>0)return di(e.labels[0],t,r)},e=>{if(e.nodeName==="INPUT"){const t=e,r=t.getAttribute("type");if(r==="button"||r==="submit"||r==="reset")return{name:t.value,nameSource:"text_content"}}},(e,t,r)=>{if(e.nodeName==="BUTTON"||e.nodeName==="LABEL"||e.getAttribute("role")==="button")return di(e,t,r)},(e,t,r)=>da(e,"aria-label",t,r),(e,t,r)=>{const a=e.getAttribute("aria-labelledby");if(a)return{name:a.split(/\s+/).map(n=>Sz(e,n)).filter(n=>!!n).map(n=>Gk(n,t,r)).join(" "),nameSource:"text_content"}},(e,t,r)=>da(e,"alt",t,r),(e,t,r)=>da(e,"name",t,r),(e,t,r)=>da(e,"title",t,r),(e,t,r)=>da(e,"placeholder",t,r),(e,t,r)=>{if("options"in e&&e.options.length>0)return di(e.options[0],t,r)}],xz=[(e,t,r)=>di(e,t,r)],kz=10;function Ff(e,t,r,a){let n=e,o=0;for(;o<=kz&&n&&n.nodeName!=="BODY"&&n.nodeName!=="HTML"&&n.nodeName!=="HEAD";){for(const i of t){const s=i(n,r,a);if(s){const{name:l,nameSource:c}=s,u=l&&l.trim();if(u)return{name:Bk(qk(u)),nameSource:c}}}if(n.nodeName==="FORM")break;n=n.parentElement,o+=1}}function qk(e){return e.replace(/\s+/g," ")}function Bk(e){return e.length>100?`${hm(e,100)} [...]`:e}function Sz(e,t){return e.ownerDocument?e.ownerDocument.getElementById(t):null}function da(e,t,r,a){const{enablePrivacyForActionName:n,defaultPrivacyLevel:o}=r;let i=e.getAttribute(t);if(i&&n){const s=jo(e,o,a);Uk(e.tagName,t,i,s,r)&&(i=Vk(i,Rk))}else i||(i="");return{name:i,nameSource:"standard_attribute"}}function di(e,t,r){return{name:Gk(e,t,r)||"",nameSource:"text_content"}}function Gk(e,t,r){if(e.isContentEditable)return;const{enablePrivacyForActionName:a,actionNameAttribute:n,defaultPrivacyLevel:o}=t;if(Oo(Sr.USE_TREE_WALKER_FOR_ACTION_NAME))return Iz(e,n,a,o,r);if("innerText"in e){let i=e.innerText;const s=l=>{const c=e.querySelectorAll(l);for(let u=0;u<c.length;u+=1){const d=c[u];if("innerText"in d){const m=d.innerText;m&&m.trim().length>0&&(i=i.replace(m,""))}}};return s(`[${ll}]`),n&&s(`[${n}]`),a&&s(`${Pr(ce.HIDDEN)}, ${Pr(ce.MASK)}`),i}return e.textContent}function Iz(e,t,r,a,n){const o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,s);let i="";for(;o.nextNode();){const l=o.currentNode;if(ur(l)){(l.nodeName==="BR"||l.nodeName==="P"||["block","flex","grid","list-item","table","table-caption"].includes(getComputedStyle(l).display))&&(i+=" ");continue}i+=l.textContent||""}return i.replace(/\s+/g," ").trim();function s(l){const c=jo(l,a,n);if(r&&c&&Rm(l,c))return NodeFilter.FILTER_REJECT;if(ur(l)){if(l.hasAttribute(ll)||t&&l.hasAttribute(t))return NodeFilter.FILTER_REJECT;const u=getComputedStyle(l);if(u.visibility!=="visible"||u.display==="none"||u.contentVisibility&&u.contentVisibility!=="visible")return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT}}function Ez(e,{onPointerDown:t,onPointerUp:r}){let a,n={selection:!1,input:!1,scroll:!1},o;const i=[je(e,window,"pointerdown",s=>{Zf(s)&&(a=Vf(),n={selection:!1,input:!1,scroll:!1},o=t(s))},{capture:!0}),je(e,window,"selectionchange",()=>{(!a||!Vf())&&(n.selection=!0)},{capture:!0}),je(e,window,"scroll",()=>{n.scroll=!0},{capture:!0,passive:!0}),je(e,window,"pointerup",s=>{if(Zf(s)&&o){const l=n;r(o,s,()=>l),o=void 0}},{capture:!0}),je(e,window,"input",()=>{n.input=!0},{capture:!0})];return{stop:()=>{i.forEach(s=>s.stop())}}}function Vf(){const e=window.getSelection();return!e||e.isCollapsed}function Zf(e){return e.target instanceof Element&&e.isPrimary!==!1}const qf=3;function Tz(e,t){if($z(e))return t.addFrustration(ca.RAGE_CLICK),e.some(Bf)&&t.addFrustration(ca.DEAD_CLICK),t.hasError&&t.addFrustration(ca.ERROR_CLICK),{isRage:!0};const r=e.some(a=>a.getUserActivity().selection);return e.forEach(a=>{a.hasError&&a.addFrustration(ca.ERROR_CLICK),Bf(a)&&!r&&a.addFrustration(ca.DEAD_CLICK)}),{isRage:!1}}function $z(e){if(e.some(t=>t.getUserActivity().selection||t.getUserActivity().scroll))return!1;for(let t=0;t<e.length-(qf-1);t+=1)if(e[t+qf-1].event.timeStamp-e[t].event.timeStamp<=tt)return!0;return!1}const Oz='input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]),textarea,select,[contenteditable],[contenteditable] *,canvas,a[href],a[href] *';function Bf(e){if(e.hasPageActivity||e.getUserActivity().input||e.getUserActivity().scroll)return!1;let t=e.event.target;return t.tagName==="LABEL"&&t.hasAttribute("for")&&(t=document.getElementById(t.getAttribute("for"))),!t||!t.matches(Oz)}const Hk=10*tt,xa=new Map;function Cz(e){const t=xa.get(e);return xa.delete(e),t}function Jk(e,t){xa.set(e,t),xa.forEach((r,a)=>{De(a,xt())>Hk&&xa.delete(a)})}const Nz=5*gt;function Az(e,t,r,a){const n=Qn({expireDelay:Nz}),o=new ge;let i;e.subscribe(10,()=>{n.reset()}),e.subscribe(5,u),e.subscribe(11,d=>{d.reason===xn.UNLOADING&&u()});const{stop:s}=Ez(a,{onPointerDown:d=>Rz(a,e,t,d,r),onPointerUp:({clickActionBase:d,hadActivityOnPointerDown:m},f,g)=>{jz(a,e,t,r,n,o,c,d,f,g,m)}});return{stop:()=>{u(),o.notify(),s()},actionContexts:{findActionId:d=>n.findAll(d)}};function c(d){if(!i||!i.tryAppend(d)){const m=d.clone();i=vz(d,f=>{zz(f,m)})}}function u(){i&&i.stop()}}function Rz(e,t,r,a,n){let o;if(e.enablePrivacyForActionName?o=jo(a.target,e.defaultPrivacyLevel):o=ce.ALLOW,o===ce.HIDDEN)return;const i=Pz(a,o,e);let s=!1;return Nm(t,r,n,e,l=>{s=l.hadActivity},Ak),{clickActionBase:i,hadActivityOnPointerDown:()=>s}}function jz(e,t,r,a,n,o,i,s,l,c,u){var d;const m=Wk(t,n,c,s,l);i(m);const f=(d=s?.target)===null||d===void 0?void 0:d.selector;f&&Jk(l.timeStamp,f);const{stop:g}=Nm(t,r,a,e,w=>{w.hadActivity&&w.end<m.startClocks.timeStamp?m.discard():w.hadActivity?m.stop(w.end):u()?m.stop(m.startClocks.timeStamp):m.stop()},Hk),h=t.subscribe(5,({endClocks:w})=>{m.stop(w.timeStamp)}),b=o.subscribe(()=>{m.stop()});m.stopObservable.subscribe(()=>{h.unsubscribe(),g(),b.unsubscribe()})}function Pz(e,t,r){const a=e.target.getBoundingClientRect(),n=Ro(e.target,r.actionNameAttribute);n&&Jk(e.timeStamp,n);const{name:o,nameSource:i}=wz(e.target,r,t);return{type:sl.CLICK,target:{width:Math.round(a.width),height:Math.round(a.height),selector:n},position:{x:Math.round(e.clientX-a.left),y:Math.round(e.clientY-a.top)},name:o,nameSource:i}}function Wk(e,t,r,a,n){const o=ot(),i=qe(),s=t.add(o,i.relative),l=Ok({lifeCycle:e,isChildEvent:g=>g.action!==void 0&&(Array.isArray(g.action.id)?g.action.id.includes(o):g.action.id===o)});let c=0,u;const d=[],m=new ge;function f(g){c===0&&(u=g,c=1,u?s.close(gm(u)):s.remove(),l.stop(),m.notify())}return{event:n,stop:f,stopObservable:m,get hasError(){return l.eventCounts.errorCount>0},get hasPageActivity(){return u!==void 0},getUserActivity:r,addFrustration:g=>{d.push(g)},startClocks:i,isStopped:()=>c===1||c===2,clone:()=>Wk(e,t,r,a,n),validate:g=>{if(f(),c!==1)return;const{resourceCount:h,errorCount:b,longTaskCount:w}=l.eventCounts,x={duration:u&&De(i.timeStamp,u),startClocks:i,id:o,frustrationTypes:d,counts:{resourceCount:h,errorCount:b,longTaskCount:w},events:g??[n],event:n,...a};e.notify(0,x),c=2},discard:()=>{f(),c=2}}}function zz(e,t){const{isRage:r}=Tz(e,t);r?(e.forEach(a=>a.discard()),t.stop(Je()),t.validate(e.map(a=>a.event))):(t.discard(),e.forEach(a=>a.validate()))}function Dz(e,t,r,a,n){const{unsubscribe:o}=e.subscribe(0,l=>{e.notify(12,Gf(l))});t.register(0,({startTime:l,eventType:c})=>{if(c!==ne.ERROR&&c!==ne.RESOURCE&&c!==ne.LONG_TASK)return kt;const u=i.findActionId(l);return u?{type:c,action:{id:u}}:kt}),t.register(1,({startTime:l})=>({action:{id:i.findActionId(l)}}));let i={findActionId:ve},s=ve;return n.trackUserInteractions&&({actionContexts:i,stop:s}=Az(e,r,a,n)),{addAction:l=>{e.notify(12,Gf(l))},actionContexts:i,stop:()=>{o(),s()}}}function Gf(e){const t=Wl(e)?{action:{id:e.id,loading_time:$k(ie(e.duration)),frustration:{type:e.frustrationTypes},error:{count:e.counts.errorCount},long_task:{count:e.counts.longTaskCount},resource:{count:e.counts.resourceCount}},_dd:{action:{target:e.target,position:e.position,name_source:e.nameSource}}}:{context:e.context},r=cr({action:{id:ot(),target:{name:e.name},type:e.type},date:e.startClocks.timeStamp,type:ne.ACTION},t),a=Wl(e)?e.duration:void 0,n=Wl(e)?{events:e.events}:{handlingStack:e.handlingStack};return{rawRumEvent:r,duration:a,startTime:e.startClocks.relative,domainContext:n}}function Wl(e){return e.type!==sl.CUSTOM}function Mz(e){const t=g2([Ks.error]).subscribe(r=>e.notify(r.error));return{stop:()=>{t.unsubscribe()}}}function Uz(e,t){const r=Qj(e,[Da.cspViolation,Da.intervention]).subscribe(a=>t.notify(a));return{stop:()=>{r.unsubscribe()}}}function Lz(e,t,r){const a=new ge;return r.subscribe(n=>{n.type===0&&a.notify(n.error)}),Mz(a),Uz(t,a),a.subscribe(n=>e.notify(14,{error:n})),Fz(e)}function Fz(e){return e.subscribe(14,({error:t})=>{e.notify(12,Vz(t))}),{addError:({error:t,handlingStack:r,componentStack:a,startClocks:n,context:o})=>{const i=wm({originalError:t,handlingStack:r,componentStack:a,startClocks:n,nonErrorPrefix:"Provided",source:Wn.CUSTOM,handling:"handled"});i.context=cr(i.context,o),e.notify(14,{error:i})}}}function Vz(e){const t={date:e.startClocks.timeStamp,error:{id:ot(),message:e.message,source:e.source,stack:e.stack,handling_stack:e.handlingStack,component_stack:e.componentStack,type:e.type,handling:e.handling,causes:e.causes,source_type:"browser",fingerprint:e.fingerprint,csp:e.csp},type:ne.ERROR,context:e.context},r={error:e.originalError,handlingStack:e.handlingStack};return{rawRumEvent:t,startTime:e.startClocks.relative,domainContext:r}}const Hf=new WeakSet;function Zz(e){if(!performance||!("getEntriesByName"in performance))return;const t=performance.getEntriesByName(e.url,"resource");if(!t.length||!("toJSON"in t[0]))return;const r=t.filter(a=>!Hf.has(a)).filter(a=>kk(a)&&Sk(a)).filter(a=>qz(a,e.startClocks.relative,Kk({startTime:e.startClocks.relative,duration:e.duration})));if(r.length===1)return Hf.add(r[0]),r[0].toJSON()}function Kk(e){return Hn(e.startTime,e.duration)}function qz(e,t,r){return e.startTime>=t-1&&Kk(e)<=Hn(r,1)}const Bz=2*gt;function Gz(e){const t=Hz(e)||Jz(e);if(!(!t||t.traceTime<=ft()-Bz))return t.traceId}function Hz(e){const t=e.querySelector("meta[name=dd-trace-id]"),r=e.querySelector("meta[name=dd-trace-time]");return Yk(t&&t.content,r&&r.content)}function Jz(e){const t=Wz(e);if(t)return Yk(Pa(t,"trace-id"),Pa(t,"trace-time"))}function Yk(e,t){const r=t&&Number(t);if(!(!e||!r))return{traceId:e,traceTime:r}}function Wz(e){for(let t=0;t<e.childNodes.length;t+=1){const r=Jf(e.childNodes[t]);if(r)return r}if(e.body)for(let t=e.body.childNodes.length-1;t>=0;t-=1){const r=e.body.childNodes[t],a=Jf(r);if(a)return a;if(!qc(r))break}}function Jf(e){if(e&&J4(e)){const t=/^\s*DATADOG;(.*?)\s*$/.exec(e.data);if(t)return t[1]}}function Xk(){if(Or(exports.RumPerformanceEntryType.NAVIGATION)){const r=performance.getEntriesByType(exports.RumPerformanceEntryType.NAVIGATION)[0];if(r)return r}const e=Kz(),t={entryType:exports.RumPerformanceEntryType.NAVIGATION,initiatorType:"navigation",name:window.location.href,startTime:0,duration:e.loadEventEnd,decodedBodySize:0,encodedBodySize:0,transferSize:0,workerStart:0,toJSON:()=>({...t,toJSON:void 0}),...e};return t}function Kz(){const e={},t=performance.timing;for(const r in t)if(So(t[r])){const a=r,n=t[a];e[a]=n===0?0:gm(n)}return e}function Yz(e,t,r=Xk){Em(e,"interactive",()=>{const a=r(),n=Object.assign(a.toJSON(),{entryType:exports.RumPerformanceEntryType.RESOURCE,initiatorType:_k,duration:a.responseEnd,traceId:Gz(document),toJSON:()=>({...n,toJSON:void 0})});t(n)})}const Xz=1e3;function Qz(e){const t=new Set,r=e.subscribe(8,a=>{t.add(a),t.size>Xz&&(Xn("Too many requests"),t.delete(t.values().next().value))});return{getMatchingRequest(a){let n=1/0,o;for(const i of t){const s=a.startTime-i.startClocks.relative;0<=s&&s<n&&i.url===a.name&&(n=Math.abs(s),o=i)}return o&&t.delete(o),o},stop(){r.unsubscribe()}}}function eD(e,t,r,a=f2(),n=Yz){let o;const i=t.trackEarlyRequests;i?o=Qz(e):e.subscribe(8,c=>{l(()=>tD(c,t,r))});const s=Qt(t,{type:exports.RumPerformanceEntryType.RESOURCE,buffered:!0}).subscribe(c=>{for(const u of c)(i||!xk(u))&&l(()=>Wf(u,t,r,o))});n(t,c=>{l(()=>Wf(c,t,r,o))});function l(c){a.push(()=>{const u=c();u&&e.notify(12,u)})}return{stop:()=>{a.stop(),s.unsubscribe()}}}function tD(e,t,r){const a=Zz(e);return Qk(a,e,r,t)}function Wf(e,t,r,a){const n=xk(e)&&a?a.getMatchingRequest(e):void 0;return Qk(e,n,r,t)}function Qk(e,t,r,a){if(!e&&!t)return;const n=t?oD(t,a):iD(e,a);if(!a.trackResources&&!n)return;const o=e?Io(e.startTime):t.startClocks,i=e?T4(e):sD(r,o,t.duration),s=t&&rD(t,a),l=cr({date:o.timeStamp,resource:{id:ot(),duration:ie(i),type:t?t.type===il.XHR?dt.XHR:dt.FETCH:E4(e),method:t?t.method:void 0,status_code:t?t.status:lD(e.responseStatus),url:t?Ik(t.url):e.name,protocol:e&&C4(e),delivery_type:e&&N4(e),graphql:s},type:ne.RESOURCE,_dd:{discarded:!a.trackResources}},n,e&&aD(e));return{startTime:o.relative,duration:i,rawRumEvent:l,domainContext:nD(e,t)}}function rD(e,t){const r=Ek(e.url,t);if(r)return z4(e,r)}function nD(e,t){if(t){const r={performanceEntry:e,isAborted:t.isAborted,handlingStack:t.handlingStack};return t.type===il.XHR?{xhr:t.xhr,...r}:{requestInput:t.input,requestInit:t.init,response:t.response,error:t.error,...r}}return{performanceEntry:e}}function aD(e){const{renderBlockingStatus:t}=e;return{resource:{render_blocking_status:t,...A4(e),...$4(e)}}}function oD(e,t){if(e.traceSampled&&e.traceId&&e.spanId)return{_dd:{span_id:e.spanId.toString(),trace_id:e.traceId.toString(),rule_psr:t.rulePsr}}}function iD(e,t){if(e.traceId)return{_dd:{trace_id:e.traceId,span_id:hk().toString(),rule_psr:t.rulePsr}}}function sD(e,t,r){return e.wasInPageStateDuringPeriod("frozen",t.relative,r)?void 0:r}function lD(e){return e===0?void 0:e}function cD(e,t,r){const{stop:a,eventCounts:n}=Ok({lifeCycle:e,isChildEvent:o=>o.view.id===t,onChange:r});return{stop:a,eventCounts:n}}const uD=10*gt;function dD(e,t,r){return{stop:Qt(e,{type:exports.RumPerformanceEntryType.PAINT,buffered:!0}).subscribe(n=>{const o=n.find(i=>i.name==="first-contentful-paint"&&i.startTime<t.timeStamp&&i.startTime<uD);o&&r(o.startTime)}).unsubscribe}}function mD(e,t){requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(De(e,xt()))})})}function pD(e,t,r){const a=Qt(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(n=>{const o=n.find(i=>i.startTime<t.timeStamp);if(o){const i=De(o.startTime,o.processingStart);let s;o.target&&ur(o.target)&&(s=Ro(o.target,e.actionNameAttribute)),r({delay:i>=0?i:0,time:o.startTime,targetSelector:s})}});return{stop:()=>{a.unsubscribe()}}}function fD(e,t,r=Xk){return vD(e,()=>{const a=r();hD(a)||t(gD(a))})}function gD(e){return{domComplete:e.domComplete,domContentLoaded:e.domContentLoadedEventEnd,domInteractive:e.domInteractive,loadEvent:e.loadEventEnd,firstByte:e.responseStart>=0&&e.responseStart<=xt()?e.responseStart:void 0}}function hD(e){return e.loadEventEnd<=0}function vD(e,t){let r;const{stop:a}=Em(e,"complete",()=>{r=Qe(()=>t())});return{stop:()=>{a(),_t(r)}}}const bD=10*gt;function yD(e,t,r,a){let n=1/0;const{stop:o}=lr(e,r,["pointerdown","keydown"],l=>{n=l.timeStamp},{capture:!0,once:!0});let i=0;const s=Qt(e,{type:exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,buffered:!0}).subscribe(l=>{const c=hx(l,u=>u.entryType===exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT&&u.startTime<n&&u.startTime<t.timeStamp&&u.startTime<bD&&u.size>i);if(c){let u;c.element&&(u=Ro(c.element,e.actionNameAttribute)),a({value:c.startTime,targetSelector:u,resourceUrl:wD(c)}),i=c.size}});return{stop:()=>{o(),s.unsubscribe()}}}function wD(e){return e.url===""?void 0:e.url}function eS(e,t,r=window){if(document.visibilityState==="hidden")return{timeStamp:0,stop:ve};if(Or(exports.RumPerformanceEntryType.VISIBILITY_STATE)){const o=performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).filter(i=>i.name==="hidden").find(i=>i.startTime>=t.relative);if(o)return{timeStamp:o.startTime,stop:ve}}let a=1/0;const{stop:n}=lr(e,r,["pagehide","visibilitychange"],o=>{(o.type==="pagehide"||document.visibilityState==="hidden")&&(a=o.timeStamp,n())},{capture:!0});return{get timeStamp(){return a},stop:n}}function _D(e,t,r,a){const n={},{stop:o}=fD(e,d=>{r(d.loadEvent),n.navigationTimings=d,a()}),i=eS(e,t),{stop:s}=dD(e,i,d=>{n.firstContentfulPaint=d,a()}),{stop:l}=yD(e,i,window,d=>{n.largestContentfulPaint=d,a()}),{stop:c}=pD(e,i,d=>{n.firstInput=d,a()});function u(){o(),s(),l(),c(),i.stop()}return{stop:u,initialViewMetrics:n}}const Bc=(e,t)=>e*t,xD=(e,t)=>{const r=Math.max(e.left,t.left),a=Math.max(e.top,t.top),n=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return r>=n||a>=o?0:Bc(n-r,o-a)},Kf=e=>{const t=Bc(e.previousRect.width,e.previousRect.height),r=Bc(e.currentRect.width,e.currentRect.height),a=xD(e.previousRect,e.currentRect);return t+r-a};function kD(e,t,r){if(!$D())return{stop:ve};let a=0,n;r({value:0});const o=TD(),i=Qt(e,{type:exports.RumPerformanceEntryType.LAYOUT_SHIFT,buffered:!0}).subscribe(s=>{var l;for(const c of s){if(c.hadRecentInput||c.startTime<t)continue;const{cumulatedValue:u,isMaxValue:d}=o.update(c);if(d){const m=SD(c.sources);n={target:m?.node?new WeakRef(m.node):void 0,time:De(t,c.startTime),previousRect:m?.previousRect,currentRect:m?.currentRect,devicePixelRatio:window.devicePixelRatio}}if(u>a){a=u;const m=(l=n?.target)===null||l===void 0?void 0:l.deref();r({value:wa(a,4),targetSelector:m&&Ro(m,e.actionNameAttribute),time:n?.time,previousRect:n?.previousRect?Yf(n.previousRect):void 0,currentRect:n?.currentRect?Yf(n.currentRect):void 0,devicePixelRatio:n?.devicePixelRatio})}}});return{stop:()=>{i.unsubscribe()}}}function SD(e){let t;for(const r of e)if(r.node&&ur(r.node)){const a=Kf(r);(!t||Kf(t)<a)&&(t=r)}return t}function Yf({x:e,y:t,width:r,height:a}){return{x:e,y:t,width:r,height:a}}const ID=5*tt,ED=tt;function TD(){let e=0,t,r,a=0;return{update:n=>{const o=t===void 0||n.startTime-r>=ED||n.startTime-t>=ID;let i;return o?(t=r=n.startTime,a=e=n.value,i=!0):(e+=n.value,r=n.startTime,i=n.value>a,i&&(a=n.value)),{cumulatedValue:e,isMaxValue:i}}}}function $D(){return Or(exports.RumPerformanceEntryType.LAYOUT_SHIFT)&&"WeakRef"in window}let mi,tS=0,Kl=1/0,Yl=0;function OD(){"interactionCount"in performance||mi||(mi=new window.PerformanceObserver(oe(e=>{e.getEntries().forEach(t=>{const r=t;r.interactionId&&(Kl=Math.min(Kl,r.interactionId),Yl=Math.max(Yl,r.interactionId),tS=(Yl-Kl)/7+1)})})),mi.observe({type:"event",buffered:!0,durationThreshold:0}))}const Xf=()=>mi?tS:window.performance.interactionCount||0,Qf=10,CD=1*gt;function ND(e,t,r){if(!jD())return{getInteractionToNextPaint:()=>{},setViewEnd:ve,stop:ve};const{getViewInteractionCount:a,stopViewInteractionCount:n}=RD(r);let o=1/0;const i=AD(a);let s=-1,l,c;function u(f){for(const h of f)h.interactionId&&h.startTime>=t&&h.startTime<=o&&i.process(h);const g=i.estimateP98Interaction();g&&g.duration!==s&&(s=g.duration,c=De(t,g.startTime),l=Cz(g.startTime),!l&&g.target&&ur(g.target)&&(l=Ro(g.target,e.actionNameAttribute)))}const d=Qt(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(u),m=Qt(e,{type:exports.RumPerformanceEntryType.EVENT,durationThreshold:40,buffered:!0}).subscribe(u);return{getInteractionToNextPaint:()=>{if(s>=0)return{value:Math.min(s,CD),targetSelector:l,time:c};if(a())return{value:0}},setViewEnd:f=>{o=f,n()},stop:()=>{m.unsubscribe(),d.unsubscribe()}}}function AD(e){const t=[];function r(){t.sort((a,n)=>n.duration-a.duration).splice(Qf)}return{process(a){const n=t.findIndex(i=>a.interactionId===i.interactionId),o=t[t.length-1];n!==-1?a.duration>t[n].duration&&(t[n]=a,r()):(t.length<Qf||a.duration>o.duration)&&(t.push(a),r())},estimateP98Interaction(){const a=Math.min(t.length-1,Math.floor(e()/50));return t[a]}}}function RD(e){OD();const t=e===nr.INITIAL_LOAD?0:Xf();let r={stopped:!1};function a(){return Xf()-t}return{getViewInteractionCount:()=>r.stopped?r.interactionCount:a(),stopViewInteractionCount:()=>{r={stopped:!0,interactionCount:a()}}}}function jD(){return Or(exports.RumPerformanceEntryType.EVENT)&&window.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype}function PD(e,t,r,a,n,o,i){let s=n===nr.INITIAL_LOAD,l=!0;const c=[],u=eS(a,o);function d(){if(!l&&!s&&c.length>0){const f=Math.max(...c);f<u.timeStamp-o.relative&&i(f)}}const{stop:m}=Nm(e,t,r,a,f=>{l&&(l=!1,f.hadActivity&&c.push(De(o.timeStamp,f.end)),d())});return{stop:()=>{m(),u.stop()},setLoadEvent:f=>{s&&(s=!1,c.push(f),d())}}}function zD(){let e;const t=window.visualViewport;return t?e=t.pageLeft-t.offsetLeft:window.scrollX!==void 0?e=window.scrollX:e=window.pageXOffset||0,Math.round(e)}function rS(){let e;const t=window.visualViewport;return t?e=t.pageTop-t.offsetTop:window.scrollY!==void 0?e=window.scrollY:e=window.pageYOffset||0,Math.round(e)}let Xl;function nS(e){return Xl||(Xl=DD(e)),Xl}function DD(e){return new ge(t=>{const{throttled:r}=To(()=>{t.notify(ul())},200);return je(e,window,"resize",r,{capture:!0,passive:!0}).stop})}function ul(){const e=window.visualViewport;return e?{width:Number(e.width*e.scale),height:Number(e.height*e.scale)}:{width:Number(window.innerWidth||0),height:Number(window.innerHeight||0)}}const MD=tt;function UD(e,t,r,a=FD(e)){let n=0,o=0,i=0;const s=a.subscribe(({scrollDepth:l,scrollTop:c,scrollHeight:u})=>{let d=!1;if(l>n&&(n=l,d=!0),u>o){o=u;const m=xt();i=De(t.relative,m),d=!0}d&&r({maxDepth:Math.min(n,o),maxDepthScrollTop:c,maxScrollHeight:o,maxScrollHeightTime:i})});return{stop:()=>s.unsubscribe()}}function LD(){const e=rS(),{height:t}=ul(),r=Math.round((document.scrollingElement||document.documentElement).scrollHeight),a=Math.round(t+e);return{scrollHeight:r,scrollDepth:a,scrollTop:e}}function FD(e,t=MD){return new ge(r=>{function a(){r.notify(LD())}if(window.ResizeObserver){const n=To(a,t,{leading:!1,trailing:!0}),o=document.scrollingElement||document.documentElement,i=new ResizeObserver(oe(n.throttled));o&&i.observe(o);const s=je(e,window,"scroll",n.throttled,{passive:!0});return()=>{n.cancel(),i.disconnect(),s.stop()}}})}function VD(e,t,r,a,n,o,i){const s={},{stop:l,setLoadEvent:c}=PD(e,t,r,a,o,i,h=>{s.loadingTime=h,n()}),{stop:u}=UD(a,i,h=>{s.scroll=h}),{stop:d}=kD(a,i.relative,h=>{s.cumulativeLayoutShift=h,n()}),{stop:m,getInteractionToNextPaint:f,setViewEnd:g}=ND(a,i.relative,o);return{stop:()=>{l(),d(),u()},stopINPTracking:m,setLoadEvent:c,setViewEnd:g,getCommonViewMetrics:()=>(s.interactionToNextPaint=f(),s)}}function ZD(e,t){const{stop:r}=je(e,window,"pageshow",a=>{a.persisted&&t(a)},{capture:!0});return r}function qD(e,t,r){mD(e.relative,a=>{t.firstContentfulPaint=a,t.largestContentfulPaint={value:a},r()})}const BD=3e3,GD=5*gt,HD=5*gt;function JD(e,t,r,a,n,o,i,s){const l=new Set;let c=m(nr.INITIAL_LOAD,fm(),s),u;f();let d;i&&(d=g(o),n.trackBfcacheViews&&(u=ZD(n,h=>{c.end();const b=Io(h.timeStamp);c=m(nr.BF_CACHE,b,void 0)})));function m(h,b,w){const x=WD(t,r,a,n,e,h,b,w);return l.add(x),x.stopObservable.subscribe(()=>{l.delete(x)}),x}function f(){t.subscribe(10,()=>{c=m(nr.ROUTE_CHANGE,void 0,{name:c.name,service:c.service,version:c.version,context:c.contextManager.getContext()})}),t.subscribe(9,()=>{c.end({sessionIsActive:!1})})}function g(h){return h.subscribe(({oldLocation:b,newLocation:w})=>{YD(b,w)&&(c.end(),c=m(nr.ROUTE_CHANGE))})}return{addTiming:(h,b=Je())=>{c.addTiming(h,b)},startView:(h,b)=>{c.end({endClocks:b}),c=m(nr.ROUTE_CHANGE,b,h)},setViewContext:h=>{c.contextManager.setContext(h)},setViewContextProperty:(h,b)=>{c.contextManager.setContextProperty(h,b)},setViewName:h=>{c.setViewName(h)},getViewContext:()=>c.contextManager.getContext(),stop:()=>{d&&d.unsubscribe(),u&&u(),c.end(),l.forEach(h=>h.stop())}}}function WD(e,t,r,a,n,o,i=qe(),s){const l=ot(),c=new ge,u={};let d=0,m;const f=ja(n),g=ol();let h=!0,b=s?.name;const w=s?.service||a.service,x=s?.version||a.version,k=s?.context;k&&g.setContext(k);const y={id:l,name:b,startClocks:i,service:w,version:x,context:k};e.notify(1,y),e.notify(2,y);const{throttled:$,cancel:I}=To(M,BD,{leading:!1}),{setLoadEvent:E,setViewEnd:A,stop:F,stopINPTracking:q,getCommonViewMetrics:ee}=VD(e,t,r,a,ke,o,i),{stop:Ne,initialViewMetrics:te}=o===nr.INITIAL_LOAD?_D(a,i,E,ke):{stop:ve,initialViewMetrics:{}};o===nr.BF_CACHE&&qD(i,te,ke);const{stop:J,eventCounts:Ae}=cD(e,l,ke),fe=Gn(M,GD),Ue=e.subscribe(11,he=>{he.reason===xn.UNLOADING&&M()});M(),g.changeObservable.subscribe(ke);function $e(){e.notify(3,{id:l,name:b,context:g.getContext(),startClocks:i,sessionIsActive:h})}function ke(){$e(),$()}function M(){I(),$e(),d+=1;const he=m===void 0?Je():m.timeStamp;e.notify(4,{customTimings:u,documentVersion:d,id:l,name:b,service:w,version:x,context:g.getContext(),loadingType:o,location:f,startClocks:i,commonViewMetrics:ee(),initialViewMetrics:te,duration:De(i.timeStamp,he),isActive:m===void 0,sessionIsActive:h,eventCounts:Ae})}return{get name(){return b},service:w,version:x,contextManager:g,stopObservable:c,end(he={}){var le,_e;m||(m=(le=he.endClocks)!==null&&le!==void 0?le:qe(),h=(_e=he.sessionIsActive)!==null&&_e!==void 0?_e:!0,e.notify(5,{endClocks:m}),e.notify(6,{endClocks:m}),Qs(fe),A(m.relative),F(),Ue.unsubscribe(),M(),Qe(()=>{this.stop()},HD))},stop(){Ne(),J(),q(),c.notify()},addTiming(he,le){if(m)return;const _e=gR(le)?le:De(i.timeStamp,le);u[KD(he)]=_e,ke()},setViewName(he){b=he,M()}}}function KD(e){const t=e.replace(/[^a-zA-Z0-9-_.@$]/g,"_");return t!==e&&Q.warn(`Invalid timing name: ${e}, sanitized to: ${t}`),t}function YD(e,t){return e.pathname!==t.pathname||!XD(t.hash)&&eg(t.hash)!==eg(e.hash)}function XD(e){const t=e.substring(1);return t!==""&&!!document.getElementById(t)}function eg(e){const t=e.indexOf("?");return t<0?e:e.slice(0,t)}function QD(e,t,r,a,n,o,i,s,l,c){return e.subscribe(4,u=>e.notify(12,eM(u,r,s))),t.register(0,({startTime:u,eventType:d})=>{const m=l.findView(u);return m?{type:d,service:m.service,version:m.version,context:m.context,view:{id:m.id,name:m.name}}:Ir}),t.register(1,({startTime:u})=>{var d;return{view:{id:(d=l.findView(u))===null||d===void 0?void 0:d.id}}}),JD(a,e,n,o,r,i,!r.trackViewsManually,c)}function eM(e,t,r){var a,n,o,i,s,l,c,u,d,m,f,g,h,b,w,x,k,y;const $=r.getReplayStats(e.id),I=(n=(a=e.commonViewMetrics)===null||a===void 0?void 0:a.cumulativeLayoutShift)===null||n===void 0?void 0:n.devicePixelRatio,E={_dd:{document_version:e.documentVersion,replay_stats:$,cls:I?{device_pixel_ratio:I}:void 0,configuration:{start_session_replay_recording_manually:t.startSessionReplayRecordingManually}},date:e.startClocks.timeStamp,type:ne.VIEW,view:{action:{count:e.eventCounts.actionCount},frustration:{count:e.eventCounts.frustrationCount},cumulative_layout_shift:(o=e.commonViewMetrics.cumulativeLayoutShift)===null||o===void 0?void 0:o.value,cumulative_layout_shift_time:ie((i=e.commonViewMetrics.cumulativeLayoutShift)===null||i===void 0?void 0:i.time),cumulative_layout_shift_target_selector:(s=e.commonViewMetrics.cumulativeLayoutShift)===null||s===void 0?void 0:s.targetSelector,first_byte:ie((l=e.initialViewMetrics.navigationTimings)===null||l===void 0?void 0:l.firstByte),dom_complete:ie((c=e.initialViewMetrics.navigationTimings)===null||c===void 0?void 0:c.domComplete),dom_content_loaded:ie((u=e.initialViewMetrics.navigationTimings)===null||u===void 0?void 0:u.domContentLoaded),dom_interactive:ie((d=e.initialViewMetrics.navigationTimings)===null||d===void 0?void 0:d.domInteractive),error:{count:e.eventCounts.errorCount},first_contentful_paint:ie(e.initialViewMetrics.firstContentfulPaint),first_input_delay:ie((m=e.initialViewMetrics.firstInput)===null||m===void 0?void 0:m.delay),first_input_time:ie((f=e.initialViewMetrics.firstInput)===null||f===void 0?void 0:f.time),first_input_target_selector:(g=e.initialViewMetrics.firstInput)===null||g===void 0?void 0:g.targetSelector,interaction_to_next_paint:ie((h=e.commonViewMetrics.interactionToNextPaint)===null||h===void 0?void 0:h.value),interaction_to_next_paint_time:ie((b=e.commonViewMetrics.interactionToNextPaint)===null||b===void 0?void 0:b.time),interaction_to_next_paint_target_selector:(w=e.commonViewMetrics.interactionToNextPaint)===null||w===void 0?void 0:w.targetSelector,is_active:e.isActive,name:e.name,largest_contentful_paint:ie((x=e.initialViewMetrics.largestContentfulPaint)===null||x===void 0?void 0:x.value),largest_contentful_paint_target_selector:(k=e.initialViewMetrics.largestContentfulPaint)===null||k===void 0?void 0:k.targetSelector,load_event:ie((y=e.initialViewMetrics.navigationTimings)===null||y===void 0?void 0:y.loadEvent),loading_time:$k(ie(e.commonViewMetrics.loadingTime)),loading_type:e.loadingType,long_task:{count:e.eventCounts.longTaskCount},performance:tM(e.commonViewMetrics,e.initialViewMetrics),resource:{count:e.eventCounts.resourceCount},time_spent:ie(e.duration)},display:e.commonViewMetrics.scroll?{scroll:{max_depth:e.commonViewMetrics.scroll.maxDepth,max_depth_scroll_top:e.commonViewMetrics.scroll.maxDepthScrollTop,max_scroll_height:e.commonViewMetrics.scroll.maxScrollHeight,max_scroll_height_time:ie(e.commonViewMetrics.scroll.maxScrollHeightTime)}}:void 0,privacy:{replay_level:t.defaultPrivacyLevel},device:{locale:navigator.language,locales:navigator.languages,time_zone:C2()}};return $r(e.customTimings)||(E.view.custom_timings=ix(e.customTimings,ie)),{rawRumEvent:E,startTime:e.startClocks.relative,duration:e.duration,domainContext:{location:e.location}}}function tM({cumulativeLayoutShift:e,interactionToNextPaint:t},{firstContentfulPaint:r,firstInput:a,largestContentfulPaint:n}){return{cls:e&&{score:e.value,timestamp:ie(e.time),target_selector:e.targetSelector,previous_rect:e.previousRect,current_rect:e.currentRect},fcp:r&&{timestamp:ie(r)},fid:a&&{duration:ie(a.delay),timestamp:ie(a.time),target_selector:a.targetSelector},inp:t&&{duration:ie(t.value),timestamp:ie(t.time),target_selector:t.targetSelector},lcp:n&&{timestamp:ie(n.value),target_selector:n.targetSelector,resource_url:n.resourceUrl}}}const rM="rum";function nM(e,t,r){const a=BP(e,rM,n=>oM(e,n),r);return a.expireObservable.subscribe(()=>{t.notify(9)}),a.renewObservable.subscribe(()=>{t.notify(10)}),a.sessionStateUpdateObservable.subscribe(({previousState:n,newState:o})=>{if(!n.forcedReplay&&o.forcedReplay){const i=a.findSession();i&&(i.isReplayForced=!0)}}),{findTrackedSession:n=>{const o=a.findSession(n);if(!(!o||o.trackingType==="0"))return{id:o.id,sessionReplay:o.trackingType==="1"?1:o.isReplayForced?2:0,anonymousId:o.anonymousId}},expire:a.expire,expireObservable:a.expireObservable,setForcedReplay:()=>a.updateSessionState({forcedReplay:"1"})}}function aM(){const e={id:"00000000-aaaa-0000-aaaa-000000000000",sessionReplay:Wx("records")?1:0};return{findTrackedSession:()=>e,expire:ve,expireObservable:new ge,setForcedReplay:ve}}function oM(e,t){return iM(t)?t:Mr(e.sessionSampleRate)?Mr(e.sessionReplaySampleRate)?"1":"2":"0"}function iM(e){return e==="0"||e==="1"||e==="2"}function sM(e,t,r,a,n,o){const i=[e.rumEndpointBuilder];e.replica&&i.push(e.replica.rumEndpointBuilder);const s=Yx({encoder:o(2),request:Sm(i,r),flushController:Xx({pageMayExitObservable:a,sessionExpireObservable:n})});return t.subscribe(13,l=>{l.type===ne.VIEW?s.upsert(l,l.view.id):s.add(l)}),s}function lM(e){const t=Kn();e.subscribe(13,r=>{t.send("rum",r)})}const cM=tn;function uM(e,t,r,a){const n=Qn({expireDelay:cM});let o;e.subscribe(1,({startClocks:l})=>{const c=a.href;n.add(s({url:c,referrer:o||document.referrer}),l.relative),o=c}),e.subscribe(6,({endClocks:l})=>{n.closeActive(l.relative)});const i=r.subscribe(({newLocation:l})=>{const c=n.find();if(c){const u=xt();n.closeActive(u),n.add(s({url:l.href,referrer:c.referrer}),u)}});function s({url:l,referrer:c}){return{url:l,referrer:c}}return t.register(0,({startTime:l,eventType:c})=>{const u=n.find(l);return u?{type:c,view:{url:u.url,referrer:u.referrer}}:Ir}),{findUrl:l=>n.find(l),stop:()=>{i.unsubscribe(),n.stop()}}}function dM(e,t){let r=ja(t);return new ge(a=>{const{stop:n}=mM(e,i),{stop:o}=pM(e,i);function i(){if(r.href===t.href)return;const s=ja(t);a.notify({newLocation:s,oldLocation:r}),r=s}return()=>{n(),o()}})}function mM(e,t){const{stop:r}=Vt(tg("pushState"),"pushState",({onPostCall:o})=>{o(t)}),{stop:a}=Vt(tg("replaceState"),"replaceState",({onPostCall:o})=>{o(t)}),{stop:n}=je(e,window,"popstate",t);return{stop:()=>{r(),a(),n()}}}function pM(e,t){return je(e,window,"hashchange",t)}function tg(e){return Object.prototype.hasOwnProperty.call(history,e)?history:History.prototype}const fM=tn;function gM(e,t,r){const a=Qn({expireDelay:fM});return e.subscribe(1,({startClocks:n})=>{a.add({},n.relative)}),e.subscribe(6,({endClocks:n})=>{a.closeActive(n.relative)}),t.register(0,({startTime:n,eventType:o})=>{if(!r.trackFeatureFlagsForEvents.concat([ne.VIEW,ne.ERROR]).includes(o))return kt;const s=a.find(n);return!s||$r(s)?kt:{type:o,feature_flags:s}}),{addFeatureFlagEvaluation:(n,o)=>{const i=a.find();i&&(i[n]=o)}}}const hM=10*tt;let kn,ri;function vM(e,t,r){e.metricsEnabled&&(aS(),ri=!1,t.subscribe(13,()=>{ri=!0}),r.subscribe(({bytesCount:a,messagesCount:n})=>{ri&&(ri=!1,kn.batchCount+=1,ng(kn.batchBytesCount,a),ng(kn.batchMessagesCount,n))}),Gn(bM,hM))}function bM(){kn.batchCount!==0&&(Ao("Customer data measures",kn),aS())}function rg(){return{min:1/0,max:0,sum:0}}function ng(e,t){e.sum+=t,e.min=Math.min(e.min,t),e.max=Math.max(e.max,t)}function aS(){kn={batchCount:0,batchBytesCount:rg(),batchMessagesCount:rg()}}const yM=4e3,wM=500,_M=tn;function xM(e,t,r=wM){const a=Qn({expireDelay:_M,maxEntries:yM});let n;Or(exports.RumPerformanceEntryType.VISIBILITY_STATE)&&performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).forEach(c=>{const u=c.name==="hidden"?"hidden":"active";i(u,c.startTime)}),i(oS(),xt());const{stop:o}=lr(t,window,["pageshow","focus","blur","visibilitychange","resume","freeze","pagehide"],l=>{i(SM(l),l.timeStamp)},{capture:!0});function i(l,c=xt()){l!==n&&(n=l,a.closeActive(c),a.add({state:n,startTime:c},c))}function s(l,c,u){return a.findAll(c,u).some(d=>d.state===l)}return e.register(0,({startTime:l,duration:c=0,eventType:u})=>{if(u===ne.VIEW){const d=a.findAll(l,c);return{type:u,_dd:{page_states:kM(d,l,r)}}}return u===ne.ACTION||u===ne.ERROR?{type:u,view:{in_foreground:s("active",l,0)}}:kt}),{wasInPageStateDuringPeriod:s,addPageState:i,stop:()=>{o(),a.stop()}}}function kM(e,t,r){if(e.length!==0)return e.slice(-r).reverse().map(({state:a,startTime:n})=>({state:a,start:ie(De(t,n))}))}function SM(e){return e.type==="freeze"?"frozen":e.type==="pagehide"?e.persisted?"frozen":"terminated":oS()}function oS(){return document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}function IM(e,t){let r;const a=requestAnimationFrame(oe(()=>{r=ul()})),n=nS(t).subscribe(o=>{r=o}).unsubscribe;return e.register(0,({eventType:o})=>({type:o,display:r?{viewport:r}:void 0})),{stop:()=>{n(),a&&cancelAnimationFrame(a)}}}function EM(e,t){const r=window.cookieStore?TM(e):OM;return new ge(a=>r(t,n=>a.notify(n)))}function TM(e){return(t,r)=>je(e,window.cookieStore,"change",n=>{const o=n.changed.find(i=>i.name===t)||n.deleted.find(i=>i.name===t);o&&r(o.value)}).stop}const $M=tt;function OM(e,t){const r=Pa(document.cookie,e),a=Gn(()=>{const n=Pa(document.cookie,e);n!==r&&t(n)},$M);return()=>{Qs(a)}}const ag="datadog-ci-visibility-test-execution-id";function CM(e,t,r=EM(e,ag)){var a;let n=hr(ag)||((a=window.Cypress)===null||a===void 0?void 0:a.env("traceId"));const o=r.subscribe(i=>{n=i});return t.register(0,({eventType:i})=>typeof n!="string"?kt:{type:i,session:{type:"ci_test"},ci_test:{test_execution_id:n}}),{stop:()=>{o.unsubscribe()}}}function NM(e,t){const r=Qt(t,{type:exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME,buffered:!0}).subscribe(a=>{for(const n of a){const o=Io(n.startTime),i={date:o.timeStamp,long_task:{id:ot(),entry_type:dk.LONG_ANIMATION_FRAME,duration:ie(n.duration),blocking_duration:ie(n.blockingDuration),first_ui_event_timestamp:ie(n.firstUIEventTimestamp),render_start:ie(n.renderStart),style_and_layout_start:ie(n.styleAndLayoutStart),start_time:ie(n.startTime),scripts:n.scripts.map(s=>({duration:ie(s.duration),pause_duration:ie(s.pauseDuration),forced_style_and_layout_duration:ie(s.forcedStyleAndLayoutDuration),start_time:ie(s.startTime),execution_start:ie(s.executionStart),source_url:s.sourceURL,source_function_name:s.sourceFunctionName,source_char_position:s.sourceCharPosition,invoker:s.invoker,invoker_type:s.invokerType,window_attribution:s.windowAttribution}))},type:ne.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:i,startTime:o.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop:()=>r.unsubscribe()}}function AM(e,t){const r=Qt(t,{type:exports.RumPerformanceEntryType.LONG_TASK,buffered:!0}).subscribe(a=>{for(const n of a){if(n.entryType!==exports.RumPerformanceEntryType.LONG_TASK||!t.trackLongTasks)break;const o=Io(n.startTime),i={date:o.timeStamp,long_task:{id:ot(),entry_type:dk.LONG_TASK,duration:ie(n.duration)},type:ne.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:i,startTime:o.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop(){r.unsubscribe()}}}function RM(e){e.register(0,({eventType:t})=>{if(!nk())return kt;const r=tk(),a=rk();return{type:t,session:{type:"synthetics"},synthetics:{test_id:r,result_id:a,injected:ek()}}})}function jM(e,t,r){const a=km(e),n=r(a);return rl(t).forEach(([o,i])=>Gc(e,a,o.split(/\.|(?=\[\])/),i)),n}function Gc(e,t,r,a){const[n,...o]=r;if(n==="[]"){Array.isArray(e)&&Array.isArray(t)&&e.forEach((i,s)=>Gc(i,t[s],o,a));return}if(!(!og(e)||!og(t))){if(o.length>0)return Gc(e[n],t[n],o,a);PM(e,n,t[n],a)}}function PM(e,t,r,a){const n=rn(r);n===a?e[t]=Ce(r):a==="object"&&(n==="undefined"||n==="null")&&(e[t]={})}function og(e){return rn(e)==="object"}const fn={"view.name":"string","view.url":"string","view.referrer":"string"},gn={context:"object"},hn={service:"string",version:"string"};let iS;function zM(e,t,r,a,n){iS={[ne.VIEW]:{"view.performance.lcp.resource_url":"string",...gn,...fn,...hn},[ne.ERROR]:{"error.message":"string","error.stack":"string","error.resource.url":"string","error.fingerprint":"string",...gn,...fn,...hn},[ne.RESOURCE]:{"resource.url":"string","resource.graphql.variables":"string",...gn,...fn,...hn},[ne.ACTION]:{"action.target.name":"string",...gn,...fn,...hn},[ne.LONG_TASK]:{"long_task.scripts[].source_url":"string","long_task.scripts[].invoker":"string",...gn,...fn,...hn},[ne.VITAL]:{...gn,...fn,...hn}};const o={[ne.ERROR]:Vl(ne.ERROR,a,n),[ne.ACTION]:Vl(ne.ACTION,a,n),[ne.VITAL]:Vl(ne.VITAL,a,n)};t.subscribe(12,({startTime:i,duration:s,rawRumEvent:l,domainContext:c})=>{const u=r.triggerHook(0,{eventType:l.type,startTime:i,duration:s});if(u===Ir)return;const d=cr(u,l,{ddtags:_m(e).join(",")});DM(d,e.beforeSend,c,o)&&($r(d.context)&&delete d.context,t.notify(13,d))})}function DM(e,t,r,a){var n;if(t){const i=jM(e,iS[e.type],s=>t(s,r));if(i===!1&&e.type!==ne.VIEW)return!1;i===!1&&Q.warn("Can't dismiss view events using beforeSend!")}return!((n=a[e.type])===null||n===void 0?void 0:n.isLimitReached())}function MM(e,t,r,a){e.register(0,({eventType:n,startTime:o})=>{const i=t.findTrackedSession(o),s=a.findView(o);if(!i||!s)return Ir;let l,c,u;return n===ne.VIEW?(l=r.getReplayStats(s.id)?!0:void 0,c=i.sessionReplay===1,u=s.sessionIsActive?void 0:!1):l=r.isRecording()?!0:void 0,{type:n,session:{id:i.id,type:"user",has_replay:l,sampled_for_replay:c,is_active:u}}}),e.register(1,({startTime:n})=>{const o=t.findTrackedSession(n);return o?{session:{id:o.id}}:kt})}function UM(e){e.register(0,({eventType:t})=>({type:t,connectivity:Fx()}))}function LM(e,t,r){e.register(0,({eventType:a})=>{const n=t.source;return{type:a,_dd:{format_version:2,drift:mx(),configuration:{session_sample_rate:wa(t.sessionSampleRate,3),session_replay_sample_rate:wa(t.sessionReplaySampleRate,3),profiling_sample_rate:wa(t.profilingSampleRate,3),beta_encode_cookie_options:t.betaEncodeCookieOptions},browser_sdk_version:Gr()?"6.24.1":void 0,sdk_name:r},application:{id:t.applicationId},date:Je(),source:n}}),e.register(1,()=>({application:{id:t.applicationId}}))}function FM(e,t){e.register(1,()=>t.isGranted()?kt:Ir)}const VM=IP,ZM=[ne.ACTION,ne.ERROR,ne.LONG_TASK,ne.RESOURCE,ne.VITAL];function qM(e){return{addEvent:(t,r,a,n)=>{ZM.includes(r.type)&&e.notify(12,{startTime:t,rawRumEvent:r,domainContext:a,duration:n})}}}function BM(e,t){if(!t.metricsEnabled)return{stop:ve};const{unsubscribe:r}=e.subscribe(4,({initialViewMetrics:a})=>{!a.largestContentfulPaint||!a.navigationTimings||(Ao("Initial view metrics",{metrics:GM(a.largestContentfulPaint,a.navigationTimings)}),r())});return{stop:r}}function GM(e,t){return{lcp:{value:e.value},navigation:{domComplete:t.domComplete,domContentLoaded:t.domContentLoaded,domInteractive:t.domInteractive,firstByte:t.firstByte,loadEvent:t.loadEvent}}}function HM(e,t,r,a,n,o,i,s,l){const c=[],u=new x4,d=VM();u.subscribe(13,L=>xm("rum",L));const m=L=>{u.notify(14,{error:L}),Xn("Error reported to customer",{"error.message":L.message})},f=xP(e),g=f.subscribe(L=>{u.notify(11,L)});c.push(()=>g.unsubscribe());const h=CP("browser-rum-sdk",e,d,m,f,n);c.push(h.stop);const b=Gr()?aM():nM(e,u,o);if(Gr())lM(u);else{const L=sM(e,u,m,f,b.expireObservable,n);c.push(()=>L.stop()),vM(h,u,L.flushController.flushObservable)}const w=y4(),x=dM(e,location),{observable:k,stop:y}=w4();c.push(y),LM(d,e,l);const $=xM(d,e),I=S4(u);c.push(()=>I.stop());const E=uM(u,d,x,location);c.push(()=>E.stop());const A=gM(u,d,e);MM(d,b,t,I),UM(d),FM(d,o);const F=E2(d,e,"rum"),q=T2(d,e,b,"rum"),ee=I2(d,e,"rum"),{actionContexts:Ne,addAction:te,addEvent:J,stop:Ae}=JM(u,d,e,$,w,k,m);c.push(Ae);const{addTiming:fe,startView:Ue,setViewName:$e,setViewContext:ke,setViewContextProperty:M,getViewContext:he,stop:le}=QD(u,d,e,location,w,k,x,t,I,a);c.push(le);const{stop:_e}=BM(u,h);c.push(_e);const{stop:j}=eD(u,e,$);if(c.push(j),e.trackLongTasks)if(Or(exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME)){const{stop:L}=NM(u,e);c.push(L)}else AM(u,e);const{addError:B}=Lz(u,e,s);s.unbuffer(),L4(u,e,b,q,ee);const me=A2(u,$,i),Se=_4(e.applicationId,b,I,Ne,E);return c.push(()=>r.stop()),{addAction:te,addEvent:J,addError:B,addTiming:fe,addFeatureFlagEvaluation:A.addFeatureFlagEvaluation,startView:Ue,setViewContext:ke,setViewContextProperty:M,getViewContext:he,setViewName:$e,lifeCycle:u,viewHistory:I,session:b,stopSession:()=>b.expire(),getInternalContext:Se.get,startDurationVital:me.startDurationVital,stopDurationVital:me.stopDurationVital,addDurationVital:me.addDurationVital,addOperationStepVital:me.addOperationStepVital,globalContext:F,userContext:q,accountContext:ee,telemetry:h,stop:()=>{c.forEach(L=>L())},hooks:d}}function JM(e,t,r,a,n,o,i){const s=Dz(e,t,n,o,r),l=qM(e),c=IM(t,r),u=CM(r,t);return RM(t),zM(r,e,t,i),{pageStateHistory:a,addAction:s.addAction,addEvent:l.addEvent,actionContexts:s.actionContexts,stop:()=>{s.stop(),u.stop(),c.stop(),a.stop()}}}function WM(e,{session:t,viewContext:r,errorType:a}){const n=t?t.id:"no-session-id",o=[];a!==void 0&&o.push(`error-type=${a}`),r&&(o.push(`seed=${r.id}`),o.push(`from=${r.startClocks.timeStamp}`));const i=KM(e),s=`/rum/replay/sessions/${n}`;return`${i}${s}?${o.join("&")}`}function KM(e){const t=e.site,r=e.subdomain||YM(e);return`https://${r?`${r}.`:""}${t}`}function YM(e){switch(e.site){case Ur:case oj:return"app";case Ox:return"dd";default:return}}const XM=1e3;let Ct;function QM(e){return dl(e).segments_count}function eU(e){dl(e).segments_count+=1}function tU(e){dl(e).records_count+=1}function rU(e,t){dl(e).segments_total_raw_size+=t}function nU(e){return Ct?.get(e)}function dl(e){Ct||(Ct=new Map);let t;return Ct.has(e)?t=Ct.get(e):(t={records_count:0,segments_count:0,segments_total_raw_size:0},Ct.set(e,t),Ct.size>XM&&aU()),t}function aU(){if(!Ct)return;const e=Ct.keys().next().value;e&&Ct.delete(e)}function sS(e,t,r){let a=0,n=[],o,i=!0,s=0;const l=[],{stop:c}=je(e,t,"message",({data:m})=>{if(m.type!=="wrote"||m.streamId!==r)return;const f=l[0];f&&(f.id===m.id?(l.shift(),a+=m.additionalBytesCount,n.push(m.result),o=m.trailer,f.writeCallback?f.writeCallback(m.result.byteLength):f.finishCallback&&f.finishCallback()):f.id<m.id&&c())});function u(){const m=n.length===0?new Uint8Array(0):zx(n.concat(o)),f={rawBytesCount:a,output:m,outputBytesCount:m.byteLength,encoding:"deflate"};return a=0,n=[],f}function d(){i||(t.postMessage({action:"reset",streamId:r}),i=!0)}return{isAsync:!0,get isEmpty(){return i},write(m,f){t.postMessage({action:"write",id:s,data:m,streamId:r}),l.push({id:s,writeCallback:f,data:m}),i=!1,s+=1},finish(m){d(),l.length?(l.forEach(f=>{delete f.writeCallback}),l[l.length-1].finishCallback=()=>m(u())):m(u())},finishSync(){d();const m=l.map(f=>f.data).join("");return l.length=0,{...u(),pendingData:m}},estimateEncodedBytesCount(m){return m.length/8},stop(){c()}}}function jm({configuredUrl:e,error:t,source:r,scriptType:a}){if(Q.error(`${r} failed to start: an error occurred while initializing the ${a}:`,t),t instanceof Event||t instanceof Error&&oU(t.message)){let n;e?n=`Please make sure the ${a} URL ${e} is correct and CSP is correctly configured.`:n="Please make sure CSP is correctly configured.",Q.error(`${n} See documentation at ${Ys}/integrations/content_security_policy_logs/#use-csp-with-real-user-monitoring-and-session-replay`)}else a==="worker"&&Im(t)}function oU(e){return e.includes("Content Security Policy")||e.includes("requires 'TrustedScriptURL'")}const iU=30*tt;function lS(e){return new Worker(e.workerUrl||URL.createObjectURL(new Blob(['(()=>{function t(t){if(1===t.length)return t[0];const e=t.reduce((t,e)=>t+e.length,0),a=new Uint8Array(e);let n=0;for(const e of t)a.set(e,n),n+=e.length;return a}function e(t){for(var e=t.length;--e>=0;)t[e]=0}var a=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),n=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=Array(576);e(s);var h=Array(60);e(h);var l=Array(512);e(l);var _=Array(256);e(_);var o=Array(29);e(o);var d,u,f,c=Array(30);function p(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function g(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(c);var v=function(t){return t<256?l[t]:l[256+(t>>>7)]},w=function(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},m=function(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},b=function(t,e,a){m(t,a[2*e],a[2*e+1])},y=function(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},z=function(t,e,a){var n,r,i=Array(16),s=0;for(n=1;n<=15;n++)i[n]=s=s+a[n-1]<<1;for(r=0;r<=e;r++){var h=t[2*r+1];0!==h&&(t[2*r]=y(i[h]++,h))}},k=function(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},x=function(t){t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},A=function(t,e,a,n){var r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]},U=function(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&A(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!A(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n},B=function(t,e,r){var i,s,h,l,d=0;if(0!==t.last_lit)do{i=t.pending_buf[t.d_buf+2*d]<<8|t.pending_buf[t.d_buf+2*d+1],s=t.pending_buf[t.l_buf+d],d++,0===i?b(t,s,e):(h=_[s],b(t,h+256+1,e),0!==(l=a[h])&&(s-=o[h],m(t,s,l)),i--,h=v(i),b(t,h,r),0!==(l=n[h])&&(i-=c[h],m(t,i,l)))}while(d<t.last_lit);b(t,256,e)},I=function(t,e){var a,n,r,i=e.dyn_tree,s=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.elems,_=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<l;a++)0!==i[2*a]?(t.heap[++t.heap_len]=_=a,t.depth[a]=0):i[2*a+1]=0;for(;t.heap_len<2;)i[2*(r=t.heap[++t.heap_len]=_<2?++_:0)]=1,t.depth[r]=0,t.opt_len--,h&&(t.static_len-=s[2*r+1]);for(e.max_code=_,a=t.heap_len>>1;a>=1;a--)U(t,i,a);r=l;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],U(t,i,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,i[2*r]=i[2*a]+i[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,i[2*a+1]=i[2*n+1]=r,t.heap[1]=r++,U(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,i,s,h,l=e.dyn_tree,_=e.max_code,o=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,p=0;for(i=0;i<=15;i++)t.bl_count[i]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<573;a++)(i=l[2*l[2*(n=t.heap[a])+1]+1]+1)>c&&(i=c,p++),l[2*n+1]=i,n>_||(t.bl_count[i]++,s=0,n>=f&&(s=u[n-f]),h=l[2*n],t.opt_len+=h*(i+s),d&&(t.static_len+=h*(o[2*n+1]+s)));if(0!==p){do{for(i=c-1;0===t.bl_count[i];)i--;t.bl_count[i]--,t.bl_count[i+1]+=2,t.bl_count[c]--,p-=2}while(p>0);for(i=c;0!==i;i--)for(n=t.bl_count[i];0!==n;)(r=t.heap[--a])>_||(l[2*r+1]!==i&&(t.opt_len+=(i-l[2*r+1])*l[2*r],l[2*r+1]=i),n--)}}(t,e),z(i,_,t.bl_count)},E=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=s,s=e[2*(n+1)+1],++h<l&&r===s||(h<_?t.bl_tree[2*r]+=h:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[32]++):h<=10?t.bl_tree[34]++:t.bl_tree[36]++,h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4))},C=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),n=0;n<=a;n++)if(r=s,s=e[2*(n+1)+1],!(++h<l&&r===s)){if(h<_)do{b(t,r,t.bl_tree)}while(0!==--h);else 0!==r?(r!==i&&(b(t,r,t.bl_tree),h--),b(t,16,t.bl_tree),m(t,h-3,2)):h<=10?(b(t,17,t.bl_tree),m(t,h-3,3)):(b(t,18,t.bl_tree),m(t,h-11,7));h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4)}},D=!1,M=function(t,e,a,n){m(t,0+(n?1:0),3),function(t,e,a){x(t),w(t,a),w(t,~a),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a}(t,e,a)},j=M,L=function(t,e,a,n){for(var r=65535&t,i=t>>>16&65535,s=0;0!==a;){a-=s=a>2e3?2e3:a;do{i=i+(r=r+e[n++]|0)|0}while(--s);r%=65521,i%=65521}return r|i<<16},S=new Uint32Array(function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}()),T=function(t,e,a,n){var r=S,i=n+a;t^=-1;for(var s=n;s<i;s++)t=t>>>8^r[255&(t^e[s])];return-1^t},O={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},q=j,F=function(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(_[a]+256+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1},G=-2,H=258,J=262,K=103,N=113,P=666,Q=function(t,e){return t.msg=O[e],e},R=function(t){return(t<<1)-(t>4?9:0)},V=function(t){for(var e=t.length;--e>=0;)t[e]=0},W=function(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask},X=function(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},Y=function(t,e){(function(t,e,a,n){var r,l,_=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),I(t,t.l_desc),I(t,t.d_desc),_=function(t){var e;for(E(t,t.dyn_ltree,t.l_desc.max_code),E(t,t.dyn_dtree,t.d_desc.max_code),I(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*i[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),r=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=r&&(r=l)):r=l=a+5,a+4<=r&&-1!==e?M(t,e,a,n):4===t.strategy||l===r?(m(t,2+(n?1:0),3),B(t,s,h)):(m(t,4+(n?1:0),3),function(t,e,a,n){var r;for(m(t,e-257,5),m(t,a-1,5),m(t,n-4,4),r=0;r<n;r++)m(t,t.bl_tree[2*i[r]+1],3);C(t,t.dyn_ltree,e-1),C(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,_+1),B(t,t.dyn_ltree,t.dyn_dtree)),k(t),n&&x(t)})(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,X(t.strm)},Z=function(t,e){t.pending_buf[t.pending++]=e},$=function(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},tt=function(t,e,a,n){var r=t.avail_in;return r>n&&(r=n),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),a),1===t.state.wrap?t.adler=L(t.adler,e,r,a):2===t.state.wrap&&(t.adler=T(t.adler,e,r,a)),t.next_in+=r,t.total_in+=r,r)},et=function(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-J?t.strstart-(t.w_size-J):0,_=t.window,o=t.w_mask,d=t.prev,u=t.strstart+H,f=_[i+s-1],c=_[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do{if(_[(a=e)+s]===c&&_[a+s-1]===f&&_[a]===_[i]&&_[++a]===_[i+1]){i+=2,a++;do{}while(_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&i<u);if(n=H-(u-i),i=u-H,n>s){if(t.match_start=e,s=n,n>=h)break;f=_[i+s-1],c=_[i+s]}}}while((e=d[e&o])>l&&0!==--r);return s<=t.lookahead?s:t.lookahead},at=function(t){var e,a,n,r,i,s=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-J)){t.window.set(t.window.subarray(s,s+s),0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=a=t.hash_size;do{n=t.head[--e],t.head[e]=n>=s?n-s:0}while(--a);e=a=s;do{n=t.prev[--e],t.prev[e]=n>=s?n-s:0}while(--a);r+=s}if(0===t.strm.avail_in)break;if(a=tt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=a,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=W(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=W(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<J&&0!==t.strm.avail_in)},nt=function(t,e){for(var a,n;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&0===e)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-J&&(t.match_length=et(t,a)),t.match_length>=3)if(n=F(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=W(t,t.ins_h,t.window[t.strstart+1]);else n=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2},rt=function(t,e){for(var a,n,r;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&0===e)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-J&&(t.match_length=et(t,a),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,n=F(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Y(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=F(t,0,t.window[t.strstart-1]))&&Y(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=F(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2};function it(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}var st=[new it(0,0,0,0,function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(at(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,Y(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-J&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(Y(t,!1),t.strm.avail_out),1)}),new it(4,4,8,4,nt),new it(4,5,16,8,nt),new it(4,6,32,32,nt),new it(4,4,16,16,rt),new it(8,16,32,32,rt),new it(8,16,128,128,rt),new it(8,32,128,256,rt),new it(32,128,258,1024,rt),new it(32,258,258,4096,rt)];function ht(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),V(this.dyn_ltree),V(this.dyn_dtree),V(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),V(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}for(var lt=function(t){var e,i=function(t){if(!t||!t.state)return Q(t,G);t.total_in=t.total_out=0,t.data_type=2;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:N,t.adler=2===e.wrap?0:1,e.last_flush=0,function(t){D||(function(){var t,e,i,g,v,w=Array(16);for(i=0,g=0;g<28;g++)for(o[g]=i,t=0;t<1<<a[g];t++)_[i++]=g;for(_[i-1]=g,v=0,g=0;g<16;g++)for(c[g]=v,t=0;t<1<<n[g];t++)l[v++]=g;for(v>>=7;g<30;g++)for(c[g]=v<<7,t=0;t<1<<n[g]-7;t++)l[256+v++]=g;for(e=0;e<=15;e++)w[e]=0;for(t=0;t<=143;)s[2*t+1]=8,t++,w[8]++;for(;t<=255;)s[2*t+1]=9,t++,w[9]++;for(;t<=279;)s[2*t+1]=7,t++,w[7]++;for(;t<=287;)s[2*t+1]=8,t++,w[8]++;for(z(s,287,w),t=0;t<30;t++)h[2*t+1]=5,h[2*t]=y(t,5);d=new p(s,a,257,286,15),u=new p(h,n,0,30,15),f=new p([],r,0,19,7)}(),D=!0),t.l_desc=new g(t.dyn_ltree,d),t.d_desc=new g(t.dyn_dtree,u),t.bl_desc=new g(t.bl_tree,f),t.bi_buf=0,t.bi_valid=0,k(t)}(e),0}(t);return 0===i&&((e=t.state).window_size=2*e.w_size,V(e.head),e.max_lazy_match=st[e.level].max_lazy,e.good_match=st[e.level].good_length,e.nice_match=st[e.level].nice_length,e.max_chain_length=st[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),i},_t=function(t,e){var a,n;if(!t||!t.state||e>5||e<0)return t?Q(t,G):G;var r=t.state;if(!t.output||!t.input&&0!==t.avail_in||r.status===P&&4!==e)return Q(t,0===t.avail_out?-5:G);r.strm=t;var i=r.last_flush;if(r.last_flush=e,42===r.status)if(2===r.wrap)t.adler=0,Z(r,31),Z(r,139),Z(r,8),r.gzhead?(Z(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Z(r,255&r.gzhead.time),Z(r,r.gzhead.time>>8&255),Z(r,r.gzhead.time>>16&255),Z(r,r.gzhead.time>>24&255),Z(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Z(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Z(r,255&r.gzhead.extra.length),Z(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=T(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Z(r,0),Z(r,0),Z(r,0),Z(r,0),Z(r,0),Z(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Z(r,3),r.status=N);else{var h=8+(r.w_bits-8<<4)<<8;h|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(h|=32),h+=31-h%31,r.status=N,$(r,h),0!==r.strstart&&($(r,t.adler>>>16),$(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(a=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending!==r.pending_buf_size));)Z(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Z(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Z(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.status=K)}else r.status=K;if(r.status===K&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&X(t),r.pending+2<=r.pending_buf_size&&(Z(r,255&t.adler),Z(r,t.adler>>8&255),t.adler=0,r.status=N)):r.status=N),0!==r.pending){if(X(t),0===t.avail_out)return r.last_flush=-1,0}else if(0===t.avail_in&&R(e)<=R(i)&&4!==e)return Q(t,-5);if(r.status===P&&0!==t.avail_in)return Q(t,-5);if(0!==t.avail_in||0!==r.lookahead||0!==e&&r.status!==P){var l=2===r.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(at(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,a=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2}(r,e):3===r.strategy?function(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=H){if(at(t),t.lookahead<=H&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[r=t.strstart-1])===s[++r]&&n===s[++r]&&n===s[++r]){i=t.strstart+H;do{}while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<i);t.match_length=H-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=F(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2}(r,e):st[r.level].func(r,e);if(3!==l&&4!==l||(r.status=P),1===l||3===l)return 0===t.avail_out&&(r.last_flush=-1),0;if(2===l&&(1===e?function(t){m(t,2,3),b(t,256,s),function(t){16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}(r):5!==e&&(q(r,0,0,!1),3===e&&(V(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),X(t),0===t.avail_out))return r.last_flush=-1,0}return 4!==e?0:r.wrap<=0?1:(2===r.wrap?(Z(r,255&t.adler),Z(r,t.adler>>8&255),Z(r,t.adler>>16&255),Z(r,t.adler>>24&255),Z(r,255&t.total_in),Z(r,t.total_in>>8&255),Z(r,t.total_in>>16&255),Z(r,t.total_in>>24&255)):($(r,t.adler>>>16),$(r,65535&t.adler)),X(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},ot=function(t){if(!t||!t.state)return G;var e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&e!==K&&e!==N&&e!==P?Q(t,G):(t.state=null,e===N?Q(t,-3):0)},dt=new Uint8Array(256),ut=0;ut<256;ut++)dt[ut]=ut>=252?6:ut>=248?5:ut>=240?4:ut>=224?3:ut>=192?2:1;dt[254]=dt[254]=1;var ft=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},ct=Object.prototype.toString;function pt(){this.options={level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0};var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ft,this.strm.avail_out=0;var e,a,n=function(t,e,a,n,r,i){if(!t)return G;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>9||8!==a||n<8||n>15||e<0||e>9||i<0||i>4)return Q(t,G);8===n&&(n=9);var h=new ht;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=n,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=r+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new Uint8Array(2*h.w_size),h.head=new Uint16Array(h.hash_size),h.prev=new Uint16Array(h.w_size),h.lit_bufsize=1<<r+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new Uint8Array(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=i,h.method=a,lt(t)}(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw Error(O[n]);if(t.header&&(e=this.strm,a=t.header,e&&e.state&&(2!==e.state.wrap||(e.state.gzhead=a))),t.dictionary){var r;if(r="[object ArrayBuffer]"===ct.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=function(t,e){var a=e.length;if(!t||!t.state)return G;var n=t.state,r=n.wrap;if(2===r||1===r&&42!==n.status||n.lookahead)return G;if(1===r&&(t.adler=L(t.adler,e,a,0)),n.wrap=0,a>=n.w_size){0===r&&(V(n.head),n.strstart=0,n.block_start=0,n.insert=0);var i=new Uint8Array(n.w_size);i.set(e.subarray(a-n.w_size,a),0),e=i,a=n.w_size}var s=t.avail_in,h=t.next_in,l=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,at(n);n.lookahead>=3;){var _=n.strstart,o=n.lookahead-2;do{n.ins_h=W(n,n.ins_h,n.window[_+3-1]),n.prev[_&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=_,_++}while(--o);n.strstart=_,n.lookahead=2,at(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=h,t.input=l,t.avail_in=s,n.wrap=r,0}(this.strm,r)))throw Error(O[n]);this._dict_set=!0}}function gt(t,e,a){try{t.postMessage({type:"errored",error:e,streamId:a})}catch(n){t.postMessage({type:"errored",error:e+"",streamId:a})}}function vt(t){const e=t.strm.adler;return new Uint8Array([3,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])}pt.prototype.push=function(t,e){var a,n,r=this.strm,i=this.options.chunkSize;if(this.ended)return!1;for(n=e===~~e?e:!0===e?4:0,"[object ArrayBuffer]"===ct.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(2===n||3===n)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(1===(a=_t(r,n)))return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),a=ot(this.strm),this.onEnd(a),this.ended=!0,0===a;if(0!==r.avail_out){if(n>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},pt.prototype.onData=function(t){this.chunks.push(t)},pt.prototype.onEnd=function(t){0===t&&(this.result=function(t){for(var e=0,a=0,n=t.length;a<n;a++)e+=t[a].length;for(var r=new Uint8Array(e),i=0,s=0,h=t.length;i<h;i++){var l=t[i];r.set(l,s),s+=l.length}return r}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},function(e=self){try{const a=new Map;e.addEventListener("message",n=>{try{const r=function(e,a){switch(a.action){case"init":return{type:"initialized",version:"6.24.1"};case"write":{let n=e.get(a.streamId);n||(n=new pt,e.set(a.streamId,n));const r=n.chunks.length,i=function(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,n,r,i,s=t.length,h=0;for(r=0;r<s;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),r++)),h+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(h),i=0,r=0;i<h;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),r++)),a<128?e[i++]=a:a<2048?(e[i++]=192|a>>>6,e[i++]=128|63&a):a<65536?(e[i++]=224|a>>>12,e[i++]=128|a>>>6&63,e[i++]=128|63&a):(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63,e[i++]=128|a>>>6&63,e[i++]=128|63&a);return e}(a.data);return n.push(i,2),{type:"wrote",id:a.id,streamId:a.streamId,result:t(n.chunks.slice(r)),trailer:vt(n),additionalBytesCount:i.length}}case"reset":e.delete(a.streamId)}}(a,n.data);r&&e.postMessage(r)}catch(t){gt(e,t,n.data&&"streamId"in n.data?n.data.streamId:void 0)}})}catch(t){gt(e,t)}}()})();'])))}let Me={status:0};function cS(e,t,r,a=lS){switch(Me.status===0&&sU(e,t,a),Me.status){case 1:return Me.initializationFailureCallbacks.push(r),Me.worker;case 3:return Me.worker}}function ig(){return Me.status}function sU(e,t,r=lS){try{const a=r(e),{stop:n}=je(e,a,"error",s=>{Ql(e,t,s)}),{stop:o}=je(e,a,"message",({data:s})=>{s.type==="errored"?Ql(e,t,s.error,s.streamId):s.type==="initialized"&&cU(s.version)});a.postMessage({action:"init"}),Qe(()=>lU(t),iU),Me={status:1,worker:a,stop:()=>{n(),o()},initializationFailureCallbacks:[]}}catch(a){Ql(e,t,a)}}function lU(e){Me.status===1&&(Q.error(`${e} failed to start: a timeout occurred while initializing the Worker`),Me.initializationFailureCallbacks.forEach(t=>t()),Me={status:2})}function cU(e){Me.status===1&&(Me={status:3,worker:Me.worker,stop:Me.stop,version:e})}function Ql(e,t,r,a){Me.status===1||Me.status===0?(jm({configuredUrl:e.workerUrl,error:r,source:t,scriptType:"worker"}),Me.status===1&&Me.initializationFailureCallbacks.forEach(n=>n()),Me={status:2}):Im(r,{worker_version:Me.status===3&&Me.version,stream_id:a})}function uS(){return typeof Array.from=="function"&&typeof CSSSupportsRule=="function"&&typeof URL.createObjectURL=="function"&&"forEach"in NodeList.prototype}function uU(e,t,r,a){const n=t.findTrackedSession(),o=dU(n,a),i=r.findView();return WM(e,{viewContext:i,errorType:o,session:n})}function dU(e,t){if(!uS())return"browser-not-supported";if(!e)return"rum-not-tracked";if(e.sessionReplay===0)return"incorrect-session-plan";if(!t)return"replay-not-started"}function mU(e,t){if(!e.metricsEnabled)return{stop:ve};let r,a,n;const{unsubscribe:o}=t.subscribe(i=>{switch(i.type){case"start":r={forced:i.forced,timestamp:Je()},a=void 0,n=void 0;break;case"document-ready":r&&(a=De(r.timestamp,Je()));break;case"recorder-settled":r&&(n=De(r.timestamp,Je()));break;case"aborted":case"deflate-encoder-load-failed":case"recorder-load-failed":case"succeeded":o(),r&&Ao("Recorder init metrics",{metrics:pU(r.forced,n,De(r.timestamp,Je()),i.type,a)});break}});return{stop:o}}function pU(e,t,r,a,n){return{forced:e,loadRecorderModuleDuration:t,recorderInitDuration:r,result:a,waitForDocReadyDuration:n}}function fU(e,t,r,a,n,o,i){let s=0,l;t.subscribe(9,()=>{(s===2||s===3)&&(m(),s=1)}),t.subscribe(10,()=>{s===1&&d()});const c=new ge;mU(i,c);const u=async f=>{c.notify({type:"start",forced:f});const[g]=await Promise.all([sg(c,{type:"recorder-settled"},n()),sg(c,{type:"document-ready"},e2(e,"interactive"))]);if(s!==2){c.notify({type:"aborted"});return}if(!g){s=0,c.notify({type:"recorder-load-failed"});return}const h=o();if(!h){s=0,c.notify({type:"deflate-encoder-load-failed"});return}({stop:l}=g(t,e,r,a,h,i)),s=3,c.notify({type:"succeeded"})};function d(f){const g=r.findTrackedSession();if(gU(g,f)){s=1;return}if(hU(s))return;s=2;const h=vU(g,f)||!1;u(h).catch(ir),h&&r.setForcedReplay()}function m(){s===3&&l?.(),s=0}return{start:d,stop:m,getSessionReplayLink(){return uU(e,r,a,s!==0)},isRecording:()=>s===3}}function gU(e,t){return!e||e.sessionReplay===0&&(!t||!t.force)}function hU(e){return e===2||e===3}function vU(e,t){return t&&t.force&&e.sessionReplay===0}async function sg(e,t,r){try{return await r}finally{e.notify(t)}}function bU(){let e=0;return{strategy:{start(){e=1},stop(){e=2},isRecording:()=>!1,getSessionReplayLink:ve},shouldStartImmediately(t){return e===1||e===0&&!t.startSessionReplayRecordingManually}}}function yU(e,t){if(Gr()&&!Wx("records")||!uS())return{start:ve,stop:ve,getReplayStats:()=>{},onRumStart:ve,isRecording:()=>!1,getSessionReplayLink:()=>{}};let{strategy:r,shouldStartImmediately:a}=bU();return{start:o=>r.start(o),stop:()=>r.stop(),getSessionReplayLink:()=>r.getSessionReplayLink(),onRumStart:n,isRecording:()=>ig()===3&&r.isRecording(),getReplayStats:o=>ig()===3?nU(o):void 0};function n(o,i,s,l,c,u){let d;function m(){return d||(c??(c=cS(i,"Datadog Session Replay",()=>{r.stop()},t)),c&&(d=sS(i,c,1))),d}r=fU(i,o,s,l,e,m,u),a(i)&&r.start()}}async function wU(e=_U){try{return await e()}catch(t){jm({error:t,source:"Recorder",scriptType:"module"})}}async function _U(){return(await Promise.resolve().then(()=>require("./startRecording-Cpeh1_CL.cjs"))).startRecording}function xU(){return $t().Profiler!==void 0}const kU=e=>{let t={status:"starting"};return e.register(0,({eventType:r})=>r!==ne.VIEW&&r!==ne.LONG_TASK?kt:{type:r,_dd:{profiling:t}}),{get:()=>t,set:r=>{t=r}}};async function SU(e=IU){try{return await e()}catch(t){jm({error:t,source:"Profiler",scriptType:"module"})}}async function IU(){return(await Promise.resolve().then(()=>require("./profiler-Ce0O8-iW.cjs"))).createRumProfiler}function EU(){let e;function t(r,a,n,o,i,s){const l=o.findTrackedSession();if(!l||!gk(l.id,n.profilingSampleRate))return;const c=kU(a);if(!xU()){c.set({status:"error",error_reason:"not-supported-by-browser"});return}SU().then(u=>{if(!u){Xn("[DD_RUM] Failed to lazy load the RUM Profiler"),c.set({status:"error",error_reason:"failed-to-lazy-load"});return}e=u(n,r,o,c,s),e.start(i.findView())}).catch(ir)}return{onRumStart:t,stop:()=>{e?.stop().catch(ir)}}}const TU=yU(wU),$U=EU(),ka=v4(HM,TU,$U,{startDeflateWorker:cS,createDeflateEncoder:sS,sdkName:"rum"});Xj($t(),"DD_RUM",ka);const ma={applicationId:"0b0a19b9-099b-4812-b342-930518330975",clientToken:"puba92c09799d321f572535176e9fe08256",site:"datadoghq.com",env:"prod",service:"gram-elements"};let Hc=!1,Jc=!0;function OU(e={}){if(e.enabled===!1){Jc=!1;return}if(!Hc)try{ka.init({applicationId:ma.applicationId,clientToken:ma.clientToken,site:ma.site,service:ma.service,env:ma.env,sessionSampleRate:100,sessionReplaySampleRate:100,trackUserInteractions:!0,trackResources:!0,trackLongTasks:!0,defaultPrivacyLevel:"mask"}),e.projectSlug&&ka.setGlobalContextProperty("projectSlug",e.projectSlug),e.variant&&ka.setGlobalContextProperty("variant",e.variant),Hc=!0}catch(t){console.warn("[Elements] Failed to initialize Datadog RUM:",t),Jc=!1}}function Ua(e,t){if(!Jc||!Hc)return;const r=e instanceof Error?e:new Error(String(e));try{ka.addError(r,{...t,timestamp:new Date().toISOString()})}catch(a){console.warn("[Elements] Failed to track error:",a)}}function CU({auth:e,mcp:t,mcps:r,environment:a,toolsToInclude:n,gramEnvironment:o}){const i=T.useMemo(()=>NU(t,r,o),[t,r,o]),s=Object.entries(a??{}).map(([b,w])=>`${b}:${w}`),l=Object.entries(e.headers??{}).map(([b,w])=>`${b}:${w}`),c=i.map(b=>`${b.url}|${b.name??""}|${b.environment??""}`),u=T.useRef([]),d=T.useRef(!1),m=T.useRef(null);m.current||(m.current=new Proxy({},{set(b,w,x){for(const k of u.current)k[w]=x;return!0},deleteProperty(b,w){for(const x of u.current)delete x[w];return!0}}));const f=m.current,g=ax({queryKey:["mcpTools",c,s,l],queryFn:async()=>{v.assert(!e.isLoading,"No auth found"),v.assert(i.length>0,"No MCP server configured");const b=RU(a??{}),w=e.headers??{},x=i.map(E=>({server:E,headers:{...b,...w,...E.environment&&{"Gram-Environment":E.environment}}}));u.current=x.map(E=>E.headers);const k=await Promise.allSettled(x.map(async({server:E,headers:A})=>{const F=await IA({name:"gram-elements-mcp-client",transport:{type:"http",url:E.url,headers:A}});return{server:E,tools:await F.tools()}})),y={},$=i.length>1;let I=0;for(const[E,{server:A}]of x.entries()){const F=k[E];if(F.status==="rejected"){I++,Ua(F.reason,{source:"custom",scope:"mcp-tools",serverName:A.name??cg(A.url),serverUrl:A.url});continue}const q=$?A.name??cg(A.url):null;for(const[ee,Ne]of Object.entries(F.value.tools)){const te=q?`${q}__${ee}`:ee;y[te]=Ne}}if(d.current=I>0&&I<x.length,I>0&&I===x.length){const E=k.find(A=>A.status==="rejected");throw E?.reason instanceof Error?E.reason:new Error("All MCP servers failed to list tools")}return y},enabled:!e.isLoading&&i.length>0,staleTime:()=>d.current?0:1/0,gcTime:1/0}),h=T.useMemo(()=>!g.data||!n?g.data:Object.fromEntries(Object.entries(g.data).filter(([b])=>typeof n=="function"?n({toolName:b}):n.includes(b))),[g.data,n]);return{...g,data:h,mcpHeaders:f}}function NU(e,t,r){return t&&t.length>0?(e&&AU(),t.map(a=>({url:a.url,name:a.name,environment:a.environment}))):e?[{url:e,name:void 0,environment:r}]:[]}let lg=!1;function AU(){lg||(lg=!0,console.warn("[gram-elements] Both `mcp` and `mcps` are set on ElementsConfig; `mcps` takes precedence and `mcp` is ignored."))}function cg(e){let t;try{t=new URL(e).pathname}catch{t=e}return(t.split("/mcp/")[1]??t).replace(/^\/+|\/+$/g,"").replace(/[^a-zA-Z0-9_-]+/g,"_")||"mcp"}const ug="MCP-";function RU(e){return typeof e!="object"||e===null?{}:Object.entries(e).reduce((t,[r,a])=>{const n=r.replace(/_/g,"-"),o=n.startsWith(ug)?n:`${ug}${n}`;return t[o]=a,t},{})}const dS=()=>{const e=T.useContext(v.ToolApprovalContext);if(!e)throw new Error("useToolApproval must be used within a ToolApprovalProvider");return e};function ml(e){return(e.api?.url||""||"https://app.getgram.ai").replace(/\/+$/,"")}const pl=["anthropic/claude-opus-4.6","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet-4.5","anthropic/claude-opus-4.5","anthropic/claude-haiku-4.5","anthropic/claude-opus-4.1","anthropic/claude-sonnet-4","openai/gpt-5.4","openai/gpt-5.4-mini","openai/gpt-5.1","openai/gpt-5.1-codex","openai/gpt-5","openai/gpt-4.1","openai/o4-mini","openai/o3","google/gemini-3.1-pro-preview","google/gemini-2.5-pro","google/gemini-2.5-flash","deepseek/deepseek-r1","deepseek/deepseek-v3.2","meta-llama/llama-4-maverick","x-ai/grok-4","qwen/qwen3-coder","moonshotai/kimi-k2.5","mistralai/mistral-medium-3.1","mistralai/codestral-2508","mistralai/devstral-small"],jU=e=>Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r.description?{description:r.description}:void 0,parameters:r.parameters instanceof ef.ZodType?ef.toJSONSchema(r.parameters):r.parameters}])),PU=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>!t.disabled&&t.type!=="backend"));let Fi=null;function zU(e,t){const r=mS(t);Fi={helpers:e,requiresApproval:r}}function DU(){Fi=null}function mS(e){if(!e)return()=>!1;if(typeof e=="function")return r=>e({toolName:r});const t=new Set(e);return r=>t.has(r)}const MU=(e,t)=>P.makeAssistantTool({...e,execute:async(r,a)=>{if(Fi?.requiresApproval(t)){const{helpers:n}=Fi,o=a.toolCallId??"";if(!n.isToolApproved(t)&&!await n.requestApproval(t,o,r))return{content:[{type:"text",text:`Tool "${t}" execution was denied by the user. Please acknowledge this and continue without using this tool's result.`}],isError:!0}}return e.execute?.(r,a)},toolName:t}),UU=.9;function dg(e,t){if(t<=0)return e;const r=e,a=new TextEncoder().encode(r);if(a.byteLength<=t)return r;const n=`
|
|
39
|
+
`,r:"\r",t:" "};function a4(e){return e.startsWith("u")?String.fromCharCode(parseInt(e.slice(1),16)):n4[e]}const o4="v1",i4=["applicationId","service","env","version","sessionSampleRate","sessionReplaySampleRate","defaultPrivacyLevel","enablePrivacyForActionName","traceSampleRate","trackSessionAcrossSubdomains","allowedTracingUrls","allowedTrackingOrigins"];async function s4(e,t){let r;const a=c4(),n=await p4(e);return n.ok?(a.increment("fetch","success"),r=l4(e,n.value,t,a)):(a.increment("fetch","failure"),Q.error(n.error)),Ao("remote configuration metrics",{metrics:a.get()}),r}function l4(e,t,r,a){const n={...e};return i4.forEach(m=>{m in t&&(n[m]=o(t[m]))}),Object.keys(r).forEach(m=>{t[m]!==void 0&&i(r[m],t[m])}),n;function o(m){if(Array.isArray(m))return m.map(o);if(u4(m)){if(d4(m)){const f=m.rcSerializedType;switch(f){case"string":return m.value;case"regex":return yk(m.value);case"dynamic":return s(m);default:Q.error(`Unsupported remote configuration: "rcSerializedType": "${f}"`);return}}return ix(m,o)}return m}function i(m,f){f.forEach(({key:g,value:h})=>{m.setContextProperty(g,o(h))})}function s(m){const f=m.strategy;let g;switch(f){case"cookie":g=l(m);break;case"dom":g=c(m);break;case"js":g=d(m);break;default:Q.error(`Unsupported remote configuration: "strategy": "${f}"`);return}const h=m.extractor;return h!==void 0&&typeof g=="string"?m4(h,g):g}function l({name:m}){const f=tl(m);return a.increment("cookie",f!==void 0?"success":"missing"),f}function c({selector:m,attribute:f}){let g;try{g=document.querySelector(m)}catch{Q.error(`Invalid selector in the remote configuration: '${m}'`),a.increment("dom","failure");return}if(!g){a.increment("dom","missing");return}if(u(g,f)){Q.error(`Forbidden element selected by the remote configuration: '${m}'`),a.increment("dom","failure");return}const h=f!==void 0?g.getAttribute(f):g.textContent;if(h===null){a.increment("dom","missing");return}return a.increment("dom","success"),h}function u(m,f){return m.getAttribute("type")==="password"&&f==="value"}function d({path:m}){let f=window;const g=H2(m);if(g.length===0){Q.error(`Invalid JSON path in the remote configuration: '${m}'`),a.increment("js","failure");return}for(const h of g){if(!(h in f)){a.increment("js","missing");return}try{f=f[h]}catch(b){Q.error(`Error accessing: '${m}'`,b),a.increment("js","failure");return}}return a.increment("js","success"),f}}function c4(){const e={fetch:{}};return{get:()=>e,increment:(t,r)=>{e[t]||(e[t]={}),e[t][r]||(e[t][r]=0),e[t][r]=e[t][r]+1}}}function u4(e){return typeof e=="object"&&e!==null}function d4(e){return"rcSerializedType"in e}function yk(e){try{return new RegExp(e)}catch{Q.error(`Invalid regex in the remote configuration: '${e}'`)}}function m4(e,t){const r=yk(e.value);if(r===void 0)return;const a=r.exec(t);if(a===null)return;const[n,o]=a;return o||n}async function p4(e){let t;try{t=await fetch(f4(e))}catch{t=void 0}if(!t||!t.ok)return{ok:!1,error:new Error("Error fetching the remote configuration.")};const r=await t.json();return r.rum?{ok:!0,value:r.rum}:{ok:!1,error:new Error("No remote configuration for RUM.")}}function f4(e){return e.remoteConfigurationProxy?e.remoteConfigurationProxy:`https://sdk-configuration.${Cx("rum",e)}/${o4}/${encodeURIComponent(e.remoteConfigurationId)}.json`}function g4({ignoreInitIfSyntheticsWillInjectRum:e=!0,startDeflateWorker:t},r,a,n){const o=w2(),i=ck();Hl(i,He.globalContext,o);const s=uk();Hl(s,He.userContext,o);const l=lk();Hl(l,He.accountContext,o);let c,u,d,m;const f=r.observable.subscribe(h),g={};function h(){if(!d||!m||!r.isGranted())return;f.unsubscribe();let y;if(m.trackViewsManually){if(!c)return;o.remove(c.callback),y=c.options}const $=n(m,u,y);o.drain($)}function b(y,$){const I=Gr();if(I&&(y=h4(y)),d=y,PP(G2(y)),m){Mx("DD_RUM",y);return}const E=L2(y,$);if(E){if(!I&&!E.sessionStoreStrategyType){Q.warn("No storage available for session. We will not send any data.");return}E.compressIntakeRequests&&!I&&t&&(u=t(E,"Datadog RUM",ve),!u)||(m=E,ik().subscribe(ve),r.tryToInit(E.trackingConsent),h())}}const w=y=>{o.add($=>$.addDurationVital(y))};return{init(y,$,I){if(!y){Q.error("Missing configuration");return}yj(y.enableExperimentalFeatures),d=y,!(e&&ek())&&(fk(y.plugins,"onInit",{initConfiguration:y,publicApi:$}),y.remoteConfigurationId?s4(y,{user:s,context:i}).then(E=>{E&&b(E,I)}).catch(ir):b(y,I))},get initConfiguration(){return d},getInternalContext:ve,stopSession:ve,addTiming(y,$=Je()){o.add(I=>I.addTiming(y,$))},startView(y,$=qe()){const I=E=>{E.startView(y,$)};o.add(I),c||(c={options:y,callback:I},h())},setViewName(y){o.add($=>$.setViewName(y))},setViewContext(y){o.add($=>$.setViewContext(y))},setViewContextProperty(y,$){o.add(I=>I.setViewContextProperty(y,$))},getViewContext:()=>g,globalContext:i,userContext:s,accountContext:l,addAction(y){o.add($=>$.addAction(y))},addError(y){o.add($=>$.addError(y))},addFeatureFlagEvaluation(y,$){o.add(I=>I.addFeatureFlagEvaluation(y,$))},startDurationVital(y,$){return mk(a,y,$)},stopDurationVital(y,$){pk(w,a,y,$)},addDurationVital:w,addOperationStepVital:(y,$,I,E)=>{o.add(A=>A.addOperationStepVital(Ce(y),$,Ce(I),Ce(E)))}}}function h4(e){var t,r;return{...e,applicationId:"00000000-aaaa-0000-aaaa-000000000000",clientToken:"empty",sessionSampleRate:100,defaultPrivacyLevel:(t=e.defaultPrivacyLevel)!==null&&t!==void 0?t:(r=Kn())===null||r===void 0?void 0:r.getPrivacyLevel()}}function Hl(e,t,r){e.changeObservable.subscribe(()=>{const a=e.getContext();r.add(n=>n[t].setContext(a))})}function v4(e,t,r,a={}){const n=XR(),o=N2(),i=O2().observable;let s=g4(a,n,o,(d,m,f)=>{const g=m&&a.createDeflateEncoder?b=>a.createDeflateEncoder(d,m,b):YP,h=e(d,t,r,f,g,n,o,i,a.sdkName);return t.onRumStart(h.lifeCycle,d,h.session,h.viewHistory,m,h.telemetry),r.onRumStart(h.lifeCycle,h.hooks,d,h.session,h.viewHistory,g),s=b4(s,h),fk(d.plugins,"onRumStart",{strategy:s,addEvent:h.addEvent}),h});const l=()=>s,c=oe(d=>{const m=typeof d=="object"?d:{name:d};s.startView(m),Ge({feature:"start-view"})}),u=Yj({init:d=>{const m=new Error().stack;yr(()=>s.init(d,u,m))},setTrackingConsent:oe(d=>{n.update(d),Ge({feature:"set-tracking-consent",tracking_consent:d})}),setViewName:oe(d=>{s.setViewName(d),Ge({feature:"set-view-name"})}),setViewContext:oe(d=>{s.setViewContext(d),Ge({feature:"set-view-context"})}),setViewContextProperty:oe((d,m)=>{s.setViewContextProperty(d,m),Ge({feature:"set-view-context-property"})}),getViewContext:oe(()=>(Ge({feature:"set-view-context-property"}),s.getViewContext())),getInternalContext:oe(d=>s.getInternalContext(d)),getInitConfiguration:oe(()=>km(s.initConfiguration)),addAction:(d,m)=>{const f=Mi("action");yr(()=>{s.addAction({name:Ce(d),context:Ce(m),startClocks:qe(),type:sl.CUSTOM,handlingStack:f}),Ge({feature:"add-action"})})},addError:(d,m)=>{const f=Mi("error");yr(()=>{s.addError({error:d,handlingStack:f,context:Ce(m),startClocks:qe()}),Ge({feature:"add-error"})})},addTiming:oe((d,m)=>{s.addTiming(Ce(d),m)}),setGlobalContext:st(l,He.globalContext,lt.setContext,"set-global-context"),getGlobalContext:st(l,He.globalContext,lt.getContext,"get-global-context"),setGlobalContextProperty:st(l,He.globalContext,lt.setContextProperty,"set-global-context-property"),removeGlobalContextProperty:st(l,He.globalContext,lt.removeContextProperty,"remove-global-context-property"),clearGlobalContext:st(l,He.globalContext,lt.clearContext,"clear-global-context"),setUser:st(l,He.userContext,lt.setContext,"set-user"),getUser:st(l,He.userContext,lt.getContext,"get-user"),setUserProperty:st(l,He.userContext,lt.setContextProperty,"set-user-property"),removeUserProperty:st(l,He.userContext,lt.removeContextProperty,"remove-user-property"),clearUser:st(l,He.userContext,lt.clearContext,"clear-user"),setAccount:st(l,He.accountContext,lt.setContext,"set-account"),getAccount:st(l,He.accountContext,lt.getContext,"get-account"),setAccountProperty:st(l,He.accountContext,lt.setContextProperty,"set-account-property"),removeAccountProperty:st(l,He.accountContext,lt.removeContextProperty,"remove-account-property"),clearAccount:st(l,He.accountContext,lt.clearContext,"clear-account"),startView:c,stopSession:oe(()=>{s.stopSession(),Ge({feature:"stop-session"})}),addFeatureFlagEvaluation:oe((d,m)=>{s.addFeatureFlagEvaluation(Ce(d),Ce(m)),Ge({feature:"add-feature-flag-evaluation"})}),getSessionReplayLink:oe(()=>t.getSessionReplayLink()),startSessionReplayRecording:oe(d=>{t.start(d),Ge({feature:"start-session-replay-recording",force:d&&d.force})}),stopSessionReplayRecording:oe(()=>t.stop()),addDurationVital:oe((d,m)=>{Ge({feature:"add-duration-vital"}),s.addDurationVital({name:Ce(d),type:Ma.DURATION,startClocks:mR(m.startTime),duration:m.duration,context:Ce(m&&m.context),description:Ce(m&&m.description)})}),startDurationVital:oe((d,m)=>(Ge({feature:"start-duration-vital"}),s.startDurationVital(Ce(d),{context:Ce(m&&m.context),description:Ce(m&&m.description)}))),stopDurationVital:oe((d,m)=>{Ge({feature:"stop-duration-vital"}),s.stopDurationVital(typeof d=="string"?Ce(d):d,{context:Ce(m&&m.context),description:Ce(m&&m.description)})}),startFeatureOperation:oe((d,m)=>{Ge({feature:"add-operation-step-vital",action_type:"start"}),s.addOperationStepVital(d,"start",m)}),succeedFeatureOperation:oe((d,m)=>{Ge({feature:"add-operation-step-vital",action_type:"succeed"}),s.addOperationStepVital(d,"end",m)}),failFeatureOperation:oe((d,m,f)=>{Ge({feature:"add-operation-step-vital",action_type:"fail"}),s.addOperationStepVital(d,"end",f,m)})});return u}function b4(e,t){return{init:r=>{Mx("DD_RUM",r)},initConfiguration:e.initConfiguration,...t}}function y4(){const e=wk();return new ge(t=>{if(!e)return;const r=new e(oe(a=>t.notify(a)));return r.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),()=>r.disconnect()})}function wk(){let e;const t=window;if(t.Zone&&(e=kr(t,"MutationObserver"),t.MutationObserver&&e===t.MutationObserver)){const r=new t.MutationObserver(ve),a=kr(r,"originalInstance");e=a&&a.constructor}return e||(e=t.MutationObserver),e}function w4(){const e=new ge,{stop:t}=Vt(window,"open",()=>e.notify());return{observable:e,stop:t}}function _4(e,t,r,a,n){return{get:o=>{const i=r.findView(o),s=n.findUrl(o),l=t.findTrackedSession(o);if(l&&i&&s){const c=a.findActionId(o);return{application_id:e,session_id:l.id,user_action:c?{id:c}:void 0,view:{id:i.id,name:i.name,referrer:s.referrer,url:s.url}}}}}}const x4=XP,k4=tn;function S4(e){const t=Qn({expireDelay:k4});e.subscribe(1,a=>{t.add(r(a),a.startClocks.relative)}),e.subscribe(6,({endClocks:a})=>{t.closeActive(a.relative)}),e.subscribe(3,a=>{const n=t.find(a.startClocks.relative);n&&(a.name&&(n.name=a.name),a.context&&(n.context=a.context),n.sessionIsActive=a.sessionIsActive)}),e.subscribe(10,()=>{t.reset()});function r(a){return{service:a.service,version:a.version,context:a.context,id:a.id,name:a.name,startClocks:a.startClocks}}return{findView:a=>t.find(a),stop:()=>{t.stop()}}}const _k="initial_document",I4=[[dt.DOCUMENT,e=>_k===e],[dt.XHR,e=>e==="xmlhttprequest"],[dt.FETCH,e=>e==="fetch"],[dt.BEACON,e=>e==="beacon"],[dt.CSS,(e,t)=>/\.css$/i.test(t)],[dt.JS,(e,t)=>/\.js$/i.test(t)],[dt.IMAGE,(e,t)=>["image","img","icon"].includes(e)||/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(t)!==null],[dt.FONT,(e,t)=>/\.(woff|eot|woff2|ttf)$/i.exec(t)!==null],[dt.MEDIA,(e,t)=>["audio","video"].includes(e)||/\.(mp3|mp4)$/i.exec(t)!==null]];function E4(e){const t=e.name;if(!_R(t))return dt.OTHER;const r=xR(t);for(const[a,n]of I4)if(n(e.initiatorType,r))return a;return dt.OTHER}function zf(...e){for(let t=1;t<e.length;t+=1)if(e[t-1]>e[t])return!1;return!0}function xk(e){return e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch"}function T4(e){const{duration:t,startTime:r,responseEnd:a}=e;return t===0&&r<a?De(r,a):t}function $4(e){if(!Sk(e))return;const{startTime:t,fetchStart:r,workerStart:a,redirectStart:n,redirectEnd:o,domainLookupStart:i,domainLookupEnd:s,connectStart:l,secureConnectionStart:c,connectEnd:u,requestStart:d,responseStart:m,responseEnd:f}=e,g={download:Nr(t,m,f),first_byte:Nr(t,d,m)};return 0<a&&a<r&&(g.worker=Nr(t,a,r)),r<u&&(g.connect=Nr(t,l,u),l<=c&&c<=u&&(g.ssl=Nr(t,c,u))),r<s&&(g.dns=Nr(t,i,s)),t<o&&(g.redirect=Nr(t,n,o)),g}function kk(e){return e.duration>=0}function Sk(e){const t=zf(e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd),r=O4(e)?zf(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart):!0;return t&&r}function O4(e){return e.redirectEnd>e.startTime}function Nr(e,t,r){if(e<=t&&t<=r)return{duration:ie(De(t,r)),start:ie(De(e,t))}}function C4(e){return e.nextHopProtocol===""?void 0:e.nextHopProtocol}function N4(e){return e.deliveryType===""?"other":e.deliveryType}function A4(e){if(e.startTime<e.responseStart){const{encodedBodySize:t,decodedBodySize:r,transferSize:a}=e;return{size:r,encoded_body_size:t,decoded_body_size:r,transfer_size:a}}return{size:void 0,encoded_body_size:void 0,decoded_body_size:void 0,transfer_size:void 0}}function Om(e){return e&&(!gj(e)||Oo(Sr.TRACK_INTAKE_REQUESTS))}const R4=/data:(.+)?(;base64)?,/g,j4=24e3;function Ik(e,t=j4){if(e.length<=t||!e.startsWith("data:"))return e;const r=e.substring(0,100).match(R4);return r?`${r[0]}[...]`:e}const P4=32*nn;function z4(e,t){const r=M4(e.requestBody,t.trackPayload);if(r){if(t.trackResponseErrors&&e.responseBody){const a=D4(e.responseBody);a&&(r.errors_count=a.length,r.errors=a)}return r}}function D4(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!="object")return;const r=t;return Vr(r.errors)?r.errors.map(n=>{var o;return{message:n.message,path:n.path,locations:n.locations,code:(o=n.extensions)===null||o===void 0?void 0:o.code}}):void 0}function Ek(e,t){return t.allowedGraphQlUrls.find(r=>al([r.match],e))}function M4(e,t=!1){if(!e||typeof e!="string")return;let r;try{r=JSON.parse(e)}catch{return}if(!r||!r.query)return;const a=r.query.trim(),n=U4(a),o=r.operationName;if(!n)return;let i;return r.variables&&(i=JSON.stringify(r.variables)),{operationType:n,operationName:o,variables:i,payload:t?hm(a,P4,"..."):void 0}}function U4(e){var t;return(t=e.match(/^\s*(query|mutation|subscription)\b/i))===null||t===void 0?void 0:t[1]}let Df=1;function L4(e,t,r,a,n){const o=M2(t,r,a,n);F4(e,t,o),V4(e,t,o)}function F4(e,t,r){const a=t2(t).subscribe(n=>{const o=n;if(Om(o.url))switch(o.state){case"start":r.traceXhr(o,o.xhr),o.requestIndex=Tk(),e.notify(7,{requestIndex:o.requestIndex,url:o.url});break;case"complete":r.clearTracingIfNeeded(o),e.notify(8,{duration:o.duration,method:o.method,requestIndex:o.requestIndex,spanId:o.spanId,startClocks:o.startClocks,status:o.status,traceId:o.traceId,traceSampled:o.traceSampled,type:il.XHR,url:o.url,xhr:o.xhr,isAborted:o.isAborted,handlingStack:o.handlingStack,requestBody:o.requestBody,responseBody:o.responseBody});break}});return{stop:()=>a.unsubscribe()}}function V4(e,t,r){const a=ik({responseBodyAction:n=>{var o;return!((o=Ek(n.url,t))===null||o===void 0)&&o.trackResponseErrors?2:1}}).subscribe(n=>{var o;const i=n;if(Om(i.url))switch(i.state){case"start":r.traceFetch(i),i.requestIndex=Tk(),e.notify(7,{requestIndex:i.requestIndex,url:i.url});break;case"resolve":r.clearTracingIfNeeded(i),e.notify(8,{duration:De(i.startClocks.timeStamp,Je()),method:i.method,requestIndex:i.requestIndex,responseType:i.responseType,spanId:i.spanId,startClocks:i.startClocks,status:i.status,traceId:i.traceId,traceSampled:i.traceSampled,type:il.FETCH,url:i.url,response:i.response,init:i.init,input:i.input,isAborted:i.isAborted,handlingStack:i.handlingStack,requestBody:(o=i.init)===null||o===void 0?void 0:o.body,responseBody:i.responseBody});break}});return{stop:()=>a.unsubscribe()}}function Tk(){const e=Df;return Df+=1,e}function $k(e){return So(e)&&e<0?void 0:e}function Ok({lifeCycle:e,isChildEvent:t,onChange:r=ve}){const a={errorCount:0,longTaskCount:0,resourceCount:0,actionCount:0,frustrationCount:0},n=e.subscribe(13,o=>{var i;if(!(o.type==="view"||o.type==="vital"||!t(o)))switch(o.type){case ne.ERROR:a.errorCount+=1,r();break;case ne.ACTION:a.actionCount+=1,o.action.frustration&&(a.frustrationCount+=o.action.frustration.type.length),r();break;case ne.LONG_TASK:a.longTaskCount+=1,r();break;case ne.RESOURCE:!((i=o._dd)===null||i===void 0)&&i.discarded||(a.resourceCount+=1,r());break}});return{stop:()=>{n.unsubscribe()},eventCounts:a}}function Z4(e,t){const r=ft();let a=!1;const{stop:n}=lr(e,window,["click","mousedown","keydown","touchstart","pointerdown"],s=>{if(!s.cancelable)return;const l={entryType:"first-input",processingStart:xt(),processingEnd:xt(),startTime:s.timeStamp,duration:0,name:"",cancelable:!1,target:null,toJSON:()=>({})};s.type==="pointerdown"?o(e,l):i(l)},{passive:!0,capture:!0});return{stop:n};function o(s,l){lr(s,window,["pointerup","pointercancel"],c=>{c.type==="pointerup"&&i(l)},{once:!0})}function i(s){if(!a){a=!0,n();const l=s.processingStart-s.startTime;l>=0&&l<ft()-r&&t(s)}}}exports.RumPerformanceEntryType=void 0;(function(e){e.EVENT="event",e.FIRST_INPUT="first-input",e.LARGEST_CONTENTFUL_PAINT="largest-contentful-paint",e.LAYOUT_SHIFT="layout-shift",e.LONG_TASK="longtask",e.LONG_ANIMATION_FRAME="long-animation-frame",e.NAVIGATION="navigation",e.PAINT="paint",e.RESOURCE="resource",e.VISIBILITY_STATE="visibility-state"})(exports.RumPerformanceEntryType||(exports.RumPerformanceEntryType={}));function Qt(e,t){return new ge(r=>{if(!window.PerformanceObserver)return;const a=l=>{const c=G4(l);c.length>0&&r.notify(c)};let n,o=!0;const i=new PerformanceObserver(oe(l=>{o?n=Qe(()=>a(l.getEntries())):a(l.getEntries())}));try{i.observe(t)}catch{if([exports.RumPerformanceEntryType.RESOURCE,exports.RumPerformanceEntryType.NAVIGATION,exports.RumPerformanceEntryType.LONG_TASK,exports.RumPerformanceEntryType.PAINT].includes(t.type)){t.buffered&&(n=Qe(()=>a(performance.getEntriesByType(t.type))));try{i.observe({entryTypes:[t.type]})}catch{return}}}o=!1,q4(e);let s;return!Or(exports.RumPerformanceEntryType.FIRST_INPUT)&&t.type===exports.RumPerformanceEntryType.FIRST_INPUT&&({stop:s}=Z4(e,l=>{a([l])})),()=>{i.disconnect(),s&&s(),_t(n)}})}let ua;function q4(e){return!ua&&B4()&&"addEventListener"in performance&&(ua=je(e,performance,"resourcetimingbufferfull",()=>{performance.clearResourceTimings()})),()=>{ua?.stop()}}function B4(){return window.performance!==void 0&&"getEntries"in performance}function Or(e){return window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes!==void 0&&PerformanceObserver.supportedEntryTypes.includes(e)}function G4(e){return e.filter(t=>!H4(t))}function H4(e){return e.entryType===exports.RumPerformanceEntryType.RESOURCE&&(!Om(e.name)||!kk(e))}function qc(e){return e.nodeType===Node.TEXT_NODE}function J4(e){return e.nodeType===Node.COMMENT_NODE}function ur(e){return e.nodeType===Node.ELEMENT_NODE}function Cm(e){return ur(e)&&!!e.shadowRoot}function Ck(e){const t=e;return!!t.host&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&ur(t.host)}function W4(e){return e.childNodes.length>0||Cm(e)}function K4(e,t){let r=e.firstChild;for(;r;)t(r),r=r.nextSibling;Cm(e)&&t(e.shadowRoot)}function Nk(e){return Ck(e)?e.host:e.parentNode}const Ak=100,Y4=100,Mf="data-dd-excluded-activity-mutations";function Nm(e,t,r,a,n,o){const i=Q4(e,t,r,a);return X4(i,n,o)}function X4(e,t,r){let a,n=!1;const o=Qe(oe(()=>c({hadActivity:!1})),Ak),i=r!==void 0?Qe(oe(()=>c({hadActivity:!0,end:Je()})),r):void 0,s=e.subscribe(({isBusy:u})=>{_t(o),_t(a);const d=Je();u||(a=Qe(oe(()=>c({hadActivity:!0,end:d})),Y4))}),l=()=>{n=!0,_t(o),_t(a),_t(i),s.unsubscribe()};function c(u){n||(l(),t(u))}return{stop:l}}function Q4(e,t,r,a){return new ge(n=>{const o=[];let i,s=0;return o.push(t.subscribe(c=>{c.every(ez)||l()}),r.subscribe(l),Qt(a,{type:exports.RumPerformanceEntryType.RESOURCE}).subscribe(c=>{c.some(u=>!Jl(a,u.name))&&l()}),e.subscribe(7,c=>{Jl(a,c.url)||(i===void 0&&(i=c.requestIndex),s+=1,l())}),e.subscribe(8,c=>{Jl(a,c.url)||i===void 0||c.requestIndex<i||(s-=1,l())})),()=>{o.forEach(c=>c.unsubscribe())};function l(){n.notify({isBusy:s>0})}})}function Jl(e,t){return al(e.excludedActivityUrls,t)}function ez(e){const t=e.type==="characterData"?e.target.parentElement:e.target;return!!(t&&ur(t)&&t.matches(`[${Mf}], [${Mf}] *`))}const ll="data-dd-action-name",Rk="Masked Element",jk=[ll,"data-testid","data-test","data-qa","data-cy","data-test-id","data-qa-id","data-testing","data-component","data-element","data-source-file"],tz=[zk,nz],rz=[zk,az,oz];function Ro(e,t){if(!e.isConnected)return;let r,a=e;for(;a&&a.nodeName!=="HTML";){const n=Uf(a,tz,sz,t,r);if(n)return n;r=Uf(a,rz,lz,t,r)||cl(iz(a),r),a=a.parentElement}return r}function Pk(e){return/[0-9]/.test(e)}function nz(e){if(e.id&&!Pk(e.id))return`#${CSS.escape(e.id)}`}function az(e){if(e.tagName==="BODY")return;const t=e.classList;for(let r=0;r<t.length;r+=1){const a=t[r];if(!Pk(a))return`${CSS.escape(e.tagName)}.${CSS.escape(a)}`}}function oz(e){return CSS.escape(e.tagName)}function zk(e,t){if(t){const a=r(t);if(a)return a}for(const a of jk){const n=r(a);if(n)return n}function r(a){if(e.hasAttribute(a))return`${CSS.escape(e.tagName)}[${a}="${CSS.escape(e.getAttribute(a))}"]`}}function iz(e){let t=e.parentElement.firstElementChild,r=1;for(;t&&t!==e;)t.tagName===e.tagName&&(r+=1),t=t.nextElementSibling;return`${CSS.escape(e.tagName)}:nth-of-type(${r})`}function Uf(e,t,r,a,n){for(const o of t){const i=o(e,a);if(i&&r(e,i,n))return cl(i,n)}}function sz(e,t,r){return e.ownerDocument.querySelectorAll(cl(t,r)).length===1}function lz(e,t,r){let a;if(r===void 0)a=i=>i.matches(t);else{const i=cl(`${t}:scope`,r);a=s=>s.querySelector(i)!==null}let o=e.parentElement.firstElementChild;for(;o;){if(o!==e&&a(o))return!1;o=o.nextElementSibling}return!0}function cl(e,t){return t?`${e}>${t}`:e}const ce={IGNORE:"ignore",HIDDEN:"hidden",ALLOW:bn.ALLOW,MASK:bn.MASK,MASK_USER_INPUT:bn.MASK_USER_INPUT,MASK_UNLESS_ALLOWLISTED:bn.MASK_UNLESS_ALLOWLISTED},Am="data-dd-privacy",cz="hidden",uz="dd-privacy-",ui="***",dz="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",mz={INPUT:!0,OUTPUT:!0,TEXTAREA:!0,SELECT:!0,OPTION:!0,DATALIST:!0,OPTGROUP:!0},pz="x";function Pr(e){return`[${Am}="${e}"], .${uz}${e}`}function jo(e,t,r){if(r&&r.has(e))return r.get(e);const a=Nk(e),n=a?jo(a,t,r):t,o=Mk(e),i=Dk(o,n);return r&&r.set(e,i),i}function Dk(e,t){switch(t){case ce.HIDDEN:case ce.IGNORE:return t}switch(e){case ce.ALLOW:case ce.MASK:case ce.MASK_USER_INPUT:case ce.MASK_UNLESS_ALLOWLISTED:case ce.HIDDEN:case ce.IGNORE:return e;default:return t}}function Mk(e){if(ur(e)){if(e.tagName==="BASE")return ce.ALLOW;if(e.tagName==="INPUT"){const t=e;if(t.type==="password"||t.type==="email"||t.type==="tel"||t.type==="hidden")return ce.MASK;const r=t.getAttribute("autocomplete");if(r&&(r.startsWith("cc-")||r.endsWith("-password")))return ce.MASK}if(e.matches(Pr(ce.HIDDEN)))return ce.HIDDEN;if(e.matches(Pr(ce.MASK)))return ce.MASK;if(e.matches(Pr(ce.MASK_UNLESS_ALLOWLISTED)))return ce.MASK_UNLESS_ALLOWLISTED;if(e.matches(Pr(ce.MASK_USER_INPUT)))return ce.MASK_USER_INPUT;if(e.matches(Pr(ce.ALLOW)))return ce.ALLOW;if(gz(e))return ce.IGNORE}}function Rm(e,t){switch(t){case ce.MASK:case ce.HIDDEN:case ce.IGNORE:return!0;case ce.MASK_UNLESS_ALLOWLISTED:return qc(e)?ti(e.parentNode)?!0:!Fk(e.textContent||""):ti(e);case ce.MASK_USER_INPUT:return qc(e)?ti(e.parentNode):ti(e);default:return!1}}function Uk(e,t,r,a,n){if(a!==ce.MASK&&a!==ce.MASK_UNLESS_ALLOWLISTED||t===Am||jk.includes(t)||t===n.actionNameAttribute)return!1;switch(t){case"title":case"alt":case"placeholder":return!0}return!!(e==="A"&&t==="href"||e==="IFRAME"&&t==="srcdoc"||r&&t.startsWith("data-")||(e==="IMG"||e==="SOURCE")&&(t==="src"||t==="srcset"))}function ti(e){if(!e||e.nodeType!==e.ELEMENT_NODE)return!1;const t=e;if(t.tagName==="INPUT")switch(t.type){case"button":case"color":case"reset":case"submit":return!1}return!!mz[t.tagName]}const Lk=e=>e.replace(/\S/g,pz);function fz(e,t){var r;const a=(r=e.parentElement)===null||r===void 0?void 0:r.tagName;let n=e.textContent||"";if(a==="HEAD"&&!n.trim())return;const i=t;if(a==="SCRIPT")n=ui;else if(i===ce.HIDDEN)n=ui;else if(Rm(e,i))if(a==="DATALIST"||a==="SELECT"||a==="OPTGROUP"){if(!n.trim())return}else a==="OPTION"?n=ui:i===ce.MASK_UNLESS_ALLOWLISTED?n=Vk(n):n=Lk(n);return n}function gz(e){if(e.nodeName==="SCRIPT")return!0;if(e.nodeName==="LINK"){const r=t("rel");return/preload|prefetch/i.test(r)&&t("as")==="script"||r==="shortcut icon"||r==="icon"}if(e.nodeName==="META"){const r=t("name"),a=t("rel"),n=t("property");return/^msapplication-tile(image|color)$/.test(r)||r==="application-name"||a==="icon"||a==="apple-touch-icon"||a==="shortcut icon"||r==="keywords"||r==="description"||/^(og|twitter|fb):/.test(n)||/^(og|twitter):/.test(r)||r==="pinterest"||r==="robots"||r==="googlebot"||r==="bingbot"||e.hasAttribute("http-equiv")||r==="author"||r==="generator"||r==="framework"||r==="publisher"||r==="progid"||/^article:/.test(n)||/^product:/.test(n)||r==="google-site-verification"||r==="yandex-verification"||r==="csrf-token"||r==="p:domain_verify"||r==="verify-v1"||r==="verification"||r==="shopify-checkout-api-token"}function t(r){return(e.getAttribute(r)||"").toLowerCase()}return!1}function Fk(e){var t;return!e||!e.trim()?!0:((t=window.$DD_ALLOW)===null||t===void 0?void 0:t.has(e.toLocaleLowerCase()))||!1}function Vk(e,t){return Fk(e)?e:t||Lk(e)}const Zk=tt,hz=100;function vz(e,t){const r=[];let a=0,n;o(e);function o(l){l.stopObservable.subscribe(i),r.push(l),_t(n),n=Qe(s,Zk)}function i(){a===1&&r.every(l=>l.isStopped())&&(a=2,t(r))}function s(){_t(n),a===0&&(a=1,i())}return{tryAppend:l=>a!==0?!1:r.length>0&&!bz(r[r.length-1].event,l.event)?(s(),!1):(o(l),!0),stop:()=>{s()}}}function bz(e,t){return e.target===t.target&&yz(e,t)<=hz&&e.timeStamp-t.timeStamp<=Zk}function yz(e,t){return Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2))}function wz(e,t,r=ce.ALLOW){const a=new Map,{actionNameAttribute:n}=t,o=Lf(e,ll)||n&&Lf(e,n);return o?{name:o,nameSource:"custom_attribute"}:r===ce.MASK?{name:Rk,nameSource:"mask_placeholder"}:Ff(e,_z,t,a)||Ff(e,xz,t,a)||{name:"",nameSource:"blank"}}function Lf(e,t){const r=e.closest(`[${t}]`);if(!r)return;const a=r.getAttribute(t);return Bk(qk(a.trim()))}const _z=[(e,t,r)=>{if("labels"in e&&e.labels&&e.labels.length>0)return di(e.labels[0],t,r)},e=>{if(e.nodeName==="INPUT"){const t=e,r=t.getAttribute("type");if(r==="button"||r==="submit"||r==="reset")return{name:t.value,nameSource:"text_content"}}},(e,t,r)=>{if(e.nodeName==="BUTTON"||e.nodeName==="LABEL"||e.getAttribute("role")==="button")return di(e,t,r)},(e,t,r)=>da(e,"aria-label",t,r),(e,t,r)=>{const a=e.getAttribute("aria-labelledby");if(a)return{name:a.split(/\s+/).map(n=>Sz(e,n)).filter(n=>!!n).map(n=>Gk(n,t,r)).join(" "),nameSource:"text_content"}},(e,t,r)=>da(e,"alt",t,r),(e,t,r)=>da(e,"name",t,r),(e,t,r)=>da(e,"title",t,r),(e,t,r)=>da(e,"placeholder",t,r),(e,t,r)=>{if("options"in e&&e.options.length>0)return di(e.options[0],t,r)}],xz=[(e,t,r)=>di(e,t,r)],kz=10;function Ff(e,t,r,a){let n=e,o=0;for(;o<=kz&&n&&n.nodeName!=="BODY"&&n.nodeName!=="HTML"&&n.nodeName!=="HEAD";){for(const i of t){const s=i(n,r,a);if(s){const{name:l,nameSource:c}=s,u=l&&l.trim();if(u)return{name:Bk(qk(u)),nameSource:c}}}if(n.nodeName==="FORM")break;n=n.parentElement,o+=1}}function qk(e){return e.replace(/\s+/g," ")}function Bk(e){return e.length>100?`${hm(e,100)} [...]`:e}function Sz(e,t){return e.ownerDocument?e.ownerDocument.getElementById(t):null}function da(e,t,r,a){const{enablePrivacyForActionName:n,defaultPrivacyLevel:o}=r;let i=e.getAttribute(t);if(i&&n){const s=jo(e,o,a);Uk(e.tagName,t,i,s,r)&&(i=Vk(i,Rk))}else i||(i="");return{name:i,nameSource:"standard_attribute"}}function di(e,t,r){return{name:Gk(e,t,r)||"",nameSource:"text_content"}}function Gk(e,t,r){if(e.isContentEditable)return;const{enablePrivacyForActionName:a,actionNameAttribute:n,defaultPrivacyLevel:o}=t;if(Oo(Sr.USE_TREE_WALKER_FOR_ACTION_NAME))return Iz(e,n,a,o,r);if("innerText"in e){let i=e.innerText;const s=l=>{const c=e.querySelectorAll(l);for(let u=0;u<c.length;u+=1){const d=c[u];if("innerText"in d){const m=d.innerText;m&&m.trim().length>0&&(i=i.replace(m,""))}}};return s(`[${ll}]`),n&&s(`[${n}]`),a&&s(`${Pr(ce.HIDDEN)}, ${Pr(ce.MASK)}`),i}return e.textContent}function Iz(e,t,r,a,n){const o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,s);let i="";for(;o.nextNode();){const l=o.currentNode;if(ur(l)){(l.nodeName==="BR"||l.nodeName==="P"||["block","flex","grid","list-item","table","table-caption"].includes(getComputedStyle(l).display))&&(i+=" ");continue}i+=l.textContent||""}return i.replace(/\s+/g," ").trim();function s(l){const c=jo(l,a,n);if(r&&c&&Rm(l,c))return NodeFilter.FILTER_REJECT;if(ur(l)){if(l.hasAttribute(ll)||t&&l.hasAttribute(t))return NodeFilter.FILTER_REJECT;const u=getComputedStyle(l);if(u.visibility!=="visible"||u.display==="none"||u.contentVisibility&&u.contentVisibility!=="visible")return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT}}function Ez(e,{onPointerDown:t,onPointerUp:r}){let a,n={selection:!1,input:!1,scroll:!1},o;const i=[je(e,window,"pointerdown",s=>{Zf(s)&&(a=Vf(),n={selection:!1,input:!1,scroll:!1},o=t(s))},{capture:!0}),je(e,window,"selectionchange",()=>{(!a||!Vf())&&(n.selection=!0)},{capture:!0}),je(e,window,"scroll",()=>{n.scroll=!0},{capture:!0,passive:!0}),je(e,window,"pointerup",s=>{if(Zf(s)&&o){const l=n;r(o,s,()=>l),o=void 0}},{capture:!0}),je(e,window,"input",()=>{n.input=!0},{capture:!0})];return{stop:()=>{i.forEach(s=>s.stop())}}}function Vf(){const e=window.getSelection();return!e||e.isCollapsed}function Zf(e){return e.target instanceof Element&&e.isPrimary!==!1}const qf=3;function Tz(e,t){if($z(e))return t.addFrustration(ca.RAGE_CLICK),e.some(Bf)&&t.addFrustration(ca.DEAD_CLICK),t.hasError&&t.addFrustration(ca.ERROR_CLICK),{isRage:!0};const r=e.some(a=>a.getUserActivity().selection);return e.forEach(a=>{a.hasError&&a.addFrustration(ca.ERROR_CLICK),Bf(a)&&!r&&a.addFrustration(ca.DEAD_CLICK)}),{isRage:!1}}function $z(e){if(e.some(t=>t.getUserActivity().selection||t.getUserActivity().scroll))return!1;for(let t=0;t<e.length-(qf-1);t+=1)if(e[t+qf-1].event.timeStamp-e[t].event.timeStamp<=tt)return!0;return!1}const Oz='input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]),textarea,select,[contenteditable],[contenteditable] *,canvas,a[href],a[href] *';function Bf(e){if(e.hasPageActivity||e.getUserActivity().input||e.getUserActivity().scroll)return!1;let t=e.event.target;return t.tagName==="LABEL"&&t.hasAttribute("for")&&(t=document.getElementById(t.getAttribute("for"))),!t||!t.matches(Oz)}const Hk=10*tt,xa=new Map;function Cz(e){const t=xa.get(e);return xa.delete(e),t}function Jk(e,t){xa.set(e,t),xa.forEach((r,a)=>{De(a,xt())>Hk&&xa.delete(a)})}const Nz=5*gt;function Az(e,t,r,a){const n=Qn({expireDelay:Nz}),o=new ge;let i;e.subscribe(10,()=>{n.reset()}),e.subscribe(5,u),e.subscribe(11,d=>{d.reason===xn.UNLOADING&&u()});const{stop:s}=Ez(a,{onPointerDown:d=>Rz(a,e,t,d,r),onPointerUp:({clickActionBase:d,hadActivityOnPointerDown:m},f,g)=>{jz(a,e,t,r,n,o,c,d,f,g,m)}});return{stop:()=>{u(),o.notify(),s()},actionContexts:{findActionId:d=>n.findAll(d)}};function c(d){if(!i||!i.tryAppend(d)){const m=d.clone();i=vz(d,f=>{zz(f,m)})}}function u(){i&&i.stop()}}function Rz(e,t,r,a,n){let o;if(e.enablePrivacyForActionName?o=jo(a.target,e.defaultPrivacyLevel):o=ce.ALLOW,o===ce.HIDDEN)return;const i=Pz(a,o,e);let s=!1;return Nm(t,r,n,e,l=>{s=l.hadActivity},Ak),{clickActionBase:i,hadActivityOnPointerDown:()=>s}}function jz(e,t,r,a,n,o,i,s,l,c,u){var d;const m=Wk(t,n,c,s,l);i(m);const f=(d=s?.target)===null||d===void 0?void 0:d.selector;f&&Jk(l.timeStamp,f);const{stop:g}=Nm(t,r,a,e,w=>{w.hadActivity&&w.end<m.startClocks.timeStamp?m.discard():w.hadActivity?m.stop(w.end):u()?m.stop(m.startClocks.timeStamp):m.stop()},Hk),h=t.subscribe(5,({endClocks:w})=>{m.stop(w.timeStamp)}),b=o.subscribe(()=>{m.stop()});m.stopObservable.subscribe(()=>{h.unsubscribe(),g(),b.unsubscribe()})}function Pz(e,t,r){const a=e.target.getBoundingClientRect(),n=Ro(e.target,r.actionNameAttribute);n&&Jk(e.timeStamp,n);const{name:o,nameSource:i}=wz(e.target,r,t);return{type:sl.CLICK,target:{width:Math.round(a.width),height:Math.round(a.height),selector:n},position:{x:Math.round(e.clientX-a.left),y:Math.round(e.clientY-a.top)},name:o,nameSource:i}}function Wk(e,t,r,a,n){const o=ot(),i=qe(),s=t.add(o,i.relative),l=Ok({lifeCycle:e,isChildEvent:g=>g.action!==void 0&&(Array.isArray(g.action.id)?g.action.id.includes(o):g.action.id===o)});let c=0,u;const d=[],m=new ge;function f(g){c===0&&(u=g,c=1,u?s.close(gm(u)):s.remove(),l.stop(),m.notify())}return{event:n,stop:f,stopObservable:m,get hasError(){return l.eventCounts.errorCount>0},get hasPageActivity(){return u!==void 0},getUserActivity:r,addFrustration:g=>{d.push(g)},startClocks:i,isStopped:()=>c===1||c===2,clone:()=>Wk(e,t,r,a,n),validate:g=>{if(f(),c!==1)return;const{resourceCount:h,errorCount:b,longTaskCount:w}=l.eventCounts,x={duration:u&&De(i.timeStamp,u),startClocks:i,id:o,frustrationTypes:d,counts:{resourceCount:h,errorCount:b,longTaskCount:w},events:g??[n],event:n,...a};e.notify(0,x),c=2},discard:()=>{f(),c=2}}}function zz(e,t){const{isRage:r}=Tz(e,t);r?(e.forEach(a=>a.discard()),t.stop(Je()),t.validate(e.map(a=>a.event))):(t.discard(),e.forEach(a=>a.validate()))}function Dz(e,t,r,a,n){const{unsubscribe:o}=e.subscribe(0,l=>{e.notify(12,Gf(l))});t.register(0,({startTime:l,eventType:c})=>{if(c!==ne.ERROR&&c!==ne.RESOURCE&&c!==ne.LONG_TASK)return kt;const u=i.findActionId(l);return u?{type:c,action:{id:u}}:kt}),t.register(1,({startTime:l})=>({action:{id:i.findActionId(l)}}));let i={findActionId:ve},s=ve;return n.trackUserInteractions&&({actionContexts:i,stop:s}=Az(e,r,a,n)),{addAction:l=>{e.notify(12,Gf(l))},actionContexts:i,stop:()=>{o(),s()}}}function Gf(e){const t=Wl(e)?{action:{id:e.id,loading_time:$k(ie(e.duration)),frustration:{type:e.frustrationTypes},error:{count:e.counts.errorCount},long_task:{count:e.counts.longTaskCount},resource:{count:e.counts.resourceCount}},_dd:{action:{target:e.target,position:e.position,name_source:e.nameSource}}}:{context:e.context},r=cr({action:{id:ot(),target:{name:e.name},type:e.type},date:e.startClocks.timeStamp,type:ne.ACTION},t),a=Wl(e)?e.duration:void 0,n=Wl(e)?{events:e.events}:{handlingStack:e.handlingStack};return{rawRumEvent:r,duration:a,startTime:e.startClocks.relative,domainContext:n}}function Wl(e){return e.type!==sl.CUSTOM}function Mz(e){const t=g2([Ks.error]).subscribe(r=>e.notify(r.error));return{stop:()=>{t.unsubscribe()}}}function Uz(e,t){const r=Qj(e,[Da.cspViolation,Da.intervention]).subscribe(a=>t.notify(a));return{stop:()=>{r.unsubscribe()}}}function Lz(e,t,r){const a=new ge;return r.subscribe(n=>{n.type===0&&a.notify(n.error)}),Mz(a),Uz(t,a),a.subscribe(n=>e.notify(14,{error:n})),Fz(e)}function Fz(e){return e.subscribe(14,({error:t})=>{e.notify(12,Vz(t))}),{addError:({error:t,handlingStack:r,componentStack:a,startClocks:n,context:o})=>{const i=wm({originalError:t,handlingStack:r,componentStack:a,startClocks:n,nonErrorPrefix:"Provided",source:Wn.CUSTOM,handling:"handled"});i.context=cr(i.context,o),e.notify(14,{error:i})}}}function Vz(e){const t={date:e.startClocks.timeStamp,error:{id:ot(),message:e.message,source:e.source,stack:e.stack,handling_stack:e.handlingStack,component_stack:e.componentStack,type:e.type,handling:e.handling,causes:e.causes,source_type:"browser",fingerprint:e.fingerprint,csp:e.csp},type:ne.ERROR,context:e.context},r={error:e.originalError,handlingStack:e.handlingStack};return{rawRumEvent:t,startTime:e.startClocks.relative,domainContext:r}}const Hf=new WeakSet;function Zz(e){if(!performance||!("getEntriesByName"in performance))return;const t=performance.getEntriesByName(e.url,"resource");if(!t.length||!("toJSON"in t[0]))return;const r=t.filter(a=>!Hf.has(a)).filter(a=>kk(a)&&Sk(a)).filter(a=>qz(a,e.startClocks.relative,Kk({startTime:e.startClocks.relative,duration:e.duration})));if(r.length===1)return Hf.add(r[0]),r[0].toJSON()}function Kk(e){return Hn(e.startTime,e.duration)}function qz(e,t,r){return e.startTime>=t-1&&Kk(e)<=Hn(r,1)}const Bz=2*gt;function Gz(e){const t=Hz(e)||Jz(e);if(!(!t||t.traceTime<=ft()-Bz))return t.traceId}function Hz(e){const t=e.querySelector("meta[name=dd-trace-id]"),r=e.querySelector("meta[name=dd-trace-time]");return Yk(t&&t.content,r&&r.content)}function Jz(e){const t=Wz(e);if(t)return Yk(Pa(t,"trace-id"),Pa(t,"trace-time"))}function Yk(e,t){const r=t&&Number(t);if(!(!e||!r))return{traceId:e,traceTime:r}}function Wz(e){for(let t=0;t<e.childNodes.length;t+=1){const r=Jf(e.childNodes[t]);if(r)return r}if(e.body)for(let t=e.body.childNodes.length-1;t>=0;t-=1){const r=e.body.childNodes[t],a=Jf(r);if(a)return a;if(!qc(r))break}}function Jf(e){if(e&&J4(e)){const t=/^\s*DATADOG;(.*?)\s*$/.exec(e.data);if(t)return t[1]}}function Xk(){if(Or(exports.RumPerformanceEntryType.NAVIGATION)){const r=performance.getEntriesByType(exports.RumPerformanceEntryType.NAVIGATION)[0];if(r)return r}const e=Kz(),t={entryType:exports.RumPerformanceEntryType.NAVIGATION,initiatorType:"navigation",name:window.location.href,startTime:0,duration:e.loadEventEnd,decodedBodySize:0,encodedBodySize:0,transferSize:0,workerStart:0,toJSON:()=>({...t,toJSON:void 0}),...e};return t}function Kz(){const e={},t=performance.timing;for(const r in t)if(So(t[r])){const a=r,n=t[a];e[a]=n===0?0:gm(n)}return e}function Yz(e,t,r=Xk){Em(e,"interactive",()=>{const a=r(),n=Object.assign(a.toJSON(),{entryType:exports.RumPerformanceEntryType.RESOURCE,initiatorType:_k,duration:a.responseEnd,traceId:Gz(document),toJSON:()=>({...n,toJSON:void 0})});t(n)})}const Xz=1e3;function Qz(e){const t=new Set,r=e.subscribe(8,a=>{t.add(a),t.size>Xz&&(Xn("Too many requests"),t.delete(t.values().next().value))});return{getMatchingRequest(a){let n=1/0,o;for(const i of t){const s=a.startTime-i.startClocks.relative;0<=s&&s<n&&i.url===a.name&&(n=Math.abs(s),o=i)}return o&&t.delete(o),o},stop(){r.unsubscribe()}}}function eD(e,t,r,a=f2(),n=Yz){let o;const i=t.trackEarlyRequests;i?o=Qz(e):e.subscribe(8,c=>{l(()=>tD(c,t,r))});const s=Qt(t,{type:exports.RumPerformanceEntryType.RESOURCE,buffered:!0}).subscribe(c=>{for(const u of c)(i||!xk(u))&&l(()=>Wf(u,t,r,o))});n(t,c=>{l(()=>Wf(c,t,r,o))});function l(c){a.push(()=>{const u=c();u&&e.notify(12,u)})}return{stop:()=>{a.stop(),s.unsubscribe()}}}function tD(e,t,r){const a=Zz(e);return Qk(a,e,r,t)}function Wf(e,t,r,a){const n=xk(e)&&a?a.getMatchingRequest(e):void 0;return Qk(e,n,r,t)}function Qk(e,t,r,a){if(!e&&!t)return;const n=t?oD(t,a):iD(e,a);if(!a.trackResources&&!n)return;const o=e?Io(e.startTime):t.startClocks,i=e?T4(e):sD(r,o,t.duration),s=t&&rD(t,a),l=cr({date:o.timeStamp,resource:{id:ot(),duration:ie(i),type:t?t.type===il.XHR?dt.XHR:dt.FETCH:E4(e),method:t?t.method:void 0,status_code:t?t.status:lD(e.responseStatus),url:t?Ik(t.url):e.name,protocol:e&&C4(e),delivery_type:e&&N4(e),graphql:s},type:ne.RESOURCE,_dd:{discarded:!a.trackResources}},n,e&&aD(e));return{startTime:o.relative,duration:i,rawRumEvent:l,domainContext:nD(e,t)}}function rD(e,t){const r=Ek(e.url,t);if(r)return z4(e,r)}function nD(e,t){if(t){const r={performanceEntry:e,isAborted:t.isAborted,handlingStack:t.handlingStack};return t.type===il.XHR?{xhr:t.xhr,...r}:{requestInput:t.input,requestInit:t.init,response:t.response,error:t.error,...r}}return{performanceEntry:e}}function aD(e){const{renderBlockingStatus:t}=e;return{resource:{render_blocking_status:t,...A4(e),...$4(e)}}}function oD(e,t){if(e.traceSampled&&e.traceId&&e.spanId)return{_dd:{span_id:e.spanId.toString(),trace_id:e.traceId.toString(),rule_psr:t.rulePsr}}}function iD(e,t){if(e.traceId)return{_dd:{trace_id:e.traceId,span_id:hk().toString(),rule_psr:t.rulePsr}}}function sD(e,t,r){return e.wasInPageStateDuringPeriod("frozen",t.relative,r)?void 0:r}function lD(e){return e===0?void 0:e}function cD(e,t,r){const{stop:a,eventCounts:n}=Ok({lifeCycle:e,isChildEvent:o=>o.view.id===t,onChange:r});return{stop:a,eventCounts:n}}const uD=10*gt;function dD(e,t,r){return{stop:Qt(e,{type:exports.RumPerformanceEntryType.PAINT,buffered:!0}).subscribe(n=>{const o=n.find(i=>i.name==="first-contentful-paint"&&i.startTime<t.timeStamp&&i.startTime<uD);o&&r(o.startTime)}).unsubscribe}}function mD(e,t){requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(De(e,xt()))})})}function pD(e,t,r){const a=Qt(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(n=>{const o=n.find(i=>i.startTime<t.timeStamp);if(o){const i=De(o.startTime,o.processingStart);let s;o.target&&ur(o.target)&&(s=Ro(o.target,e.actionNameAttribute)),r({delay:i>=0?i:0,time:o.startTime,targetSelector:s})}});return{stop:()=>{a.unsubscribe()}}}function fD(e,t,r=Xk){return vD(e,()=>{const a=r();hD(a)||t(gD(a))})}function gD(e){return{domComplete:e.domComplete,domContentLoaded:e.domContentLoadedEventEnd,domInteractive:e.domInteractive,loadEvent:e.loadEventEnd,firstByte:e.responseStart>=0&&e.responseStart<=xt()?e.responseStart:void 0}}function hD(e){return e.loadEventEnd<=0}function vD(e,t){let r;const{stop:a}=Em(e,"complete",()=>{r=Qe(()=>t())});return{stop:()=>{a(),_t(r)}}}const bD=10*gt;function yD(e,t,r,a){let n=1/0;const{stop:o}=lr(e,r,["pointerdown","keydown"],l=>{n=l.timeStamp},{capture:!0,once:!0});let i=0;const s=Qt(e,{type:exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,buffered:!0}).subscribe(l=>{const c=hx(l,u=>u.entryType===exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT&&u.startTime<n&&u.startTime<t.timeStamp&&u.startTime<bD&&u.size>i);if(c){let u;c.element&&(u=Ro(c.element,e.actionNameAttribute)),a({value:c.startTime,targetSelector:u,resourceUrl:wD(c)}),i=c.size}});return{stop:()=>{o(),s.unsubscribe()}}}function wD(e){return e.url===""?void 0:e.url}function eS(e,t,r=window){if(document.visibilityState==="hidden")return{timeStamp:0,stop:ve};if(Or(exports.RumPerformanceEntryType.VISIBILITY_STATE)){const o=performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).filter(i=>i.name==="hidden").find(i=>i.startTime>=t.relative);if(o)return{timeStamp:o.startTime,stop:ve}}let a=1/0;const{stop:n}=lr(e,r,["pagehide","visibilitychange"],o=>{(o.type==="pagehide"||document.visibilityState==="hidden")&&(a=o.timeStamp,n())},{capture:!0});return{get timeStamp(){return a},stop:n}}function _D(e,t,r,a){const n={},{stop:o}=fD(e,d=>{r(d.loadEvent),n.navigationTimings=d,a()}),i=eS(e,t),{stop:s}=dD(e,i,d=>{n.firstContentfulPaint=d,a()}),{stop:l}=yD(e,i,window,d=>{n.largestContentfulPaint=d,a()}),{stop:c}=pD(e,i,d=>{n.firstInput=d,a()});function u(){o(),s(),l(),c(),i.stop()}return{stop:u,initialViewMetrics:n}}const Bc=(e,t)=>e*t,xD=(e,t)=>{const r=Math.max(e.left,t.left),a=Math.max(e.top,t.top),n=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return r>=n||a>=o?0:Bc(n-r,o-a)},Kf=e=>{const t=Bc(e.previousRect.width,e.previousRect.height),r=Bc(e.currentRect.width,e.currentRect.height),a=xD(e.previousRect,e.currentRect);return t+r-a};function kD(e,t,r){if(!$D())return{stop:ve};let a=0,n;r({value:0});const o=TD(),i=Qt(e,{type:exports.RumPerformanceEntryType.LAYOUT_SHIFT,buffered:!0}).subscribe(s=>{var l;for(const c of s){if(c.hadRecentInput||c.startTime<t)continue;const{cumulatedValue:u,isMaxValue:d}=o.update(c);if(d){const m=SD(c.sources);n={target:m?.node?new WeakRef(m.node):void 0,time:De(t,c.startTime),previousRect:m?.previousRect,currentRect:m?.currentRect,devicePixelRatio:window.devicePixelRatio}}if(u>a){a=u;const m=(l=n?.target)===null||l===void 0?void 0:l.deref();r({value:wa(a,4),targetSelector:m&&Ro(m,e.actionNameAttribute),time:n?.time,previousRect:n?.previousRect?Yf(n.previousRect):void 0,currentRect:n?.currentRect?Yf(n.currentRect):void 0,devicePixelRatio:n?.devicePixelRatio})}}});return{stop:()=>{i.unsubscribe()}}}function SD(e){let t;for(const r of e)if(r.node&&ur(r.node)){const a=Kf(r);(!t||Kf(t)<a)&&(t=r)}return t}function Yf({x:e,y:t,width:r,height:a}){return{x:e,y:t,width:r,height:a}}const ID=5*tt,ED=tt;function TD(){let e=0,t,r,a=0;return{update:n=>{const o=t===void 0||n.startTime-r>=ED||n.startTime-t>=ID;let i;return o?(t=r=n.startTime,a=e=n.value,i=!0):(e+=n.value,r=n.startTime,i=n.value>a,i&&(a=n.value)),{cumulatedValue:e,isMaxValue:i}}}}function $D(){return Or(exports.RumPerformanceEntryType.LAYOUT_SHIFT)&&"WeakRef"in window}let mi,tS=0,Kl=1/0,Yl=0;function OD(){"interactionCount"in performance||mi||(mi=new window.PerformanceObserver(oe(e=>{e.getEntries().forEach(t=>{const r=t;r.interactionId&&(Kl=Math.min(Kl,r.interactionId),Yl=Math.max(Yl,r.interactionId),tS=(Yl-Kl)/7+1)})})),mi.observe({type:"event",buffered:!0,durationThreshold:0}))}const Xf=()=>mi?tS:window.performance.interactionCount||0,Qf=10,CD=1*gt;function ND(e,t,r){if(!jD())return{getInteractionToNextPaint:()=>{},setViewEnd:ve,stop:ve};const{getViewInteractionCount:a,stopViewInteractionCount:n}=RD(r);let o=1/0;const i=AD(a);let s=-1,l,c;function u(f){for(const h of f)h.interactionId&&h.startTime>=t&&h.startTime<=o&&i.process(h);const g=i.estimateP98Interaction();g&&g.duration!==s&&(s=g.duration,c=De(t,g.startTime),l=Cz(g.startTime),!l&&g.target&&ur(g.target)&&(l=Ro(g.target,e.actionNameAttribute)))}const d=Qt(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(u),m=Qt(e,{type:exports.RumPerformanceEntryType.EVENT,durationThreshold:40,buffered:!0}).subscribe(u);return{getInteractionToNextPaint:()=>{if(s>=0)return{value:Math.min(s,CD),targetSelector:l,time:c};if(a())return{value:0}},setViewEnd:f=>{o=f,n()},stop:()=>{m.unsubscribe(),d.unsubscribe()}}}function AD(e){const t=[];function r(){t.sort((a,n)=>n.duration-a.duration).splice(Qf)}return{process(a){const n=t.findIndex(i=>a.interactionId===i.interactionId),o=t[t.length-1];n!==-1?a.duration>t[n].duration&&(t[n]=a,r()):(t.length<Qf||a.duration>o.duration)&&(t.push(a),r())},estimateP98Interaction(){const a=Math.min(t.length-1,Math.floor(e()/50));return t[a]}}}function RD(e){OD();const t=e===nr.INITIAL_LOAD?0:Xf();let r={stopped:!1};function a(){return Xf()-t}return{getViewInteractionCount:()=>r.stopped?r.interactionCount:a(),stopViewInteractionCount:()=>{r={stopped:!0,interactionCount:a()}}}}function jD(){return Or(exports.RumPerformanceEntryType.EVENT)&&window.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype}function PD(e,t,r,a,n,o,i){let s=n===nr.INITIAL_LOAD,l=!0;const c=[],u=eS(a,o);function d(){if(!l&&!s&&c.length>0){const f=Math.max(...c);f<u.timeStamp-o.relative&&i(f)}}const{stop:m}=Nm(e,t,r,a,f=>{l&&(l=!1,f.hadActivity&&c.push(De(o.timeStamp,f.end)),d())});return{stop:()=>{m(),u.stop()},setLoadEvent:f=>{s&&(s=!1,c.push(f),d())}}}function zD(){let e;const t=window.visualViewport;return t?e=t.pageLeft-t.offsetLeft:window.scrollX!==void 0?e=window.scrollX:e=window.pageXOffset||0,Math.round(e)}function rS(){let e;const t=window.visualViewport;return t?e=t.pageTop-t.offsetTop:window.scrollY!==void 0?e=window.scrollY:e=window.pageYOffset||0,Math.round(e)}let Xl;function nS(e){return Xl||(Xl=DD(e)),Xl}function DD(e){return new ge(t=>{const{throttled:r}=To(()=>{t.notify(ul())},200);return je(e,window,"resize",r,{capture:!0,passive:!0}).stop})}function ul(){const e=window.visualViewport;return e?{width:Number(e.width*e.scale),height:Number(e.height*e.scale)}:{width:Number(window.innerWidth||0),height:Number(window.innerHeight||0)}}const MD=tt;function UD(e,t,r,a=FD(e)){let n=0,o=0,i=0;const s=a.subscribe(({scrollDepth:l,scrollTop:c,scrollHeight:u})=>{let d=!1;if(l>n&&(n=l,d=!0),u>o){o=u;const m=xt();i=De(t.relative,m),d=!0}d&&r({maxDepth:Math.min(n,o),maxDepthScrollTop:c,maxScrollHeight:o,maxScrollHeightTime:i})});return{stop:()=>s.unsubscribe()}}function LD(){const e=rS(),{height:t}=ul(),r=Math.round((document.scrollingElement||document.documentElement).scrollHeight),a=Math.round(t+e);return{scrollHeight:r,scrollDepth:a,scrollTop:e}}function FD(e,t=MD){return new ge(r=>{function a(){r.notify(LD())}if(window.ResizeObserver){const n=To(a,t,{leading:!1,trailing:!0}),o=document.scrollingElement||document.documentElement,i=new ResizeObserver(oe(n.throttled));o&&i.observe(o);const s=je(e,window,"scroll",n.throttled,{passive:!0});return()=>{n.cancel(),i.disconnect(),s.stop()}}})}function VD(e,t,r,a,n,o,i){const s={},{stop:l,setLoadEvent:c}=PD(e,t,r,a,o,i,h=>{s.loadingTime=h,n()}),{stop:u}=UD(a,i,h=>{s.scroll=h}),{stop:d}=kD(a,i.relative,h=>{s.cumulativeLayoutShift=h,n()}),{stop:m,getInteractionToNextPaint:f,setViewEnd:g}=ND(a,i.relative,o);return{stop:()=>{l(),d(),u()},stopINPTracking:m,setLoadEvent:c,setViewEnd:g,getCommonViewMetrics:()=>(s.interactionToNextPaint=f(),s)}}function ZD(e,t){const{stop:r}=je(e,window,"pageshow",a=>{a.persisted&&t(a)},{capture:!0});return r}function qD(e,t,r){mD(e.relative,a=>{t.firstContentfulPaint=a,t.largestContentfulPaint={value:a},r()})}const BD=3e3,GD=5*gt,HD=5*gt;function JD(e,t,r,a,n,o,i,s){const l=new Set;let c=m(nr.INITIAL_LOAD,fm(),s),u;f();let d;i&&(d=g(o),n.trackBfcacheViews&&(u=ZD(n,h=>{c.end();const b=Io(h.timeStamp);c=m(nr.BF_CACHE,b,void 0)})));function m(h,b,w){const x=WD(t,r,a,n,e,h,b,w);return l.add(x),x.stopObservable.subscribe(()=>{l.delete(x)}),x}function f(){t.subscribe(10,()=>{c=m(nr.ROUTE_CHANGE,void 0,{name:c.name,service:c.service,version:c.version,context:c.contextManager.getContext()})}),t.subscribe(9,()=>{c.end({sessionIsActive:!1})})}function g(h){return h.subscribe(({oldLocation:b,newLocation:w})=>{YD(b,w)&&(c.end(),c=m(nr.ROUTE_CHANGE))})}return{addTiming:(h,b=Je())=>{c.addTiming(h,b)},startView:(h,b)=>{c.end({endClocks:b}),c=m(nr.ROUTE_CHANGE,b,h)},setViewContext:h=>{c.contextManager.setContext(h)},setViewContextProperty:(h,b)=>{c.contextManager.setContextProperty(h,b)},setViewName:h=>{c.setViewName(h)},getViewContext:()=>c.contextManager.getContext(),stop:()=>{d&&d.unsubscribe(),u&&u(),c.end(),l.forEach(h=>h.stop())}}}function WD(e,t,r,a,n,o,i=qe(),s){const l=ot(),c=new ge,u={};let d=0,m;const f=ja(n),g=ol();let h=!0,b=s?.name;const w=s?.service||a.service,x=s?.version||a.version,k=s?.context;k&&g.setContext(k);const y={id:l,name:b,startClocks:i,service:w,version:x,context:k};e.notify(1,y),e.notify(2,y);const{throttled:$,cancel:I}=To(M,BD,{leading:!1}),{setLoadEvent:E,setViewEnd:A,stop:F,stopINPTracking:q,getCommonViewMetrics:ee}=VD(e,t,r,a,ke,o,i),{stop:Ne,initialViewMetrics:te}=o===nr.INITIAL_LOAD?_D(a,i,E,ke):{stop:ve,initialViewMetrics:{}};o===nr.BF_CACHE&&qD(i,te,ke);const{stop:J,eventCounts:Ae}=cD(e,l,ke),fe=Gn(M,GD),Ue=e.subscribe(11,he=>{he.reason===xn.UNLOADING&&M()});M(),g.changeObservable.subscribe(ke);function $e(){e.notify(3,{id:l,name:b,context:g.getContext(),startClocks:i,sessionIsActive:h})}function ke(){$e(),$()}function M(){I(),$e(),d+=1;const he=m===void 0?Je():m.timeStamp;e.notify(4,{customTimings:u,documentVersion:d,id:l,name:b,service:w,version:x,context:g.getContext(),loadingType:o,location:f,startClocks:i,commonViewMetrics:ee(),initialViewMetrics:te,duration:De(i.timeStamp,he),isActive:m===void 0,sessionIsActive:h,eventCounts:Ae})}return{get name(){return b},service:w,version:x,contextManager:g,stopObservable:c,end(he={}){var le,_e;m||(m=(le=he.endClocks)!==null&&le!==void 0?le:qe(),h=(_e=he.sessionIsActive)!==null&&_e!==void 0?_e:!0,e.notify(5,{endClocks:m}),e.notify(6,{endClocks:m}),Qs(fe),A(m.relative),F(),Ue.unsubscribe(),M(),Qe(()=>{this.stop()},HD))},stop(){Ne(),J(),q(),c.notify()},addTiming(he,le){if(m)return;const _e=gR(le)?le:De(i.timeStamp,le);u[KD(he)]=_e,ke()},setViewName(he){b=he,M()}}}function KD(e){const t=e.replace(/[^a-zA-Z0-9-_.@$]/g,"_");return t!==e&&Q.warn(`Invalid timing name: ${e}, sanitized to: ${t}`),t}function YD(e,t){return e.pathname!==t.pathname||!XD(t.hash)&&eg(t.hash)!==eg(e.hash)}function XD(e){const t=e.substring(1);return t!==""&&!!document.getElementById(t)}function eg(e){const t=e.indexOf("?");return t<0?e:e.slice(0,t)}function QD(e,t,r,a,n,o,i,s,l,c){return e.subscribe(4,u=>e.notify(12,eM(u,r,s))),t.register(0,({startTime:u,eventType:d})=>{const m=l.findView(u);return m?{type:d,service:m.service,version:m.version,context:m.context,view:{id:m.id,name:m.name}}:Ir}),t.register(1,({startTime:u})=>{var d;return{view:{id:(d=l.findView(u))===null||d===void 0?void 0:d.id}}}),JD(a,e,n,o,r,i,!r.trackViewsManually,c)}function eM(e,t,r){var a,n,o,i,s,l,c,u,d,m,f,g,h,b,w,x,k,y;const $=r.getReplayStats(e.id),I=(n=(a=e.commonViewMetrics)===null||a===void 0?void 0:a.cumulativeLayoutShift)===null||n===void 0?void 0:n.devicePixelRatio,E={_dd:{document_version:e.documentVersion,replay_stats:$,cls:I?{device_pixel_ratio:I}:void 0,configuration:{start_session_replay_recording_manually:t.startSessionReplayRecordingManually}},date:e.startClocks.timeStamp,type:ne.VIEW,view:{action:{count:e.eventCounts.actionCount},frustration:{count:e.eventCounts.frustrationCount},cumulative_layout_shift:(o=e.commonViewMetrics.cumulativeLayoutShift)===null||o===void 0?void 0:o.value,cumulative_layout_shift_time:ie((i=e.commonViewMetrics.cumulativeLayoutShift)===null||i===void 0?void 0:i.time),cumulative_layout_shift_target_selector:(s=e.commonViewMetrics.cumulativeLayoutShift)===null||s===void 0?void 0:s.targetSelector,first_byte:ie((l=e.initialViewMetrics.navigationTimings)===null||l===void 0?void 0:l.firstByte),dom_complete:ie((c=e.initialViewMetrics.navigationTimings)===null||c===void 0?void 0:c.domComplete),dom_content_loaded:ie((u=e.initialViewMetrics.navigationTimings)===null||u===void 0?void 0:u.domContentLoaded),dom_interactive:ie((d=e.initialViewMetrics.navigationTimings)===null||d===void 0?void 0:d.domInteractive),error:{count:e.eventCounts.errorCount},first_contentful_paint:ie(e.initialViewMetrics.firstContentfulPaint),first_input_delay:ie((m=e.initialViewMetrics.firstInput)===null||m===void 0?void 0:m.delay),first_input_time:ie((f=e.initialViewMetrics.firstInput)===null||f===void 0?void 0:f.time),first_input_target_selector:(g=e.initialViewMetrics.firstInput)===null||g===void 0?void 0:g.targetSelector,interaction_to_next_paint:ie((h=e.commonViewMetrics.interactionToNextPaint)===null||h===void 0?void 0:h.value),interaction_to_next_paint_time:ie((b=e.commonViewMetrics.interactionToNextPaint)===null||b===void 0?void 0:b.time),interaction_to_next_paint_target_selector:(w=e.commonViewMetrics.interactionToNextPaint)===null||w===void 0?void 0:w.targetSelector,is_active:e.isActive,name:e.name,largest_contentful_paint:ie((x=e.initialViewMetrics.largestContentfulPaint)===null||x===void 0?void 0:x.value),largest_contentful_paint_target_selector:(k=e.initialViewMetrics.largestContentfulPaint)===null||k===void 0?void 0:k.targetSelector,load_event:ie((y=e.initialViewMetrics.navigationTimings)===null||y===void 0?void 0:y.loadEvent),loading_time:$k(ie(e.commonViewMetrics.loadingTime)),loading_type:e.loadingType,long_task:{count:e.eventCounts.longTaskCount},performance:tM(e.commonViewMetrics,e.initialViewMetrics),resource:{count:e.eventCounts.resourceCount},time_spent:ie(e.duration)},display:e.commonViewMetrics.scroll?{scroll:{max_depth:e.commonViewMetrics.scroll.maxDepth,max_depth_scroll_top:e.commonViewMetrics.scroll.maxDepthScrollTop,max_scroll_height:e.commonViewMetrics.scroll.maxScrollHeight,max_scroll_height_time:ie(e.commonViewMetrics.scroll.maxScrollHeightTime)}}:void 0,privacy:{replay_level:t.defaultPrivacyLevel},device:{locale:navigator.language,locales:navigator.languages,time_zone:C2()}};return $r(e.customTimings)||(E.view.custom_timings=ix(e.customTimings,ie)),{rawRumEvent:E,startTime:e.startClocks.relative,duration:e.duration,domainContext:{location:e.location}}}function tM({cumulativeLayoutShift:e,interactionToNextPaint:t},{firstContentfulPaint:r,firstInput:a,largestContentfulPaint:n}){return{cls:e&&{score:e.value,timestamp:ie(e.time),target_selector:e.targetSelector,previous_rect:e.previousRect,current_rect:e.currentRect},fcp:r&&{timestamp:ie(r)},fid:a&&{duration:ie(a.delay),timestamp:ie(a.time),target_selector:a.targetSelector},inp:t&&{duration:ie(t.value),timestamp:ie(t.time),target_selector:t.targetSelector},lcp:n&&{timestamp:ie(n.value),target_selector:n.targetSelector,resource_url:n.resourceUrl}}}const rM="rum";function nM(e,t,r){const a=BP(e,rM,n=>oM(e,n),r);return a.expireObservable.subscribe(()=>{t.notify(9)}),a.renewObservable.subscribe(()=>{t.notify(10)}),a.sessionStateUpdateObservable.subscribe(({previousState:n,newState:o})=>{if(!n.forcedReplay&&o.forcedReplay){const i=a.findSession();i&&(i.isReplayForced=!0)}}),{findTrackedSession:n=>{const o=a.findSession(n);if(!(!o||o.trackingType==="0"))return{id:o.id,sessionReplay:o.trackingType==="1"?1:o.isReplayForced?2:0,anonymousId:o.anonymousId}},expire:a.expire,expireObservable:a.expireObservable,setForcedReplay:()=>a.updateSessionState({forcedReplay:"1"})}}function aM(){const e={id:"00000000-aaaa-0000-aaaa-000000000000",sessionReplay:Wx("records")?1:0};return{findTrackedSession:()=>e,expire:ve,expireObservable:new ge,setForcedReplay:ve}}function oM(e,t){return iM(t)?t:Mr(e.sessionSampleRate)?Mr(e.sessionReplaySampleRate)?"1":"2":"0"}function iM(e){return e==="0"||e==="1"||e==="2"}function sM(e,t,r,a,n,o){const i=[e.rumEndpointBuilder];e.replica&&i.push(e.replica.rumEndpointBuilder);const s=Yx({encoder:o(2),request:Sm(i,r),flushController:Xx({pageMayExitObservable:a,sessionExpireObservable:n})});return t.subscribe(13,l=>{l.type===ne.VIEW?s.upsert(l,l.view.id):s.add(l)}),s}function lM(e){const t=Kn();e.subscribe(13,r=>{t.send("rum",r)})}const cM=tn;function uM(e,t,r,a){const n=Qn({expireDelay:cM});let o;e.subscribe(1,({startClocks:l})=>{const c=a.href;n.add(s({url:c,referrer:o||document.referrer}),l.relative),o=c}),e.subscribe(6,({endClocks:l})=>{n.closeActive(l.relative)});const i=r.subscribe(({newLocation:l})=>{const c=n.find();if(c){const u=xt();n.closeActive(u),n.add(s({url:l.href,referrer:c.referrer}),u)}});function s({url:l,referrer:c}){return{url:l,referrer:c}}return t.register(0,({startTime:l,eventType:c})=>{const u=n.find(l);return u?{type:c,view:{url:u.url,referrer:u.referrer}}:Ir}),{findUrl:l=>n.find(l),stop:()=>{i.unsubscribe(),n.stop()}}}function dM(e,t){let r=ja(t);return new ge(a=>{const{stop:n}=mM(e,i),{stop:o}=pM(e,i);function i(){if(r.href===t.href)return;const s=ja(t);a.notify({newLocation:s,oldLocation:r}),r=s}return()=>{n(),o()}})}function mM(e,t){const{stop:r}=Vt(tg("pushState"),"pushState",({onPostCall:o})=>{o(t)}),{stop:a}=Vt(tg("replaceState"),"replaceState",({onPostCall:o})=>{o(t)}),{stop:n}=je(e,window,"popstate",t);return{stop:()=>{r(),a(),n()}}}function pM(e,t){return je(e,window,"hashchange",t)}function tg(e){return Object.prototype.hasOwnProperty.call(history,e)?history:History.prototype}const fM=tn;function gM(e,t,r){const a=Qn({expireDelay:fM});return e.subscribe(1,({startClocks:n})=>{a.add({},n.relative)}),e.subscribe(6,({endClocks:n})=>{a.closeActive(n.relative)}),t.register(0,({startTime:n,eventType:o})=>{if(!r.trackFeatureFlagsForEvents.concat([ne.VIEW,ne.ERROR]).includes(o))return kt;const s=a.find(n);return!s||$r(s)?kt:{type:o,feature_flags:s}}),{addFeatureFlagEvaluation:(n,o)=>{const i=a.find();i&&(i[n]=o)}}}const hM=10*tt;let kn,ri;function vM(e,t,r){e.metricsEnabled&&(aS(),ri=!1,t.subscribe(13,()=>{ri=!0}),r.subscribe(({bytesCount:a,messagesCount:n})=>{ri&&(ri=!1,kn.batchCount+=1,ng(kn.batchBytesCount,a),ng(kn.batchMessagesCount,n))}),Gn(bM,hM))}function bM(){kn.batchCount!==0&&(Ao("Customer data measures",kn),aS())}function rg(){return{min:1/0,max:0,sum:0}}function ng(e,t){e.sum+=t,e.min=Math.min(e.min,t),e.max=Math.max(e.max,t)}function aS(){kn={batchCount:0,batchBytesCount:rg(),batchMessagesCount:rg()}}const yM=4e3,wM=500,_M=tn;function xM(e,t,r=wM){const a=Qn({expireDelay:_M,maxEntries:yM});let n;Or(exports.RumPerformanceEntryType.VISIBILITY_STATE)&&performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).forEach(c=>{const u=c.name==="hidden"?"hidden":"active";i(u,c.startTime)}),i(oS(),xt());const{stop:o}=lr(t,window,["pageshow","focus","blur","visibilitychange","resume","freeze","pagehide"],l=>{i(SM(l),l.timeStamp)},{capture:!0});function i(l,c=xt()){l!==n&&(n=l,a.closeActive(c),a.add({state:n,startTime:c},c))}function s(l,c,u){return a.findAll(c,u).some(d=>d.state===l)}return e.register(0,({startTime:l,duration:c=0,eventType:u})=>{if(u===ne.VIEW){const d=a.findAll(l,c);return{type:u,_dd:{page_states:kM(d,l,r)}}}return u===ne.ACTION||u===ne.ERROR?{type:u,view:{in_foreground:s("active",l,0)}}:kt}),{wasInPageStateDuringPeriod:s,addPageState:i,stop:()=>{o(),a.stop()}}}function kM(e,t,r){if(e.length!==0)return e.slice(-r).reverse().map(({state:a,startTime:n})=>({state:a,start:ie(De(t,n))}))}function SM(e){return e.type==="freeze"?"frozen":e.type==="pagehide"?e.persisted?"frozen":"terminated":oS()}function oS(){return document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}function IM(e,t){let r;const a=requestAnimationFrame(oe(()=>{r=ul()})),n=nS(t).subscribe(o=>{r=o}).unsubscribe;return e.register(0,({eventType:o})=>({type:o,display:r?{viewport:r}:void 0})),{stop:()=>{n(),a&&cancelAnimationFrame(a)}}}function EM(e,t){const r=window.cookieStore?TM(e):OM;return new ge(a=>r(t,n=>a.notify(n)))}function TM(e){return(t,r)=>je(e,window.cookieStore,"change",n=>{const o=n.changed.find(i=>i.name===t)||n.deleted.find(i=>i.name===t);o&&r(o.value)}).stop}const $M=tt;function OM(e,t){const r=Pa(document.cookie,e),a=Gn(()=>{const n=Pa(document.cookie,e);n!==r&&t(n)},$M);return()=>{Qs(a)}}const ag="datadog-ci-visibility-test-execution-id";function CM(e,t,r=EM(e,ag)){var a;let n=hr(ag)||((a=window.Cypress)===null||a===void 0?void 0:a.env("traceId"));const o=r.subscribe(i=>{n=i});return t.register(0,({eventType:i})=>typeof n!="string"?kt:{type:i,session:{type:"ci_test"},ci_test:{test_execution_id:n}}),{stop:()=>{o.unsubscribe()}}}function NM(e,t){const r=Qt(t,{type:exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME,buffered:!0}).subscribe(a=>{for(const n of a){const o=Io(n.startTime),i={date:o.timeStamp,long_task:{id:ot(),entry_type:dk.LONG_ANIMATION_FRAME,duration:ie(n.duration),blocking_duration:ie(n.blockingDuration),first_ui_event_timestamp:ie(n.firstUIEventTimestamp),render_start:ie(n.renderStart),style_and_layout_start:ie(n.styleAndLayoutStart),start_time:ie(n.startTime),scripts:n.scripts.map(s=>({duration:ie(s.duration),pause_duration:ie(s.pauseDuration),forced_style_and_layout_duration:ie(s.forcedStyleAndLayoutDuration),start_time:ie(s.startTime),execution_start:ie(s.executionStart),source_url:s.sourceURL,source_function_name:s.sourceFunctionName,source_char_position:s.sourceCharPosition,invoker:s.invoker,invoker_type:s.invokerType,window_attribution:s.windowAttribution}))},type:ne.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:i,startTime:o.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop:()=>r.unsubscribe()}}function AM(e,t){const r=Qt(t,{type:exports.RumPerformanceEntryType.LONG_TASK,buffered:!0}).subscribe(a=>{for(const n of a){if(n.entryType!==exports.RumPerformanceEntryType.LONG_TASK||!t.trackLongTasks)break;const o=Io(n.startTime),i={date:o.timeStamp,long_task:{id:ot(),entry_type:dk.LONG_TASK,duration:ie(n.duration)},type:ne.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:i,startTime:o.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop(){r.unsubscribe()}}}function RM(e){e.register(0,({eventType:t})=>{if(!nk())return kt;const r=tk(),a=rk();return{type:t,session:{type:"synthetics"},synthetics:{test_id:r,result_id:a,injected:ek()}}})}function jM(e,t,r){const a=km(e),n=r(a);return rl(t).forEach(([o,i])=>Gc(e,a,o.split(/\.|(?=\[\])/),i)),n}function Gc(e,t,r,a){const[n,...o]=r;if(n==="[]"){Array.isArray(e)&&Array.isArray(t)&&e.forEach((i,s)=>Gc(i,t[s],o,a));return}if(!(!og(e)||!og(t))){if(o.length>0)return Gc(e[n],t[n],o,a);PM(e,n,t[n],a)}}function PM(e,t,r,a){const n=rn(r);n===a?e[t]=Ce(r):a==="object"&&(n==="undefined"||n==="null")&&(e[t]={})}function og(e){return rn(e)==="object"}const fn={"view.name":"string","view.url":"string","view.referrer":"string"},gn={context:"object"},hn={service:"string",version:"string"};let iS;function zM(e,t,r,a,n){iS={[ne.VIEW]:{"view.performance.lcp.resource_url":"string",...gn,...fn,...hn},[ne.ERROR]:{"error.message":"string","error.stack":"string","error.resource.url":"string","error.fingerprint":"string",...gn,...fn,...hn},[ne.RESOURCE]:{"resource.url":"string","resource.graphql.variables":"string",...gn,...fn,...hn},[ne.ACTION]:{"action.target.name":"string",...gn,...fn,...hn},[ne.LONG_TASK]:{"long_task.scripts[].source_url":"string","long_task.scripts[].invoker":"string",...gn,...fn,...hn},[ne.VITAL]:{...gn,...fn,...hn}};const o={[ne.ERROR]:Vl(ne.ERROR,a,n),[ne.ACTION]:Vl(ne.ACTION,a,n),[ne.VITAL]:Vl(ne.VITAL,a,n)};t.subscribe(12,({startTime:i,duration:s,rawRumEvent:l,domainContext:c})=>{const u=r.triggerHook(0,{eventType:l.type,startTime:i,duration:s});if(u===Ir)return;const d=cr(u,l,{ddtags:_m(e).join(",")});DM(d,e.beforeSend,c,o)&&($r(d.context)&&delete d.context,t.notify(13,d))})}function DM(e,t,r,a){var n;if(t){const i=jM(e,iS[e.type],s=>t(s,r));if(i===!1&&e.type!==ne.VIEW)return!1;i===!1&&Q.warn("Can't dismiss view events using beforeSend!")}return!((n=a[e.type])===null||n===void 0?void 0:n.isLimitReached())}function MM(e,t,r,a){e.register(0,({eventType:n,startTime:o})=>{const i=t.findTrackedSession(o),s=a.findView(o);if(!i||!s)return Ir;let l,c,u;return n===ne.VIEW?(l=r.getReplayStats(s.id)?!0:void 0,c=i.sessionReplay===1,u=s.sessionIsActive?void 0:!1):l=r.isRecording()?!0:void 0,{type:n,session:{id:i.id,type:"user",has_replay:l,sampled_for_replay:c,is_active:u}}}),e.register(1,({startTime:n})=>{const o=t.findTrackedSession(n);return o?{session:{id:o.id}}:kt})}function UM(e){e.register(0,({eventType:t})=>({type:t,connectivity:Fx()}))}function LM(e,t,r){e.register(0,({eventType:a})=>{const n=t.source;return{type:a,_dd:{format_version:2,drift:mx(),configuration:{session_sample_rate:wa(t.sessionSampleRate,3),session_replay_sample_rate:wa(t.sessionReplaySampleRate,3),profiling_sample_rate:wa(t.profilingSampleRate,3),beta_encode_cookie_options:t.betaEncodeCookieOptions},browser_sdk_version:Gr()?"6.24.1":void 0,sdk_name:r},application:{id:t.applicationId},date:Je(),source:n}}),e.register(1,()=>({application:{id:t.applicationId}}))}function FM(e,t){e.register(1,()=>t.isGranted()?kt:Ir)}const VM=IP,ZM=[ne.ACTION,ne.ERROR,ne.LONG_TASK,ne.RESOURCE,ne.VITAL];function qM(e){return{addEvent:(t,r,a,n)=>{ZM.includes(r.type)&&e.notify(12,{startTime:t,rawRumEvent:r,domainContext:a,duration:n})}}}function BM(e,t){if(!t.metricsEnabled)return{stop:ve};const{unsubscribe:r}=e.subscribe(4,({initialViewMetrics:a})=>{!a.largestContentfulPaint||!a.navigationTimings||(Ao("Initial view metrics",{metrics:GM(a.largestContentfulPaint,a.navigationTimings)}),r())});return{stop:r}}function GM(e,t){return{lcp:{value:e.value},navigation:{domComplete:t.domComplete,domContentLoaded:t.domContentLoaded,domInteractive:t.domInteractive,firstByte:t.firstByte,loadEvent:t.loadEvent}}}function HM(e,t,r,a,n,o,i,s,l){const c=[],u=new x4,d=VM();u.subscribe(13,L=>xm("rum",L));const m=L=>{u.notify(14,{error:L}),Xn("Error reported to customer",{"error.message":L.message})},f=xP(e),g=f.subscribe(L=>{u.notify(11,L)});c.push(()=>g.unsubscribe());const h=CP("browser-rum-sdk",e,d,m,f,n);c.push(h.stop);const b=Gr()?aM():nM(e,u,o);if(Gr())lM(u);else{const L=sM(e,u,m,f,b.expireObservable,n);c.push(()=>L.stop()),vM(h,u,L.flushController.flushObservable)}const w=y4(),x=dM(e,location),{observable:k,stop:y}=w4();c.push(y),LM(d,e,l);const $=xM(d,e),I=S4(u);c.push(()=>I.stop());const E=uM(u,d,x,location);c.push(()=>E.stop());const A=gM(u,d,e);MM(d,b,t,I),UM(d),FM(d,o);const F=E2(d,e,"rum"),q=T2(d,e,b,"rum"),ee=I2(d,e,"rum"),{actionContexts:Ne,addAction:te,addEvent:J,stop:Ae}=JM(u,d,e,$,w,k,m);c.push(Ae);const{addTiming:fe,startView:Ue,setViewName:$e,setViewContext:ke,setViewContextProperty:M,getViewContext:he,stop:le}=QD(u,d,e,location,w,k,x,t,I,a);c.push(le);const{stop:_e}=BM(u,h);c.push(_e);const{stop:j}=eD(u,e,$);if(c.push(j),e.trackLongTasks)if(Or(exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME)){const{stop:L}=NM(u,e);c.push(L)}else AM(u,e);const{addError:B}=Lz(u,e,s);s.unbuffer(),L4(u,e,b,q,ee);const me=A2(u,$,i),Se=_4(e.applicationId,b,I,Ne,E);return c.push(()=>r.stop()),{addAction:te,addEvent:J,addError:B,addTiming:fe,addFeatureFlagEvaluation:A.addFeatureFlagEvaluation,startView:Ue,setViewContext:ke,setViewContextProperty:M,getViewContext:he,setViewName:$e,lifeCycle:u,viewHistory:I,session:b,stopSession:()=>b.expire(),getInternalContext:Se.get,startDurationVital:me.startDurationVital,stopDurationVital:me.stopDurationVital,addDurationVital:me.addDurationVital,addOperationStepVital:me.addOperationStepVital,globalContext:F,userContext:q,accountContext:ee,telemetry:h,stop:()=>{c.forEach(L=>L())},hooks:d}}function JM(e,t,r,a,n,o,i){const s=Dz(e,t,n,o,r),l=qM(e),c=IM(t,r),u=CM(r,t);return RM(t),zM(r,e,t,i),{pageStateHistory:a,addAction:s.addAction,addEvent:l.addEvent,actionContexts:s.actionContexts,stop:()=>{s.stop(),u.stop(),c.stop(),a.stop()}}}function WM(e,{session:t,viewContext:r,errorType:a}){const n=t?t.id:"no-session-id",o=[];a!==void 0&&o.push(`error-type=${a}`),r&&(o.push(`seed=${r.id}`),o.push(`from=${r.startClocks.timeStamp}`));const i=KM(e),s=`/rum/replay/sessions/${n}`;return`${i}${s}?${o.join("&")}`}function KM(e){const t=e.site,r=e.subdomain||YM(e);return`https://${r?`${r}.`:""}${t}`}function YM(e){switch(e.site){case Ur:case oj:return"app";case Ox:return"dd";default:return}}const XM=1e3;let Ct;function QM(e){return dl(e).segments_count}function eU(e){dl(e).segments_count+=1}function tU(e){dl(e).records_count+=1}function rU(e,t){dl(e).segments_total_raw_size+=t}function nU(e){return Ct?.get(e)}function dl(e){Ct||(Ct=new Map);let t;return Ct.has(e)?t=Ct.get(e):(t={records_count:0,segments_count:0,segments_total_raw_size:0},Ct.set(e,t),Ct.size>XM&&aU()),t}function aU(){if(!Ct)return;const e=Ct.keys().next().value;e&&Ct.delete(e)}function sS(e,t,r){let a=0,n=[],o,i=!0,s=0;const l=[],{stop:c}=je(e,t,"message",({data:m})=>{if(m.type!=="wrote"||m.streamId!==r)return;const f=l[0];f&&(f.id===m.id?(l.shift(),a+=m.additionalBytesCount,n.push(m.result),o=m.trailer,f.writeCallback?f.writeCallback(m.result.byteLength):f.finishCallback&&f.finishCallback()):f.id<m.id&&c())});function u(){const m=n.length===0?new Uint8Array(0):zx(n.concat(o)),f={rawBytesCount:a,output:m,outputBytesCount:m.byteLength,encoding:"deflate"};return a=0,n=[],f}function d(){i||(t.postMessage({action:"reset",streamId:r}),i=!0)}return{isAsync:!0,get isEmpty(){return i},write(m,f){t.postMessage({action:"write",id:s,data:m,streamId:r}),l.push({id:s,writeCallback:f,data:m}),i=!1,s+=1},finish(m){d(),l.length?(l.forEach(f=>{delete f.writeCallback}),l[l.length-1].finishCallback=()=>m(u())):m(u())},finishSync(){d();const m=l.map(f=>f.data).join("");return l.length=0,{...u(),pendingData:m}},estimateEncodedBytesCount(m){return m.length/8},stop(){c()}}}function jm({configuredUrl:e,error:t,source:r,scriptType:a}){if(Q.error(`${r} failed to start: an error occurred while initializing the ${a}:`,t),t instanceof Event||t instanceof Error&&oU(t.message)){let n;e?n=`Please make sure the ${a} URL ${e} is correct and CSP is correctly configured.`:n="Please make sure CSP is correctly configured.",Q.error(`${n} See documentation at ${Ys}/integrations/content_security_policy_logs/#use-csp-with-real-user-monitoring-and-session-replay`)}else a==="worker"&&Im(t)}function oU(e){return e.includes("Content Security Policy")||e.includes("requires 'TrustedScriptURL'")}const iU=30*tt;function lS(e){return new Worker(e.workerUrl||URL.createObjectURL(new Blob(['(()=>{function t(t){if(1===t.length)return t[0];const e=t.reduce((t,e)=>t+e.length,0),a=new Uint8Array(e);let n=0;for(const e of t)a.set(e,n),n+=e.length;return a}function e(t){for(var e=t.length;--e>=0;)t[e]=0}var a=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),n=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=Array(576);e(s);var h=Array(60);e(h);var l=Array(512);e(l);var _=Array(256);e(_);var o=Array(29);e(o);var d,u,f,c=Array(30);function p(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function g(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(c);var v=function(t){return t<256?l[t]:l[256+(t>>>7)]},w=function(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},m=function(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},b=function(t,e,a){m(t,a[2*e],a[2*e+1])},y=function(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},z=function(t,e,a){var n,r,i=Array(16),s=0;for(n=1;n<=15;n++)i[n]=s=s+a[n-1]<<1;for(r=0;r<=e;r++){var h=t[2*r+1];0!==h&&(t[2*r]=y(i[h]++,h))}},k=function(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},x=function(t){t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},A=function(t,e,a,n){var r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]},U=function(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&A(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!A(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n},B=function(t,e,r){var i,s,h,l,d=0;if(0!==t.last_lit)do{i=t.pending_buf[t.d_buf+2*d]<<8|t.pending_buf[t.d_buf+2*d+1],s=t.pending_buf[t.l_buf+d],d++,0===i?b(t,s,e):(h=_[s],b(t,h+256+1,e),0!==(l=a[h])&&(s-=o[h],m(t,s,l)),i--,h=v(i),b(t,h,r),0!==(l=n[h])&&(i-=c[h],m(t,i,l)))}while(d<t.last_lit);b(t,256,e)},I=function(t,e){var a,n,r,i=e.dyn_tree,s=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.elems,_=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<l;a++)0!==i[2*a]?(t.heap[++t.heap_len]=_=a,t.depth[a]=0):i[2*a+1]=0;for(;t.heap_len<2;)i[2*(r=t.heap[++t.heap_len]=_<2?++_:0)]=1,t.depth[r]=0,t.opt_len--,h&&(t.static_len-=s[2*r+1]);for(e.max_code=_,a=t.heap_len>>1;a>=1;a--)U(t,i,a);r=l;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],U(t,i,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,i[2*r]=i[2*a]+i[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,i[2*a+1]=i[2*n+1]=r,t.heap[1]=r++,U(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,i,s,h,l=e.dyn_tree,_=e.max_code,o=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,p=0;for(i=0;i<=15;i++)t.bl_count[i]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<573;a++)(i=l[2*l[2*(n=t.heap[a])+1]+1]+1)>c&&(i=c,p++),l[2*n+1]=i,n>_||(t.bl_count[i]++,s=0,n>=f&&(s=u[n-f]),h=l[2*n],t.opt_len+=h*(i+s),d&&(t.static_len+=h*(o[2*n+1]+s)));if(0!==p){do{for(i=c-1;0===t.bl_count[i];)i--;t.bl_count[i]--,t.bl_count[i+1]+=2,t.bl_count[c]--,p-=2}while(p>0);for(i=c;0!==i;i--)for(n=t.bl_count[i];0!==n;)(r=t.heap[--a])>_||(l[2*r+1]!==i&&(t.opt_len+=(i-l[2*r+1])*l[2*r],l[2*r+1]=i),n--)}}(t,e),z(i,_,t.bl_count)},E=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=s,s=e[2*(n+1)+1],++h<l&&r===s||(h<_?t.bl_tree[2*r]+=h:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[32]++):h<=10?t.bl_tree[34]++:t.bl_tree[36]++,h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4))},C=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),n=0;n<=a;n++)if(r=s,s=e[2*(n+1)+1],!(++h<l&&r===s)){if(h<_)do{b(t,r,t.bl_tree)}while(0!==--h);else 0!==r?(r!==i&&(b(t,r,t.bl_tree),h--),b(t,16,t.bl_tree),m(t,h-3,2)):h<=10?(b(t,17,t.bl_tree),m(t,h-3,3)):(b(t,18,t.bl_tree),m(t,h-11,7));h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4)}},D=!1,M=function(t,e,a,n){m(t,0+(n?1:0),3),function(t,e,a){x(t),w(t,a),w(t,~a),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a}(t,e,a)},j=M,L=function(t,e,a,n){for(var r=65535&t,i=t>>>16&65535,s=0;0!==a;){a-=s=a>2e3?2e3:a;do{i=i+(r=r+e[n++]|0)|0}while(--s);r%=65521,i%=65521}return r|i<<16},S=new Uint32Array(function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}()),T=function(t,e,a,n){var r=S,i=n+a;t^=-1;for(var s=n;s<i;s++)t=t>>>8^r[255&(t^e[s])];return-1^t},O={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},q=j,F=function(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(_[a]+256+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1},G=-2,H=258,J=262,K=103,N=113,P=666,Q=function(t,e){return t.msg=O[e],e},R=function(t){return(t<<1)-(t>4?9:0)},V=function(t){for(var e=t.length;--e>=0;)t[e]=0},W=function(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask},X=function(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},Y=function(t,e){(function(t,e,a,n){var r,l,_=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),I(t,t.l_desc),I(t,t.d_desc),_=function(t){var e;for(E(t,t.dyn_ltree,t.l_desc.max_code),E(t,t.dyn_dtree,t.d_desc.max_code),I(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*i[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),r=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=r&&(r=l)):r=l=a+5,a+4<=r&&-1!==e?M(t,e,a,n):4===t.strategy||l===r?(m(t,2+(n?1:0),3),B(t,s,h)):(m(t,4+(n?1:0),3),function(t,e,a,n){var r;for(m(t,e-257,5),m(t,a-1,5),m(t,n-4,4),r=0;r<n;r++)m(t,t.bl_tree[2*i[r]+1],3);C(t,t.dyn_ltree,e-1),C(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,_+1),B(t,t.dyn_ltree,t.dyn_dtree)),k(t),n&&x(t)})(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,X(t.strm)},Z=function(t,e){t.pending_buf[t.pending++]=e},$=function(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},tt=function(t,e,a,n){var r=t.avail_in;return r>n&&(r=n),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),a),1===t.state.wrap?t.adler=L(t.adler,e,r,a):2===t.state.wrap&&(t.adler=T(t.adler,e,r,a)),t.next_in+=r,t.total_in+=r,r)},et=function(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-J?t.strstart-(t.w_size-J):0,_=t.window,o=t.w_mask,d=t.prev,u=t.strstart+H,f=_[i+s-1],c=_[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do{if(_[(a=e)+s]===c&&_[a+s-1]===f&&_[a]===_[i]&&_[++a]===_[i+1]){i+=2,a++;do{}while(_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&i<u);if(n=H-(u-i),i=u-H,n>s){if(t.match_start=e,s=n,n>=h)break;f=_[i+s-1],c=_[i+s]}}}while((e=d[e&o])>l&&0!==--r);return s<=t.lookahead?s:t.lookahead},at=function(t){var e,a,n,r,i,s=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-J)){t.window.set(t.window.subarray(s,s+s),0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=a=t.hash_size;do{n=t.head[--e],t.head[e]=n>=s?n-s:0}while(--a);e=a=s;do{n=t.prev[--e],t.prev[e]=n>=s?n-s:0}while(--a);r+=s}if(0===t.strm.avail_in)break;if(a=tt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=a,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=W(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=W(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<J&&0!==t.strm.avail_in)},nt=function(t,e){for(var a,n;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&0===e)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-J&&(t.match_length=et(t,a)),t.match_length>=3)if(n=F(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=W(t,t.ins_h,t.window[t.strstart+1]);else n=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2},rt=function(t,e){for(var a,n,r;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&0===e)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-J&&(t.match_length=et(t,a),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,n=F(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Y(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=F(t,0,t.window[t.strstart-1]))&&Y(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=F(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2};function it(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}var st=[new it(0,0,0,0,function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(at(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,Y(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-J&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(Y(t,!1),t.strm.avail_out),1)}),new it(4,4,8,4,nt),new it(4,5,16,8,nt),new it(4,6,32,32,nt),new it(4,4,16,16,rt),new it(8,16,32,32,rt),new it(8,16,128,128,rt),new it(8,32,128,256,rt),new it(32,128,258,1024,rt),new it(32,258,258,4096,rt)];function ht(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),V(this.dyn_ltree),V(this.dyn_dtree),V(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),V(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}for(var lt=function(t){var e,i=function(t){if(!t||!t.state)return Q(t,G);t.total_in=t.total_out=0,t.data_type=2;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:N,t.adler=2===e.wrap?0:1,e.last_flush=0,function(t){D||(function(){var t,e,i,g,v,w=Array(16);for(i=0,g=0;g<28;g++)for(o[g]=i,t=0;t<1<<a[g];t++)_[i++]=g;for(_[i-1]=g,v=0,g=0;g<16;g++)for(c[g]=v,t=0;t<1<<n[g];t++)l[v++]=g;for(v>>=7;g<30;g++)for(c[g]=v<<7,t=0;t<1<<n[g]-7;t++)l[256+v++]=g;for(e=0;e<=15;e++)w[e]=0;for(t=0;t<=143;)s[2*t+1]=8,t++,w[8]++;for(;t<=255;)s[2*t+1]=9,t++,w[9]++;for(;t<=279;)s[2*t+1]=7,t++,w[7]++;for(;t<=287;)s[2*t+1]=8,t++,w[8]++;for(z(s,287,w),t=0;t<30;t++)h[2*t+1]=5,h[2*t]=y(t,5);d=new p(s,a,257,286,15),u=new p(h,n,0,30,15),f=new p([],r,0,19,7)}(),D=!0),t.l_desc=new g(t.dyn_ltree,d),t.d_desc=new g(t.dyn_dtree,u),t.bl_desc=new g(t.bl_tree,f),t.bi_buf=0,t.bi_valid=0,k(t)}(e),0}(t);return 0===i&&((e=t.state).window_size=2*e.w_size,V(e.head),e.max_lazy_match=st[e.level].max_lazy,e.good_match=st[e.level].good_length,e.nice_match=st[e.level].nice_length,e.max_chain_length=st[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),i},_t=function(t,e){var a,n;if(!t||!t.state||e>5||e<0)return t?Q(t,G):G;var r=t.state;if(!t.output||!t.input&&0!==t.avail_in||r.status===P&&4!==e)return Q(t,0===t.avail_out?-5:G);r.strm=t;var i=r.last_flush;if(r.last_flush=e,42===r.status)if(2===r.wrap)t.adler=0,Z(r,31),Z(r,139),Z(r,8),r.gzhead?(Z(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Z(r,255&r.gzhead.time),Z(r,r.gzhead.time>>8&255),Z(r,r.gzhead.time>>16&255),Z(r,r.gzhead.time>>24&255),Z(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Z(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Z(r,255&r.gzhead.extra.length),Z(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=T(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Z(r,0),Z(r,0),Z(r,0),Z(r,0),Z(r,0),Z(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Z(r,3),r.status=N);else{var h=8+(r.w_bits-8<<4)<<8;h|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(h|=32),h+=31-h%31,r.status=N,$(r,h),0!==r.strstart&&($(r,t.adler>>>16),$(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(a=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending!==r.pending_buf_size));)Z(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Z(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Z(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.status=K)}else r.status=K;if(r.status===K&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&X(t),r.pending+2<=r.pending_buf_size&&(Z(r,255&t.adler),Z(r,t.adler>>8&255),t.adler=0,r.status=N)):r.status=N),0!==r.pending){if(X(t),0===t.avail_out)return r.last_flush=-1,0}else if(0===t.avail_in&&R(e)<=R(i)&&4!==e)return Q(t,-5);if(r.status===P&&0!==t.avail_in)return Q(t,-5);if(0!==t.avail_in||0!==r.lookahead||0!==e&&r.status!==P){var l=2===r.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(at(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,a=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2}(r,e):3===r.strategy?function(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=H){if(at(t),t.lookahead<=H&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[r=t.strstart-1])===s[++r]&&n===s[++r]&&n===s[++r]){i=t.strstart+H;do{}while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<i);t.match_length=H-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=F(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2}(r,e):st[r.level].func(r,e);if(3!==l&&4!==l||(r.status=P),1===l||3===l)return 0===t.avail_out&&(r.last_flush=-1),0;if(2===l&&(1===e?function(t){m(t,2,3),b(t,256,s),function(t){16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}(r):5!==e&&(q(r,0,0,!1),3===e&&(V(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),X(t),0===t.avail_out))return r.last_flush=-1,0}return 4!==e?0:r.wrap<=0?1:(2===r.wrap?(Z(r,255&t.adler),Z(r,t.adler>>8&255),Z(r,t.adler>>16&255),Z(r,t.adler>>24&255),Z(r,255&t.total_in),Z(r,t.total_in>>8&255),Z(r,t.total_in>>16&255),Z(r,t.total_in>>24&255)):($(r,t.adler>>>16),$(r,65535&t.adler)),X(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},ot=function(t){if(!t||!t.state)return G;var e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&e!==K&&e!==N&&e!==P?Q(t,G):(t.state=null,e===N?Q(t,-3):0)},dt=new Uint8Array(256),ut=0;ut<256;ut++)dt[ut]=ut>=252?6:ut>=248?5:ut>=240?4:ut>=224?3:ut>=192?2:1;dt[254]=dt[254]=1;var ft=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},ct=Object.prototype.toString;function pt(){this.options={level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0};var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ft,this.strm.avail_out=0;var e,a,n=function(t,e,a,n,r,i){if(!t)return G;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>9||8!==a||n<8||n>15||e<0||e>9||i<0||i>4)return Q(t,G);8===n&&(n=9);var h=new ht;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=n,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=r+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new Uint8Array(2*h.w_size),h.head=new Uint16Array(h.hash_size),h.prev=new Uint16Array(h.w_size),h.lit_bufsize=1<<r+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new Uint8Array(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=i,h.method=a,lt(t)}(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw Error(O[n]);if(t.header&&(e=this.strm,a=t.header,e&&e.state&&(2!==e.state.wrap||(e.state.gzhead=a))),t.dictionary){var r;if(r="[object ArrayBuffer]"===ct.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=function(t,e){var a=e.length;if(!t||!t.state)return G;var n=t.state,r=n.wrap;if(2===r||1===r&&42!==n.status||n.lookahead)return G;if(1===r&&(t.adler=L(t.adler,e,a,0)),n.wrap=0,a>=n.w_size){0===r&&(V(n.head),n.strstart=0,n.block_start=0,n.insert=0);var i=new Uint8Array(n.w_size);i.set(e.subarray(a-n.w_size,a),0),e=i,a=n.w_size}var s=t.avail_in,h=t.next_in,l=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,at(n);n.lookahead>=3;){var _=n.strstart,o=n.lookahead-2;do{n.ins_h=W(n,n.ins_h,n.window[_+3-1]),n.prev[_&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=_,_++}while(--o);n.strstart=_,n.lookahead=2,at(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=h,t.input=l,t.avail_in=s,n.wrap=r,0}(this.strm,r)))throw Error(O[n]);this._dict_set=!0}}function gt(t,e,a){try{t.postMessage({type:"errored",error:e,streamId:a})}catch(n){t.postMessage({type:"errored",error:e+"",streamId:a})}}function vt(t){const e=t.strm.adler;return new Uint8Array([3,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])}pt.prototype.push=function(t,e){var a,n,r=this.strm,i=this.options.chunkSize;if(this.ended)return!1;for(n=e===~~e?e:!0===e?4:0,"[object ArrayBuffer]"===ct.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(2===n||3===n)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(1===(a=_t(r,n)))return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),a=ot(this.strm),this.onEnd(a),this.ended=!0,0===a;if(0!==r.avail_out){if(n>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},pt.prototype.onData=function(t){this.chunks.push(t)},pt.prototype.onEnd=function(t){0===t&&(this.result=function(t){for(var e=0,a=0,n=t.length;a<n;a++)e+=t[a].length;for(var r=new Uint8Array(e),i=0,s=0,h=t.length;i<h;i++){var l=t[i];r.set(l,s),s+=l.length}return r}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},function(e=self){try{const a=new Map;e.addEventListener("message",n=>{try{const r=function(e,a){switch(a.action){case"init":return{type:"initialized",version:"6.24.1"};case"write":{let n=e.get(a.streamId);n||(n=new pt,e.set(a.streamId,n));const r=n.chunks.length,i=function(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,n,r,i,s=t.length,h=0;for(r=0;r<s;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),r++)),h+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(h),i=0,r=0;i<h;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),r++)),a<128?e[i++]=a:a<2048?(e[i++]=192|a>>>6,e[i++]=128|63&a):a<65536?(e[i++]=224|a>>>12,e[i++]=128|a>>>6&63,e[i++]=128|63&a):(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63,e[i++]=128|a>>>6&63,e[i++]=128|63&a);return e}(a.data);return n.push(i,2),{type:"wrote",id:a.id,streamId:a.streamId,result:t(n.chunks.slice(r)),trailer:vt(n),additionalBytesCount:i.length}}case"reset":e.delete(a.streamId)}}(a,n.data);r&&e.postMessage(r)}catch(t){gt(e,t,n.data&&"streamId"in n.data?n.data.streamId:void 0)}})}catch(t){gt(e,t)}}()})();'])))}let Me={status:0};function cS(e,t,r,a=lS){switch(Me.status===0&&sU(e,t,a),Me.status){case 1:return Me.initializationFailureCallbacks.push(r),Me.worker;case 3:return Me.worker}}function ig(){return Me.status}function sU(e,t,r=lS){try{const a=r(e),{stop:n}=je(e,a,"error",s=>{Ql(e,t,s)}),{stop:o}=je(e,a,"message",({data:s})=>{s.type==="errored"?Ql(e,t,s.error,s.streamId):s.type==="initialized"&&cU(s.version)});a.postMessage({action:"init"}),Qe(()=>lU(t),iU),Me={status:1,worker:a,stop:()=>{n(),o()},initializationFailureCallbacks:[]}}catch(a){Ql(e,t,a)}}function lU(e){Me.status===1&&(Q.error(`${e} failed to start: a timeout occurred while initializing the Worker`),Me.initializationFailureCallbacks.forEach(t=>t()),Me={status:2})}function cU(e){Me.status===1&&(Me={status:3,worker:Me.worker,stop:Me.stop,version:e})}function Ql(e,t,r,a){Me.status===1||Me.status===0?(jm({configuredUrl:e.workerUrl,error:r,source:t,scriptType:"worker"}),Me.status===1&&Me.initializationFailureCallbacks.forEach(n=>n()),Me={status:2}):Im(r,{worker_version:Me.status===3&&Me.version,stream_id:a})}function uS(){return typeof Array.from=="function"&&typeof CSSSupportsRule=="function"&&typeof URL.createObjectURL=="function"&&"forEach"in NodeList.prototype}function uU(e,t,r,a){const n=t.findTrackedSession(),o=dU(n,a),i=r.findView();return WM(e,{viewContext:i,errorType:o,session:n})}function dU(e,t){if(!uS())return"browser-not-supported";if(!e)return"rum-not-tracked";if(e.sessionReplay===0)return"incorrect-session-plan";if(!t)return"replay-not-started"}function mU(e,t){if(!e.metricsEnabled)return{stop:ve};let r,a,n;const{unsubscribe:o}=t.subscribe(i=>{switch(i.type){case"start":r={forced:i.forced,timestamp:Je()},a=void 0,n=void 0;break;case"document-ready":r&&(a=De(r.timestamp,Je()));break;case"recorder-settled":r&&(n=De(r.timestamp,Je()));break;case"aborted":case"deflate-encoder-load-failed":case"recorder-load-failed":case"succeeded":o(),r&&Ao("Recorder init metrics",{metrics:pU(r.forced,n,De(r.timestamp,Je()),i.type,a)});break}});return{stop:o}}function pU(e,t,r,a,n){return{forced:e,loadRecorderModuleDuration:t,recorderInitDuration:r,result:a,waitForDocReadyDuration:n}}function fU(e,t,r,a,n,o,i){let s=0,l;t.subscribe(9,()=>{(s===2||s===3)&&(m(),s=1)}),t.subscribe(10,()=>{s===1&&d()});const c=new ge;mU(i,c);const u=async f=>{c.notify({type:"start",forced:f});const[g]=await Promise.all([sg(c,{type:"recorder-settled"},n()),sg(c,{type:"document-ready"},e2(e,"interactive"))]);if(s!==2){c.notify({type:"aborted"});return}if(!g){s=0,c.notify({type:"recorder-load-failed"});return}const h=o();if(!h){s=0,c.notify({type:"deflate-encoder-load-failed"});return}({stop:l}=g(t,e,r,a,h,i)),s=3,c.notify({type:"succeeded"})};function d(f){const g=r.findTrackedSession();if(gU(g,f)){s=1;return}if(hU(s))return;s=2;const h=vU(g,f)||!1;u(h).catch(ir),h&&r.setForcedReplay()}function m(){s===3&&l?.(),s=0}return{start:d,stop:m,getSessionReplayLink(){return uU(e,r,a,s!==0)},isRecording:()=>s===3}}function gU(e,t){return!e||e.sessionReplay===0&&(!t||!t.force)}function hU(e){return e===2||e===3}function vU(e,t){return t&&t.force&&e.sessionReplay===0}async function sg(e,t,r){try{return await r}finally{e.notify(t)}}function bU(){let e=0;return{strategy:{start(){e=1},stop(){e=2},isRecording:()=>!1,getSessionReplayLink:ve},shouldStartImmediately(t){return e===1||e===0&&!t.startSessionReplayRecordingManually}}}function yU(e,t){if(Gr()&&!Wx("records")||!uS())return{start:ve,stop:ve,getReplayStats:()=>{},onRumStart:ve,isRecording:()=>!1,getSessionReplayLink:()=>{}};let{strategy:r,shouldStartImmediately:a}=bU();return{start:o=>r.start(o),stop:()=>r.stop(),getSessionReplayLink:()=>r.getSessionReplayLink(),onRumStart:n,isRecording:()=>ig()===3&&r.isRecording(),getReplayStats:o=>ig()===3?nU(o):void 0};function n(o,i,s,l,c,u){let d;function m(){return d||(c??(c=cS(i,"Datadog Session Replay",()=>{r.stop()},t)),c&&(d=sS(i,c,1))),d}r=fU(i,o,s,l,e,m,u),a(i)&&r.start()}}async function wU(e=_U){try{return await e()}catch(t){jm({error:t,source:"Recorder",scriptType:"module"})}}async function _U(){return(await Promise.resolve().then(()=>require("./startRecording-7Oy6wM18.cjs"))).startRecording}function xU(){return $t().Profiler!==void 0}const kU=e=>{let t={status:"starting"};return e.register(0,({eventType:r})=>r!==ne.VIEW&&r!==ne.LONG_TASK?kt:{type:r,_dd:{profiling:t}}),{get:()=>t,set:r=>{t=r}}};async function SU(e=IU){try{return await e()}catch(t){jm({error:t,source:"Profiler",scriptType:"module"})}}async function IU(){return(await Promise.resolve().then(()=>require("./profiler-B3tfiOx4.cjs"))).createRumProfiler}function EU(){let e;function t(r,a,n,o,i,s){const l=o.findTrackedSession();if(!l||!gk(l.id,n.profilingSampleRate))return;const c=kU(a);if(!xU()){c.set({status:"error",error_reason:"not-supported-by-browser"});return}SU().then(u=>{if(!u){Xn("[DD_RUM] Failed to lazy load the RUM Profiler"),c.set({status:"error",error_reason:"failed-to-lazy-load"});return}e=u(n,r,o,c,s),e.start(i.findView())}).catch(ir)}return{onRumStart:t,stop:()=>{e?.stop().catch(ir)}}}const TU=yU(wU),$U=EU(),ka=v4(HM,TU,$U,{startDeflateWorker:cS,createDeflateEncoder:sS,sdkName:"rum"});Xj($t(),"DD_RUM",ka);const ma={applicationId:"0b0a19b9-099b-4812-b342-930518330975",clientToken:"puba92c09799d321f572535176e9fe08256",site:"datadoghq.com",env:"prod",service:"gram-elements"};let Hc=!1,Jc=!0;function OU(e={}){if(e.enabled===!1){Jc=!1;return}if(!Hc)try{ka.init({applicationId:ma.applicationId,clientToken:ma.clientToken,site:ma.site,service:ma.service,env:ma.env,sessionSampleRate:100,sessionReplaySampleRate:100,trackUserInteractions:!0,trackResources:!0,trackLongTasks:!0,defaultPrivacyLevel:"mask"}),e.projectSlug&&ka.setGlobalContextProperty("projectSlug",e.projectSlug),e.variant&&ka.setGlobalContextProperty("variant",e.variant),Hc=!0}catch(t){console.warn("[Elements] Failed to initialize Datadog RUM:",t),Jc=!1}}function Ua(e,t){if(!Jc||!Hc)return;const r=e instanceof Error?e:new Error(String(e));try{ka.addError(r,{...t,timestamp:new Date().toISOString()})}catch(a){console.warn("[Elements] Failed to track error:",a)}}function CU({auth:e,mcp:t,mcps:r,environment:a,toolsToInclude:n,gramEnvironment:o}){const i=T.useMemo(()=>NU(t,r,o),[t,r,o]),s=Object.entries(a??{}).map(([b,w])=>`${b}:${w}`),l=Object.entries(e.headers??{}).map(([b,w])=>`${b}:${w}`),c=i.map(b=>`${b.url}|${b.name??""}|${b.environment??""}`),u=T.useRef([]),d=T.useRef(!1),m=T.useRef(null);m.current||(m.current=new Proxy({},{set(b,w,x){for(const k of u.current)k[w]=x;return!0},deleteProperty(b,w){for(const x of u.current)delete x[w];return!0}}));const f=m.current,g=ax({queryKey:["mcpTools",c,s,l],queryFn:async()=>{v.assert(!e.isLoading,"No auth found"),v.assert(i.length>0,"No MCP server configured");const b=RU(a??{}),w=e.headers??{},x=i.map(E=>({server:E,headers:{...b,...w,...E.environment&&{"Gram-Environment":E.environment}}}));u.current=x.map(E=>E.headers);const k=await Promise.allSettled(x.map(async({server:E,headers:A})=>{const F=await IA({name:"gram-elements-mcp-client",transport:{type:"http",url:E.url,headers:A}});return{server:E,tools:await F.tools()}})),y={},$=i.length>1;let I=0;for(const[E,{server:A}]of x.entries()){const F=k[E];if(F.status==="rejected"){I++,Ua(F.reason,{source:"custom",scope:"mcp-tools",serverName:A.name??cg(A.url),serverUrl:A.url});continue}const q=$?A.name??cg(A.url):null;for(const[ee,Ne]of Object.entries(F.value.tools)){const te=q?`${q}__${ee}`:ee;y[te]=Ne}}if(d.current=I>0&&I<x.length,I>0&&I===x.length){const E=k.find(A=>A.status==="rejected");throw E?.reason instanceof Error?E.reason:new Error("All MCP servers failed to list tools")}return y},enabled:!e.isLoading&&i.length>0,staleTime:()=>d.current?0:1/0,gcTime:1/0}),h=T.useMemo(()=>!g.data||!n?g.data:Object.fromEntries(Object.entries(g.data).filter(([b])=>typeof n=="function"?n({toolName:b}):n.includes(b))),[g.data,n]);return{...g,data:h,mcpHeaders:f}}function NU(e,t,r){return t&&t.length>0?(e&&AU(),t.map(a=>({url:a.url,name:a.name,environment:a.environment}))):e?[{url:e,name:void 0,environment:r}]:[]}let lg=!1;function AU(){lg||(lg=!0,console.warn("[gram-elements] Both `mcp` and `mcps` are set on ElementsConfig; `mcps` takes precedence and `mcp` is ignored."))}function cg(e){let t;try{t=new URL(e).pathname}catch{t=e}return(t.split("/mcp/")[1]??t).replace(/^\/+|\/+$/g,"").replace(/[^a-zA-Z0-9_-]+/g,"_")||"mcp"}const ug="MCP-";function RU(e){return typeof e!="object"||e===null?{}:Object.entries(e).reduce((t,[r,a])=>{const n=r.replace(/_/g,"-"),o=n.startsWith(ug)?n:`${ug}${n}`;return t[o]=a,t},{})}const dS=()=>{const e=T.useContext(v.ToolApprovalContext);if(!e)throw new Error("useToolApproval must be used within a ToolApprovalProvider");return e};function ml(e){return(e.api?.url||""||"https://app.getgram.ai").replace(/\/+$/,"")}const pl=["anthropic/claude-opus-4.6","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet-4.5","anthropic/claude-opus-4.5","anthropic/claude-haiku-4.5","anthropic/claude-opus-4.1","anthropic/claude-sonnet-4","openai/gpt-5.4","openai/gpt-5.4-mini","openai/gpt-5.1","openai/gpt-5.1-codex","openai/gpt-5","openai/gpt-4.1","openai/o4-mini","openai/o3","google/gemini-3.1-pro-preview","google/gemini-2.5-pro","google/gemini-2.5-flash","deepseek/deepseek-r1","deepseek/deepseek-v3.2","meta-llama/llama-4-maverick","x-ai/grok-4","qwen/qwen3-coder","moonshotai/kimi-k2.5","mistralai/mistral-medium-3.1","mistralai/codestral-2508","mistralai/devstral-small"],jU=e=>Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r.description?{description:r.description}:void 0,parameters:r.parameters instanceof ef.ZodType?ef.toJSONSchema(r.parameters):r.parameters}])),PU=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>!t.disabled&&t.type!=="backend"));let Fi=null;function zU(e,t){const r=mS(t);Fi={helpers:e,requiresApproval:r}}function DU(){Fi=null}function mS(e){if(!e)return()=>!1;if(typeof e=="function")return r=>e({toolName:r});const t=new Set(e);return r=>t.has(r)}const MU=(e,t)=>P.makeAssistantTool({...e,execute:async(r,a)=>{if(Fi?.requiresApproval(t)){const{helpers:n}=Fi,o=a.toolCallId??"";if(!n.isToolApproved(t)&&!await n.requestApproval(t,o,r))return{content:[{type:"text",text:`Tool "${t}" execution was denied by the user. Please acknowledge this and continue without using this tool's result.`}],isError:!0}}return e.execute?.(r,a)},toolName:t}),UU=.9;function dg(e,t){if(t<=0)return e;const r=e,a=new TextEncoder().encode(r);if(a.byteLength<=t)return r;const n=`
|
|
40
40
|
|
|
41
41
|
[…tool output truncated from ${a.byteLength} bytes to ${t}; ask a narrower question to see more…]
|
|
42
42
|
|
|
@@ -96,7 +96,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
96
96
|
`)},flush(e){e.enqueue(`data: [DONE]
|
|
97
97
|
|
|
98
98
|
`)}})}},p1={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};function I8({status:e,statusText:t,headers:r,stream:a,consumeSseStream:n}){let o=a.pipeThrough(new m1);if(n){const[i,s]=o.tee();o=i,n({stream:s})}return new Response(o.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:Lo(r,p1)})}function E8({originalMessages:e,responseMessageId:t}){if(e==null)return;const r=e[e.length-1];return r?.role==="assistant"?r.id:typeof t=="function"?t():t}function T8(e){return e.type.startsWith("data-")}function f1(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const r={...e};for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const n=t[a];if(n===void 0)continue;const o=a in e?e[a]:void 0,i=n!==null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp),s=o!=null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);i&&s?r[a]=f1(o,n):r[a]=n}return r}function $8(e){const t=["ROOT"];let r=-1,a=null;function n(l,c,u){switch(l){case'"':{r=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=c,a=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{r=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{r=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function o(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=c,t.pop();break}}}function i(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":n(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(c){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{n(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{o(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),r=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=l}break}case"INSIDE_ARRAY_START":{switch(c){case"]":{r=l,t.pop();break}default:{r=l,n(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=l,t.pop();break}default:{r=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{n(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),r=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(a,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?o(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l)):r=l;break}}}let s=e.slice(0,r+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{s+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{s+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{s+="]";break}case"INSIDE_LITERAL":{const u=e.substring(a,e.length);"true".startsWith(u)?s+="true".slice(u.length):"false".startsWith(u)?s+="false".slice(u.length):"null".startsWith(u)&&(s+="null".slice(u.length))}}return s}async function g1(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Er({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Er({text:$8(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}function fc(e){return e.type.startsWith("data-")}function gc(e){return e.type==="text"}function hc(e){return e.type==="file"}function rh(e){return e.type==="reasoning"}function Sn(e){return e.type.startsWith("tool-")}function ip(e){return e.type==="dynamic-tool"}function du(e){return Sn(e)||ip(e)}function Yi(e){return e.type.split("-").slice(1).join("-")}function O8(e){return ip(e)?e.toolName:Yi(e)}function C8({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function N8({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:a,onError:n,onToolCall:o,onData:i}){return e.pipeThrough(new TransformStream({async transform(s,l){await a(async({state:c,write:u})=>{var d,m,f,g;function h(y){const I=c.message.parts.filter(Sn).find(E=>E.toolCallId===y);if(I==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return I}function b(y){const I=c.message.parts.filter(E=>E.type==="dynamic-tool").find(E=>E.toolCallId===y);if(I==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return I}function w(y){var $;const I=c.message.parts.find(F=>Sn(F)&&F.toolCallId===y.toolCallId),E=y,A=I;I!=null?(I.state=y.state,A.input=E.input,A.output=E.output,A.errorText=E.errorText,A.rawInput=E.rawInput,A.preliminary=E.preliminary,A.providerExecuted=($=E.providerExecuted)!=null?$:I.providerExecuted,E.providerMetadata!=null&&I.state==="input-available"&&(I.callProviderMetadata=E.providerMetadata)):c.message.parts.push({type:`tool-${y.toolName}`,toolCallId:y.toolCallId,state:y.state,input:E.input,output:E.output,rawInput:E.rawInput,errorText:E.errorText,providerExecuted:E.providerExecuted,preliminary:E.preliminary,...E.providerMetadata!=null?{callProviderMetadata:E.providerMetadata}:{}})}function x(y){var $,I;const E=c.message.parts.find(q=>q.type==="dynamic-tool"&&q.toolCallId===y.toolCallId),A=y,F=E;E!=null?(E.state=y.state,F.toolName=y.toolName,F.input=A.input,F.output=A.output,F.errorText=A.errorText,F.rawInput=($=A.rawInput)!=null?$:F.rawInput,F.preliminary=A.preliminary,F.providerExecuted=(I=A.providerExecuted)!=null?I:E.providerExecuted,A.providerMetadata!=null&&E.state==="input-available"&&(E.callProviderMetadata=A.providerMetadata)):c.message.parts.push({type:"dynamic-tool",toolName:y.toolName,toolCallId:y.toolCallId,state:y.state,input:A.input,output:A.output,errorText:A.errorText,preliminary:A.preliminary,providerExecuted:A.providerExecuted,...A.providerMetadata!=null?{callProviderMetadata:A.providerMetadata}:{}})}async function k(y){if(y!=null){const $=c.message.metadata!=null?f1(c.message.metadata,y):y;t!=null&&await nu({value:$,schema:t}),c.message.metadata=$}}switch(s.type){case"text-start":{const y={type:"text",text:"",providerMetadata:s.providerMetadata,state:"streaming"};c.activeTextParts[s.id]=y,c.message.parts.push(y),u();break}case"text-delta":{const y=c.activeTextParts[s.id];y.text+=s.delta,y.providerMetadata=(d=s.providerMetadata)!=null?d:y.providerMetadata,u();break}case"text-end":{const y=c.activeTextParts[s.id];y.state="done",y.providerMetadata=(m=s.providerMetadata)!=null?m:y.providerMetadata,delete c.activeTextParts[s.id],u();break}case"reasoning-start":{const y={type:"reasoning",text:"",providerMetadata:s.providerMetadata,state:"streaming"};c.activeReasoningParts[s.id]=y,c.message.parts.push(y),u();break}case"reasoning-delta":{const y=c.activeReasoningParts[s.id];y.text+=s.delta,y.providerMetadata=(f=s.providerMetadata)!=null?f:y.providerMetadata,u();break}case"reasoning-end":{const y=c.activeReasoningParts[s.id];y.providerMetadata=(g=s.providerMetadata)!=null?g:y.providerMetadata,y.state="done",delete c.activeReasoningParts[s.id],u();break}case"file":{c.message.parts.push({type:"file",mediaType:s.mediaType,url:s.url}),u();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:s.sourceId,url:s.url,title:s.title,providerMetadata:s.providerMetadata}),u();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:s.sourceId,mediaType:s.mediaType,title:s.title,filename:s.filename,providerMetadata:s.providerMetadata}),u();break}case"tool-input-start":{const y=c.message.parts.filter(Sn);c.partialToolCalls[s.toolCallId]={text:"",toolName:s.toolName,index:y.length,dynamic:s.dynamic},s.dynamic?x({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}):w({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}),u();break}case"tool-input-delta":{const y=c.partialToolCalls[s.toolCallId];y.text+=s.inputTextDelta;const{value:$}=await g1(y.text);y.dynamic?x({toolCallId:s.toolCallId,toolName:y.toolName,state:"input-streaming",input:$}):w({toolCallId:s.toolCallId,toolName:y.toolName,state:"input-streaming",input:$}),u();break}case"tool-input-available":{s.dynamic?x({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):w({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),u(),o&&!s.providerExecuted&&await o({toolCall:s});break}case"tool-input-error":{s.dynamic?x({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):w({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:void 0,rawInput:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),u();break}case"tool-output-available":{if(s.dynamic){const y=b(s.toolCallId);x({toolCallId:s.toolCallId,toolName:y.toolName,state:"output-available",input:y.input,output:s.output,preliminary:s.preliminary})}else{const y=h(s.toolCallId);w({toolCallId:s.toolCallId,toolName:Yi(y),state:"output-available",input:y.input,output:s.output,providerExecuted:s.providerExecuted,preliminary:s.preliminary})}u();break}case"tool-output-error":{if(s.dynamic){const y=b(s.toolCallId);x({toolCallId:s.toolCallId,toolName:y.toolName,state:"output-error",input:y.input,errorText:s.errorText,providerExecuted:s.providerExecuted})}else{const y=h(s.toolCallId);w({toolCallId:s.toolCallId,toolName:Yi(y),state:"output-error",input:y.input,rawInput:y.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted})}u();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{s.messageId!=null&&(c.message.id=s.messageId),await k(s.messageMetadata),(s.messageId!=null||s.messageMetadata!=null)&&u();break}case"finish":{await k(s.messageMetadata),s.messageMetadata!=null&&u();break}case"message-metadata":{await k(s.messageMetadata),s.messageMetadata!=null&&u();break}case"error":{n?.(new Error(s.errorText));break}default:if(T8(s)){r?.[s.type]!=null&&await nu({value:s.data,schema:r[s.type]});const y=s;if(y.transient){i?.(y);break}const $=y.id!=null?c.message.parts.find(I=>y.type===I.type&&y.id===I.id):void 0;$!=null?$.data=y.data:c.message.parts.push(y),i?.(y),u()}}l.enqueue(s)})}}))}function h1({messageId:e,originalMessages:t=[],onFinish:r,onError:a,stream:n}){let o=t?.[t.length-1];o?.role!=="assistant"?o=void 0:e=o.id;let i=!1;const s=n.pipeThrough(new TransformStream({transform(m,f){if(m.type==="start"){const g=m;g.messageId==null&&e!=null&&(g.messageId=e)}m.type==="abort"&&(i=!0),f.enqueue(m)}}));if(r==null)return s;const l=C8({lastMessage:o?structuredClone(o):void 0,messageId:e??""}),c=async m=>{await m({state:l,write:()=>{}})};let u=!1;const d=async()=>{if(u||!r)return;u=!0;const m=l.message.id===o?.id;await r({isAborted:i,isContinuation:m,responseMessage:l.message,messages:[...m?t.slice(0,-1):t,l.message]})};return N8({stream:s,runUpdateMessageJob:c,onError:a}).pipeThrough(new TransformStream({transform(m,f){f.enqueue(m)},async cancel(){await d()},async flush(){await d()}}))}function A8({response:e,status:t,statusText:r,headers:a,stream:n,consumeSseStream:o}){let i=n.pipeThrough(new m1);if(o){const[s,l]=i.tee();i=s,o({stream:l})}d1({response:e,status:t,statusText:r,headers:Object.fromEntries(Lo(a,p1).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function ya(e){const t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){const r=this.getReader();let a=!1;async function n(o){var i;a=!0;try{o&&await((i=r.cancel)==null?void 0:i.call(r))}finally{try{r.releaseLock()}catch{}}}return{async next(){if(a)return{done:!0,value:void 0};const{done:o,value:i}=await r.read();return o?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(o){throw await n(!0),o}}},t}async function R8({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:a}=await r.read();if(a)break}}catch(a){t?.(a)}finally{r.releaseLock()}}function nh(){let e,t;return{promise:new Promise((a,n)=>{e=a,t=n}),resolve:e,reject:t}}function j8(){let e=[],t=null,r=!1,a=nh();const n=()=>{r=!0,a.resolve(),e.forEach(i=>i.cancel()),e=[],t?.close()},o=async()=>{if(r&&e.length===0){t?.close();return}if(e.length===0)return a=nh(),await a.promise,o();try{const{value:i,done:s}=await e[0].read();s?(e.shift(),e.length>0?await o():r&&t?.close()):t?.enqueue(i)}catch(i){t?.error(i),e.shift(),n()}};return{stream:new ReadableStream({start(i){t=i},pull:o,async cancel(){for(const i of e)await i.cancel();e=[],r=!0}}),addStream:i=>{if(r)throw new Error("Cannot add inner stream: outer stream is closed");e.push(i.getReader()),a.resolve()},close:()=>{r=!0,a.resolve(),e.length===0&&t?.close()},terminate:n}}var oi=class{constructor(){this.status={type:"pending"},this._resolve=void 0,this._reject=void 0}get promise(){return this._promise?this._promise:(this._promise=new Promise((e,t)=>{this.status.type==="resolved"?e(this.status.value):this.status.type==="rejected"&&t(this.status.error),this._resolve=e,this._reject=t}),this._promise)}resolve(e){var t;this.status={type:"resolved",value:e},this._promise&&((t=this._resolve)==null||t.call(this,e))}reject(e){var t;this.status={type:"rejected",error:e},this._promise&&((t=this._reject)==null||t.call(this,e))}};function P8(){var e,t;return(t=(e=globalThis?.performance)==null?void 0:e.now())!=null?t:Date.now()}function z8({tools:e,generatorStream:t,tracer:r,telemetry:a,system:n,messages:o,abortSignal:i,repairToolCall:s,experimental_context:l}){let c=null;const u=new ReadableStream({start(w){c=w}}),d=new Set,m=new Map;let f=!1,g;function h(){f&&d.size===0&&(g!=null&&c.enqueue(g),c.close())}const b=new TransformStream({async transform(w,x){const k=w.type;switch(k){case"stream-start":case"text-start":case"text-delta":case"text-end":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"tool-input-start":case"tool-input-delta":case"tool-input-end":case"source":case"response-metadata":case"error":case"raw":{x.enqueue(w);break}case"file":{x.enqueue({type:"file",file:new y8({data:w.data,mediaType:w.mediaType})});break}case"finish":{g={type:"finish",finishReason:w.finishReason,usage:w.usage,providerMetadata:w.providerMetadata};break}case"tool-call":{try{const y=await w8({toolCall:w,tools:e,repairToolCall:s,system:n,messages:o});if(x.enqueue(y),y.invalid){c.enqueue({type:"tool-error",toolCallId:y.toolCallId,toolName:y.toolName,input:y.input,error:Wm(y.error),dynamic:!0});break}const $=e[y.toolName];if(m.set(y.toolCallId,y.input),$.onInputAvailable!=null&&await $.onInputAvailable({input:y.input,toolCallId:y.toolCallId,messages:o,abortSignal:i,experimental_context:l}),$.execute!=null&&y.providerExecuted!==!0){const I=ZI();d.add(I),Xa({name:"ai.toolCall",attributes:Kt({telemetry:a,attributes:{...Ya({operationId:"ai.toolCall",telemetry:a}),"ai.toolCall.name":y.toolName,"ai.toolCall.id":y.toolCallId,"ai.toolCall.args":{output:()=>JSON.stringify(y.input)}}}),tracer:r,fn:async E=>{let A;try{const F=mF({execute:$.execute.bind($),input:y.input,options:{toolCallId:y.toolCallId,messages:o,abortSignal:i,experimental_context:l}});for await(const q of F)c.enqueue({...y,type:"tool-result",output:q.output,...q.type==="preliminary"&&{preliminary:!0}}),q.type==="final"&&(A=q.output)}catch(F){i1(E,F),c.enqueue({...y,type:"tool-error",error:F}),d.delete(I),h();return}d.delete(I),h();try{E.setAttributes(Kt({telemetry:a,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(A)}}}))}catch{}}})}}catch(y){c.enqueue({type:"error",error:y})}break}case"tool-result":{const y=w.toolName;w.isError?c.enqueue({type:"tool-error",toolCallId:w.toolCallId,toolName:y,input:m.get(w.toolCallId),providerExecuted:w.providerExecuted,error:w.result}):x.enqueue({type:"tool-result",toolCallId:w.toolCallId,toolName:y,input:m.get(w.toolCallId),output:w.result,providerExecuted:w.providerExecuted});break}default:{const y=k;throw new Error(`Unhandled chunk type: ${y}`)}}},flush(){f=!0,h()}});return new ReadableStream({async start(w){return Promise.all([t.pipeThrough(b).pipeTo(new WritableStream({write(x){w.enqueue(x)},close(){}})),u.pipeTo(new WritableStream({write(x){w.enqueue(x)},close(){w.close()}}))])}})}var D8=Mo({prefix:"aitxt",size:24});function M8({model:e,tools:t,toolChoice:r,system:a,prompt:n,messages:o,maxRetries:i,abortSignal:s,headers:l,stopWhen:c=u1(1),experimental_output:u,experimental_telemetry:d,prepareStep:m,providerOptions:f,experimental_activeTools:g,activeTools:h=g,experimental_repairToolCall:b,experimental_transform:w,experimental_download:x,includeRawChunks:k=!1,onChunk:y,onError:$=({error:J})=>{console.error(J)},onFinish:I,onAbort:E,onStepFinish:A,experimental_context:F,_internal:{now:q=P8,generateId:ee=D8,currentDate:Ne=()=>new Date}={},...te}){return new L8({model:op(e),telemetry:d,headers:l,settings:te,maxRetries:i,abortSignal:s,system:a,prompt:n,messages:o,tools:t,toolChoice:r,transforms:Xg(w),activeTools:h,repairToolCall:b,stopConditions:Xg(c),output:u,providerOptions:f,prepareStep:m,includeRawChunks:k,onChunk:y,onError:$,onFinish:I,onAbort:E,onStepFinish:A,now:q,currentDate:Ne,generateId:ee,experimental_context:F,download:x})}function U8(e){if(!e)return new TransformStream({transform(i,s){s.enqueue({part:i,partialOutput:void 0})}});let t,r="",a="",n="";function o({controller:i,partialOutput:s=void 0}){i.enqueue({part:{type:"text-delta",id:t,text:a},partialOutput:s}),a=""}return new TransformStream({async transform(i,s){if(i.type==="finish-step"&&a.length>0&&o({controller:s}),i.type!=="text-delta"&&i.type!=="text-start"&&i.type!=="text-end"){s.enqueue({part:i,partialOutput:void 0});return}if(t==null)t=i.id;else if(i.id!==t){s.enqueue({part:i,partialOutput:void 0});return}if(i.type==="text-start"){s.enqueue({part:i,partialOutput:void 0});return}if(i.type==="text-end"){a.length>0&&o({controller:s}),s.enqueue({part:i,partialOutput:void 0});return}r+=i.text,a+=i.text;const l=await e.parsePartial({text:r});if(l!=null){const c=JSON.stringify(l.partial);c!==n&&(o({controller:s,partialOutput:l.partial}),n=c)}}})}var L8=class{constructor({model:e,telemetry:t,headers:r,settings:a,maxRetries:n,abortSignal:o,system:i,prompt:s,messages:l,tools:c,toolChoice:u,transforms:d,activeTools:m,repairToolCall:f,stopConditions:g,output:h,providerOptions:b,prepareStep:w,includeRawChunks:x,now:k,currentDate:y,generateId:$,onChunk:I,onError:E,onFinish:A,onAbort:F,onStepFinish:q,experimental_context:ee,download:Ne}){this._totalUsage=new oi,this._finishReason=new oi,this._steps=new oi,this.output=h,this.includeRawChunks=x,this.tools=c;let te,J=[];const Ae=[];let fe,Ue,$e={},ke=[];const M=[];let he,le={},_e={};const j=new TransformStream({async transform(xe,Y){var re,pe,yt,ta;Y.enqueue(xe);const{part:U}=xe;if((U.type==="text-delta"||U.type==="reasoning-delta"||U.type==="source"||U.type==="tool-call"||U.type==="tool-result"||U.type==="tool-input-start"||U.type==="tool-input-delta"||U.type==="raw")&&await I?.({chunk:U}),U.type==="error"&&await E({error:n1(U.error)}),U.type==="text-start"&&(le[U.id]={type:"text",text:"",providerMetadata:U.providerMetadata},J.push(le[U.id])),U.type==="text-delta"){const ze=le[U.id];if(ze==null){Y.enqueue({part:{type:"error",error:`text part ${U.id} not found`},partialOutput:void 0});return}ze.text+=U.text,ze.providerMetadata=(re=U.providerMetadata)!=null?re:ze.providerMetadata}if(U.type==="text-end"){const ze=le[U.id];if(ze==null){Y.enqueue({part:{type:"error",error:`text part ${U.id} not found`},partialOutput:void 0});return}ze.providerMetadata=(pe=U.providerMetadata)!=null?pe:ze.providerMetadata,delete le[U.id]}if(U.type==="reasoning-start"&&(_e[U.id]={type:"reasoning",text:"",providerMetadata:U.providerMetadata},J.push(_e[U.id])),U.type==="reasoning-delta"){const ze=_e[U.id];if(ze==null){Y.enqueue({part:{type:"error",error:`reasoning part ${U.id} not found`},partialOutput:void 0});return}ze.text+=U.text,ze.providerMetadata=(yt=U.providerMetadata)!=null?yt:ze.providerMetadata}if(U.type==="reasoning-end"){const ze=_e[U.id];if(ze==null){Y.enqueue({part:{type:"error",error:`reasoning part ${U.id} not found`},partialOutput:void 0});return}ze.providerMetadata=(ta=U.providerMetadata)!=null?ta:ze.providerMetadata,delete _e[U.id]}if(U.type==="file"&&J.push({type:"file",file:U.file}),U.type==="source"&&J.push(U),U.type==="tool-call"&&J.push(U),U.type==="tool-result"&&!U.preliminary&&J.push(U),U.type==="tool-error"&&J.push(U),U.type==="start-step"&&($e=U.request,ke=U.warnings),U.type==="finish-step"){const ze=th({content:J,tools:c}),ra=new _8({content:J,finishReason:U.finishReason,usage:U.usage,warnings:ke,request:$e,response:{...U.response,messages:[...Ae,...ze]},providerMetadata:U.providerMetadata});await q?.(ra),vE(ke),M.push(ra),J=[],_e={},le={},Ae.push(...ze),te.resolve()}U.type==="finish"&&(Ue=U.totalUsage,fe=U.finishReason)},async flush(xe){try{if(M.length===0){const yt=new A9({message:"No output generated. Check the stream for errors."});Oe._finishReason.reject(yt),Oe._totalUsage.reject(yt),Oe._steps.reject(yt);return}const Y=fe??"unknown",re=Ue??{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0};Oe._finishReason.resolve(Y),Oe._totalUsage.resolve(re),Oe._steps.resolve(M);const pe=M[M.length-1];await A?.({finishReason:Y,totalUsage:re,usage:pe.usage,content:pe.content,text:pe.text,reasoningText:pe.reasoningText,reasoning:pe.reasoning,files:pe.files,sources:pe.sources,toolCalls:pe.toolCalls,staticToolCalls:pe.staticToolCalls,dynamicToolCalls:pe.dynamicToolCalls,toolResults:pe.toolResults,staticToolResults:pe.staticToolResults,dynamicToolResults:pe.dynamicToolResults,request:pe.request,response:pe.response,warnings:pe.warnings,providerMetadata:pe.providerMetadata,steps:M}),he.setAttributes(Kt({telemetry:t,attributes:{"ai.response.finishReason":Y,"ai.response.text":{output:()=>pe.text},"ai.response.toolCalls":{output:()=>{var yt;return(yt=pe.toolCalls)!=null&&yt.length?JSON.stringify(pe.toolCalls):void 0}},"ai.response.providerMetadata":JSON.stringify(pe.providerMetadata),"ai.usage.inputTokens":re.inputTokens,"ai.usage.outputTokens":re.outputTokens,"ai.usage.totalTokens":re.totalTokens,"ai.usage.reasoningTokens":re.reasoningTokens,"ai.usage.cachedInputTokens":re.cachedInputTokens}}))}catch(Y){xe.error(Y)}finally{he.end()}}}),B=j8();this.addStream=B.addStream,this.closeStream=B.close;const me=B.stream.getReader();let Se=new ReadableStream({async start(xe){xe.enqueue({type:"start"})},async pull(xe){function Y(){F?.({steps:M}),xe.enqueue({type:"abort"}),xe.close()}try{const{done:re,value:pe}=await me.read();if(re){xe.close();return}if(o?.aborted){Y();return}xe.enqueue(pe)}catch(re){Jr(re)&&o?.aborted?Y():xe.error(re)}},cancel(xe){return B.stream.cancel(xe)}});for(const xe of d)Se=Se.pipeThrough(xe({tools:c,stopStream(){B.terminate()}}));this.baseStream=Se.pipeThrough(U8(h)).pipeThrough(j);const{maxRetries:L,retry:We}=c1({maxRetries:n,abortSignal:o}),Le=o1(t),Be=uu(a),Gt=a1({model:e,telemetry:t,headers:r,settings:{...Be,maxRetries:L}}),Oe=this;Xa({name:"ai.streamText",attributes:Kt({telemetry:t,attributes:{...Ya({operationId:"ai.streamText",telemetry:t}),...Gt,"ai.prompt":{input:()=>JSON.stringify({system:i,prompt:s,messages:l})}}}),tracer:Le,endWhenDone:!1,fn:async xe=>{he=xe;async function Y({currentStep:re,responseMessages:pe,usage:yt}){var ta,U,ze,ra,yp;const wp=Oe.includeRawChunks;te=new oi;const _p=await r1({system:i,prompt:s,messages:l}),na=[..._p.messages,...pe],Ht=await w?.({model:e,steps:M,stepNumber:M.length,messages:na}),ln=op((ta=Ht?.model)!=null?ta:e),xp=await XE({prompt:{system:(U=Ht?.system)!=null?U:_p.system,messages:(ze=Ht?.messages)!=null?ze:na},supportedUrls:await ln.supportedUrls,download:Ne}),{toolChoice:kl,tools:Sl}=r8({tools:c,toolChoice:(ra=Ht?.toolChoice)!=null?ra:u,activeTools:(yp=Ht?.activeTools)!=null?yp:m}),{result:{stream:K1,response:kp,request:Sp},doStreamSpan:cn,startTimestampMs:Ip}=await We(()=>Xa({name:"ai.streamText.doStream",attributes:Kt({telemetry:t,attributes:{...Ya({operationId:"ai.streamText.doStream",telemetry:t}),...Gt,"ai.model.provider":ln.provider,"ai.model.id":ln.modelId,"ai.prompt.messages":{input:()=>s1(xp)},"ai.prompt.tools":{input:()=>Sl?.map(G=>JSON.stringify(G))},"ai.prompt.toolChoice":{input:()=>kl!=null?JSON.stringify(kl):void 0},"gen_ai.system":ln.provider,"gen_ai.request.model":ln.modelId,"gen_ai.request.frequency_penalty":Be.frequencyPenalty,"gen_ai.request.max_tokens":Be.maxOutputTokens,"gen_ai.request.presence_penalty":Be.presencePenalty,"gen_ai.request.stop_sequences":Be.stopSequences,"gen_ai.request.temperature":Be.temperature,"gen_ai.request.top_k":Be.topK,"gen_ai.request.top_p":Be.topP}}),tracer:Le,endWhenDone:!1,fn:async G=>({startTimestampMs:k(),doStreamSpan:G,result:await ln.doStream({...Be,tools:Sl,toolChoice:kl,responseFormat:h?.responseFormat,prompt:xp,providerOptions:b,abortSignal:o,headers:r,includeRawChunks:wp})})})),Y1=z8({tools:c,generatorStream:K1,tracer:Le,telemetry:t,system:i,messages:na,repairToolCall:f,abortSignal:o,experimental_context:ee}),X1=Sp??{},qo=[],Il=[];let El;const Tl={};let un="unknown",Pt={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},$l,Ep=!0,Jt={id:$(),timestamp:y(),modelId:e.modelId},Tp="";Oe.addStream(Y1.pipeThrough(new TransformStream({async transform(G,Ke){var aa,oa,Bo,tr;if(G.type==="stream-start"){El=G.warnings;return}if(Ep){const it=k()-Ip;Ep=!1,cn.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":it}),cn.setAttributes({"ai.response.msToFirstChunk":it}),Ke.enqueue({type:"start-step",request:X1,warnings:El??[]})}const $p=G.type;switch($p){case"text-start":case"text-end":{Ke.enqueue(G);break}case"text-delta":{G.delta.length>0&&(Ke.enqueue({type:"text-delta",id:G.id,text:G.delta,providerMetadata:G.providerMetadata}),Tp+=G.delta);break}case"reasoning-start":case"reasoning-end":{Ke.enqueue(G);break}case"reasoning-delta":{Ke.enqueue({type:"reasoning-delta",id:G.id,text:G.delta,providerMetadata:G.providerMetadata});break}case"tool-call":{Ke.enqueue(G),qo.push(G);break}case"tool-result":{Ke.enqueue(G),G.preliminary||Il.push(G);break}case"tool-error":{Ke.enqueue(G),Il.push(G);break}case"response-metadata":{Jt={id:(aa=G.id)!=null?aa:Jt.id,timestamp:(oa=G.timestamp)!=null?oa:Jt.timestamp,modelId:(Bo=G.modelId)!=null?Bo:Jt.modelId};break}case"finish":{Pt=G.usage,un=G.finishReason,$l=G.providerMetadata;const it=k()-Ip;cn.addEvent("ai.stream.finish"),cn.setAttributes({"ai.response.msToFinish":it,"ai.response.avgOutputTokensPerSecond":1e3*((tr=Pt.outputTokens)!=null?tr:0)/it});break}case"file":{Ke.enqueue(G);break}case"source":{Ke.enqueue(G);break}case"tool-input-start":{Tl[G.id]=G.toolName;const it=c?.[G.toolName];it?.onInputStart!=null&&await it.onInputStart({toolCallId:G.id,messages:na,abortSignal:o,experimental_context:ee}),Ke.enqueue({...G,dynamic:it?.type==="dynamic"});break}case"tool-input-end":{delete Tl[G.id],Ke.enqueue(G);break}case"tool-input-delta":{const it=Tl[G.id],Ol=c?.[it];Ol?.onInputDelta!=null&&await Ol.onInputDelta({inputTextDelta:G.delta,toolCallId:G.id,messages:na,abortSignal:o,experimental_context:ee}),Ke.enqueue(G);break}case"error":{Ke.enqueue(G),un="error";break}case"raw":{wp&&Ke.enqueue(G);break}default:{const it=$p;throw new Error(`Unknown chunk type: ${it}`)}}},async flush(G){const Ke=qo.length>0?JSON.stringify(qo):void 0;try{cn.setAttributes(Kt({telemetry:t,attributes:{"ai.response.finishReason":un,"ai.response.text":{output:()=>Tp},"ai.response.toolCalls":{output:()=>Ke},"ai.response.id":Jt.id,"ai.response.model":Jt.modelId,"ai.response.timestamp":Jt.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify($l),"ai.usage.inputTokens":Pt.inputTokens,"ai.usage.outputTokens":Pt.outputTokens,"ai.usage.totalTokens":Pt.totalTokens,"ai.usage.reasoningTokens":Pt.reasoningTokens,"ai.usage.cachedInputTokens":Pt.cachedInputTokens,"gen_ai.response.finish_reasons":[un],"gen_ai.response.id":Jt.id,"gen_ai.response.model":Jt.modelId,"gen_ai.usage.input_tokens":Pt.inputTokens,"gen_ai.usage.output_tokens":Pt.outputTokens}}))}catch{}finally{cn.end()}G.enqueue({type:"finish-step",finishReason:un,usage:Pt,providerMetadata:$l,response:{...Jt,headers:kp?.headers}});const aa=f8(yt,Pt);await te.promise;const oa=qo.filter(tr=>tr.providerExecuted!==!0),Bo=Il.filter(tr=>tr.providerExecuted!==!0);if(oa.length>0&&Bo.length===oa.length&&!await x8({stopConditions:g,steps:M})){pe.push(...th({content:M[M.length-1].content,tools:c}));try{await Y({currentStep:re+1,responseMessages:pe,usage:aa})}catch(tr){G.enqueue({type:"error",error:tr}),Oe.closeStream()}}else G.enqueue({type:"finish",finishReason:un,totalUsage:aa}),Oe.closeStream()}})))}await Y({currentStep:0,responseMessages:[],usage:{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0}})}}).catch(xe=>{Oe.addStream(new ReadableStream({start(Y){Y.enqueue({type:"error",error:xe}),Y.close()}})),Oe.closeStream()})}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then(e=>e[e.length-1])}get content(){return this.finalStep.then(e=>e.content)}get warnings(){return this.finalStep.then(e=>e.warnings)}get providerMetadata(){return this.finalStep.then(e=>e.providerMetadata)}get text(){return this.finalStep.then(e=>e.text)}get reasoningText(){return this.finalStep.then(e=>e.reasoningText)}get reasoning(){return this.finalStep.then(e=>e.reasoning)}get sources(){return this.finalStep.then(e=>e.sources)}get files(){return this.finalStep.then(e=>e.files)}get toolCalls(){return this.finalStep.then(e=>e.toolCalls)}get staticToolCalls(){return this.finalStep.then(e=>e.staticToolCalls)}get dynamicToolCalls(){return this.finalStep.then(e=>e.dynamicToolCalls)}get toolResults(){return this.finalStep.then(e=>e.toolResults)}get staticToolResults(){return this.finalStep.then(e=>e.staticToolResults)}get dynamicToolResults(){return this.finalStep.then(e=>e.dynamicToolResults)}get usage(){return this.finalStep.then(e=>e.usage)}get request(){return this.finalStep.then(e=>e.request)}get response(){return this.finalStep.then(e=>e.response)}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}teeStream(){const[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return ya(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){e.type==="text-delta"&&t.enqueue(e.text)}})))}get fullStream(){return ya(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await R8({stream:this.fullStream,onError:e?.onError})}catch(r){(t=e?.onError)==null||t.call(e,r)}}get experimental_partialOutputStream(){if(this.output==null)throw new I9;return ya(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:e},t){e!=null&&t.enqueue(e)}})))}toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:n=!0,sendSources:o=!1,sendStart:i=!0,sendFinish:s=!0,onError:l=Zn}={}){const c=t!=null?E8({originalMessages:e,responseMessageId:t}):void 0,u={},d=f=>{var g,h;const b=u[f];return((h=(g=this.tools)==null?void 0:g[b])==null?void 0:h.type)==="dynamic"?!0:void 0},m=this.fullStream.pipeThrough(new TransformStream({transform:async(f,g)=>{const h=a?.({part:f}),b=f.type;switch(b){case"text-start":{g.enqueue({type:"text-start",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"text-delta":{g.enqueue({type:"text-delta",id:f.id,delta:f.text,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"text-end":{g.enqueue({type:"text-end",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"reasoning-start":{g.enqueue({type:"reasoning-start",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"reasoning-delta":{n&&g.enqueue({type:"reasoning-delta",id:f.id,delta:f.text,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"reasoning-end":{g.enqueue({type:"reasoning-end",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"file":{g.enqueue({type:"file",mediaType:f.file.mediaType,url:`data:${f.file.mediaType};base64,${f.file.base64}`});break}case"source":{o&&f.sourceType==="url"&&g.enqueue({type:"source-url",sourceId:f.id,url:f.url,title:f.title,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}}),o&&f.sourceType==="document"&&g.enqueue({type:"source-document",sourceId:f.id,mediaType:f.mediaType,title:f.title,filename:f.filename,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"tool-input-start":{u[f.id]=f.toolName;const w=d(f.id);g.enqueue({type:"tool-input-start",toolCallId:f.id,toolName:f.toolName,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...w!=null?{dynamic:w}:{}});break}case"tool-input-delta":{g.enqueue({type:"tool-input-delta",toolCallId:f.id,inputTextDelta:f.delta});break}case"tool-call":{u[f.toolCallId]=f.toolName;const w=d(f.toolCallId);f.invalid?g.enqueue({type:"tool-input-error",toolCallId:f.toolCallId,toolName:f.toolName,input:f.input,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{},...w!=null?{dynamic:w}:{},errorText:l(f.error)}):g.enqueue({type:"tool-input-available",toolCallId:f.toolCallId,toolName:f.toolName,input:f.input,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{},...w!=null?{dynamic:w}:{}});break}case"tool-result":{const w=d(f.toolCallId);g.enqueue({type:"tool-output-available",toolCallId:f.toolCallId,output:f.output,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...f.preliminary!=null?{preliminary:f.preliminary}:{},...w!=null?{dynamic:w}:{}});break}case"tool-error":{const w=d(f.toolCallId);g.enqueue({type:"tool-output-error",toolCallId:f.toolCallId,errorText:l(f.error),...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...w!=null?{dynamic:w}:{}});break}case"error":{g.enqueue({type:"error",errorText:l(f.error)});break}case"start-step":{g.enqueue({type:"start-step"});break}case"finish-step":{g.enqueue({type:"finish-step"});break}case"start":{i&&g.enqueue({type:"start",...h!=null?{messageMetadata:h}:{},...c!=null?{messageId:c}:{}});break}case"finish":{s&&g.enqueue({type:"finish",...h!=null?{messageMetadata:h}:{}});break}case"abort":{g.enqueue(f);break}case"tool-input-end":break;case"raw":break;default:{const w=b;throw new Error(`Unknown chunk type: ${w}`)}}h!=null&&b!=="start"&&b!=="finish"&&g.enqueue({type:"message-metadata",messageMetadata:h})}}));return ya(h1({stream:m,messageId:c??t?.(),originalMessages:e,onFinish:r,onError:l}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:r,onFinish:a,messageMetadata:n,sendReasoning:o,sendSources:i,sendFinish:s,sendStart:l,onError:c,...u}={}){A8({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:r,onFinish:a,messageMetadata:n,sendReasoning:o,sendSources:i,sendFinish:s,sendStart:l,onError:c}),...u})}pipeTextStreamToResponse(e,t){S8({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:n,sendSources:o,sendFinish:i,sendStart:s,onError:l,...c}={}){return I8({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:a,sendReasoning:n,sendSources:o,sendFinish:i,sendStart:s,onError:l}),...c})}toTextStreamResponse(e){return k8({textStream:this.textStream,...e})}};function F8(e,t){const r=[];t?.ignoreIncompleteToolCalls&&(e=e.map(a=>({...a,parts:a.parts.filter(n=>!du(n)||n.state!=="input-streaming"&&n.state!=="input-available")})));for(const a of e)switch(a.role){case"system":{const n=a.parts.filter(i=>i.type==="text"),o=n.reduce((i,s)=>s.providerMetadata!=null?{...i,...s.providerMetadata}:i,{});r.push({role:"system",content:n.map(i=>i.text).join(""),...Object.keys(o).length>0?{providerOptions:o}:{}});break}case"user":{r.push({role:"user",content:a.parts.map(n=>{var o;if(gc(n))return{type:"text",text:n.text,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(hc(n))return{type:"file",mediaType:n.mediaType,filename:n.filename,data:n.url,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(fc(n))return(o=t?.convertDataPart)==null?void 0:o.call(t,n)}).filter(n=>n!=null)});break}case"assistant":{if(a.parts!=null){let n=function(){var i,s,l;if(o.length===0)return;const c=[];for(const d of o)if(gc(d))c.push({type:"text",text:d.text,...d.providerMetadata!=null?{providerOptions:d.providerMetadata}:{}});else if(hc(d))c.push({type:"file",mediaType:d.mediaType,filename:d.filename,data:d.url});else if(rh(d))c.push({type:"reasoning",text:d.text,providerOptions:d.providerMetadata});else if(ip(d)){const m=d.toolName;d.state!=="input-streaming"&&c.push({type:"tool-call",toolCallId:d.toolCallId,toolName:m,input:d.input,...d.callProviderMetadata!=null?{providerOptions:d.callProviderMetadata}:{}})}else if(Sn(d)){const m=Yi(d);d.state!=="input-streaming"&&(c.push({type:"tool-call",toolCallId:d.toolCallId,toolName:m,input:d.state==="output-error"?(i=d.input)!=null?i:d.rawInput:d.input,providerExecuted:d.providerExecuted,...d.callProviderMetadata!=null?{providerOptions:d.callProviderMetadata}:{}}),d.providerExecuted===!0&&(d.state==="output-available"||d.state==="output-error")&&c.push({type:"tool-result",toolCallId:d.toolCallId,toolName:m,output:Ia({output:d.state==="output-error"?d.errorText:d.output,tool:(s=t?.tools)==null?void 0:s[m],errorMode:d.state==="output-error"?"json":"none"})}))}else if(fc(d)){const m=(l=t?.convertDataPart)==null?void 0:l.call(t,d);m!=null&&c.push(m)}else{const m=d;throw new Error(`Unsupported part: ${m}`)}r.push({role:"assistant",content:c});const u=o.filter(d=>Sn(d)&&d.providerExecuted!==!0||d.type==="dynamic-tool");u.length>0&&r.push({role:"tool",content:u.map(d=>{var m;switch(d.state){case"output-error":case"output-available":{const f=O8(d);return{type:"tool-result",toolCallId:d.toolCallId,toolName:f,output:Ia({output:d.state==="output-error"?d.errorText:d.output,tool:(m=t?.tools)==null?void 0:m[f],errorMode:d.state==="output-error"?"text":"none"})}}default:return null}}).filter(d=>d!=null)}),o=[]},o=[];for(const i of a.parts)gc(i)||rh(i)||hc(i)||du(i)||fc(i)?o.push(i):i.type==="step-start"&&n();n();break}break}default:{const n=a.role;throw new L9({originalMessage:a,message:`Unsupported role: ${n}`})}}return r}function V8(e){const t=e.filter(r=>r.type==="reasoning");return t.length===0?void 0:t.map(r=>r.text).join(`
|
|
99
|
-
`)}var Z8={type:"no-schema",jsonSchema:void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new Kr({message:"No object generated: response did not match schema.",text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new gu({functionality:"element streams in no-schema mode"})}},q8=e=>({type:"object",jsonSchema:e.jsonSchema,async validatePartialResult({value:t,textDelta:r}){return{success:!0,value:{partial:t,textDelta:r}}},async validateFinalResult(t){return Zt({value:t,schema:e})},createElementStream(){throw new gu({functionality:"element streams in object mode"})}}),B8=e=>{const{$schema:t,...r}=e.jsonSchema;return{type:"array",jsonSchema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:r}},required:["elements"],additionalProperties:!1},async validatePartialResult({value:a,latestObject:n,isFirstDelta:o,isFinalDelta:i}){var s;if(!yi(a)||!Pp(a.elements))return{success:!1,error:new Nt({value:a,cause:"value must be an object that contains an array of elements"})};const l=a.elements,c=[];for(let m=0;m<l.length;m++){const f=l[m],g=await Zt({value:f,schema:e});if(!(m===l.length-1&&!i)){if(!g.success)return g;c.push(g.value)}}const u=(s=n?.length)!=null?s:0;let d="";return o&&(d+="["),u>0&&(d+=","),d+=c.slice(u).map(m=>JSON.stringify(m)).join(","),i&&(d+="]"),{success:!0,value:{partial:c,textDelta:d}}},async validateFinalResult(a){if(!yi(a)||!Pp(a.elements))return{success:!1,error:new Nt({value:a,cause:"value must be an object that contains an array of elements"})};const n=a.elements;for(const o of n){const i=await Zt({value:o,schema:e});if(!i.success)return i}return{success:!0,value:n}},createElementStream(a){let n=0;return ya(a.pipeThrough(new TransformStream({transform(o,i){switch(o.type){case"object":{const s=o.object;for(;n<s.length;n++)i.enqueue(s[n]);break}case"text-delta":case"finish":case"error":break;default:{const s=o;throw new Error(`Unsupported chunk type: ${s}`)}}}})))}}},G8=e=>({type:"enum",jsonSchema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},async validateFinalResult(t){if(!yi(t)||typeof t.result!="string")return{success:!1,error:new Nt({value:t,cause:'value must be an object that contains a string in the "result" property.'})};const r=t.result;return e.includes(r)?{success:!0,value:r}:{success:!1,error:new Nt({value:t,cause:"value must be a string in the enum"})}},async validatePartialResult({value:t,textDelta:r}){if(!yi(t)||typeof t.result!="string")return{success:!1,error:new Nt({value:t,cause:'value must be an object that contains a string in the "result" property.'})};const a=t.result,n=e.filter(o=>o.startsWith(a));return t.result.length===0||n.length===0?{success:!1,error:new Nt({value:t,cause:"value must be a string in the enum"})}:{success:!0,value:{partial:n.length>1?a:n[0],textDelta:r}}},createElementStream(){throw new gu({functionality:"element streams in enum mode"})}});function H8({output:e,schema:t,enumValues:r}){switch(e){case"object":return q8(Vn(t));case"array":return B8(Vn(t));case"enum":return G8(r);case"no-schema":return Z8;default:{const a=e;throw new Error(`Unsupported output: ${a}`)}}}async function ah(e,t,r){const a=await Er({text:e});if(!a.success)throw new Kr({message:"No object generated: could not parse the response.",cause:a.error,text:e,response:r.response,usage:r.usage,finishReason:r.finishReason});const n=await t.validateFinalResult(a.value,{text:e,response:r.response,usage:r.usage});if(!n.success)throw new Kr({message:"No object generated: response did not match schema.",cause:n.error,text:e,response:r.response,usage:r.usage,finishReason:r.finishReason});return n.value}async function J8(e,t,r,a){try{return await ah(e,t,a)}catch(n){if(r!=null&&Kr.isInstance(n)&&(Ea.isInstance(n.cause)||Nt.isInstance(n.cause))){const o=await r({text:e,error:n.cause});if(o===null)throw n;return await ah(o,t,a)}throw n}}function W8({output:e,schema:t,schemaName:r,schemaDescription:a,enumValues:n}){if(e!=null&&e!=="object"&&e!=="array"&&e!=="enum"&&e!=="no-schema")throw new Re({parameter:"output",value:e,message:"Invalid output type."});if(e==="no-schema"){if(t!=null)throw new Re({parameter:"schema",value:t,message:"Schema is not supported for no-schema output."});if(a!=null)throw new Re({parameter:"schemaDescription",value:a,message:"Schema description is not supported for no-schema output."});if(r!=null)throw new Re({parameter:"schemaName",value:r,message:"Schema name is not supported for no-schema output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for no-schema output."})}if(e==="object"){if(t==null)throw new Re({parameter:"schema",value:t,message:"Schema is required for object output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for object output."})}if(e==="array"){if(t==null)throw new Re({parameter:"schema",value:t,message:"Element schema is required for array output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for array output."})}if(e==="enum"){if(t!=null)throw new Re({parameter:"schema",value:t,message:"Schema is not supported for enum output."});if(a!=null)throw new Re({parameter:"schemaDescription",value:a,message:"Schema description is not supported for enum output."});if(r!=null)throw new Re({parameter:"schemaName",value:r,message:"Schema name is not supported for enum output."});if(n==null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are required for enum output."});for(const o of n)if(typeof o!="string")throw new Re({parameter:"enumValues",value:o,message:"Enum values must be strings."})}}var K8=Mo({prefix:"aiobj",size:24});async function mu(e){const{model:t,output:r="object",system:a,prompt:n,messages:o,maxRetries:i,abortSignal:s,headers:l,experimental_repairText:c,experimental_telemetry:u,experimental_download:d,providerOptions:m,_internal:{generateId:f=K8,currentDate:g=()=>new Date}={},...h}=e,b=op(t),w="enum"in e?e.enum:void 0,{schema:x,schemaDescription:k,schemaName:y}="schema"in e?e:{};W8({output:r,schema:x,schemaName:y,schemaDescription:k,enumValues:w});const{maxRetries:$,retry:I}=c1({maxRetries:i,abortSignal:s}),E=H8({output:r,schema:x,enumValues:w}),A=uu(h),F=Uo(l??{},`ai/${WE}`),q=a1({model:b,telemetry:u,headers:F,settings:{...A,maxRetries:$}}),ee=o1(u);try{return await Xa({name:"ai.generateObject",attributes:Kt({telemetry:u,attributes:{...Ya({operationId:"ai.generateObject",telemetry:u}),...q,"ai.prompt":{input:()=>JSON.stringify({system:a,prompt:n,messages:o})},"ai.schema":E.jsonSchema!=null?{input:()=>JSON.stringify(E.jsonSchema)}:void 0,"ai.schema.name":y,"ai.schema.description":k,"ai.settings.output":E.type}}),tracer:ee,fn:async Ne=>{var te;let J,Ae,fe,Ue,$e,ke,M,he;const le=await r1({system:a,prompt:n,messages:o}),_e=await XE({prompt:le,supportedUrls:await b.supportedUrls,download:d}),j=await I(()=>Xa({name:"ai.generateObject.doGenerate",attributes:Kt({telemetry:u,attributes:{...Ya({operationId:"ai.generateObject.doGenerate",telemetry:u}),...q,"ai.prompt.messages":{input:()=>s1(_e)},"gen_ai.system":b.provider,"gen_ai.request.model":b.modelId,"gen_ai.request.frequency_penalty":A.frequencyPenalty,"gen_ai.request.max_tokens":A.maxOutputTokens,"gen_ai.request.presence_penalty":A.presencePenalty,"gen_ai.request.temperature":A.temperature,"gen_ai.request.top_k":A.topK,"gen_ai.request.top_p":A.topP}}),tracer:ee,fn:async me=>{var Se,L,We,Le,Be,Gt,Oe,xe;const Y=await b.doGenerate({responseFormat:{type:"json",schema:E.jsonSchema,name:y,description:k},...uu(h),prompt:_e,providerOptions:m,abortSignal:s,headers:F}),re={id:(L=(Se=Y.response)==null?void 0:Se.id)!=null?L:f(),timestamp:(Le=(We=Y.response)==null?void 0:We.timestamp)!=null?Le:g(),modelId:(Gt=(Be=Y.response)==null?void 0:Be.modelId)!=null?Gt:b.modelId,headers:(Oe=Y.response)==null?void 0:Oe.headers,body:(xe=Y.response)==null?void 0:xe.body},pe=v8(Y.content),yt=V8(Y.content);if(pe===void 0)throw new Kr({message:"No object generated: the model did not return a response.",response:re,usage:Y.usage,finishReason:Y.finishReason});return me.setAttributes(Kt({telemetry:u,attributes:{"ai.response.finishReason":Y.finishReason,"ai.response.object":{output:()=>pe},"ai.response.id":re.id,"ai.response.model":re.modelId,"ai.response.timestamp":re.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(Y.providerMetadata),"ai.usage.promptTokens":Y.usage.inputTokens,"ai.usage.completionTokens":Y.usage.outputTokens,"gen_ai.response.finish_reasons":[Y.finishReason],"gen_ai.response.id":re.id,"gen_ai.response.model":re.modelId,"gen_ai.usage.input_tokens":Y.usage.inputTokens,"gen_ai.usage.output_tokens":Y.usage.outputTokens}})),{...Y,objectText:pe,reasoning:yt,responseData:re}}}));J=j.objectText,Ae=j.finishReason,fe=j.usage,Ue=j.warnings,M=j.providerMetadata,ke=(te=j.request)!=null?te:{},$e=j.responseData,he=j.reasoning,vE(Ue);const B=await J8(J,E,c,{response:$e,usage:fe,finishReason:Ae});return Ne.setAttributes(Kt({telemetry:u,attributes:{"ai.response.finishReason":Ae,"ai.response.object":{output:()=>JSON.stringify(B)},"ai.response.providerMetadata":JSON.stringify(M),"ai.usage.promptTokens":fe.inputTokens,"ai.usage.completionTokens":fe.outputTokens}})),new Y8({object:B,reasoning:he,finishReason:Ae,usage:fe,warnings:Ue,request:ke,response:$e,providerMetadata:M})}})}catch(Ne){throw n1(Ne)}}var Y8=class{constructor(e){this.object=e.object,this.finishReason=e.finishReason,this.usage=e.usage,this.warnings=e.warnings,this.providerMetadata=e.providerMetadata,this.response=e.response,this.request=e.request,this.reasoning=e.reasoning}toJsonResponse(e){var t;return new Response(JSON.stringify(this.object),{status:(t=e?.status)!=null?t:200,headers:Lo(e?.headers,{"content-type":"application/json; charset=utf-8"})})}};Mo({prefix:"aiobj",size:24});var X8={};k9(X8,{object:()=>eV,text:()=>Q8});var Q8=()=>({type:"text",responseFormat:{type:"text"},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),eV=({schema:e})=>{const t=Vn(e);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},async parsePartial({text:r}){const a=await g1(r);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value};default:{const n=a.state;throw new Error(`Unsupported parse state: ${n}`)}}},async parseOutput({text:r},a){const n=await Er({text:r});if(!n.success)throw new Kr({message:"No object generated: could not parse the response.",cause:n.error,text:r,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=await Zt({value:n.value,schema:t});if(!o.success)throw new Kr({message:"No object generated: response did not match schema.",cause:o.error,text:r,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.value}}},tV={word:/\S+\s+/m,line:/\n+/m};function rV({delayInMs:e=10,chunking:t="word",_internal:{delay:r=VI}={}}={}){let a;if(typeof t=="function")a=n=>{const o=t(n);if(o==null)return null;if(!o.length)throw new Error("Chunking function must return a non-empty string.");if(!n.startsWith(o))throw new Error(`Chunking function must return a match that is a prefix of the buffer. Received: "${o}" expected to start with "${n}"`);return o};else{const n=typeof t=="string"?tV[t]:t;if(n==null)throw new fu({argument:"chunking",message:`Chunking must be "word" or "line" or a RegExp. Received: ${t}`});a=o=>{const i=n.exec(o);return i?o.slice(0,i.index)+i?.[0]:null}}return()=>{let n="",o="";return new TransformStream({async transform(i,s){if(i.type!=="text-delta"){n.length>0&&(s.enqueue({type:"text-delta",text:n,id:o}),n=""),s.enqueue(i);return}i.id!==o&&n.length>0&&(s.enqueue({type:"text-delta",text:n,id:o}),n=""),n+=i.text,o=i.id;let l;for(;(l=a(n))!=null;)s.enqueue({type:"text-delta",text:l,id:o}),n=n.slice(l.length),await r(e)}})}}function v1({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const r=t.parts.reduce((n,o,i)=>o.type==="step-start"?i:n,-1),a=t.parts.slice(r+1).filter(du).filter(n=>!n.providerExecuted);return a.length>0&&a.every(n=>n.state==="output-available"||n.state==="output-error")}function b1({execute:e,onError:t=Wm,originalMessages:r,onFinish:a,generateId:n=ZI}){let o;const i=[],s=new ReadableStream({start(u){o=u}});function l(u){try{o.enqueue(u)}catch{}}try{const u=e({writer:{write(d){l(d)},merge(d){i.push((async()=>{const m=d.getReader();for(;;){const{done:f,value:g}=await m.read();if(f)break;l(g)}})().catch(m=>{l({type:"error",errorText:t(m)})}))},onError:t}});u&&i.push(u.catch(d=>{l({type:"error",errorText:t(d)})}))}catch(u){l({type:"error",errorText:t(u)})}return new Promise(async u=>{for(;i.length>0;)await i.shift();u()}).finally(()=>{try{o.close()}catch{}}),h1({stream:s,messageId:n(),originalMessages:r,onFinish:a,onError:t})}const y1=T.createContext(null);function sp(){return T.useContext(y1)}function nV(e){return!!e&&"dangerousApiKey"in e}function w1(e){return!!e&&"session"in e&&typeof e.session=="string"}function aV(e){return!!e&&"session"in e&&typeof e.session=="function"}function _1(e){return!!e&&"sessionToken"in e}function oV(e){return e?"sessionFn"in e:!1}function iV(e){return _1(e)||w1(e)}function sV(e){try{const t=e.split(".");if(t.length!==3)return null;let r=t[1].replace(/-/g,"+").replace(/_/g,"/");for(;r.length%4;)r+="=";const a=atob(r),n=JSON.parse(a);return typeof n.exp=="number"?n.exp:null}catch{return null}}function x1(e){return["chatSession",e]}const lV=({getSession:e,projectSlug:t})=>{const r=mm(),a=x1(t),n=r.getQueryState(a)?.data!==void 0,{data:o}=ax({queryKey:a,queryFn:()=>e({projectSlug:t}),enabled:!n&&e!==null,staleTime:1/0,gcTime:1/0});return o??null};async function cV(e){return(await(await fetch("/chat/session",{method:"POST",headers:{"Gram-Project":e.projectSlug},body:JSON.stringify({embedOrigin:window.location.origin})})).json()).client_token}function uV(e,t){return async({projectSlug:r})=>(await(await fetch(`${t}/rpc/chatSessions.create`,{method:"POST",headers:{"Content-Type":"application/json","Gram-Key":e,"Gram-Project":r},body:JSON.stringify({embed_origin:window.location.origin,user_identifier:"elements-dev"})})).json()).client_token}const _l=({projectSlug:e,auth:t})=>{const a=sp()?.isReplay??!1,n=mm(),o=T.useMemo(()=>(t?.url||""||"https://app.getgram.ai").replace(/\/+$/,""),[t?.url]),i=T.useMemo(()=>a?null:nV(t)?uV(t.dangerousApiKey,o):w1(t)?()=>Promise.resolve(t.session):aV(t)?t.session:_1(t)?()=>Promise.resolve(t.sessionToken):oV(t)?t.sessionFn:cV,[t,a,o]),s=lV({getSession:i,projectSlug:e}),l=!iV(t)&&!a,c=T.useCallback(async()=>{const u=x1(e),d=n.getQueryData(u);if(!l||!i)return{"Gram-Project":e,...d&&{"Gram-Chat-Session":d}};const m=d?sV(d):null,g=m!==null&&Date.now()>=m*1e3-3e4?0:1/0;try{const h=await n.fetchQuery({queryKey:u,queryFn:()=>i({projectSlug:e}),staleTime:g});return{"Gram-Project":e,...h&&{"Gram-Chat-Session":h}}}catch{return{"Gram-Project":e,...d&&{"Gram-Chat-Session":d}}}},[l,i,e,n]);return a?{headers:{},isLoading:!1,ensureValidHeaders:async()=>({})}:s?{headers:{"Gram-Project":e,"Gram-Chat-Session":s},isLoading:!1,ensureValidHeaders:c}:{isLoading:!0,ensureValidHeaders:c}},k1=T.createContext(null),dV=({children:e})=>{const[t,r]=T.useState("connected"),[a,n]=T.useState(0),[o,i]=T.useState(typeof navigator<"u"?navigator.onLine:!0),s=T.useRef(null);T.useEffect(()=>{if(typeof window>"u")return;const d=()=>{i(!0),s.current&&(clearTimeout(s.current),s.current=null),r("reconnecting"),s.current=setTimeout(()=>{r("connected"),n(0)},1500)},m=()=>{i(!1),r("disconnected"),s.current&&(clearTimeout(s.current),s.current=null)};return window.addEventListener("online",d),window.addEventListener("offline",m),()=>{window.removeEventListener("online",d),window.removeEventListener("offline",m),s.current&&(clearTimeout(s.current),s.current=null)}},[]);const l=T.useCallback(()=>{r("reconnecting"),n(d=>d+1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{r(d=>d==="reconnecting"?"disconnected":d)},1e4)},[]),c=T.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]),u=T.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]);return p.jsx(k1.Provider,{value:{state:t,retryCount:a,isOnline:o,markDisconnected:l,markConnected:c,reset:u},children:e})},S1=()=>T.useContext(k1);function I1({children:e}){const[t,r]=T.useState(new Map),[a,n]=T.useState(new Set),o=T.useCallback((d,m,f)=>new Promise(g=>{const h={toolCallId:m,toolName:d,args:f,resolve:g};r(b=>{const w=new Map(b);return w.set(m,h),w})}),[]),i=T.useCallback(d=>{n(m=>{const f=new Set(m);return f.add(d),f})},[]),s=T.useCallback(d=>{r(m=>{const f=m.get(d);if(f){f.resolve(!0);const g=new Map(m);return g.delete(d),g}return m})},[]),l=T.useCallback(d=>{r(m=>{const f=m.get(d);if(f){f.resolve(!1);const g=new Map(m);return g.delete(d),g}return m})},[]),c=T.useCallback(d=>a.has(d),[a]),u=T.useCallback(d=>t.get(d),[t]);return p.jsx(v.ToolApprovalContext.Provider,{value:{pendingApprovals:t,approvedTools:a,requestApproval:o,whitelistTool:i,confirmPendingApproval:s,rejectPendingApproval:l,isToolApproved:c,getPendingApproval:u},children:e})}function mV(e){return e?Object.fromEntries(Object.entries(e).map(([t,r])=>{const a=r.unstable_tool;return[t,{execute:a?.execute}]})):{}}const pV=`You are a helpful assistant that can answer questions and help with tasks.
|
|
99
|
+
`)}var Z8={type:"no-schema",jsonSchema:void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new Kr({message:"No object generated: response did not match schema.",text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new gu({functionality:"element streams in no-schema mode"})}},q8=e=>({type:"object",jsonSchema:e.jsonSchema,async validatePartialResult({value:t,textDelta:r}){return{success:!0,value:{partial:t,textDelta:r}}},async validateFinalResult(t){return Zt({value:t,schema:e})},createElementStream(){throw new gu({functionality:"element streams in object mode"})}}),B8=e=>{const{$schema:t,...r}=e.jsonSchema;return{type:"array",jsonSchema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:r}},required:["elements"],additionalProperties:!1},async validatePartialResult({value:a,latestObject:n,isFirstDelta:o,isFinalDelta:i}){var s;if(!yi(a)||!Pp(a.elements))return{success:!1,error:new Nt({value:a,cause:"value must be an object that contains an array of elements"})};const l=a.elements,c=[];for(let m=0;m<l.length;m++){const f=l[m],g=await Zt({value:f,schema:e});if(!(m===l.length-1&&!i)){if(!g.success)return g;c.push(g.value)}}const u=(s=n?.length)!=null?s:0;let d="";return o&&(d+="["),u>0&&(d+=","),d+=c.slice(u).map(m=>JSON.stringify(m)).join(","),i&&(d+="]"),{success:!0,value:{partial:c,textDelta:d}}},async validateFinalResult(a){if(!yi(a)||!Pp(a.elements))return{success:!1,error:new Nt({value:a,cause:"value must be an object that contains an array of elements"})};const n=a.elements;for(const o of n){const i=await Zt({value:o,schema:e});if(!i.success)return i}return{success:!0,value:n}},createElementStream(a){let n=0;return ya(a.pipeThrough(new TransformStream({transform(o,i){switch(o.type){case"object":{const s=o.object;for(;n<s.length;n++)i.enqueue(s[n]);break}case"text-delta":case"finish":case"error":break;default:{const s=o;throw new Error(`Unsupported chunk type: ${s}`)}}}})))}}},G8=e=>({type:"enum",jsonSchema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},async validateFinalResult(t){if(!yi(t)||typeof t.result!="string")return{success:!1,error:new Nt({value:t,cause:'value must be an object that contains a string in the "result" property.'})};const r=t.result;return e.includes(r)?{success:!0,value:r}:{success:!1,error:new Nt({value:t,cause:"value must be a string in the enum"})}},async validatePartialResult({value:t,textDelta:r}){if(!yi(t)||typeof t.result!="string")return{success:!1,error:new Nt({value:t,cause:'value must be an object that contains a string in the "result" property.'})};const a=t.result,n=e.filter(o=>o.startsWith(a));return t.result.length===0||n.length===0?{success:!1,error:new Nt({value:t,cause:"value must be a string in the enum"})}:{success:!0,value:{partial:n.length>1?a:n[0],textDelta:r}}},createElementStream(){throw new gu({functionality:"element streams in enum mode"})}});function H8({output:e,schema:t,enumValues:r}){switch(e){case"object":return q8(Vn(t));case"array":return B8(Vn(t));case"enum":return G8(r);case"no-schema":return Z8;default:{const a=e;throw new Error(`Unsupported output: ${a}`)}}}async function ah(e,t,r){const a=await Er({text:e});if(!a.success)throw new Kr({message:"No object generated: could not parse the response.",cause:a.error,text:e,response:r.response,usage:r.usage,finishReason:r.finishReason});const n=await t.validateFinalResult(a.value,{text:e,response:r.response,usage:r.usage});if(!n.success)throw new Kr({message:"No object generated: response did not match schema.",cause:n.error,text:e,response:r.response,usage:r.usage,finishReason:r.finishReason});return n.value}async function J8(e,t,r,a){try{return await ah(e,t,a)}catch(n){if(r!=null&&Kr.isInstance(n)&&(Ea.isInstance(n.cause)||Nt.isInstance(n.cause))){const o=await r({text:e,error:n.cause});if(o===null)throw n;return await ah(o,t,a)}throw n}}function W8({output:e,schema:t,schemaName:r,schemaDescription:a,enumValues:n}){if(e!=null&&e!=="object"&&e!=="array"&&e!=="enum"&&e!=="no-schema")throw new Re({parameter:"output",value:e,message:"Invalid output type."});if(e==="no-schema"){if(t!=null)throw new Re({parameter:"schema",value:t,message:"Schema is not supported for no-schema output."});if(a!=null)throw new Re({parameter:"schemaDescription",value:a,message:"Schema description is not supported for no-schema output."});if(r!=null)throw new Re({parameter:"schemaName",value:r,message:"Schema name is not supported for no-schema output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for no-schema output."})}if(e==="object"){if(t==null)throw new Re({parameter:"schema",value:t,message:"Schema is required for object output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for object output."})}if(e==="array"){if(t==null)throw new Re({parameter:"schema",value:t,message:"Element schema is required for array output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for array output."})}if(e==="enum"){if(t!=null)throw new Re({parameter:"schema",value:t,message:"Schema is not supported for enum output."});if(a!=null)throw new Re({parameter:"schemaDescription",value:a,message:"Schema description is not supported for enum output."});if(r!=null)throw new Re({parameter:"schemaName",value:r,message:"Schema name is not supported for enum output."});if(n==null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are required for enum output."});for(const o of n)if(typeof o!="string")throw new Re({parameter:"enumValues",value:o,message:"Enum values must be strings."})}}var K8=Mo({prefix:"aiobj",size:24});async function mu(e){const{model:t,output:r="object",system:a,prompt:n,messages:o,maxRetries:i,abortSignal:s,headers:l,experimental_repairText:c,experimental_telemetry:u,experimental_download:d,providerOptions:m,_internal:{generateId:f=K8,currentDate:g=()=>new Date}={},...h}=e,b=op(t),w="enum"in e?e.enum:void 0,{schema:x,schemaDescription:k,schemaName:y}="schema"in e?e:{};W8({output:r,schema:x,schemaName:y,schemaDescription:k,enumValues:w});const{maxRetries:$,retry:I}=c1({maxRetries:i,abortSignal:s}),E=H8({output:r,schema:x,enumValues:w}),A=uu(h),F=Uo(l??{},`ai/${WE}`),q=a1({model:b,telemetry:u,headers:F,settings:{...A,maxRetries:$}}),ee=o1(u);try{return await Xa({name:"ai.generateObject",attributes:Kt({telemetry:u,attributes:{...Ya({operationId:"ai.generateObject",telemetry:u}),...q,"ai.prompt":{input:()=>JSON.stringify({system:a,prompt:n,messages:o})},"ai.schema":E.jsonSchema!=null?{input:()=>JSON.stringify(E.jsonSchema)}:void 0,"ai.schema.name":y,"ai.schema.description":k,"ai.settings.output":E.type}}),tracer:ee,fn:async Ne=>{var te;let J,Ae,fe,Ue,$e,ke,M,he;const le=await r1({system:a,prompt:n,messages:o}),_e=await XE({prompt:le,supportedUrls:await b.supportedUrls,download:d}),j=await I(()=>Xa({name:"ai.generateObject.doGenerate",attributes:Kt({telemetry:u,attributes:{...Ya({operationId:"ai.generateObject.doGenerate",telemetry:u}),...q,"ai.prompt.messages":{input:()=>s1(_e)},"gen_ai.system":b.provider,"gen_ai.request.model":b.modelId,"gen_ai.request.frequency_penalty":A.frequencyPenalty,"gen_ai.request.max_tokens":A.maxOutputTokens,"gen_ai.request.presence_penalty":A.presencePenalty,"gen_ai.request.temperature":A.temperature,"gen_ai.request.top_k":A.topK,"gen_ai.request.top_p":A.topP}}),tracer:ee,fn:async me=>{var Se,L,We,Le,Be,Gt,Oe,xe;const Y=await b.doGenerate({responseFormat:{type:"json",schema:E.jsonSchema,name:y,description:k},...uu(h),prompt:_e,providerOptions:m,abortSignal:s,headers:F}),re={id:(L=(Se=Y.response)==null?void 0:Se.id)!=null?L:f(),timestamp:(Le=(We=Y.response)==null?void 0:We.timestamp)!=null?Le:g(),modelId:(Gt=(Be=Y.response)==null?void 0:Be.modelId)!=null?Gt:b.modelId,headers:(Oe=Y.response)==null?void 0:Oe.headers,body:(xe=Y.response)==null?void 0:xe.body},pe=v8(Y.content),yt=V8(Y.content);if(pe===void 0)throw new Kr({message:"No object generated: the model did not return a response.",response:re,usage:Y.usage,finishReason:Y.finishReason});return me.setAttributes(Kt({telemetry:u,attributes:{"ai.response.finishReason":Y.finishReason,"ai.response.object":{output:()=>pe},"ai.response.id":re.id,"ai.response.model":re.modelId,"ai.response.timestamp":re.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(Y.providerMetadata),"ai.usage.promptTokens":Y.usage.inputTokens,"ai.usage.completionTokens":Y.usage.outputTokens,"gen_ai.response.finish_reasons":[Y.finishReason],"gen_ai.response.id":re.id,"gen_ai.response.model":re.modelId,"gen_ai.usage.input_tokens":Y.usage.inputTokens,"gen_ai.usage.output_tokens":Y.usage.outputTokens}})),{...Y,objectText:pe,reasoning:yt,responseData:re}}}));J=j.objectText,Ae=j.finishReason,fe=j.usage,Ue=j.warnings,M=j.providerMetadata,ke=(te=j.request)!=null?te:{},$e=j.responseData,he=j.reasoning,vE(Ue);const B=await J8(J,E,c,{response:$e,usage:fe,finishReason:Ae});return Ne.setAttributes(Kt({telemetry:u,attributes:{"ai.response.finishReason":Ae,"ai.response.object":{output:()=>JSON.stringify(B)},"ai.response.providerMetadata":JSON.stringify(M),"ai.usage.promptTokens":fe.inputTokens,"ai.usage.completionTokens":fe.outputTokens}})),new Y8({object:B,reasoning:he,finishReason:Ae,usage:fe,warnings:Ue,request:ke,response:$e,providerMetadata:M})}})}catch(Ne){throw n1(Ne)}}var Y8=class{constructor(e){this.object=e.object,this.finishReason=e.finishReason,this.usage=e.usage,this.warnings=e.warnings,this.providerMetadata=e.providerMetadata,this.response=e.response,this.request=e.request,this.reasoning=e.reasoning}toJsonResponse(e){var t;return new Response(JSON.stringify(this.object),{status:(t=e?.status)!=null?t:200,headers:Lo(e?.headers,{"content-type":"application/json; charset=utf-8"})})}};Mo({prefix:"aiobj",size:24});var X8={};k9(X8,{object:()=>eV,text:()=>Q8});var Q8=()=>({type:"text",responseFormat:{type:"text"},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),eV=({schema:e})=>{const t=Vn(e);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},async parsePartial({text:r}){const a=await g1(r);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value};default:{const n=a.state;throw new Error(`Unsupported parse state: ${n}`)}}},async parseOutput({text:r},a){const n=await Er({text:r});if(!n.success)throw new Kr({message:"No object generated: could not parse the response.",cause:n.error,text:r,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=await Zt({value:n.value,schema:t});if(!o.success)throw new Kr({message:"No object generated: response did not match schema.",cause:o.error,text:r,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.value}}},tV={word:/\S+\s+/m,line:/\n+/m};function rV({delayInMs:e=10,chunking:t="word",_internal:{delay:r=VI}={}}={}){let a;if(typeof t=="function")a=n=>{const o=t(n);if(o==null)return null;if(!o.length)throw new Error("Chunking function must return a non-empty string.");if(!n.startsWith(o))throw new Error(`Chunking function must return a match that is a prefix of the buffer. Received: "${o}" expected to start with "${n}"`);return o};else{const n=typeof t=="string"?tV[t]:t;if(n==null)throw new fu({argument:"chunking",message:`Chunking must be "word" or "line" or a RegExp. Received: ${t}`});a=o=>{const i=n.exec(o);return i?o.slice(0,i.index)+i?.[0]:null}}return()=>{let n="",o="";return new TransformStream({async transform(i,s){if(i.type!=="text-delta"){n.length>0&&(s.enqueue({type:"text-delta",text:n,id:o}),n=""),s.enqueue(i);return}i.id!==o&&n.length>0&&(s.enqueue({type:"text-delta",text:n,id:o}),n=""),n+=i.text,o=i.id;let l;for(;(l=a(n))!=null;)s.enqueue({type:"text-delta",text:l,id:o}),n=n.slice(l.length),await r(e)}})}}function v1({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const r=t.parts.reduce((n,o,i)=>o.type==="step-start"?i:n,-1),a=t.parts.slice(r+1).filter(du).filter(n=>!n.providerExecuted);return a.length>0&&a.every(n=>n.state==="output-available"||n.state==="output-error")}function b1({execute:e,onError:t=Wm,originalMessages:r,onFinish:a,generateId:n=ZI}){let o;const i=[],s=new ReadableStream({start(u){o=u}});function l(u){try{o.enqueue(u)}catch{}}try{const u=e({writer:{write(d){l(d)},merge(d){i.push((async()=>{const m=d.getReader();for(;;){const{done:f,value:g}=await m.read();if(f)break;l(g)}})().catch(m=>{l({type:"error",errorText:t(m)})}))},onError:t}});u&&i.push(u.catch(d=>{l({type:"error",errorText:t(d)})}))}catch(u){l({type:"error",errorText:t(u)})}return new Promise(async u=>{for(;i.length>0;)await i.shift();u()}).finally(()=>{try{o.close()}catch{}}),h1({stream:s,messageId:n(),originalMessages:r,onFinish:a,onError:t})}const y1=T.createContext(null);function sp(){return T.useContext(y1)}function nV(e){return!!e&&"dangerousApiKey"in e}function w1(e){return!!e&&"session"in e&&typeof e.session=="string"}function aV(e){return!!e&&"session"in e&&typeof e.session=="function"}function _1(e){return!!e&&"sessionToken"in e}function oV(e){return e?"sessionFn"in e:!1}function iV(e){return _1(e)||w1(e)}function sV(e){try{const t=e.split(".");if(t.length!==3)return null;let r=t[1].replace(/-/g,"+").replace(/_/g,"/");for(;r.length%4;)r+="=";const a=atob(r),n=JSON.parse(a);return typeof n.exp=="number"?n.exp:null}catch{return null}}function x1(e){return["chatSession",e]}const lV=({getSession:e,projectSlug:t})=>{const r=mm(),a=x1(t),n=r.getQueryState(a)?.data!==void 0,{data:o}=ax({queryKey:a,queryFn:()=>e({projectSlug:t}),enabled:!n&&e!==null,staleTime:1/0,gcTime:1/0});return o??null};async function cV(e){return(await(await fetch("/chat/session",{method:"POST",headers:{"Gram-Project":e.projectSlug},body:JSON.stringify({embedOrigin:window.location.origin})})).json()).client_token}function uV(e,t){return async({projectSlug:r})=>(await(await fetch(`${t}/rpc/chatSessions.create`,{method:"POST",headers:{"Content-Type":"application/json","Gram-Key":e,"Gram-Project":r},body:JSON.stringify({embed_origin:window.location.origin,user_identifier:"elements-dev"})})).json()).client_token}const _l=({projectSlug:e,auth:t})=>{const a=sp()?.isReplay??!1,n=mm(),o=T.useMemo(()=>(t?.url||""||"https://app.getgram.ai").replace(/\/+$/,""),[t?.url]),i=T.useMemo(()=>a?null:nV(t)?uV(t.dangerousApiKey,o):w1(t)?()=>Promise.resolve(t.session):aV(t)?t.session:_1(t)?()=>Promise.resolve(t.sessionToken):oV(t)?t.sessionFn:cV,[t,a,o]),s=lV({getSession:i,projectSlug:e}),l=!iV(t)&&!a,c=t?.headers??{},u=T.useCallback(async()=>{const d=x1(e),m=n.getQueryData(d);if(!l||!i)return{...c,"Gram-Project":e,...m&&{"Gram-Chat-Session":m}};const f=m?sV(m):null,h=f!==null&&Date.now()>=f*1e3-3e4?0:1/0;try{const b=await n.fetchQuery({queryKey:d,queryFn:()=>i({projectSlug:e}),staleTime:h});return{...c,"Gram-Project":e,...b&&{"Gram-Chat-Session":b}}}catch{return{...c,"Gram-Project":e,...m&&{"Gram-Chat-Session":m}}}},[l,i,e,n,c]);return a?{headers:{},isLoading:!1,ensureValidHeaders:async()=>({})}:s?{headers:{...c,"Gram-Project":e,"Gram-Chat-Session":s},isLoading:!1,ensureValidHeaders:u}:{isLoading:!0,ensureValidHeaders:u}},k1=T.createContext(null),dV=({children:e})=>{const[t,r]=T.useState("connected"),[a,n]=T.useState(0),[o,i]=T.useState(typeof navigator<"u"?navigator.onLine:!0),s=T.useRef(null);T.useEffect(()=>{if(typeof window>"u")return;const d=()=>{i(!0),s.current&&(clearTimeout(s.current),s.current=null),r("reconnecting"),s.current=setTimeout(()=>{r("connected"),n(0)},1500)},m=()=>{i(!1),r("disconnected"),s.current&&(clearTimeout(s.current),s.current=null)};return window.addEventListener("online",d),window.addEventListener("offline",m),()=>{window.removeEventListener("online",d),window.removeEventListener("offline",m),s.current&&(clearTimeout(s.current),s.current=null)}},[]);const l=T.useCallback(()=>{r("reconnecting"),n(d=>d+1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{r(d=>d==="reconnecting"?"disconnected":d)},1e4)},[]),c=T.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]),u=T.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]);return p.jsx(k1.Provider,{value:{state:t,retryCount:a,isOnline:o,markDisconnected:l,markConnected:c,reset:u},children:e})},S1=()=>T.useContext(k1);function I1({children:e}){const[t,r]=T.useState(new Map),[a,n]=T.useState(new Set),o=T.useCallback((d,m,f)=>new Promise(g=>{const h={toolCallId:m,toolName:d,args:f,resolve:g};r(b=>{const w=new Map(b);return w.set(m,h),w})}),[]),i=T.useCallback(d=>{n(m=>{const f=new Set(m);return f.add(d),f})},[]),s=T.useCallback(d=>{r(m=>{const f=m.get(d);if(f){f.resolve(!0);const g=new Map(m);return g.delete(d),g}return m})},[]),l=T.useCallback(d=>{r(m=>{const f=m.get(d);if(f){f.resolve(!1);const g=new Map(m);return g.delete(d),g}return m})},[]),c=T.useCallback(d=>a.has(d),[a]),u=T.useCallback(d=>t.get(d),[t]);return p.jsx(v.ToolApprovalContext.Provider,{value:{pendingApprovals:t,approvedTools:a,requestApproval:o,whitelistTool:i,confirmPendingApproval:s,rejectPendingApproval:l,isToolApproved:c,getPendingApproval:u},children:e})}function mV(e){return e?Object.fromEntries(Object.entries(e).map(([t,r])=>{const a=r.unstable_tool;return[t,{execute:a?.execute}]})):{}}const pV=`You are a helpful assistant that can answer questions and help with tasks.
|
|
100
100
|
|
|
101
101
|
Tool Result Display:
|
|
102
102
|
Some tools have custom visual components that automatically render their results (you'll see a rich card/widget appear). For these, do not repeat the data - just add brief context or a follow-up question if needed.
|
|
@@ -191,4 +191,4 @@ Examples:
|
|
|
191
191
|
- "jan 5 to jan 10" -> label: "1/5-1/10"
|
|
192
192
|
|
|
193
193
|
User input: ${e}`})).object,c=mh(l.from),u=mh(l.to);if(isNaN(c.getTime())||isNaN(u.getTime()))return null;let d=l.label;d==="1w"&&(d="7d"),d==="2w"&&(d="14d"),d==="1mo"&&(d="30d"),d==="3mo"&&(d="90d");const m=Yr.find(f=>f.value===d);return m?{type:"preset",preset:m.value}:{type:"custom",range:{from:c,to:u},label:l.label}}catch{return null}}function W1({preset:e,customRange:t,onPresetChange:r,onCustomRangeChange:a,onClearCustomRange:n,customRangeLabel:o,showLive:i=!1,isLive:s=!1,onLiveChange:l,availablePresets:c,disabled:u=!1,timezone:d,apiUrl:m,projectSlug:f,className:g}){const[h,b]=C.useState(!1),[w,x]=C.useState(!1),[k,y]=C.useState(""),[$,I]=C.useState(!1),[E,A]=C.useState(!1),[F,q]=C.useState(o||null),ee=C.useRef(null);C.useEffect(()=>{o!==void 0&&q(o||null)},[o]);const Ne=m||(typeof window<"u"?window.location.origin:""),te=C.useMemo(()=>{if(!c)return Yr;const L=new Set(c);return Yr.filter(We=>L.has(We.value))},[c]),J=C.useCallback(L=>!c||c.includes(L),[c]),Ae=L=>{r?.(L.value),q(null),b(!1),y("")},fe=()=>{l?.(!s),s||J("15m")&&r?.("15m"),b(!1)},Ue=L=>{L.start&&L.end&&(a?.(L.start,L.end),q(null),b(!1),x(!1),y(""))},$e=L=>{y(L.target.value)},ke=L=>{if(L){if(L.type==="preset"){if(!J(L.preset))return!1;r?.(L.preset),q(null)}else{const We=L.label||void 0;a?.(L.range.from,L.range.to,We),q(We||null)}return y(""),b(!1),I(!1),!0}return!1},M=async L=>{if(L.key==="Enter"&&k.trim()&&!E){A(!0);try{const We=await Gq(k,Ne,f);ke(We)}finally{A(!1)}}else L.key==="Escape"?(y(""),I(!1),b(!1)):L.key==="Backspace"&&k===""&&t&&(L.preventDefault(),n?.())},he=L=>{L.stopPropagation(),I(!0),b(!0)},le=()=>{I(!0)},_e=()=>{setTimeout(()=>{k||I(!1)},150)},j=t??(e?J1(e):null),B=()=>t?F||"Custom":e?dh(e)?.shortLabel??e:"7d",me=()=>t?`${uh(t.from)} – ${uh(t.to)}`:e?dh(e)?.label??"Select time range":"Select time range",Se=L=>{!L&&$||(b(L),L&&ee.current&&setTimeout(()=>ee.current?.focus(),0))};return p.jsxs(pp,{open:h,onOpenChange:Se,children:[p.jsx(V1,{asChild:!0,disabled:u,children:p.jsxs("div",{className:v.cn("relative inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm transition-all outline-none","border-border hover:border-border/80",u&&"cursor-not-allowed opacity-50",d&&"pt-4",g),children:[d&&p.jsx("span",{className:"absolute -top-2 left-3 bg-background px-1 text-xs text-muted-foreground",children:d}),p.jsx("span",{className:v.cn("inline-flex h-6 items-center justify-center rounded px-2 py-1 text-xs font-semibold",ii,s?"bg-green-500 text-white":"bg-muted text-muted-foreground"),children:E?p.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-current/30 border-t-current"}):B()}),p.jsx("input",{ref:ee,type:"text",value:$?k:me(),onChange:$e,onClick:he,onFocus:le,onBlur:_e,onKeyDown:M,placeholder:"e.g., 3 days ago, last week...",disabled:u,className:v.cn("min-w-35 flex-1 bg-transparent outline-none","placeholder:text-muted-foreground/60",!$&&"cursor-pointer",u&&"cursor-not-allowed")}),p.jsx(v.ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})}),p.jsx(fp,{className:"w-fit max-w-[500px] p-0",align:"end",collisionPadding:16,onOpenAutoFocus:L=>{L.preventDefault(),ee.current?.focus()},children:p.jsx("div",{className:"flex flex-col",children:w?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 px-3 py-2",children:[p.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Select date range"}),p.jsx("button",{type:"button",onClick:()=>x(!1),className:"text-xs text-primary hover:underline",children:"Back"})]}),p.jsx(bp,{selected:{start:j?.from??null,end:j?.to??null},onSelect:Ue,maxDate:new Date}),t&&n&&p.jsx("div",{className:"border-t border-border/50 p-2",children:p.jsx("button",{type:"button",onClick:()=>{n(),x(!1)},className:"w-full text-xs text-muted-foreground transition-colors hover:text-foreground",children:"Clear custom range"})})]}):p.jsxs("div",{className:"py-1",children:[i&&p.jsxs("button",{type:"button",onClick:fe,className:v.cn("flex w-full items-center gap-3 px-3 py-2 text-sm transition-colors","hover:bg-muted",s&&"bg-blue-500/10"),children:[p.jsxs("span",{className:v.cn("inline-flex items-center justify-center gap-1 rounded px-1.5 py-0.5 text-xs font-semibold",ii,s?"bg-green-500 text-white":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400"),children:[p.jsx(L6,{className:"h-3 w-3"}),"LIVE"]}),p.jsx("span",{className:"text-foreground/80",children:"15 Minutes"})]}),te.map(L=>{const We=e===L.value&&!t&&!s;return p.jsxs("button",{type:"button",onClick:()=>Ae(L),className:v.cn("flex w-full items-center gap-3 px-3 py-2 text-sm transition-colors",We?"bg-blue-500 text-white":"hover:bg-muted"),children:[p.jsx("span",{className:v.cn("inline-flex items-center justify-center rounded px-1.5 py-0.5 text-xs font-semibold",ii,We?"bg-white/20 text-white":"bg-muted text-muted-foreground"),children:L.shortLabel}),p.jsx("span",{className:We?"text-white":"text-foreground/80",children:L.label})]},L.value)}),p.jsxs("button",{type:"button",onClick:()=>x(!0),className:v.cn("flex w-full items-center gap-3 px-3 py-2 text-sm transition-colors",t?"bg-blue-500 text-white":"hover:bg-muted"),children:[p.jsx("span",{className:v.cn("inline-flex items-center justify-center rounded px-1.5 py-0.5",ii,t?"bg-white/20 text-white":"bg-muted text-muted-foreground"),children:p.jsx(i6,{className:"h-4 w-4"})}),p.jsx("span",{className:t?"text-white":"text-foreground/80",children:"Select from calendar..."})]})]})})})]})}W1.displayName="TimeRangePicker";exports.ActionType=sl;exports.CENSORED_IMG_MARK=dz;exports.CENSORED_STRING_MARK=ui;exports.CREDITS_EXHAUSTED_MESSAGE=pS;exports.Calendar=bp;exports.Chat=Tq;exports.ChatHistory=$q;exports.ElementsProvider=_V;exports.MODELS=pl;exports.MessageContent=jq;exports.NodePrivacyLevel=ce;exports.ONE_SECOND=tt;exports.PRESETS=Yr;exports.PRIVACY_ATTR_NAME=Am;exports.PRIVACY_ATTR_VALUE_HIDDEN=cz;exports.Replay=zq;exports.RumEventType=ne;exports.ShareButton=Oq;exports.TimeRangePicker=W1;exports.ToolFallback=B1;exports.addEventListener=je;exports.addEventListeners=lr;exports.addRecord=tU;exports.addSegment=eU;exports.addTelemetryDebug=Xn;exports.addTelemetryMetrics=Ao;exports.addWroteData=rU;exports.buildTags=_m;exports.buildUrl=$o;exports.canUseEventBridge=Gr;exports.clearTimeout=_t;exports.clocksNow=qe;exports.clocksOrigin=fm;exports.createHttpRequest=Sm;exports.currentDrift=mx;exports.defineFrontendTool=MU;exports.describeStreamError=fS;exports.display=Q;exports.elapsed=De;exports.forEachChildNodes=K4;exports.getEventBridge=Kn;exports.getGlobalObject=$t;exports.getMutationObserverConstructor=wk;exports.getNodePrivacyLevel=jo;exports.getNodeSelfPrivacyLevel=Mk;exports.getParentNode=Nk;exports.getPresetRange=J1;exports.getScrollX=zD;exports.getScrollY=rS;exports.getSegmentsCount=QM;exports.getTextContent=fz;exports.getViewportDimension=ul;exports.hasChildNodes=W4;exports.initViewportObservable=nS;exports.instrumentMethod=Vt;exports.instrumentSetter=zj;exports.isNodeShadowHost=Cm;exports.isNodeShadowRoot=Ck;exports.isPageExitReason=Kx;exports.isSafari=yR;exports.jsonStringify=Jn;exports.monitor=oe;exports.monitorError=ir;exports.noop=ve;exports.objectEntries=rl;exports.reducePrivacyLevel=Dk;exports.relativeToClocks=Io;exports.requestIdleCallback=sk;exports.sanitizeIfLongDataUrl=Ik;exports.sendToExtension=xm;exports.setTimeout=Qe;exports.shouldMaskAttribute=Uk;exports.shouldMaskNode=Rm;exports.supportPerformanceTimingEvent=Or;exports.throttle=To;exports.timeStampNow=Je;exports.trackError=Ua;exports.useRecordCassette=qZ;exports.useThreadId=E1;
|
|
194
|
-
//# sourceMappingURL=index-
|
|
194
|
+
//# sourceMappingURL=index-BCV7Zf9E.cjs.map
|