-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew.js
More file actions
9 lines (9 loc) · 218 KB
/
new.js
File metadata and controls
9 lines (9 loc) · 218 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){qe.error(t,e)}}},t=function(e){He=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];return(Fe?o(r):r).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(Be.error,e),Fe)try{Fe(e)}catch(e){a(Be.error,e)}}},a=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];He&&qe.apply(void 0,Ne([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)},v=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},h=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)},E=function(e){return Ke(void 0,e)},S=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=Ke(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 E(e)},setContext:function(t){e=E(t)},setContextProperty:function(t,n){e[t]=E(n)},removeContextProperty:function(t){delete e[t]},clearContext:function(){e={}}}},C=function(){return(new Date).getTime()},T=function(){return C()},O=function(){return performance.now()},_=function(){return{relative:O(),timeStamp:T()}},R=function(){return void 0===$e&&($e=performance.timing.navigationStart),$e},P=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}))}}},L=function(e){var t;void 0===e&&(e=null===(t=b().location)||void 0===t?void 0:t.hostname);var n=P();return!!n&&n.getAllowedWebViewHosts().some((function(t){var n,r;return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r)}))},I=function(e){var t=u({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t},j=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)},D=function(e,t){j(e,"",0,t)},M=function(e){return U(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},U=function(e,t){if(function(){if(void 0!==Xe)return Xe;try{var e=new URL("http://test/path");return Xe="http://test/path"===e.href}catch(e){Xe=!1}return Xe}())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},B=function(e,t,n){var r=e.clientToken,o=function(e,t){var n=e.site,r=void 0===n?Qe:n,o=e.internalAnalyticsSubdomain;if(o&&r===Qe)return"".concat(o,".").concat(Qe);var i=r.split("."),a=i.pop();return"".concat(et[t],".browser-intake-").concat(i.join("-"),".").concat(a)}(e,t),i="https://".concat(o,"/api/v2/").concat(tt[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(Ge())];"rum"===t&&c.push("batch_time=".concat(T())),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}},q=function(e,t){var n=200-e.length-1;(t.length>n||nt.test(t))&&qe.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var r=t.replace(/,/g,"_");return"".concat(e,":").concat(r)},F=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||h(i))if(void 0===t.telemetrySampleRate||h(t.telemetrySampleRate)){var a;if(void 0===t.telemetryConfigurationSampleRate||h(t.telemetryConfigurationSampleRate))return a=t.enableExperimentalFeatures,Array.isArray(a)&&(Je||(Je=new Set(a)),a.filter((function(e){return"string"==typeof e})).forEach((function(e){p(e,"-")&&qe.warn("please use snake case for '".concat(e,"'")),Je.add(e)}))),u({beforeSend:t.beforeSend&&e(t.beforeSend,"beforeSend threw an error:"),cookieOptions:N(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(q("env",t)),n&&i.push(q("service",n)),r&&i.push(q("version",r)),o&&i.push(q("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:B(e,"logs",t),rumEndpointBuilder:B(e,"rum",t),sessionReplayEndpointBuilder:B(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:Qe,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:B(r,"logs",n),rumEndpointBuilder:B(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||Qe},n)}(t));qe.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else qe.error("Telemetry Sample Rate should be a number between 0 and 100");else qe.error("Session Sample Rate should be a number between 0 and 100")}else qe.error("Client Token is not configured, we will not send any data.")},N=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===We){for(var e="dd_site_test_".concat(Ge()),t=window.location.hostname.split("."),n=t.pop();t.length&&!A(e);)n="".concat(t.pop(),".").concat(n),j(e,"test",ze,{domain:n});D(e,{domain:n}),We=n}return We}()),t},H=function(e){var t=[],n=z(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=at.exec(e);if(t){var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=st.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]||rt,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}}(e)||function(e){var t=ut.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:rt,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=ct.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||rt,line:+t[3],url:t[2]}}(e)||function(e){var t=lt.exec(e);if(t){var n=t[3]&&t[3].indexOf(" > eval")>-1,r=ft.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]||rt,line:t[4]?+t[4]:void 0,url:t[3]}}}(e);n&&(!n.func&&n.line&&(n.func=rt),t.push(n))})),{message:z(e,"message"),name:z(e,"name"),stack:t}},z=function(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}},V=function(e){var t=G(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},G=function(e){return"".concat(e.name||"Error",": ").concat(e.message)},K=function(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=H(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&V(o)}),n=n.cause}return r.length?r:void 0},$=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new gt((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},W=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},J=function(e,t,n,r){return X(e,[t],n,r)},X=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=W(e,"addEventListener");function d(){var n=W(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}},Y=function(e){var t,n=[];p(e,bt.cspViolation)&&n.push(t=new gt((function(){var e=o((function(e){t.notify(function(e){var t=bt.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:bt.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:Z(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(w(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))}));return J(document,"securitypolicyviolation",e).stop})));var r=e.filter((function(e){return e!==bt.cspViolation}));return r.length&&n.push(function(e){var t=new gt((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:Z(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)),$.apply(void 0,n)},Z=function(e,t,n,r,o){return n&&V({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})},Q=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)})),v(o)):void qe.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'))},ee=function(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})},te=function(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||A("datadog-synthetics-injects-rum"))},ne=function(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||A("datadog-synthetics-result-id");return"string"==typeof e?e:void 0},re=function(e,t){var n,r=new gt;return Ot.telemetryEnabled=c(t.telemetrySampleRate),Ot.telemetryConfigurationEnabled=Ot.telemetryEnabled&&c(t.telemetryConfigurationSampleRate),Ye=function(o){if(!p(Tt,t.site)&&Ot.telemetryEnabled){var i=function(e,t){return S({type:"telemetry",date:T(),service:e,version:"4.30.1",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:v(Je||new Set)},void 0!==n?n():{})}(e,o);r.notify(i),ee("telemetry",i)}},Fe=oe,u(Ot,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r}},oe=function(e){ie(u({type:xt,status:"error"},function(e){if(e instanceof Error){var t=H(e);return{error:{kind:t.name,stack:V(ae(t))},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught ".concat(f(e))}}(e)))},ie=function(e){Ye&&Ot.sentEventCount<Ot.maxEventsPerPage&&(Ot.sentEventCount+=1,Ye(e))},ae=function(e){return e.stack=e.stack.filter((function(e){return!e.url||Ct.some((function(t){return g(e.url,t)}))})),e},se=function(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?ue(e,t,n,{onSuccess:function(){return ce(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),Lt(t,n,r,o)}}):t.queuedPayloads.enqueue(e)},ue=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())}))},ce=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:dt,startClocks:_()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=le();i.size()>0;)se(i.dequeue(),t,n,r,o)},le=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>=Pt}}},fe=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)},de=function(e,t,n,r,i){var a,s=u(t);function u(t){return new Rt(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:le(),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(){fe(e.build("xhr",s),i,r)})))}else fe(e.build("xhr",s),i,r)}(e,t,n,r)};return{send:function(t){se(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){Nt||(Nt=!0,oe(e))}(e)}fe(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)}}},pe=function(e,t){var n;if(void 0===t&&(t=0),It||(It=e),e===It)if(t>=100)ye();else{var r,o=be();if(ve()){if(o.lock)return void he(e,t);if(r=Ge(),o.lock=r,ge(o,e.options),(o=be()).lock!==r)return void he(e,t)}var i=e.process(o);if(ve()&&(o=be()).lock!==r)he(e,t);else{if(i&&me(i,e.options),ve()&&(!i||!we(i))){if((o=be()).lock!==r)return void he(e,t);delete o.lock,ge(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),ye()}}else Jt.push(e)},ve=function(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)},he=function(e,t){setTimeout(o((function(){pe(e,t+1)})),10)},ye=function(){It=void 0;var e=Jt.shift();e&&pe(e)},me=function(e,t){we(e)?function(e){j(Wt,"",0,e)}(t):(e.expire=String(C()+Gt),ge(e,t))},ge=function(e,t){j(Wt,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($t)}(e),Gt,t)},be=function(){var e=A(Wt),t={};return function(e){return void 0!==e&&(-1!==e.indexOf($t)||Kt.test(e))}(e)&&e.split($t).forEach((function(e){var n=Kt.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t},we=function(e){return m(e)},ke=function(e,t,n){!function(e){var t=A(Wt),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),me(i,e)}}(e);var r=function(e,t,n){var r=new gt,i=new gt,a=setInterval(o((function(){pe({options:e,process:function(e){return f(e)?void 0:{}},after:c})})),1e3),u=function(){var e=be();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||C()-Number(e.created)<Vt)&&(void 0===e.expire||C()<Number(e.expire))}return{expandOrRenewSession:s(o((function(){var o;pe({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=Ge(),e.created=String(C())),i}(r),r},after:function(e){o&&!l()&&function(e){u=e,r.notify()}(e),u=e}})})),1e3).throttled,expandSession:function(){pe({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);Xt.push((function(){return r.stop()}));var i,a=new zt(144e5);function u(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return Xt.push((function(){return a.stop()})),r.renewObservable.subscribe((function(){a.add(u(),O())})),r.expireObservable.subscribe((function(){a.closeActive(O())})),r.expandOrRenewSession(),a.add(u(),(R(),0)),i=X(window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,Xt.push(i),function(e){var t=o((function(){"visible"===document.visibilityState&&e()})),n=J(document,"visibilitychange",t).stop;Xt.push(n);var r=setInterval(t,6e4);Xt.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"},Se=function(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return Yt[e]>=Yt[n.getLevel()]&&p(o,t)},xe=function(e){var t,n=window;if(te()){var r=o(n.DD_RUM_SYNTHETICS);return r||Zt||(Zt=!0,function(e,t){a(Be.debug,e,t),ie(u({type:xt,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:ne()})),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 Qt[e]||(Qt[e]=function(e){var t=new gt((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=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return i((function(){var n=H(t);n.stack=n.stack.slice(2),e=V(n)})),e}();i((function(){t.notify(Te(r,e,a))}))},function(){console[e]=n}}));return t}(e)),Qt[e]}));return $.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?G(H(e)):f(e,void 0,2)}(e)})).join(" ");if(t===Be.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?V(H(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}}},_e=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}}))},Re=function(e,t){nn.set(this,{state:"open",method:e,url:M(String(t))})},Pe=function(e){var t=this,n=nn.get(this);if(n){var r=n;r.state="start",r.startTime=O(),r.startClocks=_(),r.isAborted=!1,r.xhr=this;var i=!1,a=_e(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,T()-o),c.status=t.status,e.notify(u({},c))}}));this.addEventListener("loadend",s),e.notify(r)}},Le=function(){var e=nn.get(this);e&&(e.isAborted=!0)},Ie=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:_(),url:o};return e.notify(i),i},je=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))},Ae=function(e,t){if(!e.forwardErrorsToLogs)return{stop:l};var n=function(){var e;return Mt||(e=new gt((function(){var t=_e(XMLHttpRequest.prototype,"open",{before:Re}).stop,n=_e(XMLHttpRequest.prototype,"send",{before:function(){Pe.call(this,e)}}).stop,r=_e(XMLHttpRequest.prototype,"abort",{before:Le}).stop;return function(){t(),n(),r()}})),Mt=e),Mt}().subscribe((function(e){"complete"===e.state&&a("xhr",e)})),r=function(){var e;return Ut||(e=new gt((function(){if(window.fetch)return Oe(window,"fetch",(function(t){return function(n,r){var o,a=i(Ie,null,[e,n,r]);return a?(o=t.call(this,a.input,a.init),i(je,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(Me(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:ht,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:wt.error,origin:ht}})}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(De(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(De(e,t))})),o((function(e){return n("Unable to retrieve response: ".concat(e))})))}(r.response,e,i):r.error&&function(e,t,n){n(De(V(H(e)),t))}(r.error,e,i))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}},De=function(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e},Me=function(e){return"xhr"===e?"XHR":"Fetch"},Ue=function(e){return function(e){var t=function(e){return _e(window,"onerror",{before:function(t,n,r,o,i){var a;if(i)a=H(i),e(a,i);else{var s,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var l=rn.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 _e(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=H(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:V(t),handlingStack:r,type:t.name,causes:K(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:_(),nonErrorPrefix:"Uncaught",source:yt,handling:"unhandled"}))}))},Be={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},qe=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Object.prototype.hasOwnProperty.call(Be,e)||(e=Be.log),qe[e].apply(qe,t)};qe.debug=console.debug.bind(console),qe.log=console.log.bind(console),qe.info=console.info.bind(console),qe.warn=console.warn.bind(console),qe.error=console.error.bind(console);var Fe,Ne=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))},He=!1,ze=1e3,Ve=6e4;function Ge(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,Ge)}function Ke(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]=Ke(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]=Ke(a[s],t[s],n));return a}}var $e,We,Je,Xe,Ye,Ze=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}(),Qe="datadoghq.com",et={logs:"logs",rum:"rum",sessionReplay:"session-replay"},tt={logs:"logs",rum:"rum",sessionReplay:"replay"},nt=/[^a-z0-9_:./-]/,rt="?",ot="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",it="(?::(\\d+))",at=new RegExp("^\\s*at (.*?) ?\\(".concat(ot).concat(it,"?").concat(it,"?\\)?\\s*$"),"i"),st=new RegExp("\\((\\S*)".concat(it).concat(it,"\\)")),ut=new RegExp("^\\s*at ?".concat(ot).concat(it,"?").concat(it,"??\\s*$"),"i"),ct=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,lt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,ft=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,dt="agent",pt="console",vt="logger",ht="network",yt="source",mt="report",gt=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}(),bt={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"},wt={debug:"debug",error:"error",info:"info",warn:"warn"},kt="http",Et=Object.keys(wt),St=function(){var e=function(e,t,n,r,o){void 0===n&&(n=kt),void 0===r&&(r=wt.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=wt.info),this.handleLogStrategy({message:e,context:E(t),status:n},this)},e.prototype.debug=function(e,t){this.log(e,t,wt.debug)},e.prototype.info=function(e,t){this.log(e,t,wt.info)},e.prototype.warn=function(e,t){this.log(e,t,wt.warn)},e.prototype.error=function(e,t){var n={error:{origin:vt}};this.log(e,S(n,t),wt.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}(),xt="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},_t=/[^\u0000-\u007F]/,Rt=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 _t.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?qe.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}(),Pt=3145728;function Lt(e,t,n,r){2===e.transportStatus&&setTimeout(o((function(){ue(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=1e3,ce(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(6e4,2*e.currentBackoffTime),Lt(e,t,n,r)}})})),e.currentBackoffTime)}var It,jt,At,Dt,Mt,Ut,Bt,qt,Ft,Nt=!1,Ht=1/0,zt=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:Ht,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=Ht);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===Ht&&t.close(e)},e.prototype.findAll=function(e){return void 0===e&&(e=Ht),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=O()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}(),Vt=144e5,Gt=9e5,Kt=/^([a-z]+)=([a-z0-9-]+)$/,$t="&",Wt="_dd_s",Jt=[],Xt=[],Yt=((jt={})[wt.debug]=0,jt[wt.info]=1,jt[wt.warn]=2,jt[wt.error]=3,jt),Zt=!1,Qt={},en=((At={})[Be.log]=wt.info,At[Be.debug]=wt.debug,At[Be.info]=wt.info,At[Be.warn]=wt.warn,At[Be.error]=wt.error,At),tn=((Dt={})[bt.cspViolation]=wt.error,Dt[bt.intervention]=wt.error,Dt[bt.deprecation]=wt.warn,Dt),nn=new WeakMap,rn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/,on=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}(),an=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 Ze,v=function(e,t,n,r){void 0===n&&(n=E(i())),void 0===r&&(r=T()),d.add((function(){return v(e,t,n,r)}))},h=function(){},m=new St((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.apply(void 0,e)}));return n={logger:m,init:o((function(t){var n;if(h=function(){return E(t)},L()&&(t=function(e){return u({},e,{clientToken:"empty"})}(t)),function(e){return!a||(e.silentMultipleInit||qe.error("DD_LOGS is already initialized."),!1)}(t)){var r=function(e){var t=F(e),n=Q(e.forwardConsoleLogs,y(Be),"Forward Console Logs"),r=Q(e.forwardReports,y(bt),"Forward Reports");if(t&&n&&r)return e.forwardErrorsToLogs&&!p(n,Be.error)&&n.push(Be.error),u({forwardErrorsToLogs:!1!==e.forwardErrorsToLogs,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:32768},t)}(t);r&&(n=e(t,r,i,m),v=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 St((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.apply(void 0,e)}),e,t.handler,t.level,t.context),l[e]})),getLogger:o((function(e){return l[e]})),getInitConfiguration:o((function(){return h()})),getInternalContext:o((function(e){return f(e)})),setUser:o((function(e){(function(e){var t="object"===k(e);return t||qe.error("Unsupported user:",e),t})(e)&&c.setContext(I(e))})),getUser:o(c.getContext),setUserProperty:o((function(e,t){var n,r=I((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 on;o.subscribe(1,(function(e){return ee("logs",e)}));var i,a=function(e){return o.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:dt},origin:dt,status:wt.error}})},s=i=new gt((function(){var e=J(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&i.notify({reason:"visibility_hidden"})}),{capture:!0}).stop,t=J(window,"beforeunload",(function(){i.notify({reason:"before_unload"})})).stop;return function(){e(),t()}})),c=function(e,t,n){var r,o=re("browser-logs-sdk",e);if(L()){var i=P();o.observable.subscribe((function(e){return i.send("internal_telemetry",e)}))}else{var a=de(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=xe())||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=xe())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=xe())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),Ae(t,o),function(e,t){if(!e.forwardErrorsToLogs)return{stop:l};var n=new gt;Ue(n).stop,n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:yt,stack:e.stack},origin:yt,status:wt.error}})}))}(t,o),function(e,t){Ce(e.forwardConsoleLogs).subscribe((function(e){t.notify(0,{rawLogsEvent:{date:T(),message:e.message,origin:pt,error:e.api===Be.error?{origin:pt,stack:e.stack}:void 0,status:en[e.api]}})}))}(t,o),function(e,t){Y(e.forwardReports).subscribe((function(e){var n,r=e.message,o=tn[e.type];o===wt.error?n={kind:e.subtype,origin:mt,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:T(),message:r,origin:mt,error:n,status:o}})}))}(t,o);var f,d=function(e){return{handleLog:function(t,n,r,o){var i=t.context;Se(t.status,"console",n)&&qe(t.status,t.message,S(n.getContext(),i)),e.notify(0,{rawLogsEvent:{date:o||T(),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(Ge()),n="test";j(t,n,Ve,e);var r=A(t)===n;return D(t,e),r}catch(e){return qe.error(e),!1}}(t.cookieOptions)||L()||te()?function(e){var t="1"===Ee(e)?{}:void 0;return{findTrackedSession:function(){return t}}}(t):function(e){var t=ke(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}),Ve),(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:dt,startClocks:_()})}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,v=void 0===p?void 0:p,h=i.logger,y=void 0===h?o:h,g=l.date-R(),b=e.findTrackedSession(g);if(b){var w=v||r(),k=S({service:t.service,session_id:b.id,usr:m(w.user)?void 0:w.user,view:w.view},w.context,xe(g),l,y.getContext(),d);!Se(l.status,kt,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)!==dt&&(null!==(c=s[k.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,k)}}))}(p,t,o,n,r,a),L()?function(e){var t=P();e.subscribe(1,(function(e){t.send("log",e)}))}(o):function(e,t,n,r){var o,i=de(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&&ie({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}}));qt=an,Ft=(Bt=b())["DD_LOGS"],Bt.DD_LOGS=qt,Ft&&Ft.q&&Ft.q.forEach((function(t){return e(t,"onReady callback threw an error:")()}))}();var u={card:"card-element",cardNumber:"card-number-element",cardExpirationDate:"card-expiration-date-element",cardVerificationCode:"card-verification-code-element",data:"data-element",text:"text-element"},c="https://js.basistheory.com/hosted-elements",l="pub5f53501515584007899577554c4aeda6",f="a1b0afb46284d56d7b06341a1b06a0010757894c",d="Could not find basis-theory DataElement for request.";function p(e){if(Array.isArray(e))return e}function v(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function h(){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 y(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 m(e,t){if(e){if("string"==typeof e)return y(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)?y(e,t):void 0}}function g(e,t){return p(e)||v(e)||m(e,t)||h()}function b(){return function(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 a.shift()+(a.length>0?"?":"")+a.join("&")}("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}function w(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 k={};function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e,t){return S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},S(e,t)}function x(e,t){return S(e,t)}function C(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&&x(e,t)}function T(){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 O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function _(e){return O(e)}function R(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?E(e):t}function P(e){var t=T();return function(){var n,r=_(e);if(t){var o=_(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return R(this,n)}}Object.defineProperty(k,"__esModule",{value:!0}),k.BasisTheoryApiError=void 0;var L,I,j=function(e){C(n,e);var t=P(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(E(a),n.prototype),a}return n}((L=Error,I=function(){var e=Reflect.construct(L,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e},I.prototype=Object.create(L.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(I,L):I.__proto__=L,I));k.BasisTheoryApiError=j;var A={};Object.defineProperty(A,"__esModule",{value:!0}),A.BasisTheoryValidationError=void 0;var D=function(e){C(n,e);var t=P(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(E(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));A.BasisTheoryValidationError=D;var M=function(e,t){return M=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])},M(e,t)};function U(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");M(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var B=function(){return B=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},B.apply(this,arguments)};Object.create;function q(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 F(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 N(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 H(e){return e.toLowerCase()}var z=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],V=/[^A-Z0-9]+/gi;function G(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?z:n,o=t.stripRegexp,i=void 0===o?V:o,a=t.transform,s=void 0===a?H:a,u=t.delimiter,c=void 0===u?" ":u,l=K(K(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 K(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function $(e,t){return void 0===t&&(t={}),G(e,B({delimiter:"."},t))}function W(e,t){return void 0===t&&(t={}),$(e,B({delimiter:"-"},t))}function J(e){return"function"==typeof e}function X(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 Y=X((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 Z(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Q,ee,te=((ee=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=q(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(J(u))try{u()}catch(e){o=e instanceof Y?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=q(c),f=l.next();!f.done;f=l.next()){var d=f.value;try{oe(d)}catch(e){o=null!=o?o:[],e instanceof Y?o=N(N([],F(o)),F(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 Y(o)}},ee.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)oe(e);else{if(e instanceof ee){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(t=this._finalizers)&&void 0!==t?t:[]).push(e)}},ee.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},ee.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},ee.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Z(t,e)},ee.prototype.remove=function(e){var t=this._finalizers;t&&Z(t,e),e instanceof ee&&e._removeParent(this)},ee.EMPTY=((Q=new ee).closed=!0,Q),ee),ne=te.EMPTY;function re(e){return e instanceof te||e&&"closed"in e&&J(e.remove)&&J(e.add)&&J(e.unsubscribe)}function oe(e){J(e)?e():e.unsubscribe()}var ie={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ae={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=ae.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,N([e,t],F(n))):setTimeout.apply(void 0,N([e,t],F(n)))},clearTimeout:function(e){var t=ae.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function se(e){ae.setTimeout((function(){var t=ie.onUnhandledError;if(!t)throw e;t(e)}))}function ue(){}var ce=le("C",void 0,void 0);function le(e,t,n){return{kind:e,value:t,error:n}}var fe=null;function de(e){if(ie.useDeprecatedSynchronousErrorHandling){var t=!fe;if(t&&(fe={errorThrown:!1,error:null}),e(),t){var n=fe,r=n.errorThrown,o=n.error;if(fe=null,r)throw o}}else e()}var pe,ve,he=(U(ve=function(e){var t=pe.call(this)||this;return t.isStopped=!1,e?(t.destination=e,re(e)&&e.add(t)):t.destination=Se,t},pe=te),ve.create=function(e,t,n){return new we(e,t,n)},ve.prototype.next=function(e){this.isStopped?Ee(function(e){return le("N",e,void 0)}(e),this):this._next(e)},ve.prototype.error=function(e){this.isStopped?Ee(le("E",void 0,e),this):(this.isStopped=!0,this._error(e))},ve.prototype.complete=function(){this.isStopped?Ee(ce,this):(this.isStopped=!0,this._complete())},ve.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,pe.prototype.unsubscribe.call(this),this.destination=null)},ve.prototype._next=function(e){this.destination.next(e)},ve.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},ve.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},ve),ye=Function.prototype.bind;function me(e,t){return ye.call(e,t)}var ge,be=((ge=function(e){this.partialObserver=e}).prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ke(e)}},ge.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ke(e)}else ke(e)},ge.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ke(e)}},ge),we=function(e){var t=function(t,n,r){var o,i,a=e.call(this)||this;J(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:a&&ie.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},o={next:t.next&&me(t.next,i),error:t.error&&me(t.error,i),complete:t.complete&&me(t.complete,i)}):o=t;return a.destination=new be(o),a};return U(t,e),t}(he);function ke(e){var t;ie.useDeprecatedSynchronousErrorHandling?(t=e,ie.useDeprecatedSynchronousErrorHandling&&fe&&(fe.errorThrown=!0,fe.error=t)):se(e)}function Ee(e,t){var n=ie.onStoppedNotification;n&&ae.setTimeout((function(){return n(e,t)}))}var Se={closed:!0,next:ue,error:function(e){throw e},complete:ue},xe="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ce(e){return e}function Te(e){return 0===e.length?Ce:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Oe,_e=((Oe=function(e){e&&(this._subscribe=e)}).prototype.lift=function(e){var t=new Oe;return t.source=this,t.operator=e,t},Oe.prototype.subscribe=function(e,t,n){var r,o=this,i=(r=e)&&r instanceof he||function(e){return e&&J(e.next)&&J(e.error)&&J(e.complete)}(r)&&re(r)?e:new we(e,t,n);return de((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},Oe.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},Oe.prototype.forEach=function(e,t){var n=this;return new(t=Re(t))((function(t,r){var o=new we({next:function(t){try{e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t});n.subscribe(o)}))},Oe.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},Oe.prototype[xe]=function(){return this},Oe.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Te(e)(this)},Oe.prototype.toPromise=function(e){var t=this;return new(e=Re(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},Oe.create=function(e){return new Oe(e)},Oe);function Re(e){var t;return null!==(t=null!=e?e:ie.Promise)&&void 0!==t?t:Promise}var Pe,Le=X((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Ie=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 U(t,e),t.prototype.lift=function(e){var t=new je(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Le},t.prototype.next=function(e){var t=this;de((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=q(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;de((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;de((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?ne:(this.currentObservers=null,i.push(e),new te((function(){t.currentObservers=null,Z(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 _e;return e.source=this,e},t.create=function(e,t){return new je(e,t)},t}(_e),je=function(e){var t=function(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r};return U(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:ne},t}(Ie),Ae=new Uint8Array(16);function De(){if(!Pe&&!(Pe="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 Pe(Ae)}var Me=/^(?:[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 Ue=function(e){return"string"==typeof e&&Me.test(e)},Be=[],qe=0;qe<256;++qe)Be.push((qe+256).toString(16).substr(1));var Fe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Be[e[t+0]]+Be[e[t+1]]+Be[e[t+2]]+Be[e[t+3]]+"-"+Be[e[t+4]]+Be[e[t+5]]+"-"+Be[e[t+6]]+Be[e[t+7]]+"-"+Be[e[t+8]]+Be[e[t+9]]+"-"+Be[e[t+10]]+Be[e[t+11]]+Be[e[t+12]]+Be[e[t+13]]+Be[e[t+14]]+Be[e[t+15]]).toLowerCase();if(!Ue(n))throw TypeError("Stringified UUID is invalid");return n};var Ne=function(e,t,n){var r=(e=e||{}).random||(e.rng||De)();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 Fe(r)},He={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},ze=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Object.prototype.hasOwnProperty.call(He,e)||(e=He.log),ze[e].apply(ze,t)};ze.debug=console.debug.bind(console),ze.log=console.log.bind(console),ze.info=console.info.bind(console),ze.warn=console.warn.bind(console),ze.error=console.error.bind(console);var Ve={};e(Ve,"startMonitorErrorCollection",(function(){return We}),(function(e){return We=e})),e(Ve,"setDebugMode",(function(){return Je}),(function(e){return Je=e})),e(Ve,"monitored",(function(){return Xe}),(function(e){return Xe=e})),e(Ve,"monitor",(function(){return Ye}),(function(e){return Ye=e})),e(Ve,"callMonitored",(function(){return Ze}),(function(e){return Ze=e})),e(Ve,"displayIfDebugEnabled",(function(){return Qe}),(function(e){return Qe=e}));var Ge,Ke=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))},$e=!1;function We(e){Ge=e}function Je(e){$e=e}function Xe(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(Ge?Ye(r):r).apply(this,e)}}function Ye(e){return function(){return Ze(e,this,arguments)}}function Ze(e,t,n){try{return e.apply(t,n)}catch(e){if(Qe(He.error,e),Ge)try{Ge(e)}catch(e){Qe(He.error,e)}}}function Qe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];$e&&ze.apply(void 0,Ke([e,"[MONITOR]"],t,!1))}var et=1e3,tt=60*et,nt=60*tt,rt=1024,ot=1024*rt;function it(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 at(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 st(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,st)}function ut(e){return 0!==e&&100*Math.random()<=e}function ct(){}function lt(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=ft(Object.prototype),o=ft(Array.prototype),i=ft(Object.getPrototypeOf(e)),a=ft(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function ft(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):ct}function dt(e,t){return-1!==e.indexOf(t)}function pt(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 vt(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}function ht(e){return yt(e)&&e>=0&&e<=100}function yt(e){return"number"==typeof e}function mt(e){return Object.keys(e).map((function(t){return e[t]}))}function gt(e){return 0===Object.keys(e).length}function bt(e,t){return e.slice(0,t.length)===t}function wt(){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 kt(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}function Et(e,t){var n=new RegExp("(?:^|;)\\s*".concat(t,"\\s*=\\s*([^;]+)")).exec(e);return n?n[1]:void 0}function St(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 xt(e){return null===e?"null":Array.isArray(e)?"array":void 0===e?"undefined":r(e)}function Ct(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]=Ct(o[i],t[i],n);return o}var a="object"===xt(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=Ct(a[s],t[s],n));return a}}function Tt(e){return Ct(void 0,e)}function Ot(){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=Ct(e,i))}return e}var _t,Rt,Pt,Lt,It=et;function jt(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 At(e){return Et(document.cookie,e)}function Dt(e,t){jt(e,"",0,t)}function Mt(){if(void 0===_t){for(var e="dd_site_test_".concat(st()),t=window.location.hostname.split("."),n=t.pop();t.length&&!At(e);)n="".concat(t.pop(),".").concat(n),jt(e,"test",et,{domain:n});Dt(e,{domain:n}),_t=n}return _t}function Ut(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){ze.error(t,e)}}}function Bt(){return(new Date).getTime()}function qt(){return Bt()}function Ft(){return performance.now()}function Nt(){return{relative:Ft(),timeStamp:qt()}}function Ht(){return void 0===Pt&&(Pt=performance.timing.navigationStart),Pt}function zt(e){return Vt(e,kt(window.location)).href}function Vt(e,t){if(function(){if(void 0!==Lt)return Lt;try{var e=new URL("http://test/path");return Lt="http://test/path"===e.href}catch(e){Lt=!1}return Lt}())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 Gt="datad0g.com",Kt="datadoghq.com",$t={logs:"logs",rum:"rum",sessionReplay:"session-replay"},Wt={logs:"logs",rum:"rum",sessionReplay:"replay"};function Jt(e,t,n){var r=e.clientToken,o=function(e,t){var n=e.site,r=void 0===n?Kt:n,o=e.internalAnalyticsSubdomain;if(o&&r===Kt)return"".concat(o,".").concat(Kt);var i=r.split("."),a=i.pop();return"".concat($t[t],".browser-intake-").concat(i.join("-"),".").concat(a)}(e,t),i="https://".concat(o,"/api/v2/").concat(Wt[t]),a=e.proxyUrl&&zt(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(st())];"rum"===t&&c.push("batch_time=".concat(qt())),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}}var Xt=200;function Yt(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(Qt("env",t)),n&&i.push(Qt("service",n)),r&&i.push(Qt("version",r)),o&&i.push(Qt("datacenter",o)),i}var Zt=/[^a-z0-9_:./-]/;function Qt(e,t){var n=Xt-e.length-1;(t.length>n||Zt.test(t))&&ze.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var r=t.replace(/,/g,"_");return"".concat(e,":").concat(r)}function en(e){var t=Yt(e),n=function(e,t){return{logsEndpointBuilder:Jt(e,"logs",t),rumEndpointBuilder:Jt(e,"rum",t),sessionReplayEndpointBuilder:Jt(e,"sessionReplay",t)}}(e,t),r=mt(n).map((function(e){return e.buildIntakeUrl()})),o=function(e,t,n){if(!e.replica)return;var r=at({},e,{site:Kt,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:Jt(r,"logs",n),rumEndpointBuilder:Jt(r,"rum",n)};return t.push.apply(t,mt(o).map((function(e){return e.buildIntakeUrl()}))),at({applicationId:e.replica.applicationId},o)}(e,r,t);return at({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||Kt},n)}function tn(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||ht(o))if(void 0===e.telemetrySampleRate||ht(e.telemetrySampleRate)){var i;if(void 0===e.telemetryConfigurationSampleRate||ht(e.telemetryConfigurationSampleRate))return i=e.enableExperimentalFeatures,Array.isArray(i)&&(Rt||(Rt=new Set(i)),i.filter((function(e){return"string"==typeof e})).forEach((function(e){dt(e,"-")&&ze.warn("please use snake case for '".concat(e,"'")),Rt.add(e)}))),at({beforeSend:e.beforeSend&&Ut(e.beforeSend,"beforeSend threw an error:"),cookieOptions:nn(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:16*rt,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*et,batchMessagesLimit:50,messageBytesLimit:256*rt},en(e));ze.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else ze.error("Telemetry Sample Rate should be a number between 0 and 100");else ze.error("Session Sample Rate should be a number between 0 and 100")}else ze.error("Client Token is not configured, we will not send any data.")}function nn(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=Mt()),t}var rn="?";function on(e){var t=[],n=vn(e,"stack"),r=String(e);return n&&bt(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=un.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=cn.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]||rn,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=ln.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:rn,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=fn.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||rn,line:+t[3],url:t[2]}}(e)||function(e){var t=dn.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=pn.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]||rn,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=rn),t.push(n))})),{message:vn(e,"message"),name:vn(e,"name"),stack:t}}var an="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",sn="(?::(\\d+))",un=new RegExp("^\\s*at (.*?) ?\\(".concat(an).concat(sn,"?").concat(sn,"?\\)?\\s*$"),"i"),cn=new RegExp("\\((\\S*)".concat(sn).concat(sn,"\\)"));var ln=new RegExp("^\\s*at ?".concat(an).concat(sn,"?").concat(sn,"??\\s*$"),"i");var fn=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var dn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,pn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function vn(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function hn(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 yn(e,t,n){var r=n.before,o=n.after;return hn(e,t,(function(e){return function(){var t,n=arguments;return r&&(0,Ve.callMonitored)(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&(0,Ve.callMonitored)(o,this,n),t}}))}var mn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function gn(e){var t=function(e){return yn(window,"onerror",{before:function(t,n,r,o,i){var a;if(i)a=on(i),e(a,i);else{var s,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var l=mn.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 yn(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=on(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}var bn={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function wn(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:kn(t),handlingStack:r,type:t.name,causes:xn(n,a)}:{startClocks:o,source:a,handling:s,originalError:n,message:"".concat(i," ").concat(lt(n)),stack:"No stack, consider using an instance of Error",handlingStack:r,type:t&&t.name}}function kn(e){var t=En(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 En(e){return"".concat(e.name||"Error",": ").concat(e.message)}function Sn(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return(0,Ve.callMonitored)((function(){var n=on(t);n.stack=n.stack.slice(2),e=kn(n)})),e}function xn(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=on(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&kn(o)}),n=n.cause}return r.length?r:void 0}function Cn(e){return gn((function(t,n){e.notify(wn({stackTrace:t,originalError:n,startClocks:Nt(),nonErrorPrefix:"Uncaught",source:bn.SOURCE,handling:"unhandled"}))}))}var Tn=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}();function On(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Tn((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 _n(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 Rn(e,t,n,r){return Pn(e,[t],n,r)}function Pn(e,t,n,r){var o=function(){var n=_n(e,"removeEventListener");t.forEach((function(t){return n.call(e,t,c,l)}))},i=void 0===r?{}:r,a=i.once,s=i.capture,u=i.passive,c=(0,Ve.monitor)(a?function(e){o(),n(e)}:n),l=u?{capture:s,passive:u}:s,f=_n(e,"addEventListener");return t.forEach((function(t){return f.call(e,t,c,l)})),{stop:o}}var Ln={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function In(e){var t,n=[];dt(e,Ln.cspViolation)&&n.push(t=new Tn((function(){var e=(0,Ve.monitor)((function(e){t.notify(function(e){var t=Ln.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:Ln.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:jn(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(St(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))}));return Rn(document,"securitypolicyviolation",e).stop})));var r=e.filter((function(e){return e!==Ln.cspViolation}));return r.length&&n.push(function(e){var t=new Tn((function(){if(window.ReportingObserver){var n=(0,Ve.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:jn(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)),On.apply(void 0,n)}function jn(e,t,n,r,o){return n&&kn({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function An(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var Dn,Mn={log:"log",configuration:"configuration"},Un=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","http://localhost","<anonymous>"],Bn=["ddog-gov.com"],qn={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function Fn(e,t){var n,r=new Tn;return qn.telemetryEnabled=ut(t.telemetrySampleRate),qn.telemetryConfigurationEnabled=qn.telemetryEnabled&&ut(t.telemetryConfigurationSampleRate),Dn=function(o){if(!dt(Bn,t.site)&&qn.telemetryEnabled){var i=function(e,t){return Ot({type:"telemetry",date:qt(),service:e,version:"4.30.1",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:pt(Rt||new Set)},void 0!==n?n():{})}(e,o);r.notify(i),An("telemetry",i)}},(0,Ve.startMonitorErrorCollection)(Hn),at(qn,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:r}}function Nn(e,t){(0,Ve.displayIfDebugEnabled)(He.debug,e,t),zn(at({type:Mn.log,message:e,status:"debug"},t))}function Hn(e){zn(at({type:Mn.log,status:"error"},function(e){if(e instanceof Error){var t=on(e);return{error:{kind:t.name,stack:kn(Vn(t))},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught ".concat(lt(e))}}(e)))}function zn(e){Dn&&qn.sentEventCount<qn.maxEventsPerPage&&(qn.sentEventCount+=1,Dn(e))}function Vn(e){return e.stack=e.stack.filter((function(e){return!e.url||Un.some((function(t){return bt(e.url,t)}))})),e}var Gn,Kn=1/0,$n=tt,Wn=((Gn=function(e){var t=this;this.expireDelay=e,this.entries=[],this.clearOldContextsInterval=setInterval((function(){return t.clearOldContexts()}),$n)}).prototype.add=function(e,t){var n=this,r={context:e,startTime:t,endTime:Kn,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},Gn.prototype.find=function(e){void 0===e&&(e=Kn);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}}},Gn.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===Kn&&t.close(e)},Gn.prototype.findAll=function(e){return void 0===e&&(e=Kn),this.entries.filter((function(t){return t.startTime<=e&&e<=t.endTime})).map((function(e){return e.context}))},Gn.prototype.reset=function(){this.entries=[]},Gn.prototype.stop=function(){clearInterval(this.clearOldContextsInterval)},Gn.prototype.clearOldContexts=function(){for(var e=Ft()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},Gn);var Jn,Xn=4*nt,Yn=15*tt,Zn=/^([a-z]+)=([a-z0-9-]+)$/,Qn="&",er="_dd_s",tr=10,nr=100,rr=[];function or(e,t){var n;if(void 0===t&&(t=0),Jn||(Jn=e),e===Jn)if(t>=nr)sr();else{var r,o=lr();if(ir()){if(o.lock)return void ar(e,t);if(r=st(),o.lock=r,cr(o,e.options),(o=lr()).lock!==r)return void ar(e,t)}var i=e.process(o);if(ir()&&(o=lr()).lock!==r)ar(e,t);else{if(i&&ur(i,e.options),ir()&&(!i||!fr(i))){if((o=lr()).lock!==r)return void ar(e,t);delete o.lock,cr(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),sr()}}else rr.push(e)}function ir(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)}function ar(e,t){setTimeout((0,Ve.monitor)((function(){or(e,t+1)})),tr)}function sr(){Jn=void 0;var e=rr.shift();e&&or(e)}function ur(e,t){fr(e)?function(e){jt(er,"",0,e)}(t):(e.expire=String(Bt()+Yn),cr(e,t))}function cr(e,t){jt(er,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(Qn);var t}(e),Yn,t)}function lr(){var e=At(er),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(Qn)||Zn.test(e))}(e)&&e.split(Qn).forEach((function(e){var n=Zn.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function fr(e){return gt(e)}var dr="_dd",pr="_dd_r",vr="_dd_l",hr="rum",yr="logs";function mr(e){var t=At(er),n=At(dr),r=At(pr),o=At(vr);if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i[yr]=o),r&&/^[012]$/.test(r)&&(i[hr]=r),ur(i,e)}}function gr(e,t,n){var r,o=function(e){return l(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=st(),e.created=String(Bt())),i},a=function(){return void 0!==v[t]},s=function(e){return v.id!==e.id||v[t]!==e[t]},u=function(){v={},d.notify()},c=function(e){v=e,f.notify()},l=function(e){return(void 0===e.created||Bt()-Number(e.created)<Xn)&&(void 0===e.expire||Bt()<Number(e.expire))},f=new Tn,d=new Tn,p=setInterval((0,Ve.monitor)((function(){or({options:e,process:function(e){return l(e)?void 0:{}},after:o})})),It),v=(r=lr(),l(r)?r:{});return{expandOrRenewSession:it((0,Ve.monitor)((function(){var t;or({options:e,process:function(e){var n=o(e);return t=i(n),n},after:function(e){t&&!a()&&c(e),v=e}})})),It).throttled,expandSession:function(){or({options:e,process:function(e){return a()?o(e):void 0}})},getSession:function(){return v},renewObservable:f,expireObservable:d,stop:function(){clearInterval(p)}}}var br=tt,wr=Xn,kr=[];function Er(e,t,n){var r=function(){return{id:o.getSession().id,trackingType:o.getSession()[t]}};mr(e);var o=gr(e,t,n);kr.push((function(){return o.stop()}));var i,a=new Wn(wr);return kr.push((function(){return a.stop()})),o.renewObservable.subscribe((function(){a.add(r(),Ft())})),o.expireObservable.subscribe((function(){a.closeActive(Ft())})),o.expandOrRenewSession(),a.add(r(),[0,Ht()][0]),i=Pn(window,["click","touchstart","keydown","scroll"],(function(){return o.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,kr.push(i),function(e){var t=(0,Ve.monitor)((function(){"visible"===document.visibilityState&&e()})),n=Rn(document,"visibilitychange",t).stop;kr.push(n);var r=setInterval(t,br);kr.push((function(){clearInterval(r)}))}((function(){return o.expandSession()})),{findActiveSession:function(e){return a.find(e)},renewObservable:o.renewObservable,expireObservable:o.expireObservable}}function Sr(){var e=wt().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function xr(e){var t;void 0===e&&(e=null===(t=wt().location)||void 0===t?void 0:t.hostname);var n=Sr();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}var Cr,Tr=/[^\u0000-\u007F]/,Or=((Cr=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)},Cr.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},Cr.prototype.flush=function(e){if(void 0===e&&(e=this.request.send),0!==this.bufferMessagesCount){var t=this.pushOnlyBuffer.concat(mt(this.upsertBuffer)),n=this.bufferBytesCount;this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesCount=0,this.bufferMessagesCount=0,e({data:t.join("\n"),bytesCount:n})}},Cr.prototype.computeBytesCount=function(e){return Tr.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},Cr.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,o=n.messageBytesCount;o>=this.messageBytesLimit?ze.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())},Cr.prototype.process=function(e){var t=lt(e);return{processedMessage:t,messageBytesCount:this.computeBytesCount(t)}},Cr.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},Cr.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)},Cr.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},Cr.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesCount+e+1>=this.batchBytesLimit},Cr.prototype.isFull=function(){return this.bufferMessagesCount===this.batchMessagesLimit||this.bufferBytesCount>=this.batchBytesLimit},Cr.prototype.flushPeriodically=function(){var e=this;setTimeout((0,Ve.monitor)((function(){e.flush(),e.flushPeriodically()})),this.flushTimeout)},Cr),_r=80*rt,Rr=32,Pr=3*ot,Lr=tt,Ir=et;function jr(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?Dr(e,t,n,{onSuccess:function(){return Mr(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),Ar(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function Ar(e,t,n,r){2===e.transportStatus&&setTimeout((0,Ve.monitor)((function(){Dr(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=Ir,Mr(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(Lr,2*e.currentBackoffTime),Ar(e,t,n,r)}})})),e.currentBackoffTime)}function Dr(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 Mr(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(Pr/ot,"MiB"),source:bn.AGENT,startClocks:Nt()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=Ur();i.size()>0;)jr(i.dequeue(),t,n,r,o)}function Ur(){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>=Pr}}}function Br(e,t,n){var r={transportStatus:0,currentBackoffTime:Ir,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=_r&&this.ongoingRequestCount<Rr},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:Ur(),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,Ve.monitor)((function(e){return null==r?void 0:r({status:e.status,type:e.type})})),(0,Ve.monitor)((function(){Nr(e.build("xhr",a),o,r)})))}else{Nr(e.build("xhr",a),o,r)}}(e,t,n,r)};return{send:function(t){jr(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){Fr||(Fr=!0,Hn(e))}(e)}var s=e.build("xhr");Nr(s,r)}(e,t,n)}}}var qr,Fr=!1;function Nr(e,t,n){var r=new XMLHttpRequest,o=(0,Ve.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 Hr(e,t,n,r,o){var i,a=function(t){return new Or(Br(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 zr,Vr=new WeakMap;function Gr(){var e;return qr||(e=new Tn((function(){var t=yn(XMLHttpRequest.prototype,"open",{before:Kr}).stop,n=yn(XMLHttpRequest.prototype,"send",{before:function(){$r.call(this,e)}}).stop,r=yn(XMLHttpRequest.prototype,"abort",{before:Wr}).stop;return function(){t(),n(),r()}})),qr=e),qr}function Kr(e,t){Vr.set(this,{state:"open",method:e,url:zt(String(t))})}function $r(e){var t=this,n=Vr.get(this);if(n){var r=n;r.state="start",r.startTime=Ft(),r.startClocks=Nt(),r.isAborted=!1,r.xhr=this;var o=!1,i=yn(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&a()}}).stop,a=(0,Ve.monitor)((function(){if(t.removeEventListener("loadend",a),i(),!o){o=!0;var s,u=n;u.state="complete",u.duration=(s=r.startClocks.timeStamp,qt()-s),u.status=t.status,e.notify(at({},u))}}));this.addEventListener("loadend",a),e.notify(r)}}function Wr(){var e=Vr.get(this);e&&(e.isAborted=!0)}function Jr(){var e;return zr||(e=new Tn((function(){if(window.fetch)return hn(window,"fetch",(function(t){return function(n,r){var o,i=(0,Ve.callMonitored)(Xr,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),(0,Ve.callMonitored)(Yr,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),zr=e),zr}function Xr(e,t,n){var r=n&&n.method||"object"==typeof t&&t.method||"GET",o=zt("object"==typeof t&&t.url||t),i={state:"start",init:n,input:t,method:r,startClocks:Nt(),url:o};return e.notify(i),i}function Yr(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,Ve.monitor)(r),(0,Ve.monitor)(r))}var Zr={};function Qr(e){var t=e.map((function(e){return Zr[e]||(Zr[e]=function(e){var t=new Tn((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=Sn();(0,Ve.callMonitored)((function(){t.notify(function(e,t,n){var r,o=e.map((function(e){return function(e){return"string"==typeof e?e:e instanceof Error?En(on(e)):lt(e,void 0,2)}(e)})).join(" ");if(t===He.error){var i=vt(e,(function(e){return e instanceof Error}));r=i?kn(on(i)):void 0,o="console error: ".concat(o)}return{api:t,message:o,stack:r,handlingStack:n}}(r,e,i))}))},function(){console[e]=n}}));return t}(e)),Zr[e]}));return On.apply(void 0,t)}var eo,to=((eo=function(){this.buffer=[]}).prototype.add=function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},eo.prototype.drain=function(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},eo);function no(){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 Tt(e)},setContext:function(t){e=Tt(t)},setContextProperty:function(t,n){e[t]=Tt(n)},removeContextProperty:function(t){delete e[t]},clearContext:function(){e={}}}}function ro(e,t,n){var r=function(){var e,r;if(o.cancel().catch(ct),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,Ve.monitor)((function(t){t.done?r():(n.collectStreamBody&&i.push(t.value),(a+=t.value.length)>n.bytesLimit?r():e())})),(0,Ve.monitor)((function(e){return t(e)})))}()}var oo="datadog-synthetics-public-id",io="datadog-synthetics-result-id",ao="datadog-synthetics-injects-rum";function so(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||At(ao))}function uo(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||At(io);return"string"==typeof e?e:void 0}function co(e){var t=at({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}var lo=32*rt;function fo(e,t,n){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return dt(t,e)}))?"all"===e?t:(r=e,o=new Set,r.forEach((function(e){return o.add(e)})),pt(o)):void ze.error("".concat(n,' should be "all" or an array with allowed values "').concat(t.join('", "'),'"'));var r,o}var po={};e(po,"StatusType",(function(){return yo}),(function(e){return yo=e})),e(po,"HandlerType",(function(){return mo}),(function(e){return mo=e})),e(po,"STATUSES",(function(){return go}),(function(e){return go=e})),e(po,"Logger",(function(){return bo}),(function(e){return bo=e}));var vo,ho=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},yo={debug:"debug",error:"error",info:"info",warn:"warn"},mo={console:"console",http:"http",silent:"silent"},go=Object.keys(yo),bo=(vo=function(e,t,n,r,o){void 0===n&&(n=mo.http),void 0===r&&(r=yo.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=no(),this.contextManager.set(at({},o,t?{logger:{name:t}}:void 0))},vo.prototype.log=function(e,t,n){void 0===n&&(n=yo.info),this.handleLogStrategy({message:e,context:Tt(t),status:n},this)},vo.prototype.debug=function(e,t){this.log(e,t,yo.debug)},vo.prototype.info=function(e,t){this.log(e,t,yo.info)},vo.prototype.warn=function(e,t){this.log(e,t,yo.warn)},vo.prototype.error=function(e,t){var n={error:{origin:bn.LOGGER}};this.log(e,Ot(n,t),yo.error)},vo.prototype.setContext=function(e){this.contextManager.set(e)},vo.prototype.getContext=function(){return this.contextManager.get()},vo.prototype.addContext=function(e,t){this.contextManager.add(e,t)},vo.prototype.removeContext=function(e){this.contextManager.remove(e)},vo.prototype.setHandler=function(e){this.handlerType=e},vo.prototype.getHandler=function(){return this.handlerType},vo.prototype.setLevel=function(e){this.level=e},vo.prototype.getLevel=function(){return this.level},ho([Ve.monitored],vo.prototype,"log",null),vo);var wo,ko="logs";function Eo(e){var t=Er(e.cookieOptions,ko,(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:So(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 So(e){return ut(e.sessionSampleRate)?"1":"0"}var xo=((wo={})[po.StatusType.debug]=0,wo[po.StatusType.info]=1,wo[po.StatusType.warn]=2,wo[po.StatusType.error]=3,wo);function Co(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return xo[e]>=xo[n.getLevel()]&&dt(o,t)}function To(e,t,n,r,o,i){var a=po.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}),tt),(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:bn.AGENT,startClocks:Nt()})}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,v=void 0===p?void 0:p,h=i.logger,y=void 0===h?o:h,m=l.date-Ht(),g=e.findTrackedSession(m);if(g){var b=v||r(),w=Ot({service:t.service,session_id:g.id,usr:gt(b.user)?void 0:b.user,view:b.view},b.context,Ro(m),l,y.getContext(),d);!Co(l.status,po.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)!==bn.AGENT&&(null!==(c=s[w.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,w)}}))}var Oo,_o=!1;function Ro(e){var t,n=function(t){if(t&&t.getInternalContext)return t.getInternalContext(e)},r=window;if(so()){var o=n(r.DD_RUM_SYNTHETICS);return o||_o||(_o=!0,Nn("Logs sent before RUM is injected by the synthetics worker",{testId:(t=window._DATADOG_SYNTHETICS_PUBLIC_ID||At(oo),"string"==typeof t?t:void 0),resultId:uo()})),o}return n(r.DD_RUM)}var Po,Lo=((Oo={})[He.log]=po.StatusType.info,Oo[He.debug]=po.StatusType.debug,Oo[He.info]=po.StatusType.info,Oo[He.warn]=po.StatusType.warn,Oo[He.error]=po.StatusType.error,Oo);var Io=((Po={})[Ln.cspViolation]=po.StatusType.error,Po[Ln.intervention]=po.StatusType.error,Po[Ln.deprecation]=po.StatusType.warn,Po);function jo(e,t){var n=function(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(Do(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:bn.NETWORK,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:po.StatusType.error,origin:bn.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(Ao(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){window.TextDecoder?e.body?function(e,t,n){ro(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,Ve.monitor)((function(e){return n(Ao(e,t))})),(0,Ve.monitor)((function(e){return n("Unable to retrieve response: ".concat(e))})))}(r.response,e,o):r.error&&function(e,t,n){n(Ao(kn(on(e)),t))}(r.error,e,o))};if(!e.forwardErrorsToLogs)return{stop:ct};var r=Gr().subscribe((function(e){"complete"===e.state&&n("xhr",e)})),o=Jr().subscribe((function(e){"resolve"===e.state&&n("fetch",e)}));return{stop:function(){r.unsubscribe(),o.unsubscribe()}}}function Ao(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function Do(e){return"xhr"===e?"XHR":"Fetch"}var Mo,Uo=((Mo=function(){this.callbacks={}}).prototype.notify=function(e,t){var n=this.callbacks[e];n&&n.forEach((function(e){return e(t)}))},Mo.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}))}}},Mo);var Bo,qo,Fo,No,Ho,zo,Vo,Go,Ko,$o,Wo,Jo,Xo,Yo=(Bo=function(e,t,n,r){var o=new Uo;o.subscribe(1,(function(e){return An("logs",e)}));var i,a=function(e){return o.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:bn.AGENT},origin:bn.AGENT,status:po.StatusType.error}})},s=i=new Tn((function(){var e=Rn(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&i.notify({reason:"visibility_hidden"})}),{capture:!0}).stop,t=Rn(window,"beforeunload",(function(){i.notify({reason:"before_unload"})})).stop;return function(){e(),t()}}));(function(e,t,n){var r,o=Fn("browser-logs-sdk",e);if(xr()){var i=Sr();o.observable.subscribe((function(e){return i.send("internal_telemetry",e)}))}else{var a=Hr(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 e.site===Gt}(e))}))}return o})(t,a,s).setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=Ro())||void 0===e?void 0:e.application_id},session:{id:null===(t=l.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=Ro())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=Ro())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),jo(t,o),function(e,t){if(!e.forwardErrorsToLogs)return{stop:ct};var n=new Tn,r=Cn(n).stop,o=n.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:bn.SOURCE,stack:e.stack},origin:bn.SOURCE,status:po.StatusType.error}})}))}(t,o),function(e,t){var n=Qr(e.forwardConsoleLogs).subscribe((function(e){t.notify(0,{rawLogsEvent:{date:qt(),message:e.message,origin:bn.CONSOLE,error:e.api===He.error?{origin:bn.CONSOLE,stack:e.stack}:void 0,status:Lo[e.api]}})}))}(t,o),function(e,t){var n=In(e.forwardReports).subscribe((function(e){var n,r,o,i=e.message,a=Io[e.type];a===po.StatusType.error?n={kind:e.subtype,origin:bn.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:qt(),message:i,origin:bn.REPORT,error:n,status:a}})}))}(t,o);var u,c=function(e){return{handleLog:function(t,n,r,o){var i=t.context;Co(t.status,po.HandlerType.console,n)&&ze(t.status,t.message,Ot(n.getContext(),i)),e.notify(0,{rawLogsEvent:{date:o||qt(),message:t.message,status:t.status,origin:bn.LOGGER},messageContext:i,savedCommonContext:r,logger:n})}}}(o).handleLog,l=!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_".concat(st()),n="test";jt(t,n,tt,e);var r=At(t)===n;return Dt(t,e),r}catch(e){return ze.error(e),!1}}(t.cookieOptions)||xr()||so()?function(e){var t="1"===So(e)?{}:void 0;return{findTrackedSession:function(){return t}}}(t):Eo(t);return To(l,t,o,n,r,a),xr()?function(e){var t=Sr();e.subscribe(1,(function(e){t.send("log",e)}))}(o):function(e,t,n,r){var o,i=Hr(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){qn.telemetryConfigurationEnabled&&zn({type:Mn.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 at({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(e)),{handleLog:c,getInternalContext:(u=l,{get:function(e){var t=u.findTrackedSession(e);if(t)return{session_id:t.id}}}).get}},No=function(){return{view:{referrer:document.referrer,url:window.location.href},context:zo.getContext(),user:Vo.getContext()}},Ho=!1,zo=no(),Vo=no(),Go={},Ko=function(){},$o=new to,Wo=function(e,t,n,r){void 0===n&&(n=Tt(No())),void 0===r&&(r=qt()),$o.add((function(){return Wo(e,t,n,r)}))},Jo=function(){},Xo=new(0,po.Logger)((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Wo.apply(void 0,e)})),qo={logger:Xo,init:(0,Ve.monitor)((function(e){var t;if(Jo=function(){return Tt(e)},xr()&&(e=function(e){return at({},e,{clientToken:"empty"})}(e)),function(e){return!Ho||(e.silentMultipleInit||ze.error("DD_LOGS is already initialized."),!1)}(e)){var n=function(e){var t=tn(e),n=fo(e.forwardConsoleLogs,mt(He),"Forward Console Logs"),r=fo(e.forwardReports,mt(Ln),"Forward Reports");if(t&&n&&r)return e.forwardErrorsToLogs&&!dt(n,He.error)&&n.push(He.error),at({forwardErrorsToLogs:!1!==e.forwardErrorsToLogs,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:lo},t)}(e);n&&(t=Bo(e,n,No,Xo),Wo=t.handleLog,Ko=t.getInternalContext,$o.drain(),Ho=!0)}})),getLoggerGlobalContext:(0,Ve.monitor)(zo.get),getGlobalContext:(0,Ve.monitor)(zo.getContext),setLoggerGlobalContext:(0,Ve.monitor)(zo.set),setGlobalContext:(0,Ve.monitor)(zo.setContext),addLoggerGlobalContext:(0,Ve.monitor)(zo.add),setGlobalContextProperty:(0,Ve.monitor)(zo.setContextProperty),removeLoggerGlobalContext:(0,Ve.monitor)(zo.remove),removeGlobalContextProperty:(0,Ve.monitor)(zo.removeContextProperty),clearGlobalContext:(0,Ve.monitor)(zo.clearContext),createLogger:(0,Ve.monitor)((function(e,t){return void 0===t&&(t={}),Go[e]=new(0,po.Logger)((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Wo.apply(void 0,e)}),e,t.handler,t.level,t.context),Go[e]})),getLogger:(0,Ve.monitor)((function(e){return Go[e]})),getInitConfiguration:(0,Ve.monitor)((function(){return Jo()})),getInternalContext:(0,Ve.monitor)((function(e){return Ko(e)})),setUser:(0,Ve.monitor)((function(e){(function(e){var t="object"===xt(e);return t||ze.error("Unsupported user:",e),t})(e)&&Vo.setContext(co(e))})),getUser:(0,Ve.monitor)(Vo.getContext),setUserProperty:(0,Ve.monitor)((function(e,t){var n,r=co((n={},n[e]=t,n))[e];Vo.setContextProperty(e,r)})),removeUserProperty:(0,Ve.monitor)(Vo.removeContextProperty),clearUser:(0,Ve.monitor)(Vo.clearContext)},Fo=at({version:"4.30.1",onReady:function(e){e()}},qo),Object.defineProperty(Fo,"_setDebug",{get:function(){return Ve.setDebugMode},enumerable:!1}),Fo);!function(e,t,n){var r=e[t];e[t]=n,r&&r.q&&r.q.forEach((function(e){return Ut(e,"onReady callback threw an error:")()}))}(wt(),"DD_LOGS",Yo);var Zo={logger:{error:function(e,t){Yo.logger.error(e,t)},info:function(e,t){Yo.logger.info(e,t)}}},Qo=function(){"use strict";function e(){o(this,e)}return a(e,null,[{key:"updateFocusableElements",value:function(){var e=Array.from(document.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), object, embed, *[tabindex], *[contenteditable], iframe"));this._focusableElements=e.filter((function(e){var t=e.getAttribute("tabindex"),n=!t||Number.parseInt(t)>=0,r="hidden"!==window.getComputedStyle(e).getPropertyValue("visibility")&&"none"!==window.getComputedStyle(e).getPropertyValue("display"),o=!1;return e instanceof HTMLIFrameElement&&(o=e.title.includes("Basis Theory")),n&&r||o}))}},{key:"setIframeTabbingListeners",value:function(){var e=this,t=-1!==(navigator.userAgent.indexOf("Opera")||navigator.userAgent.indexOf("OPR"))?"Opera":navigator.userAgent.includes("Edg")?"Edge":navigator.userAgent.includes("Chrome")?"Chrome":navigator.userAgent.includes("Safari")?"Safari":navigator.userAgent.includes("Firefox")?"Firefox":navigator.userAgent.includes("MSIE")||Boolean(document.documentMode)?"IE":"unknown";"Firefox"!==t&&"Safari"!==t||(window.addEventListener("message",(function(t){var n;if(e.doesEventOriginMatchIframeOrigin(t))try{(n=JSON.parse(t.data))&&(e.setIframeKeypressRequestMessageListener(n,t),e.setIframeKeypressMessageListener(n),e.setFocusListeners(n))}catch(e){}})),this.setTabAndShiftTabKeyPressListeners())}},{key:"getFocusDirection",value:function(){return!this._tabAndShiftTabKeyPresses.Shift&&this._tabAndShiftTabKeyPresses.Tab?"forward":this._tabAndShiftTabKeyPresses.Shift&&this._tabAndShiftTabKeyPresses.Tab?"backward":"unknown"}},{key:"setIframeKeypressRequestMessageListener",value:function(e,t){if("iframeKeypressRequestMessage"===e.type){var n,r=e;null===(n=this._focusableElements.find((function(e){return e.id===r.elementId})).contentWindow)||void 0===n||n.postMessage(JSON.stringify({type:"iframeKeypressResponseMessage",isShiftKeyPressed:this._tabAndShiftTabKeyPresses.Shift}),t.origin)}}},{key:"setIframeKeypressMessageListener",value:function(e){if("iframeKeypressMessage"===e.type){var t=e;"Tab"!==t.key&&"Shift"!==t.key||(this._tabAndShiftTabKeyPresses[t.key]="keydown"===t.event)}}},{key:"setTabAndShiftTabKeyPressListeners",value:function(){var e=this,t=function(t){"Tab"!==t.key&&"Shift"!==t.key||(e._tabAndShiftTabKeyPresses[t.key]="keydown"===t.type)};window.addEventListener("keydown",t,!0),window.addEventListener("keyup",t,!0)}},{key:"setFocusListeners",value:function(e){if("iframeFocusChange"===e.type){var t=e;"Tab"!==t.key&&"Shift"!==t.key||(this._tabAndShiftTabKeyPresses[t.key]="keydown"===t.event);var n=this._focusableElements.find((function(e){return e.id===t.elementId})),r=this._focusableElements.indexOf(n),o=this.getFocusDirection();("forward"===o&&r<this._focusableElements.length-1||"backward"===o&&r>0)&&this.focusOnNextElement(o,r)}}},{key:"focusOnNextElement",value:function(e,t){var n="backward"===e?t-1:t+1;this._focusableElements[n].focus()}},{key:"doesEventOriginMatchIframeOrigin",value:function(e){var t=e.origin.includes("localhost")||e.origin.includes("flock-dev.com")||e.origin.includes("basistheory.com"),n=e.data&&"string"==typeof e.data;return t&&n}}]),e}();function ei(e,t,n){return ei=function(){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}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&x(o,n.prototype),o},ei.apply(null,arguments)}function ti(e,t,n){return ei.apply(null,arguments)}function ni(e){var t="function"==typeof Map?new Map:void 0;return ni=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 ti(e,arguments,_(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),x(r,e)},ni(e)}function ri(e){return ni(e)}s(Qo,"_focusableElements",[]),s(Qo,"_tabAndShiftTabKeyPresses",{});var oi=function(e){"use strict";C(n,e);var t=P(n);function n(e){var r,i=e.details;return o(this,n),(r=t.call(this,Ra(i))).name="MountElementError",r.details=i,r}return n}(ri(Error)),ii=function(e){"use strict";C(n,e);var t=P(n);function n(e){var r,i=e.details;return o(this,n),(r=t.call(this,Ra(i))).name="UpdateElementError",r.details=i,r}return n}(ri(Error)),ai="Element is not mounted.",si=function(){"use strict";function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,e),this.options=Object.freeze(w({},t,this.sanitizeOptions("create",n))),this.id=Ne(),this.unmounted=!1,this._ready=!1,this.changeSubject=new Ie,this.readySubject=new Ie,this.focusSubject=new Ie,this.blurSubject=new Ie,this.keydownSubject=new Ie,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 Zo.logger.error("Element has been unmounted and can't be mounted again for elementId=".concat(this.id),{errorType:"elementAlreadyUnmounted",elementId:this.id}),new Error("Element has been unmounted and can't be mounted again");if(this.mounted)throw Zo.logger.error("Element is already mounted for elementId=".concat(this.id),{errorType:"elementAlreadyMounted",elementId:this.id}),new Error("Element is already mounted.");var n="string"==typeof e?null===document||void 0===document?void 0:document.querySelector(e):e;if(!n||n.childNodes.length>0)throw"string"==typeof e?(Zo.logger.error("Couldn't find an empty element with selector ".concat(e," to mount on for elementId=").concat(this.id,"."),{errorType:"noEmptySelector",elementId:this.id}),new Error("Couldn't find an empty element with selector ".concat(e," to mount on."))):(Zo.logger.error("No selector or HTML element was provided for mounting elementId=".concat(this.id,"."),{errorType:"noSelectorOrElement",elementId:this.id}),new Error("No selector or HTML element was provided for mounting elementId=".concat(this.id,".")));return new Promise((function(e,r){t.iframe=document.createElement("iframe"),t.iframe.id=t.id,t.iframe.src=Oa(t.options,t.id),t.iframe.title="Basis Theory ".concat(t.elementType," Safe Data Frame ").concat(t.id),t.iframe.allow="clipboard-write",t.iframe.referrerPolicy="origin",t.iframe.scrolling="no";var o=t.iframeStyle();Object.keys(o).forEach((function(e){var n,r=null!==(n=o[e])&&void 0!==n?n:null;t.updateIframeStyle(W(e),r)})),n.append(t.iframe),t.removedFromDomObserver=new MutationObserver((function(e){e.forEach((function(e){"childList"!==e.type||document.contains(t.iframe)||t.ready||(Zo.logger.info("Element with elementId=".concat(t.id," was removed from the DOM during mounting."),{msgType:"removedFromDom",elementId:t.id}),r("Element was removed from the DOM."))}))})),t.removedFromDomObserver.observe(t.iframe.parentNode,{childList:!0,subtree:!0}),t.iframe.addEventListener("load",(function(){t.mountTimeout=window.setTimeout((function(){document.contains(t.iframe)?t.ready||(t.stopListening(),Zo.logger.info("Mount Timeout for elementId=".concat(t.id),{errorType:"mountTimeout",elementId:t.id}),r("Failed to communicate with Basis Theory Elements. This could be caused by a browser setting or an extension like ad block. Please check your browser or extension settings and trying again.")):(Zo.logger.info("MountTimeout for Element with elementId=".concat(t.id," after being removed from DOM."),{msgType:"removedFromDomTimeout",elementId:t.id}),r("Element was removed from the DOM."))}),15e3)})),t.startListening(),t.onMountCallbacks={resolve:e,reject:r},Qo.updateFocusableElements()}))}},{key:"unmount",value:function(){var e,t;if(!this.mounted)throw Zo.logger.error("".concat(ai," on unmount for elementId=").concat(this.id),{errorType:"notMountedOnUnmount",elementId:this.id}),new Error(ai);null===(e=this.removedFromDomObserver)||void 0===e||e.disconnect(),this.stopListening(),null===(t=this.iframe)||void 0===t||t.remove(),delete this.iframe,this.unmounted=!0}},{key:"update",value:function(e){var t=this;if(!this.mounted)return Zo.logger.error("".concat(ai," on update for elementId=").concat(this.id),{errorType:"notMountedOnUpdate",elementId:this.id}),Promise.reject(new Error(ai));var n=Ne(),r=this.sanitizeOptions("update",e),o={type:"updateConfigRequest",direction:"outgoing",correlationId:n,validateOnChange:r.validateOnChange,enableCopy:r.enableCopy,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,validation:r.validation},i=new Ie;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(w({},t.options,r))}}),t.postMessage(o)}))}},{key:"clear",value:function(){if(!this.mounted)throw Zo.logger.error("".concat(ai," on clear for elementId=").concat(this.id),{errorType:"notMountedOnClear",elementId:this.id}),new Error(ai);this.postMessage({type:"clearElement",direction:"outgoing"})}},{key:"focus",value:function(){if(!this.mounted)throw Zo.logger.error("".concat(ai," on focus for elementId=").concat(this.id),{errorType:"notMountedOnFocus",elementId:this.id}),new Error(ai);this.postMessage({type:"focusElement",direction:"outgoing"})}},{key:"blur",value:function(){if(!this.mounted)throw Zo.logger.error("".concat(ai," on blur for elementId=").concat(this.id),{errorType:"notMountedOnBlur",elementId:this.id}),new Error(ai);this.postMessage({type:"blurElement",direction:"outgoing"})}},{key:"setValue",value:function(e){if(!this.mounted)throw Zo.logger.error("".concat(ai," on setValue for elementId=").concat(this.id),{errorType:"notMountedOnSetValue",elementId:this.id}),new Error(ai);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 Zo.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(ai));var u=Ne(),c={type:"tokenizeRequest",direction:"outgoing",correlationId:u,service:t,method:n,id:o,payload:Xa(r),options:i,elements:Ja(a)},l=new Ie;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,La),this.iframeOrigin)}},{key:"sanitizeOptions",value:function(e,t){return es(t)}},{key:"onLoad",value:function(){if(this.ready)Zo.logger.info("Load message received for ready elementId=".concat(this.id),{msgType:"loadMessageWhenReady",elementId:this.id});else{var e={type:"setConfigRequest",direction:"outgoing",apiKey:this.options.apiKey,style:this.options.style,validateOnChange:this.options.validateOnChange,enableCopy:this.options.enableCopy,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,validation:this.options.validation};this.postMessage(e)}}},{key:"onSetConfigResponse",value:function(e){var t=e.errors;this.onMountCallbacks&&(t&&t.length>0?this.onMountCallbacks.reject(new oi({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 ii({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){if(t.stopImmediatePropagation(),"onLoad"===o.type){var i;Zo.logger.info("onLoad received for elementId=".concat(e.id),{msgType:"onLoadReceived",elementId:e.id}),window.clearTimeout(e.mountTimeout),null===(i=e.removedFromDomObserver)||void 0===i||i.disconnect();var a=Pa();return e.iframe&&e.iframe.contentWindow&&a.saveElementWindow({elementId:e.id,elementWindow:e.iframe.contentWindow}),e.onLoad()}return"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,A.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,k.BasisTheoryApiError)("The API is unreachable. Please check your connection or try again later.",o,n)):o&&o>=400?t.error(new(0,k.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(W(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}(),ui=function(e){"use strict";C(n,e);var t=P(n);function n(){var e;return o(this,n),s(E(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 ts(e,t)}}]),n}(si),ci=function(e){"use strict";C(n,e);var t=P(n);function n(){var e;return o(this,n),s(E(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 os(e,t)}}]),n}(si),li=function e(t,n){"use strict";o(this,e),this.element=t,this.method=n},fi=function(e){"use strict";C(n,e);var t=P(n);function n(){var e;return o(this,n),s(E(e=t.apply(this,arguments)),"elementType","CardExpirationDateElement"),e}return a(n,[{key:"month",value:function(){return new li(this,"month")}},{key:"year",value:function(){return new li(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 rs(e,t)}}]),n}(si),di=function(e){"use strict";C(n,e);var t=P(n);function n(){var e;return o(this,n),s(E(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 is(e,t)}}]),n}(si);function pi(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 vi(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){pi(i,r,o,a,s,"next",e)}function s(e){pi(i,r,o,a,s,"throw",e)}a(void 0)}))}}var hi={},yi=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=E;return function(i,a){if(r===x)throw new Error("Generator is already running");if(r===C){if("throw"===i)throw a;return h()}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=L(s,n);if(u){if(u===T)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===E)throw r=C,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?C:S,c.arg===T)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=C,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)},v=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:h}},h=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 E="suspendedStart",S="suspendedYield",x="executing",C="completed",T={},O={};n(O,b,(function(){return this}));var _=Object.getPrototypeOf,R=_&&_(_(v([])));R&&R!==y&&m.call(R,b)&&(O=R);var P=s.prototype=i.prototype=Object.create(O);function L(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,L(e,n),"throw"===n.method))return T;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var i=o(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,T;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,T):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,T)}return a.prototype=s,n(P,"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(P),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(P),n(P,k,"Generator"),n(P,b,(function(){return this})),n(P,"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=v,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,T):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),T},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),T}},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:v(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),T}},e}(hi);try{regeneratorRuntime=yi}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=yi:Function("r","regeneratorRuntime = r")(yi)}var mi,gi="__lodash_hash_undefined__",bi=1/0,wi=9007199254740991,ki="[object Function]",Ei="[object GeneratorFunction]",Si="[object Symbol]",xi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ci=/^\w*$/,Ti=/^\./,Oi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_i=/\\(\\)?/g,Ri=/^\[object .+?Constructor\]$/,Pi=/^(?:0|[1-9]\d*)$/,Li="object"==typeof n&&n&&n.Object===Object&&n,Ii="object"==typeof self&&self&&self.Object===Object&&self,ji=Li||Ii||Function("return this")();var Ai,Di=Array.prototype,Mi=Function.prototype,Ui=Object.prototype,Bi=ji["__core-js_shared__"],qi=(Ai=/[^.]+$/.exec(Bi&&Bi.keys&&Bi.keys.IE_PROTO||""))?"Symbol(src)_1."+Ai:"",Fi=Mi.toString,Ni=Ui.hasOwnProperty,Hi=Ui.toString,zi=RegExp("^"+Fi.call(Ni).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vi=ji.Symbol,Gi=Di.splice,Ki=oa(ji,"Map"),$i=oa(Object,"create"),Wi=Vi?Vi.prototype:void 0,Ji=Wi?Wi.toString:void 0;function Xi(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 Yi(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 Zi(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 Qi(e,t,n){var r=e[t];Ni.call(e,t)&&ca(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function ea(e,t){for(var n=e.length;n--;)if(ca(e[n][0],t))return n;return-1}function ta(e){if(!fa(e)||(t=e,qi&&qi in t))return!1;var t,n=function(e){var t=fa(e)?Hi.call(e):"";return t==ki||t==Ei}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?zi:Ri;return n.test(function(e){if(null!=e){try{return Fi.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function na(e,t,n,o){if(!fa(e))return e;t=function(e,t){if(la(e))return!1;var n=void 0===e?"undefined":r(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!da(e))||(Ci.test(e)||!xi.test(e)||null!=t&&e in Object(t))}(t,e)?[t]:function(e){return la(e)?e:aa(e)}(t);for(var i=-1,a=t.length,s=a-1,u=e;null!=u&&++i<a;){var c=sa(t[i]),l=n;if(i!=s){var f=u[c];void 0===(l=o?o(f,c,u):void 0)&&(l=fa(f)?f:ia(t[i+1])?[]:{})}Qi(u,c,l),u=u[c]}return e}function ra(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 oa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ta(n)?n:void 0}function ia(e,t){return!!(t=null==t?wi:t)&&("number"==typeof e||Pi.test(e))&&e>-1&&e%1==0&&e<t}Xi.prototype.clear=function(){this.__data__=$i?$i(null):{}},Xi.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Xi.prototype.get=function(e){var t=this.__data__;if($i){var n=t[e];return n===gi?void 0:n}return Ni.call(t,e)?t[e]:void 0},Xi.prototype.has=function(e){var t=this.__data__;return $i?void 0!==t[e]:Ni.call(t,e)},Xi.prototype.set=function(e,t){return this.__data__[e]=$i&&void 0===t?gi:t,this},Yi.prototype.clear=function(){this.__data__=[]},Yi.prototype.delete=function(e){var t=this.__data__,n=ea(t,e);return!(n<0)&&(n==t.length-1?t.pop():Gi.call(t,n,1),!0)},Yi.prototype.get=function(e){var t=this.__data__,n=ea(t,e);return n<0?void 0:t[n][1]},Yi.prototype.has=function(e){return ea(this.__data__,e)>-1},Yi.prototype.set=function(e,t){var n=this.__data__,r=ea(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Zi.prototype.clear=function(){this.__data__={hash:new Xi,map:new(Ki||Yi),string:new Xi}},Zi.prototype.delete=function(e){return ra(this,e).delete(e)},Zi.prototype.get=function(e){return ra(this,e).get(e)},Zi.prototype.has=function(e){return ra(this,e).has(e)},Zi.prototype.set=function(e,t){return ra(this,e).set(e,t),this};var aa=ua((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(da(e))return Ji?Ji.call(e):"";var t=e+"";return"0"==t&&1/e==-bi?"-0":t}(t);var n=[];return Ti.test(e)&&n.push(""),e.replace(Oi,(function(e,t,r,o){n.push(r?o.replace(_i,"$1"):t||e)})),n}));function sa(e){if("string"==typeof e||da(e))return e;var t=e+"";return"0"==t&&1/e==-bi?"-0":t}function ua(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(ua.Cache||Zi),n}function ca(e,t){return e===t||e!=e&&t!=t}ua.Cache=Zi;var la=Array.isArray;function fa(e){var t=void 0===e?"undefined":r(e);return!!e&&("object"==t||"function"==t)}function da(e){return"symbol"==(void 0===e?"undefined":r(e))||function(e){return!!e&&"object"==typeof e}(e)&&Hi.call(e)==Si}mi=function(e,t,n){return null==e?e:na(e,t,n)};var pa="No element argument has been defined. Use @basis-theory/basis-theory-js instead if no elements are needed.",va="Could not find basis-theory element for request.",ha=function(e,t){return"Only strings, booleans, and numbers are allowed as values. Found ".concat(e," had value: ").concat(t)},ya=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 Zo.logger.error("".concat(va," for elementId=").concat(e),{errorType:"noElementFound",elementId:e}),new Error(va)},ma=function(e){return"string"==typeof e||"boolean"==typeof e||"number"==typeof e||null==e},ga=function(e,t,n){return n?Array.isArray(e)?"".concat(n,"[").concat(t,"]"):"".concat(n,".").concat(t):t},ba=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=g(o,2),a=i[0],u=i[1],c=ga(e,a,r);if(u instanceof si)n.elements=Object.assign(n.elements||{},s({},c,{index:ya(u.id)})),n.masterElement=u;else if(u instanceof li&&u.element instanceof si&&("string"==typeof u.method||void 0===u.method)){var l=u.element,f=u.method;n.elements=Object.assign(n.elements||{},s({},c,{index:ya(l.id),method:f})),n.masterElement=l}else if(ma(u))n.payload=t(mi)(n.payload||{},c,u);else{if("object"!=typeof u)throw Zo.logger.error(ha(c,u),{errorType:"invalidRequestOnGetPayload",requestObject:e}),new TypeError(ha(c,u));Array.isArray(u)&&0===u.length?n.payload=t(mi)(n.payload||{},c,[]):ba(u,n,c)}})),n},wa=function(e){var t=ba(e),n=t.elements,r=t.masterElement,o=t.payload;if(!r||!n)throw Zo.logger.error("".concat(pa," on getMessageInputs"),{errorType:"useBtJs"}),new Error(pa);return{elements:n,payload:o,masterElement:r}},ka=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=g(o,2),a=i[0],u=i[1],c=ga(e,a,r);if(u instanceof si)n.elementReferences=Object.assign(n.elementReferences||{},s({},c,{elementId:u.id}));else if(u instanceof li&&u.element instanceof si&&("string"==typeof u.method||void 0===u.method)){var l=u.element,f=u.method;n.elementReferences=Object.assign(n.elementReferences||{},s({},c,{elementId:l.id,elementMethod:f}))}else if(ma(u))n.servicePayload=t(mi)(n.servicePayload||{},c,u);else{if("object"!=typeof u)throw Zo.logger.error(ha(c,u),{errorType:"invalidRequestOnGetPayload",requestObject:e}),new TypeError(ha(c,u));Array.isArray(u)&&0===u.length?n.servicePayload=t(mi)(n.servicePayload||{},c,[]):ka(u,n,c)}})),n},Ea=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=ka(e),r=n.elementReferences,o=n.servicePayload;if(!r&&!t)throw Zo.logger.error("".concat(pa," on getServiceRequestPayload"),{errorType:"useBtJs"}),new Error(pa);return{elementReferences:r,servicePayload:o}},Sa=function(e){"use strict";C(n,e);var t=P(n);function n(e,r,i,a){var s;return o(this,n),(s=t.call(this)).name="HttpClientError",s.status=r,s.data=i,s.headers=a,s}return n}(ri(Error)),xa=function(e){"use strict";C(r,e);var n=P(r);function r(){var e;return o(this,r),s(E(e=n.apply(this,arguments)),"elementType","DataElement"),s(E(e),"elementWindows",[]),s(E(e),"_dataElementId","btDataElement"),e}return a(r,[{key:"saveElementWindow",value:function(e){this.elementWindows.push(e)}},{key:"mountDataElement",value:function(){var e=this;if(!this.mounted){var t="".concat(this._dataElementId,"-").concat(this.id),n=document.createElement("div");n.id=t,document.body.append(n),document.contains(n)?this.mountPromise=this._mount(t):(this.mountObserver=new MutationObserver((function(r){r.forEach((function(r){"childList"===r.type&&document.contains(n)&&!e.mounted&&(e.mountPromise=e._mount(t))}))})),this.mountObserver.observe(document.body,{childList:!0,subtree:!0}))}}},{key:"_tokenRequest",value:function(e){var n=e.service,r=e.method,o=e.payload,i=e.id,a=e.options,s=this;return vi(t(hi).mark((function e(){var u,c;return t(hi).wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s.mounted){e.next=3;break}return e.next=3,s.mountPromise;case 3:return u=Ne(),c={type:"detokenizeRequest",direction:"outgoing",correlationId:u,service:n,method:r,id:i,payload:Xa(o),options:a},e.abrupt("return",s.sendPostMessage(c,u));case 6:case"end":return e.stop()}}),e)})))()}},{key:"_proxyRequest",value:function(e,n,r,o){var i=this;return vi(t(hi).mark((function a(){var s,u;return t(hi).wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i.mounted){t.next=3;break}return t.next=3,i.mountPromise;case 3:return s=Ne(),u={type:"proxyRequest",direction:"outgoing",method:e,correlationId:s,options:n,payload:o,elements:r},t.abrupt("return",i.sendPostMessage(u,s));case 6:case"end":return t.stop()}}),a)})))()}},{key:"_serviceRequest",value:function(e){var n=e.service,r=e.serviceMethod,o=e.serviceOptions,i=e.servicePayload,a=e.elementReferences,s=this;return vi(t(hi).mark((function e(){var u,c;return t(hi).wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s.mounted){e.next=3;break}return e.next=3,s.mountPromise;case 3:return u=Ne(),c={type:"serviceRequest",direction:"outgoing",correlationId:u,service:n,serviceMethod:r,serviceOptions:o,servicePayload:i,elementReferences:a},e.abrupt("return",s.sendPostMessage(c,u));case 6:case"end":return e.stop()}}),e)})))()}},{key:"_httpClientRequest",value:function(e){var n=e.url,r=e.method,o=e.config,i=e.payload,a=e.elementReferences,s=this;return vi(t(hi).mark((function e(){var u,c;return t(hi).wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s.mounted){e.next=3;break}return e.next=3,s.mountPromise;case 3:return u=Ne(),c={type:"httpClientRequest",direction:"outgoing",correlationId:u,url:n,method:r,config:o,payload:i,elementReferences:a},e.abrupt("return",s.sendPostMessage(c,u));case 6:case"end":return e.stop()}}),e)})))()}},{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);case"dispatchValueRequest":return this.onDispatchValueRequest(e);case"serviceResponse":return this.onServiceResponse(e);case"httpClientResponse":return this.onHttpClientResponse(e)}}},{key:"_mount",value:function(e){return this.mountObserver&&this.mountObserver.disconnect(),this.mount("#".concat(e))}},{key:"sendPostMessage",value:function(e,t){var n=this,r=new Ie;return this.submitSubjects[t]=r,new Promise((function(o,i){r.subscribe({error:i,next:o,complete:function(){delete n.submitSubjects[t]}}),n.postMessage(e)}))}},{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,A.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,k.BasisTheoryApiError)("The API is unreachable. Please check your connection or try again later.",r,t)):r&&r>=400?a.error(new(0,k.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,k.BasisTheoryApiError)("The API is unreachable. Please check your connection or try again later.",n,t)):n&&n>=400?o.error(new(0,k.BasisTheoryApiError)("The API responded with status code ".concat(n,". Check error.data for more information."),n,t)):o.next(t),o.complete())}},{key:"onDispatchValueRequest",value:function(e){var t=e.elementId,n=e.forElementId,r=e.forElementPath,o=e.forElementMethod,i=e.correlationId,a=this.elementWindows.find((function(e){return e.elementId===n}));if(a){var s={correlationId:i,type:"dataElementValueRequest",direction:"outgoing",elementPath:r,elementMethod:o,dataElementWindowIndex:ya(t)};a.elementWindow.postMessage(JSON.stringify(s,La),this.iframeOrigin)}else Zo.logger.error("Could not find element window on dispatchValueRequest.",{msgType:"elementWindowNotFound",elementId:n,dataElementId:this.id})}},{key:"onServiceResponse",value:function(e){var t=e.data,n=e.validationErrors,r=e.status,o=e.correlationId,i=this.submitSubjects[o];i&&(n&&Object.keys(n).length?i.error(new(0,A.BasisTheoryValidationError)("There was a validation error that prevented submitting your request. Check error.details for more information.",n)):r&&r<0?i.error(new(0,k.BasisTheoryApiError)("The API is unreachable. Please check your connection or try again later.",r,t)):r&&r>=400?i.error(new(0,k.BasisTheoryApiError)("The API responded with status code ".concat(r,". Check error.data for more information."),r,t)):i.next(t),i.complete())}},{key:"onHttpClientResponse",value:function(e){var t=e.data,n=e.validationErrors,r=e.status,o=e.correlationId,i=e.headers,a=this.submitSubjects[o];a&&(n&&Object.keys(n).length?a.error(new(0,A.BasisTheoryValidationError)("There was a validation error that prevented submitting your request. Check error.details for more information.",n)):r&&r<0?a.error(new Sa("The API is unreachable. Please check your connection or try again later.",r,t)):r&&r>=400?a.error(new Sa("The API responded with status code ".concat(r,". Check error.data for more information."),r,t,i)):a.next(t),a.complete())}}]),r}(si),Ca=function(e){"use strict";C(n,e);var t=P(n);function n(){var e;return o(this,n),s(E(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 ns(e,t)}}]),n}(si),Ta=function(e){if(null==e)throw Zo.logger.error("BasisTheoryElements has not yet been properly initialized.",{errorType:"failureOnInit"}),new Error("BasisTheoryElements has not yet been properly initialized.");return e},Oa=function(e,t){var n=e.type,r=e.baseUrl,o=u[n];if(!o)throw Zo.logger.error("No route found for element of type ".concat(n,"."),{errorType:"noRouteFound"}),new Error("No route found for element of type ".concat(n,"."));return b(r,"elements",o,"?element_id=".concat(t))},_a=function(e){return!(!e||"object"!=typeof e)&&void 0!==Object.entries(e).find((function(e){var t=g(e,2)[1];return t instanceof si||_a(t)}))},Ra=function(e){if(e.length)return e[0].message},Pa=function(){var e=window.DataElement;if(!e)throw Zo.logger.error(d,{errorType:"noDataElement"}),new Error(d);return e},La=function(e,t){return t instanceof RegExp?"".concat("REGEXP__").concat(t.source):t};function Ia(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 ja,Aa,Da,Ma={},Ua=ja={};function Ba(){throw new Error("setTimeout has not been defined")}function qa(){throw new Error("clearTimeout has not been defined")}function Fa(e){if(Aa===setTimeout)return setTimeout(e,0);if((Aa===Ba||!Aa)&&setTimeout)return Aa=setTimeout,setTimeout(e,0);try{return Aa(e,0)}catch(t){try{return Aa.call(null,e,0)}catch(t){return Aa.call(this,e,0)}}}!function(){try{Aa="function"==typeof setTimeout?setTimeout:Ba}catch(e){Aa=Ba}try{Da="function"==typeof clearTimeout?clearTimeout:qa}catch(e){Da=qa}}();var Na,Ha=[],za=!1,Va=-1;function Ga(){za&&Na&&(za=!1,Na.length?Ha=Na.concat(Ha):Va=-1,Ha.length&&Ka())}function Ka(){if(!za){var e=Fa(Ga);za=!0;for(var t=Ha.length;t;){for(Na=Ha,Ha=[];++Va<t;)Na&&Na[Va].run();Va=-1,t=Ha.length}Na=null,za=!1,function(e){if(Da===clearTimeout)return clearTimeout(e);if((Da===qa||!Da)&&clearTimeout)return Da=clearTimeout,clearTimeout(e);try{return Da(e)}catch(t){try{return Da.call(null,e)}catch(t){return Da.call(this,e)}}}(e)}}function $a(e,t){this.fun=e,this.array=t}function Wa(){}Ua.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];Ha.push(new $a(e,t)),1!==Ha.length||za||Fa(Ka)},$a.prototype.run=function(){this.fun.apply(null,this.array)},Ua.title="browser",Ua.browser=!0,Ua.env={},Ua.argv=[],Ua.version="",Ua.versions={},Ua.on=Wa,Ua.addListener=Wa,Ua.once=Wa,Ua.off=Wa,Ua.removeListener=Wa,Ua.removeAllListeners=Wa,Ua.emit=Wa,Ua.prependListener=Wa,Ua.prependOnceListener=Wa,Ua.listeners=function(e){return[]},Ua.binding=function(e){throw new Error("process.binding is not supported")},Ua.cwd=function(){return"/"},Ua.chdir=function(e){throw new Error("process.chdir is not supported")},Ua.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 ja&&ja.versions&&ja.versions.node&&(e=n);var t=!e.JS_HTMLENCODE_NO_COMMON_JS&&Ma,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?Ma=u:(e.htmlEncode=a,e.htmlDecode=s,r&&define((function(){return u})))}();var Ja=function(e){if("object"!=typeof e||!e)return{};var t={};return Object.entries(e).forEach((function(e){var n=g(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]=w({index:i},a?{method:a}:{}))}})),t},Xa=function(e){if("object"==typeof e&&e){var t=Array.isArray(e)?[]:{};return Object.entries(e).forEach((function(e){var n=g(e,2),r=n[0],o=n[1];if(ma(o))t[r]="string"==typeof o?(0,Ma.htmlEncode)(o):o;else if("object"==typeof o)if(Array.isArray(o)&&0===o.length)t[r]=[];else{var i=Xa(o);i&&Object.keys(i).length>0&&(t[r]=i)}})),t}},Ya=function(e,t,n,o){var i=n[o];if(!t&&void 0===i)return i;if("regex"===e&&!(i instanceof RegExp)||"regex"!==e&&(void 0===i?"undefined":r(i))!==e)throw Zo.logger.error('"'.concat(String(o),'" should be a ').concat(e,"."),{errorType:"sanitizationFailure"}),new TypeError('"'.concat(String(o),'" should be a ').concat(e,"."));return i},Za=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 Zo.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.",{errorType:"sanitizationFailure"}),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.")},Qa=function(e){if(void 0!==e){if(!Array.isArray(e))throw Zo.logger.error("Mask is not an array",{errorType:"sanitizationFailure"}),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 Zo.logger.error("Mask has the following invalid chars: ".concat(t.join(", ")),{errorType:"sanitizationFailure"}),new TypeError("Mask has the following invalid chars: ".concat(t.join(", ")));return e}},es=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ya("boolean",!1,e,"disabled"),Ya("string",!1,e,"autoComplete"),Ya("boolean",!1,e,"validateOnChange"),Ya("boolean",!1,e,"enableCopy"),{validateOnChange:e.validateOnChange,enableCopy:e.enableCopy,style:e.style,disabled:e.disabled,autoComplete:e.autoComplete}},ts=function(e,t){return Ia(w({},es(t)),{value:t.value?{number:Ya("string",!1,t.value,"number"),expiration_month:Ya("number",!1,t.value,"expiration_month"),expiration_year:Ya("number",!1,t.value,"expiration_year"),cvc:Ya("string",!1,t.value,"cvc")}:void 0})},ns=function(e,t){return Ia(w({},es(t),"create"===e?{targetId:Ya("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:Ya("string",!1,t,"placeholder"),password:Ya("boolean",!1,t,"password"),mask:"create"===e?Qa(t.mask):void 0,transform:Za(t.transform),ariaLabel:Ya("string",!1,t,"aria-label"),autoComplete:Ya("string",!1,t,"autoComplete"),value:Ya("string",!1,t,"value"),validation:Ya("regex",!1,t,"validation")})},rs=function(e,t){return Ia(w({},es(t),"create"===e?{targetId:Ya("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:Ya("string",!1,t,"placeholder"),ariaLabel:Ya("string",!1,t,"aria-label"),autoComplete:Ya("string",!1,t,"autoComplete"),value:t.value&&"object"==typeof t.value?{month:Ya("number",!1,t.value,"month"),year:Ya("number",!1,t.value,"year")}:Ya("string",!1,t,"value")})},os=function(e,t){return Ia(w({},es(t),"create"===e?{targetId:Ya("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:Ya("string",!1,t,"placeholder"),ariaLabel:Ya("string",!1,t,"aria-label"),iconPosition:Ya("string",!1,t,"iconPosition"),autoComplete:Ya("string",!1,t,"autoComplete"),value:Ya("string",!1,t,"value")})},is=function(e,t){return Ia(w({},es(t),"create"===e?{targetId:Ya("string",!0,null!=t?t:{},"targetId")}:{}),{placeholder:Ya("string",!1,t,"placeholder"),ariaLabel:Ya("string",!1,t,"aria-label"),cardBrand:Ya("string",!1,t,"cardBrand"),autoComplete:Ya("string",!1,t,"autoComplete"),value:Ya("string",!1,t,"value")})};function as(e){if(Array.isArray(e))return y(e)}function ss(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function us(e){return as(e)||v(e)||m(e)||ss()}function cs(e){var t=function(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=t};return(t.prototype=new Error).name=e,t.prototype.constructor=t,t}for(var ls=cs("LaunchDarklyUnexpectedResponseError"),fs=cs("LaunchDarklyInvalidEnvironmentIdError"),ds=cs("LaunchDarklyInvalidUserError"),ps=cs("LaunchDarklyInvalidEventKeyError"),vs=cs("LaunchDarklyInvalidArgumentError"),hs=cs("LaunchDarklyFlagFetchError"),ys={LDUnexpectedResponseError:ls,LDInvalidEnvironmentIdError:fs,LDInvalidUserError:ds,LDInvalidEventKeyError:ps,LDInvalidArgumentError:vs,LDInvalidDataError:cs("LaunchDarklyInvalidDataError"),LDFlagFetchError:hs,isHttpErrorRecoverable:function(e){return!(e>=400&&e<500)||400===e||408===e||429===e}},ms=[],gs=[],bs="undefined"!=typeof Uint8Array?Uint8Array:Array,ws="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ks=0;ks<64;++ks)ms[ks]=ws[ks],gs[ws.charCodeAt(ks)]=ks;function Es(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function Ss(e,t,n){for(var r,o,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(ms[(o=r)>>18&63]+ms[o>>12&63]+ms[o>>6&63]+ms[63&o]);return i.join("")}gs["-".charCodeAt(0)]=62,gs["_".charCodeAt(0)]=63;var xs={byteLength:function(e){var t=Es(e),n=t[0],r=t[1];return 3*(n+r)/4-r},toByteArray:function(e){var t,n,r=Es(e),o=r[0],i=r[1],a=new bs(function(e,t,n){return 3*(t+n)/4-n}(0,o,i)),s=0,u=i>0?o-4:o;for(n=0;n<u;n+=4)t=gs[e.charCodeAt(n)]<<18|gs[e.charCodeAt(n+1)]<<12|gs[e.charCodeAt(n+2)]<<6|gs[e.charCodeAt(n+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=255&t;return 2===i&&(t=gs[e.charCodeAt(n)]<<2|gs[e.charCodeAt(n+1)]>>4,a[s++]=255&t),1===i&&(t=gs[e.charCodeAt(n)]<<10|gs[e.charCodeAt(n+1)]<<4|gs[e.charCodeAt(n+2)]>>2,a[s++]=t>>8&255,a[s++]=255&t),a},fromByteArray:function(e){for(var t,n=e.length,r=n%3,o=[],i=16383,a=0,s=n-r;a<s;a+=i)o.push(Ss(e,a,a+i>s?s:a+i));return 1===r?(t=e[n-1],o.push(ms[t>>2]+ms[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(ms[t>>10]+ms[t>>4&63]+ms[t<<2&63]+"=")),o.join("")}},Cs=Array.isArray,Ts=Object.keys,Os=Object.prototype.hasOwnProperty,_s=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,o,i,a=Cs(t),s=Cs(n);if(a&&s){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(a!=s)return!1;var u=t instanceof Date,c=n instanceof Date;if(u!=c)return!1;if(u&&c)return t.getTime()==n.getTime();var l=t instanceof RegExp,f=n instanceof RegExp;if(l!=f)return!1;if(l&&f)return t.toString()==n.toString();var d=Ts(t);if((o=d.length)!==Ts(n).length)return!1;for(r=o;0!=r--;)if(!Os.call(n,d[r]))return!1;for(r=o;0!=r--;)if(!e(t[i=d[r]],n[i]))return!1;return!0}return t!=t&&n!=n},Rs=["key","ip","country","email","firstName","lastName","avatar","name"];function Ps(e){var t=unescape(encodeURIComponent(e));return xs.fromByteArray(function(e){for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}(t))}function Ls(e){return Ps(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Is(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var js,As={appendUrlPath:function(e,t){return(e.endsWith("/")?e.substring(0,e.length-1):e)+(t.startsWith("/")?"":"/")+t},base64URLEncode:Ls,btoa:Ps,chunkEventsForUrl:function(e,t){for(var n,r=t.slice(0),o=[],i=e;r.length>0;){for(n=[];i>0;){var a=r.shift();if(!a)break;(i-=Ls(JSON.stringify(a)).length)<0&&n.length>0?r.unshift(a):n.push(a)}i=e,o.push(n)}return o},clone:function(e){return JSON.parse(JSON.stringify(e))},deepEquals:function(e,t){return _s(e,t)},extend:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce((function(e,t){return w({},e,t)}),{})},getLDUserAgentString:function(e){var t=e.version||"?";return e.userAgent+"/"+t},objectHasOwnProperty:Is,onNextTick:function(e){setTimeout(e,0)},sanitizeContext:function(e){return e?(null!==e.kind&&void 0!==e.kind||Rs.forEach((function(n){var r=e[n];void 0!==r&&"string"!=typeof r&&((t=t||w({},e))[n]=String(r))})),t||e):e;var t},transformValuesToVersionedValues:function(e){var t={};for(var n in e)Is(e,n)&&(t[n]={value:e[n],version:0});return t},transformVersionedValuesToValues:function(e){var t={};for(var n in e)Is(e,n)&&(t[n]=e[n].value);return t},wrapPromiseCallback:function(e,t){var n=e.then((function(e){return t&&setTimeout((function(){t(null,e)}),0),e}),(function(e){if(!t)return Promise.reject(e);setTimeout((function(){t(e,null)}),0)}));return t?void 0:n}},Ds=new Uint8Array(16);function Ms(){if(!js&&!(js="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 js(Ds)}var Us=/^(?:[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;function Bs(e){return"string"==typeof e&&Us.test(e)}for(var qs,Fs,Ns=[],Hs=0;Hs<256;++Hs)Ns.push((Hs+256).toString(16).substr(1));function zs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ns[e[t+0]]+Ns[e[t+1]]+Ns[e[t+2]]+Ns[e[t+3]]+"-"+Ns[e[t+4]]+Ns[e[t+5]]+"-"+Ns[e[t+6]]+Ns[e[t+7]]+"-"+Ns[e[t+8]]+Ns[e[t+9]]+"-"+Ns[e[t+10]]+Ns[e[t+11]]+Ns[e[t+12]]+Ns[e[t+13]]+Ns[e[t+14]]+Ns[e[t+15]]).toLowerCase();if(!Bs(n))throw TypeError("Stringified UUID is invalid");return n}var Vs=0,Gs=0;function Ks(e){if(!Bs(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}function $s(e,t,n){var r=function(e,r,o,i){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=Ks(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+e.length);if(a.set(r),a.set(e,r.length),(a=n(a))[6]=15&a[6]|t,a[8]=63&a[8]|128,o){i=i||0;for(var s=0;s<16;++s)o[i+s]=a[s];return o}return zs(a)};try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function Ws(e){return 14+(e+64>>>9<<4)+1}function Js(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function Xs(e,t,n,r,o,i){var a,s;return Js((a=Js(Js(t,e),Js(r,i)))<<(s=o)|a>>>32-s,n)}function Ys(e,t,n,r,o,i,a){return Xs(t&n|~t&r,e,t,o,i,a)}function Zs(e,t,n,r,o,i,a){return Xs(t&r|n&~r,e,t,o,i,a)}function Qs(e,t,n,r,o,i,a){return Xs(t^n^r,e,t,o,i,a)}function eu(e,t,n,r,o,i,a){return Xs(n^(t|~r),e,t,o,i,a)}var tu=$s("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){for(var t=[],n=32*e.length,r="0123456789abcdef",o=0;o<n;o+=8){var i=e[o>>5]>>>o%32&255,a=parseInt(r.charAt(i>>>4&15)+r.charAt(15&i),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Ws(t)-1]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,a=0;a<e.length;a+=16){var s=n,u=r,c=o,l=i;n=Ys(n,r,o,i,e[a],7,-680876936),i=Ys(i,n,r,o,e[a+1],12,-389564586),o=Ys(o,i,n,r,e[a+2],17,606105819),r=Ys(r,o,i,n,e[a+3],22,-1044525330),n=Ys(n,r,o,i,e[a+4],7,-176418897),i=Ys(i,n,r,o,e[a+5],12,1200080426),o=Ys(o,i,n,r,e[a+6],17,-1473231341),r=Ys(r,o,i,n,e[a+7],22,-45705983),n=Ys(n,r,o,i,e[a+8],7,1770035416),i=Ys(i,n,r,o,e[a+9],12,-1958414417),o=Ys(o,i,n,r,e[a+10],17,-42063),r=Ys(r,o,i,n,e[a+11],22,-1990404162),n=Ys(n,r,o,i,e[a+12],7,1804603682),i=Ys(i,n,r,o,e[a+13],12,-40341101),o=Ys(o,i,n,r,e[a+14],17,-1502002290),n=Zs(n,r=Ys(r,o,i,n,e[a+15],22,1236535329),o,i,e[a+1],5,-165796510),i=Zs(i,n,r,o,e[a+6],9,-1069501632),o=Zs(o,i,n,r,e[a+11],14,643717713),r=Zs(r,o,i,n,e[a],20,-373897302),n=Zs(n,r,o,i,e[a+5],5,-701558691),i=Zs(i,n,r,o,e[a+10],9,38016083),o=Zs(o,i,n,r,e[a+15],14,-660478335),r=Zs(r,o,i,n,e[a+4],20,-405537848),n=Zs(n,r,o,i,e[a+9],5,568446438),i=Zs(i,n,r,o,e[a+14],9,-1019803690),o=Zs(o,i,n,r,e[a+3],14,-187363961),r=Zs(r,o,i,n,e[a+8],20,1163531501),n=Zs(n,r,o,i,e[a+13],5,-1444681467),i=Zs(i,n,r,o,e[a+2],9,-51403784),o=Zs(o,i,n,r,e[a+7],14,1735328473),n=Qs(n,r=Zs(r,o,i,n,e[a+12],20,-1926607734),o,i,e[a+5],4,-378558),i=Qs(i,n,r,o,e[a+8],11,-2022574463),o=Qs(o,i,n,r,e[a+11],16,1839030562),r=Qs(r,o,i,n,e[a+14],23,-35309556),n=Qs(n,r,o,i,e[a+1],4,-1530992060),i=Qs(i,n,r,o,e[a+4],11,1272893353),o=Qs(o,i,n,r,e[a+7],16,-155497632),r=Qs(r,o,i,n,e[a+10],23,-1094730640),n=Qs(n,r,o,i,e[a+13],4,681279174),i=Qs(i,n,r,o,e[a],11,-358537222),o=Qs(o,i,n,r,e[a+3],16,-722521979),r=Qs(r,o,i,n,e[a+6],23,76029189),n=Qs(n,r,o,i,e[a+9],4,-640364487),i=Qs(i,n,r,o,e[a+12],11,-421815835),o=Qs(o,i,n,r,e[a+15],16,530742520),n=eu(n,r=Qs(r,o,i,n,e[a+2],23,-995338651),o,i,e[a],6,-198630844),i=eu(i,n,r,o,e[a+7],10,1126891415),o=eu(o,i,n,r,e[a+14],15,-1416354905),r=eu(r,o,i,n,e[a+5],21,-57434055),n=eu(n,r,o,i,e[a+12],6,1700485571),i=eu(i,n,r,o,e[a+3],10,-1894986606),o=eu(o,i,n,r,e[a+10],15,-1051523),r=eu(r,o,i,n,e[a+1],21,-2054922799),n=eu(n,r,o,i,e[a+8],6,1873313359),i=eu(i,n,r,o,e[a+15],10,-30611744),o=eu(o,i,n,r,e[a+6],15,-1560198380),r=eu(r,o,i,n,e[a+13],21,1309151649),n=eu(n,r,o,i,e[a+4],6,-145523070),i=eu(i,n,r,o,e[a+11],10,-1120210379),o=eu(o,i,n,r,e[a+2],15,718787259),r=eu(r,o,i,n,e[a+9],21,-343485551),n=Js(n,s),r=Js(r,u),o=Js(o,c),i=Js(i,l)}return[n,r,o,i]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(Ws(t)),r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))}));function nu(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function ru(e,t){return e<<t|e>>>32-t}var ou=$s("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o<r.length;++o)e.push(r.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var i=e.length/4+2,a=Math.ceil(i/16),s=new Array(a),u=0;u<a;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=e[64*u+4*l]<<24|e[64*u+4*l+1]<<16|e[64*u+4*l+2]<<8|e[64*u+4*l+3];s[u]=c}s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<a;++f){for(var d=new Uint32Array(80),p=0;p<16;++p)d[p]=s[f][p];for(var v=16;v<80;++v)d[v]=ru(d[v-3]^d[v-8]^d[v-14]^d[v-16],1);for(var h=n[0],y=n[1],m=n[2],g=n[3],b=n[4],w=0;w<80;++w){var k=Math.floor(w/20),E=ru(h,5)+nu(k,y,m,g)+b+t[k]+d[w]>>>0;b=g,g=m,m=ru(y,30)>>>0,y=h,h=E}n[0]=n[0]+h>>>0,n[1]=n[1]+y>>>0,n[2]=n[2]+m>>>0,n[3]=n[3]+g>>>0,n[4]=n[4]+b>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),iu=Object.freeze({__proto__:null,v1:function(e,t,n){var r=t&&n||0,o=t||new Array(16),i=(e=e||{}).node||qs,a=void 0!==e.clockseq?e.clockseq:Fs;if(null==i||null==a){var s=e.random||(e.rng||Ms)();null==i&&(i=qs=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=Fs=16383&(s[6]<<8|s[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Gs+1,l=u-Vs+(c-Gs)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||u>Vs)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Vs=u,Gs=c,Fs=a;var f=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=255&f;var d=u/4294967296*1e4&268435455;o[r++]=d>>>8&255,o[r++]=255&d,o[r++]=d>>>24&15|16,o[r++]=d>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var p=0;p<6;++p)o[r+p]=i[p];return t||zs(o)},v3:tu,v4:function(e,t,n){var r=(e=e||{}).random||(e.rng||Ms)();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 zs(r)},v5:ou,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!Bs(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:Bs,stringify:zs,parse:Ks}),au=["debug","info","warn","error","none"],su=function(e,t){var n=function(e){var t=au[e];if("none"!==t)if(e<u)l[t]=function(){};else{var n=e;l[t]=function(){o(n,t,arguments)}}},r=function(e){return function(t){console&&console[e]&&console[e].call(console,t)}},o=function(e,n,r){if(!(r.length<1)){var o,u=a?n+": "+s:s;if(1!==r.length&&t){var c=us(r);c[0]=u+c[0],o=t.apply(void 0,us(c))}else o=u+r[0];try{i[e](o)}catch(e){console&&console.log&&console.log("[LaunchDarkly] Configured logger's "+n+" method threw an exception: "+e)}}};if(e&&e.destination&&"function"!=typeof e.destination)throw new Error("destination for basicLogger was set to a non-function");var i=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[r("log"),r("info"),r("warn"),r("error")],a=!(!e||!e.destination),s=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:"[LaunchDarkly] ",u=1;if(e&&e.level)for(var c=0;c<au.length;c++)au[c]===e.level&&(u=c);for(var l={},f=0;f<au.length;f++)n(f);return l};function uu(e){return e&&e.message?e.message:"string"==typeof e||e instanceof String?e:JSON.stringify(e)}var cu=" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initializing-the-client for instructions on SDK initialization.",lu={bootstrapInvalid:function(){return"LaunchDarkly bootstrap data is not available because the back end could not read the flags."},bootstrapOldFormat:function(){return"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."+cu},clientInitialized:function(){return"LaunchDarkly client initialized"},clientNotReady:function(){return"LaunchDarkly client is not ready"},debugEnqueueingEvent:function(e){return'enqueueing "'+e+'" event'},debugPostingDiagnosticEvent:function(e){return"sending diagnostic event ("+e.kind+")"},debugPostingEvents:function(e){return"sending "+e+" events"},debugStreamDelete:function(e){return'received streaming deletion for flag "'+e+'"'},debugStreamDeleteIgnored:function(e){return'received streaming deletion for flag "'+e+'" but ignored due to version check'},debugStreamPatch:function(e){return'received streaming update for flag "'+e+'"'},debugStreamPatchIgnored:function(e){return'received streaming update for flag "'+e+'" but ignored due to version check'},debugStreamPing:function(){return"received ping message from stream"},debugPolling:function(e){return"polling for feature flags at "+e},debugStreamPut:function(){return"received streaming update for all flags"},deprecated:function(e,t){return t?'"'+e+'" is deprecated, please use "'+t+'"':'"'+e+'" is deprecated'},environmentNotFound:function(){return"Environment not found. Double check that you specified a valid environment/client-side ID."+cu},environmentNotSpecified:function(){return"No environment/client-side ID was specified."+cu},errorFetchingFlags:function(e){return"Error fetching flag settings: "+uu(e)},eventCapacityExceeded:function(){return"Exceeded event queue capacity. Increase capacity to avoid dropping events."},eventWithoutContext:function(){return"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript"},httpErrorMessage:function(e,t,n){return"Received error "+e+(401===e?" (invalid SDK key)":"")+" for "+t+" - "+(ys.isHttpErrorRecoverable(e)?n:"giving up permanently")},httpUnavailable:function(){return"Cannot make HTTP requests in this environment."+cu},identifyDisabled:function(){return"identify() has no effect here; it must be called on the main client instance"},inspectorMethodError:function(e,t){return'an inspector: "'.concat(t,'" of type: "').concat(e,'" generated an exception')},invalidContentType:function(e){return'Expected application/json content type but got "'+e+'"'},invalidData:function(){return"Invalid data received from LaunchDarkly; connection may have been interrupted"},invalidInspector:function(e,t){return'an inspector: "'.concat(t,'" of an invalid type (').concat(e,") was configured")},invalidKey:function(){return"Event key must be a string"},invalidContext:function(){return"Invalid context specified."+cu},invalidTagValue:function(e){return'Config option "'.concat(e,'" must only contain letters, numbers, ., _ or -.')},localStorageUnavailable:function(e){return"local storage is unavailable: "+uu(e)},networkError:function(e){return"network error"+(e?" ("+e+")":"")},optionBelowMinimum:function(e,t,n){return'Config option "'+e+'" was set to '+t+", changing to minimum value of "+n},streamClosing:function(){return"Closing stream connection"},streamConnecting:function(e){return"Opening stream connection to "+e},streamError:function(e,t){return"Error on stream connection: "+uu(e)+", will continue retrying after "+t+" milliseconds."},tagValueTooLong:function(e){return'Value of "'.concat(e,'" was longer than 64 characters and was discarded.')},unknownCustomEventKey:function(e){return'Custom event "'+e+'" does not exist'},unknownOption:function(e){return'Ignoring unknown config option "'+e+'"'},contextNotSpecified:function(){return"No context specified."+cu},unrecoverableStreamError:function(e){return"Error on stream connection ".concat(uu(e),", giving up permanently")},wrongOptionType:function(e,t,n){return'Config option "'+e+'" should be of type '+t+", got "+n+", using default value"},wrongOptionTypeBoolean:function(e,t){return'Config option "'+e+'" should be a boolean, got '+t+", converting to boolean"}},fu=function(e){au.forEach((function(t){if("none"!==t&&(!e[t]||"function"!=typeof e[t]))throw new Error("Provided logger instance must support logger."+t+"(...) method")}))},du={baseUrl:{default:"https://app.launchdarkly.com"},streamUrl:{default:"https://clientstream.launchdarkly.com"},eventsUrl:{default:"https://events.launchdarkly.com"},sendEvents:{default:!0},streaming:{type:"boolean"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:"function"},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributes:{default:[]},bootstrap:{type:"string|object"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:"string"},wrapperVersion:{type:"string"},stateProvider:{type:"object"},application:{validator:function(e,t,n){var r={};return t.id&&(r.id=hu("".concat(e,".id"),t.id,n)),t.version&&(r.version=hu("".concat(e,".version"),t.version,n)),r}},inspectors:{default:[]}},pu=/^(\w|\.|-)+$/;function vu(e){return e&&e.replace(/\/+$/,"")}function hu(e,t,n){if("string"==typeof t&&t.match(pu)){if(!(t.length>64))return t;n.warn(lu.tagValueTooLong(e))}else n.warn(lu.invalidTagValue(e))}var yu={baseOptionDefs:du,validate:function(e,t,n,o){var i=function(e){As.onNextTick((function(){t&&t.maybeReportError(new ys.LDInvalidArgumentError(e))}))},a=As.extend({logger:{default:o}},du,n),s={},u=As.extend({},e||{});return function(e){var t=e;Object.keys(s).forEach((function(e){if(void 0!==t[e]){var n=s[e];o&&o.warn(lu.deprecated(e,n)),n&&(void 0===t[n]&&(t[n]=t[e]),delete t[e])}}))}(u),u=function(e){var t=As.extend({},e);return Object.keys(a).forEach((function(e){void 0!==t[e]&&null!==t[e]||(t[e]=a[e]&&a[e].default)})),t}(u),u=function(e){var t=As.extend({},e),n=function(e){if(null===e)return"any";if(void 0!==e){if(Array.isArray(e))return"array";var t=void 0===e?"undefined":r(e);return"boolean"===t||"string"===t||"number"===t||"function"===t?t:"object"}};return Object.keys(e).forEach((function(r){var s=e[r];if(null!=s){var u=a[r];if(void 0===u)i(lu.unknownOption(r));else{var c=u.type||n(u.default),l=u.validator;if(l){var f=l(r,e[r],o);void 0!==f?t[r]=f:delete t[r]}else if("any"!==c){var d=c.split("|"),p=n(s);d.indexOf(p)<0?"boolean"===c?(t[r]=!!s,i(lu.wrongOptionTypeBoolean(r,p))):(i(lu.wrongOptionType(r,c,p)),t[r]=u.default):"number"===p&&void 0!==u.minimum&&s<u.minimum&&(i(lu.optionBelowMinimum(r,s,u.minimum)),t[r]=u.minimum)}}}})),t.baseUrl=vu(t.baseUrl),t.streamUrl=vu(t.streamUrl),t.eventsUrl=vu(t.eventsUrl),t}(u),fu(u.logger),u},getTags:function(e){var t={};return e&&(e.application&&void 0!==e.application.id&&null!==e.application.id&&(t["application-id"]=[e.application.id]),e.application&&void 0!==e.application.version&&null!==e.application.id&&(t["application-version"]=[e.application.version])),t}},mu=As.getLDUserAgentString,gu=function(e,t){if(t&&!t.sendLDHeaders)return{};var n={};n[e.userAgentHeaderName||"User-Agent"]=mu(e),t&&t.wrapperName&&(n["X-LaunchDarkly-Wrapper"]=t.wrapperVersion?t.wrapperName+"/"+t.wrapperVersion:t.wrapperName);var r=yu.getTags(t),o=Object.keys(r);return o.length&&(n["x-launchdarkly-tags"]=o.sort().map((function(e){return Array.isArray(r[e])?r[e].sort().map((function(t){return"".concat(e,"/").concat(t)})):["".concat(e,"/").concat(r[e])]})).reduce((function(e,t){return e.concat(t)}),[]).join(" ")),n},bu=function(e,t){return t&&t.requestHeaderTransform?t.requestHeaderTransform(w({},e)):e},wu=iu.v1,ku=gu,Eu=bu,Su=function(e,t,n){var r="/a/"+t+".gif",o=As.extend({"Content-Type":"application/json"},ku(e,n)),i=e.httpFallbackPing,a={sendChunk:function(t,a,s,u){var c=JSON.stringify(t),l=s?null:wu();return u?function t(r){var i=s?o:As.extend({},o,{"X-LaunchDarkly-Event-Schema":"4","X-LaunchDarkly-Payload-ID":l});return e.httpRequest("POST",a,Eu(i,n),c).promise.then((function(e){if(e)return e.status>=400&&ys.isHttpErrorRecoverable(e.status)&&r?t(!1):function(e){var t={status:e.status},n=e.header("date");if(n){var r=Date.parse(n);r&&(t.serverTime=r)}return t}(e)})).catch((function(){return r?t(!1):Promise.reject()}))}(!0).catch((function(){})):(i&&i(a+r+"?d="+As.base64URLEncode(c)),Promise.resolve())},sendEvents:function(t,n,r){if(!e.httpRequest)return Promise.resolve();var o,i=e.httpAllowsPost();o=i?[t]:As.chunkEventsForUrl(2e3-n.length,t);for(var s=[],u=0;u<o.length;u++)s.push(a.sendChunk(o[u],n,r,i));return Promise.all(s)}};return a},xu=su;function Cu(e){return"string"==typeof e&&"kind"!==e&&e.match(/^(\w|\.|-)+$/)}var Tu=function(e,t){if(e){if(t&&(void 0===e.kind||null===e.kind))return void 0!==e.key&&null!==e.key;var n=e.key,r=void 0===e.kind?"user":e.kind,o=Cu(r),i="multi"===r||null!=n&&""!==n;if("multi"===r){var a=Object.keys(e).filter((function(e){return"kind"!==e}));return i&&a.every((function(e){return Cu(e)}))&&a.every((function(t){var n=e[t].key;return null!=n&&""!==n}))}return i&&o}return!1},Ou=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xu();if(e){var n={},r=e.kind,o=e.key;switch(r){case void 0:n.user="".concat(o);break;case"multi":Object.entries(e).filter((function(e){return"kind"!==g(e,1)[0]})).forEach((function(e){var t=g(e,2),r=t[0],o=t[1];o&&o.key&&(n[r]=o.key)}));break;case null:t.warn("null is not a valid context kind: ".concat(e));break;case"":t.warn("'' is not a valid context kind: ".concat(e));break;default:n[r]="".concat(o)}return n}},_u=function(e){return e?null===e.kind||void 0===e.kind?["user"]:"multi"!==e.kind?[e.kind]:Object.keys(e).filter((function(e){return"kind"!==e})):[]},Ru=_u;function Pu(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Lu(e){return(e.startsWith("/")?e.substring(1):e).split("/").map((function(e){return e.indexOf("~")>=0?e.replace(/~1/g,"/").replace(/~0/g,"~"):e}))}function Iu(e){return!e.startsWith("/")}function ju(e,t){var n=Iu(e),r=Iu(t);if(n&&r)return e===t;if(n){var o=Lu(t);return 1===o.length&&e===o[0]}if(r){var i=Lu(e);return 1===i.length&&t===i[0]}return e===t}function Au(e){return"/".concat(Pu(e))}var Du={cloneExcluding:function(e,t){var n,r=[],o={},i=[];for((n=r).push.apply(n,us(Object.keys(e).map((function(t){return{key:t,ptr:Au(t),source:e,parent:o,visited:[e]}}))));r.length;){var a=r.pop();if(t.some((function(e){return ju(e,a.ptr)})))i.push(a.ptr);else{var s=a.source[a.key];if(null===s)a.parent[a.key]=s;else if(Array.isArray(s))a.parent[a.key]=us(s);else if("object"==typeof s){var u;if(a.visited.includes(s))continue;a.parent[a.key]={},(u=r).push.apply(u,us(Object.keys(s).map((function(e){var t,n;return{key:e,ptr:(t=a.ptr,n=Pu(e),"".concat(t,"/").concat(n)),source:s,parent:a.parent[a.key],visited:us(a.visited).concat([s])}}))))}else a.parent[a.key]=s}}return{cloned:o,excluded:i.sort()}},compare:ju,literalToReference:Au},Mu=Ou,Uu=function(e,t,n){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=function(){return 0===p||0===Math.floor(Math.random()*p)},s=function(e){m.length<v?(m.push(e),k=!1):(k||(k=!0,y.warn(lu.eventCapacityExceeded())),o&&o.incrementDroppedEvents())},u={},c=(arguments.length>5&&void 0!==arguments[5]?arguments[5]:null)||Su(e,n,t),l=As.appendUrlPath(t.eventsUrl,"/events/bulk/"+n),f=function(){var e={},t=0,n=0,r={},o={};return e.summarizeEvent=function(e){if("feature"===e.kind){var i=e.key+":"+(null!==e.variation&&void 0!==e.variation?e.variation:"")+":"+(null!==e.version&&void 0!==e.version?e.version:""),a=r[i],s=o[e.key];s||(s=new Set,o[e.key]=s),function(e){return e.context?Ru(e.context):e.contextKeys?Object.keys(e.contextKeys):[]}(e).forEach((function(e){return s.add(e)})),a?a.count=a.count+1:r[i]={count:1,key:e.key,version:e.version,variation:e.variation,value:e.value,default:e.default},(0===t||e.creationDate<t)&&(t=e.creationDate),e.creationDate>n&&(n=e.creationDate)}},e.getSummary=function(){var e={},i=!0,a=!0,s=!1,u=void 0;try{for(var c,l=Object.values(r)[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var f=c.value,d=e[f.key];d||(d={default:f.default,counters:[],contextKinds:us(o[f.key])},e[f.key]=d);var p={value:f.value,count:f.count};void 0!==f.variation&&null!==f.variation&&(p.variation=f.variation),void 0!==f.version&&null!==f.version?p.version=f.version:p.unknown=!0,d.counters.push(p),i=!1}}catch(e){s=!0,u=e}finally{try{a||null==l.return||l.return()}finally{if(s)throw u}}return i?null:{startDate:t,endDate:n,features:e}},e.clearSummary=function(){t=0,n=0,r={},o={}},e}(),d=function(e){var t={},n=e.allAttributesPrivate,r=e.privateAttributes||[],o=["key","kind","_meta","anonymous"],i=["name","ip","firstName","lastName","email","avatar","country"],a=function(e){if("object"==typeof e&&null!==e&&!Array.isArray(e)){var t=Du.cloneExcluding(e,function(e){return(n?Object.keys(e):us(r).concat(us(e._meta&&e._meta.privateAttributes||[]))).filter((function(e){return!o.some((function(t){return Du.compare(e,t)}))}))}(e)),i=t.cloned,a=t.excluded;return i.key=String(i.key),a.length&&(i._meta||(i._meta={}),i._meta.redactedAttributes=a),i._meta&&(delete i._meta.privateAttributes,0===Object.keys(i._meta).length&&delete i._meta),void 0!==i.anonymous&&(i.anonymous=!!i.anonymous),i}};return t.filter=function(e){return void 0===e.kind||null===e.kind?a(function(e){var t=Ia(w({},e.custom||{}),{kind:"user",key:e.key});void 0!==e.anonymous&&(t.anonymous=!!e.anonymous);var n=!0,r=!1,o=void 0;try{for(var a,s=i[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;delete t[u],void 0!==e[u]&&null!==e[u]&&(t[u]=String(e[u]))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return void 0!==e.privateAttributeNames&&null!==e.privateAttributeNames&&(t._meta=t._meta||{},t._meta.privateAttributes=e.privateAttributeNames.map((function(e){return e.startsWith("/")?Du.literalToReference(e):e}))),t}(e)):"multi"===e.kind?function(e){var t={kind:e.kind},n=Object.keys(e),r=!0,o=!1,i=void 0;try{for(var s,u=n[Symbol.iterator]();!(r=(s=u.next()).done);r=!0){var c=s.value;if("kind"!==c){var l=a(e[c]);l&&(t[c]=l)}}}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return t}(e):a(e)},t}(t),p=t.samplingInterval,v=t.eventCapacity,h=t.flushInterval,y=t.logger,m=[],g=0,b=!1,k=!1;return u.enqueue=function(e){if(!b){var t,n=!1,r=!1;if(f.summarizeEvent(e),"feature"===e.kind?a()&&(n=!!e.trackEvents,r=!!(t=e).debugEventsUntilDate&&t.debugEventsUntilDate>g&&t.debugEventsUntilDate>(new Date).getTime()):n=a(),n&&s(function(e){var t=As.extend({},e);return"identify"===e.kind?t.context=d.filter(e.context):(t.contextKeys=Mu(e.context,y),delete t.context),"feature"===e.kind&&(delete t.trackEvents,delete t.debugEventsUntilDate),t}(e)),r){var o=As.extend({},e,{kind:"debug"});o.context=d.filter(o.context),delete o.trackEvents,delete o.debugEventsUntilDate,s(o)}}},u.flush=function(){if(b)return Promise.resolve();var e=m,t=f.getSummary();return f.clearSummary(),t&&(t.kind="summary",e.push(t)),o&&o.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(m=[],y.debug(lu.debugPostingEvents(e.length)),c.sendEvents(e,l).then((function(e){var t=e&&e[0];t&&(t.serverTime&&(g=t.serverTime),ys.isHttpErrorRecoverable(t.status)||(b=!0),t.status>=400&&As.onNextTick((function(){i.maybeReportError(new ys.LDUnexpectedResponseError(lu.httpErrorMessage(t.status,"event posting","some events were dropped")))})))})))},u.start=function(){var e=function(){u.flush(),r=setTimeout(e,h)};r=setTimeout(e,h)},u.stop=function(){clearTimeout(r)},u},Bu="ready",qu="initialized",Fu="failed",Nu=As.appendUrlPath,Hu=As.base64URLEncode,zu=As.objectHasOwnProperty,Vu=gu,Gu=bu,Ku=ys.isHttpErrorRecoverable,$u=function(e,t,n,r){var o,i=function(e){if(e.status&&"number"==typeof e.status&&!Ku(e.status))return u(),f.error(lu.unrecoverableStreamError(e)),void(w&&(clearTimeout(w),w=null));var t=function(){var e,t=(e=function(){var e=y*Math.pow(2,x);return e>3e4?3e4:e}(),e-Math.trunc(.5*Math.random()*e));return x+=1,t}();g||(f.warn(lu.streamError(e,t)),g=!0),c(!1),u(),a(t)},a=function(e){w||(e?w=setTimeout(s,e):s())},s=function(){var r;w=null;var a="",s={headers:m,readTimeoutMillis:3e5};if(e.eventSourceFactory){for(var c in null!=E&&(a="h="+E),v?e.eventSourceAllowsReport?(r=p,s.method="REPORT",s.headers["Content-Type"]="application/json",s.body=JSON.stringify(k)):(r=Nu(l,"/ping/"+n),a=""):r=p+"/"+Hu(JSON.stringify(k)),s.headers=Gu(s.headers,t),h&&(a=a+(a?"&":"")+"withReasons=true"),r=r+(a?"?":"")+a,u(),f.info(lu.streamConnecting(r)),o=(new Date).getTime(),b=e.eventSourceFactory(r,s),S)zu(S,c)&&b.addEventListener(c,S[c]);b.onerror=i,b.onopen=function(){x=0}}},u=function(){b&&(f.info(lu.streamClosing()),b.close(),b=null)},c=function(e){o&&r&&r.recordStreamInit(o,!e,(new Date).getTime()-o),o=null},l=t.streamUrl,f=t.logger,d={},p=Nu(l,"/eval/"+n),v=t.useReport,h=t.evaluationReasons,y=t.streamReconnectDelay,m=Vu(e,t),g=!1,b=null,w=null,k=null,E=null,S=null,x=0;return d.connect=function(e,t,n){var r=function(e){S[e]=function(t){g=!1,c(!0),n[e]&&n[e](t)}};for(var o in k=e,E=t,S={},n||{})r(o);a()},d.disconnect=function(){clearTimeout(w),w=null,u()},d.isConnected=function(){return!!(b&&e.eventSourceIsActive&&e.eventSourceIsActive(b))},d},Wu=bu,Ju=gu,Xu="application/json",Yu=function(e,t,n){var r=function(n,r){if(!e.httpRequest)return new Promise((function(e,t){t(new ys.LDFlagFetchError(lu.httpUnavailable()))}));var o=r?"REPORT":"GET",i=Ju(e,t);r&&(i["Content-Type"]=Xu);var a=c[n];a||(a=function(e){var t,n,r,o,i={addPromise:function(i,a){t=i,n&&n(),n=a,i.then((function(n){t===i&&(r(n),e&&e())}),(function(n){t===i&&(o(n),e&&e())}))}};return i.resultPromise=new Promise((function(e,t){r=e,o=t})),i}((function(){delete c[n]})),c[n]=a);var s=e.httpRequest(o,n,Wu(i,t),r),u=s.promise.then((function(e){if(200===e.status){if(e.header("content-type")&&e.header("content-type").substring(0,16)===Xu)return JSON.parse(e.body);var t=lu.invalidContentType(e.header("content-type")||"");return Promise.reject(new ys.LDFlagFetchError(t))}return Promise.reject(function(e){return 404===e.status?new ys.LDInvalidEnvironmentIdError(lu.environmentNotFound()):new ys.LDFlagFetchError(lu.errorFetchingFlags(e.statusText||String(e.status)))}(e))}),(function(e){return Promise.reject(new ys.LDFlagFetchError(lu.networkError(e)))}));return a.addPromise(u,(function(){s.cancel&&s.cancel()})),a.resultPromise},o=t.baseUrl,i=t.useReport,a=t.evaluationReasons,s=t.logger,u={},c={};return u.fetchJSON=function(e){return r(As.appendUrlPath(o,e),null)},u.fetchFlagSettings=function(e,t){var u,c,l,f="";return i?(c=[o,"/sdk/evalx/",n,"/context"].join(""),l=JSON.stringify(e)):(u=As.base64URLEncode(JSON.stringify(e)),c=[o,"/sdk/evalx/",n,"/contexts/",u].join("")),t&&(f="h="+t),a&&(f=f+(f?"&":"")+"withReasons=true"),c=c+(f?"?":"")+f,s.debug(lu.debugPolling(c)),r(c,l)},u},Zu=iu.v1,Qu=_u,ec=function(e){var t=function(e){return null==e||"user"===e?"ld:$anonUserId":"ld:$contextKey:".concat(e)},n=function(n,r){return null!==r.key&&void 0!==r.key?(r.key=r.key.toString(),Promise.resolve(r)):r.anonymous?function(n){return e.get(t(n))}(n).then((function(o){if(o)return r.key=o,r;var i=Zu();return r.key=i,function(n,r){return e.set(t(r),n)}(i,n).then((function(){return r}))})):Promise.reject(new ys.LDInvalidUserError(lu.invalidContext()))};this.processContext=function(e){if(!e)return Promise.reject(new ys.LDInvalidUserError(lu.contextNotSpecified()));var t=As.clone(e);if("multi"===e.kind){var r=Qu(t);return Promise.all(r.map((function(e){return n(e,t[e])}))).then((function(){return t}))}return n(e.kind,t)}},tc=iu.v1,nc=yu.baseOptionDefs,rc=As.appendUrlPath,oc=function(e){var t={diagnosticId:tc()};return e&&(t.sdkKeySuffix=e.length>6?e.substring(e.length-6):e),t},ic=function(e){var t,n,r,o,i=function(e){t=e,n=0,r=0,o=[]};return i(e),{getProps:function(){return{dataSinceDate:t,droppedEvents:n,eventsInLastBatch:r,streamInits:o}},setProps:function(e){t=e.dataSinceDate,n=e.droppedEvents||0,r=e.eventsInLastBatch||0,o=e.streamInits||[]},incrementDroppedEvents:function(){n++},setEventsInLastBatch:function(e){r=e},recordStreamInit:function(e,t,n){var r={timestamp:e,failed:t,durationMillis:n};o.push(r)},reset:i}},ac=function(e,t,n,r,o,i,a){var s,u,c=function(){return{sdk:f(),configuration:d(),platform:e.diagnosticPlatformData}},l=function(e){i.logger&&i.logger.debug(lu.debugPostingDiagnosticEvent(e)),r.sendEvents(e,h,!0).then((function(){})).catch((function(){}))},f=function(){var t=w({},e.diagnosticSdkData);return i.wrapperName&&(t.wrapperName=i.wrapperName),i.wrapperVersion&&(t.wrapperVersion=i.wrapperVersion),t},d=function(){return{customBaseURI:i.baseUrl!==nc.baseUrl.default,customStreamURI:i.streamUrl!==nc.streamUrl.default,customEventsURI:i.eventsUrl!==nc.eventsUrl.default,eventsCapacity:i.eventCapacity,eventsFlushIntervalMillis:i.flushInterval,reconnectTimeMillis:i.streamReconnectDelay,streamingDisabled:!g,allAttributesPrivate:!!i.allAttributesPrivate,diagnosticRecordingIntervalMillis:i.diagnosticRecordingInterval,usingSecureMode:!!i.hash,bootstrapMode:!!i.bootstrap,fetchGoalsDisabled:!i.fetchGoals,sendEventsOnlyForVariation:!!i.sendEventsOnlyForVariation}},p=!!e.diagnosticUseCombinedEvent,v="ld:"+o+":$diagnostics",h=rc(i.eventsUrl,"/events/diagnostic/"+o),y=i.diagnosticRecordingInterval,m=n,g=!!i.streaming,b={};function k(){l(function(){var e=(new Date).getTime(),t=w({kind:p?"diagnostic-combined":"diagnostic",id:a,creationDate:e},m.getProps());return p&&(t=w({},t,c())),m.reset(e),t}()),u=setTimeout(k,y),s=(new Date).getTime(),p&&function(){if(t.isEnabled()){var e=w({},m.getProps());t.set(v,JSON.stringify(e))}}()}return b.start=function(){p?function(e){if(!t.isEnabled())return e(!1);t.get(v).then((function(t){if(t)try{var n=JSON.parse(t);m.setProps(n),s=n.dataSinceDate}catch(e){}e(!0)})).catch((function(){e(!1)}))}((function(e){if(e){var t=(s||0)+y,n=(new Date).getTime();n>=t?k():u=setTimeout(k,t-n)}else 0===Math.floor(4*Math.random())?k():u=setTimeout(k,y)})):(l(w({kind:"diagnostic-init",id:a,creationDate:m.getProps().dataSinceDate},c())),u=setTimeout(k,y))},b.stop=function(){u&&clearTimeout(u)},b.setStreaming=function(e){g=e},b},sc=As.onNextTick,uc={flagUsed:"flag-used",flagDetailsChanged:"flag-details-changed",flagDetailChanged:"flag-detail-changed",clientIdentityChanged:"client-identity-changed"};Object.freeze(uc);var cc=function(e,t){var n,r={},o=(s(n={},uc.flagUsed,[]),s(n,uc.flagDetailsChanged,[]),s(n,uc.flagDetailChanged,[]),s(n,uc.clientIdentityChanged,[]),n),i=e&&e.map((function(e){return function(e,t){var n=!1,r={type:e.type,name:e.name,method:function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];try{var s;(s=e).method.apply(s,us(i))}catch(e){n||(n=!0,t.warn(lu.inspectorMethodError(r.type,r.name)))}}};return r}(e,t)}));return i&&i.forEach((function(e){Object.prototype.hasOwnProperty.call(o,e.type)?o[e.type].push(e):t.warn(lu.invalidInspector(e.type,e.name))})),r.hasListeners=function(e){return o[e]&&o[e].length},r.onFlagUsed=function(e,t,n){o[uc.flagUsed].length&&sc((function(){o[uc.flagUsed].forEach((function(r){return r.method(e,t,n)}))}))},r.onFlags=function(e){o[uc.flagDetailsChanged].length&&sc((function(){o[uc.flagDetailsChanged].forEach((function(t){return t.method(e)}))}))},r.onFlagChanged=function(e,t){o[uc.flagDetailChanged].length&&sc((function(){o[uc.flagDetailChanged].forEach((function(n){return n.method(e,t)}))}))},r.onIdentityChanged=function(e){o[uc.clientIdentityChanged].length&&sc((function(){o[uc.clientIdentityChanged].forEach((function(t){return t.method(e)}))}))},r},lc=su,fc=Tu,dc=uc,pc=cc,vc="change",hc="internal-change",yc={initialize:function(e,t,n,r,o){var i,a,s,u=function(e){I&&(W&&W.enqueueEvent&&W.enqueueEvent(e)||(e.context?($=!1,!L||K||r.isDoNotTrack()||(T.debug(lu.debugEnqueueingEvent(e.kind)),N.enqueue(e))):$&&(T.warn(lu.eventWithoutContext()),$=!1)))},c=function(e,t){P.hasListeners(dc.flagDetailChanged)&&P.onFlagChanged(e.key,v(t))},l=function(){P.hasListeners(dc.flagDetailsChanged)&&P.onFlags(Object.entries(z).map((function(e){var t=g(e,2),n=t[0],r=t[1];return{key:n,detail:v(r)}})).reduce((function(e,t){return e[t.key]=t.detail,e}),{}))},f=function(e,t,n,r){var o=J.getContext(),i=new Date,a={kind:"feature",key:e,context:o,value:t?t.value:null,variation:t?t.variationIndex:null,default:n,creationDate:i.getTime()},s=z[e];s&&(a.version=s.flagVersion?s.flagVersion:s.version,a.trackEvents=s.trackEvents,a.debugEventsUntilDate=s.debugEventsUntilDate),(r||s&&s.trackReason)&&t&&(a.reason=t.reason),u(a)},d=function(e){return fc(e,!1)?Promise.resolve(e):Promise.reject(new ys.LDInvalidUserError(lu.invalidContext()))},p=function(e,t,n,r,o){var i;if(z&&As.objectHasOwnProperty(z,e)&&z[e]&&!z[e].deleted){var a=z[e];i=v(a),null!==a.value&&void 0!==a.value||(i.value=t)}else i={value:t,variationIndex:null,reason:{kind:"ERROR",errorKind:"FLAG_NOT_FOUND"}};return n&&f(e,i,t,r),o||function(e,t){P.hasListeners(dc.flagUsed)&&P.onFlagUsed(e,t,J.getContext())}(e,i),i},v=function(e){return{value:e.value,variationIndex:void 0===e.variation?null:e.variation,reason:e.reason||null}},h=function(){if(a=!0,J.getContext()){var e=function(e){try{return JSON.parse(e)}catch(e){return void O.maybeReportError(new ys.LDInvalidDataError(lu.invalidData()))}};F.connect(J.getContext(),j,{ping:function(){T.debug(lu.debugStreamPing());var e=J.getContext();H.fetchFlagSettings(e,j).then((function(t){As.deepEquals(e,J.getContext())&&m(t||{})})).catch((function(e){O.maybeReportError(new ys.LDFlagFetchError(lu.errorFetchingFlags(e)))}))},put:function(t){var n=e(t.data);n&&(T.debug(lu.debugStreamPut()),m(n))},patch:function(t){var n=e(t.data);if(n){var r=z[n.key];if(!r||!r.version||!n.version||r.version<n.version){T.debug(lu.debugStreamPatch(n.key));var o={},i=As.extend({},n);delete i.key,z[n.key]=i;var a=v(i);o[n.key]=r?{previous:r.value,current:a}:{current:a},b(o),c(n,i)}else T.debug(lu.debugStreamPatchIgnored(n.key))}},delete:function(t){var n=e(t.data);if(n)if(!z[n.key]||z[n.key].version<n.version){T.debug(lu.debugStreamDelete(n.key));var r={};z[n.key]&&!z[n.key].deleted&&(r[n.key]={previous:z[n.key].value}),z[n.key]={version:n.version,deleted:!0},c(n,z[n.key]),b(r)}else T.debug(lu.debugStreamDeleteIgnored(n.key))}})}},y=function(){a&&(F.disconnect(),a=!1)},m=function(e){var t={};if(!e)return Promise.resolve();for(var n in z)As.objectHasOwnProperty(z,n)&&z[n]&&(e[n]&&!As.deepEquals(e[n].value,z[n].value)?t[n]={previous:z[n].value,current:v(e[n])}:e[n]&&!e[n].deleted||(t[n]={previous:z[n].value}));for(var r in e)As.objectHasOwnProperty(e,r)&&e[r]&&(!z[r]||z[r].deleted)&&(t[r]={current:v(e[r])});return z=w({},e),l(),b(t).catch((function(){}))},b=function(e){var t=Object.keys(e);if(t.length>0){var n={};t.forEach((function(t){var r=e[t].current,o=r?r.value:void 0,i=e[t].previous;O.emit(vc+":"+t,o,i),n[t]=r?{current:o,previous:i}:{previous:i}})),O.emit(vc,n),O.emit(hc,z),R.sendEventsOnlyForVariation||W||t.forEach((function(t){f(t,e[t].current)}))}return i&&Y?Y.saveFlags(z):Promise.resolve()},k=function(){var e=V||s&&void 0===V;e&&!a?h():!e&&a&&y(),q&&q.setStreaming(e)},E=function(e){return e===vc||e.substr(0,7)===vc+":"},S=function(e){I=e.environment,J.setContext(e.context),z=w({},e.flags),As.onNextTick(x)},x=function(){T.info(lu.clientInitialized()),G=!0,k(),_.signalSuccess()},C=function(e){_.signalFailure(e)},T=n&&n.logger?n.logger:o&&o.logger&&o.logger.default||lc("warn"),O=function(e){var t={},n={};return t.on=function(e,t,r){n[e]=n[e]||[],n[e]=n[e].concat({handler:t,context:r})},t.off=function(e,t,r){if(n[e])for(var o=0;o<n[e].length;o++)n[e][o].handler===t&&n[e][o].context===r&&(n[e]=n[e].slice(0,o).concat(n[e].slice(o+1)))},t.emit=function(e){if(n[e])for(var t=n[e].slice(0),r=0;r<t.length;r++)t[r].handler.apply(t[r].context,Array.prototype.slice.call(arguments,1))},t.getEvents=function(){return Object.keys(n)},t.getEventListenerCount=function(e){return n[e]?n[e].length:0},t.maybeReportError=function(t){t&&(n.error?this.emit("error",t):(e||console).error(t.message))},t}(T),_=function(e){var t=!1,n=!1,r=null,o=null,i=new Promise((function(t){var n=function(){e.off(Bu,n),t()};e.on(Bu,n)})).catch((function(){}));return{getInitializationPromise:function(){return o||(t?Promise.resolve():n?Promise.reject(r):(o=new Promise((function(t,n){var r=function(){e.off(qu,r),t()},o=function(t){e.off(Fu,o),n(t)};e.on(qu,r),e.on(Fu,o)})),o))},getReadyPromise:function(){return i},signalSuccess:function(){t||n||(t=!0,e.emit(qu),e.emit(Bu))},signalFailure:function(o){t||n||(n=!0,r=o,e.emit(Fu,o),e.emit(Bu)),e.maybeReportError(o)}}}(O),R=yu.validate(n,O,o,T),P=pc(R.inspectors,T),L=R.sendEvents,I=e,j=R.hash,A=function(e,t){var n={},r=!1,o=function(e){r||(r=!0,t.warn(lu.localStorageUnavailable(e)))};return n.isEnabled=function(){return!!e},n.get=function(t){return new Promise((function(n){e?e.get(t).then(n).catch((function(e){o(e),n(void 0)})):n(void 0)}))},n.set=function(t,n){return new Promise((function(r){e?e.set(t,n).then((function(){return r(!0)})).catch((function(e){o(e),r(!1)})):r(!1)}))},n.clear=function(t){return new Promise((function(n){e?e.clear(t).then((function(){return n(!0)})).catch((function(e){o(e),n(!1)})):n(!1)}))},n}(r.localStorage,T),D=Su(r,I,R),M=R.sendEvents&&!R.diagnosticOptOut,U=M?oc(I):null,B=M?ic((new Date).getTime()):null,q=M?ac(r,A,B,D,I,R,U):null,F=$u(r,R,I,B),N=R.eventProcessor||Uu(r,R,I,B,O,D),H=Yu(r,R,I),z={},V=R.streaming,G=!1,K=!1,$=!0,W=R.stateProvider,J=function(e,t){var n,r={};return r.setContext=function(e){(n=As.sanitizeContext(e))&&t&&t(As.clone(n))},r.getContext=function(){return n?As.clone(n):null},e&&r.setContext(e),r}(null,(function(e){(function(e){W||e&&u({kind:"identify",context:e,creationDate:(new Date).getTime()})})(e),P.hasListeners(dc.clientIdentityChanged)&&P.onIdentityChanged(J.getContext())})),X=new ec(A),Y=A.isEnabled()?function(e,t,n,r){var o=function(){var e="",o=r.getContext();return o&&(e=n||As.btoa(JSON.stringify(o))),"ld:"+t+":"+e},i={loadFlags:function(){return e.get(o()).then((function(e){if(null==e)return null;try{var t=JSON.parse(e);if(t){var n=t.$schema;void 0===n||n<1?t=As.transformValuesToVersionedValues(t):delete t.$schema}return t}catch(e){return i.clearFlags().then((function(){return null}))}}))},saveFlags:function(t){var n=As.extend({},t,{$schema:1});return e.set(o(),JSON.stringify(n))},clearFlags:function(){return e.clear(o())}};return i}(A,I,j,J):null;if("string"==typeof R.bootstrap&&"LOCALSTORAGE"===R.bootstrap.toUpperCase()&&(Y?i=!0:T.warn(lu.localStorageUnavailable())),"object"==typeof R.bootstrap&&(z=function(e){var t=Object.keys(e),n="$flagsState",r="$valid",o=e[n];!o&&t.length&&T.warn(lu.bootstrapOldFormat()),!1===e[r]&&T.warn(lu.bootstrapInvalid());var i={};return t.forEach((function(t){if(t!==n&&t!==r){var a={value:e[t]};o&&o[t]?a=As.extend(a,o[t]):a.version=0,i[t]=a}})),i}(R.bootstrap)),W){var Z=W.getInitialState();Z?S(Z):W.on("init",S),W.on("update",(function(e){e.context&&J.setContext(e.context),e.flags&&m(e.flags)}))}else(e?X.processContext(t).then(d).then((function(e){return J.setContext(e),"object"==typeof R.bootstrap?x():i?Y.loadFlags().then((function(e){return null==e?(z={},H.fetchFlagSettings(J.getContext(),j).then((function(e){return m(e||{})})).then(x).catch((function(e){C(new ys.LDFlagFetchError(lu.errorFetchingFlags(e)))}))):(z=e,As.onNextTick(x),H.fetchFlagSettings(J.getContext(),j).then((function(e){return m(e)})).catch((function(e){return O.maybeReportError(e)})))})):H.fetchFlagSettings(J.getContext(),j).then((function(e){z=e||{},l(),x()})).catch((function(e){z={},C(e)}))})):Promise.reject(new ys.LDInvalidEnvironmentIdError(lu.environmentNotSpecified()))).catch(C);var Q={waitForInitialization:function(){return _.getInitializationPromise()},waitUntilReady:function(){return _.getReadyPromise()},identify:function(e,t,n){if(K)return As.wrapPromiseCallback(Promise.resolve({}),n);if(W)return T.warn(lu.identifyDisabled()),As.wrapPromiseCallback(Promise.resolve(As.transformVersionedValuesToValues(z)),n);var r=i&&Y?Y.clearFlags():Promise.resolve();return As.wrapPromiseCallback(r.then((function(){return X.processContext(e)})).then(d).then((function(e){return H.fetchFlagSettings(e,t).then((function(n){var r=As.transformVersionedValuesToValues(n);return J.setContext(e),j=t,n?m(n).then((function(){return r})):r}))})).then((function(e){return a&&h(),e})).catch((function(e){return O.maybeReportError(e),Promise.reject(e)})),n)},getContext:function(){return J.getContext()},variation:function(e,t){return p(e,t,!0,!1,!1).value},variationDetail:function(e,t){return p(e,t,!0,!0,!1)},track:function(e,t,n){if("string"==typeof e){r.customEventFilter&&!r.customEventFilter(e)&&T.warn(lu.unknownCustomEventKey(e));var o=J.getContext(),i={kind:"custom",key:e,context:o,url:r.getCurrentUrl(),creationDate:(new Date).getTime()};o&&o.anonymous&&(i.contextKind=o.anonymous?"anonymousUser":"user"),null!=t&&(i.data=t),null!=n&&(i.metricValue=n),u(i)}else O.maybeReportError(new ys.LDInvalidEventKeyError(lu.unknownCustomEventKey(e)))},on:function(e,t,n){var r;E(e)?(s=!0,G&&k(),O.on(e,t,n)):(r=O).on.apply(r,arguments)},off:function(e){var t;if((t=O).off.apply(t,arguments),E(e)){var n=!1;O.getEvents().forEach((function(e){E(e)&&O.getEventListenerCount(e)>0&&(n=!0)})),n||(s=!1,a&&void 0===V&&y())}},setStreaming:function(e){var t=null===e?void 0:e;t!==V&&(V=t,k())},flush:function(e){return As.wrapPromiseCallback(L?N.flush():Promise.resolve(),e)},allFlags:function(){var e={};if(!z)return e;for(var t in z)As.objectHasOwnProperty(z,t)&&!z[t].deleted&&(e[t]=p(t,null,!R.sendEventsOnlyForVariation,!1,!0).value);return e},close:function(e){if(K)return As.wrapPromiseCallback(Promise.resolve(),e);var t=function(){K=!0,z={}},n=Promise.resolve().then((function(){if(y(),q&&q.stop(),L)return N.stop(),N.flush()})).then(t).catch(t);return As.wrapPromiseCallback(n,e)}};return{client:Q,options:R,emitter:O,ident:J,logger:T,requestor:H,start:function(){L&&(q&&q.start(),N.start())},enqueueEvent:u,getFlagsInternal:function(){return z},getEnvironmentId:function(){return I},internalChangeEventName:hc}},commonBasicLogger:lc,errors:ys,messages:lu,utils:As,getContextKeys:Ou},mc=yc.initialize,gc=yc.errors,bc=yc.getContextKeys;function wc(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}function kc(e){for(var t=arguments,n=function(n){var o=null!=t[n]?t[n]:{};n%2?wc(Object(o),!0).forEach((function(t){!function(e,t,n){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==(void 0===t?"undefined":r(t))?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):wc(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))},o=1;o<arguments.length;o++)n(o);return e}var Ec={promise:Promise.resolve({status:200,header:function(){return null},body:null})};var Sc=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};function xc(e,t,n,r){var o,i,a=("substring"!==e.kind&&"regex"!==e.kind||!r.includes("/")?t.replace(r,""):t).replace(n,"");switch(e.kind){case"exact":i=t,o=new RegExp("^"+Sc(e.url)+"/?$");break;case"canonical":i=a,o=new RegExp("^"+Sc(e.url)+"/?$");break;case"substring":i=a,o=new RegExp(".*"+Sc(e.substring)+".*$");break;case"regex":i=a,o=new RegExp(e.pattern);break;default:return!1}return o.test(i)}function Cc(e,t){for(var n={},r=null,o=[],i=0;i<e.length;i++)for(var a=e[i],s=a.urls||[],u=0;u<s.length;u++)if(xc(s[u],window.location.href,window.location.search,window.location.hash)){"pageview"===a.kind?t("pageview",a):(o.push(a),t("click_pageview",a));break}return o.length>0&&(r=function(e){for(var n=function(e,t){for(var n=[],r=0;r<t.length;r++)for(var o=e.target,i=t[r],a=i.selector,s=document.querySelectorAll(a);o&&s.length>0;){for(var u=0;u<s.length;u++)o===s[u]&&n.push(i);o=o.parentNode}return n}(e,o),r=0;r<n.length;r++)t("click",n[r])},document.addEventListener("click",r)),n.dispose=function(){document.removeEventListener("click",r)},n}var Tc=300;var Oc="goalsReady",_c={fetchGoals:{default:!0},hash:{type:"string"},eventProcessor:{type:"object"},eventUrlTransformer:{type:"function"},disableSyncEventPost:{default:!1}};function Rc(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=function(e){var t,n={userAgentHeaderName:"X-LaunchDarkly-User-Agent",synchronousFlush:!1};if(window.XMLHttpRequest){var r=e&&e.disableSyncEventPost;n.httpRequest=function(e,t,o,i){var a=n.synchronousFlush&!r;return n.synchronousFlush=!1,function(e,t,n,r,o){if(o&&!function(){var e=window.navigator&&window.navigator.userAgent;if(e){var t=e.match(/Chrom(e|ium)\/([0-9]+)\./);if(t)return parseInt(t[2],10)<73}return!0}())return Ec;var i=new window.XMLHttpRequest;for(var a in i.open(e,t,!o),n||{})Object.prototype.hasOwnProperty.call(n,a)&&i.setRequestHeader(a,n[a]);if(o)return i.send(r),Ec;var s,u=new Promise((function(e,t){i.addEventListener("load",(function(){s||e({status:i.status,header:function(e){return i.getResponseHeader(e)},body:i.responseText})})),i.addEventListener("error",(function(){s||t(new Error)})),i.send(r)}));return{promise:u,cancel:function(){s=!0,i.abort()}}}(e,t,o,i,a)}}n.httpAllowsPost=function(){return void 0===t&&(t=!!window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest),t},n.httpFallbackPing=function(e){(new window.Image).src=e};var o,i=e&&e.eventUrlTransformer;n.getCurrentUrl=function(){return i?i(window.location.href):window.location.href},n.isDoNotTrack=function(){var e;return 1===(e=window.navigator&&void 0!==window.navigator.doNotTrack?window.navigator.doNotTrack:window.navigator&&void 0!==window.navigator.msDoNotTrack?window.navigator.msDoNotTrack:window.doNotTrack)||!0===e||"1"===e||"yes"===e};try{window.localStorage&&(n.localStorage={get:function(e){return new Promise((function(t){t(window.localStorage.getItem(e))}))},set:function(e,t){return new Promise((function(n){window.localStorage.setItem(e,t),n()}))},clear:function(e){return new Promise((function(t){window.localStorage.removeItem(e),t()}))}})}catch(e){n.localStorage=null}if(e&&e.useReport&&"function"==typeof window.EventSourcePolyfill&&window.EventSourcePolyfill.supportedOptions&&window.EventSourcePolyfill.supportedOptions.method?(n.eventSourceAllowsReport=!0,o=window.EventSourcePolyfill):(n.eventSourceAllowsReport=!1,o=window.EventSource),window.EventSource){var a=3e5;n.eventSourceFactory=function(e,t){var n=kc(kc({},{heartbeatTimeout:a,silentTimeout:a,skipDefaultHeaders:!0}),t);return new o(e,n)},n.eventSourceIsActive=function(e){return e.readyState===window.EventSource.OPEN||e.readyState===window.EventSource.CONNECTING}}return n.userAgent="JSClient",n.version="3.1.2",n.diagnosticSdkData={name:"js-client-sdk",version:"3.1.2"},n.diagnosticPlatformData={name:"JS"},n.diagnosticUseCombinedEvent=!0,n}(n),o=mc(e,t,n,r,_c),i=o.client,a=o.options,s=o.emitter,u=new Promise((function(e){var t=s.on(Oc,(function(){s.off(Oc,t),e()}))}));i.waitUntilGoalsReady=function(){return u},a.fetchGoals?function(e,t){var n,r,o=function(){r&&r.dispose(),n&&n.length&&(r=Cc(n,i))},i=function(t,n){var r=e.ident.getContext(),o={kind:t,key:n.key,data:null,url:window.location.href,creationDate:(new Date).getTime(),contextKeys:bc(r)};return"click"===t&&(o.selector=n.selector),e.enqueueEvent(o)};e.requestor.fetchJSON("/sdk/goals/"+e.getEnvironmentId()).then((function(e){e&&e.length>0&&(r=Cc(n=e,i),function(e,t){var n,r=function(){(n=window.location.href)!==o&&(o=n,t())},o=window.location.href;!function e(t,n){t(),setTimeout((function(){e(t,n)}),n)}(r,e),window.history&&window.history.pushState?window.addEventListener("popstate",r):window.addEventListener("hashchange",r)}(Tc,o)),t()})).catch((function(n){e.emitter.maybeReportError(new gc.LDUnexpectedResponseError((n&&n.message,n.message))),t()}))}(o,(function(){return s.emit(Oc)})):s.emit(Oc),"complete"!==document.readyState?window.addEventListener("load",o.start):o.start();var c=function(){r.synchronousFlush=!0,i.flush().catch((function(){})),r.synchronousFlush=!1};return document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&c()})),window.addEventListener("pagehide",c),i}var Pc,Lc=!1,Ic=(Pc=vi(t(hi).mark((function e(){var n,r,o;return t(hi).wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=window.navigator.userAgent?window.navigator.userAgent.split(" ")[0]:"unknown",r={kind:"browser",key:"browser-".concat(Math.random(),"-").concat(n),referrer:window.location.href},o=Rc("635c15a65364ba1168293882",r),e.next=6,o.waitForInitialization();case 6:o.variation("use-elements-cdn",!1),Lc=o.variation("create-token-from-data-element",!1),e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[0,10]])}))),function(){return Pc.apply(this,arguments)}),jc=function(){"use strict";function e(){o(this,e)}return a(e,[{key:"post",value:function(e,t,n){return this.getServiceRequestPayloadAndMakeHttpClientRequest({url:e,method:"post",config:n,payload:t})}},{key:"put",value:function(e,t,n){return this.getServiceRequestPayloadAndMakeHttpClientRequest({url:e,method:"put",config:n,payload:t})}},{key:"patch",value:function(e,t,n){return this.getServiceRequestPayloadAndMakeHttpClientRequest({url:e,method:"patch",config:n,payload:t})}},{key:"get",value:function(e,t){return this.getDataElementAndMakeHttpClientRequest({url:e,method:"get",config:t})}},{key:"delete",value:function(e,t){return this.getDataElementAndMakeHttpClientRequest({url:e,method:"delete",config:t})}},{key:"getServiceRequestPayloadAndMakeHttpClientRequest",value:function(e){var t=e.url,n=e.config,r=e.payload,o=e.method,i=Ea(r,!0),a=i.elementReferences,s=i.servicePayload;return this.getDataElementAndMakeHttpClientRequest({url:t,method:o,config:n,payload:s},a)}},{key:"getDataElementAndMakeHttpClientRequest",value:function(e,t){return Pa()._httpClientRequest(Ia(w({},e),{elementReferences:t}))}}]),e}(),Ac="Could not find basis-theory DataElement for request.",Dc=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 Zo.logger.error("".concat(Ac," when sending proxy request."),{errorType:"noDataElement"}),new Error(Ac);if(null==t?void 0:t.body)try{var r=wa(t.body),o=r.elements,i=r.payload;return t=Ia(w({},t),{body:void 0}),n._proxyRequest(e,t,o,i)}catch(r){return n._proxyRequest(e,t)}return n._proxyRequest(e,t)}}]),e}(),Mc=function(){"use strict";function e(){o(this,e)}return a(e,[{key:"tokenize",value:function(e,t){var n=wa(e),r=n.elements,o=n.payload;return n.masterElement._submit({method:"tokenize",payload:o,options:t,elements:r})}}]),e}(),Uc="Could not find basis-theory DataElement for request.",Bc=function(){"use strict";function e(){o(this,e)}return a(e,[{key:"create",value:function(e,t){return Lc?this.createWithDataElement(e,t):this.createWithMasterElement(e,t)}},{key:"update",value:function(e,t,n){if("string"!=typeof e)throw Zo.logger.error("The token 'id' must be a string on token update.",{errorType:"noIdOnTokenUpdate"}),new TypeError("The token 'id' must be a string.");var r=wa(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 Zo.logger.error("The token 'id' must be a string on token update.",{errorType:"noIdOnTokenUpdate"}),new TypeError("The token 'id' must be a string.");var n=window.DataElement;if(!n)throw Zo.logger.error("".concat(Uc," on token retrieve."),{errorType:"noDataElement"}),new Error(Uc);return n._tokenRequest({service:"tokens",method:"retrieve",id:e,options:t})}},{key:"createWithMasterElement",value:function(e,t){var n=wa(e),r=n.elements,o=n.payload;return n.masterElement._submit({service:"tokens",method:"create",payload:o,elements:r,options:t})}},{key:"createWithDataElement",value:function(e,t){var n=Ea(e),r=n.elementReferences,o=n.servicePayload,i=Pa();return null==i?void 0:i._serviceRequest({service:"tokens",serviceMethod:"create",serviceOptions:t,elementReferences:r,servicePayload:o})}}]),e}(),qc=function(){"use strict";function e(){o(this,e),s(this,"hasElement",_a)}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"),""),(this._baseUrl.includes("elements.basistheory.com")||this._baseUrl.includes("elements.flock-dev.com"))&&(this._baseUrl=c)}catch(e){this._baseUrl=c}var r=new xa({type:"data",apiKey:this._apiKey,baseUrl:this.baseUrl});return window.DataElement=r,r.mountDataElement(),Ic(),Qo.setIframeTabbingListeners(),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 ui(r,t);break;case"text":n=new Ca(r,t);break;case"cardNumber":n=new ci(r,t);break;case"cardExpirationDate":n=new fi(r,t);break;case"cardVerificationCode":n=new di(r,t);break;default:throw Zo.logger.error("Element type ".concat(e," is not supported."),{errorType:"elementTypeNotSupported"}),new Error("Element type ".concat(e," is not supported."))}return n}},{key:"tokenize",value:function(e,t){return(new Mc).tokenize(e,t)}},{key:"tokens",get:function(){return new Bc}},{key:"proxy",get:function(){return new Dc}},{key:"client",get:function(){return new jc}},{key:"baseUrl",get:function(){return Ta(this._baseUrl)}}]),e}(),Fc=new qc;window.BasisTheory&&(window.BasisTheory.elements=Fc),window.BasisTheoryElements=Fc,window.DD_LOGS&&l&&(window.DD_LOGS.init({clientToken:l,forwardErrorsToLogs:!1,sessionSampleRate:100}),window.DD_LOGS.setGlobalContext({application:"BasisTheory Elements Client",env:c?c.includes("dev")?"dev":"prod":"local",referrer:document.referrer,gitSha:f}))}();