-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathold.js
More file actions
9 lines (9 loc) · 151 KB
/
old.js
File metadata and controls
9 lines (9 loc) · 151 KB
1
2
3
4
5
6
7
8
9
!function(){function e(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}function t(e){return e&&e.__esModule?e.default:e}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function r(e){return e&&e.constructor===Symbol?"symbol":typeof e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(){"use strict";var e=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{return e.apply(void 0,n)}catch(e){Ne.error(t,e)}}},t=function(e){Ge=e},n=function(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fe?o(r):r;return n.apply(this,e)}},o=function(e){return function(){return i(e,this,arguments)}},i=function(e,t,n){try{return e.apply(t,n)}catch(e){if(a(De.error,e),Fe)try{Fe(e)}catch(e){a(De.error,e)}}},a=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Ge&&Ne.apply(void 0,ze([e,"[MONITOR]"],t,!1))},s=function(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,a=!n||void 0===n.trailing||n.trailing,s=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];s?r=n:(i?e.apply(void 0,n):r=n,s=!0,o=setTimeout((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){clearTimeout(o),s=!1,r=void 0}}},u=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e},c=function(e){return 0!==e&&100*Math.random()<=e},l=function(){},f=function(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=d(Object.prototype),o=d(Array.prototype),i=d(Object.getPrototypeOf(e)),a=d(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}},d=function(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):l},p=function(e,t){return-1!==e.indexOf(t)},h=function(e){if(Array.from)return Array.from(e);var t=[];if(e instanceof Set)e.forEach((function(e){return t.push(e)}));else for(var n=0;n<e.length;n++)t.push(e[n]);return t},v=function(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100},y=function(e){return Object.keys(e).map((function(t){return e[t]}))},m=function(e){return 0===Object.keys(e).length},g=function(e,t){return e.slice(0,t.length)===t},b=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e},w=function(e,t,n){void 0===n&&(n="");var r=e.charCodeAt(t-1),o=r>=55296&&r<=56319?t+1:t;return e.length<=o?e:"".concat(e.slice(0,o)).concat(n)},k=function(e){return null===e?"null":Array.isArray(e)?"array":void 0===e?"undefined":r(e)},S=function(e){return We(void 0,e)},E=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=We(e,i))}return e},x=function(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t},getContext:function(){return S(e)},setContext:function(t){e=S(t)},setContextProperty:function(t,n){e[t]=S(n)},removeContextProperty:function(t){delete e[t]},clearContext:function(){e={}}}},_=function(){return(new Date).getTime()},C=function(){return _()},T=function(){return performance.now()},O=function(){return{relative:T(),timeStamp:C()}},R=function(){return void 0===Je&&(Je=performance.timing.navigationStart),Je},L=function(){var e=b().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}},j=function(e){var t;void 0===e&&(e=null===(t=b().location)||void 0===t?void 0:t.hostname);var n=L();return!!n&&n.getAllowedWebViewHosts().some((function(t){var n,r;return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r)}))},P=function(e){var t=u({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t},B=function(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u)},A=function(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*".concat(t,"\\s*=\\s*([^;]+)")).exec(e);return n?n[1]:void 0}(document.cookie,e)},I=function(e,t){B(e,"",0,t)},M=function(e){return q(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}(window.location)).href},q=function(e,t){if(function(){if(void 0!==Ye)return Ye;try{var e=new URL("http://test/path");return Ye="http://test/path"===e.href}catch(e){Ye=!1}return Ye}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r},U=function(e,t,n){var r=e.clientToken,o=function(e,t){var n=e.site,r=void 0===n?et:n,o=e.internalAnalyticsSubdomain;if(o&&r===et)return"".concat(o,".").concat(et);var i=r.split("."),a=i.pop();return"".concat(tt[t],".browser-intake-").concat(i.join("-"),".").concat(a)}(e,t),i="https://".concat(o,"/api/v2/").concat(nt[t]),a=e.proxyUrl&&M(e.proxyUrl);return{build:function(o,s){var u=["sdk_version:".concat("4.30.1"),"api:".concat(o)].concat(n);s&&u.push("retry_count:".concat(s.count),"retry_after:".concat(s.lastFailureStatus));var c=["ddsource=browser","ddtags=".concat(encodeURIComponent(u.join(","))),"dd-api-key=".concat(r),"dd-evp-origin-version=".concat(encodeURIComponent("4.30.1")),"dd-evp-origin=browser","dd-request-id=".concat(Ve())];"rum"===t&&c.push("batch_time=".concat(C())),e.internalAnalyticsSubdomain&&c.reverse();var l="".concat(i,"?").concat(c.join("&"));return a?"".concat(a,"?ddforward=").concat(encodeURIComponent(l)):l},buildIntakeUrl:function(){return a?"".concat(a,"?ddforward"):i},endpointType:t}},D=function(e,t){var n=200-e.length-1;(t.length>n||rt.test(t))&&Ne.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var r=t.replace(/,/g,"_");return"".concat(e,":").concat(r)},N=function(t){var n,r,o;if(t&&t.clientToken){var i=null!==(n=t.sessionSampleRate)&&void 0!==n?n:t.sampleRate;if(void 0===i||v(i))if(void 0===t.telemetrySampleRate||v(t.telemetrySampleRate)){var a;if(void 0===t.telemetryConfigurationSampleRate||v(t.telemetryConfigurationSampleRate))return a=t.enableExperimentalFeatures,Array.isArray(a)&&(Xe||(Xe=new Set(a)),a.filter((function(e){return"string"==typeof e})).forEach((function(e){p(e,"-")&&Ne.warn("please use snake case for '".concat(e,"'")),Xe.add(e)}))),u({beforeSend:t.beforeSend&&e(t.beforeSend,"beforeSend threw an error:"),cookieOptions:F(t),sessionSampleRate:null!=i?i:100,telemetrySampleRate:null!==(r=t.telemetrySampleRate)&&void 0!==r?r:20,telemetryConfigurationSampleRate:null!==(o=t.telemetryConfigurationSampleRate)&&void 0!==o?o:5,service:t.service,silentMultipleInit:!!t.silentMultipleInit,batchBytesLimit:16384,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:3e4,batchMessagesLimit:50,messageBytesLimit:262144},function(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(D("env",t)),n&&i.push(D("service",n)),r&&i.push(D("version",r)),o&&i.push(D("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:U(e,"logs",t),rumEndpointBuilder:U(e,"rum",t),sessionReplayEndpointBuilder:U(e,"sessionReplay",t)}}(e,t),r=y(n).map((function(e){return e.buildIntakeUrl()})),o=function(e,t,n){if(e.replica){var r=u({},e,{site:et,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:U(r,"logs",n),rumEndpointBuilder:U(r,"rum",n)};return t.push.apply(t,y(o).map((function(e){return e.buildIntakeUrl()}))),u({applicationId:e.replica.applicationId},o)}}(e,r,t);return u({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||et},n)}(t));Ne.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else Ne.error("Telemetry Sample Rate should be a number between 0 and 100");else Ne.error("Session Sample Rate should be a number between 0 and 100")}else Ne.error("Client Token is not configured, we will not send any data.")},F=function(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===Ke){for(var e="dd_site_test_".concat(Ve()),t=window.location.hostname.split("."),n=t.pop();t.length&&!A(e);)n="".concat(t.pop(),".").concat(n),B(e,"test",He,{domain:n});I(e,{domain:n}),Ke=n}return Ke}()),t},z=function(e){var t=[],n=G(e,"stack"),r=String(e);return n&&g(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=st.exec(e);if(t){var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=ut.exec(t[2]);return r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]),{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||ot,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}}(e)||function(e){var t=ct.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:ot,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=lt.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||ot,line:+t[3],url:t[2]}}(e)||function(e){var t=ft.exec(e);if(t){var n=t[3]&&t[3].indexOf(" > eval")>-1,r=dt.exec(t[3]);return n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0),{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||ot,line:t[4]?+t[4]:void 0,url:t[3]}}}(e);n&&(!n.func&&n.line&&(n.func=ot),t.push(n))})),{message:G(e,"message"),name:G(e,"name"),stack:t}},G=function(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}},H=function(e){var t=$(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"(".concat(e.args.join(", "),")"):"",o=e.line?":".concat(e.line):"",i=e.line&&e.column?":".concat(e.column):"";t+="\n at ".concat(n).concat(r," @ ").concat(e.url).concat(o).concat(i)})),t},$=function(e){return"".concat(e.name||"Error",": ").concat(e.message)},V=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return i((function(){var n=z(t);n.stack=n.stack.slice(2),e=H(n)})),e},W=function(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=z(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&H(o)}),n=n.cause}return r.length?r:void 0},J=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new bt((function(){var t=e.map((function(e){return e.subscribe((function(e){return n.notify(e)}))}));return function(){return t.forEach((function(e){return e.unsubscribe()}))}}));return n},K=function(e,t){var n,r=window;return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n},X=function(e,t,n,r){return Y(e,[t],n,r)},Y=function(e,t,n,r){var i=void 0===r?{}:r,a=i.once,s=i.capture,u=i.passive,c=o(a?function(e){d(),n(e)}:n),l=u?{capture:s,passive:u}:s,f=K(e,"addEventListener");function d(){var n=K(e,"removeEventListener");t.forEach((function(t){return n.call(e,t,c,l)}))}return t.forEach((function(t){return f.call(e,t,c,l)})),{stop:d}},Z=function(e){var t,n=[];p(e,wt.cspViolation)&&n.push(t=new bt((function(){var e=o((function(e){t.notify(function(e){var t=wt.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:wt.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:Q(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(w(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))}));return X(document,"securitypolicyviolation",e).stop})));var r=e.filter((function(e){return e!==wt.cspViolation}));return r.length&&n.push(function(e){var t=new bt((function(){if(window.ReportingObserver){var n=o((function(e){return e.forEach((function(e){t.notify(function(e){var t=e.type,n=e.body;return{type:t,subtype:n.id,message:"".concat(t,": ").concat(n.message),stack:Q(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)}}(e))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(r)),J.apply(void 0,n)},Q=function(e,t,n,r,o){return n&&H({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})},ee=function(e,t,n){var r,o;return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return p(t,e)}))?"all"===e?t:(r=e,o=new Set,r.forEach((function(e){return o.add(e)})),h(o)):void Ne.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'))},te=function(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})},ne=function(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||A("datadog-synthetics-injects-rum"))},re=function(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||A("datadog-synthetics-result-id");return"string"==typeof e?e:void 0},oe=function(e,t){var n,r=new bt;return Ot.telemetryEnabled=c(t.telemetrySampleRate),Ot.telemetryConfigurationEnabled=Ot.telemetryEnabled&&c(t.telemetryConfigurationSampleRate),Ze=function(o){if(!p(Tt,t.site)&&Ot.telemetryEnabled){var i=function(e,t){return E({type:"telemetry",date:C(),service:e,version:"4.30.1",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:h(Xe||new Set)},void 0!==n?n():{})}(e,o);r.notify(i),te("telemetry",i)}},Fe=ie,u(Ot,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r}},ie=function(e){ae(u({type:_t,status:"error"},function(e){if(e instanceof Error){var t=z(e);return{error:{kind:t.name,stack:H(se(t))},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught ".concat(f(e))}}(e)))},ae=function(e){Ze&&Ot.sentEventCount<Ot.maxEventsPerPage&&(Ot.sentEventCount+=1,Ze(e))},se=function(e){return e.stack=e.stack.filter((function(e){return!e.url||Ct.some((function(t){return g(e.url,t)}))})),e},ue=function(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?ce(e,t,n,{onSuccess:function(){return le(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),Pt(t,n,r,o)}}):t.queuedPayloads.enqueue(e)},ce=function(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||e.status>=500)}(n)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:n.status},i()):(t.transportStatus=0,o())}))},le=function(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(3,"MiB"),source:pt,startClocks:O()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=fe();i.size()>0;)ue(i.dequeue(),t,n,r,o)},fe=function(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=jt}}},de=function(e,t,n){var r=new XMLHttpRequest,i=o((function(){r.removeEventListener("loadend",i),null==n||n({status:r.status})}));r.open("POST",e,!0),r.addEventListener("loadend",i),r.send(t)},pe=function(e,t,n,r,i){var a,s=u(t);function u(t){return new Lt(function(e,t,n){var r={transportStatus:0,currentBackoffTime:1e3,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=81920&&this.ongoingRequestCount<32},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:fe(),queueFullReported:!1},i=function(n,r){return function(e,t,n,r){var i=n.data,a=n.bytesCount,s=n.retry;if(function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&a<t){var u=e.build("fetch",s);fetch(u,{method:"POST",body:i,keepalive:!0,mode:"cors"}).then(o((function(e){return null==r?void 0:r({status:e.status,type:e.type})})),o((function(){de(e.build("xhr",s),i,r)})))}else de(e.build("xhr",s),i,r)}(e,t,n,r)};return{send:function(t){ue(t,r,i,e.endpointType,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount;if(navigator.sendBeacon&&o<t)try{var i=e.build("beacon");if(navigator.sendBeacon(i,r))return}catch(e){!function(e){zt||(zt=!0,ie(e))}(e)}de(e.build("xhr"),r)}(e,t,n)}}}(t,e.batchBytesLimit,n),e.batchMessagesLimit,e.batchBytesLimit,e.messageBytesLimit,e.flushTimeout,r)}return i&&(a=u(i)),{add:function(e,t){void 0===t&&(t=!0),s.add(e),a&&t&&a.add(e)}}},he=function(e,t){var n;if(void 0===t&&(t=0),Bt||(Bt=e),e===Bt)if(t>=100)me();else{var r,o=we();if(ve()){if(o.lock)return void ye(e,t);if(r=Ve(),o.lock=r,be(o,e.options),(o=we()).lock!==r)return void ye(e,t)}var i=e.process(o);if(ve()&&(o=we()).lock!==r)ye(e,t);else{if(i&&ge(i,e.options),ve()&&(!i||!ke(i))){if((o=we()).lock!==r)return void ye(e,t);delete o.lock,be(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),me()}}else Xt.push(e)},ve=function(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)},ye=function(e,t){setTimeout(o((function(){he(e,t+1)})),10)},me=function(){Bt=void 0;var e=Xt.shift();e&&he(e)},ge=function(e,t){ke(e)?function(e){B(Kt,"",0,e)}(t):(e.expire=String(_()+Vt),be(e,t))},be=function(e,t){B(Kt,function(e){var t;return(t=e,Object.keys(t).map((function(e){return[e,t[e]]}))).map((function(e){var t=e[0],n=e[1];return"".concat(t,"=").concat(n)})).join(Jt)}(e),Vt,t)},we=function(){var e=A(Kt),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(Jt)||Wt.test(e))}(e)&&e.split(Jt).forEach((function(e){var n=Wt.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t},ke=function(e){return m(e)},Se=function(e,t,n){!function(e){var t=A(Kt),n=A("_dd"),r=A("_dd_r"),o=A("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),ge(i,e)}}(e);var r=function(e,t,n){var r=new bt,i=new bt,a=setInterval(o((function(){he({options:e,process:function(e){return f(e)?void 0:{}},after:c})})),1e3),u=function(){var e=we();return f(e)?e:{}}();function c(e){return f(e)||(e={}),l()&&(function(e){return u.id!==e.id||u[t]!==e[t]}(e)?(u={},i.notify()):u=e),e}function l(){return void 0!==u[t]}function f(e){return(void 0===e.created||_()-Number(e.created)<$t)&&(void 0===e.expire||_()<Number(e.expire))}return{expandOrRenewSession:s(o((function(){var o;he({options:e,process:function(e){var r=c(e);return o=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;return e[t]=o,i&&!e.id&&(e.id=Ve(),e.created=String(_())),i}(r),r},after:function(e){o&&!l()&&function(e){u=e,r.notify()}(e),u=e}})})),1e3).throttled,expandSession:function(){he({options:e,process:function(e){return l()?c(e):void 0}})},getSession:function(){return u},renewObservable:r,expireObservable:i,stop:function(){clearInterval(a)}}}(e,t,n);Yt.push((function(){return r.stop()}));var i,a=new Ht(144e5);function u(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return Yt.push((function(){return a.stop()})),r.renewObservable.subscribe((function(){a.add(u(),T())})),r.expireObservable.subscribe((function(){a.closeActive(T())})),r.expandOrRenewSession(),a.add(u(),(R(),0)),i=Y(window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,Yt.push(i),function(e){var t=o((function(){"visible"===document.visibilityState&&e()})),n=X(document,"visibilitychange",t).stop;Yt.push(n);var r=setInterval(t,6e4);Yt.push((function(){clearInterval(r)}))}((function(){return r.expandSession()})),{findActiveSession:function(e){return a.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable}},Ee=function(e){return c(e.sessionSampleRate)?"1":"0"},xe=function(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return Zt[e]>=Zt[n.getLevel()]&&p(o,t)},_e=function(e){var t,n=window;if(ne()){var r=o(n.DD_RUM_SYNTHETICS);return r||Qt||(Qt=!0,function(e,t){a(De.debug,e,t),ae(u({type:_t,message:e,status:"debug"},t))}("Logs sent before RUM is injected by the synthetics worker",{testId:(t=window._DATADOG_SYNTHETICS_PUBLIC_ID||A("datadog-synthetics-public-id"),"string"==typeof t?t:void 0),resultId:re()})),r}return o(n.DD_RUM);function o(t){if(t&&t.getInternalContext)return t.getInternalContext(e)}},Ce=function(e){var t=e.map((function(e){return en[e]||(en[e]=function(e){var t=new bt((function(){var n=console[e];return console[e]=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(console,r);var a=V();i((function(){t.notify(Te(r,e,a))}))},function(){console[e]=n}}));return t}(e)),en[e]}));return J.apply(void 0,t)},Te=function(e,t,n){var r,o=e.map((function(e){return function(e){return"string"==typeof e?e:e instanceof Error?$(z(e)):f(e,void 0,2)}(e)})).join(" ");if(t===De.error){var i=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r))return r}}(e,(function(e){return e instanceof Error}));r=i?H(z(i)):void 0,o="console error: ".concat(o)}return{api:t,message:o,stack:r,handlingStack:n}},Oe=function(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}},Re=function(e,t,n){var r=n.before,o=n.after;return Oe(e,t,(function(e){return function(){var t,n=arguments;return r&&i(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&i(o,this,n),t}}))},Le=function(e,t){rn.set(this,{state:"open",method:e,url:M(String(t))})},je=function(e){var t=this,n=rn.get(this);if(n){var r=n;r.state="start",r.startTime=T(),r.startClocks=O(),r.isAborted=!1,r.xhr=this;var i=!1,a=Re(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&s()}}).stop,s=o((function(){if(t.removeEventListener("loadend",s),a(),!i){i=!0;var o,c=n;c.state="complete",c.duration=(o=r.startClocks.timeStamp,C()-o),c.status=t.status,e.notify(u({},c))}}));this.addEventListener("loadend",s),e.notify(r)}},Pe=function(){var e=rn.get(this);e&&(e.isAborted=!0)},Be=function(e,t,n){var r=n&&n.method||"object"==typeof t&&t.method||"GET",o=M("object"==typeof t&&t.url||t),i={state:"start",init:n,input:t,method:r,startClocks:O(),url:o};return e.notify(i),i},Ae=function(e,t,n){var r=function(t){var r=n;r.state="resolve","stack"in t||t instanceof Error?(r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t):"status"in t&&(r.response=t,r.responseType=t.type,r.status=t.status,r.isAborted=!1),e.notify(r)};t.then(o(r),o(r))},Ie=function(e,t){if(!e.forwardErrorsToLogs)return{stop:l};var n=function(){var e;return qt||(e=new bt((function(){var t=Re(XMLHttpRequest.prototype,"open",{before:Le}).stop,n=Re(XMLHttpRequest.prototype,"send",{before:function(){je.call(this,e)}}).stop,r=Re(XMLHttpRequest.prototype,"abort",{before:Pe}).stop;return function(){t(),n(),r()}})),qt=e),qt}().subscribe((function(e){"complete"===e.state&&a("xhr",e)})),r=function(){var e;return Ut||(e=new bt((function(){if(window.fetch)return Oe(window,"fetch",(function(t){return function(n,r){var o,a=i(Be,null,[e,n,r]);return a?(o=t.call(this,a.input,a.init),i(Ae,null,[e,o,a])):o=t.call(this,n,r),o}})).stop})),Ut=e),Ut}().subscribe((function(e){"resolve"===e.state&&a("fetch",e)}));function a(n,r){function i(e){t.notify(0,{rawLogsEvent:{message:"".concat(qe(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:yt,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:kt.error,origin:yt}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(Me(e.response,t)):n(e.response)}(r.xhr,e,i):r.response?function(e,t,n){window.TextDecoder?e.body?function(e,t,n){!function(e,t,n){var r=e.getReader(),i=[],a=0;function s(){var e,o;if(r.cancel().catch(l),n.collectStreamBody){var s;if(1===i.length)s=i[0];else{s=new Uint8Array(a);var u=0;i.forEach((function(e){s.set(e,u),u+=e.length}))}e=s.slice(0,n.bytesLimit),o=s.length>n.bytesLimit}t(void 0,e,o)}!function e(){r.read().then(o((function(t){t.done?s():(n.collectStreamBody&&i.push(t.value),(a+=t.value.length)>n.bytesLimit?s():e())})),o((function(e){return t(e)})))}()}(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(e.clone().body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: ".concat(e):t)})):n():e.clone().text().then(o((function(e){return n(Me(e,t))})),o((function(e){return n("Unable to retrieve response: ".concat(e))})))}(r.response,e,i):r.error&&function(e,t,n){n(Me(H(z(e)),t))}(r.error,e,i))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}},Me=function(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e},qe=function(e){return"xhr"===e?"XHR":"Fetch"},Ue=function(e){return function(e){var t=function(e){return Re(window,"onerror",{before:function(t,n,r,o,i){var a;if(i)a=z(i),e(a,i);else{var s,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var l=on.exec(c);l&&(s=l[1],c=l[2])}e(a={name:s,message:"string"==typeof c?c:void 0,stack:[u]},t)}}})}(e).stop,n=function(e){return Re(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=z(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}((function(t,n){e.notify(function(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,a=e.source,s=e.handling;return t&&(void 0!==t.message||n instanceof Error)?{startClocks:o,source:a,handling:s,originalError:n,message:t.message||"Empty message",stack:H(t),handlingStack:r,type:t.name,causes:W(n,a)}:{startClocks:o,source:a,handling:s,originalError:n,message:"".concat(i," ").concat(f(n)),stack:"No stack, consider using an instance of Error",handlingStack:r,type:t&&t.name}}({stackTrace:t,originalError:n,startClocks:O(),nonErrorPrefix:"Uncaught",source:mt,handling:"unhandled"}))}))},De={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},Ne=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Object.prototype.hasOwnProperty.call(De,e)||(e=De.log),Ne[e].apply(Ne,t)};Ne.debug=console.debug.bind(console),Ne.log=console.log.bind(console),Ne.info=console.info.bind(console),Ne.warn=console.warn.bind(console),Ne.error=console.error.bind(console);var Fe,ze=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Ge=!1,He=1e3,$e=6e4;function Ve(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,Ve)}function We(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=We(o[i],t[i],n);return o}var a="object"===k(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=We(a[s],t[s],n));return a}}var Je,Ke,Xe,Ye,Ze,Qe=function(){var e=function(){this.buffer=[]};return e.prototype.add=function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},e.prototype.drain=function(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),et="datadoghq.com",tt={logs:"logs",rum:"rum",sessionReplay:"session-replay"},nt={logs:"logs",rum:"rum",sessionReplay:"replay"},rt=/[^a-z0-9_:./-]/,ot="?",it="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",at="(?::(\\d+))",st=new RegExp("^\\s*at (.*?) ?\\(".concat(it).concat(at,"?").concat(at,"?\\)?\\s*$"),"i"),ut=new RegExp("\\((\\S*)".concat(at).concat(at,"\\)")),ct=new RegExp("^\\s*at ?".concat(it).concat(at,"?").concat(at,"??\\s*$"),"i"),lt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,ft=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,dt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pt="agent",ht="console",vt="logger",yt="network",mt="source",gt="report",bt=function(){var e=function(e){this.onFirstSubscribe=e,this.observers=[]};return e.prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}(),wt={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"},kt={debug:"debug",error:"error",info:"info",warn:"warn"},St="http",Et=Object.keys(kt),xt=function(){var e=function(e,t,n,r,o){void 0===n&&(n=St),void 0===r&&(r=kt.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=x(),this.contextManager.set(u({},o,t?{logger:{name:t}}:void 0))};return e.prototype.log=function(e,t,n){void 0===n&&(n=kt.info),this.handleLogStrategy({message:e,context:S(t),status:n},this)},e.prototype.debug=function(e,t){this.log(e,t,kt.debug)},e.prototype.info=function(e,t){this.log(e,t,kt.info)},e.prototype.warn=function(e,t){this.log(e,t,kt.warn)},e.prototype.error=function(e,t){var n={error:{origin:vt}};this.log(e,E(n,t),kt.error)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.getContext=function(){return this.contextManager.get()},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(e){this.level=e},e.prototype.getLevel=function(){return this.level},function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);i>3&&a&&Object.defineProperty(t,n,a)}([n],e.prototype,"log",null),e}(),_t="log",Ct=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","http://localhost","<anonymous>"],Tt=["ddog-gov.com"],Ot={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1},Rt=/[^\u0000-\u007F]/,Lt=function(){var e=function(e,t,n,r,o,i){var a=this;this.request=e,this.batchMessagesLimit=t,this.batchBytesLimit=n,this.messageBytesLimit=r,this.flushTimeout=o,this.pageExitObservable=i,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,i.subscribe((function(){return a.flush(a.request.sendOnExit)})),this.flushPeriodically()};return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(e){if(void 0===e&&(e=this.request.send),0!==this.bufferMessagesCount){var t=this.pushOnlyBuffer.concat(y(this.upsertBuffer)),n=this.bufferBytesCount;this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,e({data:t.join("\n"),bytesCount:n})}},e.prototype.computeBytesCount=function(e){return Rt.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,o=n.messageBytesCount;o>=this.messageBytesLimit?Ne.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(o)&&this.flush(),this.push(r,o,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=f(e);return{processedMessage:t,messageBytesCount:this.computeBytesCount(t)}},e.prototype.push=function(e,t,n){this.bufferMessagesCount>0&&(this.bufferBytesCount+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesCount+=t,this.bufferMessagesCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.computeBytesCount(t);this.bufferBytesCount-=n,this.bufferMessagesCount-=1,this.bufferMessagesCount>0&&(this.bufferBytesCount-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesCount+e+1>=this.batchBytesLimit},e.prototype.isFull=function(){return this.bufferMessagesCount===this.batchMessagesLimit||this.bufferBytesCount>=this.batchBytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout(o((function(){e.flush(),e.flushPeriodically()})),this.flushTimeout)},e}(),jt=3145728;function Pt(e,t,n,r){2===e.transportStatus&&setTimeout(o((function(){ce(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=1e3,le(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(6e4,2*e.currentBackoffTime),Pt(e,t,n,r)}})})),e.currentBackoffTime)}var Bt,At,It,Mt,qt,Ut,Dt,Nt,Ft,zt=!1,Gt=1/0,Ht=function(){var e=function(e){var t=this;this.expireDelay=e,this.entries=[],this.clearOldContextsInterval=setInterval((function(){return t.clearOldContexts()}),6e4)};return e.prototype.add=function(e,t){var n=this,r={context:e,startTime:t,endTime:Gt,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.entries.unshift(r),r},e.prototype.find=function(e){void 0===e&&(e=Gt);for(var t=0,n=this.entries;t<n.length;t++){var r=n[t];if(r.startTime<=e){if(e<=r.endTime)return r.context;break}}},e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===Gt&&t.close(e)},e.prototype.findAll=function(e){return void 0===e&&(e=Gt),this.entries.filter((function(t){return t.startTime<=e&&e<=t.endTime})).map((function(e){return e.context}))},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){clearInterval(this.clearOldContextsInterval)},e.prototype.clearOldContexts=function(){for(var e=T()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}(),$t=144e5,Vt=9e5,Wt=/^([a-z]+)=([a-z0-9-]+)$/,Jt="&",Kt="_dd_s",Xt=[],Yt=[],Zt=((At={})[kt.debug]=0,At[kt.info]=1,At[kt.warn]=2,At[kt.error]=3,At),Qt=!1,en={},tn=((It={})[De.log]=kt.info,It[De.debug]=kt.debug,It[De.info]=kt.info,It[De.warn]=kt.warn,It[De.error]=kt.error,It),nn=((Mt={})[wt.cspViolation]=kt.error,Mt[wt.intervention]=kt.error,Mt[wt.deprecation]=kt.warn,Mt),rn=new WeakMap,on=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/,an=function(){var e=function(){this.callbacks={}};return e.prototype.notify=function(e,t){var n=this.callbacks[e];n&&n.forEach((function(e){return e(t)}))},e.prototype.subscribe=function(e,t){var n=this;return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),{unsubscribe:function(){n.callbacks[e]=n.callbacks[e].filter((function(e){return t!==e}))}}},e}(),sn=function(e){var n,r,i=function(){return{view:{referrer:document.referrer,url:window.location.href},context:s.getContext(),user:c.getContext()}},a=!1,s=x(),c=x(),l={},f=function(){},d=new Qe,h=function(e,t,n,r){void 0===n&&(n=S(i())),void 0===r&&(r=C()),d.add((function(){return h(e,t,n,r)}))},v=function(){},m=new xt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h.apply(void 0,e)}));return n={logger:m,init:o((function(t){var n;if(v=function(){return S(t)},j()&&(t=function(e){return u({},e,{clientToken:"empty"})}(t)),function(e){return!a||(e.silentMultipleInit||Ne.error("DD_LOGS is already initialized."),!1)}(t)){var r=function(e){var t=N(e),n=ee(e.forwardConsoleLogs,y(De),"Forward Console Logs"),r=ee(e.forwardReports,y(wt),"Forward Reports");if(t&&n&&r)return e.forwardErrorsToLogs&&!p(n,De.error)&&n.push(De.error),u({forwardErrorsToLogs:!1!==e.forwardErrorsToLogs,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:32768},t)}(t);r&&(n=e(t,r,i,m),h=n.handleLog,f=n.getInternalContext,d.drain(),a=!0)}})),getLoggerGlobalContext:o(s.get),getGlobalContext:o(s.getContext),setLoggerGlobalContext:o(s.set),setGlobalContext:o(s.setContext),addLoggerGlobalContext:o(s.add),setGlobalContextProperty:o(s.setContextProperty),removeLoggerGlobalContext:o(s.remove),removeGlobalContextProperty:o(s.removeContextProperty),clearGlobalContext:o(s.clearContext),createLogger:o((function(e,t){return void 0===t&&(t={}),l[e]=new xt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h.apply(void 0,e)}),e,t.handler,t.level,t.context),l[e]})),getLogger:o((function(e){return l[e]})),getInitConfiguration:o((function(){return v()})),getInternalContext:o((function(e){return f(e)})),setUser:o((function(e){(function(e){var t="object"===k(e);return t||Ne.error("Unsupported user:",e),t})(e)&&c.setContext(P(e))})),getUser:o(c.getContext),setUserProperty:o((function(e,t){var n,r=P((n={},n[e]=t,n))[e];c.setContextProperty(e,r)})),removeUserProperty:o(c.removeContextProperty),clearUser:o(c.clearContext)},r=u({version:"4.30.1",onReady:function(e){e()}},n),Object.defineProperty(r,"_setDebug",{get:function(){return t},enumerable:!1}),r}((function(e,t,n,r){var o=new an;o.subscribe(1,(function(e){return te("logs",e)}));var i,a=function(e){return o.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:pt},origin:pt,status:kt.error}})},s=i=new bt((function(){var e=X(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&i.notify({reason:"visibility_hidden"})}),{capture:!0}).stop,t=X(window,"beforeunload",(function(){i.notify({reason:"before_unload"})})).stop;return function(){e(),t()}})),c=function(e,t,n){var r,o=oe("browser-logs-sdk",e);if(j()){var i=L();o.observable.subscribe((function(e){return i.send("internal_telemetry",e)}))}else{var a=pe(e,e.rumEndpointBuilder,t,n,null===(r=e.replica)||void 0===r?void 0:r.rumEndpointBuilder);o.observable.subscribe((function(t){return a.add(t,function(e){return"datad0g.com"===e.site}(e))}))}return o}(t,a,s);c.setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=_e())||void 0===e?void 0:e.application_id},session:{id:null===(t=p.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=_e())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=_e())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),Ie(t,o),function(e,t){if(!e.forwardErrorsToLogs)return{stop:l};var n=new bt;Ue(n).stop,n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:mt,stack:e.stack},origin:mt,status:kt.error}})}))}(t,o),function(e,t){Ce(e.forwardConsoleLogs).subscribe((function(e){t.notify(0,{rawLogsEvent:{date:C(),message:e.message,origin:ht,error:e.api===De.error?{origin:ht,stack:e.stack}:void 0,status:tn[e.api]}})}))}(t,o),function(e,t){Z(e.forwardReports).subscribe((function(e){var n,r=e.message,o=nn[e.type];o===kt.error?n={kind:e.subtype,origin:gt,stack:e.stack}:e.stack&&(r+=" Found in ".concat(function(e){var t;return null===(t=/@ (.+)/.exec(e))||void 0===t?void 0:t[1]}(e.stack))),t.notify(0,{rawLogsEvent:{date:C(),message:r,origin:gt,error:n,status:o}})}))}(t,o);var f,d=function(e){return{handleLog:function(t,n,r,o){var i=t.context;xe(t.status,"console",n)&&Ne(t.status,t.message,E(n.getContext(),i)),e.notify(0,{rawLogsEvent:{date:o||C(),message:t.message,status:t.status,origin:vt},messageContext:i,savedCommonContext:r,logger:n})}}}(o).handleLog,p=!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_".concat(Ve()),n="test";B(t,n,$e,e);var r=A(t)===n;return I(t,e),r}catch(e){return Ne.error(e),!1}}(t.cookieOptions)||j()||ne()?function(e){var t="1"===Ee(e)?{}:void 0;return{findTrackedSession:function(){return t}}}(t):function(e){var t=Se(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:Ee(e);return{trackingType:n,isTracked:"1"===n}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&"1"===n.trackingType?{id:n.id}:void 0}}}(t);return function(e,t,n,r,o,i){var a=Et.concat(["custom"]),s={};a.forEach((function(e){var n,r,o,a,u;s[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,a=0,u=!1,{isLimitReached:function(){if(0===a&&setTimeout((function(){a=0}),$e),(a+=1)<=r||u)return u=!1,!1;if(a===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:pt,startClocks:O()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var a,u,c,l=i.rawLogsEvent,f=i.messageContext,d=void 0===f?void 0:f,p=i.savedCommonContext,h=void 0===p?void 0:p,v=i.logger,y=void 0===v?o:v,g=l.date-R(),b=e.findTrackedSession(g);if(b){var w=h||r(),k=E({service:t.service,session_id:b.id,usr:m(w.user)?void 0:w.user,view:w.view},w.context,_e(g),l,y.getContext(),d);!xe(l.status,St,y)||!1===(null===(a=t.beforeSend)||void 0===a?void 0:a.call(t,k))||(null===(u=k.error)||void 0===u?void 0:u.origin)!==pt&&(null!==(c=s[k.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,k)}}))}(p,t,o,n,r,a),j()?function(e){var t=L();e.subscribe(1,(function(e){t.send("log",e)}))}(o):function(e,t,n,r){var o,i=pe(e,e.logsEndpointBuilder,n,r,null===(o=e.replica)||void 0===o?void 0:o.logsEndpointBuilder);t.subscribe(1,(function(e){i.add(e)}))}(t,o,a,s),function(e){Ot.telemetryConfigurationEnabled&&ae({type:"configuration",configuration:e})}(function(e){var t=function(e){var t;return{session_sample_rate:null!==(t=e.sessionSampleRate)&&void 0!==t?t:e.sampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,use_before_send:!!e.beforeSend,use_cross_site_session_cookie:e.useCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:void 0!==e.proxyUrl?!!e.proxyUrl:void 0,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_resources:e.trackResources,track_long_task:e.trackLongTasks}}(e);return u({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(e)),{handleLog:d,getInternalContext:(f=p,{get:function(e){var t=f.findTrackedSession(e);if(t)return{session_id:t.id}}}).get}}));Nt=sn,Ft=(Dt=b())["DD_LOGS"],Dt.DD_LOGS=Nt,Ft&&Ft.q&&Ft.q.forEach((function(t){return e(t,"onReady callback threw an error:")()}))}();var u={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},c=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Object.prototype.hasOwnProperty.call(u,e)||(e=u.log),c[e].apply(c,t)};c.debug=console.debug.bind(console),c.log=console.log.bind(console),c.info=console.info.bind(console),c.warn=console.warn.bind(console),c.error=console.error.bind(console);var l={};e(l,"startMonitorErrorCollection",(function(){return h}),(function(e){return h=e})),e(l,"setDebugMode",(function(){return v}),(function(e){return v=e})),e(l,"monitored",(function(){return y}),(function(e){return y=e})),e(l,"monitor",(function(){return m}),(function(e){return m=e})),e(l,"callMonitored",(function(){return g}),(function(e){return g=e})),e(l,"displayIfDebugEnabled",(function(){return b}),(function(e){return b=e}));var f,d=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},p=!1;function h(e){f=e}function v(e){p=e}function y(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=f?m(r):r;return n.apply(this,e)}}function m(e){return function(){return g(e,this,arguments)}}function g(e,t,n){try{return e.apply(t,n)}catch(e){if(b(u.error,e),f)try{f(e)}catch(e){b(u.error,e)}}}function b(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];p&&c.apply(void 0,d([e,"[MONITOR]"],t,!1))}var w=1e3,k=6e4;function S(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,a=!n||void 0===n.trailing||n.trailing,s=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];s?r=n:(i?e.apply(void 0,n):r=n,s=!0,o=setTimeout((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){clearTimeout(o),s=!1,r=void 0}}}function E(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}function x(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,x)}function _(e){return 0!==e&&100*Math.random()<=e}function C(){}function T(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=O(Object.prototype),o=O(Array.prototype),i=O(Object.getPrototypeOf(e)),a=O(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function O(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):C}function R(e,t){return-1!==e.indexOf(t)}function L(e){if(Array.from)return Array.from(e);var t=[];if(e instanceof Set)e.forEach((function(e){return t.push(e)}));else for(var n=0;n<e.length;n++)t.push(e[n]);return t}function j(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}function P(e){return B(e)&&e>=0&&e<=100}function B(e){return"number"==typeof e}function A(e){return Object.keys(e).map((function(t){return e[t]}))}function I(e){return 0===Object.keys(e).length}function M(e,t){return e.slice(0,t.length)===t}function q(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}function U(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}function D(e,t){var n=new RegExp("(?:^|;)\\s*".concat(t,"\\s*=\\s*([^;]+)")).exec(e);return n?n[1]:void 0}function N(e,t,n){void 0===n&&(n="");var r=e.charCodeAt(t-1),o=r>=55296&&r<=56319?t+1:t;return e.length<=o?e:"".concat(e.slice(0,o)).concat(n)}function F(e){return null===e?"null":Array.isArray(e)?"array":void 0===e?"undefined":r(e)}function z(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=z(o[i],t[i],n);return o}var a="object"===F(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=z(a[s],t[s],n));return a}}function G(e){return z(void 0,e)}function H(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=z(e,i))}return e}var $,V,W,J;function K(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u)}function X(e){return D(document.cookie,e)}function Y(e,t){K(e,"",0,t)}function Z(){if(void 0===$){for(var e="dd_site_test_".concat(x()),t=window.location.hostname.split("."),n=t.pop();t.length&&!X(e);)n="".concat(t.pop(),".").concat(n),K(e,"test",w,{domain:n});Y(e,{domain:n}),$=n}return $}function Q(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{return e.apply(void 0,n)}catch(e){c.error(t,e)}}}function ee(){return(new Date).getTime()}function te(){return ee()}function ne(){return performance.now()}function re(){return{relative:ne(),timeStamp:te()}}function oe(){return void 0===W&&(W=performance.timing.navigationStart),W}function ie(e){return ae(e,U(window.location)).href}function ae(e,t){if(function(){if(void 0!==J)return J;try{var e=new URL("http://test/path");return J="http://test/path"===e.href}catch(e){J=!1}return J}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}var se="datadoghq.com",ue={logs:"logs",rum:"rum",sessionReplay:"session-replay"},ce={logs:"logs",rum:"rum",sessionReplay:"replay"};function le(e,t,n){var r=e.clientToken,o=function(e,t){var n=e.site,r=void 0===n?se:n,o=e.internalAnalyticsSubdomain;if(o&&r===se)return"".concat(o,".").concat(se);var i=r.split("."),a=i.pop();return"".concat(ue[t],".browser-intake-").concat(i.join("-"),".").concat(a)}(e,t),i="https://".concat(o,"/api/v2/").concat(ce[t]),a=e.proxyUrl&&ie(e.proxyUrl);return{build:function(o,s){var u=["sdk_version:".concat("4.30.1"),"api:".concat(o)].concat(n);s&&u.push("retry_count:".concat(s.count),"retry_after:".concat(s.lastFailureStatus));var c=["ddsource=browser","ddtags=".concat(encodeURIComponent(u.join(","))),"dd-api-key=".concat(r),"dd-evp-origin-version=".concat(encodeURIComponent("4.30.1")),"dd-evp-origin=browser","dd-request-id=".concat(x())];"rum"===t&&c.push("batch_time=".concat(te())),e.internalAnalyticsSubdomain&&c.reverse();var l="".concat(i,"?").concat(c.join("&"));return a?"".concat(a,"?ddforward=").concat(encodeURIComponent(l)):l},buildIntakeUrl:function(){return a?"".concat(a,"?ddforward"):i},endpointType:t}}function fe(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(pe("env",t)),n&&i.push(pe("service",n)),r&&i.push(pe("version",r)),o&&i.push(pe("datacenter",o)),i}var de=/[^a-z0-9_:./-]/;function pe(e,t){var n=200-e.length-1;(t.length>n||de.test(t))&&c.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var r=t.replace(/,/g,"_");return"".concat(e,":").concat(r)}function he(e){var t=fe(e),n=function(e,t){return{logsEndpointBuilder:le(e,"logs",t),rumEndpointBuilder:le(e,"rum",t),sessionReplayEndpointBuilder:le(e,"sessionReplay",t)}}(e,t),r=A(n).map((function(e){return e.buildIntakeUrl()})),o=function(e,t,n){if(!e.replica)return;var r=E({},e,{site:se,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:le(r,"logs",n),rumEndpointBuilder:le(r,"rum",n)};return t.push.apply(t,A(o).map((function(e){return e.buildIntakeUrl()}))),E({applicationId:e.replica.applicationId},o)}(e,r,t);return E({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||se},n)}function ve(e){var t,n,r;if(e&&e.clientToken){var o=null!==(t=e.sessionSampleRate)&&void 0!==t?t:e.sampleRate;if(void 0===o||P(o))if(void 0===e.telemetrySampleRate||P(e.telemetrySampleRate)){var i;if(void 0===e.telemetryConfigurationSampleRate||P(e.telemetryConfigurationSampleRate))return i=e.enableExperimentalFeatures,Array.isArray(i)&&(V||(V=new Set(i)),i.filter((function(e){return"string"==typeof e})).forEach((function(e){R(e,"-")&&c.warn("please use snake case for '".concat(e,"'")),V.add(e)}))),E({beforeSend:e.beforeSend&&Q(e.beforeSend,"beforeSend threw an error:"),cookieOptions:ye(e),sessionSampleRate:null!=o?o:100,telemetrySampleRate:null!==(n=e.telemetrySampleRate)&&void 0!==n?n:20,telemetryConfigurationSampleRate:null!==(r=e.telemetryConfigurationSampleRate)&&void 0!==r?r:5,service:e.service,silentMultipleInit:!!e.silentMultipleInit,batchBytesLimit:16384,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:3e4,batchMessagesLimit:50,messageBytesLimit:262144},he(e));c.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else c.error("Telemetry Sample Rate should be a number between 0 and 100");else c.error("Session Sample Rate should be a number between 0 and 100")}else c.error("Client Token is not configured, we will not send any data.")}function ye(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=Z()),t}var me="?";function ge(e){var t=[],n=Te(e,"stack"),r=String(e);return n&&M(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=ke.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=Se.exec(t[2]);r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||me,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Ee.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:me,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=xe.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||me,line:+t[3],url:t[2]}}(e)||function(e){var t=_e.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=Ce.exec(t[3]);n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0);return{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||me,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=me),t.push(n))})),{message:Te(e,"message"),name:Te(e,"name"),stack:t}}var be="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",we="(?::(\\d+))",ke=new RegExp("^\\s*at (.*?) ?\\(".concat(be).concat(we,"?").concat(we,"?\\)?\\s*$"),"i"),Se=new RegExp("\\((\\S*)".concat(we).concat(we,"\\)"));var Ee=new RegExp("^\\s*at ?".concat(be).concat(we,"?").concat(we,"??\\s*$"),"i");var xe=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var _e=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Ce=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Te(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function Oe(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}}function Re(e,t,n){var r=n.before,o=n.after;return Oe(e,t,(function(e){return function(){var t,n=arguments;return r&&(0,l.callMonitored)(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&(0,l.callMonitored)(o,this,n),t}}))}var Le=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function je(e){var t=function(e){return Re(window,"onerror",{before:function(t,n,r,o,i){var a;if(i)a=ge(i),e(a,i);else{var s,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var l=Le.exec(c);l&&(s=l[1],c=l[2])}e(a={name:s,message:"string"==typeof c?c:void 0,stack:[u]},t)}}})}(e).stop,n=function(e){return Re(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=ge(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}var Pe={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function Be(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,a=e.source,s=e.handling;return t&&(void 0!==t.message||n instanceof Error)?{startClocks:o,source:a,handling:s,originalError:n,message:t.message||"Empty message",stack:Ae(t),handlingStack:r,type:t.name,causes:qe(n,a)}:{startClocks:o,source:a,handling:s,originalError:n,message:"".concat(i," ").concat(T(n)),stack:"No stack, consider using an instance of Error",handlingStack:r,type:t&&t.name}}function Ae(e){var t=Ie(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"(".concat(e.args.join(", "),")"):"",o=e.line?":".concat(e.line):"",i=e.line&&e.column?":".concat(e.column):"";t+="\n at ".concat(n).concat(r," @ ").concat(e.url).concat(o).concat(i)})),t}function Ie(e){return"".concat(e.name||"Error",": ").concat(e.message)}function Me(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return(0,l.callMonitored)((function(){var n=ge(t);n.stack=n.stack.slice(2),e=Ae(n)})),e}function qe(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=ge(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Ae(o)}),n=n.cause}return r.length?r:void 0}function Ue(e){return je((function(t,n){e.notify(Be({stackTrace:t,originalError:n,startClocks:re(),nonErrorPrefix:"Uncaught",source:Pe.SOURCE,handling:"unhandled"}))}))}var De,Ne=((De=function(e){this.onFirstSubscribe=e,this.observers=[]}).prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},De.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},De);function Fe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Ne((function(){var t=e.map((function(e){return e.subscribe((function(e){return n.notify(e)}))}));return function(){return t.forEach((function(e){return e.unsubscribe()}))}}));return n}function ze(e,t){var n,r=window;return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function Ge(e,t,n,r){return He(e,[t],n,r)}function He(e,t,n,r){var o=function(){var n=ze(e,"removeEventListener");t.forEach((function(t){return n.call(e,t,c,f)}))},i=void 0===r?{}:r,a=i.once,s=i.capture,u=i.passive,c=(0,l.monitor)(a?function(e){o(),n(e)}:n),f=u?{capture:s,passive:u}:s,d=ze(e,"addEventListener");return t.forEach((function(t){return d.call(e,t,c,f)})),{stop:o}}var $e={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function Ve(e){var t,n=[];R(e,$e.cspViolation)&&n.push(t=new Ne((function(){var e=(0,l.monitor)((function(e){t.notify(function(e){var t=$e.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:$e.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:We(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(N(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))}));return Ge(document,"securitypolicyviolation",e).stop})));var r=e.filter((function(e){return e!==$e.cspViolation}));return r.length&&n.push(function(e){var t=new Ne((function(){if(window.ReportingObserver){var n=(0,l.monitor)((function(e){return e.forEach((function(e){var n,r,o;t.notify((r=(n=e).type,o=n.body,{type:r,subtype:o.id,message:"".concat(r,": ").concat(o.message),stack:We(o.id,o.message,o.sourceFile,o.lineNumber,o.columnNumber)}))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(r)),Fe.apply(void 0,n)}function We(e,t,n,r,o){return n&&Ae({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function Je(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var Ke,Xe={log:"log",configuration:"configuration"},Ye=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","http://localhost","<anonymous>"],Ze=["ddog-gov.com"],Qe={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function et(e,t){var n,r=new Ne;return Qe.telemetryEnabled=_(t.telemetrySampleRate),Qe.telemetryConfigurationEnabled=Qe.telemetryEnabled&&_(t.telemetryConfigurationSampleRate),Ke=function(o){if(!R(Ze,t.site)&&Qe.telemetryEnabled){var i=function(e,t){return H({type:"telemetry",date:te(),service:e,version:"4.30.1",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:L(V||new Set)},void 0!==n?n():{})}(e,o);r.notify(i),Je("telemetry",i)}},(0,l.startMonitorErrorCollection)(nt),E(Qe,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r}}function tt(e,t){(0,l.displayIfDebugEnabled)(u.debug,e,t),rt(E({type:Xe.log,message:e,status:"debug"},t))}function nt(e){rt(E({type:Xe.log,status:"error"},function(e){if(e instanceof Error){var t=ge(e);return{error:{kind:t.name,stack:Ae(ot(t))},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught ".concat(T(e))}}(e)))}function rt(e){Ke&&Qe.sentEventCount<Qe.maxEventsPerPage&&(Qe.sentEventCount+=1,Ke(e))}function ot(e){return e.stack=e.stack.filter((function(e){return!e.url||Ye.some((function(t){return M(e.url,t)}))})),e}var it,at=1/0,st=((it=function(e){var t=this;this.expireDelay=e,this.entries=[],this.clearOldContextsInterval=setInterval((function(){return t.clearOldContexts()}),6e4)}).prototype.add=function(e,t){var n=this,r={context:e,startTime:t,endTime:at,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.entries.unshift(r),r},it.prototype.find=function(e){void 0===e&&(e=at);for(var t=0,n=this.entries;t<n.length;t++){var r=n[t];if(r.startTime<=e){if(e<=r.endTime)return r.context;break}}},it.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===at&&t.close(e)},it.prototype.findAll=function(e){return void 0===e&&(e=at),this.entries.filter((function(t){return t.startTime<=e&&e<=t.endTime})).map((function(e){return e.context}))},it.prototype.reset=function(){this.entries=[]},it.prototype.stop=function(){clearInterval(this.clearOldContextsInterval)},it.prototype.clearOldContexts=function(){for(var e=ne()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},it);var ut,ct=144e5,lt=9e5,ft=/^([a-z]+)=([a-z0-9-]+)$/,dt="&",pt="_dd_s",ht=[];function vt(e,t){var n;if(void 0===t&&(t=0),ut||(ut=e),e===ut)if(t>=100)gt();else{var r,o=kt();if(yt()){if(o.lock)return void mt(e,t);if(r=x(),o.lock=r,wt(o,e.options),(o=kt()).lock!==r)return void mt(e,t)}var i=e.process(o);if(yt()&&(o=kt()).lock!==r)mt(e,t);else{if(i&&bt(i,e.options),yt()&&(!i||!St(i))){if((o=kt()).lock!==r)return void mt(e,t);delete o.lock,wt(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),gt()}}else ht.push(e)}function yt(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)}function mt(e,t){setTimeout((0,l.monitor)((function(){vt(e,t+1)})),10)}function gt(){ut=void 0;var e=ht.shift();e&&vt(e)}function bt(e,t){St(e)?function(e){K(pt,"",0,e)}(t):(e.expire=String(ee()+lt),wt(e,t))}function wt(e,t){K(pt,function(e){return(t=e,Object.keys(t).map((function(e){return[e,t[e]]}))).map((function(e){var t=e[0],n=e[1];return"".concat(t,"=").concat(n)})).join(dt);var t}(e),lt,t)}function kt(){var e=X(pt),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(dt)||ft.test(e))}(e)&&e.split(dt).forEach((function(e){var n=ft.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function St(e){return I(e)}function Et(e){var t=X(pt),n=X("_dd"),r=X("_dd_r"),o=X("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),bt(i,e)}}function xt(e,t,n){var r,o=function(e){return f(e)||(e={}),a()&&(s(e)?u():v=e),e},i=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;return e[t]=o,i&&!e.id&&(e.id=x(),e.created=String(ee())),i},a=function(){return void 0!==v[t]},s=function(e){return v.id!==e.id||v[t]!==e[t]},u=function(){v={},p.notify()},c=function(e){v=e,d.notify()},f=function(e){return(void 0===e.created||ee()-Number(e.created)<ct)&&(void 0===e.expire||ee()<Number(e.expire))},d=new Ne,p=new Ne,h=setInterval((0,l.monitor)((function(){vt({options:e,process:function(e){return f(e)?void 0:{}},after:o})})),1e3),v=(r=kt(),f(r)?r:{});return{expandOrRenewSession:S((0,l.monitor)((function(){var t;vt({options:e,process:function(e){var n=o(e);return t=i(n),n},after:function(e){t&&!a()&&c(e),v=e}})})),1e3).throttled,expandSession:function(){vt({options:e,process:function(e){return a()?o(e):void 0}})},getSession:function(){return v},renewObservable:d,expireObservable:p,stop:function(){clearInterval(h)}}}var _t=[];function Ct(e,t,n){var r=function(){return{id:o.getSession().id,trackingType:o.getSession()[t]}};Et(e);var o=xt(e,t,n);_t.push((function(){return o.stop()}));var i,a=new st(144e5);return _t.push((function(){return a.stop()})),o.renewObservable.subscribe((function(){a.add(r(),ne())})),o.expireObservable.subscribe((function(){a.closeActive(ne())})),o.expandOrRenewSession(),a.add(r(),[0,oe()][0]),i=He(window,["click","touchstart","keydown","scroll"],(function(){return o.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,_t.push(i),function(e){var t=(0,l.monitor)((function(){"visible"===document.visibilityState&&e()})),n=Ge(document,"visibilitychange",t).stop;_t.push(n);var r=setInterval(t,6e4);_t.push((function(){clearInterval(r)}))}((function(){return o.expandSession()})),{findActiveSession:function(e){return a.find(e)},renewObservable:o.renewObservable,expireObservable:o.expireObservable}}function Tt(){var e=q().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function Ot(e){var t;void 0===e&&(e=null===(t=q().location)||void 0===t?void 0:t.hostname);var n=Tt();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}var Rt,Lt=/[^\u0000-\u007F]/,jt=((Rt=function(e,t,n,r,o,i){var a=this;this.request=e,this.batchMessagesLimit=t,this.batchBytesLimit=n,this.messageBytesLimit=r,this.flushTimeout=o,this.pageExitObservable=i,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,i.subscribe((function(){return a.flush(a.request.sendOnExit)})),this.flushPeriodically()}).prototype.add=function(e){this.addOrUpdate(e)},Rt.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},Rt.prototype.flush=function(e){if(void 0===e&&(e=this.request.send),0!==this.bufferMessagesCount){var t=this.pushOnlyBuffer.concat(A(this.upsertBuffer)),n=this.bufferBytesCount;this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,e({data:t.join("\n"),bytesCount:n})}},Rt.prototype.computeBytesCount=function(e){return Lt.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},Rt.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,o=n.messageBytesCount;o>=this.messageBytesLimit?c.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(o)&&this.flush(),this.push(r,o,t),this.isFull()&&this.flush())},Rt.prototype.process=function(e){var t=T(e);return{processedMessage:t,messageBytesCount:this.computeBytesCount(t)}},Rt.prototype.push=function(e,t,n){this.bufferMessagesCount>0&&(this.bufferBytesCount+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesCount+=t,this.bufferMessagesCount+=1},Rt.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.computeBytesCount(t);this.bufferBytesCount-=n,this.bufferMessagesCount-=1,this.bufferMessagesCount>0&&(this.bufferBytesCount-=1)},Rt.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},Rt.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesCount+e+1>=this.batchBytesLimit},Rt.prototype.isFull=function(){return this.bufferMessagesCount===this.batchMessagesLimit||this.bufferBytesCount>=this.batchBytesLimit},Rt.prototype.flushPeriodically=function(){var e=this;setTimeout((0,l.monitor)((function(){e.flush(),e.flushPeriodically()})),this.flushTimeout)},Rt),Pt=3145728;function Bt(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?It(e,t,n,{onSuccess:function(){return Mt(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),At(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function At(e,t,n,r){2===e.transportStatus&&setTimeout((0,l.monitor)((function(){It(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=1e3,Mt(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(6e4,2*e.currentBackoffTime),At(e,t,n,r)}})})),e.currentBackoffTime)}function It(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),!function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||e.status>=500)}(n)?(t.transportStatus=0,o()):(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:n.status},i())}))}function Mt(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(3,"MiB"),source:Pe.AGENT,startClocks:re()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=qt();i.size()>0;)Bt(i.dequeue(),t,n,r,o)}function qt(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=Pt}}}function Ut(e,t,n){var r={transportStatus:0,currentBackoffTime:1e3,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=81920&&this.ongoingRequestCount<32},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:qt(),queueFullReported:!1},o=function(n,r){return function(e,t,n,r){var o=n.data,i=n.bytesCount,a=n.retry,s=function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&i<t;if(s){var u=e.build("fetch",a);fetch(u,{method:"POST",body:o,keepalive:!0,mode:"cors"}).then((0,l.monitor)((function(e){return null==r?void 0:r({status:e.status,type:e.type})})),(0,l.monitor)((function(){Ft(e.build("xhr",a),o,r)})))}else{Ft(e.build("xhr",a),o,r)}}(e,t,n,r)};return{send:function(t){Bt(t,r,o,e.endpointType,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount,i=!!navigator.sendBeacon&&o<t;if(i)try{var a=e.build("beacon");if(navigator.sendBeacon(a,r))return}catch(e){!function(e){Nt||(Nt=!0,nt(e))}(e)}var s=e.build("xhr");Ft(s,r)}(e,t,n)}}}var Dt,Nt=!1;function Ft(e,t,n){var r=new XMLHttpRequest,o=(0,l.monitor)((function(){r.removeEventListener("loadend",o),null==n||n({status:r.status})}));r.open("POST",e,!0),r.addEventListener("loadend",o),r.send(t)}function zt(e,t,n,r,o){var i,a=function(t){return new jt(Ut(t,e.batchBytesLimit,n),e.batchMessagesLimit,e.batchBytesLimit,e.messageBytesLimit,e.flushTimeout,r)},s=a(t);return o&&(i=a(o)),{add:function(e,t){void 0===t&&(t=!0),s.add(e),i&&t&&i.add(e)}}}var Gt,Ht=new WeakMap;function $t(){var e;return Dt||(e=new Ne((function(){var t=Re(XMLHttpRequest.prototype,"open",{before:Vt}).stop,n=Re(XMLHttpRequest.prototype,"send",{before:function(){Wt.call(this,e)}}).stop,r=Re(XMLHttpRequest.prototype,"abort",{before:Jt}).stop;return function(){t(),n(),r()}})),Dt=e),Dt}function Vt(e,t){Ht.set(this,{state:"open",method:e,url:ie(String(t))})}function Wt(e){var t=this,n=Ht.get(this);if(n){var r=n;r.state="start",r.startTime=ne(),r.startClocks=re(),r.isAborted=!1,r.xhr=this;var o=!1,i=Re(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&a()}}).stop,a=(0,l.monitor)((function(){if(t.removeEventListener("loadend",a),i(),!o){o=!0;var s,u=n;u.state="complete",u.duration=(s=r.startClocks.timeStamp,te()-s),u.status=t.status,e.notify(E({},u))}}));this.addEventListener("loadend",a),e.notify(r)}}function Jt(){var e=Ht.get(this);e&&(e.isAborted=!0)}function Kt(){var e;return Gt||(e=new Ne((function(){if(window.fetch)return Oe(window,"fetch",(function(t){return function(n,r){var o,i=(0,l.callMonitored)(Xt,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),(0,l.callMonitored)(Yt,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),Gt=e),Gt}function Xt(e,t,n){var r=n&&n.method||"object"==typeof t&&t.method||"GET",o=ie("object"==typeof t&&t.url||t),i={state:"start",init:n,input:t,method:r,startClocks:re(),url:o};return e.notify(i),i}function Yt(e,t,n){var r=function(t){var r=n;r.state="resolve","stack"in t||t instanceof Error?(r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t):"status"in t&&(r.response=t,r.responseType=t.type,r.status=t.status,r.isAborted=!1),e.notify(r)};t.then((0,l.monitor)(r),(0,l.monitor)(r))}var Zt={};function Qt(e){var t=e.map((function(e){return Zt[e]||(Zt[e]=function(e){var t=new Ne((function(){var n=console[e];return console[e]=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(console,r);var i=Me();(0,l.callMonitored)((function(){t.notify(en(r,e,i))}))},function(){console[e]=n}}));return t}(e)),Zt[e]}));return Fe.apply(void 0,t)}function en(e,t,n){var r,o=e.map((function(e){return function(e){return"string"==typeof e?e:e instanceof Error?Ie(ge(e)):T(e,void 0,2)}(e)})).join(" ");if(t===u.error){var i=j(e,(function(e){return e instanceof Error}));r=i?Ae(ge(i)):void 0,o="console error: ".concat(o)}return{api:t,message:o,stack:r,handlingStack:n}}var tn,nn=((tn=function(){this.buffer=[]}).prototype.add=function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},tn.prototype.drain=function(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},tn);function rn(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t},getContext:function(){return G(e)},setContext:function(t){e=G(t)},setContextProperty:function(t,n){e[t]=G(n)},removeContextProperty:function(t){delete e[t]},clearContext:function(){e={}}}}function on(e,t,n){var r=function(){var e,r;if(o.cancel().catch(C),n.collectStreamBody){var s;if(1===i.length)s=i[0];else{s=new Uint8Array(a);var u=0;i.forEach((function(e){s.set(e,u),u+=e.length}))}e=s.slice(0,n.bytesLimit),r=s.length>n.bytesLimit}t(void 0,e,r)},o=e.getReader(),i=[],a=0;!function e(){o.read().then((0,l.monitor)((function(t){t.done?r():(n.collectStreamBody&&i.push(t.value),(a+=t.value.length)>n.bytesLimit?r():e())})),(0,l.monitor)((function(e){return t(e)})))}()}function an(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||X("datadog-synthetics-injects-rum"))}function sn(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||X("datadog-synthetics-result-id");return"string"==typeof e?e:void 0}function un(e){var t=E({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}function cn(e,t,n){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return R(t,e)}))?"all"===e?t:(r=e,o=new Set,r.forEach((function(e){return o.add(e)})),L(o)):void c.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'));var r,o}var ln={};e(ln,"StatusType",(function(){return pn}),(function(e){return pn=e})),e(ln,"HandlerType",(function(){return hn}),(function(e){return hn=e})),e(ln,"STATUSES",(function(){return vn}),(function(e){return vn=e})),e(ln,"Logger",(function(){return yn}),(function(e){return yn=e}));var fn,dn=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},pn={debug:"debug",error:"error",info:"info",warn:"warn"},hn={console:"console",http:"http",silent:"silent"},vn=Object.keys(pn),yn=(fn=function(e,t,n,r,o){void 0===n&&(n=hn.http),void 0===r&&(r=pn.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=rn(),this.contextManager.set(E({},o,t?{logger:{name:t}}:void 0))},fn.prototype.log=function(e,t,n){void 0===n&&(n=pn.info),this.handleLogStrategy({message:e,context:G(t),status:n},this)},fn.prototype.debug=function(e,t){this.log(e,t,pn.debug)},fn.prototype.info=function(e,t){this.log(e,t,pn.info)},fn.prototype.warn=function(e,t){this.log(e,t,pn.warn)},fn.prototype.error=function(e,t){var n={error:{origin:Pe.LOGGER}};this.log(e,H(n,t),pn.error)},fn.prototype.setContext=function(e){this.contextManager.set(e)},fn.prototype.getContext=function(){return this.contextManager.get()},fn.prototype.addContext=function(e,t){this.contextManager.add(e,t)},fn.prototype.removeContext=function(e){this.contextManager.remove(e)},fn.prototype.setHandler=function(e){this.handlerType=e},fn.prototype.getHandler=function(){return this.handlerType},fn.prototype.setLevel=function(e){this.level=e},fn.prototype.getLevel=function(){return this.level},dn([l.monitored],fn.prototype,"log",null),fn);var mn;function gn(e){var t=Ct(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:bn(e);return{trackingType:n,isTracked:"1"===n}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&"1"===n.trackingType?{id:n.id}:void 0}}}function bn(e){return _(e.sessionSampleRate)?"1":"0"}var wn=((mn={})[ln.StatusType.debug]=0,mn[ln.StatusType.info]=1,mn[ln.StatusType.warn]=2,mn[ln.StatusType.error]=3,mn);function kn(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return wn[e]>=wn[n.getLevel()]&&R(o,t)}function Sn(e,t,n,r,o,i){var a=ln.STATUSES.concat(["custom"]),s={};a.forEach((function(e){var n,r,o,a,u;s[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,a=0,u=!1,{isLimitReached:function(){if(0===a&&setTimeout((function(){a=0}),k),(a+=1)<=r||u)return u=!1,!1;if(a===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Pe.AGENT,startClocks:re()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var a,u,c,l=i.rawLogsEvent,f=i.messageContext,d=void 0===f?void 0:f,p=i.savedCommonContext,h=void 0===p?void 0:p,v=i.logger,y=void 0===v?o:v,m=l.date-oe(),g=e.findTrackedSession(m);if(g){var b=h||r(),w=H({service:t.service,session_id:g.id,usr:I(b.user)?void 0:b.user,view:b.view},b.context,_n(m),l,y.getContext(),d);!kn(l.status,ln.HandlerType.http,y)||!1===(null===(a=t.beforeSend)||void 0===a?void 0:a.call(t,w))||(null===(u=w.error)||void 0===u?void 0:u.origin)!==Pe.AGENT&&(null!==(c=s[w.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,w)}}))}var En,xn=!1;function _n(e){var t,n=function(t){if(t&&t.getInternalContext)return t.getInternalContext(e)},r=window;if(an()){var o=n(r.DD_RUM_SYNTHETICS);return o||xn||(xn=!0,tt("Logs sent before RUM is injected by the synthetics worker",{testId:(t=window._DATADOG_SYNTHETICS_PUBLIC_ID||X("datadog-synthetics-public-id"),"string"==typeof t?t:void 0),resultId:sn()})),o}return n(r.DD_RUM)}var Cn,Tn=((En={})[u.log]=ln.StatusType.info,En[u.debug]=ln.StatusType.debug,En[u.info]=ln.StatusType.info,En[u.warn]=ln.StatusType.warn,En[u.error]=ln.StatusType.error,En);var On=((Cn={})[$e.cspViolation]=ln.StatusType.error,Cn[$e.intervention]=ln.StatusType.error,Cn[$e.deprecation]=ln.StatusType.warn,Cn);function Rn(e,t){var n=function(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(jn(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:Pe.NETWORK,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:ln.StatusType.error,origin:Pe.NETWORK}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(Ln(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){window.TextDecoder?e.body?function(e,t,n){on(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(e.clone().body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: ".concat(e):t)})):n():e.clone().text().then((0,l.monitor)((function(e){return n(Ln(e,t))})),(0,l.monitor)((function(e){return n("Unable to retrieve response: ".concat(e))})))}(r.response,e,o):r.error&&function(e,t,n){n(Ln(Ae(ge(e)),t))}(r.error,e,o))};if(!e.forwardErrorsToLogs)return{stop:C};var r=$t().subscribe((function(e){"complete"===e.state&&n("xhr",e)})),o=Kt().subscribe((function(e){"resolve"===e.state&&n("fetch",e)}));return{stop:function(){r.unsubscribe(),o.unsubscribe()}}}function Ln(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function jn(e){return"xhr"===e?"XHR":"Fetch"}var Pn,Bn=((Pn=function(){this.callbacks={}}).prototype.notify=function(e,t){var n=this.callbacks[e];n&&n.forEach((function(e){return e(t)}))},Pn.prototype.subscribe=function(e,t){var n=this;return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),{unsubscribe:function(){n.callbacks[e]=n.callbacks[e].filter((function(e){return t!==e}))}}},Pn);var An,In,Mn,qn,Un,Dn,Nn,Fn,zn,Gn,Hn,$n,Vn,Wn=(An=function(e,t,n,r){var o=new Bn;o.subscribe(1,(function(e){return Je("logs",e)}));var i,a=function(e){return o.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:Pe.AGENT},origin:Pe.AGENT,status:ln.StatusType.error}})},s=i=new Ne((function(){var e=Ge(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&i.notify({reason:"visibility_hidden"})}),{capture:!0}).stop,t=Ge(window,"beforeunload",(function(){i.notify({reason:"before_unload"})})).stop;return function(){e(),t()}}));(function(e,t,n){var r,o=et("browser-logs-sdk",e);if(Ot()){var i=Tt();o.observable.subscribe((function(e){return i.send("internal_telemetry",e)}))}else{var a=zt(e,e.rumEndpointBuilder,t,n,null===(r=e.replica)||void 0===r?void 0:r.rumEndpointBuilder);o.observable.subscribe((function(t){return a.add(t,function(e){return"datad0g.com"===e.site}(e))}))}return o})(t,a,s).setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=_n())||void 0===e?void 0:e.application_id},session:{id:null===(t=d.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=_n())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=_n())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),Rn(t,o),function(e,t){if(!e.forwardErrorsToLogs)return{stop:C};var n=new Ne,r=Ue(n).stop,o=n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:Pe.SOURCE,stack:e.stack},origin:Pe.SOURCE,status:ln.StatusType.error}})}))}(t,o),function(e,t){var n=Qt(e.forwardConsoleLogs).subscribe((function(e){t.notify(0,{rawLogsEvent:{date:te(),message:e.message,origin:Pe.CONSOLE,error:e.api===u.error?{origin:Pe.CONSOLE,stack:e.stack}:void 0,status:Tn[e.api]}})}))}(t,o),function(e,t){var n=Ve(e.forwardReports).subscribe((function(e){var n,r,o,i=e.message,a=On[e.type];a===ln.StatusType.error?n={kind:e.subtype,origin:Pe.REPORT,stack:e.stack}:e.stack&&(i+=" Found in ".concat((r=e.stack,null===(o=/@ (.+)/.exec(r))||void 0===o?void 0:o[1]))),t.notify(0,{rawLogsEvent:{date:te(),message:i,origin:Pe.REPORT,error:n,status:a}})}))}(t,o);var l,f=function(e){return{handleLog:function(t,n,r,o){var i=t.context;kn(t.status,ln.HandlerType.console,n)&&c(t.status,t.message,H(n.getContext(),i)),e.notify(0,{rawLogsEvent:{date:o||te(),message:t.message,status:t.status,origin:Pe.LOGGER},messageContext:i,savedCommonContext:r,logger:n})}}}(o).handleLog,d=!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_".concat(x()),n="test";K(t,n,k,e);var r=X(t)===n;return Y(t,e),r}catch(e){return c.error(e),!1}}(t.cookieOptions)||Ot()||an()?function(e){var t="1"===bn(e)?{}:void 0;return{findTrackedSession:function(){return t}}}(t):gn(t);return Sn(d,t,o,n,r,a),Ot()?function(e){var t=Tt();e.subscribe(1,(function(e){t.send("log",e)}))}(o):function(e,t,n,r){var o,i=zt(e,e.logsEndpointBuilder,n,r,null===(o=e.replica)||void 0===o?void 0:o.logsEndpointBuilder);t.subscribe(1,(function(e){i.add(e)}))}(t,o,a,s),function(e){Qe.telemetryConfigurationEnabled&&rt({type:Xe.configuration,configuration:e})}(function(e){var t=function(e){var t;return{session_sample_rate:null!==(t=e.sessionSampleRate)&&void 0!==t?t:e.sampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,use_before_send:!!e.beforeSend,use_cross_site_session_cookie:e.useCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:void 0!==e.proxyUrl?!!e.proxyUrl:void 0,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_resources:e.trackResources,track_long_task:e.trackLongTasks}}(e);return E({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(e)),{handleLog:f,getInternalContext:(l=d,{get:function(e){var t=l.findTrackedSession(e);if(t)return{session_id:t.id}}}).get}},qn=function(){return{view:{referrer:document.referrer,url:window.location.href},context:Dn.getContext(),user:Nn.getContext()}},Un=!1,Dn=rn(),Nn=rn(),Fn={},zn=function(){},Gn=new nn,Hn=function(e,t,n,r){void 0===n&&(n=G(qn())),void 0===r&&(r=te()),Gn.add((function(){return Hn(e,t,n,r)}))},$n=function(){},Vn=new(0,ln.Logger)((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Hn.apply(void 0,e)})),In={logger:Vn,init:(0,l.monitor)((function(e){var t;if($n=function(){return G(e)},Ot()&&(e=function(e){return E({},e,{clientToken:"empty"})}(e)),function(e){return!Un||(e.silentMultipleInit||c.error("DD_LOGS is already initialized."),!1)}(e)){var n=function(e){var t=ve(e),n=cn(e.forwardConsoleLogs,A(u),"Forward Console Logs"),r=cn(e.forwardReports,A($e),"Forward Reports");if(t&&n&&r)return e.forwardErrorsToLogs&&!R(n,u.error)&&n.push(u.error),E({forwardErrorsToLogs:!1!==e.forwardErrorsToLogs,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:32768},t)}(e);n&&(t=An(e,n,qn,Vn),Hn=t.handleLog,zn=t.getInternalContext,Gn.drain(),Un=!0)}})),getLoggerGlobalContext:(0,l.monitor)(Dn.get),getGlobalContext:(0,l.monitor)(Dn.getContext),setLoggerGlobalContext:(0,l.monitor)(Dn.set),setGlobalContext:(0,l.monitor)(Dn.setContext),addLoggerGlobalContext:(0,l.monitor)(Dn.add),setGlobalContextProperty:(0,l.monitor)(Dn.setContextProperty),removeLoggerGlobalContext:(0,l.monitor)(Dn.remove),removeGlobalContextProperty:(0,l.monitor)(Dn.removeContextProperty),clearGlobalContext:(0,l.monitor)(Dn.clearContext),createLogger:(0,l.monitor)((function(e,t){return void 0===t&&(t={}),Fn[e]=new(0,ln.Logger)((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Hn.apply(void 0,e)}),e,t.handler,t.level,t.context),Fn[e]})),getLogger:(0,l.monitor)((function(e){return Fn[e]})),getInitConfiguration:(0,l.monitor)((function(){return $n()})),getInternalContext:(0,l.monitor)((function(e){return zn(e)})),setUser:(0,l.monitor)((function(e){(function(e){var t="object"===F(e);return t||c.error("Unsupported user:",e),t})(e)&&Nn.setContext(un(e))})),getUser:(0,l.monitor)(Nn.getContext),setUserProperty:(0,l.monitor)((function(e,t){var n,r=un((n={},n[e]=t,n))[e];Nn.setContextProperty(e,r)})),removeUserProperty:(0,l.monitor)(Nn.removeContextProperty),clearUser:(0,l.monitor)(Nn.clearContext)},Mn=E({version:"4.30.1",onReady:function(e){e()}},In),Object.defineProperty(Mn,"_setDebug",{get:function(){return l.setDebugMode},enumerable:!1}),Mn);!function(e,t,n){var r=e[t];e[t]=n,r&&r.q&&r.q.forEach((function(e){return Q(e,"onReady callback threw an error:")()}))}(q(),"DD_LOGS",Wn);var Jn={card:"card-element",cardNumber:"card-number-element",cardExpirationDate:"card-expiration-date-element",cardVerificationCode:"card-verification-code-element",data:"data-element",text:"text-element"},Kn="https://elements-dev.basistheory.com",Xn="pub5f53501515584007899577554c4aeda6";function Yn(e){if(Array.isArray(e))return e}function Zn(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Qn(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function tr(e,t){if(e){if("string"==typeof e)return er(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}function nr(e,t){return Yn(e)||Zn(e)||tr(e,t)||Qn()}function rr(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<e.length;r++){var o=e[r];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(r>0&&(o=o.replace(/^[\/]+/,"")),o=r<e.length-1?o.replace(/[\/]+$/,""):o.replace(/[\/]+$/,"/"),t.push(o))}var i=t.join("/"),a=(i=i.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return i=a.shift()+(a.length>0?"?":"")+a.join("&")}function or(){return rr("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}function ir(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){s(e,t,n[t])}))}return e}var ar={};function sr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ur(e,t){return ur=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ur(e,t)}function cr(e,t){return ur(e,t)}function lr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&cr(e,t)}function fr(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function dr(e){return dr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},dr(e)}function pr(e){return dr(e)}function hr(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?sr(e):t}function vr(e){var t=fr();return function(){var n,r=pr(e);if(t){var o=pr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return hr(this,n)}}Object.defineProperty(ar,"__esModule",{value:!0}),ar.BasisTheoryApiError=void 0;var yr,mr,gr=function(e){lr(n,e);var t=vr(n);function n(e,r,i){var a;return o(this,n),(a=t.call(this,e)).status=r,a.data=i,a.name="BasisTheoryApiError",Object.setPrototypeOf(sr(a),n.prototype),a}return n}((yr=Error,mr=function(){var e=Reflect.construct(yr,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e},mr.prototype=Object.create(yr.prototype,{constructor:{value:yr,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(mr,yr):mr.__proto__=yr,mr));ar.BasisTheoryApiError=gr;var br={};Object.defineProperty(br,"__esModule",{value:!0}),br.BasisTheoryValidationError=void 0;var wr=function(e){lr(n,e);var t=vr(n);function n(e,r,i){var a;return o(this,n),(a=t.call(this,e)).details=r,a.validation=i,a.name="BasisTheoryValidationError",Object.setPrototypeOf(sr(a),n.prototype),a}return n}(function(e){var t=function(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t};return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error));br.BasisTheoryValidationError=wr;var kr=function(e,t){return kr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},kr(e,t)};function Sr(e,t){var n=function(){this.constructor=e};if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");kr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Er=function(){return Er=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Er.apply(this,arguments)};Object.create;function xr(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function Cr(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;function Tr(e){return e.toLowerCase()}var Or=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Rr=/[^A-Z0-9]+/gi;function Lr(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?Or:n,o=t.stripRegexp,i=void 0===o?Rr:o,a=t.transform,s=void 0===a?Tr:a,u=t.delimiter,c=void 0===u?" ":u,l=jr(jr(e,r,"$1\0$2"),i,"\0"),f=0,d=l.length;"\0"===l.charAt(f);)f++;for(;"\0"===l.charAt(d-1);)d--;return l.slice(f,d).split("\0").map(s).join(c)}function jr(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function Pr(e,t){return void 0===t&&(t={}),Lr(e,Er({delimiter:"."},t))}function Br(e,t){return void 0===t&&(t={}),Pr(e,Er({delimiter:"-"},t))}function Ar(e){return"function"==typeof e}function Ir(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Mr=Ir((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function qr(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ur,Dr,Nr=((Dr=function(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}).prototype.unsubscribe=function(){var e,t,n,r,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=xr(i),s=a.next();!s.done;s=a.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else i.remove(this);var u=this.initialTeardown;if(Ar(u))try{u()}catch(e){o=e instanceof Mr?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=xr(c),f=l.next();!f.done;f=l.next()){var d=f.value;try{Gr(d)}catch(e){o=null!=o?o:[],e instanceof Mr?o=Cr(Cr([],_r(o)),_r(e.errors)):o.push(e)}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new Mr(o)}},Dr.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Gr(e);else{if(e instanceof Dr){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(t=this._finalizers)&&void 0!==t?t:[]).push(e)}},Dr.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},Dr.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},Dr.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&qr(t,e)},Dr.prototype.remove=function(e){var t=this._finalizers;t&&qr(t,e),e instanceof Dr&&e._removeParent(this)},Dr.EMPTY=((Ur=new Dr).closed=!0,Ur),Dr),Fr=Nr.EMPTY;function zr(e){return e instanceof Nr||e&&"closed"in e&&Ar(e.remove)&&Ar(e.add)&&Ar(e.unsubscribe)}function Gr(e){Ar(e)?e():e.unsubscribe()}var Hr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},$r={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=$r.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Cr([e,t],_r(n))):setTimeout.apply(void 0,Cr([e,t],_r(n)))},clearTimeout:function(e){var t=$r.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Vr(e){$r.setTimeout((function(){var t=Hr.onUnhandledError;if(!t)throw e;t(e)}))}function Wr(){}var Jr=Kr("C",void 0,void 0);function Kr(e,t,n){return{kind:e,value:t,error:n}}var Xr=null;function Yr(e){if(Hr.useDeprecatedSynchronousErrorHandling){var t=!Xr;if(t&&(Xr={errorThrown:!1,error:null}),e(),t){var n=Xr,r=n.errorThrown,o=n.error;if(Xr=null,r)throw o}}else e()}var Zr,Qr,eo=(Sr(Qr=function(e){var t=Zr.call(this)||this;return t.isStopped=!1,e?(t.destination=e,zr(e)&&e.add(t)):t.destination=uo,t},Zr=Nr),Qr.create=function(e,t,n){return new io(e,t,n)},Qr.prototype.next=function(e){this.isStopped?so(function(e){return Kr("N",e,void 0)}(e),this):this._next(e)},Qr.prototype.error=function(e){this.isStopped?so(Kr("E",void 0,e),this):(this.isStopped=!0,this._error(e))},Qr.prototype.complete=function(){this.isStopped?so(Jr,this):(this.isStopped=!0,this._complete())},Qr.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,Zr.prototype.unsubscribe.call(this),this.destination=null)},Qr.prototype._next=function(e){this.destination.next(e)},Qr.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},Qr.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Qr),to=Function.prototype.bind;function no(e,t){return to.call(e,t)}var ro,oo=((ro=function(e){this.partialObserver=e}).prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ao(e)}},ro.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ao(e)}else ao(e)},ro.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ao(e)}},ro),io=function(e){var t=function(t,n,r){var o,i,a=e.call(this)||this;Ar(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:a&&Hr.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},o={next:t.next&&no(t.next,i),error:t.error&&no(t.error,i),complete:t.complete&&no(t.complete,i)}):o=t;return a.destination=new oo(o),a};return Sr(t,e),t}(eo);function ao(e){var t;Hr.useDeprecatedSynchronousErrorHandling?(t=e,Hr.useDeprecatedSynchronousErrorHandling&&Xr&&(Xr.errorThrown=!0,Xr.error=t)):Vr(e)}function so(e,t){var n=Hr.onStoppedNotification;n&&$r.setTimeout((function(){return n(e,t)}))}var uo={closed:!0,next:Wr,error:function(e){throw e},complete:Wr},co="function"==typeof Symbol&&Symbol.observable||"@@observable";function lo(e){return e}function fo(e){return 0===e.length?lo:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var po=function(){var e=function(e){e&&(this._subscribe=e)};return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,o=this,i=(r=e)&&r instanceof eo||function(e){return e&&Ar(e.next)&&Ar(e.error)&&Ar(e.complete)}(r)&&zr(r)?e:new io(e,t,n);return Yr((function(){var e=o,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=ho(t))((function(t,r){var o=new io({next:function(t){try{e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t});n.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[co]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return fo(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ho(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function ho(e){var t;return null!==(t=null!=e?e:Hr.Promise)&&void 0!==t?t:Promise}var vo,yo=Ir((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),mo=function(e){var t=function(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t};return Sr(t,e),t.prototype.lift=function(e){var t=new go(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new yo},t.prototype.next=function(e){var t=this;Yr((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=xr(t.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(e)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;Yr((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;Yr((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,o=n.isStopped,i=n.observers;return r||o?Fr:(this.currentObservers=null,i.push(e),new Nr((function(){t.currentObservers=null,qr(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,o=t.isStopped;n?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new po;return e.source=this,e},t.create=function(e,t){return new go(e,t)},t}(po),go=function(e){var t=function(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r};return Sr(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:Fr},t}(mo),bo=new Uint8Array(16);function wo(){if(!vo&&!(vo="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vo(bo)}var ko=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var So=function(e){return"string"==typeof e&&ko.test(e)},Eo=[],xo=0;xo<256;++xo)Eo.push((xo+256).toString(16).substr(1));var _o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Eo[e[t+0]]+Eo[e[t+1]]+Eo[e[t+2]]+Eo[e[t+3]]+"-"+Eo[e[t+4]]+Eo[e[t+5]]+"-"+Eo[e[t+6]]+Eo[e[t+7]]+"-"+Eo[e[t+8]]+Eo[e[t+9]]+"-"+Eo[e[t+10]]+Eo[e[t+11]]+Eo[e[t+12]]+Eo[e[t+13]]+Eo[e[t+14]]+Eo[e[t+15]]).toLowerCase();if(!So(n))throw TypeError("Stringified UUID is invalid");return n};var Co=function(e,t,n){var r=(e=e||{}).random||(e.rng||wo)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return _o(r)};function To(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function Oo(e,t,n){return Oo=To()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&cr(o,n.prototype),o},Oo.apply(null,arguments)}function Ro(e,t,n){return Oo.apply(null,arguments)}function Lo(e){var t="function"==typeof Map?new Map:void 0;return Lo=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Ro(e,arguments,pr(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),cr(r,e)},Lo(e)}function jo(e){return Lo(e)}var Po=function(e){"use strict";lr(n,e);var t=vr(n);function n(e){var r,i=e.details;return o(this,n),(r=t.call(this,Xo(i))).name="MountElementError",r.details=i,r}return n}(jo(Error)),Bo=function(e){"use strict";lr(n,e);var t=vr(n);function n(e){var r,i=e.details;return o(this,n),(r=t.call(this,Xo(i))).name="UpdateElementError",r.details=i,r}return n}(jo(Error)),Ao="Element is not mounted.",Io=function(){"use strict";function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,e),this.options=Object.freeze(ir({},t,this.sanitizeOptions("create",n))),this.id=Co(),this.unmounted=!1,this._ready=!1,this.changeSubject=new mo,this.readySubject=new mo,this.focusSubject=new mo,this.blurSubject=new mo,this.keydownSubject=new mo,this.updateSubjects={},this.submitSubjects={},this.metadata={complete:!1,valid:!1,maskSatisfied:!1,empty:!0}}return a(e,[{key:"mount",value:function(e){var t=this;if(this.unmounted)throw Wn.logger.error("Element has been unmounted and can't be mounted again for elementId=".concat(this.id)),new Error("Element has been unmounted and can't be mounted again");if(this.mounted)throw Wn.logger.error("Element is already mounted for elementId=".concat(this.id)),new Error("Element is already mounted.");var n=null===document||void 0===document?void 0:document.querySelector(e);if(!n||n.childNodes.length>0)throw Wn.logger.error("Couldn't find an empty element with selector ".concat(e," to mount on for elementId=").concat(this.id,".")),new Error("Couldn't find an empty element with selector ".concat(e," to mount on."));return new Promise((function(r,o){t.iframe=document.createElement("iframe"),t.iframe.id=t.id,t.iframe.src=Jo(t.options,t.id),t.iframe.title="Basis Theory ".concat(t.elementType," Safe Data Frame ").concat(t.id),t.iframe.scrolling="no";var i=t.iframeStyle();Object.keys(i).forEach((function(e){var n,r=null!==(n=i[e])&&void 0!==n?n:null;t.updateIframeStyle(Br(e),r)})),n.append(t.iframe),t.iframe.addEventListener("load",(function(){t.mountTimeout=window.setTimeout((function(){Wn.logger.error("Mount Timeout for elementId=".concat(t.id)),t.iframe&&(t.iframe.src=Jo(t.options,t.id)),t.retryTimeout=window.setTimeout((function(){t.stopListening(),Wn.logger.error("Mount Timeout on retry for elementId=".concat(t.id)),o(new Error('Timeout while trying to mount element under selector "'.concat(e,'". Check the console for more details.')))}),15e3)}),15e3)})),t.startListening(),t.onMountCallbacks={resolve:r,reject:o}}))}},{key:"unmount",value:function(){var e;if(!this.mounted)throw Wn.logger.error("".concat(Ao," on unmount for elementId=").concat(this.id)),new Error(Ao);this.stopListening(),null===(e=this.iframe)||void 0===e||e.remove(),delete this.iframe,this.unmounted=!0}},{key:"update",value:function(e){var t=this;if(!this.mounted)return Wn.logger.error("".concat(Ao," on update for elementId=").concat(this.id)),Promise.reject(new Error(Ao));var n=Co(),r=this.sanitizeOptions("update",e),o={type:"updateConfigRequest",direction:"outgoing",correlationId:n,style:r.style,disabled:r.disabled,password:r.password,placeholder:r.placeholder,transform:r.transform,ariaLabel:r.ariaLabel,iconPosition:r.iconPosition,cardBrand:r.cardBrand,autoComplete:r.autoComplete,value:r.value},i=new mo;return this.updateSubjects[n]=i,new Promise((function(e,a){i.subscribe({error:a,next:e,complete:function(){delete t.updateSubjects[n],t.options=Object.freeze(ir({},t.options,r))}}),t.postMessage(o)}))}},{key:"clear",value:function(){if(!this.mounted)throw Wn.logger.error("".concat(Ao," on clear for elementId=").concat(this.id)),new Error(Ao);this.postMessage({type:"clearElement",direction:"outgoing"})}},{key:"focus",value:function(){if(!this.mounted)throw Wn.logger.error("".concat(Ao," on focus for elementId=").concat(this.id)),new Error(Ao);this.postMessage({type:"focusElement",direction:"outgoing"})}},{key:"blur",value:function(){if(!this.mounted)throw Wn.logger.error("".concat(Ao," on blur for elementId=").concat(this.id)),new Error(Ao);this.postMessage({type:"blurElement",direction:"outgoing"})}},{key:"setValue",value:function(e){if(!this.mounted)throw Wn.logger.error("".concat(Ao," on setValue for elementId=").concat(this.id)),new Error(Ao);var t={type:"setValueRequest",direction:"outgoing",value:e};this.postMessage(t)}},{key:"on",value:function(e,t){switch(e){case"change":return this.changeSubject.subscribe({next:t});case"focus":return this.focusSubject.subscribe({next:t});case"blur":return this.blurSubject.subscribe({next:t});case"keydown":return this.keydownSubject.subscribe({next:t});case"ready":return this.readySubject.subscribe({next:t});default:throw Wn.logger.error("Unknown event type ".concat(e,".")),new Error("Unknown event type ".concat(e,"."))}}},{key:"_submit",value:function(e){var t=e.service,n=e.method,r=e.payload,o=e.id,i=e.options,a=e.elements,s=this;if(!this.mounted)return Promise.reject(new Error(Ao));var u=Co(),c={type:"tokenizeRequest",direction:"outgoing",correlationId:u,service:t,method:n,id:o,payload:ya(r),options:i,elements:va(a)},l=new mo;return this.submitSubjects[u]=l,new Promise((function(e,t){l.subscribe({error:t,next:e,complete:function(){delete s.submitSubjects[u]}}),s.postMessage(c)}))}},{key:"postMessage",value:function(e){var t,n;return null===(t=this.iframe)||void 0===t||null===(n=t.contentWindow)||void 0===n?void 0:n.postMessage(JSON.stringify(e,(function(e,t){return t instanceof RegExp?"".concat("REGEXP__").concat(t.source):t})),this.iframeOrigin)}},{key:"sanitizeOptions",value:function(e,t){return wa(t)}},{key:"onLoad",value:function(){if(!this.ready){window.clearTimeout(this.mountTimeout),window.clearTimeout(this.retryTimeout);var e={type:"setConfigRequest",direction:"outgoing",apiKey:this.options.apiKey,style:this.options.style,disabled:this.options.disabled,password:this.options.password,targetId:this.options.targetId,mask:this.options.mask,placeholder:this.options.placeholder,transform:this.options.transform,ariaLabel:this.options.ariaLabel,iconPosition:this.options.iconPosition,cardBrand:this.options.cardBrand,autoComplete:this.options.autoComplete,value:this.options.value};this.postMessage(e)}}},{key:"onSetConfigResponse",value:function(e){var t=e.errors;this.onMountCallbacks&&(t&&t.length>0?this.onMountCallbacks.reject(new Po({details:t})):(this._ready=!0,this.onMountCallbacks.resolve(),this.readySubject.next({type:"ready"})),delete this.onMountCallbacks)}},{key:"onUpdateConfigResponse",value:function(e){var t=e.correlationId,n=e.errors,r=this.updateSubjects[t];r&&(n&&n.length>0?r.error(new Bo({details:n})):(r.next(),r.complete()))}},{key:"startListening",value:function(){var e=this;this.listener=function(t){var n=t.origin===e.iframeOrigin,r=t.data&&"string"==typeof t.data;if(n&&r){var o;try{o=JSON.parse(t.data)}catch(e){}if(o&&"incoming"===o.direction&&o.elementId===e.id)return t.stopImmediatePropagation(),"onLoad"===o.type?e.onLoad():"setConfigResponse"===o.type?e.onSetConfigResponse(o):"updateConfigResponse"===o.type?e.onUpdateConfigResponse(o):"inputFocus"===o.type?e.focusSubject.next({type:"focus",targetId:o.targetId}):"inputBlur"===o.type?e.blurSubject.next({type:"blur",targetId:o.targetId}):"inputKeydown"===o.type?e.keydownSubject.next({type:"keydown",targetId:o.targetId,key:o.key,ctrlKey:o.ctrlKey,altKey:o.altKey,shiftKey:o.shiftKey,metaKey:o.metaKey}):"stateUpdate"===o.type?e.onUpdateElementState(o):"tokenizeResponse"===o.type?e.onTokenizeResponse(o):e.onMessage(o)}},window.addEventListener("message",this.listener)}},{key:"stopListening",value:function(){this.listener&&window.removeEventListener("message",this.listener)}},{key:"onUpdateElementState",value:function(e){var t;(null!==(t=e.height)&&void 0!==t?t:-1)>=0&&this.updateIframeStyle("height","".concat(e.height,"px"))}},{key:"onTokenizeResponse",value:function(e){var t=this.submitSubjects[e.correlationId],n=e.data,r=e.errors,o=e.status,i=e.payloadErrors;t&&(r&&r.length>0?t.error(new(0,br.BasisTheoryValidationError)("There was a validation error that prevented submitting your request. Check error.details for more information.",i,r)):o&&o<0?t.error(new(0,ar.BasisTheoryApiError)("The API is unreachable. Please check your connection or try again later.",o,n)):o&&o>=400?t.error(new(0,ar.BasisTheoryApiError)("The API responded with status code ".concat(o,". Check error.data for more information."),o,n)):t.next(n),t.complete())}},{key:"updateIframeStyle",value:function(e,t){var n;null===(n=this.iframe)||void 0===n||n.style.setProperty(Br(e),t,"important")}},{key:"iframeOrigin",get:function(){var e;return new URL(null===(e=this.iframe)||void 0===e?void 0:e.src).origin}},{key:"mounted",get:function(){return Boolean(this.iframe)}},{key:"ready",get:function(){return this._ready}}]),e}(),Mo=function(e){"use strict";lr(n,e);var t=vr(n);function n(){var e;return o(this,n),s(sr(e=t.apply(this,arguments)),"elementType","CardElement"),e}return a(n,[{key:"cardMetadata",get:function(){return this._cardMetadata}},{key:"iframeStyle",value:function(){return{height:"29px",borderStyle:"none",margin:"0px",padding:"0px",width:"1px",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",willChange:"transform"}}},{key:"onMessage",value:function(e){var t;if("formChange"===e.type)return this._cardMetadata={cardBrand:null!==(t=e.cardBrand)&&void 0!==t?t:"unknown",cardBin:e.cardBin,cardLast4:e.cardLast4},this.metadata.empty=e.empty,this.metadata.complete=e.complete,this.metadata.maskSatisfied=e.maskSatisfied,this.metadata.valid=e.valid,this.changeSubject.next({cardBrand:e.cardBrand,cardLast4:e.cardLast4,cardBin:e.cardBin,valid:e.valid,maskSatisfied:e.maskSatisfied,type:"change",empty:e.empty,errors:e.errors,complete:e.complete})}},{key:"sanitizeOptions",value:function(e,t){return ka(e,t)}}]),n}(Io),qo=function(e){"use strict";lr(n,e);var t=vr(n);function n(){var e;return o(this,n),s(sr(e=t.apply(this,arguments)),"elementType","CardNumberElement"),e}return a(n,[{key:"cardMetadata",get:function(){return this._cardMetadata}},{key:"iframeStyle",value:function(){return{height:"29px",borderStyle:"none",margin:"0px",padding:"0px",width:"1px",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",willChange:"transform"}}},{key:"onMessage",value:function(e){var t,n;if("fieldChange"===e.type)return this._cardMetadata={cardBrand:null!==(t=e.cardBrand)&&void 0!==t?t:"unknown",cardBin:e.cardBin,cardLast4:e.cardLast4},this.metadata.empty=e.empty,this.metadata.complete=e.complete,this.metadata.maskSatisfied=e.maskSatisfied,this.metadata.valid=e.valid,this.changeSubject.next({cardBrand:null!==(n=e.cardBrand)&&void 0!==n?n:"unknown",cardLast4:e.cardLast4,valid:e.valid,maskSatisfied:e.maskSatisfied,cardBin:e.cardBin,type:"change",empty:e.empty,errors:e.error?[{type:e.error.type,targetId:e.targetId}]:[],complete:e.complete})}},{key:"sanitizeOptions",value:function(e,t){return xa(e,t)}}]),n}(Io),Uo=function e(t,n){"use strict";o(this,e),this.element=t,this.method=n},Do=function(e){"use strict";lr(n,e);var t=vr(n);function n(){var e;return o(this,n),s(sr(e=t.apply(this,arguments)),"elementType","CardExpirationDateElement"),e}return a(n,[{key:"month",value:function(){return new Uo(this,"month")}},{key:"year",value:function(){return new Uo(this,"year")}},{key:"iframeStyle",value:function(){return{height:"29px",borderStyle:"none",margin:"0px",padding:"0px",width:"1px",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",willChange:"transform"}}},{key:"onMessage",value:function(e){if("fieldChange"===e.type)return this.metadata.empty=e.empty,this.metadata.complete=e.complete,this.metadata.maskSatisfied=e.maskSatisfied,this.metadata.valid=e.valid,this.changeSubject.next({type:"change",empty:e.empty,valid:e.valid,maskSatisfied:e.maskSatisfied,errors:e.error?[{type:e.error.type,targetId:e.targetId}]:[],complete:e.complete})}},{key:"sanitizeOptions",value:function(e,t){return Ea(e,t)}}]),n}(Io),No=function(e){"use strict";lr(n,e);var t=vr(n);function n(){var e;return o(this,n),s(sr(e=t.apply(this,arguments)),"elementType","CardVerificationCodeElement"),e}return a(n,[{key:"iframeStyle",value:function(){return{height:"29px",borderStyle:"none",margin:"0px",padding:"0px",width:"1px",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",willChange:"transform"}}},{key:"onMessage",value:function(e){if("fieldChange"===e.type)return this.metadata.empty=e.empty,this.metadata.complete=e.complete,this.metadata.maskSatisfied=e.maskSatisfied,this.metadata.valid=e.valid,this.changeSubject.next({type:"change",empty:e.empty,valid:e.valid,maskSatisfied:e.maskSatisfied,errors:e.error?[{type:e.error.type,targetId:e.targetId}]:[],complete:e.complete})}},{key:"sanitizeOptions",value:function(e,t){return _a(e,t)}}]),n}(Io);function Fo(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function zo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Fo(i,r,o,a,s,"next",e)}function s(e){Fo(i,r,o,a,s,"throw",e)}a(void 0)}))}}var Go={},Ho=function(e){"use strict";var t,n=function(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]},r=function(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),s=new p(r||[]);return a._invoke=l(e,n,s),a},o=function(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}},i=function(){},a=function(){},s=function(){},u=function(e){["next","throw","return"].forEach((function(t){n(e,t,(function(e){return this._invoke(t,e)}))}))},c=function(e,t){function n(r,i,a,s){var u=o(e[r],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&m.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var r;this._invoke=function(e,o){function i(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(i,i):i()}},l=function(e,t,n){var r=S;return function(i,a){if(r===x)throw new Error("Generator is already running");if(r===_){if("throw"===i)throw a;return v()}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=j(s,n);if(u){if(u===C)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===S)throw r=_,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=x;var c=o(e,t,n);if("normal"===c.type){if(r=n.done?_:E,c.arg===C)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=_,n.method="throw",n.arg=c.arg)}}},f=function(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)},d=function(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t},p=function(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)},h=function(e){if(e){var n=e[b];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function n(){for(;++r<e.length;)if(m.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:v}},v=function(){return{value:t,done:!0}},y=Object.prototype,m=y.hasOwnProperty,g="function"==typeof Symbol?Symbol:{},b=g.iterator||"@@iterator",w=g.asyncIterator||"@@asyncIterator",k=g.toStringTag||"@@toStringTag";try{n({},"")}catch(e){n=function(e,t,n){return e[t]=n}}e.wrap=r;var S="suspendedStart",E="suspendedYield",x="executing",_="completed",C={},T={};n(T,b,(function(){return this}));var O=Object.getPrototypeOf,R=O&&O(O(h([])));R&&R!==y&&m.call(R,b)&&(T=R);var L=s.prototype=i.prototype=Object.create(T);function j(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,j(e,n),"throw"===n.method))return C;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return C}var i=o(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,C;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,C):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,C)}return a.prototype=s,n(L,"constructor",s),n(s,"constructor",a),a.displayName=n(s,k,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,n(e,k,"GeneratorFunction")),e.prototype=Object.create(L),e},e.awrap=function(e){return{__await:e}},u(c.prototype),n(c.prototype,w,(function(){return this})),e.AsyncIterator=c,e.async=function(t,n,o,i,a){void 0===a&&(a=Promise);var s=new c(r(t,n,o,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},u(L),n(L,k,"Generator"),n(L,b,(function(){return this})),n(L,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=h,p.prototype={constructor:p,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(d),!e)for(var n in this)"t"===n.charAt(0)&&m.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){var n=function(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o};if(this.done)throw e;for(var r=this,o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=m.call(i,"catchLoc"),u=m.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&m.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,C):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),C},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),d(n),C}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;d(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:h(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),C}},e}(Go);try{regeneratorRuntime=Ho}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=Ho:Function("r","regeneratorRuntime = r")(Ho)}var $o=function(e){"use strict";lr(r,e);var n=vr(r);function r(){var e;return o(this,r),s(sr(e=n.apply(this,arguments)),"elementType","DataElement"),s(sr(e),"_dataElementId","btDataElement"),e}return a(r,[{key:"_tokenRequest",value:function(e){var n=e.service,r=e.method,o=e.payload,i=e.id,a=e.options,s=this;return zo(t(Go).mark((function e(){var u,c,l;return t(Go).wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.mountDataElement();case 2:return u=Co(),c={type:"detokenizeRequest",direction:"outgoing",correlationId:u,service:n,method:r,id:i,payload:ya(o),options:a},l=new mo,s.submitSubjects[u]=l,e.abrupt("return",new Promise((function(e,t){l.subscribe({error:t,next:e,complete:function(){delete s.submitSubjects[u]}}),s.postMessage(c)})));case 7:case"end":return e.stop()}}),e)})))()}},{key:"_proxyRequest",value:function(e,n){var r=this;return zo(t(Go).mark((function o(){var i,a,s;return t(Go).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.mountDataElement();case 2:return i=Co(),a={type:"proxyRequest",direction:"outgoing",method:e,correlationId:i,options:n},s=new mo,r.submitSubjects[i]=s,t.abrupt("return",new Promise((function(e,t){s.subscribe({error:t,next:e,complete:function(){delete r.submitSubjects[i]}}),r.postMessage(a)})));case 7:case"end":return t.stop()}}),o)})))()}},{key:"iframeStyle",value:function(){return{display:"none"}}},{key:"onMessage",value:function(e){switch(e.type){case"detokenizeResponse":return this.onDetokenizeResponse(e);case"proxyResponse":return this.onProxyResponse(e)}}},{key:"mountDataElement",value:function(){var e=this;return zo(t(Go).mark((function n(){var r;return t(Go).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.mounted){t.next=6;break}return(r=document.createElement("div")).id=e._dataElementId,document.body.append(r),t.next=6,e.mount("#".concat(e._dataElementId));case 6:case"end":return t.stop()}}),n)})))()}},{key:"onDetokenizeResponse",value:function(e){var t=e.data,n=e.errors,r=e.status,o=e.payloadErrors,i=e.correlationId,a=this.submitSubjects[i];a&&(n&&n.length>0?a.error(new(0,br.BasisTheoryValidationError)("There was a validation error that prevented submitting your request. Check error.details for more information.",o,n)):r&&r<0?a.error(new(0,ar.BasisTheoryApiError)("The API is unreachable. Please check your connection or try again later.",r,t)):r&&r>=400?a.error(new(0,ar.BasisTheoryApiError)("The API responded with status code ".concat(r,". Check error.data for more information."),r,t)):a.next(t),a.complete())}},{key:"onProxyResponse",value:function(e){var t=e.data,n=e.status,r=e.correlationId,o=this.submitSubjects[r];o&&(n&&n<0?o.error(new(0,ar.BasisTheoryApiError)("The API is unreachable. Please check your connection or try again later.",n,t)):n&&n>=400?o.error(new(0,ar.BasisTheoryApiError)("The API responded with status code ".concat(n,". Check error.data for more information."),n,t)):o.next(t),o.complete())}}]),r}(Io),Vo=function(e){"use strict";lr(n,e);var t=vr(n);function n(){var e;return o(this,n),s(sr(e=t.apply(this,arguments)),"elementType","TextElement"),e}return a(n,[{key:"iframeStyle",value:function(){return{height:"29px",borderStyle:"none",margin:"0px",padding:"0px",width:"1px",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",willChange:"transform"}}},{key:"onMessage",value:function(e){if("fieldChange"===e.type)return this.metadata.empty=e.empty,this.metadata.complete=e.complete,this.metadata.maskSatisfied=e.maskSatisfied,this.metadata.valid=e.valid,this.changeSubject.next({type:"change",empty:e.empty,valid:e.valid,maskSatisfied:e.maskSatisfied,errors:e.error?[{type:e.error.type,targetId:e.targetId}]:[],complete:e.complete})}},{key:"sanitizeOptions",value:function(e,t){return Sa(e,t)}}]),n}(Io),Wo=function(e){if(null==e)throw Wn.logger.error("BasisTheoryElements has not yet been properly initialized."),new Error("BasisTheoryElements has not yet been properly initialized.");return e},Jo=function(e,t){var n=e.type,r=e.baseUrl,o=Jn[n];if(!o)throw Wn.logger.error("No route found for element of type ".concat(n,".")),new Error("No route found for element of type ".concat(n,"."));return or(r,"elements",o,"?element_id=".concat(t))},Ko=function(e){return!(!e||"object"!=typeof e)&&void 0!==Object.entries(e).find((function(e){var t=nr(e,2)[1];return t instanceof Io||Ko(t)}))},Xo=function(e){if(e.length)return e[0].message};function Yo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}var Zo,Qo,ei,ti={},ni=Zo={};function ri(){throw new Error("setTimeout has not been defined")}function oi(){throw new Error("clearTimeout has not been defined")}function ii(e){if(Qo===setTimeout)return setTimeout(e,0);if((Qo===ri||!Qo)&&setTimeout)return Qo=setTimeout,setTimeout(e,0);try{return Qo(e,0)}catch(t){try{return Qo.call(null,e,0)}catch(t){return Qo.call(this,e,0)}}}!function(){try{Qo="function"==typeof setTimeout?setTimeout:ri}catch(e){Qo=ri}try{ei="function"==typeof clearTimeout?clearTimeout:oi}catch(e){ei=oi}}();var ai,si=[],ui=!1,ci=-1;function li(){ui&&ai&&(ui=!1,ai.length?si=ai.concat(si):ci=-1,si.length&&fi())}function fi(){if(!ui){var e=ii(li);ui=!0;for(var t=si.length;t;){for(ai=si,si=[];++ci<t;)ai&&ai[ci].run();ci=-1,t=si.length}ai=null,ui=!1,function(e){if(ei===clearTimeout)return clearTimeout(e);if((ei===oi||!ei)&&clearTimeout)return ei=clearTimeout,clearTimeout(e);try{ei(e)}catch(t){try{return ei.call(null,e)}catch(t){return ei.call(this,e)}}}(e)}}function di(e,t){this.fun=e,this.array=t}function pi(){}ni.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];si.push(new di(e,t)),1!==si.length||ui||ii(fi)},di.prototype.run=function(){this.fun.apply(null,this.array)},ni.title="browser",ni.browser=!0,ni.env={},ni.argv=[],ni.version="",ni.versions={},ni.on=pi,ni.addListener=pi,ni.once=pi,ni.off=pi,ni.removeListener=pi,ni.removeAllListeners=pi,ni.emit=pi,ni.prependListener=pi,ni.prependOnceListener=pi,ni.listeners=function(e){return[]},ni.binding=function(e){throw new Error("process.binding is not supported")},ni.cwd=function(){return"/"},ni.chdir=function(e){throw new Error("process.chdir is not supported")},ni.umask=function(){return 0},
/**
* [js-htmlencode]{@link https://github.com/emn178/js-htmlencode}
*
* @version 0.3.0
* @author Chen, Yi-Cyuan [[email protected]]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/function(){"use strict";var e="object"==typeof window?window:{};!e.JS_HTMLENCODE_NO_NODE_JS&&"object"==typeof Zo&&Zo.versions&&Zo.versions.node&&(e=n);var t=!e.JS_HTMLENCODE_NO_COMMON_JS&&ti,r="function"==typeof define&&define.amd,o={" ":" ","¡":"¡","¢":"¢","£":"£","¤":"¤","¥":"Â¥","¦":"¦","§":"§","¨":"¨","©":"©","ª":"ª","«":"«","¬":"¬","­":"Â","®":"®","¯":"¯","°":"°","±":"±","²":"²","³":"³","´":"´","µ":"µ","¶":"¶","·":"·","¸":"¸","¹":"¹","º":"º","»":"»","¼":"¼","½":"½","¾":"¾","¿":"¿","À":"À","Á":"Ã","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Ã…","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"ÃŒ","Í":"Ã","Î":"ÃŽ","Ï":"Ã","Ð":"Ã","Ñ":"Ñ","Ò":"Ã’","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","×":"×","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ã","Þ":"Þ","ß":"ß","à":"à ","á":"á","â":"â","ã":"ã","ä":"ä","å":"Ã¥","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"Ã","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","÷":"÷","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ",""":'"',"&":"&","<":"<",">":">","'":"'","Œ":"Å’","œ":"Å“","Š":"Å ","š":"Å¡","Ÿ":"Ÿ","ˆ":"ˆ","˜":"Ëœ"," ":" "," ":" "," ":" ","‌":"‌","‍":"â€","‎":"‎","‏":"â€","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"â€","„":"„","†":"†","‡":"‡","‰":"‰","‹":"‹","›":"›","€":"€","ƒ":"Æ’","Α":"Α","Β":"Î’","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Î","Ξ":"Ξ","Ο":"Ο","Π":"Î ","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Î¥","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"Ï€","ρ":"Ï","ς":"Ï‚","σ":"σ","τ":"Ï„","υ":"Ï…","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","ϑ":"Ï‘","ϒ":"Ï’","ϖ":"Ï–","•":"•","…":"…","′":"′","″":"″","‾":"‾","⁄":"â„","℘":"℘","ℑ":"â„‘","ℜ":"ℜ","™":"â„¢","ℵ":"ℵ","←":"â†","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"â‡","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","∀":"∀","∂":"∂","∃":"∃","∅":"∅","∇":"∇","∈":"∈","∉":"∉","∋":"∋","∏":"âˆ","∑":"∑","−":"−","∗":"∗","√":"√","∝":"âˆ","∞":"∞","∠":"∠","∧":"∧","∨":"∨","∩":"∩","∪":"∪","∫":"∫","∴":"∴","∼":"∼","≅":"≅","≈":"≈","≠":"≠","≡":"≡","≤":"≤","≥":"≥","⊂":"⊂","⊃":"⊃","⊄":"⊄","⊆":"⊆","⊇":"⊇","⊕":"⊕","⊗":"⊗","⊥":"⊥","⋅":"â‹…","⌈":"⌈","⌉":"⌉","⌊":"⌊","⌋":"⌋","⟨":"〈","⟩":"〉","◊":"â—Š","♠":"â™ ","♣":"♣","♥":"♥","♦":"♦"},i=function(e){if("#"!==e.charAt(1))return o[e]||e;var t,n=e.charAt(2);return"x"===n||"X"===n?(n=e.substring(3,e.length-1),t=parseInt(n,16)):(n=e.substring(2,e.length-1),t=parseInt(n)),isNaN(t)?e:String.fromCharCode(t)},a=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")},s=function(e){return e.replace(/&#?\w+;/g,i)},u=a;a.htmlEncode=a,a.htmlDecode=s,t?ti=u:(e.htmlEncode=a,e.htmlDecode=s,r&&define((function(){return u})))}();var hi,vi="__lodash_hash_undefined__",yi="[object Function]",mi="[object GeneratorFunction]",gi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bi=/^\w*$/,wi=/^\./,ki=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Si=/\\(\\)?/g,Ei=/^\[object .+?Constructor\]$/,xi=/^(?:0|[1-9]\d*)$/,_i="object"==typeof n&&n&&n.Object===Object&&n,Ci="object"==typeof self&&self&&self.Object===Object&&self,Ti=_i||Ci||Function("return this")();var Oi,Ri=Array.prototype,Li=Function.prototype,ji=Object.prototype,Pi=Ti["__core-js_shared__"],Bi=(Oi=/[^.]+$/.exec(Pi&&Pi.keys&&Pi.keys.IE_PROTO||""))?"Symbol(src)_1."+Oi:"",Ai=Li.toString,Ii=ji.hasOwnProperty,Mi=ji.toString,qi=RegExp("^"+Ai.call(Ii).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ui=Ti.Symbol,Di=Ri.splice,Ni=Zi(Ti,"Map"),Fi=Zi(Object,"create"),zi=Ui?Ui.prototype:void 0,Gi=zi?zi.toString:void 0;function Hi(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function $i(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vi(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wi(e,t,n){var r=e[t];Ii.call(e,t)&&ra(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ji(e,t){for(var n=e.length;n--;)if(ra(e[n][0],t))return n;return-1}function Ki(e){if(!ia(e)||(t=e,Bi&&Bi in t))return!1;var t,n=function(e){var t=ia(e)?Mi.call(e):"";return t==yi||t==mi}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?qi:Ei;return n.test(function(e){if(null!=e){try{return Ai.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function Xi(e,t,n,o){if(!ia(e))return e;t=function(e,t){if(oa(e))return!1;var n=void 0===e?"undefined":r(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!aa(e))||(bi.test(e)||!gi.test(e)||null!=t&&e in Object(t))}(t,e)?[t]:function(e){return oa(e)?e:ea(e)}(t);for(var i=-1,a=t.length,s=a-1,u=e;null!=u&&++i<a;){var c=ta(t[i]),l=n;if(i!=s){var f=u[c];void 0===(l=o?o(f,c,u):void 0)&&(l=ia(f)?f:Qi(t[i+1])?[]:{})}Wi(u,c,l),u=u[c]}return e}function Yi(e,t){var n,o,i=e.__data__;return("string"==(o=void 0===(n=t)?"undefined":r(n))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Zi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ki(n)?n:void 0}function Qi(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||xi.test(e))&&e>-1&&e%1==0&&e<t}Hi.prototype.clear=function(){this.__data__=Fi?Fi(null):{}},Hi.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Hi.prototype.get=function(e){var t=this.__data__;if(Fi){var n=t[e];return n===vi?void 0:n}return Ii.call(t,e)?t[e]:void 0},Hi.prototype.has=function(e){var t=this.__data__;return Fi?void 0!==t[e]:Ii.call(t,e)},Hi.prototype.set=function(e,t){return this.__data__[e]=Fi&&void 0===t?vi:t,this},$i.prototype.clear=function(){this.__data__=[]},$i.prototype.delete=function(e){var t=this.__data__,n=Ji(t,e);return!(n<0)&&(n==t.length-1?t.pop():Di.call(t,n,1),!0)},$i.prototype.get=function(e){var t=this.__data__,n=Ji(t,e);return n<0?void 0:t[n][1]},$i.prototype.has=function(e){return Ji(this.__data__,e)>-1},$i.prototype.set=function(e,t){var n=this.__data__,r=Ji(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Vi.prototype.clear=function(){this.__data__={hash:new Hi,map:new(Ni||$i),string:new Hi}},Vi.prototype.delete=function(e){return Yi(this,e).delete(e)},Vi.prototype.get=function(e){return Yi(this,e).get(e)},Vi.prototype.has=function(e){return Yi(this,e).has(e)},Vi.prototype.set=function(e,t){return Yi(this,e).set(e,t),this};var ea=na((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(aa(e))return Gi?Gi.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return wi.test(e)&&n.push(""),e.replace(ki,(function(e,t,r,o){n.push(r?o.replace(Si,"$1"):t||e)})),n}));function ta(e){if("string"==typeof e||aa(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function na(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(na.Cache||Vi),n}function ra(e,t){return e===t||e!=e&&t!=t}na.Cache=Vi;var oa=Array.isArray;function ia(e){var t=void 0===e?"undefined":r(e);return!!e&&("object"==t||"function"==t)}function aa(e){return"symbol"==(void 0===e?"undefined":r(e))||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Mi.call(e)}hi=function(e,t,n){return null==e?e:Xi(e,t,n)};var sa="No element argument has been defined. Use @basis-theory/basis-theory-js instead if no elements are needed.",ua="Could not find basis-theory element for request.",ca=function(e,t){return"Only strings, booleans, and numbers are allowed as values. Found ".concat(e," had value: ").concat(t)},la=function(e){for(var t=null===document||void 0===document?void 0:document.querySelector('[id="'.concat(e,'"]')),n=0;n<window.length;n++)if(window[n]===(null==t?void 0:t.contentWindow))return n;throw Wn.logger.error("".concat(ua," for elementId=").concat(e)),new Error(ua)},fa=function(e){return"string"==typeof e||"boolean"==typeof e||"number"==typeof e||null==e},da=function(e,t,n){return n?Array.isArray(e)?"".concat(n,"[").concat(t,"]"):"".concat(n,".").concat(t):t},pa=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return Object.entries(e).forEach((function(o){var i=nr(o,2),a=i[0],u=i[1],c=da(e,a,r);if(u instanceof Io)n.elements=Object.assign(n.elements||{},s({},c,{index:la(u.id)})),n.masterElement=u;else if(u instanceof Uo&&u.element instanceof Io&&("string"==typeof u.method||void 0===u.method)){var l=u.element,f=u.method;n.elements=Object.assign(n.elements||{},s({},c,{index:la(l.id),method:f})),n.masterElement=l}else if(fa(u))n.payload=t(hi)(n.payload||{},c,u);else{if("object"!=typeof u)throw Wn.logger.error(ca(c,u)),new TypeError(ca(c,u));pa(u,n,c)}})),n},ha=function(e){var t=pa(e),n=t.elements,r=t.masterElement,o=t.payload;if(!r||!n)throw Wn.logger.error("".concat(sa," on getMessageInputs")),new Error(sa);return{elements:n,payload:o,masterElement:r}},va=function(e){if("object"!=typeof e||!e)return{};var t={};return Object.entries(e).forEach((function(e){var n=nr(e,2),r=n[0],o=n[1];if("string"==typeof r&&"object"==typeof o&&o){var i=o.index,a=o.method;"number"!=typeof i||void 0!==a&&"string"!=typeof a||(t[r]=ir({index:i},a?{method:a}:{}))}})),t},ya=function(e){if("object"==typeof e&&e){var t=Array.isArray(e)?[]:{};return Object.entries(e).forEach((function(e){var n=nr(e,2),r=n[0],o=n[1];if(fa(o))t[r]="string"==typeof o?(0,ti.htmlEncode)(o):o;else if("object"==typeof o){var i=ya(o);i&&Object.keys(i).length>0&&(t[r]=i)}})),t}},ma=function(e,t,n,o){var i=n[o];if(!t&&void 0===i)return i;if((void 0===i?"undefined":r(i))!==e)throw Wn.logger.error('"'.concat(String(o),'" should be a ').concat(e,".")),new TypeError('"'.concat(String(o),'" should be a ').concat(e,"."));return i},ga=function(e){if(null==e)return e;if(e instanceof RegExp)return[e,""];if(Array.isArray(e)&&1===e.length&&e[0]instanceof RegExp)return[e[0],""];if(Array.isArray(e)&&2===e.length&&e[0]instanceof RegExp&&"string"==typeof e[1])return e;throw Wn.logger.error("Transform should be null, a RegExp object, an array with a RegExp object, or an array with a RegExp object in the first index and a string in the second."),new TypeError("Transform should be null, a RegExp object, an array with a RegExp object, or an array with a RegExp object in the first index and a string in the second.")},ba=function(e){if(void 0!==e){if(!Array.isArray(e))throw Wn.logger.error("Mask is not an array"),new TypeError("Mask is not an array");var t=e.filter((function(e){return!(e instanceof RegExp||"string"==typeof e&&1===e.length)}));if(t.length)throw Wn.logger.error("Mask has the following invalid chars: ".concat(t.join(", "))),new TypeError("Mask has the following invalid chars: ".concat(t.join(", ")));return e}},wa=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ma("boolean",!1,e,"disabled"),ma("string",!1,e,"autoComplete"),{style:e.style,disabled:e.disabled,autoComplete:e.autoComplete}},ka=function(e,t){return Yo(ir({},wa(t)),{value:t.value?{number:ma("string",!1,t.value,"number"),expiration_month:ma("number",!1,t.value,"expiration_month"),expiration_year:ma("number",!1,t.value,"expiration_year"),cvc:ma("string",!1,t.value,"cvc")}:void 0})},Sa=function(e,t){return Yo(ir({},wa(t),"create"===e?{targetId:ma("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:ma("string",!1,t,"placeholder"),password:ma("boolean",!1,t,"password"),mask:"create"===e?ba(t.mask):void 0,transform:ga(t.transform),ariaLabel:ma("string",!1,t,"aria-label"),autoComplete:ma("string",!1,t,"autoComplete"),value:ma("string",!1,t,"value")})},Ea=function(e,t){return Yo(ir({},wa(t),"create"===e?{targetId:ma("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:ma("string",!1,t,"placeholder"),ariaLabel:ma("string",!1,t,"aria-label"),autoComplete:ma("string",!1,t,"autoComplete"),value:t.value&&"object"==typeof t.value?{month:ma("number",!1,t.value,"month"),year:ma("number",!1,t.value,"year")}:ma("string",!1,t,"value")})},xa=function(e,t){return Yo(ir({},wa(t),"create"===e?{targetId:ma("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:ma("string",!1,t,"placeholder"),ariaLabel:ma("string",!1,t,"aria-label"),iconPosition:ma("string",!1,t,"iconPosition"),autoComplete:ma("string",!1,t,"autoComplete"),value:ma("string",!1,t,"value")})},_a=function(e,t){return Yo(ir({},wa(t),"create"===e?{targetId:ma("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:ma("string",!1,t,"placeholder"),ariaLabel:ma("string",!1,t,"aria-label"),cardBrand:ma("string",!1,t,"cardBrand"),autoComplete:ma("string",!1,t,"autoComplete"),value:ma("string",!1,t,"value")})},Ca="Could not find basis-theory DataElement for request.",Ta=function(){"use strict";function e(){o(this,e)}return a(e,[{key:"get",value:function(e){return this.sendProxyRequest("get",e)}},{key:"post",value:function(e){return this.sendProxyRequest("post",e)}},{key:"patch",value:function(e){return this.sendProxyRequest("patch",e)}},{key:"put",value:function(e){return this.sendProxyRequest("put",e)}},{key:"delete",value:function(e){return this.sendProxyRequest("delete",e)}},{key:"sendProxyRequest",value:function(e,t){var n=window.DataElement;if(!n)throw Wn.logger.error("".concat(Ca," when sending proxy request.")),new Error(Ca);return n._proxyRequest(e,t)}}]),e}(),Oa=function(){"use strict";function e(){o(this,e)}return a(e,[{key:"tokenize",value:function(e,t){var n=ha(e),r=n.elements,o=n.payload;return n.masterElement._submit({method:"tokenize",payload:o,options:t,elements:r})}}]),e}(),Ra="Could not find basis-theory DataElement for request.",La=function(){"use strict";function e(){o(this,e)}return a(e,[{key:"create",value:function(e,t){var n=ha(e),r=n.elements,o=n.payload;return n.masterElement._submit({service:"tokens",method:"create",payload:o,elements:r,options:t})}},{key:"update",value:function(e,t,n){if("string"!=typeof e)throw Wn.logger.error("The token 'id' must be a string on token update."),new TypeError("The token 'id' must be a string.");var r=ha(t),o=r.elements,i=r.payload;return r.masterElement._submit({service:"tokens",method:"update",payload:i,id:e,options:n,elements:o})}},{key:"retrieve",value:function(e,t){if("string"!=typeof e)throw Wn.logger.error("The token 'id' must be a string on token update."),new TypeError("The token 'id' must be a string.");var n=window.DataElement;if(!n)throw Wn.logger.error("".concat(Ra," on token retrieve.")),new Error(Ra);return n._tokenRequest({service:"tokens",method:"retrieve",id:e,options:t})}}]),e}(),ja=function(){"use strict";function e(){o(this,e),s(this,"hasElement",Ko)}return a(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this._apiKey=e;try{var n=new URL(t);n.protocol="localhost"===n.hostname?"http":"https",this._baseUrl=n.toString().replace(RegExp("\\/$","u"),"")}catch(e){this._baseUrl=Kn}return window.DataElement=new $o({type:"data",apiKey:this._apiKey,baseUrl:this.baseUrl}),Promise.resolve(this)}},{key:"createElement",value:function(e,t){var n,r={type:e,apiKey:this._apiKey,baseUrl:this.baseUrl};switch(e){case"card":n=new Mo(r,t);break;case"text":n=new Vo(r,t);break;case"cardNumber":n=new qo(r,t);break;case"cardExpirationDate":n=new Do(r,t);break;case"cardVerificationCode":n=new No(r,t);break;default:throw Wn.logger.error("Element type ".concat(e," is not supported.")),new Error("Element type ".concat(e," is not supported."))}return n}},{key:"tokenize",value:function(e,t){return(new Oa).tokenize(e,t)}},{key:"tokens",get:function(){return new La}},{key:"proxy",get:function(){return new Ta}},{key:"baseUrl",get:function(){return Wo(this._baseUrl)}}]),e}(),Pa=new ja;window.BasisTheory&&(window.BasisTheory.elements=Pa),window.BasisTheoryElements=Pa,window.DD_LOGS&&Xn&&(window.DD_LOGS.init({clientToken:Xn,forwardErrorsToLogs:!1,sessionSampleRate:100}),window.DD_LOGS.setGlobalContext({application:"BasisTheory Elements Client",env:Kn?Kn.includes("dev")?"dev":"prod":"local",referrer:document.referrer}))}();