@paydock/client-sdk 1.104.6-beta → 1.104.7-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/bundles/index.cjs +29364 -8275
  2. package/bundles/index.cjs.d.ts +64 -4
  3. package/bundles/index.cjs.map +1 -1
  4. package/bundles/index.mjs +29364 -8275
  5. package/bundles/index.mjs.d.ts +64 -4
  6. package/bundles/index.mjs.map +1 -1
  7. package/bundles/types/api/api-base.d.ts +14 -6
  8. package/bundles/types/api/api-base.d.ts.map +1 -1
  9. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +3 -3
  10. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
  11. package/bundles/types/checkout-button/runner/popup.runner.d.ts +1 -1
  12. package/bundles/types/components/http-core.d.ts.map +1 -1
  13. package/bundles/types/configs/env/environment.cba.d.ts +1 -1
  14. package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
  15. package/bundles/types/configs/env/environment.paydock.d.ts +1 -1
  16. package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
  17. package/bundles/types/shared/http/http-request.d.ts +14 -0
  18. package/bundles/types/shared/http/http-request.d.ts.map +1 -0
  19. package/bundles/types/shared/http/index.d.ts +2 -0
  20. package/bundles/types/shared/http/index.d.ts.map +1 -0
  21. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts +15 -0
  22. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts.map +1 -0
  23. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts +66 -0
  24. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts.map +1 -0
  25. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +14 -0
  26. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -0
  27. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts +15 -0
  28. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts.map +1 -0
  29. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts +23 -0
  30. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts.map +1 -0
  31. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts +15 -0
  32. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts.map +1 -0
  33. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts +4 -0
  34. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts.map +1 -0
  35. package/bundles/types/wallet-buttons/google.wallet-service.d.ts +4 -4
  36. package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +1 -1
  37. package/bundles/types/widget/configuration.d.ts.map +1 -1
  38. package/bundles/types/widget/html-multi-widget.d.ts +3 -3
  39. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  40. package/bundles/widget.umd.js +29364 -8275
  41. package/bundles/widget.umd.js.d.ts +64 -4
  42. package/bundles/widget.umd.js.map +1 -1
  43. package/bundles/widget.umd.js.min.d.ts +64 -4
  44. package/bundles/widget.umd.min.js +62 -1
  45. package/bundles/widget.umd.min.js.map +1 -1
  46. package/examples/multi-html-widget/simple.html +2 -1
  47. package/package.json +18 -15
@@ -1,2 +1,63 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("isomorphic-dompurify")):"function"==typeof define&&define.amd?define(["exports","isomorphic-dompurify"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).paydock={})}(this,(function(e){"use strict";function t(e,t,i){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,n()?Reflect.construct(t,i||[],d(e).constructor):t.apply(e,i))}function n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(n=function(){return!!e})()}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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,i(r.key),r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c.apply(this,arguments)}function l(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},p.apply(this,arguments)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(u=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,t)||m(e,t)||function(){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 v(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){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 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(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var g,k=function(){return s((function e(){o(this,e)}),null,[{key:"isFacebook",value:function(){return-1!==navigator.userAgent.indexOf("FBSN/iOS")&&-1!==navigator.userAgent.indexOf("AppleWebKit")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isInstagram",value:function(){return-1!==navigator.userAgent.indexOf("iOS")&&-1!==navigator.userAgent.indexOf("Instagram")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isSupportPopUp",value:function(){return!this.isFacebook()&&!this.isInstagram()}},{key:"getLanguage",value:function(){return window.navigator.language||""}},{key:"getTimezoneOffset",value:function(){return(new Date).getTimezoneOffset()}},{key:"getBrowserName",value:function(){var e=navigator.userAgent;return e.indexOf("Firefox")>-1?"Mozilla Firefox":e.indexOf("Opera")>-1?"Opera":e.indexOf("Trident")>-1?"Microsoft Internet Explorer":e.indexOf("Edge")>-1?"Microsoft Edge":e.indexOf("Chrome")>-1?"Google Chrome or Chromium":e.indexOf("Safari")>-1?"Apple Safari":"unknown"}},{key:"isJavaEnabled",value:function(){return navigator.javaEnabled()}},{key:"getColorDepth",value:function(){return screen.colorDepth}},{key:"getScreenHeight",value:function(){return screen.height}},{key:"getScreenWidth",value:function(){return screen.width}},{key:"getBrowserInfo",value:function(){var e,t=navigator.userAgent,n=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?{name:"IE",version:(e=/\brv[ :]+(\d+)/g.exec(t)||[])[1]||""}:"Chrome"===n[1]&&null!=(e=t.match(/\bOPR|Edge\/(\d+)/))?{name:"Opera",version:e[1]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&n.splice(1,1,e[1]),{name:n[0],version:n[1]})}}])}(),E="/v1/charges/3ds",C=function(){return s((function e(t){o(this,e),this.api=t}),[{key:"preAuth",value:function(e,t){return"function"==typeof t?this.api.getClient("POST",E).send(c(c({},e),{_3ds:c(c({},e._3ds),{browser_details:{name:k.getBrowserName(),java_enabled:k.isJavaEnabled().toString(),language:k.getLanguage(),screen_height:k.getScreenHeight().toString(),screen_width:k.getScreenWidth().toString(),time_zone:k.getTimezoneOffset().toString(),color_depth:k.getColorDepth().toString()}})}),(function(e){t(e)})):this.api.getClientPromise("POST",E).send(c(c({},e),{_3ds:c(c({},e._3ds),{browser_details:{name:k.getBrowserName(),java_enabled:k.isJavaEnabled().toString(),language:k.getLanguage(),screen_height:k.getScreenHeight().toString(),screen_width:k.getScreenWidth().toString(),time_zone:k.getTimezoneOffset().toString(),color_depth:k.getColorDepth().toString()}})}))}}])}(),_="x-access-token",w="x-user-public-key",b=function(){function e(){o(this,e)}return s(e,null,[{key:"validateJWT",value:function(e){if(!e)return null;var t=f(e.split("."),3),n=t[0],i=t[1],r=t[2];if(!n||!i||!r)return null;if(2+n.length+i.length+r.length!==e.length)return null;try{return{head:JSON.parse(atob(n)),body:JSON.parse(atob(i)),signature:r}}catch(e){return null}}},{key:"extractData",value:function(e){try{return JSON.parse(atob(e.meta))}catch(e){return null}}},{key:"extractMeta",value:function(e){try{return JSON.parse(atob(e.meta)).meta}catch(e){return null}}},{key:"getAccessHeaderNameByToken",value:function(t){return e.validateJWT(t)?_:w}}])}(),S="sandbox",T="sandbox-kovena",O="sandbox-demo-kovena",A="production",P="staging",R="staging_1",L="staging_2",x="staging_3",H="staging_4",I="staging_5",U="staging_6",M="staging_7",N="staging_8",D="staging_9",F="staging_10",V="staging_11",B="staging_12",j="staging_13",z="staging_14",q="staging_15",K=[{env:S,url:"https://widget-sandbox."},{env:T,url:"https://widget-sandbox."},{env:"sandbox-demo",url:"https://widget-sandbox-demo."},{env:O,url:"https://widget-sandbox-demo."},{env:A,url:"https://widget."},{env:P,url:"https://widsta."},{env:R,url:"https://widsta-1."},{env:L,url:"https://widsta-2."},{env:x,url:"https://widsta-3."},{env:H,url:"https://widsta-4."},{env:I,url:"https://widsta-5."},{env:U,url:"https://widsta-6."},{env:M,url:"https://widsta-7."},{env:N,url:"https://widsta-8."},{env:D,url:"https://widsta-9."},{env:F,url:"https://widsta-10."},{env:V,url:"https://widsta-11."},{env:B,url:"https://widsta-12."},{env:j,url:"https://widsta-13."},{env:z,url:"https://widsta-14."},{env:q,url:"https://widsta-15."}],Y=[{env:S,url:"https://api-sandbox."},{env:A,url:"https://api."},{env:P,url:"https://apista."},{env:R,url:"https://apista-1."},{env:L,url:"https://apista-2."},{env:x,url:"https://apista-3."},{env:H,url:"https://apista-4."},{env:I,url:"https://apista-5."},{env:U,url:"https://apista-6."},{env:M,url:"https://apista-7."},{env:N,url:"https://apista-8."},{env:D,url:"https://apista-9."},{env:F,url:"https://apista-10."},{env:V,url:"https://apista-11."},{env:B,url:"https://apista-12."},{env:j,url:"https://apista-13."},{env:z,url:"https://apista-14."},{env:q,url:"https://apista-15."}],W=[T,O],Z=S,G="paydock.com",J="kovena.com",X=function(){return s((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;o(this,e),this.configs=t,this.setEnv(n)}),[{key:"setEnv",value:function(e,t){if(!this.isValidMode(this.configs,e))throw new Error("unknown env: "+e);if(this.env=e,t&&!t.match("^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$"))throw new Error("invalid: "+t);t?this.alias=t:-1!==W.indexOf(this.env)?this.alias=J:this.alias=G}},{key:"getEnv",value:function(){return this.env}},{key:"getConf",value:function(){for(var e in this.configs)if(this.configs.hasOwnProperty(e)&&this.configs[e].env===this.getEnv())return{url:-1!==this.configs[e].url.indexOf("localhost")?this.configs[e].url:this.configs[e].url+this.alias,env:this.configs[e].env};throw new Error("invalid env")}},{key:"isValidMode",value:function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].env===t)return!0;return!1}}])}(),$=function(){function e(){o(this,e)}return s(e,null,[{key:"version",get:function(){return e._version.trim()||null}}])}();$.type="client",$.headerKeys=Object.freeze({version:"x-sdk-version",type:"x-sdk-type"}),$._version="v1.104.6-beta",function(e){e[e.PUBLIC_KEY=0]="PUBLIC_KEY",e[e.TOKEN=1]="TOKEN"}(g||(g={}));var Q,ee=function(){return s((function e(t,n){o(this,e),this.auth=t,this.authType=n||this.setAuthType(),this.env=new X(Y)}),[{key:"setEnv",value:function(e,t){return this.env.setEnv(e,t),this}},{key:"setAuthType",value:function(){return this.authType=b.validateJWT(this.auth)?g.TOKEN:g.PUBLIC_KEY}},{key:"getClient",value:function(e,t){var n=this,i=new XMLHttpRequest;return i.open(e,this.env.getConf().url+t,!0),i.setRequestHeader("Content-Type","application/json; charset=UTF-8"),this.setAuthHeader(i),$.version&&(i.setRequestHeader($.headerKeys.version,$.version),i.setRequestHeader($.headerKeys.type,$.type)),{config:i,send:function(e,t,r){i.onload=function(){return n.parser({text:i.responseText,status:i.status},t,r)},i.send(JSON.stringify(e))}}}},{key:"getClientPromise",value:function(e,t){var n=this,i=new XMLHttpRequest;return i.open(e,this.env.getConf().url+t,!0),i.setRequestHeader("Content-Type","application/json; charset=UTF-8"),this.setAuthHeader(i),$.version&&(i.setRequestHeader($.headerKeys.version,$.version),i.setRequestHeader($.headerKeys.type,$.type)),{config:i,send:function(e){return new Promise((function(t,n){i.onload=function(){return t({text:i.responseText,status:i.status})},i.send(JSON.stringify(e))})).then((function(e){return n.parserPromise(e)}))}}}},{key:"parser",value:function(e,t,n){var i=e.text,r=e.status;try{var o=JSON.parse(i);if(r>=200&&r<300||302===r)return t(o.resource.data);n(o.error||{message:"unknown error"})}catch(e){}}},{key:"parserPromise",value:function(e){var t=e.text,n=e.status;try{var i=JSON.parse(t);return n>=200&&n<300||302===n?Promise.resolve(i.resource.data):Promise.reject(i.error||{message:"unknown error"})}catch(e){return Promise.reject(e)}}},{key:"setAuthHeader",value:function(e){switch(this.authType){case g.PUBLIC_KEY:e.setRequestHeader("x-user-public-key",this.auth);break;case g.TOKEN:e.setRequestHeader("x-access-token",this.auth)}}}])}(),te=function(e){function n(e){var i;return o(this,n),(i=t(this,n,[e])).publicKey=i.auth,i}return l(n,e),s(n,[{key:"getBrowserDetails",value:function(){return{name:k.getBrowserName(),java_enabled:k.isJavaEnabled().toString(),language:k.getLanguage(),screen_height:k.getScreenHeight().toString(),screen_width:k.getScreenWidth().toString(),time_zone:k.getTimezoneOffset().toString(),color_depth:k.getColorDepth().toString()}}},{key:"charge",value:function(){return new C(this)}}])}(ee),ne=function(){return s((function e(){o(this,e)}),null,[{key:"extendSearchParams",value:function(e,t,n){return e.replace(new RegExp("([?&]"+t+"(?=[=&#]|$)[^#&]*|(?=#|$))"),"&"+t+"="+encodeURIComponent(n)).replace(/^([^?&]+)&/,"$1?")}},{key:"serialize",value:function(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}}])}(),ie=function(){return s((function e(){o(this,e)}),null,[{key:"generate",value:function(){if("undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.getRandomValues){var e=new Uint16Array(8);return window.crypto.getRandomValues(e),this.hash(e[0])+this.hash(e[1])+"-"+this.hash(e[2])+"-"+this.hash(e[3])+"-"+this.hash(e[4])+"-"+this.hash(e[5])+this.hash(e[6])+this.hash(e[7])}return this.random()+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+this.random()+this.random()}},{key:"hash",value:function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t}},{key:"random",value:function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}])}(),re="/wallet/flypay",oe="/images/logo.png",ae=function(){return s((function e(t){o(this,e),this.params={},this.widgetId=ie.generate(),this.linkResource=t,this.env=new X(K),this.setParams({widget_id:this.widgetId})}),[{key:"getNetUrl",value:function(){return this.env.getConf().url+this.linkResource}},{key:"getUrl",value:function(){var e=this.getNetUrl(),t=this.getParams();for(var n in t)t.hasOwnProperty(n)&&(e=ne.extendSearchParams(e,n,t[n]));return e}},{key:"setParams",value:function(e){this.params=c({},this.params,e)}},{key:"concatParams",value:function(e){for(var t in e)e.hasOwnProperty(t)&&e[t].length&&("string"!=typeof this.params[t]&&(this.params[t]=""),this.params[t].length?this.params[t]+=","+e[t]:this.params[t]+=e[t])}},{key:"getParams",value:function(){return this.params}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getBaseUrl",value:function(){return this.env.getConf().url}}])}(),se=function(){return s((function e(){o(this,e)}),null,[{key:"insertToInput",value:function(e,t,n){if(void 0!==n[t]){var i=document.querySelector(e);i&&(i.value=n[t])}}},{key:"subscribe",value:function(e,t,n){t.addEventListener?t.addEventListener(e,n):t.attachEvent("on".concat(e),n)}}])}(),ue=function(){return s((function e(t){o(this,e),this.selector=t}),[{key:"isExist",value:function(){return!!this.getElement()}},{key:"getStyles",value:function(e){if(this.isExist()){var t=this.getElement().getAttribute("widget-style");if(!t)return{};var n=t.split(";");return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"on",value:function(e,t){this.isExist()&&se.subscribe(e,this.getElement(),t)}},{key:"getAttr",value:function(e){if(this.isExist()){var t=this.getElement(),n=[];for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].replace(/_/g,"-"),o=t.getAttribute(r);o&&n.push("".concat(e[i],":").concat(o))}return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"getSelector",value:function(){return this.selector}},{key:"convertConfigs",value:function(e,t){var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].split(":"),o=r[0].replace(/-/g,"_").trim();-1!==t.indexOf(o)&&(n[o]=r[1].trim())}return n}}])}(),ce=function(){return s((function e(t){o(this,e),this.container=t}),[{key:"load",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("src",e),t.title&&(n.title=t.title),this.container.getElement().appendChild(n)}}},{key:"loadFromHtml",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("height","100%"),n.setAttribute("width","100%"),t.title&&(n.title=t.title);this.container.getElement().appendChild(n);var i=this.getElement().contentDocument;i.open(),i.write("<html><head><style>html, body {margin: 0;} iframe {border: 0; width: 100%}</style><title></title></head><body>{{content}}</body></html>".replace("{{content}}",e)),i.close()}}},{key:"remove",value:function(){if(this.container.isExist()&&this.isExist()){var e=this.getElement();this.container.getElement().removeChild(e)}}},{key:"show",value:function(){this.isExist()&&(this.setStyle("visibility","visible"),this.setStyle("display","block"))}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isExist()&&(e?this.setStyle("visibility","hidden"):this.setStyle("display","none"))}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"getElement",value:function(){return this.container.isExist()?this.container.getElement().querySelector("iframe"):null}},{key:"setStyle",value:function(e,t){this.getElement().style[e]=t}}])}(),le={AFTER_LOAD:"afterLoad",SUBMIT:"submit",FINISH:"finish",VALIDATION_ERROR:"validationError",SYSTEM_ERROR:"systemError",CHECKOUT_SUCCESS:"checkoutSuccess",CHECKOUT_READY:"checkoutReady",CHECKOUT_ERROR:"checkoutError",CHECKOUT_COMPLETED:"checkoutCompleted",CHECKOUT_POPUP_OPEN:"checkoutPopupOpen",CHECKOUT_POPUP_CLOSE:"checkoutPopupClose",VALIDATION:"validation",SELECT:"select",UNSELECT:"unselect",NEXT:"next",PREV:"prev",META_CHANGE:"metaChange",RESIZE:"resize",CHARGE_AUTH_SUCCESS:"chargeAuthSuccess",CHARGE_AUTH_REJECT:"chargeAuthReject",CHARGE_AUTH_CANCELLED:"chargeAuthCancelled",ADDITIONAL_DATA_SUCCESS:"additionalDataCollectSuccess",ADDITIONAL_DATA_REJECT:"additionalDataCollectReject",CHARGE_AUTH:"chargeAuth",DISPATCH_SUCCESS:"dispatchSuccess",DISPATCH_ERROR:"dispatchError"},de=function(){return s((function e(t){var n=this;o(this,e),this.listeners=[],t&&se.subscribe("message",t,(function(e){var t;try{t=JSON.parse(e.data)}catch(e){}t&&n.emit(t)}))}),[{key:"emit",value:function(e){for(var t in this.listeners)this.listeners[t].event===e.event&&e.widget_id===this.listeners[t].widget_id&&this.listeners[t].listener.apply(this,[e])}},{key:"on",value:function(e,t,n){for(var i in le)le.hasOwnProperty(i)&&e===le[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}},{key:"clear",value:function(){this.listeners=[]}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t)}}])}(),he={visibility:"hidden",border:"0",width:"0",height:"0"};!function(e){e.SUCCESS="success",e.ERROR="error",e.PENDING="pending"}(Q||(Q={}));var pe,fe="chargeAuthSuccess",ve="chargeAuthReject",me="chargeAuthDecoupled",ye="chargeAuthChallenge",ge="chargeAuthInfo",ke="error",Ee=function(){return s((function e(t,n,i){o(this,e),this.container=t,this.api=n,this.eventEmitter=i,this.resultRead=!1,this.iFrameEvent=new de(window)}),[{key:"load",value:function(e,t){var n=e.initialization_url,i=e.secondary_url,r=e.charge_3ds_id;try{this.setupIFrameEvents(r),this.initializeIFrames(n,i,t)}catch(e){this.eventEmitter.emit(ke,this.parseError(e,r))}}},{key:"initializeIFrames",value:function(e,t,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this.container.getElement();if(r){var o=document.createElement("div");if(o.setAttribute("id","paydock_authorization_iframe"),r.appendChild(o),this.browserAndChallengeContainer=new ue("#paydock_authorization_iframe"),this.iFrameAuthorization=new ce(this.browserAndChallengeContainer),this.iFrameAuthorization.load(e,{title:n}),t){var a=document.createElement("div");a.setAttribute("id","paydock_secondary_iframe"),r.appendChild(a),this.monitoringContainer=new ue("#paydock_secondary_iframe"),this.iFrameSecondaryUrl=new ce(this.monitoringContainer),this.iFrameSecondaryUrl.load(t,{title:n})}else this.iFrameSecondaryUrl=void 0;this.hideIframes(i)}}},{key:"hideIframes",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(var n in he)he.hasOwnProperty(n)&&(t&&this.iFrameAuthorization.setStyle(n,he[n]),null===(e=this.iFrameSecondaryUrl)||void 0===e||e.setStyle(n,he[n]))}},{key:"setupIFrameEvents",value:function(e){var t=this;this.iFrameEvent.on(le.CHARGE_AUTH,e,(function(e){"MethodSkipped"===e.status||"MethodFinished"===e.status?(e.info&&t.eventEmitter.emit(ge,{info:e.info}),t.performAuthentication(e)):"AuthTimedOut"!==e.status&&"invalid_event"!==e.status||t.eventEmitter.emit(ve,t.parseHandleResponse({status:e.status},e.charge_3ds_id))})),this.iFrameEvent.on(le.CHARGE_AUTH_SUCCESS,e,(function(e){t.processResult(e.charge_3ds_id)}))}},{key:"parseResultData",value:function(e,t){return{status:e.status,charge_3ds_id:t}}},{key:"parseHandleResponse",value:function(e,t){var n=e.status,i=e.result;return{status:n,charge_3ds_id:t,result:{description:null==i?void 0:i.description}}}},{key:"parseError",value:function(e,t){return{charge_3ds_id:t,error:e}}},{key:"processResult",value:function(e){var t=this;this.resultRead||(this.resultRead=!0,this.api.charge().standalone3dsHandle().then((function(n){var i;t.iFrameAuthorization.remove(),null===(i=t.iFrameSecondaryUrl)||void 0===i||i.remove(),n.status===Q.SUCCESS?t.eventEmitter.emit(fe,t.parseResultData(n,e)):t.eventEmitter.emit(ve,t.parseResultData(n,e))}),(function(n){t.eventEmitter.emit(ke,t.parseError(n,e))})))}},{key:"externalAPI",value:function(e,t){var n=new XMLHttpRequest;return n.open(e,t,!0),new Promise((function(e,t){n.onload=function(){try{var i=JSON.parse(n.responseText);e(i)}catch(e){t(e)}},n.send()}))}},{key:"doPolling",value:function(e,t){var n=this;this.externalAPI("GET",e).then((function(i){if(i.event&&"AuthResultNotReady"!==i.event){if("AuthResultReady"!==i.event)throw new Error("Event not supported");n.processResult(t)}else setTimeout((function(){n.doPolling(e,t)}),2e3)})).catch((function(e){return n.eventEmitter.emit(ke,n.parseError(e,t))}))}},{key:"performAuthentication",value:function(e){var t,n=this,i=e.charge_3ds_id;this.iFrameAuthorization.remove(),null===(t=this.iFrameSecondaryUrl)||void 0===t||t.remove(),this.api.charge().standalone3dsProcess({charge_3ds_id:i}).then((function(e){var t,r;if("success"===e.status)n.eventEmitter.emit(fe,n.parseHandleResponse(e,i));else{if("pending"!==e.status)return n.eventEmitter.emit(ve,n.parseHandleResponse(e,i));(null===(t=null==e?void 0:e.result)||void 0===t?void 0:t.challenge)?(n.eventEmitter.emit(ye,n.parseHandleResponse(e,i)),n.initializeIFrames(e.result.challenge_url,void 0,"Authentication Challenge",!1),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i)):(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.decoupled_challenge)&&(n.eventEmitter.emit(me,n.parseHandleResponse(e,i)),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i))}}),(function(e){n.eventEmitter.emit(ke,n.parseError(e,i))}))}}])}(),Ce=function(){return s((function e(t){o(this,e),this.api=t}),[{key:"walletCapture",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/capture").send(e)}},{key:"walletCallback",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/callback").send(e)}},{key:"standalone3dsProcess",value:function(e){return this.api.getClientPromise("POST","/v1/charges/standalone-3ds/process").send(e)}},{key:"standalone3dsHandle",value:function(){return this.api.getClientPromise("GET","/v1/charges/standalone-3ds/handle").send(void 0)}}])}(),_e=function(){return s((function e(t){o(this,e),this.api=t}),[{key:"getConfig",value:function(e){var t="/v1/services/:service_id/config".replace(":service_id",e);return this.api.getClientPromise("GET",t).send(void 0)}}])}();!function(e){e.VISA_SRC="VisaSRC",e.MASTERCARD_SRC="MastercardSRCClickToPay"}(pe||(pe={}));var we,be=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"charge",value:function(){return new Ce(this)}},{key:"service",value:function(){return new _e(this)}}])}(ee),Se="GPayments",Te=function(){return s((function e(t,n){o(this,e),this.env=Z,this.container=t,this.eventEmitter=n}),[{key:"load",value:function(e,t){var n=b.validateJWT(e);if(!n)throw new Error("Invalid charge token");var i=b.extractData(n.body),r=new be(e,g.TOKEN);if(r.setEnv(this.env,this.alias),i.service_type===Se)new Ee(this.container,r,this.eventEmitter).load(i,t.title)}},{key:"setEnv",value:function(e,t){this.env=e,this.alias=t}}])}(),Oe=function(){return s((function e(){o(this,e),this.events={}}),[{key:"emit",value:function(e,t){var n=this.events[e];n&&n.forEach((function(e){e.call(null,t)}))}},{key:"subscribe",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter((function(e){return t!==e}))}}}])}();!function(e){e.HTML="html",e.URL="url",e.STANDALONE_3DS="standalone_3ds"}(we||(we={}));var Ae,Pe,Re=function(){return s((function e(t,n){o(this,e),this.configs=[],this.link=new ae("/3ds/webhook"),this.token=e.extractToken(n),this.link.setParams({ref_id:this.token.charge_3ds_id}),this.container=new ue(t),this.iFrame=new ce(this.container),this.eventEmitter=new Oe,this.standalone3dsService=new Te(this.container,this.eventEmitter),this.event=new de(window)}),[{key:"load",value:function(){this.token.format===we.HTML?this.iFrame.loadFromHtml(this.token.content,{title:"3d secure authentication"}):this.token.format===we.URL?this.iFrame.load(this.token.content,{title:"3d secure authentication"}):this.token.format===we.STANDALONE_3DS?this.standalone3dsService.load(this.token.content,{title:"3d secure authentication"}):console.error("Token contain unsupported payload")}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.standalone3dsService.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"on",value:function(e,t){var n=this;return this.token.format===we.STANDALONE_3DS?"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))})):"function"==typeof t?this.event.on(e,this.link.getParams().ref_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().ref_id,(function(e){return t(e)}))}))}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}}],[{key:"extractToken",value:function(e){return JSON.parse(window.atob(e))}}])}(),Le={CLICK:"click",POPUP_REDIRECT:"popupRedirect",REDIRECT:"redirect",ERROR:"error",REFERRED:"referred",DECLINED:"declined",CANCELLED:"cancelled",ACCEPTED:"accepted",FINISH:"finish",CLOSE:"close"};!function(e){e.CONTEXTUAL="contextual",e.REDIRECT="redirect"}(Ae||(Ae={})),function(e){e.ZIPMONEY="Zipmoney",e.PAYPAL="PaypalClassic",e.AFTERPAY="Afterpay"}(Pe||(Pe={}));var xe,He,Ie="[Paydock:CheckoutButton]",Ue={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},Me={CARD_NAME:"card_name",CARD_NUMBER:"card_number",EXPIRE_MONTH:"expire_month",EXPIRE_YEAR:"expire_year",CARD_CCV:"card_ccv",CARD_PIN:"card_pin",ACCOUNT_NAME:"account_name",ACCOUNT_BSB:"account_bsb",ACCOUNT_NUMBER:"account_number",ACCOUNT_ROUTING:"account_routing",ACCOUNT_HOLDER_TYPE:"account_holder_type",ACCOUNT_BANK_NAME:"account_bank_name",ACCOUNT_TYPE:"account_type",FIRST_NAME:"first_name",LAST_NAME:"last_name",EMAIL:"email",PHONE:"phone",PHONE2:"phone2",ADDRESS_LINE1:"address_line1",ADDRESS_LINE2:"address_line2",ADDRESS_STATE:"address_state",ADDRESS_COUNTRY:"address_country",ADDRESS_CITY:"address_city",ADDRESS_POSTCODE:"address_postcode",ADDRESS_COMPANY:"address_company"},Ne={BACKGROUND_COLOR:"background_color",BACKGROUND_ACTIVE_COLOR:"background_active_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",ICON_SIZE:"icon_size",BUTTON_COLOR:"button_color",ERROR_COLOR:"error_color",SUCCESS_COLOR:"success_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},De={TITLE:"title",TITLE_H1:"title_h1",TITLE_H2:"title_h2",TITLE_H3:"title_h3",TITLE_H4:"title_h4",TITLE_H5:"title_h5",TITLE_H6:"title_h6",FINISH:"finish_text",TITLE_DESCRIPTION:"title_description",SUBMIT_BUTTON:"submit_button",SUBMIT_BUTTON_PROCESSING:"submit_button_processing"},Fe={SUBMIT_BUTTON:"submit_button",TABS:"tabs"},Ve={AMEX:"amex",AUSBC:"ausbc",DINERS:"diners",DISCOVER:"discover",JAPCB:"japcb",LASER:"laser",MASTERCARD:"mastercard",SOLO:"solo",VISA:"visa",VISA_WHITE:"visa_white"},Be=[].concat(["brand_name","cart_border_color","reference","email","hdr_img","logo_img","pay_flow_color","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone","hide_shipping_address"],["first_name","last_name","phone","tokenize","email","gender","date_of_birth","charge","statistics","hide_shipping_address"],["amount","currency","email","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone"],["customer_storage_number","tokenise_algorithm"]);!function(e){e.STRIPE="Stripe",e.FLYPAY="Flypay",e.FLYPAY_V2="FlypayV2",e.PAYPAL="Paypal",e.MASTERCARD="MasterCard",e.AFTERPAY="Afterpay"}(xe||(xe={})),function(e){e.GOOGLE="google",e.APPLE="apple",e.FLYPAY="flypay",e.FLYPAY_V2="flypayV2",e.PAYPAL="paypal",e.AFTERPAY="afterpay"}(He||(He={}));var je,ze=function(){return s((function e(){o(this,e),this.env=new X(Y)}),[{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getUrl",value:function(){return this.env.getConf().url+this.getLink()}},{key:"create",value:function(e,t,n,i){var r=this,o=new XMLHttpRequest;o.onload=function(){r.parser(o.responseText,o.status,n,i)},o.open("POST",this.getUrl(),!0),o.setRequestHeader("Content-Type","application/json; charset=UTF-8"),o.setRequestHeader(b.getAccessHeaderNameByToken(e),e),$.version&&(o.setRequestHeader($.headerKeys.version,$.version),o.setRequestHeader($.headerKeys.type,$.type)),o.send(JSON.stringify(t))}},{key:"get",value:function(e,t,n){var i=this,r=new XMLHttpRequest;r.onload=function(){i.parser(r.responseText,r.status,t,n)},r.open("GET",this.getUrl(),!0),r.setRequestHeader("Content-Type","application/json; charset=UTF-8"),r.setRequestHeader(b.getAccessHeaderNameByToken(e),e),$.version&&(r.setRequestHeader($.headerKeys.version,$.version),r.setRequestHeader($.headerKeys.type,$.type)),r.send()}},{key:"parser",value:function(e,t,n,i){var r={};try{r=JSON.parse(e)}catch(e){}if(t>=200&&t<300||302===t)return n(r.resource.data,t);i(r.error||{message:"unknown error"},t)}}])}(),qe=function(e){function n(e,i,r){var a;return o(this,n),(a=t(this,n)).body={gateway_id:e,meta:{},success_redirect_url:i,error_redirect_url:r,redirect_url:i},a}return l(n,e),s(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout"}},{key:"setDescriptions",value:function(e){this.body.description=e}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Be.indexOf(t)?this.body.meta[t]=e[t]:console.warn("ExternalCheckout::setMeta: unsupported meta key ".concat(t)))}},{key:"getConfigs",value:function(){return this.body}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e,t){};this.create(e,this.getConfigs(),(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error"),"unknown_error"):n(e.message,e.code)}))}}])}(ze),Ke=function(e){function n(e){var i;return o(this,n),(i=t(this,n)).token=e,i}return l(n,e),s(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout/:token".replace(":token",this.token)}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.get(e,(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error")):n(e.message)}))}}])}(ze),Ye='\n <div class="cs-loader">\n <div class="cs-loader-inner">\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n </div>\n </div>\n',We="\n <style> \n .cs-loader {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n }\n \n .cs-loader-inner {\n transform: translateY(-50%);\n top: 50%;\n position: absolute;\n width: calc(100% - 200px);\n color: #8e8d8c;\n padding: 0 100px;\n text-align: center;\n }\n \n \n .cs-loader-inner label {\n font-size: 20px;\n opacity: 0;\n display:inline-block;\n }\n \n @keyframes lol {\n 0% {\n opacity: 0;\n transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n transform: translateX(300px);\n }\n }\n \n @-webkit-keyframes lol {\n 0% {\n opacity: 0;\n -webkit-transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n -webkit-transform: translateX(300px);\n -moz-transform: translateX(300px);\n }\n }\n \n .cs-loader-inner label:nth-child(6) {\n -webkit-animation: lol 3s infinite ease-in-out;\n -moz-animation: lol 3s infinite ease-in-out;\n animation: lol 3s infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(5) {\n -webkit-animation: lol 3s 100ms infinite ease-in-out;\n -moz-animation: lol 3s 100ms infinite ease-in-out;\n animation: lol 3s 100ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(4) {\n -webkit-animation: lol 3s 200ms infinite ease-in-out;\n -moz-animation: lol 3s 200ms infinite ease-in-out;\n animation: lol 3s 200ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(3) {\n -webkit-animation: lol 3s 300ms infinite ease-in-out;\n -moz-animation: lol 3s 300ms infinite ease-in-out;\n animation: lol 3s 300ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(2) {\n -webkit-animation: lol 3s 400ms infinite ease-in-out;\n -moz-animation: lol 3s 400ms infinite ease-in-out;\n animation: lol 3s 400ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(1) {\n -webkit-animation: lol 3s 500ms infinite ease-in-out;\n -moz-animation: lol 3s 500ms infinite ease-in-out;\n animation: lol 3s 500ms infinite ease-in-out;\n }\n </style>\n",Ze="close",Ge="focus",Je=function(){return s((function e(){o(this,e),this.description="Don't see the secure checkout browser? We'll help you re-launch the window to complete your purchase",this.title="Checkout",this.overlay=null,this.style=null,this.showControl=!0,this.showLoader=!0,this.eventEmitter=new Oe}),[{key:"initControl",value:function(){if(!this.isInit()&&this.showControl){if(!k.isSupportPopUp())return this.createLoader();this.createTemplate(),this.createStyles(),this.eventHandler()}}},{key:"initLoader",value:function(){!this.isInit()&&this.showLoader&&(this.createStyles(),this.createLoader())}},{key:"eventHandler",value:function(){var e=this,t=document.querySelector("[data-close]"),n=document.querySelector("[data-continue]");t&&se.subscribe("click",t,(function(){return e.eventEmitter.emit(Ze,{})})),n&&se.subscribe("click",n,(function(){return e.eventEmitter.emit(Ge,{})}))}},{key:"clear",value:function(){(this.style||this.overlay)&&(this.style.parentNode.removeChild(this.style),this.overlay.parentNode.removeChild(this.overlay),this.style=null,this.overlay=null)}},{key:"createLoader",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0];this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=We+Ye,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <strong class="checkout-title" data-title>{{title}}</strong>\n <p data-description>{{description}}</p>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');n=(n=n.replace("{{description}}",this.description)).replace("{{title}}",this.title),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .hide-continue-button [data-continue] {\n display: none;\n }\n\n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display {\n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n"),n=document.querySelector(".checkout-container");t=t.replace("{{width}}",n?String(n.offsetHeight/2):"0"),this.style=document.createElement("style"),this.style.type="text/css",this.style.appendChild(document.createTextNode(t)),e.appendChild(this.style)}},{key:"setBackdropDescription",value:function(e){this.description=e}},{key:"setBackdropTitle",value:function(e){this.title=e}},{key:"onTrigger",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"isInit",value:function(){return!(!this.overlay||!this.style)}},{key:"hideContinueControl",value:function(){this.isInit()&&this.overlay.classList.add("hide-continue-button")}},{key:"turnOffControl",value:function(){this.showControl=!1}},{key:"turnOffLoader",value:function(){this.showLoader=!1}}])}(),Xe=function(){return s((function e(){o(this,e),this.widgetEnv=new X(K)}),[{key:"error",value:function(e,t,n){n(!0)}},{key:"setEnv",value:function(e,t){this.widgetEnv.setEnv(e,t)}}])}();function $e(){return function(e){function n(){var e;o(this,n);for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return(e=t(this,n,[].concat(r))).background=new Je,e.background.onTrigger(Ge,(function(){return e.continue()})),e.background.onTrigger(Ze,(function(){return e.stop()})),e}return l(n,e),s(n,[{key:"continue",value:function(){}},{key:"stop",value:function(){}},{key:"error",value:function(e,t,n){n(!0)}},{key:"setSuspendedRedirectUri",value:function(e){this.suspendedRedirectUri=e}},{key:"setBackgroundTitle",value:function(e){this.background.setBackdropTitle(e)}},{key:"setBackgroundDescription",value:function(e){this.background.setBackdropDescription(e)}},{key:"turnOffBackdrop",value:function(){this.background.turnOffControl(),this.background.turnOffLoader()}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xe)}!function(e){e.SUCCESS="success",e.DECLINED="declined",e.CLOSE="close",e.REFERRED="referred",e.ERROR="error"}(je||(je={}));var Qe="paydock-dispatcher",et=function(){return s((function e(t){o(this,e),this.messageSource=t,this.env=new X(K)}),[{key:"restartDispatcher",value:function(){var e=document.getElementById(Qe);e&&e.parentNode&&e.parentNode.removeChild(e);var t=document.createElement("iframe");t.setAttribute("src",this.env.getConf().url+"/dispatcher"),t.id=Qe,t.style.display="none",document.body.appendChild(t)}},{key:"on",value:function(e,t){var n=this;se.subscribe("message",window,(function(i){var r=null;try{r=JSON.parse(i.data)}catch(e){}r&&r.message_source===n.messageSource&&r.event===e&&t(r)}))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.restartDispatcher()}}])}(),tt="close",nt=function(){return s((function e(){o(this,e),this.configs={width:500,height:500,scrollbars:!0,resizable:!0,top:0,left:0},this.eventEmitter=new Oe}),[{key:"isExist",value:function(){return!(!this.getElement()||this.getElement().closed)}},{key:"getElement",value:function(){return this.window}},{key:"init",value:function(){var e=this;if(!k.isSupportPopUp())return this.window=window;var t=this.getConfigs();this.window=window.open("about:blank","_blank","noopener=false,width=".concat(t.width,",height=").concat(t.height,",top=").concat(t.top,",left=").concat(t.left,",scrollbars=").concat(t.scrollbars?"yes":"no",",resizable=").concat(t.resizable?"yes":"no")),this.showLoader();var n=setInterval((function(){e.isExist()||(clearInterval(n),e.eventEmitter.emit(tt,{}))}),200)}},{key:"redirect",value:function(e){this.isExist()&&(this.window.location.href=e)}},{key:"close",value:function(){this.isExist()&&this.getElement().close&&(this.getElement().close(),this.window=null)}},{key:"focus",value:function(){this.isExist()&&this.getElement().focus&&this.getElement().focus()}},{key:"setConfigs",value:function(e){this.configs=c(this.configs,e)}},{key:"getNetConfigs",value:function(){return c({},this.configs)}},{key:"getConfigs",value:function(){var e=this.getNetConfigs();return e.left=window.screenX+(window.screen.width/2-e.width/2),e.top=window.screenY+(window.screen.height/2-e.height/2),e}},{key:"onClose",value:function(e){this.eventEmitter.subscribe(tt,e)}},{key:"initError",value:function(e){this.getElement().document.write("."),(this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0]).innerHTML="<style>\n .error-wrapper {\n color: #ff0000;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n }\n </style>"+'<div class="error-wrapper"><div>{{error}}</div></div>'.replace("{{error}}",e)}},{key:"showLoader",value:function(){this.getElement().document.write(".");var e=this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0];if(e.innerHTML=We+Ye,this.env===P&&this.env===R&&this.env===L&&this.env===x&&this.env===H&&this.env===I&&this.env===U&&this.env===M&&this.env===N&&this.env===D&&this.env===F&&this.env===V&&this.env===B&&this.env===j&&this.env===z&&this.env===q){var t=0;se.subscribe("click",e,(function(){5===++t&&(e.innerHTML='\n <style>\n html{width: 100%;height: 100%;}\n body{margin: 0px;padding: 0px;background-color: #111;}\n \n .eye{\n width: 20px; height: 8px;\n background-color: #eee;\n border-radius:0px 0px 20px 20px;\n position: relative;\n top: 40px;\n left: 10px;\n box-shadow: 40px 0px 0px 0px #eee; \n }\n \n .head{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden; \n position: relative;\n margin: -250px auto;\n width: 80px; height: 80px;\n background-color: #111;\n border-radius:50px;\n box-shadow: inset -4px 2px 0px 0px #eee;\n -webkit-animation:node 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n .body{ \n position: relative;\n margin: 90px auto;\n width: 140px; height: 120px;\n background-color: #111;\n border-radius: 50px/25px ;\n box-shadow: inset -5px 2px 0px 0px #eee;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out; \n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out; \n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out; \n }\n \n @keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-moz-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-moz-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-webkit-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-webkit-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n \n \n .circ{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin: 60px auto;\n width: 180px; height: 180px;\n background-color: #111;\n border-radius: 0px 0px 50px 50px;\n position: relative;\n z-index: -1; \n left: 0%;\n top: 20%;\n overflow: hidden;\n }\n \n .hands{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin-top: 140px;\n width: 120px;height: 120px;\n position: absolute;\n background-color: #111;\n border-radius:20px;\n box-shadow:-1px -4px 0px 0px #eee;\n transform:rotate(45deg);\n -webkit-transform:rotate(45deg);\n -mox-transform:rotate(45deg);\n top:75%;left: 16%;\n z-index: 1;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n \n .load{ position: absolute;\n width: 100px; height: 20px;\n margin: -10px auto;\n -webkit-font-smoothing: antialiased;\n -moz-font-smoothing: antialiased;\n font-smoothing: antialiased;\n font-family: \'Julius Sans One\', sans-serif;\n font-size:30px;\n font-weight:400;\n color:#eee;\n left: 10%;\n top: 5%;\n }\n </style>\n\n <div class="circ">\n <div class="load">A little patience ...</div>\n <div class="hands"></div>\n <div class="body"></div>\n <div class="head">\n <div class="eye"></div>\n </div>\n </div>\n')}))}}},{key:"setEnv",value:function(e){this.env=e}}])}(),it=function(e){function n(e){var i;return o(this,n),(i=t(this,n)).publicKey=e,i.checkout=null,i.dispatcher=new et("checkout.paydock"),setTimeout((function(){return i.dispatcher.restartDispatcher()}),200),i.popup=new nt,i}return l(n,e),s(n,[{key:"run",value:function(){this.isRunning()||(this.popup.init(),this.background.initControl())}},{key:"isRunning",value:function(){return this.popup.isExist()}},{key:"next",value:function(e){this.checkout=e,k.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.checkout.link)}},{key:"continue",value:function(){this.popup.focus()}},{key:"stop",value:function(){this.popup.close()}},{key:"onStop",value:function(e){var t=this;this.popup.onClose((function(){t.background.clear(),t.checkout=null,e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.dispatcher.on(e,(function(e){if(n.checkout&&n.checkout.reference_id===e.reference_id)n.background.clear(),t(n.checkout);else if(!k.isSupportPopUp()){var i=window.localStorage.getItem("paydock_checkout_token");if(!i)return;var r=JSON.parse(i);r&&r.reference_id===e.reference_id&&(window.localStorage.removeItem("paydock_checkout_token"),n.checkout=r,n.background.clear(),t(n.checkout))}}))}},{key:"setEnv",value:function(e,t){p(d(n.prototype),"setEnv",this).call(this,e,t),this.dispatcher.setEnv(e,t),this.popup.setEnv(e)}}])}($e());function rt(e){return"run"in e}function ot(e){return"setRedirectUrl"in e}!function e(t,n,i){function r(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,(function(e){return r(t[a][1][e]||e)}),l,l.exports,e,t,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)r(i[a]);return r}({1:[function(e,t,n){function i(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===i||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function a(){v&&p&&(v=!1,p.length?f=p.concat(f):m=-1,f.length&&s())}function s(){if(!v){var e=o(a);v=!0;for(var t=f.length;t;){for(p=f,f=[];++m<t;)p&&p[m].run();m=-1,t=f.length}p=null,v=!1,function(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var l,d,h=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:i}catch(e){l=i}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,f=[],v=!1,m=-1;h.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new u(e,t)),1!==f.length||v||o(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=c,h.addListener=c,h.once=c,h.off=c,h.removeListener=c,h.removeAllListeners=c,h.emit=c,h.prependListener=c,h.prependOnceListener=c,h.listeners=function(e){return[]},h.binding=function(e){throw Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],2:[function(e,t,n){(function(e){!function(e){if("function"==typeof bootstrap)bootstrap("promise",e);else if("object"==r(n)&&"object"==r(t))t.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=e}else{if("undefined"==typeof window&&"undefined"==typeof self)throw Error("This environment was not anticipated by Q. Please file a bug.");var i="undefined"!=typeof window?window:self,o=i.Q;i.Q=e(),i.Q.noConflict=function(){return i.Q=o,this}}}((function(){function t(e){return function(){return L.apply(e,arguments)}}function n(e,t){if(S&&t.stack&&"object"==r(e)&&null!==e&&e.stack){for(var n=[],o=t;o;o=o.source)o.stack&&(!e.__minimumStackCounter__||e.__minimumStackCounter__>o.stackCounter)&&(N(e,"__minimumStackCounter__",{value:o.stackCounter,configurable:!0}),n.unshift(o.stack));n.unshift(e.stack),N(e,"stack",{value:function(e){for(var t=e.split("\n"),n=[],r=0;r<t.length;++r){var o=t[r];a(o)||i(o)||!o||n.push(o)}return n.join("\n")}(n.join("\n"+B+"\n")),configurable:!0})}}function i(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function o(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var i=/.*@(.+):(\d+)$/.exec(e);return i?[i[1],Number(i[2])]:void 0}function a(e){var t=o(e);if(!t)return!1;var n=t[0],i=t[1];return n===T&&i>=A&&i<=Z}function s(){if(S)try{throw Error()}catch(n){var e=n.stack.split("\n"),t=o(e[0].indexOf("@")>0?e[1]:e[2]);if(!t)return;return T=t[0],t[1]}}function u(e){var t,n;return e instanceof h?e:m(e)?(t=e,n=c(),u.nextTick((function(){try{t.then(n.resolve,n.reject,n.notify)}catch(e){n.reject(e)}})),n.promise):k(e)}function c(){function e(e){t=e,u.longStackSupport&&S&&(o.source=e),H(n,(function(t,n){u.nextTick((function(){e.promiseDispatch.apply(e,n)}))}),void 0),n=void 0,i=void 0}var t,n=[],i=[],r=M(c.prototype),o=M(h.prototype);if(o.promiseDispatch=function(e,r,o){var a=x(arguments);n?(n.push(a),"when"===r&&o[1]&&i.push(o[1])):u.nextTick((function(){t.promiseDispatch.apply(t,a)}))},o.valueOf=function(){if(n)return o;var e=f(t);return v(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},u.longStackSupport&&S)try{throw Error()}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1),o.stackCounter=j++}return r.promise=o,r.resolve=function(n){t||e(u(n))},r.fulfill=function(n){t||e(k(n))},r.reject=function(n){t||e(g(n))},r.notify=function(e){t||H(i,(function(t,n){u.nextTick((function(){n(e)}))}),void 0)},r}function l(e){if("function"!=typeof e)throw TypeError("resolver must be a function.");var t=c();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function d(e){return l((function(t,n){for(var i=0,r=e.length;i<r;i++)u(e[i]).then(t,n)}))}function h(e,t,n){void 0===t&&(t=function(e){return g(Error("Promise does not support operation: "+e))}),void 0===n&&(n=function(){return{state:"unknown"}});var i=M(h.prototype);if(i.promiseDispatch=function(n,r,o){var a;try{a=e[r]?e[r].apply(i,o):t.call(i,r,o)}catch(e){a=g(e)}n&&n(a)},i.inspect=n,n){var r=n();"rejected"===r.state&&(i.exception=r.reason),i.valueOf=function(){var e=n();return"pending"===e.state||"rejected"===e.state?i:e.value}}return i}function p(e,t,n,i){return u(e).then(t,n,i)}function f(e){if(v(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function v(e){return e instanceof h}function m(e){var t;return(t=e)===Object(t)&&"function"==typeof e.then}function y(){q.length=0,K.length=0,W||(W=!0)}function g(t){var n,i,o=h({when:function(n){return n&&function(t){if(W){var n=I(K,t);-1!==n&&("object"==r(e)&&"function"==typeof e.emit&&u.nextTick.runAfter((function(){var i=I(Y,t);-1!==i&&(e.emit("rejectionHandled",q[n],t),Y.splice(i,1))})),K.splice(n,1),q.splice(n,1))}}(this),n?n(t):this}},(function(){return this}),(function(){return{state:"rejected",reason:t}}));return n=o,i=t,W&&("object"==r(e)&&"function"==typeof e.emit&&u.nextTick.runAfter((function(){-1!==I(K,n)&&(e.emit("unhandledRejection",i,n),Y.push(n))})),K.push(n),i&&void 0!==i.stack?q.push(i.stack):q.push("(no stack) "+i)),o}function k(e){return h({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},delete:function(t){delete e[t]},post:function(t,n){return null==t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return F(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function E(e,t,n){return u(e).spread(t,n)}function C(e,t,n){return u(e).dispatch(t,n)}function _(e){return p(e,(function(e){var t=0,n=c();return H(e,(function(i,r,o){var a;v(r)&&"fulfilled"===(a=r.inspect()).state?e[o]=a.value:(++t,p(r,(function(i){e[o]=i,0==--t&&n.resolve(e)}),n.reject,(function(e){n.notify({index:o,value:e})})))}),void 0),0===t&&n.resolve(e),n.promise}))}function w(e){if(0===e.length)return u.resolve();var t=u.defer(),n=0;return H(e,(function(i,r,o){var a=e[o];n++,p(a,(function(e){t.resolve(e)}),(function(e){0==--n&&(e.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+e.message,t.reject(e))}),(function(e){t.notify({index:o,value:e})}))}),void 0),t.promise}function b(e){return p(e,(function(e){return e=U(e,u),p(_(U(e,(function(e){return p(e,P,P)}))),(function(){return e}))}))}var S=!1;try{throw Error()}catch(e){S=!!e.stack}var T,O,A=s(),P=function(){},R=function(){function t(){for(var e,t;i.next;)e=(i=i.next).task,i.task=void 0,(t=i.domain)&&(i.domain=void 0,t.enter()),n(e,t);for(;c.length;)n(e=c.pop());a=!1}function n(e,n){try{e()}catch(e){if(u)throw n&&n.exit(),setTimeout(t,0),n&&n.enter(),e;setTimeout((function(){throw e}),0)}n&&n.exit()}var i={task:void 0,next:null},o=i,a=!1,s=void 0,u=!1,c=[];if(R=function(t){o=o.next={task:t,domain:u&&e.domain,next:null},a||(a=!0,s())},"object"==r(e)&&"[object process]"===e.toString()&&e.nextTick)u=!0,s=function(){e.nextTick(t)};else if("function"==typeof setImmediate)s="undefined"!=typeof window?setImmediate.bind(window,t):function(){setImmediate(t)};else if("undefined"!=typeof MessageChannel){var l=new MessageChannel;l.port1.onmessage=function(){s=d,l.port1.onmessage=t,t()};var d=function(){l.port2.postMessage(0)};s=function(){setTimeout(t,0),d()}}else s=function(){setTimeout(t,0)};return R.runAfter=function(e){c.push(e),a||(a=!0,s())},R}(),L=Function.call,x=t(Array.prototype.slice),H=t(Array.prototype.reduce||function(e,t){var n=0,i=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=i)throw TypeError()}for(;n<i;n++)n in this&&(t=e(t,this[n],n));return t}),I=t(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),U=t(Array.prototype.map||function(e,t){var n=this,i=[];return H(n,(function(r,o,a){i.push(e.call(t,o,a,n))}),void 0),i}),M=Object.create||function(e){function t(){}return t.prototype=e,new t},N=Object.defineProperty||function(e,t,n){return e[t]=n.value,e},D=t(Object.prototype.hasOwnProperty),F=Object.keys||function(e){var t=[];for(var n in e)D(e,n)&&t.push(n);return t},V=t(Object.prototype.toString);O="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var B="From previous event:";u.resolve=u,u.nextTick=R,u.longStackSupport=!1;var j=1;"object"==r(e)&&e&&e.env&&e.env.Q_DEBUG&&(u.longStackSupport=!0),u.defer=c,c.prototype.makeNodeResolver=function(){var e=this;return function(t,n){t?e.reject(t):arguments.length>2?e.resolve(x(arguments,1)):e.resolve(n)}},u.Promise=l,u.promise=l,l.race=d,l.all=_,l.reject=g,l.resolve=u,u.passByCopy=function(e){return e},h.prototype.passByCopy=function(){return this},u.join=function(e,t){return u(e).join(t)},h.prototype.join=function(e){return u([this,e]).spread((function(e,t){if(e===t)return e;throw Error("Q can't join: not the same: "+e+" "+t)}))},u.race=d,h.prototype.race=function(){return this.then(u.race)},u.makePromise=h,h.prototype.toString=function(){return"[object Promise]"},h.prototype.then=function(e,t,i){var r=this,o=c(),a=!1;return u.nextTick((function(){r.promiseDispatch((function(t){a||(a=!0,o.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return g(e)}}(t)))}),"when",[function(e){a||(a=!0,o.resolve(function(e){if("function"==typeof t){n(e,r);try{return t(e)}catch(e){return g(e)}}return g(e)}(e)))}])})),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,n,r=!1;try{t=e,n="function"==typeof i?i(t):t}catch(e){if(r=!0,!u.onerror)throw e;u.onerror(e)}r||o.notify(n)}]),o.promise},u.tap=function(e,t){return u(e).tap(t)},h.prototype.tap=function(e){return e=u(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},u.when=p,h.prototype.thenResolve=function(e){return this.then((function(){return e}))},u.thenResolve=function(e,t){return u(e).thenResolve(t)},h.prototype.thenReject=function(e){return this.then((function(){throw e}))},u.thenReject=function(e,t){return u(e).thenReject(t)},u.nearer=f,u.isPromise=v,u.isPromiseAlike=m,u.isPending=function(e){return v(e)&&"pending"===e.inspect().state},h.prototype.isPending=function(){return"pending"===this.inspect().state},u.isFulfilled=function(e){return!v(e)||"fulfilled"===e.inspect().state},h.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},u.isRejected=function(e){return v(e)&&"rejected"===e.inspect().state},h.prototype.isRejected=function(){return"rejected"===this.inspect().state};var z,q=[],K=[],Y=[],W=!0;u.resetUnhandledRejections=y,u.getUnhandledReasons=function(){return q.slice()},u.stopUnhandledRejectionTracking=function(){y(),W=!1},y(),u.reject=g,u.fulfill=k,u.master=function(e){return h({isDef:function(){}},(function(t,n){return C(e,t,n)}),(function(){return u(e).inspect()}))},u.spread=E,h.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},u.async=function(e){return function(){function t(e,t){var o,a;if("undefined"==typeof StopIteration){try{o=n[e](t)}catch(e){return g(e)}return o.done?u(o.value):p(o.value,i,r)}try{o=n[e](t)}catch(e){return"[object StopIteration]"===V(a=e)||a instanceof O?u(e.value):g(e)}return p(o,i,r)}var n=e.apply(this,arguments),i=t.bind(t,"next"),r=t.bind(t,"throw");return i()}},u.spawn=function(e){u.done(u.async(e)())},u.return=function(e){throw new O(e)},u.promised=function(e){return function(){return E([this,_(arguments)],(function(t,n){return e.apply(t,n)}))}},u.dispatch=C,h.prototype.dispatch=function(e,t){var n=this,i=c();return u.nextTick((function(){n.promiseDispatch(i.resolve,e,t)})),i.promise},u.get=function(e,t){return u(e).dispatch("get",[t])},h.prototype.get=function(e){return this.dispatch("get",[e])},u.set=function(e,t,n){return u(e).dispatch("set",[t,n])},h.prototype.set=function(e,t){return this.dispatch("set",[e,t])},u.del=u.delete=function(e,t){return u(e).dispatch("delete",[t])},h.prototype.del=h.prototype.delete=function(e){return this.dispatch("delete",[e])},u.mapply=u.post=function(e,t,n){return u(e).dispatch("post",[t,n])},h.prototype.mapply=h.prototype.post=function(e,t){return this.dispatch("post",[e,t])},u.send=u.mcall=u.invoke=function(e,t){return u(e).dispatch("post",[t,x(arguments,2)])},h.prototype.send=h.prototype.mcall=h.prototype.invoke=function(e){return this.dispatch("post",[e,x(arguments,1)])},u.fapply=function(e,t){return u(e).dispatch("apply",[void 0,t])},h.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},u.try=u.fcall=function(e){return u(e).dispatch("apply",[void 0,x(arguments,1)])},h.prototype.fcall=function(){return this.dispatch("apply",[void 0,x(arguments)])},u.fbind=function(e){var t=u(e),n=x(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(x(arguments))])}},h.prototype.fbind=function(){var e=this,t=x(arguments);return function(){return e.dispatch("apply",[this,t.concat(x(arguments))])}},u.keys=function(e){return u(e).dispatch("keys",[])},h.prototype.keys=function(){return this.dispatch("keys",[])},u.all=_,h.prototype.all=function(){return _(this)},u.any=w,h.prototype.any=function(){return w(this)},u.allResolved=(z=b,function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("allResolved is deprecated, use allSettled instead.",Error("").stack),z.apply(z,arguments)}),h.prototype.allResolved=function(){return b(this)},u.allSettled=function(e){return u(e).allSettled()},h.prototype.allSettled=function(){return this.then((function(e){return _(U(e,(function(e){function t(){return e.inspect()}return(e=u(e)).then(t,t)})))}))},u.fail=u.catch=function(e,t){return u(e).then(void 0,t)},h.prototype.fail=h.prototype.catch=function(e){return this.then(void 0,e)},u.progress=function(e,t){return u(e).then(void 0,void 0,t)},h.prototype.progress=function(e){return this.then(void 0,void 0,e)},u.fin=u.finally=function(e,t){return u(e).finally(t)},h.prototype.fin=h.prototype.finally=function(e){if(!e||"function"!=typeof e.apply)throw Error("Q can't apply finally callback");return e=u(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},u.done=function(e,t,n,i){return u(e).done(t,n,i)},h.prototype.done=function(t,i,o){var a=function(e){u.nextTick((function(){if(n(e,s),!u.onerror)throw e;u.onerror(e)}))},s=t||i||o?this.then(t,i,o):this;"object"==r(e)&&e&&e.domain&&(a=e.domain.bind(a)),s.then(void 0,a)},u.timeout=function(e,t,n){return u(e).timeout(t,n)},h.prototype.timeout=function(e,t){var n=c(),i=setTimeout((function(){t&&"string"!=typeof t||((t=Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)}),e);return this.then((function(e){clearTimeout(i),n.resolve(e)}),(function(e){clearTimeout(i),n.reject(e)}),n.notify),n.promise},u.delay=function(e,t){return void 0===t&&(t=e,e=void 0),u(e).delay(t)},h.prototype.delay=function(e){return this.then((function(t){var n=c();return setTimeout((function(){n.resolve(t)}),e),n.promise}))},u.nfapply=function(e,t){return u(e).nfapply(t)},h.prototype.nfapply=function(e){var t=c(),n=x(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},u.nfcall=function(e){var t=x(arguments,1);return u(e).nfapply(t)},h.prototype.nfcall=function(){var e=x(arguments),t=c();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},u.nfbind=u.denodeify=function(e){if(void 0===e)throw Error("Q can't wrap an undefined function");var t=x(arguments,1);return function(){var n=t.concat(x(arguments)),i=c();return n.push(i.makeNodeResolver()),u(e).fapply(n).fail(i.reject),i.promise}},h.prototype.nfbind=h.prototype.denodeify=function(){var e=x(arguments);return e.unshift(this),u.denodeify.apply(void 0,e)},u.nbind=function(e,t){var n=x(arguments,2);return function(){var i=n.concat(x(arguments)),r=c();return i.push(r.makeNodeResolver()),u((function(){return e.apply(t,arguments)})).fapply(i).fail(r.reject),r.promise}},h.prototype.nbind=function(){var e=x(arguments,0);return e.unshift(this),u.nbind.apply(void 0,e)},u.nmapply=u.npost=function(e,t,n){return u(e).npost(t,n)},h.prototype.nmapply=h.prototype.npost=function(e,t){var n=x(t||[]),i=c();return n.push(i.makeNodeResolver()),this.dispatch("post",[e,n]).fail(i.reject),i.promise},u.nsend=u.nmcall=u.ninvoke=function(e,t){var n=x(arguments,2),i=c();return n.push(i.makeNodeResolver()),u(e).dispatch("post",[t,n]).fail(i.reject),i.promise},h.prototype.nsend=h.prototype.nmcall=h.prototype.ninvoke=function(e){var t=x(arguments,1),n=c();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},u.nodeify=function(e,t){return u(e).nodeify(t)},h.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){u.nextTick((function(){e(null,t)}))}),(function(t){u.nextTick((function(){e(t)}))}))},u.noConflict=function(){throw Error("Q.noConflict only works when Q is used as a global")};var Z=s();return u}))}).call(this,e("_process"))},{_process:1}],3:[function(e,t,n){var i=function(e){switch(r(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,o){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==r(e)?Object.keys(e).map((function(r){var o=encodeURIComponent(i(r))+n;return Array.isArray(e[r])?e[r].map((function(e){return o+encodeURIComponent(i(e))})).join(t):o+encodeURIComponent(i(e[r]))})).join(t):o?encodeURIComponent(i(o))+n+encodeURIComponent(i(e)):""}},{}],4:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return l.default.information("zip:checkout:init"),d.default.Promise((function(t,n){return e.onCheckout(t,n,{})})).then((function(i){var r=i.redirect_uri||i.redirectUri||i.data&&(i.data.redirect_uri||i.data.redirectUri);if(!r)return l.default.debug("zip:checkout:error","Response does not contain redirectUri property"),n(i),void e.onError({code:"checkout_error",message:"The response does not contain the redirectUri property",detail:i});l.default.debug("zip:checkout:success",i),t({redirectUri:r})})).catch((function(t){l.default.debug("zip:checkout:error",t),n(t),e.onError({code:"checkout_error",message:"Checkout response error",detail:t})}))}Object.defineProperty(n,"__esModule",{value:!0}),n.Checkout=void 0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=i(e("./modal")),s=i(e("./options")),u=i(e("./utility")),l=i(e("./console")),d=i((e("./events"),e("q"))),h=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return o(e,null,[{key:"init",value:function(e){var t,n;if("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),e=c({},s.default,e),!this._validate(e))return l.default.setLevel(e.logLevel),e.redirect?r(e,(function(t){return e.redirectFn(t.redirectUri)})):(t=e,(n=new a.default).onClose=t.onComplete.bind(t),n.build(),void r(t,(function(e){return n.setUri(e.redirectUri)}),(function(e){return n.close(!1)})))}},{key:"attachButton",value:function(e,t){var n=document.querySelectorAll(e);if(!n.length)return config.onError({code:"attach_error",message:"Cannot find button to attach zipMoney checkout"});for(var i=0;i<n.length;i++)u.default.addEventHandler(n[i],"click",(function(){return Zip.Checkout.init(t)}))}},{key:"_validate",value:function(e){return 0>["error","information","debug"].indexOf(e.logLevel.toLowerCase())&&(e.logLevel="error"),0>["standard","express"].indexOf(e.request.toLowerCase())&&(e.request="standard"),e.onComplete=e.onComplete||function(){},e.onError=e.onError||function(){},e.checkoutUri||e.onCheckout!==s.default.onCheckout?"express"===e.request?e.onError({code:"not_implemented",message:"This feature is not yet implemented"}):e.redirect||e.onComplete!==s.default.onComplete||e.redirectUri?void 0:e.onError({code:"validation",message:"if onComplete function is not specified then redirectUri must be specified"}):e.onError({code:"validation",message:"if onCheckout function is not specified then checkoutUri must be specified"})}}]),e}();n.Checkout=h},{"./console":5,"./events":6,"./modal":8,"./options":9,"./utility":10,q:2}],5:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i="error";n.default={error:function(){var e;(e=window.console).log.apply(e,arguments)},information:function(){var e;"error"!==i&&(e=window.console).log.apply(e,arguments)},debug:function(){var e;"debug"===i&&(e=window.console).log.apply(e,arguments)},setLevel:function(e){i=e}}},{}],6:[function(e,t,n){(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.EventListener=void 0;var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();if(((i=e("./utility"))&&i.__esModule?i:{default:i}).default.isIe){var o=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};o.prototype=t.Event.prototype,t.CustomEvent=o}var a={},s=n.EventListener=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"constructor",value:function(){a={}}},{key:"on",value:function(e,t){a[e]=t}},{key:"off",value:function(e){a[e]=null}}]),e}();s.Event=function(e,t){this.eventType=e,this.data=t||{}},s.Event.eventTypes={resize:"resize",transition:"transition",close:"close",complete:"complete",clear:"clear"};var u=window.addEventListener?"addEventListener":"attachEvent",c=window[u];c("attachEvent"==u?"onmessage":"message",(function(e){var n,i;e.data.zipmoney&&(n=e.data.msg,i=new t.CustomEvent("zipmoney",{detail:n}),t.dispatchEvent(i))}),!1),c("zipmoney",(function(e){var t,n=a[e.detail.eventType];n?n(e.detail.data||{}):(t=e,console.log("Unexpected Event",t))}),!1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utility":10}],7:[function(e,t,n){(function(t){var n=e("./checkout"),i=e("./events");t.Zip=t.Zip||{},t.Zip.Checkout=n.Checkout,t.zipMoneyEvent=i.EventListener.ZipEvent}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./checkout":4,"./events":6}],8:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}function o(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function a(e){for(var t=document.querySelectorAll("html, body"),n=0;n<t.length;n++)t[n].style.overflowY=e}function s(e){var t=document.body.currentStyle||window.getComputedStyle(document.body),n=document.body.offsetHeight+(parseInt(t.marginTop,10)+parseInt(t.marginBottom,10))-parseInt(t.height,10);document.body.style.height=e-n+"px"}Object.defineProperty(n,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=i(e("./utility")),d=e("./events"),h=(i(e("./console")),{iframeWidth:400,iframeMinWidth:320,iframeInitialHeight:704,iframeMinHeight:600,verticalMargin:35}),p=["resize","transition","close","complete","clear"],f="https://d3k1w8lx8mqizo.cloudfront.net/zm/",v=function(){function e(){var t=this;(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,e),this._events=[],this._isMobile=l.default.isMobileDevice(),p.forEach((function(e){return d.EventListener.on(d.EventListener.Event.eventTypes[e],t[e].bind(t))}))}return u(e,[{key:"build",value:function(){this._initialHtmlHeight=o(),window.scrollTo(0,0);var e=this._frame=(t=this._frameUri,n=this._isMobile,(i=document.createElement("iframe")).id="zipmoney-iframe",i.frameborder=0,c(i.style,{padding:"0",border:"none",zIndex:"999999",backgroundColor:"#FFF",backgroundImage:"url("+f+"spinner.gif)",backgroundRepeat:"no-repeat",backgroundPosition:"50% 50%"}),c(i.style,n?{overflow:"scroll",width:"100%",height:"100%",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",margin:"0"}:{width:h.iframeWidth+"px",minWidth:h.iframeMinWidth+"px",height:h.iframeInitialHeight+"px",margin:h.verticalMargin+"px auto 0 auto",display:"table-row",backgroundSize:"25%",textAlign:"center",boxShadow:"0px 0px 70px 0px rgb(0, 0, 0)"}),i.src=t||"",i);if(!this._isMobile){var t,n,i,r,u,l=((r=document.createElement("img")).src=f+"icon-close.png",c(r.style,{width:"50px",height:"50px",position:"absolute",top:"20px",right:"20px",cursor:"pointer"}),r);l.onclick=this.close.bind(this),this._overlay=((u=document.createElement("div")).className="zipmoney-overlay",c(u.style,{position:"absolute",left:"0",top:"0",display:"table-cell",textAlign:"center",verticalAlign:"middle",background:"rgba(0, 0, 0, 0.75)",zIndex:"10000",height:"100%",width:"100%"}),u),this._overlay.appendChild(l),this._overlay.appendChild(this._frame),e=this._overlay}document.body.appendChild(e),this._isMobile&&s(this._frame.offsetHeight),a("auto"),this._startMonitoringWindowResize()}},{key:"setUri",value:function(e){this._frameUri=e,this._frame&&(this._frame.src=e)}},{key:"resize",value:function(e){var t=this._isMobile?16:0,n=(e=e>=h.iframeMinHeight?e:h.iframeMinHeight,(e+=t)+2*h.verticalMargin),i=r();this._frame.style.height=e+"px",this._overlay&&(this._overlay.style.height=Math.max(i,this._initialHtmlHeight,n)+"px"),this._isMobile&&s(e)}},{key:"transition",value:function(){window.scroll(0,0)}},{key:"close",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t={state:"cancelled"};this._events.length&&(t=this._events.pop()),this._destroy(),this.onClose&&e&&this.onClose(t)}},{key:"complete",value:function(e){this._events.push(e)}},{key:"clear",value:function(e){this._events=[]}},{key:"_startMonitoringWindowResize",value:function(){var e=this;this._resizeHandler=l.default.debounce((function(){var t,n,i,a;return t=e,n=r(),i=o(),a=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t._overlay&&(t._overlay.style.height=Math.max(n,i)+"px"),void(t._isMobile||a<h.iframeWidth?t._frame.style.width="100%":t._frame.style.width=h.iframeWidth+"px")}),250),l.default.addEventHandler(window,"resize",this._resizeHandler)}},{key:"_stopMonitoringWindowResize",value:function(){l.default.removeEventHandler(window,"resize",this._resizeHandler)}},{key:"_destroy",value:function(){this._stopMonitoringWindowResize(),this._overlay?document.body.removeChild(this._overlay):document.body.removeChild(this._frame),this._isMobile&&(document.body.style.height="initial"),a("initial"),this._overlay=this._frame=null,p.forEach((function(e){return d.EventListener.off(d.EventListener.Event.eventTypes[e])}))}}]),e}();n.default=v},{"./console":5,"./events":6,"./utility":10}],9:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r=i(e("./xr")),o=i(e("./console"));r.default.configure({headers:{"X-Requested-With":"XMLHttpRequest"}}),n.default={request:"standard",redirect:!1,logLevel:"Error",onCheckout:function(e,t,n){r.default.post(this.checkoutUri).then((function(t){return e(t.data)})).catch(t)},onShippingAddressChanged:function(e,t,n){r.default.post(this.shippingUri).then(e).catch(t)},onComplete:function(e){if(o.default.information("zip:completed",e),"cancelled"!==e.state){var t=e.checkoutId?"&checkoutId="+e.checkoutId:"";this.redirectFn(this.redirectUri+"?result="+e.state+t)}},onError:function(e){o.default.error(e)},redirectFn:function(e){window.location.href=e}}},{"./console":5,"./xr":11}],10:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"isIe",value:function(){var e=-1,t=window.navigator.userAgent,n=t.indexOf("MSIE "),i=t.indexOf("Trident/");if(n>0)e=parseInt(t.substring(n+5,t.indexOf(".",n)),10);else if(i>0){var r=t.indexOf("rv:");e=parseInt(t.substring(r+3,t.indexOf(".",r)),10)}return e>-1?e:void 0}},{key:"isMobileDevice",value:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}},{key:"debounce",value:function(e,t){var n;return function(){var i=this,r=arguments,o=!n;clearTimeout(n),n=setTimeout((function(){n=null,e.apply(i,r)}),t),o&&e.apply(i,r)}}},{key:"addEventHandler",value:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}},{key:"removeEventHandler",value:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}}]),e}();n.default=r},{}],11:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var r in n)if({}.hasOwnProperty.call(n,r)){var o=n[r];if("object"===(void 0===o?"undefined":u(o)))for(var a in o)({}).hasOwnProperty.call(o,a)&&(e[a]=o[a])}return e}function s(e){var t,n;return n=function(t,n){var i=a({},p,f,e),r=i.xmlHttpRequest();for(var s in i.abort&&e.abort((function(){n(o(r)),r.abort()})),r.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,c.default)(i.params):i.url,!0),r.withCredentials=i.withCredentials,r.addEventListener(h.LOAD,(function(){if(r.status>=200&&r.status<300){var e=null;r.responseText&&(e=!0===i.raw?r.responseText:i.load(r.responseText)),t(o(r,e))}else n(o(r))})),r.addEventListener(h.ABORT,(function(){return n(o(r))})),r.addEventListener(h.ERROR,(function(){return n(o(r))})),r.addEventListener(h.TIMEOUT,(function(){return n(o(r))})),i.headers)({}).hasOwnProperty.call(i.headers,s)&&r.setRequestHeader(s,i.headers[s]);for(var l in i.events)({}).hasOwnProperty.call(i.events,l)&&r.addEventListener(l,i.events[l].bind(null,r),!1);var d="object"!==u(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?r.send(d):r.send()},((t=e)&&t.promise?t.promise:f.promise||p.promise)(n)}Object.defineProperty(n,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},c=i(e("querystring/encode")),l=i(e("q")),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},h={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:JSON.stringify,load:JSON.parse,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return l.default.Promise(e)},withCredentials:!1},f={};s.assign=a,s.encode=c.default,s.configure=function(e){f=a({},f,e)},s.Methods=d,s.Events=h,s.defaults=p,s.get=function(e,t,n){return s(a({url:e,method:d.GET,params:t},n))},s.put=function(e,t,n){return s(a({url:e,method:d.PUT,data:t},n))},s.post=function(e,t,n){return s(a({url:e,method:d.POST,data:t},n))},s.patch=function(e,t,n){return s(a({url:e,method:d.PATCH,data:t},n))},s.del=function(e,t){return s(a({url:e,method:d.DELETE},t))},s.options=function(e,t){return s(a({url:e,method:d.OPTIONS},t))},n.default=s},{q:2,"querystring/encode":3}]},{},[7]);var at,st=function(e){function n(){var e;return o(this,n),(e=t(this,n)).apiEnv=new X(Y),e}return l(n,e),s(n,[{key:"setEnv",value:function(e,t){p(d(n.prototype),"setEnv",this).call(this,e,t),this.apiEnv.setEnv(e,t)}},{key:"getCheckoutUri",value:function(e){return this.apiEnv.getConf().url+"/v1/echo?"+ne.serialize({json_body:JSON.stringify({redirect_uri:e})})}}])}(Xe),ut=function(e){function n(){var e;return o(this,n),(e=t(this,n)).runs=!1,e.eventEmitter=new Oe,e}return l(n,e),s(n,[{key:"run",value:function(){this.runs=!0,this.background.initLoader()}},{key:"isRunning",value:function(){return this.runs}},{key:"next",value:function(e){var t=this;this.background.clear(),this.checkout=e;var n=this.getCheckoutUri(this.checkout.link);Zip.Checkout.init({checkoutUri:n,onComplete:function(e){return t.eventHandler(e)},onError:function(e){return t.eventHandler(e)}})}},{key:"getSuccessRedirectUri",value:function(){return this.suspendedRedirectUri?this.suspendedRedirectUri:this.widgetEnv.getConf().url+String("/checkout/zipmoney/suspended")}},{key:"getErrorRedirectUri",value:function(){return this.getSuccessRedirectUri()}},{key:"stop",value:function(){p(d(n.prototype),"stop",this).call(this),this.runs=!1;var e=document.querySelector(".zipmoney-overlay");e&&e.remove(),this.eventEmitter.emit(je.CLOSE)}},{key:"onStop",value:function(e){var t=this;this.eventEmitter.subscribe(je.CLOSE,(function(){t.background.clear(),e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.eventEmitter.subscribe(e,(function(){t(n.checkout)}))}},{key:"eventHandler",value:function(e){switch(this.runs=!1,e.state){case"approved":this.eventEmitter.emit(je.CLOSE),this.eventEmitter.emit(je.SUCCESS);break;case"declined":this.eventEmitter.emit(je.CLOSE),this.eventEmitter.emit(je.DECLINED);break;case"cancelled":this.eventEmitter.emit(je.CLOSE);break;case"referred":this.eventEmitter.emit(je.CLOSE),this.eventEmitter.emit(je.REFERRED);break;default:console.warn("".concat("[CheckoutButton:Zipmoney]"," Unknown gateway status."))}}}])}($e(st)),ct="[Paydock:StorageDispatcher]";!function(e){e.WIDGET_SESSION="widget-session"}(at||(at={}));var lt,dt,ht=function(){return s((function e(t){o(this,e),this.messageSource=t,this.defaultPayload={destination:"widget.paydock"},this.env=new X(K),this.defaultPayload.source=t,this.iframeEvent=new de(window)}),[{key:"create",value:function(e){this.onLoadCallback=e,this.dispatcherFrame&&this.destroy(),this.widgetId=ie.generate(),this.setupIframeEventListeners();var t=document.createElement("iframe");return t.setAttribute("src",this.env.getConf().url+"/storage-dispatcher"+"?widgetId=".concat(this.widgetId)),t.setAttribute("id","pd-storage-dispatcher"),t.style.display="none",document.body.appendChild(t),this.dispatcherFrame=t,console.info("".concat(ct," initialized.")),t}},{key:"destroy",value:function(){this.dispatcherFrame&&this.dispatcherFrame.parentNode&&this.dispatcherFrame.parentNode.removeChild(this.dispatcherFrame),this.iframeEvent.clear(),this.widgetId=void 0,this.dispatcherFrame=void 0}},{key:"push",value:function(e,t){var n;if(this.pushCallbacks=t,this.dispatcherFrame){var i=c(c({},this.defaultPayload),e);null===(n=this.dispatcherFrame.contentWindow)||void 0===n||n.postMessage(i,this.env.getConf().url)}else console.error("".concat(ct," dispatcher is not initialized."))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.create(this.onLoadCallback)}},{key:"setupIframeEventListeners",value:function(){var e=this;this.widgetId&&(this.iframeEvent.on(le.AFTER_LOAD,this.widgetId,(function(t){var n;null===(n=e.onLoadCallback)||void 0===n||n.call(e)})),this.iframeEvent.on(le.DISPATCH_SUCCESS,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onSuccess)||void 0===i||i.call(n)})),this.iframeEvent.on(le.DISPATCH_ERROR,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onError)||void 0===i||i.call(n)})))}}])}(),pt=function(e){function n(){var e;return o(this,n),(e=t(this,n)).storageDispatcher=new ht("zipmoney.checkout.paydock"),e}return l(n,e),s(n,[{key:"getProxyRedirectUrl",value:function(){return this.widgetEnv.getConf().url+"/checkout/zipmoney/response"}},{key:"next",value:function(e,t){var n=this;this.storageDispatcher.create((function(){var i={merchant_redirect_url:n.getRedirectUrl(),checkout_token:e.token,public_key:t.public_key,gateway_id:t.gateway_id};n.storageDispatcher.push({intent:at.WIDGET_SESSION,data:i},{onSuccess:function(){var t=n.getCheckoutUri(e.link);Zip.Checkout.init({checkoutUri:t,redirect:!0})},onError:function(){console.error("Error initializing Zip Checkout")}})}))}},{key:"getSuccessRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"getErrorRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"setEnv",value:function(e,t){p(d(n.prototype),"setEnv",this).call(this,e,t),this.storageDispatcher.setEnv(e,t)}}])}(function(){return function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"setRedirectUrl",value:function(e){this.merchantRedirectUrl=e}},{key:"getRedirectUrl",value:function(){return this.merchantRedirectUrl}},{key:"error",value:function(e,t,n){n(!1)}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xe)}(st)),ft=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+ne.extendSearchParams("/checkout/success","merchant",encodeURIComponent(window.location.href))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+ne.extendSearchParams("/checkout/error","merchant",encodeURIComponent(window.location.href))}}])}(it),vt=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/success".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/error".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"next",value:function(e,t){this.checkout=e,k.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.getRedirectUrl(this.checkout,t))}},{key:"error",value:function(e,t,n){return!t||t&&"invalid_amount"!==t?n(!0):(this.popup.initError(e),n(!1))}},{key:"run",value:function(){this.isRunning()||(this.popup.setConfigs({width:420,height:715}),this.popup.init(),this.background.initControl())}},{key:"getRedirectUrl",value:function(e,t){return this.widgetEnv.getConf().url+"/checkout/afterpay/init?"+ne.serialize(c(c({},t),{token:e.reference_id,env:"live"===e.mode?"live":"test"}))}}])}(it),mt={EXTERNAL_CHECKOUT_TOKEN:"external_checkout_token",CHECKOUT_TOKEN:"checkout_token",BANK_ACCOUNT:"bank_account",CARD:"card"},yt=function(e){function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:mt.CARD;switch(o(this,n),(r=t(this,n)).body={gateway_id:e,type:a},a){case mt.CARD:case mt.BANK_ACCOUNT:delete i.gateway_id,delete i.type,delete i.checkout_token,r.body=c(r.body,i);break;case mt.CHECKOUT_TOKEN:case mt.EXTERNAL_CHECKOUT_TOKEN:r.body.checkout_token=i;break;default:throw new Error("Unsupported type of PaymentSourceToken")}return r}return l(n,e),s(n,[{key:"getLink",value:function(){return"/v1/payment_sources/tokens"}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.create(e,this.getConfigs(),(function(e,n){return t(e)}),(function(e,t){void 0===e.message?n("unknown error"):n(e.message)}))}},{key:"getConfigs",value:function(){return this.body}}])}(ze),gt=function(){return s((function e(t,n,i,r){var a=this;o(this,e),this.background=t,this.runner=n,this.eventEmitter=i,this.params=r,this.runner.onStop((function(){a.eventEmitter.emit(Le.CLOSE)}))}),[{key:"init",value:function(e){var t=this;this.setEnv(e),this.runner.onCheckout(je.SUCCESS,(function(e){t.eventEmitter.emit(Le.ACCEPTED,{}),t.background.initLoader(),t.runner.stop(),t.checkToken(e.token,(function(){t.createOneTimeToken(e.token)}))})),this.runner.onCheckout(je.ERROR,(function(){t.eventEmitter.emit(Le.ERROR),console.error("".concat(Ie," Error from checkout server.")),t.runner.stop()})),this.runner.onCheckout(je.REFERRED,(function(){t.eventEmitter.emit(Le.REFERRED),t.runner.stop()})),this.runner.onCheckout(je.DECLINED,(function(){t.eventEmitter.emit(Le.DECLINED),t.runner.stop()})),this.eventEmitter.subscribe(Le.ERROR,(function(){t.runner.stop()})),this.eventEmitter.subscribe(Le.FINISH,(function(e){t.background.clear()}))}},{key:"setEnv",value:function(e){this.env=e}},{key:"checkToken",value:function(e,t){var n=this,i=new Ke(e);i.setEnv(this.env),i.send(this.params.accessToken,(function(e){n.details=e,t()}),(function(){n.eventEmitter.emit(Le.ERROR,{}),console.error("".concat(Ie," Error during creating payment source token."))}))}},{key:"createOneTimeToken",value:function(e){var t=this,n=new yt(this.params.gatewayId,e,mt.CHECKOUT_TOKEN);n.setEnv(this.env),n.send(this.params.accessToken,(function(e){t.eventEmitter.emit(Le.FINISH,{payment_source_token:e,checkout_email:t.details.checkout_email,checkout_holder:t.details.checkout_holder,gateway_type:t.details.gateway_type})}),(function(){t.eventEmitter.emit(Le.ERROR,{}),console.error("".concat(Ie," Error during creating payment source token."))}))}}])}(),kt=function(){return s((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pe.PAYPAL,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ae.CONTEXTUAL;o(this,e),this.accessToken=n,this.gatewayId=i,this.gatewayType=r,this.mode=a,this.window=window,this.meta={},this.env=Z,this.eventEmitter=new Oe,this.container=new ue(t),this.initCheckout(this.container),this.chooseRunner(r,a)}),[{key:"chooseRunner",value:function(e,t){var n=this.getRunnerByMode(e,t);this.runner=new n(this.accessToken),rt(this.runner)?(this.background=new Je,this.checkoutHandler=new gt(this.background,this.runner,this.eventEmitter,{accessToken:this.accessToken,gatewayId:this.gatewayId}),this.checkoutHandler.init(this.env)):(this.background=void 0,this.checkoutHandler=void 0)}},{key:"buildAdditionalParams",value:function(){return{}}},{key:"initCheckout",value:function(e){var t=this;e.on("click",(function(e){if(rt(t.runner)){if(t.runner.isRunning())return;t.runner.run()}else if(ot(t.runner)&&!t.runner.getRedirectUrl())throw Error("".concat(Ie," The merchant redirect URL should is required in the '").concat(t.mode,"' mode."));t.eventEmitter.emit(Le.CLICK);var n=new qe(t.gatewayId,t.runner.getSuccessRedirectUri(),t.runner.getErrorRedirectUri());n.setMeta(t.meta),n.setEnv(t.env),n.send(t.accessToken,(function(e){var n=rt(t.runner)?Le.POPUP_REDIRECT:Le.REDIRECT;t.eventEmitter.emit(n),t.runner.next(e,t.buildAdditionalParams())}),(function(e,n){console.error("".concat(Ie," ").concat(e)),t.eventEmitter.emit(Le.ERROR,{error:e,code:n}),t.runner.error(e,n,(function(e){e&&t.close()}))}))}))}},{key:"on",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"close",value:function(){this.assertMethodSupport(this.runner,Ae.CONTEXTUAL)&&this.runner.stop()}},{key:"onFinishInsert",value:function(e,t){this.on(Le.FINISH,(function(n){se.insertToInput(e,t,n)}))}},{key:"setMeta",value:function(e){this.meta=c(this.meta,e)}},{key:"setBackdropDescription",value:function(e){this.assertMethodSupport(this.runner,Ae.CONTEXTUAL)&&this.runner.setBackgroundDescription(e)}},{key:"setBackdropTitle",value:function(e){this.assertMethodSupport(this.runner,Ae.CONTEXTUAL)&&this.runner.setBackgroundTitle(e)}},{key:"setSuspendedRedirectUri",value:function(e){this.assertMethodSupport(this.runner,Ae.CONTEXTUAL)&&this.runner.setSuspendedRedirectUri(e)}},{key:"setRedirectUrl",value:function(e){this.assertMethodSupport(this.runner,Ae.REDIRECT)&&this.runner.setRedirectUrl(e)}},{key:"getSuccessRedirectUri",value:function(){return this.runner.getSuccessRedirectUri()}},{key:"turnOffBackdrop",value:function(){this.turnOffControlBackdrop(),this.turnOffLoaderBackdrop()}},{key:"turnOffControlBackdrop",value:function(){this.assertMethodSupport(this.runner,Ae.CONTEXTUAL)&&this.runner.turnOffBackdrop()}},{key:"turnOffLoaderBackdrop",value:function(){var e;null===(e=this.background)||void 0===e||e.turnOffLoader()}},{key:"setEnv",value:function(e,t){var n;this.env=e,this.alias=t,null===(n=this.checkoutHandler)||void 0===n||n.setEnv(e),this.runner.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env}},{key:"getRunnerByMode",value:function(e,t){if(e===Pe.PAYPAL){if(t===Ae.REDIRECT)throw Error("".concat(Ie," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return ft}if(e===Pe.AFTERPAY){if(t===Ae.REDIRECT)throw Error("".concat(Ie," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return vt}if(e===Pe.ZIPMONEY)return t===Ae.CONTEXTUAL?ut:pt;throw Error("".concat(Ie," Unsupported gateway."))}},{key:"assertMethodSupport",value:function(e,t){var n="".concat(Ie," The method is not supported in the '").concat(t,"' mode.");switch(t){case Ae.CONTEXTUAL:if(rt(e))return!0;console.warn(n);break;case Ae.REDIRECT:if(ot(e))return!0;console.warn(n)}return!1}}])}(),Et=function(e){function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ae.CONTEXTUAL;return o(this,n),(r=t(this,n,[e,i,a,Pe.ZIPMONEY,s])).publicKey=i,r.gatewayId=a,r.mode=s,r}return l(n,e),s(n,[{key:"setSuspendedRedirectUri",value:function(e){p(d(n.prototype),"setSuspendedRedirectUri",this).call(this,e)}},{key:"setRedirectUrl",value:function(e){rt(this.runner)&&(p(d(n.prototype),"chooseRunner",this).call(this,Pe.ZIPMONEY,Ae.REDIRECT),p(d(n.prototype),"setEnv",this).call(this,this.env,this.alias)),p(d(n.prototype),"setRedirectUrl",this).call(this,e)}},{key:"buildAdditionalParams",value:function(){return c(c({},p(d(n.prototype),"buildAdditionalParams",this).call(this)),{public_key:this.publicKey,gateway_id:this.gatewayId})}}])}(kt),Ct=function(e){function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return o(this,n),(r=t(this,n,[e,i,a,Pe.AFTERPAY])).accessToken=i,r.gatewayId=a,r.showETP=!1,r}return l(n,e),s(n,[{key:"showEnhancedTrackingProtectionPopup",value:function(e){var t=k.getBrowserInfo(),n=t.name,i=t.version;e&&"Firefox"===n&&+i>=100&&(this.showETP=!0)}},{key:"buildAdditionalParams",value:function(){var e=p(d(n.prototype),"buildAdditionalParams",this).call(this);return this.showETP&&(e.show_etp=!0),e}}])}(kt),_t=function(e){function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return o(this,n),(r=t(this,n,[e,i,a,Pe.PAYPAL])).publicKey=i,r.gatewayId=a,r}return l(n,e),s(n)}(kt),wt=function(){return s((function e(){o(this,e)}),null,[{key:"values",value:function(e){return Object.keys(e).map((function(t){return e[t]}))}}])}(),bt=function(){return s((function e(t,n){o(this,e),this.configs=[],this.configTokens=[],this.link=new ae("/payment-sources"),this.link.setParams(c({query_token:n},b.validateJWT(t)?{access_token:t}:{public_key:t})),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type})}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==wt.values(Ne).indexOf(e)?this.link.setParams(u({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"setLimit",value:function(e){this.link.setParams({limit:e})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"getIFrameUrl",value:function(){return this.link.getUrl()}},{key:"filterByGatewayIds",value:function(e){this.link.setParams({gateway_ids:e.join(",")})}},{key:"filterByTypes",value:function(e){var t,n=[],i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=m(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;e.hasOwnProperty(r)&&(-1===wt.values(Ue).indexOf(r)?console.warn("PaymentSourceWidget::filterByTypes: unsupported type ".concat(r)):n.push(r))}}catch(e){i.e(e)}finally{i.f()}this.link.setParams({payment_source_types:n.join(",")})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),St=function(e){function n(e,i,r){var a;return o(this,n),(a=t(this,n,[i,r])).container=new ue(e),a.iFrame=new ce(a.container),a.event=new de(window),a}return l(n,e),s(n,[{key:"load",value:function(){this.iFrame.load(this.getIFrameUrl(),{title:"Payment Sources"})}},{key:"on",value:function(e,t){this.event.on(e,this.link.getParams().widget_id,t)}},{key:"hide",value:function(e){console.info("PayDock SDK"),this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"onSelectInsert",value:function(e,t){this.on(le.SELECT,(function(n){se.insertToInput(e,t,n)}))}}])}(bt);!function(e){e.IFRAME_LOADED="iframeLoaded",e.CHECKOUT_READY="checkoutReady",e.CHECKOUT_COMPLETED="checkoutCompleted",e.CHECKOUT_ERROR="checkoutError",e.CHECKOUT_POPUP_OPEN="checkoutPopupOpen",e.CHECKOUT_POPUP_CLOSE="checkoutPopupClose"}(lt||(lt={})),function(e){e.CRITICAL_ERROR="CriticalError",e.USER_ERROR="UserError",e.SUCCESS="Success"}(dt||(dt={}));var Tt,Ot={PRIMARY_BUTTON_COLOR:"primary_button_color",SECONDARY_BUTTON_COLOR:"secondary_button_color",PRIMARY_BUTTON_TEXT_COLOR:"primary_button_text_color",SECONDARY_BUTTON_TEXT_COLOR:"secondary_button_text_color",FONT_FAMILY:"font_family",ENABLE_SRC_POPUP:"enable_src_popup"},At=function(){return s((function e(t,n,i,r,a,s,u,l){o(this,e),this.meta=r,this.eventEmitter=a,this.autoResize=s,this.link=new ae("/secure-remote-commerce/mastercard"),this.link.setParams(c({service_id:n,public_key:i},r&&{meta:JSON.stringify(r)})),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type}),u&&this.link.setEnv(u,l),this.iFrameContainer=new ue(t),this.iFrame=new ce(this.iFrameContainer),this.iFrameEvent=new de(window),this.setupIFrameEvents()}),[{key:"setupIFrameEvents",value:function(){var e=this,t=this.link.getParams().widget_id;t&&(this.iFrameEvent.on(lt.CHECKOUT_READY,t,(function(t){var n=t.data;e.eventEmitter.emit(lt.CHECKOUT_READY,n)})),this.iFrameEvent.on(lt.CHECKOUT_COMPLETED,t,(function(t){var n=t.data;e.eventEmitter.emit(lt.CHECKOUT_COMPLETED,n)})),this.iFrameEvent.on(lt.CHECKOUT_POPUP_OPEN,t,(function(t){var n=t.data;e.eventEmitter.emit(lt.CHECKOUT_POPUP_OPEN,n)})),this.iFrameEvent.on(lt.CHECKOUT_POPUP_CLOSE,t,(function(t){var n=t.data;e.eventEmitter.emit(lt.CHECKOUT_POPUP_CLOSE,n)})),this.iFrameEvent.on(lt.CHECKOUT_ERROR,t,(function(t){var n=t.data;e.eventEmitter.emit(lt.CHECKOUT_ERROR,n)})),this.autoResize&&this.useAutoResize(!0))}},{key:"load",value:function(){var e=this;this.iFrame.load(this.link.getUrl(),{title:"Mastercard SRC checkout"});var t=this.iFrame.getElement();this.iFrame.setStyle("width","100%"),t&&(t.onload=function(){return e.eventEmitter.emit(lt.IFRAME_LOADED,{})})}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"hideCheckout",value:function(e){this.iFrame&&this.iFrame.hide()}},{key:"showCheckout",value:function(){this.iFrame&&this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"useAutoResize",value:function(e){var t=this;if(!this.autoResize||e){this.autoResize=!0;var n=this.link.getParams();(null==n?void 0:n.widget_id)&&this.iFrameEvent.on("resize",n.widget_id,(function(e){var n,i,r=e.data,o=t.iFrame.getElement();o&&(o.scrolling="no",(null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.height)&&t.iFrame.setStyle("height",(null===(i=null==r?void 0:r.data)||void 0===i?void 0:i.height)+"px"))}))}}}])}(),Pt=function(e){function n(e,i,r,a){var s;return o(this,n),(s=t(this,n,[e,i,r,a])).iframe_selector=e,s.service_id=i,s.public_key_or_access_token=r,s.meta=a,s}return l(n,e),s(n,[{key:"load",value:function(){this.provider||(this.meta.customizations=this.style,this.provider=new At(this.iframe_selector,this.service_id,this.public_key_or_access_token,this.meta,this.eventEmitter,this.autoResize,this.env,this.alias),this.provider.load())}}])}(function(){return s((function e(t,n,i,r){o(this,e),this.iframe_selector=t,this.service_id=n,this.public_key_or_access_token=i,this.meta=r,this.autoResize=!1,this.style={},this.api=new be(i,g.PUBLIC_KEY),this.eventEmitter=new Oe}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==wt.values(Ot).indexOf(e)?this.style[e]=t:console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){var e=this;this.provider||this.api.service().getConfig(this.service_id).then((function(t){var n=t.type;if(e.meta.customizations=e.style,n===pe.MASTERCARD_SRC)e.provider=new At(e.iframe_selector,e.service_id,e.public_key_or_access_token,e.meta,e.eventEmitter,e.autoResize,e.env,e.alias);e.provider&&e.provider.load()}))}},{key:"setEnv",value:function(e,t){this.provider||(this.env=e,this.alias=t,this.api.setEnv(e,t))}},{key:"getEnv",value:function(){return this.provider?this.provider.getEnv():this.env}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"hideCheckout",value:function(e){this.provider&&"function"==typeof this.provider.hideCheckout&&this.provider.hideCheckout(e)}},{key:"showCheckout",value:function(){this.provider&&"function"==typeof this.provider.showCheckout&&this.provider.showCheckout()}},{key:"reload",value:function(){this.provider&&this.provider.reload()}},{key:"useAutoResize",value:function(){this.autoResize=!0,this.provider&&"function"==typeof this.provider.useAutoResize&&this.provider.useAutoResize()}}])}()),Rt={SUBMIT_FORM:"submit_form",CHANGE_TAB:"tab",HIDE_ELEMENTS:"hide_elements",SHOW_ELEMENTS:"show_elements",REFRESH_CHECKOUT:"refresh_checkout",UPDATE_FORM_VALUES:"update_form_values",INIT_CHECKOUT:"init_checkout"},Lt=function(){return s((function e(t){o(this,e),this.iFrame=t}),[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===wt.values(Rt).indexOf(e)&&console.warn("unsupported trigger type");var n={trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}();!function(e){e.AFTER_LOAD="after_load",e.SYSTEM_ERROR="system_error",e.CVV_SECURE_CODE_REQUESTED="cvv_secure_code_requested",e.CARD_NUMBER_SECURE_CODE_REQUESTED="card_number_secure_code_requested",e.ACCESS_FORBIDDEN="access_forbidden",e.SESSION_EXPIRED="session_expired",e.OPERATION_FORBIDDEN="operation_forbidden"}(Tt||(Tt={}));var xt,Ht=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"on",value:function(e,t,n){for(var i in Tt)Tt.hasOwnProperty(i)&&e===Tt[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(de),It=function(){return s((function e(t,n){o(this,e),this.validationData={},this.configs=[],this.container=new ue(t),this.iFrame=new ce(this.container),this.triggerElement=new Lt(this.iFrame),this.event=new Ht(window),this.vaultDisplayToken=n,this.link=new ae("/vault-display"),this.link.setParams({vault_display_token:n})}),[{key:"setEnv",value:function(e,t){this.link.setEnv(e,t)}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==wt.values(Ne).indexOf(e)?this.link.setParams(u({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){this.iFrame.load(this.link.getUrl(),{title:"Vault Display"})}}])}();!function(e){e.AFTER_LOAD="after_load",e.UNAVAILABLE="unavailable",e.START_LOADING="start_loading",e.END_LOADING="end_loading",e.UPDATE="update",e.PAYMENT_SUCCESSFUL="payment_successful",e.PAYMENT_IN_REVIEW="payment_in_review",e.PAYMENT_ERROR="payment_error"}(xt||(xt={}));var Ut=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"on",value:function(e,t,n){for(var i in xt)xt.hasOwnProperty(i)&&e===xt[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(de),Mt={CLOSE:"close",UPDATED:"updated"},Nt=function(e){function n(e,i){var r;return o(this,n),(r=t(this,n,[e])).widgetId=i,r}return l(n,e),s(n,[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===wt.values(Mt).indexOf(e)&&console.warn("unsupported trigger type");var n={message_source:"wallet.paydock",reference_id:this.widgetId,trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}(Lt),Dt=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return o(this,n),(i=t(this,n)).bgImageUrl=e,i.hideCloseButton=r,i.imageStyle=null,i}return l(n,e),s(n,[{key:"initControl",value:function(){this.imageStyle||this.createImageStyles(),p(d(n.prototype),"initControl",this).call(this)}},{key:"clear",value:function(){this.imageStyle&&this.imageStyle.parentNode.removeChild(this.imageStyle),this.imageStyle=null,p(d(n.prototype),"clear",this).call(this)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <div class="checkout-bg-logo"></div>\n <a href="#" data-close>Close</a>\n </div>\n');!0===this.hideCloseButton&&(n=n.replace('<a href="#" data-close>Close</a>',"")),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createImageStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n }\n\n .checkout-overlay {\n z-index: 2147483647;\n }\n\n .checkout-container [data-close] {\n opacity: 1;\n }\n .checkout-container [data-close]:before,\n .checkout-container [data-close]:after {\n background-color: #fff;\n }\n");document.querySelector(".checkout-container"),t=t.replace("{{url}}",this.bgImageUrl),this.imageStyle=document.createElement("style"),this.imageStyle.type="text/css",this.imageStyle.appendChild(document.createTextNode(t)),e.appendChild(this.imageStyle)}}])}(Je),Ft={UNAVAILABLE:"unavailable",UPDATE:"update",PAYMENT_METHOD_SELECTED:"payment_method_selected",PAYMENT_SUCCESS:"payment_success",PAYMENT_IN_REVIEW:"payment_in_review",PAYMENT_ERROR:"payment_error",CALLBACK:"callback",AUTH_TOKENS_CHANGED:"auth_tokens_changed",BUTTON_CLICK:"button_click",CHECKOUT_OPEN:"checkout_open",CHECKOUT_CLOSE:"checkout_close"},Vt=function(){return s((function e(t,n){o(this,e),this.publicKey=t,this.meta=n,this.env=Z,this.eventEmitter=new Oe,this.initializeChildWallets()}),[{key:"initializeChildWallets",value:function(){this.childWallets=[]}},{key:"getGatewayName",value:function(){throw new Error("Method not implemented")}},{key:"setEnv",value:function(e){return this.env=e,this}},{key:"load",value:function(e){this.childWallets.forEach((function(t){return t.load(e)}))}},{key:"update",value:function(e){}},{key:"enable",value:function(){}},{key:"disable",value:function(){}},{key:"on",value:function(e,t){var n=this;if(-1===wt.values(Ft).indexOf(e))throw new Error("invalid wallet event");return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}}])}(),Bt=function(e){function n(e,i){var r;o(this,n),(r=t(this,n,[e,i])).link=new ae(re);var a=i.amount,s=i.currency,u=i.id,l=i.gateway_mode,d=i.reference,h=i.request_shipping;return r.link.setParams(c({token:e,amount:a,currency:s,gateway_mode:l,credentials:d||u},h?{request_shipping:h}:{})),$.version&&r.link.setParams({sdk_version:$.version,sdk_type:$.type}),r.token=e,r.event=new Ut(window),r}return l(n,e),s(n,[{key:"load",value:function(e){this.container=e,this.iFrame=new ce(this.container);var t=this.link.getParams().widget_id;this.triggerElement=new Nt(this.iFrame,t),this.setupIFrameEvents(t),this.background=this.initBackground(),this.iFrame.load(this.link.getUrl())}},{key:"close",value:function(){this.triggerElement.push(Mt.CLOSE),this.background.clear()}},{key:"update",value:function(e){this.triggerElement.push(Mt.UPDATED,e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),this}},{key:"initBackground",value:function(){var e=this,t=new Dt(this.link.getNetUrl().replace(re,oe));return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Ze,(function(){return e.triggerElement.push(Mt.CLOSE)})),t}},{key:"setupIFrameEvents",value:function(e){var t=this;this.event.on(xt.UNAVAILABLE,e,(function(e){return t.eventEmitter.emit(Ft.UNAVAILABLE,null)})),this.event.on(xt.START_LOADING,e,(function(e){return t.background.initControl()})),this.event.on(xt.END_LOADING,e,(function(e){return t.background.clear()})),this.event.on(xt.UPDATE,e,(function(e){t.eventEmitter.emit(Ft.UPDATE,t.parseUpdateData(e))})),this.event.on(xt.PAYMENT_SUCCESSFUL,e,(function(e){t.eventEmitter.emit(Ft.PAYMENT_SUCCESS,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(xt.PAYMENT_IN_REVIEW,e,(function(e){t.eventEmitter.emit(Ft.PAYMENT_IN_REVIEW,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(xt.PAYMENT_ERROR,e,(function(e){t.eventEmitter.emit(Ft.PAYMENT_ERROR,e),t.iFrame.getElement()||t.background.clear()}))}},{key:"parsePaymentSuccessfulData",value:function(e){var t;return{id:this.meta.id,amount:e.amount,currency:e.currencyCode,status:null===(t=e.charge)||void 0===t?void 0:t.status}}},{key:"parseUpdateData",value:function(e){return c(c(c({wallet_response_code:e.responseCode,wallet_session_id:e.sessionId},e.paymentMethodDetails?{payment_source:{wallet_payment_method_id:e.paymentMethodDetails.paymentMethodId,card_number_last4:e.paymentMethodDetails.lastFourDigitsOfPan,card_scheme:e.paymentMethodDetails.paymentScheme}}:{}),e.loyaltyAccountSummary?{wallet_loyalty_account:{id:e.loyaltyAccountSummary.loyaltyAccountId,barcode:e.loyaltyAccountSummary.loyaltyAccountBarcode}}:{}),e.deliveryAddressDetails?{shipping:{address_line1:e.deliveryAddressDetails.line1,address_line2:e.deliveryAddressDetails.line2,address_postcode:e.deliveryAddressDetails.postalCode,address_city:e.deliveryAddressDetails.city,address_state:e.deliveryAddressDetails.state,address_country:e.deliveryAddressDetails.countryCode,address_company:e.deliveryAddressDetails.companyName,wallet_address_id:e.deliveryAddressDetails.addressId,post_office_box_number:e.deliveryAddressDetails.postOfficeBoxNumber,wallet_address_created_timestamp:e.deliveryAddressDetails.createdTimestamp,wallet_address_updated_timestamp:e.deliveryAddressDetails.updatedTimestamp,wallet_address_name:e.deliveryAddressDetails.name}}:{})}}])}(Vt),jt=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"load",value:function(e){return window.Promise?(!0===this.meta.standalone?this.renderPaypalStandaloneComponent(e):this.renderPaypalCommonComponent(e),Promise.resolve()):(this.eventEmitter.emit(Ft.UNAVAILABLE,null),Promise.resolve())}},{key:"update",value:function(e){var t=this;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject)return e.success?void this.eventEmitter.emit(Ft.CALLBACK,{data:{request_type:"UPDATE_TRANSACTION",shipping:this.latestShippingData},onSuccess:function(e){return t.latestShippingChangePromiseResolve(!0)},onError:function(){return t.latestShippingChangePromiseReject()}}):this.latestShippingChangePromiseReject()}},{key:"renderPaypalCommonComponent",value:function(e){var t,n=this,i=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",r=document.createElement("script");r.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency).concat(!0===this.meta.pay_later?"&enable-funding=paylater&disable-funding=card":"&disable-funding=credit,card").concat(this.meta.capture?"":"&intent=authorize"),r.async=!0,r.onload=function(){window.paypal?(n.paypal=window.paypal,n.paypal.Buttons(c({},n.paypalSharedProps())).render("#".concat(i))):n.eventEmitter.emit(Ft.UNAVAILABLE,null)},document.head.appendChild(r)}},{key:"renderPaypalStandaloneComponent",value:function(e){var t,n,i=this,r=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",o=document.createElement("script");o.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency,"&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(this.meta.capture?"":"&intent=authorize").concat("live"===(null===(n=this.meta)||void 0===n?void 0:n.gateway_mode)?"":"&buyer-country=AU"),o.async=!0,o.onload=function(){if(window.paypal){i.paypal=window.paypal;var e=!!i.meta.pay_later,t=i.paypal.Buttons(c({fundingSource:e?i.paypal.FUNDING.PAYLATER:i.paypal.FUNDING.PAYPAL},i.paypalSharedProps()));if(t.isEligible()){if(t.render("#".concat(r)),e)i.paypal.Messages(c({amount:i.meta.amount,currency:i.meta.currency,placement:"payment"},i.meta.style&&i.meta.style.messages&&{style:i.meta.style.messages})).render("#".concat(r))}else i.eventEmitter.emit(Ft.UNAVAILABLE,null)}else i.eventEmitter.emit(Ft.UNAVAILABLE,null)},document.head.appendChild(o)}},{key:"paypalSharedProps",value:function(){var e=this;return c(c({},this.meta.style&&{style:this.meta.style}),{onClick:function(t,n){var i;return e.eventEmitter.emit(Ft.BUTTON_CLICK,{attachResult:function(e){i=e&&e instanceof Promise?e.then((function(){return n.resolve()})).catch((function(){return n.reject()})):e}}),i},createOrder:function(){return new Promise((function(t,n){e.eventEmitter.emit(Ft.CALLBACK,{data:c({request_type:"CREATE_TRANSACTION"},e.meta.request_shipping&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e.id)},onError:function(e){return n(e)}})}))},onShippingChange:function(t,n){return new Promise((function(n,i){var r=e.parseUpdateData(t);e.latestShippingData=r.shipping,e.latestShippingChangePromiseResolve=n,e.latestShippingChangePromiseReject=i,e.eventEmitter.emit(Ft.UPDATE,r)}))},onApprove:function(t){return e.pendingApprovalPromise=e.pendingApprovalPromise||new Promise((function(n,i){return e.eventEmitter.emit(Ft.PAYMENT_METHOD_SELECTED,{data:{payment_method_id:t.orderID,customer:{payment_source:{external_payer_id:t.payerID}}},onSuccess:function(){e.pendingApprovalPromise=void 0,n(!0)},onError:function(t){e.pendingApprovalPromise=void 0,i(t)}})})),e.pendingApprovalPromise},onCancel:function(){return e.eventEmitter.emit(Ft.CHECKOUT_CLOSE)},onError:function(e){}})}},{key:"parseUpdateData",value:function(e){var t;return c(c({wallet_order_id:e.orderID,wallet_session_id:e.paymentID,payment_source:{wallet_payment_method_id:e.paymentToken}},e.shipping_address&&{shipping:{address_city:e.shipping_address.city,address_state:e.shipping_address.state,address_postcode:e.shipping_address.postal_code,address_country:e.shipping_address.country_code}}),e.selected_shipping_option&&{selected_shipping_option:{id:e.selected_shipping_option.id,label:e.selected_shipping_option.label,amount:e.selected_shipping_option.amount.value,currency:e.selected_shipping_option.amount.currency_code,type:null===(t=e.selected_shipping_option)||void 0===t?void 0:t.type}})}}])}(Vt),zt={};function qt(e){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qt(e)}Object.defineProperty(zt,"__esModule",{value:!0});var Kt,Yt="https://js.stripe.com/v3",Wt=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Zt="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Gt=null,Jt=function(e){return null!==Gt||(Gt=new Promise((function(t,n){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(Zt),window.Stripe)t(window.Stripe);else try{var i=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Yt,'"]')),t=0;t<e.length;t++){var n=e[t];if(Wt.test(n.src))return n}return null}();i&&e?console.warn(Zt):i||(i=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(Yt).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n}(e)),i.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),i.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}))),Gt},Xt=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==qt(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)},$t=!1,Qt=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];$t=!0;var i=Date.now();return Jt(Kt).then((function(e){return function(e,t,n){if(null===e)return null;var i=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.54.2",startTime:t})}(i,n),i}(e,t,i)}))};Qt.setLoadParameters=function(e){if($t&&Kt){var t=Xt(e);if(Object.keys(t).reduce((function(t,n){var i;return t&&e[n]===(null===(i=Kt)||void 0===i?void 0:i[n])}),!0))return}if($t)throw new Error("You cannot change load parameters after calling loadStripe");Kt=Xt(e)},zt.loadStripe=Qt;var en=zt,tn="success",nn="fail",rn=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"initPaymentRequest",value:function(){return this.stripe.paymentRequest({country:this.meta.country.toUpperCase(),currency:this.meta.currency.toLowerCase(),total:{label:this.meta.amount_label,amount:Math.floor(100*this.meta.amount)},requestPayerName:!0===this.meta.request_payer_name,requestPayerEmail:!0===this.meta.request_payer_email,requestPayerPhone:!0===this.meta.request_payer_phone})}},{key:"createWalletButton",value:function(){return this.stripe.elements().create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"load",value:function(e){var t=this;return en.loadStripe(this.publicKey).then((function(e){t.stripe=e,t.paymentRequest=t.initPaymentRequest()})).then((function(){return t.checkAvailability()})).then((function(n){return t.mount(e,n)})).then((function(){return t.setOnPaymentMethodSelected()}))}},{key:"checkAvailability",value:function(){var e=this;return this.paymentRequest.canMakePayment().then((function(t){if(t){var n=!e.meta.wallets||e.meta.wallets.includes(He.GOOGLE),i=!e.meta.wallets||e.meta.wallets.includes(He.APPLE);return{google_pay:n&&!t.applePay,apple_pay:i&&t.applePay,flypay:!1}}}))}},{key:"mount",value:function(e,t){if(!t||!t.apple_pay&&!t.google_pay)return this.eventEmitter.emit(Ft.UNAVAILABLE,null);this.createWalletButton().mount(e.getElement())}},{key:"setOnPaymentMethodSelected",value:function(){var e=this;this.paymentRequest.on("paymentmethod",(function(t){var n,i,r=t.paymentMethod,o=r.id,a=r.card,s=r.billing_details,u=s.name,c=s.address,l={payment_method_id:o,customer:{payer_name:t.payerName,payer_email:t.payerEmail,payer_phone:t.payerPhone,payment_source:{wallet_type:e.getWalletType(null===(n=null==a?void 0:a.wallet)||void 0===n?void 0:n.type),card_name:u,type:null===(i=null==a?void 0:a.wallet)||void 0===i?void 0:i.type,card_scheme:null==a?void 0:a.brand,card_number_last4:null==a?void 0:a.last4,expire_month:null==a?void 0:a.exp_month,expire_year:null==a?void 0:a.exp_year,address_line1:c.line1,address_line2:c.line2,address_city:c.city,address_postcode:c.postal_code,address_state:c.state,address_country:c.country}}};e.eventEmitter.emit(Ft.PAYMENT_METHOD_SELECTED,{data:l,onSuccess:function(){return t.complete(tn)},onError:function(e){return t.complete(nn)}})}))}},{key:"getWalletType",value:function(e){return e?"google_pay"===e?He.GOOGLE:He.APPLE:null}}])}(Vt),on=function(e){function n(e,i,r,a){var s;return o(this,n),(s=t(this,n,[e,i])).gatewayName=r,s.eventEmitter=a,s.latestShippingData={},s.onCancelPayment=function(e){return s.eventEmitter.emit(Ft.CHECKOUT_CLOSE)},s.onValidateMerchant=function(e){s.handleMerchantOnButtonClickEvent().then((function(){s.getMerchantSession().then((function(e){s.paymentSession.completeMerchantValidation(e)})).catch((function(e){console.error("Error fetching merchant session",e),s.paymentSession.abort()}))})).catch((function(e){console.error("Error while processing merchant callback",e),s.paymentSession.abort()}))},s.onPaymentAuthorized=function(e){var t,n=e.payment,i=n.token,r=n.billingContact,o=n.shippingContact;s.latestShippingData.shippingContact=o;var a=null===(t=s.selectedShippingOption)||void 0===t?void 0:t.type,u=[null==o?void 0:o.givenName,null==o?void 0:o.familyName].join(" ").trim();s.eventEmitter.emit(Ft.PAYMENT_METHOD_SELECTED,{data:c({customer:{payment_source:c(c({wallet_type:He.APPLE},u&&{card_name:u}),{type:i.paymentMethod.type,card_scheme:i.paymentMethod.network,address_line1:null==r?void 0:r.addressLines[0],address_line2:null==r?void 0:r.addressLines[1],address_country:null==r?void 0:r.countryCode,address_city:null==r?void 0:r.locality,address_postcode:null==r?void 0:r.postalCode,address_state:null==r?void 0:r.administrativeArea,ref_token:i.paymentData?JSON.stringify(i.paymentData):""})}},s.meta.request_shipping&&o&&{shipping:c(c(c({},a&&{method:a}),s.hasShippingOptions()&&{options:s.meta.shipping_options}),{address_line1:o.addressLines[0],address_line2:o.addressLines[1],address_country:o.countryCode,address_city:o.locality,address_postcode:o.postalCode,address_state:o.administrativeArea,contact:{first_name:o.givenName,last_name:o.familyName,email:o.emailAddress,phone:o.phoneNumber}})}),onSuccess:function(){return s.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS)},onError:function(){return s.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE)}})},s.onShippingContactSelected=function(e){s.latestShippingData.shippingContact=e.shippingContact;var t=s.parseUpdateData(s.latestShippingData);return s.eventEmitter.emit(Ft.UPDATE,t),new Promise((function(e,t){s.latestShippingChangePromiseResolve=e,s.latestShippingChangePromiseReject=t}))},s.onShippingMethodSelected=function(e){var t,n;s.latestShippingData.shippingMethod=e.shippingMethod;var i={newTotal:{label:s.meta.amount_label||(null===(n=null===(t=s.getMetaRawDataInitialization())||void 0===t?void 0:t.total)||void 0===n?void 0:n.label),amount:s.meta.amount.toString(),type:"final"}};s.paymentSession.completeShippingMethodSelection(i)},s.parseUpdateData=function(e){var t,n,i,r,o,a,s,u;return c({shipping:{address_city:null===(t=null==e?void 0:e.shippingContact)||void 0===t?void 0:t.locality,address_state:null===(n=null==e?void 0:e.shippingContact)||void 0===n?void 0:n.administrativeArea,address_postcode:null===(i=null==e?void 0:e.shippingContact)||void 0===i?void 0:i.postalCode,address_country:null===(r=null==e?void 0:e.shippingContact)||void 0===r?void 0:r.countryCode}},(null==e?void 0:e.shippingMethod)&&{selected_shipping_option:{id:null===(o=null==e?void 0:e.shippingMethod)||void 0===o?void 0:o.identifier,label:null===(a=null==e?void 0:e.shippingMethod)||void 0===a?void 0:a.label,detail:null===(s=null==e?void 0:e.shippingMethod)||void 0===s?void 0:s.detail,amount:null===(u=null==e?void 0:e.shippingMethod)||void 0===u?void 0:u.amount}})},s.formatShippingOptions=function(e){return e.map((function(e){return{identifier:e.id,label:e.label,detail:(null==e?void 0:e.detail)||"",amount:e.amount}}))},s.eventEmitter=a,s}return l(n,e),s(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[He.APPLE])||void 0===n?void 0:n.merchant)||""}},{key:"getMetaStyles",value:function(){var e,t,n;if((null===(e=this.meta)||void 0===e?void 0:e.style)&&"object"===r(null===(t=this.meta)||void 0===t?void 0:t.style)){var i=JSON.parse(JSON.stringify(null===(n=this.meta)||void 0===n?void 0:n.style));return"google"in i&&(null==i||delete i.google),"apple"in i?null==i?void 0:i.apple:i}return null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i;if((null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"object"===r(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)){var o=JSON.parse(JSON.stringify(null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization));return"google"in o&&(null==o||delete o.google),"apple"in o?null==o?void 0:o.apple:o}return null}},{key:"isShippingRequired",value:function(){var e;return null===(e=this.meta)||void 0===e?void 0:e.request_shipping}},{key:"hasShippingOptions",value:function(){var e,t;return(null===(e=this.meta)||void 0===e?void 0:e.request_shipping)&&!!(null===(t=this.meta)||void 0===t?void 0:t.shipping_options)}},{key:"load",value:function(e){var t=this;if(window.Promise)return this.checkAvailability().then((function(n){var i;n?(t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(i=t.meta)||void 0===i?void 0:i.shipping_options[0],t.latestShippingData.shippingMethod=t.formatShippingOptions([t.selectedShippingOption])[0]),t.mount(e)):t.eventEmitter.emit(Ft.UNAVAILABLE,{wallet:He.APPLE})})).catch((function(e){return console.error("Error checking ApplePay availability",e)}));this.eventEmitter.emit(Ft.UNAVAILABLE,{wallet:He.APPLE})}},{key:"update",value:function(e){var t,n,i;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success||!e.body)return this.latestShippingChangePromiseReject();var r=null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount,o=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;r&&(this.meta.amount=r),o&&(this.meta.shipping_options=o,this.selectedShippingOption=o?o[0]:void 0);var a=c({newTotal:{label:null===(i=this.meta)||void 0===i?void 0:i.amount_label,amount:this.meta.amount.toString(),type:"final"}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingMethods:this.formatShippingOptions(this.meta.shipping_options)});this.paymentSession.completeShippingContactSelection(a),this.latestShippingChangePromiseResolve({})}}},{key:"checkAvailability",value:function(){var e=this;return new Promise((function(t,n){window.ApplePaySession&&ApplePaySession||t(!1),ApplePaySession.canMakePaymentsWithActiveCard(e.getMerchantId()).then((function(e){return t(e)})).catch((function(e){return t(!1)}))}))}},{key:"mount",value:function(e){var t=this,n=document.createElement("style");n.innerHTML=this.createButtonStyle(),document.head.appendChild(n);var i=document.createElement("div");i.onclick=function(){return t.onApplePayButtonClicked()},i.classList.add("paydock-apple-container","apple-pay-button","apple-pay-button-black"),i.setAttribute("tabindex","0"),i.setAttribute("role","button"),e.getElement().appendChild(i)}},{key:"onApplePayButtonClicked",value:function(){this.paymentSession=new ApplePaySession(3,this.createRequest()),this.paymentSession.onvalidatemerchant=this.onValidateMerchant,this.paymentSession.onpaymentauthorized=this.onPaymentAuthorized,this.paymentSession.oncancel=this.onCancelPayment,this.paymentSession.onshippingcontactselected=this.onShippingContactSelected,this.paymentSession.onshippingmethodselected=this.onShippingMethodSelected,this.paymentSession.begin()}},{key:"createRequest",value:function(){var e,t=this.getMetaRawDataInitialization();return t&&"object"===r(t)&&("object"===r(t.total)?t.total.amount=this.meta.amount.toString():t.total={label:(null===(e=this.meta)||void 0===e?void 0:e.amount_label)||"",amount:this.meta.amount.toString()},this.isShippingRequired()&&this.hasShippingOptions()&&(t.shippingMethods=this.formatShippingOptions(this.meta.shipping_options))),t||c(c(c({countryCode:this.meta.country.toUpperCase(),currencyCode:this.meta.currency.toUpperCase(),merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard","amex","discover"]},this.meta.show_billing_address&&{requiredBillingContactFields:["name","postalAddress"]}),this.isShippingRequired()&&c({requiredShippingContactFields:["postalAddress","name","phone","email"]},this.hasShippingOptions()&&{shippingMethods:this.formatShippingOptions(this.meta.shipping_options)})),{total:{label:this.meta.amount_label,amount:this.meta.amount.toString(),type:"final"}})}},{key:"getMerchantSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Ft.CALLBACK,{data:c({request_type:"CREATE_SESSION",wallet_type:He.APPLE,session_id:window.location.hostname},e.isShippingRequired()&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e)},onError:function(e){return n(e)}})}))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Ft.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"createButtonStyle",value:function(){var e,t;return"\n .paydock-apple-container {\n width: 100%;\n height: 40px;\n }\n\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: ".concat((null===(e=this.getMetaStyles())||void 0===e?void 0:e.button_type)||"plain","\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n -apple-pay-button-type: ").concat((null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"plain","\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n ")}}])}(Vt),an=function(e){function n(e,i,r,a){var s;return o(this,n),(s=t(this,n,[e,i])).gatewayName=r,s.eventEmitter=a,s.processingButtonClick=!1,s.parseUpdateData=function(e){var t,n,i,r,o,a,u=null===(n=null===(t=s.meta)||void 0===t?void 0:t.shipping_options)||void 0===n?void 0:n.find((function(t){var n;return t.id===(null===(n=null==e?void 0:e.shippingOptionData)||void 0===n?void 0:n.id)}));return c({shipping:{address_city:null===(i=e.shippingAddress)||void 0===i?void 0:i.locality,address_state:null===(r=e.shippingAddress)||void 0===r?void 0:r.administrativeArea,address_postcode:null===(o=null==e?void 0:e.shippingAddress)||void 0===o?void 0:o.postalCode,address_country:null===(a=null==e?void 0:e.shippingAddress)||void 0===a?void 0:a.countryCode}},u&&{selected_shipping_option:{id:null==u?void 0:u.id,label:null==u?void 0:u.label,detail:null==u?void 0:u.detail,type:null==u?void 0:u.type}})},s.formatShippingOptions=function(e){return e.map((function(e){return{id:e.id,label:e.label,description:(null==e?void 0:e.detail)||""}}))},s.eventEmitter=a,s}return l(n,e),s(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[He.GOOGLE])||void 0===n?void 0:n.merchant}},{key:"getMetaStyles",value:function(){var e,t,n,i;return"object"===r(null===(e=this.meta)||void 0===e?void 0:e.style)&&"google"in(null===(t=this.meta)||void 0===t?void 0:t.style)?null===(i=null===(n=this.meta)||void 0===n?void 0:n.style)||void 0===i?void 0:i.google:null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i,o;return(null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&"object"===r(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"google"in(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)?null===(o=null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization)||void 0===o?void 0:o.google:null}},{key:"isShippingRequired",value:function(){return!!this.meta.request_shipping}},{key:"hasShippingOptions",value:function(){return this.meta.request_shipping&&!!this.meta.shipping_options}},{key:"load",value:function(e){var t=this;if(window.Promise)return new Promise((function(n,i){var r=document.createElement("script");r.type="text/javascript",r.src="https://pay.google.com/gp/p/js/pay.js",r.async=!0,r.onload=function(){var r,o,a,s;if(!window.google)return t.eventEmitter.emit(Ft.UNAVAILABLE,{wallet:He.GOOGLE}),void i();t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(r=t.meta)||void 0===r?void 0:r.shipping_options[0]),t.paymentsClient=new google.payments.api.PaymentsClient(c({merchantInfo:c(c({},(null===(o=t.meta)||void 0===o?void 0:o.merchant_name)?{merchantName:null===(a=t.meta)||void 0===a?void 0:a.merchant_name}:{}),{merchantId:t.getMerchantId()}),paymentDataCallbacks:c({onPaymentAuthorized:function(e){return t.onPaymentAuthorized(e)}},t.isShippingRequired()&&{onPaymentDataChanged:function(e){return t.onPaymentDataChanged(e)}})},"live"===(null===(s=t.meta)||void 0===s?void 0:s.gateway_mode)?{environment:"PRODUCTION"}:{environment:"TEST"})),t.checkAvailability().then((function(r){if(!r)return t.eventEmitter.emit(Ft.UNAVAILABLE,{wallet:He.GOOGLE}),void i();t.mount(e),n()}))},document.head.appendChild(r)}));this.eventEmitter.emit(Ft.UNAVAILABLE,{wallet:He.GOOGLE})}},{key:"update",value:function(e){var t,n,i,r;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success)return this.latestShippingChangePromiseReject();var o=(null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount)||this.meta.amount,a=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;o&&(this.meta.amount=o),a&&(this.meta.shipping_options=a,this.selectedShippingOption=a?a[0]:void 0);var s=c({newTransactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:null===(i=this.meta.amount)||void 0===i?void 0:i.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()}},this.isShippingRequired()&&this.hasShippingOptions()&&a&&{newShippingOptionParameters:{defaultSelectedOptionId:null===(r=this.selectedShippingOption)||void 0===r?void 0:r.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}});this.latestShippingChangePromiseResolve(s)}}},{key:"checkAvailability",value:function(){return this.paymentsClient.isReadyToPay(this.createRequest()).then((function(e){return!!e.result})).catch((function(e){return console.error("Error checking GooglePay availability",e),!1}))}},{key:"mount",value:function(e){var t,n,i,r=this;e.getElement().appendChild(this.paymentsClient.createButton({onClick:function(){return r.onGooglePayButtonClicked()},buttonType:(null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"pay",buttonSizeMode:(null===(n=this.getMetaStyles())||void 0===n?void 0:n.button_size_mode)||"fill",buttonColor:(null===(i=this.getMetaStyles())||void 0===i?void 0:i.button_color)||"default"}))}},{key:"onGooglePayButtonClicked",value:function(){var e=this;this.processingButtonClick||(this.processingButtonClick=!0,this.handleMerchantOnButtonClickEvent().then((function(){e.loadPaymentData().finally((function(){e.processingButtonClick=!1}))})).catch((function(t){e.processingButtonClick=!1,console.error("Error while processing merchant callback",t)})))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Ft.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"loadPaymentData",value:function(){var e=this;return this.paymentsClient.loadPaymentData(this.createPaymentDataRequest()).catch((function(t){throw e.eventEmitter.emit(Ft.CHECKOUT_CLOSE),console.error("Error while loading payment data",t),t}))}},{key:"onPaymentAuthorized",value:function(e){var t,n,i,r,o,a,s,u,l,d,h,p,f,v,m,y=this,g=null===(i=null===(n=null===(t=e.paymentMethodData)||void 0===t?void 0:t.info)||void 0===n?void 0:n.billingAddress)||void 0===i?void 0:i.address1,k=null===(a=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===a?void 0:a.address2,E=null===(s=null==e?void 0:e.shippingAddress)||void 0===s?void 0:s.address1,C=null===(u=null==e?void 0:e.shippingAddress)||void 0===u?void 0:u.address2,_=null===(l=this.selectedShippingOption)||void 0===l?void 0:l.type,w=null===(d=null==e?void 0:e.shippingAddress)||void 0===d?void 0:d.countryCode,b=null===(h=null==e?void 0:e.shippingAddress)||void 0===h?void 0:h.locality,S=null===(p=null==e?void 0:e.shippingAddress)||void 0===p?void 0:p.postalCode,T=null===(f=null==e?void 0:e.shippingAddress)||void 0===f?void 0:f.administrativeArea,O=null===(v=null==e?void 0:e.shippingAddress)||void 0===v?void 0:v.name,A=null==e?void 0:e.email,P=null===(m=null==e?void 0:e.shippingAddress)||void 0===m?void 0:m.phoneNumber;return new Promise((function(t){var n,i,r,o,a,s,u,l,d,h,p,f,v,m;return y.eventEmitter.emit(Ft.PAYMENT_METHOD_SELECTED,{data:c({customer:{payment_source:c(c(c(c({wallet_type:He.GOOGLE,type:e.paymentMethodData.type,card_scheme:null===(i=null===(n=e.paymentMethodData)||void 0===n?void 0:n.info)||void 0===i?void 0:i.cardNetwork},g&&{address_line1:g}),k&&{address_line2:k}),k&&{address_line2:k}),{address_country:null===(a=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===a?void 0:a.countryCode,address_city:null===(l=null===(u=null===(s=e.paymentMethodData)||void 0===s?void 0:s.info)||void 0===u?void 0:u.billingAddress)||void 0===l?void 0:l.locality,address_postcode:null===(p=null===(h=null===(d=e.paymentMethodData)||void 0===d?void 0:d.info)||void 0===h?void 0:h.billingAddress)||void 0===p?void 0:p.postalCode,address_state:null===(m=null===(v=null===(f=e.paymentMethodData)||void 0===f?void 0:f.info)||void 0===v?void 0:v.billingAddress)||void 0===m?void 0:m.administrativeArea,ref_token:e.paymentMethodData.tokenizationData.token})}},y.isShippingRequired()&&{shipping:c(c(c(c(c(c(c(c(c({},_&&{method:_}),y.hasShippingOptions()&&{options:y.meta.shipping_options}),E&&{address_line1:E}),C&&{address_line2:C}),w&&{address_country:w}),b&&{address_city:b}),S&&{address_postcode:S}),T&&{address_state:T}),{contact:c(c(c({},O&&{first_name:O}),A&&{email:A}),P&&{phone:P})})}),onSuccess:function(){return t({transactionState:"SUCCESS"})},onError:function(e){return t({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:(null==e?void 0:e.message)||"Error processing payment",reason:"PAYMENT_DATA_INVALID"}})}})}))}},{key:"onPaymentDataChanged",value:function(e){var t=this;if(this.isShippingRequired()){var n=this.parseUpdateData(e),i=new Promise((function(e,n){t.latestShippingChangePromiseResolve=e,t.latestShippingChangePromiseReject=n}));return this.eventEmitter.emit(Ft.UPDATE,n),i}}},{key:"createRequest",value:function(){var e="Apple Safari"===k.getBrowserName();return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.createCardData()],existingPaymentMethodRequired:!e}}},{key:"createPaymentDataRequest",value:function(){var e,t,n,i;this.isShippingRequired()&&this.hasShippingOptions()&&(this.selectedShippingOption=null===(e=this.meta)||void 0===e?void 0:e.shipping_options[0]);var r=this.getMerchantId();return c({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[c(c({},this.createCardData()),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"paydock",gatewayMerchantId:r}}})],transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:this.meta.amount.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()},merchantInfo:c(c({},(null===(t=this.meta)||void 0===t?void 0:t.merchant_name)?{merchantName:null===(n=this.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:r}),callbackIntents:["PAYMENT_AUTHORIZATION"].concat(v(this.isShippingRequired()?["SHIPPING_ADDRESS"]:[]),v(this.hasShippingOptions()?["SHIPPING_OPTION"]:[]))},this.isShippingRequired()&&c({shippingAddressRequired:!0},this.hasShippingOptions()&&{shippingOptionRequired:!0,shippingOptionParameters:{defaultSelectedOptionId:null===(i=this.selectedShippingOption)||void 0===i?void 0:i.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}}))}},{key:"createCardData",value:function(){return this.getMetaRawDataInitialization()||{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!!this.meta.show_billing_address}}}}])}(Vt),sn=function(e){function n(){return o(this,n),t(this,n,arguments)}return l(n,e),s(n,[{key:"initializeChildWallets",value:function(){var e,t,n,i,r,o;this.childWallets=[];var a=!!(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t.apple)||void 0===n?void 0:n.merchant),s=!!(null===(o=null===(r=null===(i=this.meta)||void 0===i?void 0:i.credentials)||void 0===r?void 0:r.google)||void 0===o?void 0:o.merchant);!a||this.meta.wallets&&!this.meta.wallets.includes(He.APPLE)||this.childWallets.push(new on(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter)),!s||this.meta.wallets&&!this.meta.wallets.includes(He.GOOGLE)||this.childWallets.push(new an(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter))}},{key:"getGatewayName",value:function(){return xe.MASTERCARD}},{key:"setEnv",value:function(e){return this.childWallets.forEach((function(t){return t.setEnv(e)})),this}},{key:"update",value:function(e){this.childWallets.forEach((function(t){return t.update(e)}))}}])}(Vt),un=function(e){function n(e,i){var r;return o(this,n),(r=t(this,n,[e,i])).token=e,r.storageDispatcher=new ht("afterpay.wallet.paydock"),r}return l(n,e),s(n,[{key:"load",value:function(e){var t=this;this.storageDispatcher.create((function(){return t.mount(e)}))}},{key:"setEnv",value:function(e){return p(d(n.prototype),"setEnv",this).call(this,e),this.storageDispatcher.setEnv(e),this}},{key:"mount",value:function(e){var t,n,i,o,a=this,s={};(null===(t=this.meta)||void 0===t?void 0:t.style)&&"object"===r(null===(n=this.meta)||void 0===n?void 0:n.style)&&(s=JSON.parse(JSON.stringify((null===(i=this.meta)||void 0===i?void 0:i.style.afterpay)||(null===(o=this.meta)||void 0===o?void 0:o.style))));var u=this.getButton(s);u.onclick=function(){return a.onAfterPayButtonClicked()};var c=this.getButtonStyle(s);e.getElement().appendChild(u),e.getElement().appendChild(c)}},{key:"onAfterPayButtonClicked",value:function(){var e,t,n=this,i=document.createElement("script"),r=null===(e=this.meta)||void 0===e?void 0:e.country;i.type="text/javascript",i.src="live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"https://portal.afterpay.com/afterpay.js":"https://portal.sandbox.afterpay.com/afterpay.js",i.async=!0,i.defer=!0,i.onload=function(){window.AfterPay.initialize({countryCode:r}),n.storageDispatcher.push({intent:at.WIDGET_SESSION,data:{token:n.token}},{onSuccess:function(){n.getCheckoutSession().then((function(e){window.AfterPay.redirect({token:e.ref_token})})).catch((function(e){window.AfterPay.close(),n.eventEmitter.emit(Ft.UNAVAILABLE,{err:e})}))},onError:function(){console.error("Error initializing Afterpay wallet"),window.AfterPay.close(),n.eventEmitter.emit(Ft.UNAVAILABLE,{})}})},document.head.appendChild(i)}},{key:"getCheckoutSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Ft.CALLBACK,{data:{request_type:"CREATE_SESSION",wallet_type:He.AFTERPAY},onSuccess:function(e){t(e)},onError:function(e){n(e)}})}))}},{key:"getButton",value:function(e){var t=document.createElement("button");return t.classList.add("afterpay-checkout-btn"),t.setAttribute("type","button"),t.innerHTML='\n <div class="afterpay-checkout-btn__wrapper">\n <svg viewBox="0 0 390 94"\n height="'.concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <g fill="currentColor">\n <path\n d="M388.6 21.4l-34.8 71.8h-14.4l13-26.8-20.5-45h14.8l13.2 30.1 14.3-30.1zM41 46.9c0-8.6-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4C11 73.2.4 62 .4 46.9c0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51H41.1zM114.6 61.1c-4.4 0-5.6-1.6-5.6-5.9V32.5h8.1V21.4H109V8.9H96.1v12.4H79.5v-5.1c0-4.3 1.6-5.9 6.1-5.9h2.8V.4h-6.2C71.6.4 66.6 3.9 66.6 14.5v6.8h-7.1v11.1h7.1v39.9h12.9V32.5h16.6v25c0 10.4 4 14.9 14.4 14.9h6.6V61.1h-2.5zM160.7 42.3c-.9-6.6-6.3-10.6-12.6-10.6s-11.5 3.9-12.9 10.6h25.5zm-25.6 7.9c.9 7.5 6.3 11.8 13.2 11.8 5.4 0 9.6-2.6 12-6.6h13.2c-3.1 10.8-12.7 17.7-25.5 17.7-15.4 0-26.2-10.8-26.2-26.2 0-15.4 11.4-26.5 26.5-26.5 15.2 0 26.2 11.2 26.2 26.5 0 1.1-.1 2.2-.3 3.3h-39.1zM256.2 46.9c0-8.3-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.4 13.9-14.6m-40.4 46.3V21.4h12.5V28c3.8-4.7 9.4-7.5 16.1-7.5 13.8 0 24.6 11.3 24.6 26.3s-11 26.4-24.9 26.4c-6.4 0-11.7-2.6-15.4-6.8v26.8h-12.9zM314.2 46.9c0-8.6-6.2-14.6-13.9-14.6-7.6 0-13.9 6.1-13.9 14.6 0 8.4 6.2 14.6 13.9 14.6s13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4-14 0-24.6-11.2-24.6-26.3 0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51h-12.5zM193.2 26.4s3.2-5.9 11-5.9c3.3 0 5.5 1.2 5.5 1.2v13s-4.7-2.9-9.1-2.3c-4.3.6-7.1 4.6-7.1 9.9v30.2h-13v-51H193v4.9h.2z" />\n </g>\n </svg>\n <svg viewBox="0 0 107 96"\n height="').concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <path\n d="M99 19.5L84.2 11l-15-8.6c-10-5.7-22.4 1.5-22.4 13v1.9c0 1.1.6 2 1.5 2.6l7 4c1.9 1.1 4.4-.3 4.4-2.5v-4.6c0-2.3 2.5-3.7 4.4-2.6l13.8 7.9L91.6 30c2 1.1 2 4 0 5.1L77.9 43l-13.8 7.9c-2 1.1-4.4-.3-4.4-2.6V46c0-11.5-12.4-18.7-22.4-13l-15 8.6-14.8 8.5c-10 5.7-10 20.2 0 26l14.8 8.5 15 8.6c10 5.7 22.4-1.5 22.4-13v-1.9c0-1.1-.6-2-1.5-2.6l-7-4c-1.9-1.1-4.4.3-4.4 2.5v4.6c0 2.3-2.5 3.7-4.4 2.6l-13.8-7.9-13.7-7.9c-2-1.1-2-4 0-5.1l13.7-7.9 13.8-7.9c2-1.1 4.4.3 4.4 2.6v2.3c0 11.5 12.4 18.7 22.4 13l15-8.6L99 45.5c10.1-5.8 10.1-20.2 0-26"\n fill="currentColor" />\n </svg>\n </div>\n '),t}},{key:"getButtonStyle",value:function(e){var t=document.createElement("style"),n=this.generateButtonColor(e.button_type);return t.innerText="\n .afterpay-checkout-btn {\n outline: none;\n border: none;\n border-radius: ".concat(this.getHeight(e),";\n padding: 0;\n margin: 0;\n transition: all 300ms;\n cursor: pointer;\n }\n\n .afterpay-checkout-btn:active {\n opacity: 0.7;\n }\n\n .afterpay-checkout-btn__wrapper {\n display: flex;\n align-items: center;\n padding: 10px 20px;\n color: ").concat(n.color,";\n background-color: ").concat(n.background,";\n border-radius: ").concat(this.getHeight(e),";\n }\n "),t}},{key:"generateButtonColor",value:function(e){switch(e){case"black":return{color:"#B2FCE3",background:"#000"};case"mint":return{color:"#000",background:"#B2FCE3"};default:return{color:"#fff",background:"#000"}}}},{key:"getHeight",value:function(e){return e.height?Number.isNaN(Number(e.height))?e.height:"".concat(e.height,"px"):"40px"}}])}(Vt);var cn=class{DEFAULT_WIDTH=450;DEFAULT_HEIGHT=750;DEFAULT_FEATURES={resizable:"no"};auth;callback;error;frame;isCheckoutOpen;onMessage;url;orderId;accessToken;refreshToken;clientId;onCheckoutClosed;rootUrl;targetOrigin;title;windowFeatures;windowObserver;constructor({auth:e,url:t,clientId:n,mode:i,orderId:r,onCheckoutClosed:o,onError:a,onTokensChanged:s,onPaymentSuccess:u,onPaymentError:c,title:l,windowFeatures:d}){this.callback={ERROR({error:e,orderId:t}){a?.({error:e,orderId:t})},PAYMENT_ERROR({error:e,orderId:t}){c?.({error:e,orderId:t})},PAYMENT_SUCCESS({orderId:e}){u?.({orderId:e})},TOKENS_CHANGED({accessToken:e,refreshToken:t}){s?.({accessToken:e,refreshToken:t})}},this.auth=e,this.isCheckoutOpen=!1,this.error=void 0,this.frame=void 0,this.onMessage=e=>{const{data:n,origin:i}=e;i===t&&(!0===n?.isDomReady&&this.postMessage(),n?.isPaymentSuccessful&&this.callback.PAYMENT_SUCCESS({orderId:n.orderId}),!n?.isPaymentSuccessful&&n?.error&&this.callback.PAYMENT_ERROR({orderId:n.orderId,error:n.error}),!n?.paymentFlowState&&n?.error&&this.callback.ERROR({orderId:n.orderId,error:n.error}),n?.accessToken&&n?.refreshToken&&this.callback.TOKENS_CHANGED({accessToken:n.accessToken,refreshToken:n.refreshToken}))};const h=i||"default";this.rootUrl=t,this.targetOrigin=window.location.href.replace(/\/$/,""),this.url=`${t}?orderId=${r}&merchantUrl=${encodeURIComponent(this.targetOrigin)}&mode=${h}`,this.orderId=r,this.clientId=n,this.onCheckoutClosed=o,this.title=l,this.windowFeatures=d,this.windowObserver=void 0}get isWindowObserverOpen(){return!!this.windowObserver}open=()=>{this.isCheckoutOpen?this.frame?.focus():(this.frame=window.open(this.url,this.title,this.getFeatures()),this.isCheckoutOpen=!0,this.startWindowObserver())};close=()=>{this.frame=void 0,this.isCheckoutOpen=!1,this.stopWindowObserver()};listenMessage=()=>{this.onMessage&&window.addEventListener("message",this.onMessage,!1)};postMessage=()=>{this.frame&&this.rootUrl&&this.frame.postMessage({auth:{...this.auth}},this.rootUrl)};getFeatures(){const e=this.windowFeatures?.width||this.DEFAULT_WIDTH,t=this.windowFeatures?.height||this.DEFAULT_HEIGHT,n={...this.DEFAULT_FEATURES,...this.windowFeatures};return function(e,t="="){return Object.keys(e).length?Object.entries(e).reduce(((e,[n,i])=>[...e,`${n}${t}${i}`]),[]).join(","):""}({...this.getCenteredPosition(e,t),...n,width:e,height:t})}getCenteredPosition(e,t){return{left:screen.width/2-e/2,top:screen.height/2-t/2}}startWindowObserver(){this.isWindowObserverOpen||(this.windowObserver=setInterval((()=>{this.frame?.closed&&(this.close(),this.onCheckoutClosed?.({orderId:this.orderId}),this.onMessage&&window.removeEventListener("message",this.onMessage))}),300))}stopWindowObserver(){clearInterval(this.windowObserver)}};var ln=function(e){function n(e,i){var r;return o(this,n),(r=t(this,n,[e,i])).onFlypayV2ButtonClick=function(){var e=function(e){var t=document.getElementById("loading-overlay");t&&(t.style.display=e)};r.disable(),e("flex"),r.handleMerchantOnButtonClickEvent().then((function(){var t=function(t){var n;e("none"),r.background=r.initBackground(),r.orderId?(null===(n=r.background)||void 0===n||n.initControl(),r.flypayV2Checkout(r.orderId)):r.eventEmitter.emit(Ft.UNAVAILABLE)};r.orderId?t(r.orderId):r.getOrderId().then((function(e){r.orderId=e,t()})).catch((function(t){!function(t){var n;null===(n=r.background)||void 0===n||n.clear(),e("none"),r.enable(),r.eventEmitter.emit(Ft.UNAVAILABLE,{err:t})}(t)}))})).catch((function(t){e("none"),r.enable()}))},r.accessToken=null==i?void 0:i.access_token,r.refreshToken=null==i?void 0:i.refresh_token,r.link=new ae(""),r}return l(n,e),s(n,[{key:"load",value:function(e){this.containerId=e.getSelector(),this.mount(e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),p(d(n.prototype),"setEnv",this).call(this,e)}},{key:"enable",value:function(){var e=document.getElementById("flypay-v2-button");e&&(e.disabled=!1,this.flypayV2Button.innerHTML='\n <div id="loading-overlay"></div>\n <div class="flypay-v2-checkout-btn__wrapper">\n <svg viewBox="0 0 384 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_34013_168361)">\n <rect width="384" height="48" rx="24" fill="#212121"/>\n <path d="M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z" fill="white"/>\n <path d="M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z" fill="white"/>\n <path d="M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z" fill="white"/>\n <path d="M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z" fill="white"/>\n <path d="M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z" fill="white"/>\n <path d="M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z" fill="white"/>\n <path d="M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z" fill="white"/>\n <path d="M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z" fill="white"/>\n <path d="M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z" fill="white"/>\n <path d="M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0_34013_168361">\n <rect width="384" height="48" rx="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ')}},{key:"disable",value:function(){var e=document.getElementById("flypay-v2-button");e&&(e.disabled=!0,this.flypayV2Button.innerHTML='\n <div id="loading-overlay"></div>\n <div class="flypay-v2-checkout-btn-disabled">\n <svg viewBox="0 0 384 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_34032_180021)">\n <rect x="0.5" y="0.5" width="383" height="47" rx="23.5" stroke="#212121"/>\n <path d="M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z" fill="#212121"/>\n <path d="M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z" fill="#212121"/>\n <path d="M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z" fill="#212121"/>\n <path d="M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z" fill="#212121"/>\n <path d="M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z" fill="#212121"/>\n <path d="M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z" fill="#212121"/>\n <path d="M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z" fill="#212121"/>\n <path d="M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z" fill="#212121"/>\n <path d="M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z" fill="#212121"/>\n <path d="M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z" fill="#212121"/>\n </g>\n <defs>\n <clipPath id="clip0_34032_180021">\n <rect width="384" height="48" rx="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ')}},{key:"mount",value:function(e){this.flypayV2Button=this.getButton(),this.flypayV2Button.onclick=this.onFlypayV2ButtonClick,e.getElement().appendChild(this.flypayV2Button)}},{key:"getButton",value:function(){var e,t=document.createElement("style");return t.innerHTML=(e=this.containerId,"\n ".concat(e,' {\n position: relative;\n }\n\n #loading-overlay {\n position: absolute;\n height: 100%;\n width: 100%;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n cursor: not-allowed; /* Make it look not clickable */\n }\n\n #loading-overlay::after {\n content: "";\n height: 60%;\n aspect-ratio: 1 / 1;\n display: inline-block;\n border: 4px solid #ccc;\n border-top-color: #333;\n border-radius: 50%;\n\n /* Vendor prefixes for animation property */\n -webkit-animation: spin 1s infinite linear;\n -moz-animation: spin 1s infinite linear;\n -o-animation: spin 1s infinite linear;\n animation: spin 1s infinite linear;\n }\n\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-moz-keyframes spin {\n 0% {\n -moz-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -moz-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-o-keyframes spin {\n 0% {\n -o-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -o-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n\n .flypay-v2-checkout-btn {\n width: 100%;\n height: fit-content;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: pointer; /* Make it look clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n\n .flypay-v2-checkout-btn-disabled {\n width: 100%;\n height: fit-content;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: not-allowed; /* Make it look not clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n ')),document.head.appendChild(t),this.flypayV2Button=document.createElement("button"),this.flypayV2Button.classList.add("flypay-v2-checkout-btn"),this.flypayV2Button.setAttribute("type","button"),this.flypayV2Button.setAttribute("aria-label","Pay with flypay"),this.flypayV2Button.setAttribute("id","flypay-v2-button"),this.flypayV2Button.innerHTML='\n <div id="loading-overlay"></div>\n <div class="flypay-v2-checkout-btn__wrapper">\n <svg viewBox="0 0 384 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_34013_168361)">\n <rect width="384" height="48" rx="24" fill="#212121"/>\n <path d="M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z" fill="white"/>\n <path d="M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z" fill="white"/>\n <path d="M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z" fill="white"/>\n <path d="M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z" fill="white"/>\n <path d="M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z" fill="white"/>\n <path d="M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z" fill="white"/>\n <path d="M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z" fill="white"/>\n <path d="M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z" fill="white"/>\n <path d="M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z" fill="white"/>\n <path d="M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0_34013_168361">\n <rect width="384" height="48" rx="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ',this.flypayV2Button}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Ft.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"getOrderId",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Ft.CALLBACK,{data:{request_type:"CREATE_SESSION"},onSuccess:function(e){return t(e.id)},onError:function(e){return n(e.error)}})}))}},{key:"flypayV2Checkout",value:function(e){var t,n,i=this;this.checkout=new cn(c(c({orderId:e},this.accessToken&&this.refreshToken&&{auth:{access_token:this.accessToken,refresh_token:this.refreshToken},mode:"express"}),{clientId:"live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"dbbd114e-3583-4db5-915e-59f1b3dcd08b":"924ac1ce-00f4-44e4-8277-06cae751ef1a",url:"live"===(null===(n=this.meta)||void 0===n?void 0:n.gateway_mode)?"https://checkout.cxbflypay.com.au":"https://checkout.sandbox.cxbflypay.com.au",onCheckoutClosed:function(){var e;i.eventEmitter.emit(Ft.CHECKOUT_CLOSE),null===(e=i.background)||void 0===e||e.clear(),i.enable()},onError:function(e){return i.eventEmitter.emit(Ft.PAYMENT_ERROR,{error:e})},onPaymentSuccess:function(e){return i.eventEmitter.emit(Ft.PAYMENT_SUCCESS,e)},onPaymentError:function(e){return i.eventEmitter.emit(Ft.PAYMENT_ERROR,{error:e})},onTokensChanged:function(e){var t=e.accessToken,n=e.refreshToken;i.accessToken=t,i.refreshToken=n,i.eventEmitter.emit(Ft.AUTH_TOKENS_CHANGED,{accessToken:t,refreshToken:n})}})),this.checkout.open(),this.checkout.isCheckoutOpen&&this.eventEmitter.emit(Ft.CHECKOUT_OPEN,{}),this.checkout.listenMessage()}},{key:"initBackground",value:function(){var e=this,t=new Dt(this.link.getNetUrl()+oe);return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Ze,(function(){var t;e.checkout.close(),null===(t=e.background)||void 0===t||t.clear(),e.enable()})),t}}])}(Vt),dn="unavailable",hn="update",pn="paymentSuccessful",fn="paymentError",vn="paymentInReview",mn="authTokensChanged",yn="onClick",gn="onCheckoutOpen",kn="onCheckoutClose",En=function(){return s((function e(t,n,i){o(this,e),this.hasUpdateHandler=!1;var r=b.validateJWT(n);if(!r)throw new Error("Invalid charge token");this.eventEmitter=new Oe,this.container=new ue(t);var a=b.extractMeta(r.body);switch(this.api=new be(n,g.TOKEN),a.gateway.type){case xe.STRIPE:this.service=new rn(a.credentials.client_auth,c(c({},i),{amount:a.charge.amount,currency:a.charge.currency}));break;case xe.FLYPAY:this.service=new Bt(n,c(c({},i),{id:a.charge.id,gateway_mode:a.gateway.mode,amount:a.charge.amount,currency:a.charge.currency,reference:a.charge.reference}));break;case xe.FLYPAY_V2:this.service=new ln(n,c(c({},i),{id:a.charge.id,gateway_mode:a.gateway.mode,amount:a.charge.amount,currency:a.charge.currency,reference:a.charge.reference}));break;case xe.PAYPAL:this.service=new jt(a.credentials.client_auth,c(c({},i),{id:a.charge.id,gateway_mode:a.gateway.mode,amount:a.charge.amount,currency:a.charge.currency,capture:a.charge.capture}));break;case xe.MASTERCARD:this.service=new sn("",c(c({},i),{credentials:a.gateway.credentials,amount:a.charge.amount,currency:a.charge.currency,gateway_mode:a.gateway.mode}));break;case xe.AFTERPAY:this.service=new un(n,c(c({},i),{id:a.charge.id,gateway_mode:a.gateway.mode,amount:a.charge.amount,currency:a.charge.currency,reference:a.charge.reference}))}}),[{key:"load",value:function(){try{this.setupServiceCallbacks(),this.service.load(this.container)}catch(e){throw this.eventEmitter.emit(dn,null),e}}},{key:"update",value:function(e){this.service.update(e)}},{key:"setEnv",value:function(e,t){this.api.setEnv(e,t),this.service.setEnv(e)}},{key:"enable",value:function(){this.service.enable()}},{key:"disable",value:function(){this.service.disable()}},{key:"close",value:function(){"function"==typeof this.service.close&&this.service.close()}},{key:"on",value:function(e,t){var n=this;return e===hn&&(this.hasUpdateHandler=!0),"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"onUnavailable",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(dn,e):new Promise((function(e){return t.eventEmitter.subscribe(dn,(function(){return e()}))}))}},{key:"onUpdate",value:function(e){var t=this;return this.hasUpdateHandler=!0,"function"==typeof e?this.eventEmitter.subscribe(hn,e):new Promise((function(e){return t.eventEmitter.subscribe(hn,(function(t){return e(t)}))}))}},{key:"onPaymentSuccessful",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(pn,e):new Promise((function(e){return t.eventEmitter.subscribe(pn,(function(t){return e(t)}))}))}},{key:"onPaymentInReview",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(vn,e):new Promise((function(e){return t.eventEmitter.subscribe(vn,(function(t){return e(t)}))}))}},{key:"onPaymentError",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(fn,e):new Promise((function(e){return t.eventEmitter.subscribe(fn,(function(t){return e(t)}))}))}},{key:"onAuthTokensChanged",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(mn,e):new Promise((function(e){return t.eventEmitter.subscribe(mn,(function(t){return e(t)}))}))}},{key:"onClick",value:function(e){if("function"==typeof e)return this.eventEmitter.subscribe(yn,e)}},{key:"onCheckoutOpen",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(gn,e):new Promise((function(e){return t.eventEmitter.subscribe(gn,(function(t){return e(t)}))}))}},{key:"onCheckoutClose",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(kn,e):new Promise((function(e){return t.eventEmitter.subscribe(kn,(function(t){return e(t)}))}))}},{key:"setupServiceCallbacks",value:function(){this.setupUnavailableCallback(),this.setupUpdateCallback(),this.setupWalletCallback(),this.setupPaymentCallback(),this.setupPaymentSuccessCallback(),this.setupPaymentInReviewCallback(),this.setupPaymentErrorCallback(),this.setupAuthTokensChangedCallback(),this.setupOnClickCallback(),this.setupOnCheckoutOpenCallback(),this.setupOnCheckoutCloseCallback()}},{key:"setupUnavailableCallback",value:function(){var e=this;this.service.on(Ft.UNAVAILABLE,(function(t){return e.eventEmitter.emit(dn,{event:dn,data:t})}))}},{key:"setupUpdateCallback",value:function(){var e=this;this.service.on(Ft.UPDATE,(function(t){return e.hasUpdateHandler?e.eventEmitter.emit(hn,{event:hn,data:t}):e.update({success:!0})}))}},{key:"setupOnClickCallback",value:function(){var e=this;this.service.on(Ft.BUTTON_CLICK,(function(t){return e.eventEmitter.emit(yn,{event:yn,data:t})}))}},{key:"setupOnCheckoutOpenCallback",value:function(){var e=this;this.service.on(Ft.CHECKOUT_OPEN,(function(t){return e.eventEmitter.emit(gn,{event:gn,data:t})}))}},{key:"setupOnCheckoutCloseCallback",value:function(){var e=this;this.service.on(Ft.CHECKOUT_CLOSE,(function(t){return e.eventEmitter.emit(kn,{event:kn,data:t})}))}},{key:"setupWalletCallback",value:function(){var e=this;this.service.on(Ft.CALLBACK,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCallback(n).then((function(e){return i(e)}),(function(e){return r(e.message)}))}))}},{key:"setupPaymentCallback",value:function(){var e=this;this.service.on(Ft.PAYMENT_METHOD_SELECTED,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCapture(n).then((function(t){"function"==typeof i&&i();var r="inreview"===t.status?vn:pn;e.eventEmitter.emit(r,{event:r,data:c(c({},t),n.customer&&{payer_name:n.customer.payer_name,payer_email:n.customer.payer_email,payer_phone:n.customer.payer_phone})})}),(function(t){"function"==typeof r&&r(t),e.eventEmitter.emit(fn,{event:fn,data:t})}))}))}},{key:"setupPaymentSuccessCallback",value:function(){var e=this;this.service.on(Ft.PAYMENT_SUCCESS,(function(t){return e.eventEmitter.emit(pn,{event:pn,data:t})}))}},{key:"setupPaymentInReviewCallback",value:function(){var e=this;this.service.on(Ft.PAYMENT_IN_REVIEW,(function(t){return e.eventEmitter.emit(vn,{event:vn,data:t})}))}},{key:"setupPaymentErrorCallback",value:function(){var e=this;this.service.on(Ft.PAYMENT_ERROR,(function(t){return e.eventEmitter.emit(fn,{event:fn,data:t})}))}},{key:"setupAuthTokensChangedCallback",value:function(){var e=this;this.service.on(Ft.AUTH_TOKENS_CHANGED,(function(t){return e.eventEmitter.emit(mn,{event:mn,data:t})}))}}])}(),Cn={CARD:"card",GIFT_CARD:"gift_card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},_n={PAYMENT_SOURCE:"payment_source",CARD_PAYMENT_SOURCE_WITH_CVV:"card_payment_source_with_cvv",CARD_PAYMENT_SOURCE_WITHOUT_CVV:"card_payment_source_without_cvv"},wn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cn.CARD,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_n.PAYMENT_SOURCE;if(o(this,e),-1===wt.values(Cn).indexOf(n))throw new Error("unsupported payment type");if(n===Cn.CHECKOUT)throw new Error('Payment type "checkout" is deprecated. Use CheckoutButton for this type of payments https://www.npmjs.com/package/@paydock/client-sdk#checkout-button');if(-1===wt.values(_n).indexOf(i))throw new Error("unsupported purpose");this.env=new X(Y),this.configs={purpose:i,meta:{},dynamic_fields_position:!0,predefined_fields:{gateway_id:t,type:n,card_scheme:null,card_processing_network:null}}}return s(e,[{key:"setWebHookDestination",value:function(e){this.configs.webhook_destination=e}},{key:"setSuccessRedirectUrl",value:function(e){this.configs.success_redirect_url=e}},{key:"setErrorRedirectUrl",value:function(e){this.configs.error_redirect_url=e}},{key:"setFormFields",value:function(e){for(var t in Array.isArray(this.configs.defined_form_fields)||(this.configs.defined_form_fields=[]),e)e.hasOwnProperty(t)&&(-1!==wt.values(Me).indexOf(e[t].replace("*",""))?this.configs.defined_form_fields.push(e[t]):console.warn("Configuration::setFormFields: unsupported form field ".concat(e[t])))}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Be.indexOf(t)?this.configs.meta[t]=e[t]:console.warn("Configuration::setMeta: unsupported meta key ".concat(t)))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"setLabel",value:function(e){this.configs.label=e}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"createToken",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.send(e,(function(e,i){if(i>=200&&i<300)return t(e.resource.data.configuration_token);void 0===e.error||void 0===e.error.message?n("unknown error"):n(e.error.message)}))}},{key:"send",value:function(e,t){var n=new XMLHttpRequest;n.open("POST",this.getUrl(),!0),n.setRequestHeader("Content-Type","application/json; charset=UTF-8"),n.setRequestHeader(b.getAccessHeaderNameByToken(e),e),$.version&&(n.setRequestHeader($.headerKeys.version,$.version),n.setRequestHeader($.headerKeys.type,$.type)),n.send(JSON.stringify(this.getConfigs())),n.onload=function(){var e={};try{e=JSON.parse(n.responseText)}catch(e){}t(e,n.status)}}},{key:"getConfigs",value:function(){return this.configs}},{key:"getUrl",value:function(){return this.env.getConf().url+"/v1/remote-action/configs"}},{key:"setGiftCardSchemeData",value:function(e,t){if(this.configs.predefined_fields.type!==Cn.GIFT_CARD)throw new Error("unsupported payment type");if(!e||!t)throw new Error("");this.configs.predefined_fields.card_scheme=e,this.configs.predefined_fields.card_processing_network=t}}],[{key:"createEachToken",value:function(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){},o=new Array(n.length),a=[],s=0,u=function(u){n.hasOwnProperty(u)&&n[u].createToken(t,(function(t){o[u]=t,s++,n.length===s&&e.finishCreatingEachToken(o,a,i,r)}),(function(t){a.push("gateway: ".concat(n[u].getConfigs().predefined_fields.gateway_id," | ").concat(t)),s++,n.length===s&&e.finishCreatingEachToken(o,a,i,r)}))};for(var c in n)u(c)}},{key:"finishCreatingEachToken",value:function(e,t,n,i){t.length>=1?i(t):n(e)}}])}(),bn={INPUT:"input",SUBMIT_BUTTON:"submit_button",LABEL:"label",TITLE:"title",TITLE_DESCRIPTION:"title_description"},Sn={ERROR:"error",FOCUS:"focus",HOVER:"hover"},Tn=[{element:bn.INPUT,states:[Sn.FOCUS,Sn.ERROR],styles:["color","border","border_radius","background_color","height","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition"]},{element:bn.SUBMIT_BUTTON,states:[Sn.HOVER],styles:["color","border","border_radius","background_color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition","opacity"]},{element:bn.LABEL,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin"]},{element:bn.TITLE,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]},{element:bn.TITLE_DESCRIPTION,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]}],On=function(){return s((function e(){o(this,e)}),null,[{key:"check",value:function(e,t,n,i){for(var r in e)if(e.hasOwnProperty(r)&&e[r].element===t){if(-1===e[r].states.indexOf(n)&&n)return!1;for(var o in i)if(i.hasOwnProperty(o)&&-1===e[r].styles.indexOf(o.replace("-","_")))return!1;return!0}return!1}},{key:"encode",value:function(e,t,n){var i=[];for(var r in n)n.hasOwnProperty(r)&&i.push("".concat(r.replace("_","-"),":").concat(n[r]));var o=i.join(";");return t?"".concat(e,"::").concat(t,"{").concat(o,"}"):"".concat(e,"{").concat(o,"}")}},{key:"decode",value:function(e){var t=(e.match("::(.*){")||["",null])[1],n=null!==t?(e.match("(.*)::")||["",""])[1].trim():(e.match("(.*){")||["",""])[1].trim(),i=(e.match("{(.*)}")||["",""])[1].split(";"),r={};for(var o in i)if(i.hasOwnProperty(o)){var a=i[o].split(":");(a||2===a.length)&&(r[a[0].trim()]=(a[1]||"").trim())}return{element:n,state:t,styles:r}}}])}(),An=function(){return s((function e(t,n){if(o(this,e),this.configs=[],this.configTokens=[],this.link=new ae("/remote-action"),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type}),b.validateJWT(t)?this.link.setParams({token:t}):this.link.setParams({public_key:t}),this.accessToken=t,!n||Array.isArray(n)&&!n.length)throw Error("configuration token is required");if("string"==typeof n)this.configTokens.push(n);else if(n instanceof wn)this.configs.push(n);else if(Array.isArray(n)&&"string"==typeof n[0])this.configTokens=n;else{if(!(Array.isArray(n)&&n[0]instanceof wn))throw Error("Unsupported type of configuration token");this.configs=n}}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"usePhoneCountryMask",value:function(e){return e?!e.only_countries||/^[a-z]+$/.test(e.only_countries.join(""))&&2*e.only_countries.length===e.only_countries.join("").length?!e.preferred_countries||/^[a-z]+$/.test(e.preferred_countries.join(""))&&2*e.preferred_countries.length===e.preferred_countries.join("").length?e.default_country&&2!==e.default_country.length?console.warn("Widget::usePhoneCountryMask[s: default_country - incorrect value length"):(this.link.setParams({use_country_phone_mask:!0}),e.only_countries&&this.link.setParams({phone_mask_only_countries:e.only_countries.join(",")}),e.preferred_countries&&this.link.setParams({phone_mask_preferred_countries:e.preferred_countries.join(",")}),void(e.default_country&&this.link.setParams({phone_mask_default_country:e.default_country}))):console.warn("Widget::usePhoneCountryMask[s: preferred_countries - unsupported symbols or incorrect length of value"):console.warn("Widget::usePhoneCountryMask[s: only_countries - unsupported symbols or incorrect length of value"):this.link.setParams({use_country_phone_mask:!0})}},{key:"setStyle",value:function(e,t){-1!==wt.values(Ne).indexOf(e)?this.link.setParams(u({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setTexts",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setText(t,e[t])}},{key:"setText",value:function(e,t){-1!==wt.values(De).indexOf(e)?this.link.setParams(u({},e,t)):console.warn("Widget::setText[s: unsupported text param ".concat(e))}},{key:"setElementStyle",value:function(e,t,n){var i=3===arguments.length?t:null,r=3===arguments.length?n:t;if(!On.check(Tn,e,i,r))return console.warn('Styles for "'.concat(e,'" element with "').concat(i||"default",'" state was ignored because some of the arguments are unacceptable'));this.link.concatParams({element_styles:On.encode(e,i,r)})}},{key:"setFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormValue(t,e[t])}},{key:"setFormValue",value:function(e,t){return-1===wt.values(Me).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void("string"==typeof this.link.getParams().form_values&&this.link.getParams().form_values.length?this.link.setParams({form_values:"".concat(this.link.getParams().form_values,",").concat(e,":").concat(t)}):this.link.setParams({form_values:"".concat(e,":").concat(t)}))}},{key:"setFormLabels",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormLabel(t,e[t])}},{key:"setFormLabel",value:function(e,t){if(-1===wt.values(Me).indexOf(e))return console.warn("Widget::setFormLabel[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormLabel[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_labels:"".concat(e,":").concat(n)})}},{key:"setFormPlaceholders",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormPlaceholder(t,e[t])}},{key:"setFormPlaceholder",value:function(e,t){if(-1===wt.values(Me).indexOf(e))return console.warn("Widget::setFormPlaceholder[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormPlaceholder[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_placeholders:"".concat(e,":").concat(n)})}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){e.value&&this.setFormValue(e.field,e.value),e.label&&this.setFormLabel(e.field,e.label),e.placeholder&&this.setFormPlaceholder(e.field,e.placeholder)}},{key:"setIcons",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setIcon(t,e[t])}},{key:"setIcon",value:function(e,t){if(/\,/.test(t)||/\:/.test(t))return console.warn("Widget::setIcon[s: ".concat(e," - unsupported symbols (: or ,) in value"));"string"==typeof this.link.getParams().icons&&this.link.getParams().icons.length?this.link.setParams({icons:"".concat(this.link.getParams().icons,",").concat(e,":").concat(t)}):this.link.setParams({icons:"".concat(e,":").concat(t)})}},{key:"setHiddenElements",value:function(e){var t=[],n=wt.values(Fe).concat(wt.values(Me));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::setHiddenElements: unsupported element ".concat(e[i])));t.length&&this.link.concatParams({hidden_elements:t.join(",")})}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"useGatewayFieldValidation",value:function(){this.link.setParams({fields_validation:!0})}},{key:"setSupportedCardIcons",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(-1!==wt.values(Ve).indexOf(e[i])?n.push(e[i]):console.warn("Widget::cardTypes: unsupported type of cards ".concat(e[i])));n.length&&this.link.concatParams({supported_card_types:n.join(",")}),t&&this.link.setParams({validate_card_types:t})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"loadIFrameUrl",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){};if(this.link.setParams({configuration_tokens:""}),this.configTokens.length)return this.link.setParams({configuration_tokens:this.configTokens.join(",")}),e(this.link.getUrl());wn.createEachToken(this.accessToken,this.configs,(function(n){return t.link.concatParams({configuration_tokens:n.join(",")}),e(t.link.getUrl())}),(function(e){n(e)}))}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),Pn=function(){return s((function e(t){o(this,e),this.intercepted=!1,this.selector=t}),[{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"beforeSubmit",value:function(e){var t=this;this.isExist()&&this.subscribe(this.getElement(),(function(n){n.preventDefault(),t.intercepted=!0,e.apply(t,[])}))}},{key:"continueSubmit",value:function(){var e=this;this.isExist()&&this.intercepted&&(this.intercepted=!1,setTimeout((function(){e.getElement().submit()}),50))}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("submit",t):e.attachEvent("onsubmit",t)}}])}(),Rn=function(e){function n(e,i,r){var a;return o(this,n),(a=t(this,n,[i,r])).validationData={},a.container=new ue(e),a.iFrame=new ce(a.container),a.triggerElement=new Lt(a.iFrame),a.event=new de(window),a}return l(n,e),s(n,[{key:"load",value:function(){var e=this;this.setStyles(this.container.getStyles(wt.values(Ne))),this.setTexts(this.container.getAttr(wt.values(De))),this.loadIFrameUrl((function(t){e.iFrame.load(t,{title:"Card details"}),e.afterLoad()}),(function(e){for(var t in console.error("Errors when creating a token[s, widget will not be load:"),e)e.hasOwnProperty(t)&&console.error("--- | ".concat(e[t]))}))}},{key:"afterLoad",value:function(){var e=this;this.on(le.VALIDATION,(function(t){e.validationData=t}))}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.triggerElement.push(e,t)}},{key:"getValidationState",value:function(){return this.validationData}},{key:"isValidForm",value:function(){return!!this.validationData.form_valid}},{key:"isInvalidField",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_fields&&-1!==this.validationData.invalid_fields.indexOf(e)}},{key:"isFieldErrorShowed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_showed_fields&&-1!==this.validationData.invalid_showed_fields.indexOf(e)}},{key:"isInvalidFieldByValidator",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=!1;if(!this.validationData.validators)return n;var i=this.validationData.validators[t];return i?-1!==i.indexOf(e):n}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"hideElements",value:function(e){var t=[],n=wt.values(Fe).concat(wt.values(Me));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::hideElements: unsupported element ".concat(e[i])));t.length&&this.trigger(Rt.HIDE_ELEMENTS,{elements:t.join(",")})}},{key:"showElements",value:function(e){var t=[],n=wt.values(Fe).concat(wt.values(Me));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::showElements: unsupported element ".concat(e[i])));t.length&&this.trigger(Rt.SHOW_ELEMENTS,{elements:t.join(",")})}},{key:"updateFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.updateFormValue(t,e[t])}},{key:"updateFormValue",value:function(e,t){return-1===wt.values(Me).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void this.trigger(Rt.UPDATE_FORM_VALUES,{form_values:"".concat(e,":").concat(t)})}},{key:"onFinishInsert",value:function(e,t){this.on(le.FINISH,(function(n){se.insertToInput(e,t,n)}))}},{key:"interceptSubmitForm",value:function(e){var t=this;this.setHiddenElements([Fe.SUBMIT_BUTTON]);var n=new Pn(e);n.beforeSubmit((function(){t.triggerElement.push(Rt.SUBMIT_FORM,{}),t.event.on(le.FINISH,t.link.getParams().widget_id,(function(){n.continueSubmit()}))}))}},{key:"useCheckoutAutoSubmit",value:function(){var e=this;this.setHiddenElements([Fe.SUBMIT_BUTTON]),this.on(le.CHECKOUT_SUCCESS,(function(t){e.trigger(Rt.SUBMIT_FORM)})),this.on(le.VALIDATION_ERROR,(function(t){e.trigger(Rt.REFRESH_CHECKOUT)})),this.on(le.SYSTEM_ERROR,(function(t){e.trigger(Rt.REFRESH_CHECKOUT)}))}},{key:"useAutoResize",value:function(){var e=this;this.on(le.RESIZE,(function(t){e.iFrame.getElement()&&(e.iFrame.getElement().scrolling="no",t.height&&e.iFrame.setStyle("height",t.height+"px"))}))}}])}(An),Ln=function(e){function n(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return o(this,n),t(this,n,[e,i,new wn(r,a,s)])}return l(n,e),s(n,[{key:"setWebHookDestination",value:function(e){this.configs[0].setWebHookDestination(e)}},{key:"setSuccessRedirectUrl",value:function(e){this.configs[0].setSuccessRedirectUrl(e)}},{key:"setErrorRedirectUrl",value:function(e){this.configs[0].setErrorRedirectUrl(e)}},{key:"setFormFields",value:function(e){this.configs[0].setFormFields(e)}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){this.configs[0].setFormFields([e.field]),p(d(n.prototype),"setFormElement",this).call(this,c(c({},e),{field:e.field.replace("*","")}))}},{key:"setMeta",value:function(e){this.configs[0].setMeta(e)}},{key:"setGiftCardScheme",value:function(e,t){this.configs[0].setGiftCardSchemeData(e,t)}}])}(Rn);e.AfterpayCheckoutButton=Ct,e.Api=te,e.CHECKOUT_BUTTON_EVENT=Le,e.Canvas3ds=Re,e.Configuration=wn,e.ELEMENT=Fe,e.EVENT=le,e.ExternalCheckoutBuilder=qe,e.ExternalCheckoutChecker=Ke,e.FORM_FIELD=Me,e.HtmlMultiWidget=Rn,e.HtmlPaymentSourceWidget=St,e.HtmlWidget=Ln,e.MastercardSRCClickToPay=Pt,e.MultiWidget=An,e.PAYMENT_TYPE=Cn,e.PURPOSE=_n,e.PaymentSourceBuilder=yt,e.PaymentSourceWidget=bt,e.PaypalCheckoutButton=_t,e.STYLABLE_ELEMENT=bn,e.STYLABLE_ELEMENT_STATE=Sn,e.STYLE=Ne,e.SUPPORTED_CARD_TYPES=Ve,e.TEXT=De,e.TRIGGER=Rt,e.TYPE=mt,e.VAULT_DISPLAY_STYLE={BACKGROUND_COLOR:"background_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",BUTTON_COLOR:"button_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},e.VaultDisplayWidget=It,e.WalletButtons=En,e.ZipmoneyCheckoutButton=Et}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("isomorphic-dompurify")):"function"==typeof define&&define.amd?define(["exports","isomorphic-dompurify"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).paydock={})}(this,(function(e){"use strict";function t(e,t,i){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,n()?Reflect.construct(t,i||[],h(e).constructor):t.apply(e,i))}function n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(n=function(){return!!e})()}function i(){i=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var r=t&&t.prototype instanceof y?t:y,s=Object.create(r.prototype),a=new A(i||[]);return o(s,"_invoke",{value:N(e,n,a)}),s}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p="suspendedStart",f="suspendedYield",m="executing",v="completed",g={};function y(){}function b(){}function E(){}var w={};u(w,a,(function(){return this}));var k=Object.getPrototypeOf,S=k&&k(k(x([])));S&&S!==n&&r.call(S,a)&&(w=S);var C=E.prototype=y.prototype=Object.create(w);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function n(i,o,s,a){var c=h(e[i],e,o);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(u).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}})}function N(t,n,i){var r=p;return function(o,s){if(r===m)throw Error("Generator is already running");if(r===v){if("throw"===o)throw s;return{value:e,done:!0}}for(i.method=o,i.arg=s;;){var a=i.delegate;if(a){var c=O(a,i);if(c){if(c===g)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===p)throw r=v,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=m;var l=h(t,n,i);if("normal"===l.type){if(r=i.done?v:f,l.arg===g)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(r=v,i.method="throw",i.arg=l.arg)}}}function O(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function I(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)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function x(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=E,o(C,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:b,configurable:!0}),b.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},T(_.prototype),u(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var s=new _(d(e,n,i,r),o);return t.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},T(C),u(C,l,"Generator"),u(C,a,(function(){return this})),u(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=x,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(i,r){return a.type="throw",a.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},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),g},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),R(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;R(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:x(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),g}},t}function r(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u.apply(this,arguments)}function d(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},f.apply(this,arguments)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,s,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(i=o.call(n)).done)&&(a.push(i.value),a.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw r}}return a}}(e,t)||g(e,t)||function(){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 v(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){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 g(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(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var b=function(){return c((function e(){s(this,e)}),null,[{key:"isFacebook",value:function(){return-1!==navigator.userAgent.indexOf("FBSN/iOS")&&-1!==navigator.userAgent.indexOf("AppleWebKit")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isInstagram",value:function(){return-1!==navigator.userAgent.indexOf("iOS")&&-1!==navigator.userAgent.indexOf("Instagram")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isSupportPopUp",value:function(){return!this.isFacebook()&&!this.isInstagram()}},{key:"getLanguage",value:function(){return window.navigator.language||""}},{key:"getTimezoneOffset",value:function(){return(new Date).getTimezoneOffset()}},{key:"getBrowserName",value:function(){var e=navigator.userAgent;return e.indexOf("Firefox")>-1?"Mozilla Firefox":e.indexOf("Opera")>-1?"Opera":e.indexOf("Trident")>-1?"Microsoft Internet Explorer":e.indexOf("Edge")>-1?"Microsoft Edge":e.indexOf("Chrome")>-1?"Google Chrome or Chromium":e.indexOf("Safari")>-1?"Apple Safari":"unknown"}},{key:"isJavaEnabled",value:function(){return navigator.javaEnabled()}},{key:"getColorDepth",value:function(){return screen.colorDepth}},{key:"getScreenHeight",value:function(){return screen.height}},{key:"getScreenWidth",value:function(){return screen.width}},{key:"getBrowserInfo",value:function(){var e,t=navigator.userAgent,n=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?{name:"IE",version:(e=/\brv[ :]+(\d+)/g.exec(t)||[])[1]||""}:"Chrome"===n[1]&&null!=(e=t.match(/\bOPR|Edge\/(\d+)/))?{name:"Opera",version:e[1]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&n.splice(1,1,e[1]),{name:n[0],version:n[1]})}}])}(),E="/v1/charges/3ds",w=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"preAuth",value:function(e,t){return"function"==typeof t?this.api.getClient("POST",E).send(u(u({},e),{_3ds:u(u({},e._3ds),{browser_details:{name:b.getBrowserName(),java_enabled:b.isJavaEnabled().toString(),language:b.getLanguage(),screen_height:b.getScreenHeight().toString(),screen_width:b.getScreenWidth().toString(),time_zone:b.getTimezoneOffset().toString(),color_depth:b.getColorDepth().toString()}})}),(function(e){t(e)})):this.api.getClientPromise("POST",E).send(u(u({},e),{_3ds:u(u({},e._3ds),{browser_details:{name:b.getBrowserName(),java_enabled:b.isJavaEnabled().toString(),language:b.getLanguage(),screen_height:b.getScreenHeight().toString(),screen_width:b.getScreenWidth().toString(),time_zone:b.getTimezoneOffset().toString(),color_depth:b.getColorDepth().toString()}})}))}}])}(),k="sandbox",S="sandbox-kovena",C="sandbox-demo-kovena",T="production",_="staging",N="staging_1",O="staging_2",I="staging_3",R="staging_4",A="staging_5",x="staging_6",M="staging_7",L="staging_8",P="staging_9",D="staging_10",F="staging_11",U="staging_12",H="staging_13",j="staging_14",B="staging_15",V=[{env:k,url:"https://widget-sandbox."},{env:S,url:"https://widget-sandbox."},{env:"sandbox-demo",url:"https://widget-sandbox-demo."},{env:C,url:"https://widget-sandbox-demo."},{env:T,url:"https://widget."},{env:_,url:"https://widsta."},{env:N,url:"https://widsta-1."},{env:O,url:"https://widsta-2."},{env:I,url:"https://widsta-3."},{env:R,url:"https://widsta-4."},{env:A,url:"https://widsta-5."},{env:x,url:"https://widsta-6."},{env:M,url:"https://widsta-7."},{env:L,url:"https://widsta-8."},{env:P,url:"https://widsta-9."},{env:D,url:"https://widsta-10."},{env:F,url:"https://widsta-11."},{env:U,url:"https://widsta-12."},{env:H,url:"https://widsta-13."},{env:j,url:"https://widsta-14."},{env:B,url:"https://widsta-15."}],z=[{env:k,url:"https://api-sandbox."},{env:T,url:"https://api."},{env:_,url:"https://apista."},{env:N,url:"https://apista-1."},{env:O,url:"https://apista-2."},{env:I,url:"https://apista-3."},{env:R,url:"https://apista-4."},{env:A,url:"https://apista-5."},{env:x,url:"https://apista-6."},{env:M,url:"https://apista-7."},{env:L,url:"https://apista-8."},{env:P,url:"https://apista-9."},{env:D,url:"https://apista-10."},{env:F,url:"https://apista-11."},{env:U,url:"https://apista-12."},{env:H,url:"https://apista-13."},{env:j,url:"https://apista-14."},{env:B,url:"https://apista-15."}],W=[S,C],q=k,G="paydock.com",K="kovena.com",Y=function(){return c((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:q;s(this,e),this.configs=t,this.setEnv(n)}),[{key:"setEnv",value:function(e,t){if(!this.isValidMode(this.configs,e))throw new Error("unknown env: ".concat(e));if(this.env=e,t&&!t.match("^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$"))throw new Error("invalid: ".concat(t));t?this.alias=t:-1!==W.indexOf(this.env)?this.alias=K:this.alias=G}},{key:"getEnv",value:function(){return this.env}},{key:"getConf",value:function(){for(var e in this.configs)if(this.configs.hasOwnProperty(e)&&this.configs[e].env===this.getEnv())return{url:-1!==this.configs[e].url.indexOf("localhost")?this.configs[e].url:this.configs[e].url+this.alias,env:this.configs[e].env};throw new Error("invalid env")}},{key:"isValidMode",value:function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].env===t)return!0;return!1}}])}(),$=function(){function e(){s(this,e)}return c(e,null,[{key:"version",get:function(){return e._version.trim()||null}}])}();$.type="client",$.headerKeys=Object.freeze({version:"x-sdk-version",type:"x-sdk-type"}),$._version="v1.104.7-beta";var Z="x-access-token",J="x-user-public-key",X=function(){function e(){s(this,e)}return c(e,null,[{key:"validateJWT",value:function(e){if(!e)return null;var t=m(e.split("."),3),n=t[0],i=t[1],r=t[2];if(!n||!i||!r)return null;if(2+n.length+i.length+r.length!==e.length)return null;try{return{head:JSON.parse(atob(n)),body:JSON.parse(atob(i)),signature:r}}catch(e){return null}}},{key:"extractData",value:function(e){try{return JSON.parse(atob(e.meta))}catch(e){return null}}},{key:"extractMeta",value:function(e){try{return JSON.parse(atob(e.meta)).meta}catch(e){return null}}},{key:"getAccessHeaderNameByToken",value:function(t){return e.validateJWT(t)?Z:J}}])}(),Q=function(){function e(t){s(this,e),this.request=t}return c(e,[{key:"inner",value:function(){return this.request}},{key:"setHeader",value:function(e,t){return this.request.setRequestHeader(e,t),this}},{key:"setAccessToken",value:function(e){return this.setHeader("x-access-token",e)}},{key:"setPublicKey",value:function(e){return this.setHeader("x-user-public-key",e)}},{key:"setContentTypeJson",value:function(){return this.setHeader("Content-Type","application/json; charset=UTF-8")}},{key:"setSdkVersion",value:function(){return $.version&&(this.setHeader($.headerKeys.version,$.version),this.setHeader($.headerKeys.type,$.type)),this}}],[{key:"create",value:function(t,n){var i=new XMLHttpRequest;return i.open(t,n,!0),new e(i)}}])}();function ee(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;
2
+ /**
3
+ * @file Contains constants about the environment the agent is running
4
+ * within. These values are derived at the time the agent is first loaded.
5
+ * @copyright 2023 New Relic Corporation. All rights reserved.
6
+ * @license Apache-2.0
7
+ */
8
+ const te="undefined"!=typeof window&&!!window.document,ne="undefined"!=typeof WorkerGlobalScope&&("undefined"!=typeof self&&self instanceof WorkerGlobalScope&&self.navigator instanceof WorkerNavigator||"undefined"!=typeof globalThis&&globalThis instanceof WorkerGlobalScope&&globalThis.navigator instanceof WorkerNavigator),ie=te?window:"undefined"!=typeof WorkerGlobalScope&&("undefined"!=typeof self&&self instanceof WorkerGlobalScope&&self||"undefined"!=typeof globalThis&&globalThis instanceof WorkerGlobalScope&&globalThis),re="complete"===ie?.document?.readyState,oe=Boolean("hidden"===ie?.document?.visibilityState),se=""+ie?.location,ae=/iPad|iPhone|iPod/.test(ie.navigator?.userAgent),ce=ae&&"undefined"==typeof SharedWorker;(()=>{const e=ie.navigator?.userAgent?.match(/Firefox[/\s](\d+\.\d+)/);Array.isArray(e)&&e.length>=2&&e[1]})();const le=Boolean(te&&window.document.documentMode),ue=!!ie.navigator?.sendBeacon,de=Math.floor(Date.now()-performance.now());function he(){return Math.floor(performance.now())}const pe={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net"};function fe(){return ie.NREUM||(ie.NREUM={}),void 0===ie.newrelic&&(ie.newrelic=ie.NREUM),ie.NREUM}function me(){let e=fe();return e.o||(e.o={ST:ie.setTimeout,SI:ie.setImmediate,CT:ie.clearTimeout,XHR:ie.XMLHttpRequest,REQ:ie.Request,EV:ie.Event,PR:ie.Promise,MO:ie.MutationObserver,FETCH:ie.fetch}),e}function ve(e){let t=fe();return t.initializedAgents?.[e]}function ge(){return function(){let e=fe();const t=e.info||{};e.info={beacon:pe.beacon,errorBeacon:pe.errorBeacon,...t}}(),function(){let e=fe();const t=e.init||{};e.init={...t}}(),me(),function(){let e=fe();const t=e.loader_config||{};e.loader_config={...t}}(),fe()}var ye=Object.prototype.hasOwnProperty;function be(e,t,n){if(ye.call(e,t))return e[t];var i=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(e,t,{value:i,writable:!0,enumerable:!1}),i}catch(e){}return e[t]=i,i}function Ee(e,t){"function"==typeof console.warn&&(console.warn("New Relic: ".concat(e)),t&&console.warn(t))}function we(e,t){try{if(!e||"object"!=typeof e)return Ee("Setting a Configurable requires an object as input");if(!t||"object"!=typeof t)return Ee("Setting a Configurable requires a model to set its initial properties");const n=Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t)),i=0===Object.keys(n).length?e:n;for(let r in i)if(void 0!==e[r])try{if(null===e[r]){n[r]=null;continue}Array.isArray(e[r])&&Array.isArray(t[r])?n[r]=Array.from(new Set([...e[r],...t[r]])):"object"==typeof e[r]&&"object"==typeof t[r]?n[r]=we(e[r],t[r]):n[r]=e[r]}catch(e){Ee("An error occurred while setting a property of a Configurable",e)}return n}catch(e){Ee("An error occured while setting a Configurable",e)}}const ke={beacon:pe.beacon,errorBeacon:pe.errorBeacon,licenseKey:void 0,applicationID:void 0,sa:void 0,queueTime:void 0,applicationTime:void 0,ttGuid:void 0,user:void 0,account:void 0,product:void 0,extra:void 0,jsAttributes:{},userAttributes:void 0,atts:void 0,transactionName:void 0,tNamePlain:void 0},Se={};function Ce(e){if(!e)throw new Error("All info objects require an agent identifier!");if(!Se[e])throw new Error("Info for ".concat(e," was never set"));return Se[e]}function Te(e,t){if(!e)throw new Error("All info objects require an agent identifier!");Se[e]=we(t,ke);const n=ve(e);n&&(n.info=Se[e])}const _e=e=>{if(!e||"string"!=typeof e)return!1;try{document.createDocumentFragment().querySelector(e)}catch{return!1}return!0},Ne=144e5,Oe=18e5,Ie="session-started",Re="session-pause",Ae="session-reset",xe="session-resume",Me="session-update",Le="same-tab",Pe="cross-tab",De={OFF:0,FULL:1,ERROR:2},Fe="[data-nr-mask]",Ue=()=>{const e={mask_selector:"*",block_selector:"[data-nr-block]",mask_input_options:{color:!1,date:!1,"datetime-local":!1,email:!1,month:!1,number:!1,range:!1,search:!1,tel:!1,text:!1,time:!1,url:!1,week:!1,textarea:!1,select:!1,password:!0}};return{feature_flags:[],proxy:{assets:void 0,beacon:void 0},privacy:{cookies_enabled:!0},ajax:{deny_list:void 0,block_internal:!0,enabled:!0,harvestTimeSeconds:10,autoStart:!0},distributed_tracing:{enabled:void 0,exclude_newrelic_header:void 0,cors_use_newrelic_header:void 0,cors_use_tracecontext_headers:void 0,allowed_origins:void 0},session:{expiresMs:Ne,inactiveMs:Oe},ssl:void 0,obfuscate:void 0,jserrors:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},metrics:{enabled:!0,autoStart:!0},page_action:{enabled:!0,harvestTimeSeconds:30,autoStart:!0},page_view_event:{enabled:!0,autoStart:!0},page_view_timing:{enabled:!0,harvestTimeSeconds:30,long_task:!1,autoStart:!0},session_trace:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},harvest:{tooManyRequestsDelay:60},session_replay:{autoStart:!0,enabled:!1,harvestTimeSeconds:60,preload:!1,sampling_rate:10,error_sampling_rate:100,collect_fonts:!1,inline_images:!1,inline_stylesheet:!0,mask_all_inputs:!0,get mask_text_selector(){return e.mask_selector},set mask_text_selector(t){_e(t)?e.mask_selector="".concat(t,",").concat(Fe):""===t||null===t?e.mask_selector=Fe:Ee("An invalid session_replay.mask_selector was provided. '*' will be used.",t)},get block_class(){return"nr-block"},get ignore_class(){return"nr-ignore"},get mask_text_class(){return"nr-mask"},get block_selector(){return e.block_selector},set block_selector(t){_e(t)?e.block_selector+=",".concat(t):""!==t&&Ee("An invalid session_replay.block_selector was provided and will not be used",t)},get mask_input_options(){return e.mask_input_options},set mask_input_options(t){t&&"object"==typeof t?e.mask_input_options={...t,password:!0}:Ee("An invalid session_replay.mask_input_option was provided and will not be used",t)}},spa:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},soft_navigations:{enabled:!0,harvestTimeSeconds:10,autoStart:!0}}},He={},je="All configuration objects require an agent identifier!";function Be(e){if(!e)throw new Error(je);if(!He[e])throw new Error("Configuration for ".concat(e," was never set"));return He[e]}function Ve(e,t){if(!e)throw new Error(je);var n=Be(e);if(n){for(var i=t.split("."),r=0;r<i.length-1;r++)if("object"!=typeof(n=n[i[r]]))return;n=n[i[i.length-1]]}return n}const ze={accountID:void 0,trustKey:void 0,agentID:void 0,licenseKey:void 0,applicationID:void 0,xpid:void 0},We={};function qe(e){if(!e)throw new Error("All loader-config objects require an agent identifier!");if(!We[e])throw new Error("LoaderConfig for ".concat(e," was never set"));return We[e]}const Ge=me().o,Ke="1.260.0",Ye={buildEnv:"NPM",distMethod:"NPM",version:Ke,originTime:de},$e={customTransaction:void 0,disabled:!1,isolatedBacklog:!1,loaderType:void 0,maxBytes:3e4,onerror:void 0,origin:""+ie.location,ptid:void 0,releaseIds:{},appMetadata:{},session:void 0,denyList:void 0,harvestCount:0,timeKeeper:void 0},Ze={};function Je(e){if(!e)throw new Error("All runtime objects require an agent identifier!");if(!Ze[e])throw new Error("Runtime for ".concat(e," was never set"));return Ze[e]}function Xe(e){return function(e){try{const t=Ce(e);return!!t.licenseKey&&!!t.errorBeacon&&!!t.applicationID}catch(e){return!1}}(e)}class Qe{constructor(e){this.contextId=e}}function et(e,t){return e?15&e[t]:16*Math.random()|0}function tt(){const e=ie?.crypto||ie?.msCrypto;let t,n=0;return e&&e.getRandomValues&&(t=e.getRandomValues(new Uint8Array(30))),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("").map((e=>"x"===e?et(t,n++).toString(16):"y"===e?(3&et()|8).toString(16):e)).join("")}function nt(e){const t=ie?.crypto||ie?.msCrypto;let n,i=0;t&&t.getRandomValues&&(n=t.getRandomValues(new Uint8Array(e)));const r=[];for(var o=0;o<e;o++)r.push(et(n,i++).toString(16));return r.join("")}
9
+ /**
10
+ * @file Contains a unique identifier for the running agent bundle
11
+ * when loaded.
12
+ * @copyright 2023 New Relic Corporation. All rights reserved.
13
+ * @license Apache-2.0
14
+ */const it=tt(),rt="nr@context:".concat(it),ot=function e(t,n){var i={},r={},o={},s=!1;try{s=16===n.length&&Je(n).isolatedBacklog}catch(e){}var a={on:l,addEventListener:l,removeEventListener:function(e,t){var n=i[e];if(!n)return;for(var r=0;r<n.length;r++)n[r]===t&&n.splice(r,1)},emit:function(e,n,i,o,s){!1!==s&&(s=!0);if(ot.aborted&&!o)return;t&&s&&t.emit(e,n,i);for(var l=c(i),d=u(e),p=d.length,f=0;f<p;f++)d[f].apply(l,n);var m=h()[r[e]];m&&m.push([a,e,n,l]);return l},get:d,listeners:u,context:c,buffer:function(e,t){const n=h();if(t=t||"feature",a.aborted)return;Object.entries(e||{}).forEach((e=>{let[i,o]=e;r[o]=t,t in n||(n[t]=[])}))},abort:function(){a._aborted=!0,Object.keys(a.backlog).forEach((e=>{delete a.backlog[e]}))},isBuffering:function(e){return!!h()[r[e]]},debugId:n,backlog:s?{}:t&&"object"==typeof t.backlog?t.backlog:{},isolatedBacklog:s};return Object.defineProperty(a,"aborted",{get:()=>{let e=a._aborted||!1;return e||(t&&(e=t.aborted),e)}}),a;function c(e){return e&&e instanceof Qe?e:e?be(e,rt,(()=>new Qe(rt))):new Qe(rt)}function l(e,t){i[e]=u(e).concat(t)}function u(e){return i[e]||[]}function d(t){return o[t]=o[t]||e(a,t)}function h(){return a.backlog}}(void 0,"globalEE"),st=fe();st.ee||(st.ee=ot);var at=ot.get("handle");function ct(e,t,n,i,r){r?(r.buffer([e],i),r.emit(e,t,n)):(at.buffer([e],i),at.emit(e,t,n))}const lt=(e,t)=>Object.entries(e||{}).map((e=>{let[n,i]=e;return t(n,i)}));dt.on=ht;var ut=dt.handlers={};function dt(e,t,n,i){ht(i||at,ut,e,t,n)}function ht(e,t,n,i,r){r||(r="feature"),e||(e=at);var o=t[r]=t[r]||{};(o[n]=o[n]||[]).push([e,i])}const pt={ajax:"ajax",jserrors:"jserrors",metrics:"metrics",pageAction:"page_action",pageViewEvent:"page_view_event",pageViewTiming:"page_view_timing",sessionReplay:"session_replay",sessionTrace:"session_trace",softNav:"soft_navigations",spa:"spa"},ft={[pt.pageViewEvent]:1,[pt.pageViewTiming]:2,[pt.metrics]:3,[pt.jserrors]:4,[pt.ajax]:5,[pt.sessionTrace]:6,[pt.pageAction]:7,[pt.spa]:8,[pt.softNav]:9,[pt.sessionReplay]:10},mt={};function vt(e,t){const n={staged:!1,priority:ft[t]||0};yt(e),mt[e].get(t)||mt[e].set(t,n)}function gt(e,t){yt(e),mt[e].get(t)&&mt[e].delete(t),mt[e].size&&Et(e)}function yt(e){if(!e)throw new Error("agentIdentifier required");mt[e]||(mt[e]=new Map)}function bt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"feature",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(yt(e),!e||!mt[e].get(t)||n)return wt(e,t);mt[e].get(t).staged=!0,Et(e)}function Et(e){const t=Array.from(mt[e]);t.every((e=>{let[t,n]=e;return n.staged}))&&(t.sort(((e,t)=>e[1].priority-t[1].priority)),t.forEach((t=>{let[n]=t;mt[e].delete(n),wt(e,n)})))}function wt(e,t){const n=e?ot.get(e):ot,i=dt.handlers;if(n.backlog&&i){var r=n.backlog[t],o=i[t];if(o){for(var s=0;r&&s<r.length;++s)kt(r[s],o);lt(o,(function(e,t){lt(t,(function(t,n){n[0].on(e,n[1])}))}))}n.isolatedBacklog||delete i[t],n.backlog[t]=null,n.emit("drain-"+t,[])}}function kt(e,t){var n=e[1];lt(t[n],(function(t,n){var i=e[0];if(n[0]===i){var r=n[1],o=e[3],s=e[2];r.apply(o,s)}}))}class St{constructor(e,t,n){this.agentIdentifier=e,this.aggregator=t,this.ee=ot.get(e),this.featureName=n,this.blocked=!1}}let Ct=!1,Tt=!1;try{const e={get passive(){return Ct=!0,!1},get signal(){return Tt=!0,!1}};ie.addEventListener("test",null,e),ie.removeEventListener("test",null,e)}catch(e){}function _t(e,t){return Ct||Tt?{capture:!!e,passive:Ct,signal:t}:!!e}function Nt(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;window.addEventListener(e,t,_t(n,i))}function Ot(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;document.addEventListener(e,t,_t(n,i))}function It(){return"undefined"==typeof document||"complete"===document.readyState}function Rt(e,t){if(It())return e();Nt("load",e,t)}const At=e=>te&&!0===Ve(e,"privacy.cookies_enabled");function xt(e,t){return!!function(e){return!!Ge.MO&&At(e)&&!0===Ve(e,"session_trace.enabled")}(e)&&(!!t?.isNew||!!t?.state.sessionReplayMode)}function Mt(e,t){const n=t.correctAbsoluteTimestamp(e);return{originalTimestamp:e,correctedTimestamp:n,timestampDiff:e-n,originTime:de,correctedOriginTime:t.correctedOriginTime,originTimeDiff:Math.floor(de-t.correctedOriginTime)}}function Lt(e){var t=this;let n=!1;return function(){if(!n){n=!0;for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];e.apply(t,r)}}}class Pt extends St{constructor(e,t,n){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];super(e,t,n),this.auto=i,this.abortHandler=void 0,this.featAggregate=void 0,this.onAggregateImported=void 0,!1===Ve(this.agentIdentifier,"".concat(this.featureName,".autoStart"))&&(this.auto=!1),this.auto?vt(e,n):this.ee.on("manual-start-all",Lt((()=>{vt(this.agentIdentifier,this.featureName),this.auto=!0,this.importAggregator()})))}importAggregator(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.featAggregate||!this.auto)return;this.onAggregateImported=new Promise((t=>{e=t}));const n=async()=>{let n;try{if(At(this.agentIdentifier)){const{setupAgentSession:e}=await Promise.resolve().then((function(){return jo}));n=e(this.agentIdentifier)}}catch(e){Ee("A problem occurred when starting up session manager. This page will not start or extend any session.",e),this.featureName===pt.sessionReplay&&this.abortHandler?.()}try{if(!this.#e(this.featureName,n))return bt(this.agentIdentifier,this.featureName),void e(!1);const{lazyFeatureLoader:i}=await Promise.resolve().then((function(){return Bo})),{Aggregate:r}=await i(this.featureName,"aggregate");this.featAggregate=new r(this.agentIdentifier,this.aggregator,t),e(!0)}catch(t){Ee("Downloading and initializing ".concat(this.featureName," failed..."),t),this.abortHandler?.(),bt(this.agentIdentifier,this.featureName,!0),e(!1),this.ee&&this.ee.abort()}};te?Rt((()=>n()),!0):n()}#e(e,t){return e!==pt.sessionReplay||xt(this.agentIdentifier,t)}}const Dt=pt.jserrors,Ft=pt.sessionReplay,Ut={RECORD:"recordReplay",PAUSE:"pauseReplay",REPLAY_RUNNING:"replayRunning",ERROR_DURING_REPLAY:"errorDuringReplay"},Ht=2,jt=4,Bt={[De.ERROR]:15e3,[De.FULL]:3e5,[De.OFF]:0},Vt={message:"Session was reset",sm:"Reset"},zt={message:"Recorder failed to import",sm:"Import"},Wt={message:"429: Too Many Requests",sm:"Too-Many"},qt={message:"Payload was too large",sm:"Too-Big"},Gt={message:"Session Entity was set to OFF on another tab",sm:"Cross-Tab"},Kt={message:"Session Replay is not allowed and will not be started",sm:"Entitlement"},Yt="api",$t=()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}};function Zt(e){try{return JSON.stringify(e,$t())}catch(e){try{ot.emit("internal-error",[e])}catch(e){}}}class Jt{constructor(e,t,n,i,r){this.name="UncaughtError",this.message="string"==typeof e?e:Zt(e),this.sourceURL=t,this.line=n,this.column=i,this.__newrelic=r}}function Xt(e){return tn(e)?e:new Jt(void 0!==e?.message?e.message:e,e?.filename||e?.sourceURL,e?.lineno||e?.line,e?.colno||e?.col,e?.__newrelic)}function Qt(e){let t="Unhandled Promise Rejection";if(tn(e?.reason))try{return e.reason.message=t+": "+e.reason.message,Xt(e.reason)}catch(t){return Xt(e.reason)}if(void 0===e.reason)return Xt(t);const n=Xt(e.reason);return n.message=t+": "+n?.message,n}function en(e){if(e.error instanceof SyntaxError&&!/:\d+$/.test(e.error.stack?.trim())){const t=new Jt(e.message,e.filename,e.lineno,e.colno,e.error.__newrelic);return t.name=SyntaxError.name,t}return tn(e.error)?e.error:Xt(e)}function tn(e){return e instanceof Error&&!!e.stack}let nn=class extends Pt{static featureName=Dt;#t=!1;constructor(e,t){super(e,t,Dt,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);try{this.removeOnAbort=new AbortController}catch(e){}this.ee.on("internal-error",(e=>{this.abortHandler&&ct("ierr",[Xt(e),he(),!0,{},this.#t],void 0,this.featureName,this.ee)})),this.ee.on(Ut.REPLAY_RUNNING,(e=>{this.#t=e})),ie.addEventListener("unhandledrejection",(e=>{this.abortHandler&&ct("err",[Qt(e),he(),!1,{unhandledPromiseRejection:1},this.#t],void 0,this.featureName,this.ee)}),_t(!1,this.removeOnAbort?.signal)),ie.addEventListener("error",(e=>{this.abortHandler&&ct("err",[en(e),he(),!1,{},this.#t],void 0,this.featureName,this.ee)}),_t(!1,this.removeOnAbort?.signal)),this.abortHandler=this.#n,this.importAggregator()}#n(){this.removeOnAbort?.abort(),this.abortHandler=void 0}};const rn=pt.pageViewEvent;let on=class extends Pt{static featureName=rn;constructor(e,t){super(e,t,rn,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]),this.importAggregator()}};const sn=Object.values(pt);function an(e){const t={};return sn.forEach((n=>{t[n]=function(e,t){return!0===Ve(t,"".concat(e,".enabled"))}(n,e)})),t}const cn=pt.metrics,ln="storeSupportabilityMetrics",un="storeEventMetrics",dn=["setErrorHandler","finished","addToTrace","addRelease","addPageAction","setCurrentRouteName","setPageViewName","setCustomAttribute","interaction","noticeError","setUserId","setApplicationVersion","start",Ut.RECORD,Ut.PAUSE],hn=["setErrorHandler","finished","addToTrace","addRelease"];function pn(){const e=ge();dn.forEach((t=>{e[t]=function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];let o=[];return Object.values(e.initializedAgents).forEach((e=>{e.exposed&&e.api[t]&&o.push(e.api[t](...i))})),o.length>1?o:o[0]}(t,...i)}}))}const fn={};const mn="newrelic";const vn=new Set,gn={};function yn(e,t){const n=ot.get(t);gn[t]??={},e&&"object"==typeof e&&(vn.has(t)||(n.emit("rumresp",[e]),gn[t]=e,vn.add(t),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{ie.dispatchEvent(new CustomEvent(mn,{detail:e}))}catch(e){}}({loaded:!0})))}let bn=!1;function En(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,{init:r,info:o,loader_config:s,runtime:a={loaderType:n},exposed:c=!0}=t;const l=ge();o||(r=l.init,o=l.info,s=l.loader_config),function(e,t){if(!e)throw new Error(je);He[e]=we(t,Ue());const n=ve(e);n&&(n.init=He[e])}(e.agentIdentifier,r||{}),function(e,t){if(!e)throw new Error("All loader-config objects require an agent identifier!");We[e]=we(t,ze);const n=ve(e);n&&(n.loader_config=We[e])}(e.agentIdentifier,s||{}),o.jsAttributes??={},ne&&(o.jsAttributes.isWorker=!0),Te(e.agentIdentifier,o);const u=Be(e.agentIdentifier),d=[o.beacon,o.errorBeacon];var h,p;bn||(u.proxy.assets&&(u.proxy.assets,d.push(u.proxy.assets)),u.proxy.beacon&&d.push(u.proxy.beacon),pn(),h="activatedFeatures",p=gn,fe()[h]=p,e.runSoftNavOverSpa&&=!0===u.soft_navigations.enabled&&u.feature_flags.includes("soft_nav")),a.denyList=[...u.ajax.deny_list||[],...u.ajax.block_internal?d:[]],a.ptid=e.agentIdentifier,function(e,t){if(!e)throw new Error("All runtime objects require an agent identifier!");Ze[e]={...we(t,$e),...Ye};const n=ve(e);n&&(n.runtime=Ze[e])}(e.agentIdentifier,a),void 0===e.api&&(e.api=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||vt(e,"api");const i={};var r=ot.get(e),o=r.get("tracer");fn[e]=De.OFF,r.on(Ut.REPLAY_RUNNING,(t=>{fn[e]=t}));var s="api-",a=s+"ixn-";function c(t,n,i,r){const o=Ce(e);return null===n?delete o.jsAttributes[t]:Te(e,{...o,jsAttributes:{...o.jsAttributes,[t]:n}}),d(s,i,!0,r||null===n?"session":void 0)(t,n)}function l(){}hn.forEach((e=>{i[e]=d(s,e,!0,"api")})),i.addPageAction=d(s,"addPageAction",!0,pt.pageAction),i.setPageViewName=function(t,n){if("string"==typeof t)return"/"!==t.charAt(0)&&(t="/"+t),Je(e).customTransaction=(n||"http://custom.transaction")+t,d(s,"setPageViewName",!0)()},i.setCustomAttribute=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof e){if(["string","number","boolean"].includes(typeof t)||null===t)return c(e,t,"setCustomAttribute",n);Ee("Failed to execute setCustomAttribute.\nNon-null value must be a string, number or boolean type, but a type of <".concat(typeof t,"> was provided."))}else Ee("Failed to execute setCustomAttribute.\nName must be a string type, but a type of <".concat(typeof e,"> was provided."))},i.setUserId=function(e){if("string"==typeof e||null===e)return c("enduser.id",e,"setUserId",!0);Ee("Failed to execute setUserId.\nNon-null value must be a string type, but a type of <".concat(typeof e,"> was provided."))},i.setApplicationVersion=function(e){if("string"==typeof e||null===e)return c("application.version",e,"setApplicationVersion",!1);Ee("Failed to execute setApplicationVersion. Expected <String | null>, but got <".concat(typeof e,">."))},i.start=()=>{try{ct(ln,["API/start/called"],void 0,pt.metrics,r),r.emit("manual-start-all")}catch(e){Ee("An unexpected issue occurred",e)}},i[Ut.RECORD]=function(){ct(ln,["API/recordReplay/called"],void 0,pt.metrics,r),ct(Ut.RECORD,[],void 0,pt.sessionReplay,r)},i[Ut.PAUSE]=function(){ct(ln,["API/pauseReplay/called"],void 0,pt.metrics,r),ct(Ut.PAUSE,[],void 0,pt.sessionReplay,r)},i.interaction=function(e){return(new l).get("object"==typeof e?e:{})};const u=l.prototype={createTracer:function(e,t){var i={},s=this,c="function"==typeof t;return ct(ln,["API/createTracer/called"],void 0,pt.metrics,r),n||ct(a+"tracer",[he(),e,i],s,pt.spa,r),function(){if(o.emit((c?"":"no-")+"fn-start",[he(),s,c],i),c)try{return t.apply(this,arguments)}catch(e){const t="string"==typeof e?new Error(e):e;throw o.emit("fn-err",[arguments,this,t],i),t}finally{o.emit("fn-end",[he()],i)}}}};function d(e,t,n,i){return function(){return ct(ln,["API/"+t+"/called"],void 0,pt.metrics,r),i&&ct(e+t,[he(),...arguments],n?null:this,i,r),n?void 0:this}}function h(){Promise.resolve().then((function(){return Vo})).then((t=>{let{setAPI:n}=t;n(e),bt(e,"api")})).catch((e=>{Ee("Downloading runtime APIs failed...",e),r.abort()}))}return["actionText","setName","setAttribute","save","ignore","onEnd","getContext","end","get"].forEach((e=>{u[e]=d(a,e,void 0,n?pt.softNav:pt.spa)})),i.setCurrentRouteName=n?d(a,"routeName",void 0,pt.softNav):d(s,"routeName",!0,pt.spa),i.noticeError=function(t,n){"string"==typeof t&&(t=new Error(t)),ct(ln,["API/noticeError/called"],void 0,pt.metrics,r),ct("err",[t,he(),!1,n,!!fn[e]],void 0,pt.jserrors,r)},te?Rt((()=>h()),!0):h(),i}(e.agentIdentifier,i,e.runSoftNavOverSpa)),void 0===e.exposed&&(e.exposed=c),bn=!0}const wn={agentIdentifier:"",ee:void 0};class kn{constructor(e){try{if("object"!=typeof e)return Ee("shared context requires an object as input");this.sharedContext={},Object.assign(this.sharedContext,wn),Object.entries(e).forEach((e=>{let[t,n]=e;Object.keys(wn).includes(t)&&(this.sharedContext[t]=n)}))}catch(e){Ee("An error occurred while setting SharedContext",e)}}}class Sn extends kn{constructor(e){super(e),this.aggregatedData={}}store(e,t,n,i,r){var o=this.getBucket(e,t,n,r);return o.metrics=function(e,t){t||(t={count:0});return t.count+=1,lt(e,(function(e,n){t[e]=Cn(n,t[e])})),t}(i,o.metrics),o}merge(e,t,n,i,r){var o=this.getBucket(e,t,i,r);if(o.metrics){var s=o.metrics;s.count+=n.count,lt(n,(function(e,t){if("count"!==e){var i=s[e],r=n[e];r&&!r.c?s[e]=Cn(r.t,i):s[e]=function(e,t){if(!t)return e;t.c||(t=Tn(t.t));return t.min=Math.min(e.min,t.min),t.max=Math.max(e.max,t.max),t.t+=e.t,t.sos+=e.sos,t.c+=e.c,t}(r,s[e])}}))}else o.metrics=n}storeMetric(e,t,n,i){var r=this.getBucket(e,t,n);return r.stats=Cn(i,r.stats),r}getBucket(e,t,n,i){this.aggregatedData[e]||(this.aggregatedData[e]={});var r=this.aggregatedData[e][t];return r||(r=this.aggregatedData[e][t]={params:n||{}},i&&(r.custom=i)),r}get(e,t){return t?this.aggregatedData[e]&&this.aggregatedData[e][t]:this.aggregatedData[e]}take(e){for(var t={},n="",i=!1,r=0;r<e.length;r++)t[n=e[r]]=Object.values(this.aggregatedData[n]||{}),t[n].length&&(i=!0),delete this.aggregatedData[n];return i?t:null}}function Cn(e,t){return null==e?function(e){e?e.c++:e={c:1};return e}(t):t?(t.c||(t=Tn(t.t)),t.c+=1,t.t+=e,t.sos+=e*e,e>t.max&&(t.max=e),e<t.min&&(t.min=e),t):{t:e}}function Tn(e){return{t:e,min:e,max:e,sos:e*e,c:1}}class _n{agentIdentifier;constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt(16);this.agentIdentifier=e,this.ee=ot.get(e)}#i(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if("function"==typeof this.api?.[e])return this.api[e](...n);Ee("Call to agent api ".concat(e," failed. The API is not currently initialized."))}addPageAction(e,t){return this.#i("addPageAction",e,t)}setPageViewName(e,t){return this.#i("setPageViewName",e,t)}setCustomAttribute(e,t,n){return this.#i("setCustomAttribute",e,t,n)}noticeError(e,t){return this.#i("noticeError",e,t)}setUserId(e){return this.#i("setUserId",e)}setApplicationVersion(e){return this.#i("setApplicationVersion",e)}setErrorHandler(e){return this.#i("setErrorHandler",e)}finished(e){return this.#i("finished",e)}addRelease(e,t){return this.#i("addRelease",e,t)}start(e){return this.#i("start",e)}recordReplay(){return this.#i(Ut.RECORD)}pauseReplay(){return this.#i(Ut.PAUSE)}addToTrace(e){return this.#i("addToTrace",e)}setCurrentRouteName(e){return this.#i("setCurrentRouteName",e)}interaction(){return this.#i("interaction")}}const Nn=[pt.jserrors,pt.pageAction,pt.metrics];class On extends _n{constructor(e,t){super(t),this.sharedAggregator=new Sn({agentIdentifier:this.agentIdentifier}),this.features={},function(e,t){let n=fe();n.initializedAgents??={},t.initializedAt={ms:he(),date:new Date},n.initializedAgents[e]=t}(this.agentIdentifier,this),En(this,{...e,runtime:{isolatedBacklog:!0}},e.loaderType||"micro-agent"),Object.assign(this,this.api),this.start=e=>this.run(e),this.run(Nn.filter((e=>Ve(this.agentIdentifier,"".concat(e,".autoStart")))))}get config(){return{info:Ce(this.agentIdentifier),init:Be(this.agentIdentifier),loader_config:qe(this.agentIdentifier),runtime:Je(this.agentIdentifier)}}run(e){try{const t=Nn;if(void 0===e)e=t;else{if((e=Array.isArray(e)&&e.length?e:[e]).some((e=>!t.includes(e))))return Ee("Invalid feature name supplied. Acceptable feature names are: ".concat(t));e.includes(pt.pageViewEvent)||e.push(pt.pageViewEvent)}}catch(e){Ee("An unexpected issue occurred",e)}try{const t=an(this.agentIdentifier);try{this.features.page_view_event=new on(this.agentIdentifier,this.sharedAggregator)}catch(e){Ee("Something prevented the agent from instrumenting.",e)}return Rt((()=>{Nn.forEach((n=>{t[n]&&e.includes(n)&&Promise.resolve().then((function(){return Bo})).then((e=>{let{lazyFeatureLoader:t}=e;return t(n,"aggregate")})).then((e=>{let{Aggregate:t}=e;this.features[n]=new t(this.agentIdentifier,this.sharedAggregator)})).catch((e=>Ee("Something prevented the agent from being downloaded.",e)))}))})),!0}catch(e){return Ee("Failed to initialize instrument classes.",e),!1}}}const In=pt.pageAction;class Rn extends Pt{static featureName=In;constructor(e,t){super(e,t,In,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]),this.importAggregator()}}function An(){var e,t,n=(e="bam.nr-data.net",t={enabled:"true",accountId:"974691",agentId:"1386157150",applicationId:"1386157150",licenseKey:"4848a32285",trustKey:"974691"},{browserAgent:{available:Object.values(t).every(Boolean),options:{info:{applicationID:t.applicationId,licenseKey:t.licenseKey,beacon:e,errorBeacon:e,sa:1},init:{distributed_tracing:{autoStart:!1,enabled:!1},jserrors:{autoStart:!0,enabled:!0},metrics:{autoStart:!1,enabled:!1},page_action:{autoStart:!0,enabled:!0},page_view_event:{autoStart:!0,enabled:!0},page_view_timing:{autoStart:!1,enabled:!1},session_replay:{autoStart:!1,enabled:!1},session_trace:{autoStart:!1,enabled:!1},spa:{autoStart:!1,enabled:!1},ajax:u(u({},{autoStart:!1,enabled:!1}),{deny_list:[e,"undefined"==typeof window?void 0:window.location.host].filter(Boolean)}),privacy:{cookies_enabled:!1}},loaderConfig:{accountID:t.accountId,agentID:t.agentId,applicationID:t.applicationId,licenseKey:t.licenseKey,trustKey:t.trustKey}}}}).browserAgent;return{available:n.available,options:n.options}}var xn=function(e){function n(e){var i;return s(this,n),(i=t(this,n,[e])).call=function(e){if(i.isAvailable()){for(var t,r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];(t=n.agent)[e].apply(t,o)}},i}return d(n,e),c(n,[{key:"isAvailable",value:function(){return n.available}}],[{key:"instance",get:function(){if(!n.initialized){var e=An(),t=e.available,i=e.options;n.available=t,t&&(n.agent=new n(i),n.agent.start([nn.featureName,Rn.featureName,on.featureName])),n.initialized=!0}return n.agent}}])}(On),Mn=function(){return c((function e(){s(this,e),this.agent=xn.instance}),[{key:"createAction",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ee(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).addPageAction.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}();new Mn;var Ln,Pn=function(){return c((function e(){s(this,e),this.agent=xn.instance}),[{key:"createError",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ee(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).noticeError.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}(),Dn=new Pn,Fn=function(){return c((function e(){s(this,e),this.agent=xn.instance}),[{key:"createEvent",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ee(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).addPageAction.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}();new Fn,function(e){e[e.PUBLIC_KEY=0]="PUBLIC_KEY",e[e.TOKEN=1]="TOKEN"}(Ln||(Ln={}));var Un,Hn,jn,Bn=function(){function e(t,n){s(this,e),this.reportEvent=function(e,t){e.createEvent(t)},this.reportError=function(e,t,n){e.createError(t,n)},this.auth=t,this.authType=n||this.setAuthType(),this.env=new Y(z)}return c(e,[{key:"setEnv",value:function(e,t){return this.env.setEnv(e,t),this}},{key:"setAuthType",value:function(){return this.authType=X.validateJWT(this.auth)?Ln.TOKEN:Ln.PUBLIC_KEY,this.authType}},{key:"getClient",value:function(e,t){var n=this,i=this.newApiRequest(e,t);return{config:i,send:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};i.onload=function(){return n.parser({text:i.responseText,status:i.status},t,(function(e){n.reportError(Dn,e,u(u({},n.ctx),{classMethod:"getClient",description:"Send unsuccessful."})),r(e)}))},i.send(JSON.stringify(e))}}}},{key:"getClientPromise",value:function(e,t){var n=this,i=this.newApiRequest(e,t);return{config:i,send:function(e){return new Promise((function(t,n){i.onload=function(){return t({text:i.responseText,status:i.status})},i.send(JSON.stringify(e))})).then((function(e){return n.parserPromise(e)})).catch((function(e){throw n.reportError(Dn,e,u(u({},n.ctx),{classMethod:"getClientPromise",description:"Send unsuccessful."})),e}))}}}},{key:"parser",value:function(e,t,n){var i=e.text,r=e.status;try{var o=JSON.parse(i);if(r>=200&&r<300||302===r)return t(o.resource.data);n(o.error||{message:"unknown error"})}catch(e){this.reportError(Dn,e,u(u({},this.ctx),{classMethod:"parser",description:"Unable to parse response body to json."}))}}},{key:"parserPromise",value:function(e){var t=e.text,n=e.status;try{var i=JSON.parse(t);return n>=200&&n<300||302===n?Promise.resolve(i.resource.data):Promise.reject(i.error||{message:"unknown error"})}catch(e){return this.reportError(Dn,e,u(u({},this.ctx),{classMethod:"parserPromise",description:"Unable to parse response body to json."})),Promise.reject(e)}}},{key:"newApiRequest",value:function(e,t){var n=Q.create(e,this.env.getConf().url+t).setContentTypeJson().setSdkVersion();switch(this.authType){case Ln.PUBLIC_KEY:n.setPublicKey(this.auth);break;case Ln.TOKEN:n.setAccessToken(this.auth)}return n.inner()}},{key:"ctx",get:function(){return{sdkVersion:$.version,className:e.name,environment:this.env.getEnv()}}}])}(),Vn=function(e){function n(e){var i;return s(this,n),(i=t(this,n,[e])).publicKey=i.auth,i}return d(n,e),c(n,[{key:"getBrowserDetails",value:function(){return{name:b.getBrowserName(),java_enabled:b.isJavaEnabled().toString(),language:b.getLanguage(),screen_height:b.getScreenHeight().toString(),screen_width:b.getScreenWidth().toString(),time_zone:b.getTimezoneOffset().toString(),color_depth:b.getColorDepth().toString()}}},{key:"charge",value:function(){return new w(this)}}])}(Bn),zn=function(){return c((function e(){s(this,e)}),null,[{key:"extendSearchParams",value:function(e,t,n){return e.replace(new RegExp("([?&]"+t+"(?=[=&#]|$)[^#&]*|(?=#|$))"),"&"+t+"="+encodeURIComponent(n)).replace(/^([^?&]+)&/,"$1?")}},{key:"serialize",value:function(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}}])}(),Wn=function(){return c((function e(){s(this,e)}),null,[{key:"generate",value:function(){if("undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.getRandomValues){var e=new Uint16Array(8);return window.crypto.getRandomValues(e),this.hash(e[0])+this.hash(e[1])+"-"+this.hash(e[2])+"-"+this.hash(e[3])+"-"+this.hash(e[4])+"-"+this.hash(e[5])+this.hash(e[6])+this.hash(e[7])}return this.random()+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+this.random()+this.random()}},{key:"hash",value:function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t}},{key:"random",value:function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}])}(),qn="/wallet/flypay",Gn="/images/logo.png",Kn=function(){return c((function e(t){s(this,e),this.params={},this.widgetId=Wn.generate(),this.linkResource=t,this.env=new Y(V),this.setParams({widget_id:this.widgetId})}),[{key:"getNetUrl",value:function(){return this.env.getConf().url+this.linkResource}},{key:"getUrl",value:function(){var e=this.getNetUrl(),t=this.getParams();for(var n in t)t.hasOwnProperty(n)&&(e=zn.extendSearchParams(e,n,t[n]));return e}},{key:"setParams",value:function(e){this.params=u({},this.params,e)}},{key:"concatParams",value:function(e){for(var t in e)e.hasOwnProperty(t)&&e[t].length&&("string"!=typeof this.params[t]&&(this.params[t]=""),this.params[t].length?this.params[t]+=","+e[t]:this.params[t]+=e[t])}},{key:"getParams",value:function(){return this.params}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getBaseUrl",value:function(){return this.env.getConf().url}}])}(),Yn=function(){return c((function e(){s(this,e)}),null,[{key:"insertToInput",value:function(e,t,n){if(void 0!==n[t]){var i=document.querySelector(e);i&&(i.value=n[t])}}},{key:"subscribe",value:function(e,t,n){t.addEventListener?t.addEventListener(e,n):t.attachEvent("on".concat(e),n)}}])}(),$n=function(){return c((function e(t){s(this,e),this.selector=t}),[{key:"isExist",value:function(){return!!this.getElement()}},{key:"getStyles",value:function(e){if(this.isExist()){var t=this.getElement().getAttribute("widget-style");if(!t)return{};var n=t.split(";");return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"on",value:function(e,t){this.isExist()&&Yn.subscribe(e,this.getElement(),t)}},{key:"getAttr",value:function(e){if(this.isExist()){var t=this.getElement(),n=[];for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].replace(/_/g,"-"),o=t.getAttribute(r);o&&n.push("".concat(e[i],":").concat(o))}return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"getSelector",value:function(){return this.selector}},{key:"convertConfigs",value:function(e,t){var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].split(":"),o=r[0].replace(/-/g,"_").trim();-1!==t.indexOf(o)&&(n[o]=r[1].trim())}return n}}])}(),Zn=function(){return c((function e(t){s(this,e),this.container=t}),[{key:"load",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("src",e),t.title&&(n.title=t.title),this.container.getElement().appendChild(n)}}},{key:"loadFromHtml",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("height","100%"),n.setAttribute("width","100%"),t.title&&(n.title=t.title);this.container.getElement().appendChild(n);var i=this.getElement().contentDocument;i.open(),i.write("<html><head><style>html, body {margin: 0;} iframe {border: 0; width: 100%}</style><title></title></head><body>{{content}}</body></html>".replace("{{content}}",e)),i.close()}}},{key:"remove",value:function(){if(this.container.isExist()&&this.isExist()){var e=this.getElement();this.container.getElement().removeChild(e)}}},{key:"show",value:function(){this.isExist()&&(this.setStyle("visibility","visible"),this.setStyle("display","block"))}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isExist()&&(e?this.setStyle("visibility","hidden"):this.setStyle("display","none"))}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"getElement",value:function(){return this.container.isExist()?this.container.getElement().querySelector("iframe"):null}},{key:"setStyle",value:function(e,t){this.getElement().style[e]=t}}])}(),Jn={AFTER_LOAD:"afterLoad",SUBMIT:"submit",FINISH:"finish",VALIDATION_ERROR:"validationError",SYSTEM_ERROR:"systemError",CHECKOUT_SUCCESS:"checkoutSuccess",CHECKOUT_READY:"checkoutReady",CHECKOUT_ERROR:"checkoutError",CHECKOUT_COMPLETED:"checkoutCompleted",CHECKOUT_POPUP_OPEN:"checkoutPopupOpen",CHECKOUT_POPUP_CLOSE:"checkoutPopupClose",VALIDATION:"validation",SELECT:"select",UNSELECT:"unselect",NEXT:"next",PREV:"prev",META_CHANGE:"metaChange",RESIZE:"resize",CHARGE_AUTH_SUCCESS:"chargeAuthSuccess",CHARGE_AUTH_REJECT:"chargeAuthReject",CHARGE_AUTH_CANCELLED:"chargeAuthCancelled",ADDITIONAL_DATA_SUCCESS:"additionalDataCollectSuccess",ADDITIONAL_DATA_REJECT:"additionalDataCollectReject",CHARGE_AUTH:"chargeAuth",DISPATCH_SUCCESS:"dispatchSuccess",DISPATCH_ERROR:"dispatchError"},Xn=function(){return c((function e(t){var n=this;s(this,e),this.listeners=[],t&&Yn.subscribe("message",t,(function(e){var t;try{t=JSON.parse(e.data)}catch(e){}t&&n.emit(t)}))}),[{key:"emit",value:function(e){for(var t in this.listeners)this.listeners[t].event===e.event&&e.widget_id===this.listeners[t].widget_id&&this.listeners[t].listener.apply(this,[e])}},{key:"on",value:function(e,t,n){for(var i in Jn)Jn.hasOwnProperty(i)&&e===Jn[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}},{key:"clear",value:function(){this.listeners=[]}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t)}}])}(),Qn={visibility:"hidden",border:"0",width:"0",height:"0"};!function(e){e.SUCCESS="success",e.ERROR="error",e.PENDING="pending"}(Un||(Un={})),function(e){e.SUCCESS="success",e.PENDING="pending",e.ERROR="error"}(Hn||(Hn={})),function(e){e.FINISHED="MethodFinished",e.SKIPPED="MethodSkipped",e.READY="ResultReady",e.TIMEOUT="AuthTimedOut",e.INVALID="invalid_event"}(jn||(jn={}));var ei,ti="chargeAuthSuccess",ni="chargeAuthReject",ii="chargeAuthDecoupled",ri="chargeAuthChallenge",oi="chargeAuthInfo",si="error",ai=function(){return c((function e(t,n,i){s(this,e),this.container=t,this.api=n,this.eventEmitter=i,this.resultRead=!1,this.iFrameEvent=new Xn(window)}),[{key:"load",value:function(e,t){var n=e.initialization_url,i=e.secondary_url,r=e.charge_3ds_id;try{this.setupIFrameEvents(r),this.initializeIFrames(n,i,t)}catch(e){this.eventEmitter.emit(si,this.parseError(e,r))}}},{key:"initializeIFrames",value:function(e,t,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this.container.getElement();if(r){var o=document.createElement("div");if(o.setAttribute("id","paydock_authorization_iframe"),r.appendChild(o),this.browserAndChallengeContainer=new $n("#paydock_authorization_iframe"),this.iFrameAuthorization=new Zn(this.browserAndChallengeContainer),this.iFrameAuthorization.load(e,{title:n}),t){var s=document.createElement("div");s.setAttribute("id","paydock_secondary_iframe"),r.appendChild(s),this.monitoringContainer=new $n("#paydock_secondary_iframe"),this.iFrameSecondaryUrl=new Zn(this.monitoringContainer),this.iFrameSecondaryUrl.load(t,{title:n})}else this.iFrameSecondaryUrl=void 0;this.hideIframes(i)}}},{key:"hideIframes",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(var n in Qn)Qn.hasOwnProperty(n)&&(t&&this.iFrameAuthorization.setStyle(n,Qn[n]),null===(e=this.iFrameSecondaryUrl)||void 0===e||e.setStyle(n,Qn[n]))}},{key:"setupIFrameEvents",value:function(e){var t=this;this.iFrameEvent.on(Jn.CHARGE_AUTH,e,(function(e){e.status===jn.SKIPPED||e.status===jn.FINISHED?(e.info&&t.eventEmitter.emit(oi,{info:e.info}),t.performAuthentication(e)):e.status!==jn.TIMEOUT&&e.status!==jn.INVALID||t.eventEmitter.emit(ni,t.parseHandleResponse({status:e.status},e.charge_3ds_id))})),this.iFrameEvent.on(Jn.CHARGE_AUTH_SUCCESS,e,(function(e){t.processResult(e.charge_3ds_id)}))}},{key:"parseResultData",value:function(e,t){return{status:e.status,charge_3ds_id:t}}},{key:"parseHandleResponse",value:function(e,t){var n=e.status,i=e.result;return{status:n,charge_3ds_id:t,result:{description:null==i?void 0:i.description}}}},{key:"parseError",value:function(e,t){return{charge_3ds_id:t,error:e}}},{key:"processResult",value:function(e){var t=this;this.resultRead||(this.resultRead=!0,this.api.charge().standalone3dsHandle().then((function(n){var i;t.iFrameAuthorization.remove(),null===(i=t.iFrameSecondaryUrl)||void 0===i||i.remove(),n.status===Un.SUCCESS?t.eventEmitter.emit(ti,t.parseResultData(n,e)):t.eventEmitter.emit(ni,t.parseResultData(n,e))}),(function(n){t.eventEmitter.emit(si,t.parseError(n,e))})))}},{key:"externalAPI",value:function(e,t){var n=Q.create(e,t).inner();return new Promise((function(e,t){n.onload=function(){try{var i=JSON.parse(n.responseText);e(i)}catch(e){t(e)}},n.send()}))}},{key:"doPolling",value:function(e,t){var n=this;this.externalAPI("GET",e).then((function(i){if(i.event&&"AuthResultNotReady"!==i.event){if("AuthResultReady"!==i.event)throw new Error("Event not supported");n.processResult(t)}else setTimeout((function(){n.doPolling(e,t)}),2e3)})).catch((function(e){return n.eventEmitter.emit(si,n.parseError(e,t))}))}},{key:"performAuthentication",value:function(e){var t,n=this,i=e.charge_3ds_id;this.iFrameAuthorization.remove(),null===(t=this.iFrameSecondaryUrl)||void 0===t||t.remove(),this.api.charge().standalone3dsProcess({charge_3ds_id:i}).then((function(e){var t,r;if(e.status===Hn.SUCCESS)n.eventEmitter.emit(ti,n.parseHandleResponse(e,i));else{if(e.status!==Hn.PENDING)return n.eventEmitter.emit(ni,n.parseHandleResponse(e,i));(null===(t=null==e?void 0:e.result)||void 0===t?void 0:t.challenge)?(n.eventEmitter.emit(ri,n.parseHandleResponse(e,i)),n.initializeIFrames(e.result.challenge_url,void 0,"Authentication Challenge",!1),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i)):(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.decoupled_challenge)&&(n.eventEmitter.emit(ii,n.parseHandleResponse(e,i)),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i))}}),(function(e){n.eventEmitter.emit(si,n.parseError(e,i))}))}}])}(),ci=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"walletCapture",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/capture").send(e)}},{key:"walletCallback",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/callback").send(e)}},{key:"standalone3dsProcess",value:function(e){return this.api.getClientPromise("POST","/v1/charges/standalone-3ds/process").send(e)}},{key:"standalone3dsHandle",value:function(){return this.api.getClientPromise("GET","/v1/charges/standalone-3ds/handle").send(void 0)}}])}(),li=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"getConfig",value:function(e){var t="/v1/services/:service_id/config".replace(":service_id",e);return this.api.getClientPromise("GET",t).send(void 0)}}])}();!function(e){e.VISA_SRC="VisaSRC",e.MASTERCARD_SRC="MastercardSRCClickToPay"}(ei||(ei={}));var ui,di=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"charge",value:function(){return new ci(this)}},{key:"service",value:function(){return new li(this)}}])}(Bn),hi="GPayments",pi=function(){return c((function e(t,n){s(this,e),this.env=q,this.container=t,this.eventEmitter=n}),[{key:"load",value:function(e,t){var n=X.validateJWT(e);if(!n)throw new Error("Invalid charge token");var i=X.extractData(n.body),r=new di(e,Ln.TOKEN);if(r.setEnv(this.env,this.alias),i.service_type===hi)new ai(this.container,r,this.eventEmitter).load(i,t.title)}},{key:"setEnv",value:function(e,t){this.env=e,this.alias=t}}])}(),fi=function(){return c((function e(){s(this,e),this.events={}}),[{key:"emit",value:function(e,t){var n=this.events[e];n&&n.forEach((function(e){e.call(null,t)}))}},{key:"subscribe",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter((function(e){return t!==e}))}}}])}();!function(e){e.HTML="html",e.URL="url",e.STANDALONE_3DS="standalone_3ds"}(ui||(ui={}));var mi,vi,gi=function(){return c((function e(t,n){s(this,e),this.configs=[],this.link=new Kn("/3ds/webhook"),this.token=e.extractToken(n),this.link.setParams({ref_id:this.token.charge_3ds_id}),this.container=new $n(t),this.iFrame=new Zn(this.container),this.eventEmitter=new fi,this.standalone3dsService=new pi(this.container,this.eventEmitter),this.event=new Xn(window)}),[{key:"load",value:function(){this.token.format===ui.HTML?this.iFrame.loadFromHtml(this.token.content,{title:"3d secure authentication"}):this.token.format===ui.URL?this.iFrame.load(this.token.content,{title:"3d secure authentication"}):this.token.format===ui.STANDALONE_3DS?this.standalone3dsService.load(this.token.content,{title:"3d secure authentication"}):console.error("Token contain unsupported payload")}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.standalone3dsService.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"on",value:function(e,t){var n=this;return this.token.format===ui.STANDALONE_3DS?"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))})):"function"==typeof t?this.event.on(e,this.link.getParams().ref_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().ref_id,(function(e){return t(e)}))}))}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}}],[{key:"extractToken",value:function(e){return JSON.parse(window.atob(e))}}])}(),yi={CLICK:"click",POPUP_REDIRECT:"popupRedirect",REDIRECT:"redirect",ERROR:"error",REFERRED:"referred",DECLINED:"declined",CANCELLED:"cancelled",ACCEPTED:"accepted",FINISH:"finish",CLOSE:"close"};!function(e){e.CONTEXTUAL="contextual",e.REDIRECT="redirect"}(mi||(mi={})),function(e){e.ZIPMONEY="Zipmoney",e.PAYPAL="PaypalClassic",e.AFTERPAY="Afterpay"}(vi||(vi={}));var bi,Ei,wi="[Paydock:CheckoutButton]",ki={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},Si={CARD_NAME:"card_name",CARD_NUMBER:"card_number",EXPIRE_MONTH:"expire_month",EXPIRE_YEAR:"expire_year",CARD_CCV:"card_ccv",CARD_PIN:"card_pin",ACCOUNT_NAME:"account_name",ACCOUNT_BSB:"account_bsb",ACCOUNT_NUMBER:"account_number",ACCOUNT_ROUTING:"account_routing",ACCOUNT_HOLDER_TYPE:"account_holder_type",ACCOUNT_BANK_NAME:"account_bank_name",ACCOUNT_TYPE:"account_type",FIRST_NAME:"first_name",LAST_NAME:"last_name",EMAIL:"email",PHONE:"phone",PHONE2:"phone2",ADDRESS_LINE1:"address_line1",ADDRESS_LINE2:"address_line2",ADDRESS_STATE:"address_state",ADDRESS_COUNTRY:"address_country",ADDRESS_CITY:"address_city",ADDRESS_POSTCODE:"address_postcode",ADDRESS_COMPANY:"address_company"},Ci={BACKGROUND_COLOR:"background_color",BACKGROUND_ACTIVE_COLOR:"background_active_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",ICON_SIZE:"icon_size",BUTTON_COLOR:"button_color",ERROR_COLOR:"error_color",SUCCESS_COLOR:"success_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},Ti={TITLE:"title",TITLE_H1:"title_h1",TITLE_H2:"title_h2",TITLE_H3:"title_h3",TITLE_H4:"title_h4",TITLE_H5:"title_h5",TITLE_H6:"title_h6",FINISH:"finish_text",TITLE_DESCRIPTION:"title_description",SUBMIT_BUTTON:"submit_button",SUBMIT_BUTTON_PROCESSING:"submit_button_processing"},_i={SUBMIT_BUTTON:"submit_button",TABS:"tabs"},Ni={AMEX:"amex",AUSBC:"ausbc",DINERS:"diners",DISCOVER:"discover",JAPCB:"japcb",LASER:"laser",MASTERCARD:"mastercard",SOLO:"solo",VISA:"visa",VISA_WHITE:"visa_white"},Oi=[].concat(["brand_name","cart_border_color","reference","email","hdr_img","logo_img","pay_flow_color","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone","hide_shipping_address"],["first_name","last_name","phone","tokenize","email","gender","date_of_birth","charge","statistics","hide_shipping_address"],["amount","currency","email","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone"],["customer_storage_number","tokenise_algorithm"]);!function(e){e.STRIPE="Stripe",e.FLYPAY="Flypay",e.FLYPAY_V2="FlypayV2",e.PAYPAL="Paypal",e.MASTERCARD="MasterCard",e.AFTERPAY="Afterpay"}(bi||(bi={})),function(e){e.GOOGLE="google",e.APPLE="apple",e.FLYPAY="flypay",e.FLYPAY_V2="flypayV2",e.PAYPAL="paypal",e.AFTERPAY="afterpay"}(Ei||(Ei={}));var Ii,Ri=function(){return c((function e(){s(this,e),this.env=new Y(z)}),[{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getUrl",value:function(){return this.env.getConf().url+this.getLink()}},{key:"create",value:function(e,t,n,i){var r=this,o=Q.create("POST",this.getUrl()).setHeader(X.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();o.onload=function(){r.parser(o.responseText,o.status,n,i)},o.send(JSON.stringify(t))}},{key:"get",value:function(e,t,n){var i=this,r=Q.create("GET",this.getUrl()).setHeader(X.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();r.onload=function(){i.parser(r.responseText,r.status,t,n)},r.send()}},{key:"parser",value:function(e,t,n,i){var r={};try{r=JSON.parse(e)}catch(e){}return t>=200&&t<300||302===t?n(r.resource.data,t):i(r.error||{message:"unknown error"},t)}}])}(),Ai=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n)).body={gateway_id:e,meta:{},success_redirect_url:i,error_redirect_url:r,redirect_url:i},o}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout"}},{key:"setDescriptions",value:function(e){this.body.description=e}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Oi.indexOf(t)?this.body.meta[t]=e[t]:console.warn("ExternalCheckout::setMeta: unsupported meta key ".concat(t)))}},{key:"getConfigs",value:function(){return this.body}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e,t){};this.create(e,this.getConfigs(),(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error"),"unknown_error"):n(e.message,e.code)}))}}])}(Ri),xi=function(e){function n(e){var i;return s(this,n),(i=t(this,n)).token=e,i}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout/:token".replace(":token",this.token)}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.get(e,(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error")):n(e.message)}))}}])}(Ri),Mi='\n <div class="cs-loader">\n <div class="cs-loader-inner">\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n </div>\n </div>\n',Li="\n <style> \n .cs-loader {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n }\n \n .cs-loader-inner {\n transform: translateY(-50%);\n top: 50%;\n position: absolute;\n width: calc(100% - 200px);\n color: #8e8d8c;\n padding: 0 100px;\n text-align: center;\n }\n \n \n .cs-loader-inner label {\n font-size: 20px;\n opacity: 0;\n display:inline-block;\n }\n \n @keyframes lol {\n 0% {\n opacity: 0;\n transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n transform: translateX(300px);\n }\n }\n \n @-webkit-keyframes lol {\n 0% {\n opacity: 0;\n -webkit-transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n -webkit-transform: translateX(300px);\n -moz-transform: translateX(300px);\n }\n }\n \n .cs-loader-inner label:nth-child(6) {\n -webkit-animation: lol 3s infinite ease-in-out;\n -moz-animation: lol 3s infinite ease-in-out;\n animation: lol 3s infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(5) {\n -webkit-animation: lol 3s 100ms infinite ease-in-out;\n -moz-animation: lol 3s 100ms infinite ease-in-out;\n animation: lol 3s 100ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(4) {\n -webkit-animation: lol 3s 200ms infinite ease-in-out;\n -moz-animation: lol 3s 200ms infinite ease-in-out;\n animation: lol 3s 200ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(3) {\n -webkit-animation: lol 3s 300ms infinite ease-in-out;\n -moz-animation: lol 3s 300ms infinite ease-in-out;\n animation: lol 3s 300ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(2) {\n -webkit-animation: lol 3s 400ms infinite ease-in-out;\n -moz-animation: lol 3s 400ms infinite ease-in-out;\n animation: lol 3s 400ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(1) {\n -webkit-animation: lol 3s 500ms infinite ease-in-out;\n -moz-animation: lol 3s 500ms infinite ease-in-out;\n animation: lol 3s 500ms infinite ease-in-out;\n }\n </style>\n",Pi="close",Di="focus",Fi=function(){return c((function e(){s(this,e),this.description="Don't see the secure checkout browser? We'll help you re-launch the window to complete your purchase",this.title="Checkout",this.overlay=null,this.style=null,this.showControl=!0,this.showLoader=!0,this.eventEmitter=new fi}),[{key:"initControl",value:function(){if(!this.isInit()&&this.showControl){if(!b.isSupportPopUp())return this.createLoader();this.createTemplate(),this.createStyles(),this.eventHandler()}}},{key:"initLoader",value:function(){!this.isInit()&&this.showLoader&&(this.createStyles(),this.createLoader())}},{key:"eventHandler",value:function(){var e=this,t=document.querySelector("[data-close]"),n=document.querySelector("[data-continue]");t&&Yn.subscribe("click",t,(function(){return e.eventEmitter.emit(Pi,{})})),n&&Yn.subscribe("click",n,(function(){return e.eventEmitter.emit(Di,{})}))}},{key:"clear",value:function(){(this.style||this.overlay)&&(this.style.parentNode.removeChild(this.style),this.overlay.parentNode.removeChild(this.overlay),this.style=null,this.overlay=null)}},{key:"createLoader",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0];this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=Li+Mi,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <strong class="checkout-title" data-title>{{title}}</strong>\n <p data-description>{{description}}</p>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');n=(n=n.replace("{{description}}",this.description)).replace("{{title}}",this.title),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .hide-continue-button [data-continue] {\n display: none;\n }\n\n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display {\n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n"),n=document.querySelector(".checkout-container");t=t.replace("{{width}}",n?String(n.offsetHeight/2):"0"),this.style=document.createElement("style"),this.style.type="text/css",this.style.appendChild(document.createTextNode(t)),e.appendChild(this.style)}},{key:"setBackdropDescription",value:function(e){this.description=e}},{key:"setBackdropTitle",value:function(e){this.title=e}},{key:"onTrigger",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"isInit",value:function(){return!(!this.overlay||!this.style)}},{key:"hideContinueControl",value:function(){this.isInit()&&this.overlay.classList.add("hide-continue-button")}},{key:"turnOffControl",value:function(){this.showControl=!1}},{key:"turnOffLoader",value:function(){this.showLoader=!1}}])}(),Ui=function(){return c((function e(){s(this,e),this.widgetEnv=new Y(V)}),[{key:"error",value:function(e,t,n){n(!0)}},{key:"setEnv",value:function(e,t){this.widgetEnv.setEnv(e,t)}}])}();function Hi(){return function(e){function n(){var e;s(this,n);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return(e=t(this,n,[].concat(r))).background=new Fi,e.background.onTrigger(Di,(function(){return e.continue()})),e.background.onTrigger(Pi,(function(){return e.stop()})),e}return d(n,e),c(n,[{key:"continue",value:function(){}},{key:"stop",value:function(){}},{key:"error",value:function(e,t,n){n(!0)}},{key:"setSuspendedRedirectUri",value:function(e){this.suspendedRedirectUri=e}},{key:"setBackgroundTitle",value:function(e){this.background.setBackdropTitle(e)}},{key:"setBackgroundDescription",value:function(e){this.background.setBackdropDescription(e)}},{key:"turnOffBackdrop",value:function(){this.background.turnOffControl(),this.background.turnOffLoader()}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ui)}!function(e){e.SUCCESS="success",e.DECLINED="declined",e.CLOSE="close",e.REFERRED="referred",e.ERROR="error"}(Ii||(Ii={}));var ji="paydock-dispatcher",Bi=function(){return c((function e(t){s(this,e),this.messageSource=t,this.env=new Y(V)}),[{key:"restartDispatcher",value:function(){var e=document.getElementById(ji);e&&e.parentNode&&e.parentNode.removeChild(e);var t=document.createElement("iframe");t.setAttribute("src",this.env.getConf().url+"/dispatcher"),t.id=ji,t.style.display="none",document.body.appendChild(t)}},{key:"on",value:function(e,t){var n=this;Yn.subscribe("message",window,(function(i){var r=null;try{r=JSON.parse(i.data)}catch(e){}r&&r.message_source===n.messageSource&&r.event===e&&t(r)}))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.restartDispatcher()}}])}(),Vi="close",zi=function(){return c((function e(){s(this,e),this.configs={width:500,height:500,scrollbars:!0,resizable:!0,top:0,left:0},this.eventEmitter=new fi}),[{key:"isExist",value:function(){return!(!this.getElement()||this.getElement().closed)}},{key:"getElement",value:function(){return this.window}},{key:"init",value:function(){var e=this;if(!b.isSupportPopUp())return this.window=window;var t=this.getConfigs();this.window=window.open("about:blank","_blank","noopener=false,width=".concat(t.width,",height=").concat(t.height,",top=").concat(t.top,",left=").concat(t.left,",scrollbars=").concat(t.scrollbars?"yes":"no",",resizable=").concat(t.resizable?"yes":"no")),this.showLoader();var n=setInterval((function(){e.isExist()||(clearInterval(n),e.eventEmitter.emit(Vi,{}))}),200)}},{key:"redirect",value:function(e){this.isExist()&&(this.window.location.href=e)}},{key:"close",value:function(){this.isExist()&&this.getElement().close&&(this.getElement().close(),this.window=null)}},{key:"focus",value:function(){this.isExist()&&this.getElement().focus&&this.getElement().focus()}},{key:"setConfigs",value:function(e){this.configs=u(this.configs,e)}},{key:"getNetConfigs",value:function(){return u({},this.configs)}},{key:"getConfigs",value:function(){var e=this.getNetConfigs();return e.left=window.screenX+(window.screen.width/2-e.width/2),e.top=window.screenY+(window.screen.height/2-e.height/2),e}},{key:"onClose",value:function(e){this.eventEmitter.subscribe(Vi,e)}},{key:"initError",value:function(e){this.getElement().document.write("."),(this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0]).innerHTML="<style>\n .error-wrapper {\n color: #ff0000;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n }\n </style>"+'<div class="error-wrapper"><div>{{error}}</div></div>'.replace("{{error}}",e)}},{key:"showLoader",value:function(){this.getElement().document.write(".");var e=this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0];if(e.innerHTML=Li+Mi,this.env===_&&this.env===N&&this.env===O&&this.env===I&&this.env===R&&this.env===A&&this.env===x&&this.env===M&&this.env===L&&this.env===P&&this.env===D&&this.env===F&&this.env===U&&this.env===H&&this.env===j&&this.env===B){var t=0;Yn.subscribe("click",e,(function(){5===++t&&(e.innerHTML='\n <style>\n html{width: 100%;height: 100%;}\n body{margin: 0px;padding: 0px;background-color: #111;}\n \n .eye{\n width: 20px; height: 8px;\n background-color: #eee;\n border-radius:0px 0px 20px 20px;\n position: relative;\n top: 40px;\n left: 10px;\n box-shadow: 40px 0px 0px 0px #eee; \n }\n \n .head{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden; \n position: relative;\n margin: -250px auto;\n width: 80px; height: 80px;\n background-color: #111;\n border-radius:50px;\n box-shadow: inset -4px 2px 0px 0px #eee;\n -webkit-animation:node 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n .body{ \n position: relative;\n margin: 90px auto;\n width: 140px; height: 120px;\n background-color: #111;\n border-radius: 50px/25px ;\n box-shadow: inset -5px 2px 0px 0px #eee;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out; \n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out; \n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out; \n }\n \n @keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-moz-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-moz-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-webkit-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-webkit-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n \n \n .circ{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin: 60px auto;\n width: 180px; height: 180px;\n background-color: #111;\n border-radius: 0px 0px 50px 50px;\n position: relative;\n z-index: -1; \n left: 0%;\n top: 20%;\n overflow: hidden;\n }\n \n .hands{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin-top: 140px;\n width: 120px;height: 120px;\n position: absolute;\n background-color: #111;\n border-radius:20px;\n box-shadow:-1px -4px 0px 0px #eee;\n transform:rotate(45deg);\n -webkit-transform:rotate(45deg);\n -mox-transform:rotate(45deg);\n top:75%;left: 16%;\n z-index: 1;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n \n .load{ position: absolute;\n width: 100px; height: 20px;\n margin: -10px auto;\n -webkit-font-smoothing: antialiased;\n -moz-font-smoothing: antialiased;\n font-smoothing: antialiased;\n font-family: \'Julius Sans One\', sans-serif;\n font-size:30px;\n font-weight:400;\n color:#eee;\n left: 10%;\n top: 5%;\n }\n </style>\n\n <div class="circ">\n <div class="load">A little patience ...</div>\n <div class="hands"></div>\n <div class="body"></div>\n <div class="head">\n <div class="eye"></div>\n </div>\n </div>\n')}))}}},{key:"setEnv",value:function(e){this.env=e}}])}(),Wi=function(e){function n(e){var i;return s(this,n),(i=t(this,n)).publicKey=e,i.checkout=null,i.dispatcher=new Bi("checkout.paydock"),setTimeout((function(){return i.dispatcher.restartDispatcher()}),200),i.popup=new zi,i}return d(n,e),c(n,[{key:"run",value:function(){this.isRunning()||(this.popup.init(),this.background.initControl())}},{key:"isRunning",value:function(){return this.popup.isExist()}},{key:"next",value:function(e){this.checkout=e,b.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.checkout.link)}},{key:"continue",value:function(){this.popup.focus()}},{key:"stop",value:function(){this.popup.close()}},{key:"onStop",value:function(e){var t=this;this.popup.onClose((function(){t.background.clear(),t.checkout=null,e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.dispatcher.on(e,(function(e){if(n.checkout&&n.checkout.reference_id===e.reference_id)n.background.clear(),t(n.checkout);else if(!b.isSupportPopUp()){var i=window.localStorage.getItem("paydock_checkout_token");if(!i)return;var r=JSON.parse(i);r&&r.reference_id===e.reference_id&&(window.localStorage.removeItem("paydock_checkout_token"),n.checkout=r,n.background.clear(),t(n.checkout))}}))}},{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.dispatcher.setEnv(e,t),this.popup.setEnv(e)}}])}(Hi());function qi(e){return"run"in e}function Gi(e){return"setRedirectUrl"in e}!function e(t,n,i){function r(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,(function(e){return r(t[s][1][e]||e)}),u,u.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){function i(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function o(e){if(u===setTimeout)return setTimeout(e,0);if((u===i||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function s(){m&&p&&(m=!1,p.length?f=p.concat(f):v=-1,f.length&&a())}function a(){if(!m){var e=o(s);m=!0;for(var t=f.length;t;){for(p=f,f=[];++v<t;)p&&p[v].run();v=-1,t=f.length}p=null,m=!1,function(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}(e)}}function c(e,t){this.fun=e,this.array=t}function l(){}var u,d,h=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:i}catch(e){u=i}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,f=[],m=!1,v=-1;h.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new c(e,t)),1!==f.length||m||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.prependListener=l,h.prependOnceListener=l,h.listeners=function(e){return[]},h.binding=function(e){throw Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],2:[function(e,t,n){(function(e){!function(e){if("function"==typeof bootstrap)bootstrap("promise",e);else if("object"==o(n)&&"object"==o(t))t.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=e}else{if("undefined"==typeof window&&"undefined"==typeof self)throw Error("This environment was not anticipated by Q. Please file a bug.");var i="undefined"!=typeof window?window:self,r=i.Q;i.Q=e(),i.Q.noConflict=function(){return i.Q=r,this}}}((function(){function t(e){return function(){return A.apply(e,arguments)}}function n(e,t){if(T&&t.stack&&"object"==o(e)&&null!==e&&e.stack){for(var n=[],r=t;r;r=r.source)r.stack&&(!e.__minimumStackCounter__||e.__minimumStackCounter__>r.stackCounter)&&(F(e,"__minimumStackCounter__",{value:r.stackCounter,configurable:!0}),n.unshift(r.stack));n.unshift(e.stack),F(e,"stack",{value:function(e){for(var t=e.split("\n"),n=[],r=0;r<t.length;++r){var o=t[r];s(o)||i(o)||!o||n.push(o)}return n.join("\n")}(n.join("\n"+B+"\n")),configurable:!0})}}function i(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function r(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var i=/.*@(.+):(\d+)$/.exec(e);return i?[i[1],Number(i[2])]:void 0}function s(e){var t=r(e);if(!t)return!1;var n=t[0],i=t[1];return n===_&&i>=O&&i<=Y}function a(){if(T)try{throw Error()}catch(n){var e=n.stack.split("\n"),t=r(e[0].indexOf("@")>0?e[1]:e[2]);if(!t)return;return _=t[0],t[1]}}function c(e){var t,n;return e instanceof h?e:v(e)?(t=e,n=l(),c.nextTick((function(){try{t.then(n.resolve,n.reject,n.notify)}catch(e){n.reject(e)}})),n.promise):b(e)}function l(){function e(e){t=e,c.longStackSupport&&T&&(o.source=e),M(n,(function(t,n){c.nextTick((function(){e.promiseDispatch.apply(e,n)}))}),void 0),n=void 0,i=void 0}var t,n=[],i=[],r=D(l.prototype),o=D(h.prototype);if(o.promiseDispatch=function(e,r,o){var s=x(arguments);n?(n.push(s),"when"===r&&o[1]&&i.push(o[1])):c.nextTick((function(){t.promiseDispatch.apply(t,s)}))},o.valueOf=function(){if(n)return o;var e=f(t);return m(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},c.longStackSupport&&T)try{throw Error()}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1),o.stackCounter=V++}return r.promise=o,r.resolve=function(n){t||e(c(n))},r.fulfill=function(n){t||e(b(n))},r.reject=function(n){t||e(y(n))},r.notify=function(e){t||M(i,(function(t,n){c.nextTick((function(){n(e)}))}),void 0)},r}function u(e){if("function"!=typeof e)throw TypeError("resolver must be a function.");var t=l();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function d(e){return u((function(t,n){for(var i=0,r=e.length;i<r;i++)c(e[i]).then(t,n)}))}function h(e,t,n){void 0===t&&(t=function(e){return y(Error("Promise does not support operation: "+e))}),void 0===n&&(n=function(){return{state:"unknown"}});var i=D(h.prototype);if(i.promiseDispatch=function(n,r,o){var s;try{s=e[r]?e[r].apply(i,o):t.call(i,r,o)}catch(e){s=y(e)}n&&n(s)},i.inspect=n,n){var r=n();"rejected"===r.state&&(i.exception=r.reason),i.valueOf=function(){var e=n();return"pending"===e.state||"rejected"===e.state?i:e.value}}return i}function p(e,t,n,i){return c(e).then(t,n,i)}function f(e){if(m(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function m(e){return e instanceof h}function v(e){var t;return(t=e)===Object(t)&&"function"==typeof e.then}function g(){W.length=0,q.length=0,K||(K=!0)}function y(t){var n,i,r=h({when:function(n){return n&&function(t){if(K){var n=L(q,t);-1!==n&&("object"==o(e)&&"function"==typeof e.emit&&c.nextTick.runAfter((function(){var i=L(G,t);-1!==i&&(e.emit("rejectionHandled",W[n],t),G.splice(i,1))})),q.splice(n,1),W.splice(n,1))}}(this),n?n(t):this}},(function(){return this}),(function(){return{state:"rejected",reason:t}}));return n=r,i=t,K&&("object"==o(e)&&"function"==typeof e.emit&&c.nextTick.runAfter((function(){-1!==L(q,n)&&(e.emit("unhandledRejection",i,n),G.push(n))})),q.push(n),i&&void 0!==i.stack?W.push(i.stack):W.push("(no stack) "+i)),r}function b(e){return h({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},delete:function(t){delete e[t]},post:function(t,n){return null==t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return H(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function E(e,t,n){return c(e).spread(t,n)}function w(e,t,n){return c(e).dispatch(t,n)}function k(e){return p(e,(function(e){var t=0,n=l();return M(e,(function(i,r,o){var s;m(r)&&"fulfilled"===(s=r.inspect()).state?e[o]=s.value:(++t,p(r,(function(i){e[o]=i,0==--t&&n.resolve(e)}),n.reject,(function(e){n.notify({index:o,value:e})})))}),void 0),0===t&&n.resolve(e),n.promise}))}function S(e){if(0===e.length)return c.resolve();var t=c.defer(),n=0;return M(e,(function(i,r,o){var s=e[o];n++,p(s,(function(e){t.resolve(e)}),(function(e){0==--n&&(e.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+e.message,t.reject(e))}),(function(e){t.notify({index:o,value:e})}))}),void 0),t.promise}function C(e){return p(e,(function(e){return e=P(e,c),p(k(P(e,(function(e){return p(e,I,I)}))),(function(){return e}))}))}var T=!1;try{throw Error()}catch(e){T=!!e.stack}var _,N,O=a(),I=function(){},R=function(){function t(){for(var e,t;i.next;)e=(i=i.next).task,i.task=void 0,(t=i.domain)&&(i.domain=void 0,t.enter()),n(e,t);for(;l.length;)n(e=l.pop());s=!1}function n(e,n){try{e()}catch(e){if(c)throw n&&n.exit(),setTimeout(t,0),n&&n.enter(),e;setTimeout((function(){throw e}),0)}n&&n.exit()}var i={task:void 0,next:null},r=i,s=!1,a=void 0,c=!1,l=[];if(R=function(t){r=r.next={task:t,domain:c&&e.domain,next:null},s||(s=!0,a())},"object"==o(e)&&"[object process]"===e.toString()&&e.nextTick)c=!0,a=function(){e.nextTick(t)};else if("function"==typeof setImmediate)a="undefined"!=typeof window?setImmediate.bind(window,t):function(){setImmediate(t)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=function(){a=d,u.port1.onmessage=t,t()};var d=function(){u.port2.postMessage(0)};a=function(){setTimeout(t,0),d()}}else a=function(){setTimeout(t,0)};return R.runAfter=function(e){l.push(e),s||(s=!0,a())},R}(),A=Function.call,x=t(Array.prototype.slice),M=t(Array.prototype.reduce||function(e,t){var n=0,i=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=i)throw TypeError()}for(;n<i;n++)n in this&&(t=e(t,this[n],n));return t}),L=t(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),P=t(Array.prototype.map||function(e,t){var n=this,i=[];return M(n,(function(r,o,s){i.push(e.call(t,o,s,n))}),void 0),i}),D=Object.create||function(e){function t(){}return t.prototype=e,new t},F=Object.defineProperty||function(e,t,n){return e[t]=n.value,e},U=t(Object.prototype.hasOwnProperty),H=Object.keys||function(e){var t=[];for(var n in e)U(e,n)&&t.push(n);return t},j=t(Object.prototype.toString);N="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var B="From previous event:";c.resolve=c,c.nextTick=R,c.longStackSupport=!1;var V=1;"object"==o(e)&&e&&e.env&&e.env.Q_DEBUG&&(c.longStackSupport=!0),c.defer=l,l.prototype.makeNodeResolver=function(){var e=this;return function(t,n){t?e.reject(t):arguments.length>2?e.resolve(x(arguments,1)):e.resolve(n)}},c.Promise=u,c.promise=u,u.race=d,u.all=k,u.reject=y,u.resolve=c,c.passByCopy=function(e){return e},h.prototype.passByCopy=function(){return this},c.join=function(e,t){return c(e).join(t)},h.prototype.join=function(e){return c([this,e]).spread((function(e,t){if(e===t)return e;throw Error("Q can't join: not the same: "+e+" "+t)}))},c.race=d,h.prototype.race=function(){return this.then(c.race)},c.makePromise=h,h.prototype.toString=function(){return"[object Promise]"},h.prototype.then=function(e,t,i){var r=this,o=l(),s=!1;return c.nextTick((function(){r.promiseDispatch((function(t){s||(s=!0,o.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return y(e)}}(t)))}),"when",[function(e){s||(s=!0,o.resolve(function(e){if("function"==typeof t){n(e,r);try{return t(e)}catch(e){return y(e)}}return y(e)}(e)))}])})),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,n,r=!1;try{t=e,n="function"==typeof i?i(t):t}catch(e){if(r=!0,!c.onerror)throw e;c.onerror(e)}r||o.notify(n)}]),o.promise},c.tap=function(e,t){return c(e).tap(t)},h.prototype.tap=function(e){return e=c(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},c.when=p,h.prototype.thenResolve=function(e){return this.then((function(){return e}))},c.thenResolve=function(e,t){return c(e).thenResolve(t)},h.prototype.thenReject=function(e){return this.then((function(){throw e}))},c.thenReject=function(e,t){return c(e).thenReject(t)},c.nearer=f,c.isPromise=m,c.isPromiseAlike=v,c.isPending=function(e){return m(e)&&"pending"===e.inspect().state},h.prototype.isPending=function(){return"pending"===this.inspect().state},c.isFulfilled=function(e){return!m(e)||"fulfilled"===e.inspect().state},h.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},c.isRejected=function(e){return m(e)&&"rejected"===e.inspect().state},h.prototype.isRejected=function(){return"rejected"===this.inspect().state};var z,W=[],q=[],G=[],K=!0;c.resetUnhandledRejections=g,c.getUnhandledReasons=function(){return W.slice()},c.stopUnhandledRejectionTracking=function(){g(),K=!1},g(),c.reject=y,c.fulfill=b,c.master=function(e){return h({isDef:function(){}},(function(t,n){return w(e,t,n)}),(function(){return c(e).inspect()}))},c.spread=E,h.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},c.async=function(e){return function(){function t(e,t){var o,s;if("undefined"==typeof StopIteration){try{o=n[e](t)}catch(e){return y(e)}return o.done?c(o.value):p(o.value,i,r)}try{o=n[e](t)}catch(e){return"[object StopIteration]"===j(s=e)||s instanceof N?c(e.value):y(e)}return p(o,i,r)}var n=e.apply(this,arguments),i=t.bind(t,"next"),r=t.bind(t,"throw");return i()}},c.spawn=function(e){c.done(c.async(e)())},c.return=function(e){throw new N(e)},c.promised=function(e){return function(){return E([this,k(arguments)],(function(t,n){return e.apply(t,n)}))}},c.dispatch=w,h.prototype.dispatch=function(e,t){var n=this,i=l();return c.nextTick((function(){n.promiseDispatch(i.resolve,e,t)})),i.promise},c.get=function(e,t){return c(e).dispatch("get",[t])},h.prototype.get=function(e){return this.dispatch("get",[e])},c.set=function(e,t,n){return c(e).dispatch("set",[t,n])},h.prototype.set=function(e,t){return this.dispatch("set",[e,t])},c.del=c.delete=function(e,t){return c(e).dispatch("delete",[t])},h.prototype.del=h.prototype.delete=function(e){return this.dispatch("delete",[e])},c.mapply=c.post=function(e,t,n){return c(e).dispatch("post",[t,n])},h.prototype.mapply=h.prototype.post=function(e,t){return this.dispatch("post",[e,t])},c.send=c.mcall=c.invoke=function(e,t){return c(e).dispatch("post",[t,x(arguments,2)])},h.prototype.send=h.prototype.mcall=h.prototype.invoke=function(e){return this.dispatch("post",[e,x(arguments,1)])},c.fapply=function(e,t){return c(e).dispatch("apply",[void 0,t])},h.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},c.try=c.fcall=function(e){return c(e).dispatch("apply",[void 0,x(arguments,1)])},h.prototype.fcall=function(){return this.dispatch("apply",[void 0,x(arguments)])},c.fbind=function(e){var t=c(e),n=x(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(x(arguments))])}},h.prototype.fbind=function(){var e=this,t=x(arguments);return function(){return e.dispatch("apply",[this,t.concat(x(arguments))])}},c.keys=function(e){return c(e).dispatch("keys",[])},h.prototype.keys=function(){return this.dispatch("keys",[])},c.all=k,h.prototype.all=function(){return k(this)},c.any=S,h.prototype.any=function(){return S(this)},c.allResolved=(z=C,function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("allResolved is deprecated, use allSettled instead.",Error("").stack),z.apply(z,arguments)}),h.prototype.allResolved=function(){return C(this)},c.allSettled=function(e){return c(e).allSettled()},h.prototype.allSettled=function(){return this.then((function(e){return k(P(e,(function(e){function t(){return e.inspect()}return(e=c(e)).then(t,t)})))}))},c.fail=c.catch=function(e,t){return c(e).then(void 0,t)},h.prototype.fail=h.prototype.catch=function(e){return this.then(void 0,e)},c.progress=function(e,t){return c(e).then(void 0,void 0,t)},h.prototype.progress=function(e){return this.then(void 0,void 0,e)},c.fin=c.finally=function(e,t){return c(e).finally(t)},h.prototype.fin=h.prototype.finally=function(e){if(!e||"function"!=typeof e.apply)throw Error("Q can't apply finally callback");return e=c(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},c.done=function(e,t,n,i){return c(e).done(t,n,i)},h.prototype.done=function(t,i,r){var s=function(e){c.nextTick((function(){if(n(e,a),!c.onerror)throw e;c.onerror(e)}))},a=t||i||r?this.then(t,i,r):this;"object"==o(e)&&e&&e.domain&&(s=e.domain.bind(s)),a.then(void 0,s)},c.timeout=function(e,t,n){return c(e).timeout(t,n)},h.prototype.timeout=function(e,t){var n=l(),i=setTimeout((function(){t&&"string"!=typeof t||((t=Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)}),e);return this.then((function(e){clearTimeout(i),n.resolve(e)}),(function(e){clearTimeout(i),n.reject(e)}),n.notify),n.promise},c.delay=function(e,t){return void 0===t&&(t=e,e=void 0),c(e).delay(t)},h.prototype.delay=function(e){return this.then((function(t){var n=l();return setTimeout((function(){n.resolve(t)}),e),n.promise}))},c.nfapply=function(e,t){return c(e).nfapply(t)},h.prototype.nfapply=function(e){var t=l(),n=x(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},c.nfcall=function(e){var t=x(arguments,1);return c(e).nfapply(t)},h.prototype.nfcall=function(){var e=x(arguments),t=l();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},c.nfbind=c.denodeify=function(e){if(void 0===e)throw Error("Q can't wrap an undefined function");var t=x(arguments,1);return function(){var n=t.concat(x(arguments)),i=l();return n.push(i.makeNodeResolver()),c(e).fapply(n).fail(i.reject),i.promise}},h.prototype.nfbind=h.prototype.denodeify=function(){var e=x(arguments);return e.unshift(this),c.denodeify.apply(void 0,e)},c.nbind=function(e,t){var n=x(arguments,2);return function(){var i=n.concat(x(arguments)),r=l();return i.push(r.makeNodeResolver()),c((function(){return e.apply(t,arguments)})).fapply(i).fail(r.reject),r.promise}},h.prototype.nbind=function(){var e=x(arguments,0);return e.unshift(this),c.nbind.apply(void 0,e)},c.nmapply=c.npost=function(e,t,n){return c(e).npost(t,n)},h.prototype.nmapply=h.prototype.npost=function(e,t){var n=x(t||[]),i=l();return n.push(i.makeNodeResolver()),this.dispatch("post",[e,n]).fail(i.reject),i.promise},c.nsend=c.nmcall=c.ninvoke=function(e,t){var n=x(arguments,2),i=l();return n.push(i.makeNodeResolver()),c(e).dispatch("post",[t,n]).fail(i.reject),i.promise},h.prototype.nsend=h.prototype.nmcall=h.prototype.ninvoke=function(e){var t=x(arguments,1),n=l();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},c.nodeify=function(e,t){return c(e).nodeify(t)},h.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){c.nextTick((function(){e(null,t)}))}),(function(t){c.nextTick((function(){e(t)}))}))},c.noConflict=function(){throw Error("Q.noConflict only works when Q is used as a global")};var Y=a();return c}))}).call(this,e("_process"))},{_process:1}],3:[function(e,t,n){var i=function(e){switch(o(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==o(e)?Object.keys(e).map((function(r){var o=encodeURIComponent(i(r))+n;return Array.isArray(e[r])?e[r].map((function(e){return o+encodeURIComponent(i(e))})).join(t):o+encodeURIComponent(i(e[r]))})).join(t):r?encodeURIComponent(i(r))+n+encodeURIComponent(i(e)):""}},{}],4:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return l.default.information("zip:checkout:init"),d.default.Promise((function(t,n){return e.onCheckout(t,n,{})})).then((function(i){var r=i.redirect_uri||i.redirectUri||i.data&&(i.data.redirect_uri||i.data.redirectUri);if(!r)return l.default.debug("zip:checkout:error","Response does not contain redirectUri property"),n(i),void e.onError({code:"checkout_error",message:"The response does not contain the redirectUri property",detail:i});l.default.debug("zip:checkout:success",i),t({redirectUri:r})})).catch((function(t){l.default.debug("zip:checkout:error",t),n(t),e.onError({code:"checkout_error",message:"Checkout response error",detail:t})}))}Object.defineProperty(n,"__esModule",{value:!0}),n.Checkout=void 0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=i(e("./modal")),a=i(e("./options")),c=i(e("./utility")),l=i(e("./console")),d=i((e("./events"),e("q"))),h=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return o(e,null,[{key:"init",value:function(e){var t,n;if("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),e=u({},a.default,e),!this._validate(e))return l.default.setLevel(e.logLevel),e.redirect?r(e,(function(t){return e.redirectFn(t.redirectUri)})):(t=e,(n=new s.default).onClose=t.onComplete.bind(t),n.build(),void r(t,(function(e){return n.setUri(e.redirectUri)}),(function(e){return n.close(!1)})))}},{key:"attachButton",value:function(e,t){var n=document.querySelectorAll(e);if(!n.length)return config.onError({code:"attach_error",message:"Cannot find button to attach zipMoney checkout"});for(var i=0;i<n.length;i++)c.default.addEventHandler(n[i],"click",(function(){return Zip.Checkout.init(t)}))}},{key:"_validate",value:function(e){return 0>["error","information","debug"].indexOf(e.logLevel.toLowerCase())&&(e.logLevel="error"),0>["standard","express"].indexOf(e.request.toLowerCase())&&(e.request="standard"),e.onComplete=e.onComplete||function(){},e.onError=e.onError||function(){},e.checkoutUri||e.onCheckout!==a.default.onCheckout?"express"===e.request?e.onError({code:"not_implemented",message:"This feature is not yet implemented"}):e.redirect||e.onComplete!==a.default.onComplete||e.redirectUri?void 0:e.onError({code:"validation",message:"if onComplete function is not specified then redirectUri must be specified"}):e.onError({code:"validation",message:"if onCheckout function is not specified then checkoutUri must be specified"})}}]),e}();n.Checkout=h},{"./console":5,"./events":6,"./modal":8,"./options":9,"./utility":10,q:2}],5:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i="error";n.default={error:function(){var e;(e=window.console).log.apply(e,arguments)},information:function(){var e;"error"!==i&&(e=window.console).log.apply(e,arguments)},debug:function(){var e;"debug"===i&&(e=window.console).log.apply(e,arguments)},setLevel:function(e){i=e}}},{}],6:[function(e,t,n){(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.EventListener=void 0;var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();if(((i=e("./utility"))&&i.__esModule?i:{default:i}).default.isIe){var o=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};o.prototype=t.Event.prototype,t.CustomEvent=o}var s={},a=n.EventListener=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"constructor",value:function(){s={}}},{key:"on",value:function(e,t){s[e]=t}},{key:"off",value:function(e){s[e]=null}}]),e}();a.Event=function(e,t){this.eventType=e,this.data=t||{}},a.Event.eventTypes={resize:"resize",transition:"transition",close:"close",complete:"complete",clear:"clear"};var c=window.addEventListener?"addEventListener":"attachEvent",l=window[c];l("attachEvent"==c?"onmessage":"message",(function(e){var n,i;e.data.zipmoney&&(n=e.data.msg,i=new t.CustomEvent("zipmoney",{detail:n}),t.dispatchEvent(i))}),!1),l("zipmoney",(function(e){var t,n=s[e.detail.eventType];n?n(e.detail.data||{}):(t=e,console.log("Unexpected Event",t))}),!1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utility":10}],7:[function(e,t,n){(function(t){var n=e("./checkout"),i=e("./events");t.Zip=t.Zip||{},t.Zip.Checkout=n.Checkout,t.zipMoneyEvent=i.EventListener.ZipEvent}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./checkout":4,"./events":6}],8:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}function o(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function s(e){for(var t=document.querySelectorAll("html, body"),n=0;n<t.length;n++)t[n].style.overflowY=e}function a(e){var t=document.body.currentStyle||window.getComputedStyle(document.body),n=document.body.offsetHeight+(parseInt(t.marginTop,10)+parseInt(t.marginBottom,10))-parseInt(t.height,10);document.body.style.height=e-n+"px"}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=i(e("./utility")),d=e("./events"),h=(i(e("./console")),{iframeWidth:400,iframeMinWidth:320,iframeInitialHeight:704,iframeMinHeight:600,verticalMargin:35}),p=["resize","transition","close","complete","clear"],f="https://d3k1w8lx8mqizo.cloudfront.net/zm/",m=function(){function e(){var t=this;(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,e),this._events=[],this._isMobile=l.default.isMobileDevice(),p.forEach((function(e){return d.EventListener.on(d.EventListener.Event.eventTypes[e],t[e].bind(t))}))}return c(e,[{key:"build",value:function(){this._initialHtmlHeight=o(),window.scrollTo(0,0);var e=this._frame=(t=this._frameUri,n=this._isMobile,(i=document.createElement("iframe")).id="zipmoney-iframe",i.frameborder=0,u(i.style,{padding:"0",border:"none",zIndex:"999999",backgroundColor:"#FFF",backgroundImage:"url("+f+"spinner.gif)",backgroundRepeat:"no-repeat",backgroundPosition:"50% 50%"}),u(i.style,n?{overflow:"scroll",width:"100%",height:"100%",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",margin:"0"}:{width:h.iframeWidth+"px",minWidth:h.iframeMinWidth+"px",height:h.iframeInitialHeight+"px",margin:h.verticalMargin+"px auto 0 auto",display:"table-row",backgroundSize:"25%",textAlign:"center",boxShadow:"0px 0px 70px 0px rgb(0, 0, 0)"}),i.src=t||"",i);if(!this._isMobile){var t,n,i,r,c,l=((r=document.createElement("img")).src=f+"icon-close.png",u(r.style,{width:"50px",height:"50px",position:"absolute",top:"20px",right:"20px",cursor:"pointer"}),r);l.onclick=this.close.bind(this),this._overlay=((c=document.createElement("div")).className="zipmoney-overlay",u(c.style,{position:"absolute",left:"0",top:"0",display:"table-cell",textAlign:"center",verticalAlign:"middle",background:"rgba(0, 0, 0, 0.75)",zIndex:"10000",height:"100%",width:"100%"}),c),this._overlay.appendChild(l),this._overlay.appendChild(this._frame),e=this._overlay}document.body.appendChild(e),this._isMobile&&a(this._frame.offsetHeight),s("auto"),this._startMonitoringWindowResize()}},{key:"setUri",value:function(e){this._frameUri=e,this._frame&&(this._frame.src=e)}},{key:"resize",value:function(e){var t=this._isMobile?16:0,n=(e=e>=h.iframeMinHeight?e:h.iframeMinHeight,(e+=t)+2*h.verticalMargin),i=r();this._frame.style.height=e+"px",this._overlay&&(this._overlay.style.height=Math.max(i,this._initialHtmlHeight,n)+"px"),this._isMobile&&a(e)}},{key:"transition",value:function(){window.scroll(0,0)}},{key:"close",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t={state:"cancelled"};this._events.length&&(t=this._events.pop()),this._destroy(),this.onClose&&e&&this.onClose(t)}},{key:"complete",value:function(e){this._events.push(e)}},{key:"clear",value:function(e){this._events=[]}},{key:"_startMonitoringWindowResize",value:function(){var e=this;this._resizeHandler=l.default.debounce((function(){var t,n,i,s;return t=e,n=r(),i=o(),s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t._overlay&&(t._overlay.style.height=Math.max(n,i)+"px"),void(t._isMobile||s<h.iframeWidth?t._frame.style.width="100%":t._frame.style.width=h.iframeWidth+"px")}),250),l.default.addEventHandler(window,"resize",this._resizeHandler)}},{key:"_stopMonitoringWindowResize",value:function(){l.default.removeEventHandler(window,"resize",this._resizeHandler)}},{key:"_destroy",value:function(){this._stopMonitoringWindowResize(),this._overlay?document.body.removeChild(this._overlay):document.body.removeChild(this._frame),this._isMobile&&(document.body.style.height="initial"),s("initial"),this._overlay=this._frame=null,p.forEach((function(e){return d.EventListener.off(d.EventListener.Event.eventTypes[e])}))}}]),e}();n.default=m},{"./console":5,"./events":6,"./utility":10}],9:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r=i(e("./xr")),o=i(e("./console"));r.default.configure({headers:{"X-Requested-With":"XMLHttpRequest"}}),n.default={request:"standard",redirect:!1,logLevel:"Error",onCheckout:function(e,t,n){r.default.post(this.checkoutUri).then((function(t){return e(t.data)})).catch(t)},onShippingAddressChanged:function(e,t,n){r.default.post(this.shippingUri).then(e).catch(t)},onComplete:function(e){if(o.default.information("zip:completed",e),"cancelled"!==e.state){var t=e.checkoutId?"&checkoutId="+e.checkoutId:"";this.redirectFn(this.redirectUri+"?result="+e.state+t)}},onError:function(e){o.default.error(e)},redirectFn:function(e){window.location.href=e}}},{"./console":5,"./xr":11}],10:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"isIe",value:function(){var e=-1,t=window.navigator.userAgent,n=t.indexOf("MSIE "),i=t.indexOf("Trident/");if(n>0)e=parseInt(t.substring(n+5,t.indexOf(".",n)),10);else if(i>0){var r=t.indexOf("rv:");e=parseInt(t.substring(r+3,t.indexOf(".",r)),10)}return e>-1?e:void 0}},{key:"isMobileDevice",value:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}},{key:"debounce",value:function(e,t){var n;return function(){var i=this,r=arguments,o=!n;clearTimeout(n),n=setTimeout((function(){n=null,e.apply(i,r)}),t),o&&e.apply(i,r)}}},{key:"addEventHandler",value:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}},{key:"removeEventHandler",value:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}}]),e}();n.default=r},{}],11:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function s(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var r in n)if({}.hasOwnProperty.call(n,r)){var o=n[r];if("object"===(void 0===o?"undefined":c(o)))for(var s in o)({}).hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e}function a(e){var t,n;return n=function(t,n){var i=s({},p,f,e),o=i.xmlHttpRequest();for(var a in i.abort&&e.abort((function(){n(r(o)),o.abort()})),o.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,l.default)(i.params):i.url,!0),o.withCredentials=i.withCredentials,o.addEventListener(h.LOAD,(function(){if(o.status>=200&&o.status<300){var e=null;o.responseText&&(e=!0===i.raw?o.responseText:i.load(o.responseText)),t(r(o,e))}else n(r(o))})),o.addEventListener(h.ABORT,(function(){return n(r(o))})),o.addEventListener(h.ERROR,(function(){return n(r(o))})),o.addEventListener(h.TIMEOUT,(function(){return n(r(o))})),i.headers)({}).hasOwnProperty.call(i.headers,a)&&o.setRequestHeader(a,i.headers[a]);for(var u in i.events)({}).hasOwnProperty.call(i.events,u)&&o.addEventListener(u,i.events[u].bind(null,o),!1);var d="object"!==c(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?o.send(d):o.send()},((t=e)&&t.promise?t.promise:f.promise||p.promise)(n)}Object.defineProperty(n,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)},l=i(e("querystring/encode")),u=i(e("q")),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},h={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:JSON.stringify,load:JSON.parse,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return u.default.Promise(e)},withCredentials:!1},f={};a.assign=s,a.encode=l.default,a.configure=function(e){f=s({},f,e)},a.Methods=d,a.Events=h,a.defaults=p,a.get=function(e,t,n){return a(s({url:e,method:d.GET,params:t},n))},a.put=function(e,t,n){return a(s({url:e,method:d.PUT,data:t},n))},a.post=function(e,t,n){return a(s({url:e,method:d.POST,data:t},n))},a.patch=function(e,t,n){return a(s({url:e,method:d.PATCH,data:t},n))},a.del=function(e,t){return a(s({url:e,method:d.DELETE},t))},a.options=function(e,t){return a(s({url:e,method:d.OPTIONS},t))},n.default=a},{q:2,"querystring/encode":3}]},{},[7]);var Ki,Yi=function(e){function n(){var e;return s(this,n),(e=t(this,n)).apiEnv=new Y(z),e}return d(n,e),c(n,[{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.apiEnv.setEnv(e,t)}},{key:"getCheckoutUri",value:function(e){return this.apiEnv.getConf().url+"/v1/echo?"+zn.serialize({json_body:JSON.stringify({redirect_uri:e})})}}])}(Ui),$i=function(e){function n(){var e;return s(this,n),(e=t(this,n)).runs=!1,e.eventEmitter=new fi,e}return d(n,e),c(n,[{key:"run",value:function(){this.runs=!0,this.background.initLoader()}},{key:"isRunning",value:function(){return this.runs}},{key:"next",value:function(e){var t=this;this.background.clear(),this.checkout=e;var n=this.getCheckoutUri(this.checkout.link);Zip.Checkout.init({checkoutUri:n,onComplete:function(e){return t.eventHandler(e)},onError:function(e){return t.eventHandler(e)}})}},{key:"getSuccessRedirectUri",value:function(){return this.suspendedRedirectUri?this.suspendedRedirectUri:this.widgetEnv.getConf().url+String("/checkout/zipmoney/suspended")}},{key:"getErrorRedirectUri",value:function(){return this.getSuccessRedirectUri()}},{key:"stop",value:function(){f(h(n.prototype),"stop",this).call(this),this.runs=!1;var e=document.querySelector(".zipmoney-overlay");e&&e.remove(),this.eventEmitter.emit(Ii.CLOSE)}},{key:"onStop",value:function(e){var t=this;this.eventEmitter.subscribe(Ii.CLOSE,(function(){t.background.clear(),e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.eventEmitter.subscribe(e,(function(){t(n.checkout)}))}},{key:"eventHandler",value:function(e){switch(this.runs=!1,e.state){case"approved":this.eventEmitter.emit(Ii.CLOSE),this.eventEmitter.emit(Ii.SUCCESS);break;case"declined":this.eventEmitter.emit(Ii.CLOSE),this.eventEmitter.emit(Ii.DECLINED);break;case"cancelled":this.eventEmitter.emit(Ii.CLOSE);break;case"referred":this.eventEmitter.emit(Ii.CLOSE),this.eventEmitter.emit(Ii.REFERRED);break;default:console.warn("".concat("[CheckoutButton:Zipmoney]"," Unknown gateway status."))}}}])}(Hi(Yi)),Zi="[Paydock:StorageDispatcher]";!function(e){e.WIDGET_SESSION="widget-session"}(Ki||(Ki={}));var Ji,Xi,Qi=function(){return c((function e(t){s(this,e),this.messageSource=t,this.defaultPayload={destination:"widget.paydock"},this.env=new Y(V),this.defaultPayload.source=t,this.iframeEvent=new Xn(window)}),[{key:"create",value:function(e){this.onLoadCallback=e,this.dispatcherFrame&&this.destroy(),this.widgetId=Wn.generate(),this.setupIframeEventListeners();var t=document.createElement("iframe");return t.setAttribute("src",this.env.getConf().url+"/storage-dispatcher"+"?widgetId=".concat(this.widgetId)),t.setAttribute("id","pd-storage-dispatcher"),t.style.display="none",document.body.appendChild(t),this.dispatcherFrame=t,console.info("".concat(Zi," initialized.")),t}},{key:"destroy",value:function(){this.dispatcherFrame&&this.dispatcherFrame.parentNode&&this.dispatcherFrame.parentNode.removeChild(this.dispatcherFrame),this.iframeEvent.clear(),this.widgetId=void 0,this.dispatcherFrame=void 0}},{key:"push",value:function(e,t){var n;if(this.pushCallbacks=t,this.dispatcherFrame){var i=u(u({},this.defaultPayload),e);null===(n=this.dispatcherFrame.contentWindow)||void 0===n||n.postMessage(i,this.env.getConf().url)}else console.error("".concat(Zi," dispatcher is not initialized."))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.create(this.onLoadCallback)}},{key:"setupIframeEventListeners",value:function(){var e=this;this.widgetId&&(this.iframeEvent.on(Jn.AFTER_LOAD,this.widgetId,(function(t){var n;null===(n=e.onLoadCallback)||void 0===n||n.call(e)})),this.iframeEvent.on(Jn.DISPATCH_SUCCESS,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onSuccess)||void 0===i||i.call(n)})),this.iframeEvent.on(Jn.DISPATCH_ERROR,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onError)||void 0===i||i.call(n)})))}}])}(),er=function(e){function n(){var e;return s(this,n),(e=t(this,n)).storageDispatcher=new Qi("zipmoney.checkout.paydock"),e}return d(n,e),c(n,[{key:"getProxyRedirectUrl",value:function(){return this.widgetEnv.getConf().url+"/checkout/zipmoney/response"}},{key:"next",value:function(e,t){var n=this;this.storageDispatcher.create((function(){var i={merchant_redirect_url:n.getRedirectUrl(),checkout_token:e.token,public_key:t.public_key,gateway_id:t.gateway_id};n.storageDispatcher.push({intent:Ki.WIDGET_SESSION,data:i},{onSuccess:function(){var t=n.getCheckoutUri(e.link);Zip.Checkout.init({checkoutUri:t,redirect:!0})},onError:function(){console.error("Error initializing Zip Checkout")}})}))}},{key:"getSuccessRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"getErrorRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.storageDispatcher.setEnv(e,t)}}])}(function(){return function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"setRedirectUrl",value:function(e){this.merchantRedirectUrl=e}},{key:"getRedirectUrl",value:function(){return this.merchantRedirectUrl}},{key:"error",value:function(e,t,n){n(!1)}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ui)}(Yi)),tr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+zn.extendSearchParams("/checkout/success","merchant",encodeURIComponent(window.location.href))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+zn.extendSearchParams("/checkout/error","merchant",encodeURIComponent(window.location.href))}}])}(Wi),nr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/success".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/error".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"next",value:function(e,t){this.checkout=e,b.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.getRedirectUrl(this.checkout,t))}},{key:"error",value:function(e,t,n){return!t||t&&"invalid_amount"!==t?n(!0):(this.popup.initError(e),n(!1))}},{key:"run",value:function(){this.isRunning()||(this.popup.setConfigs({width:420,height:715}),this.popup.init(),this.background.initControl())}},{key:"getRedirectUrl",value:function(e,t){return this.widgetEnv.getConf().url+"/checkout/afterpay/init?"+zn.serialize(u(u({},t),{token:e.reference_id,env:"live"===e.mode?"live":"test"}))}}])}(Wi),ir={EXTERNAL_CHECKOUT_TOKEN:"external_checkout_token",CHECKOUT_TOKEN:"checkout_token",BANK_ACCOUNT:"bank_account",CARD:"card"},rr=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ir.CARD;switch(s(this,n),(r=t(this,n)).body={gateway_id:e,type:o},o){case ir.CARD:case ir.BANK_ACCOUNT:delete i.gateway_id,delete i.type,delete i.checkout_token,r.body=u(r.body,i);break;case ir.CHECKOUT_TOKEN:case ir.EXTERNAL_CHECKOUT_TOKEN:r.body.checkout_token=i;break;default:throw new Error("Unsupported type of PaymentSourceToken")}return r}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/tokens"}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.create(e,this.getConfigs(),(function(e,n){return t(e)}),(function(e,t){void 0===e.message?n("unknown error"):n(e.message)}))}},{key:"getConfigs",value:function(){return this.body}}])}(Ri),or=function(){return c((function e(t,n,i,r){var o=this;s(this,e),this.background=t,this.runner=n,this.eventEmitter=i,this.params=r,this.runner.onStop((function(){o.eventEmitter.emit(yi.CLOSE)}))}),[{key:"init",value:function(e){var t=this;this.setEnv(e),this.runner.onCheckout(Ii.SUCCESS,(function(e){t.eventEmitter.emit(yi.ACCEPTED,{}),t.background.initLoader(),t.runner.stop(),t.checkToken(e.token,(function(){t.createOneTimeToken(e.token)}))})),this.runner.onCheckout(Ii.ERROR,(function(){t.eventEmitter.emit(yi.ERROR),console.error("".concat(wi," Error from checkout server.")),t.runner.stop()})),this.runner.onCheckout(Ii.REFERRED,(function(){t.eventEmitter.emit(yi.REFERRED),t.runner.stop()})),this.runner.onCheckout(Ii.DECLINED,(function(){t.eventEmitter.emit(yi.DECLINED),t.runner.stop()})),this.eventEmitter.subscribe(yi.ERROR,(function(){t.runner.stop()})),this.eventEmitter.subscribe(yi.FINISH,(function(e){t.background.clear()}))}},{key:"setEnv",value:function(e){this.env=e}},{key:"checkToken",value:function(e,t){var n=this,i=new xi(e);i.setEnv(this.env),i.send(this.params.accessToken,(function(e){n.details=e,t()}),(function(){n.eventEmitter.emit(yi.ERROR,{}),console.error("".concat(wi," Error during creating payment source token."))}))}},{key:"createOneTimeToken",value:function(e){var t=this,n=new rr(this.params.gatewayId,e,ir.CHECKOUT_TOKEN);n.setEnv(this.env),n.send(this.params.accessToken,(function(e){t.eventEmitter.emit(yi.FINISH,{payment_source_token:e,checkout_email:t.details.checkout_email,checkout_holder:t.details.checkout_holder,gateway_type:t.details.gateway_type})}),(function(){t.eventEmitter.emit(yi.ERROR,{}),console.error("".concat(wi," Error during creating payment source token."))}))}}])}(),sr=function(){return c((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vi.PAYPAL,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:mi.CONTEXTUAL;s(this,e),this.accessToken=n,this.gatewayId=i,this.gatewayType=r,this.mode=o,this.window=window,this.meta={},this.env=q,this.eventEmitter=new fi,this.container=new $n(t),this.initCheckout(this.container),this.chooseRunner(r,o)}),[{key:"chooseRunner",value:function(e,t){var n=this.getRunnerByMode(e,t);this.runner=new n(this.accessToken),qi(this.runner)?(this.background=new Fi,this.checkoutHandler=new or(this.background,this.runner,this.eventEmitter,{accessToken:this.accessToken,gatewayId:this.gatewayId}),this.checkoutHandler.init(this.env)):(this.background=void 0,this.checkoutHandler=void 0)}},{key:"buildAdditionalParams",value:function(){return{}}},{key:"initCheckout",value:function(e){var t=this;e.on("click",(function(e){if(qi(t.runner)){if(t.runner.isRunning())return;t.runner.run()}else if(Gi(t.runner)&&!t.runner.getRedirectUrl())throw Error("".concat(wi," The merchant redirect URL should is required in the '").concat(t.mode,"' mode."));t.eventEmitter.emit(yi.CLICK);var n=new Ai(t.gatewayId,t.runner.getSuccessRedirectUri(),t.runner.getErrorRedirectUri());n.setMeta(t.meta),n.setEnv(t.env),n.send(t.accessToken,(function(e){var n=qi(t.runner)?yi.POPUP_REDIRECT:yi.REDIRECT;t.eventEmitter.emit(n),t.runner.next(e,t.buildAdditionalParams())}),(function(e,n){console.error("".concat(wi," ").concat(e)),t.eventEmitter.emit(yi.ERROR,{error:e,code:n}),t.runner.error(e,n,(function(e){e&&t.close()}))}))}))}},{key:"on",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"close",value:function(){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.stop()}},{key:"onFinishInsert",value:function(e,t){this.on(yi.FINISH,(function(n){Yn.insertToInput(e,t,n)}))}},{key:"setMeta",value:function(e){this.meta=u(this.meta,e)}},{key:"setBackdropDescription",value:function(e){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.setBackgroundDescription(e)}},{key:"setBackdropTitle",value:function(e){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.setBackgroundTitle(e)}},{key:"setSuspendedRedirectUri",value:function(e){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.setSuspendedRedirectUri(e)}},{key:"setRedirectUrl",value:function(e){this.assertMethodSupport(this.runner,mi.REDIRECT)&&this.runner.setRedirectUrl(e)}},{key:"getSuccessRedirectUri",value:function(){return this.runner.getSuccessRedirectUri()}},{key:"turnOffBackdrop",value:function(){this.turnOffControlBackdrop(),this.turnOffLoaderBackdrop()}},{key:"turnOffControlBackdrop",value:function(){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.turnOffBackdrop()}},{key:"turnOffLoaderBackdrop",value:function(){var e;null===(e=this.background)||void 0===e||e.turnOffLoader()}},{key:"setEnv",value:function(e,t){var n;this.env=e,this.alias=t,null===(n=this.checkoutHandler)||void 0===n||n.setEnv(e),this.runner.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env}},{key:"getRunnerByMode",value:function(e,t){if(e===vi.PAYPAL){if(t===mi.REDIRECT)throw Error("".concat(wi," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return tr}if(e===vi.AFTERPAY){if(t===mi.REDIRECT)throw Error("".concat(wi," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return nr}if(e===vi.ZIPMONEY)return t===mi.CONTEXTUAL?$i:er;throw Error("".concat(wi," Unsupported gateway."))}},{key:"assertMethodSupport",value:function(e,t){var n="".concat(wi," The method is not supported in the '").concat(t,"' mode.");switch(t){case mi.CONTEXTUAL:if(qi(e))return!0;console.warn(n);break;case mi.REDIRECT:if(Gi(e))return!0;console.warn(n)}return!1}}])}(),ar=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:mi.CONTEXTUAL;return s(this,n),(r=t(this,n,[e,i,o,vi.ZIPMONEY,a])).publicKey=i,r.gatewayId=o,r.mode=a,r}return d(n,e),c(n,[{key:"setSuspendedRedirectUri",value:function(e){f(h(n.prototype),"setSuspendedRedirectUri",this).call(this,e)}},{key:"setRedirectUrl",value:function(e){qi(this.runner)&&(f(h(n.prototype),"chooseRunner",this).call(this,vi.ZIPMONEY,mi.REDIRECT),f(h(n.prototype),"setEnv",this).call(this,this.env,this.alias)),f(h(n.prototype),"setRedirectUrl",this).call(this,e)}},{key:"buildAdditionalParams",value:function(){return u(u({},f(h(n.prototype),"buildAdditionalParams",this).call(this)),{public_key:this.publicKey,gateway_id:this.gatewayId})}}])}(sr),cr=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return s(this,n),(r=t(this,n,[e,i,o,vi.AFTERPAY])).accessToken=i,r.gatewayId=o,r.showETP=!1,r}return d(n,e),c(n,[{key:"showEnhancedTrackingProtectionPopup",value:function(e){var t=b.getBrowserInfo(),n=t.name,i=t.version;e&&"Firefox"===n&&+i>=100&&(this.showETP=!0)}},{key:"buildAdditionalParams",value:function(){var e=f(h(n.prototype),"buildAdditionalParams",this).call(this);return this.showETP&&(e.show_etp=!0),e}}])}(sr),lr=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return s(this,n),(r=t(this,n,[e,i,o,vi.PAYPAL])).publicKey=i,r.gatewayId=o,r}return d(n,e),c(n)}(sr),ur=function(){return c((function e(){s(this,e)}),null,[{key:"values",value:function(e){return Object.keys(e).map((function(t){return e[t]}))}}])}(),dr=function(){return c((function e(t,n){s(this,e),this.configs=[],this.configTokens=[],this.link=new Kn("/payment-sources"),this.link.setParams(u({query_token:n},X.validateJWT(t)?{access_token:t}:{public_key:t})),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type})}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==ur.values(Ci).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"setLimit",value:function(e){this.link.setParams({limit:e})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"getIFrameUrl",value:function(){return this.link.getUrl()}},{key:"filterByGatewayIds",value:function(e){this.link.setParams({gateway_ids:e.join(",")})}},{key:"filterByTypes",value:function(e){var t,n=[],i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=g(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;e.hasOwnProperty(r)&&(-1===ur.values(ki).indexOf(r)?console.warn("PaymentSourceWidget::filterByTypes: unsupported type ".concat(r)):n.push(r))}}catch(e){i.e(e)}finally{i.f()}this.link.setParams({payment_source_types:n.join(",")})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),hr=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n,[i,r])).container=new $n(e),o.iFrame=new Zn(o.container),o.event=new Xn(window),o}return d(n,e),c(n,[{key:"load",value:function(){this.iFrame.load(this.getIFrameUrl(),{title:"Payment Sources"})}},{key:"on",value:function(e,t){this.event.on(e,this.link.getParams().widget_id,t)}},{key:"hide",value:function(e){console.info("PayDock SDK"),this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"onSelectInsert",value:function(e,t){this.on(Jn.SELECT,(function(n){Yn.insertToInput(e,t,n)}))}}])}(dr);!function(e){e.IFRAME_LOADED="iframeLoaded",e.CHECKOUT_READY="checkoutReady",e.CHECKOUT_COMPLETED="checkoutCompleted",e.CHECKOUT_ERROR="checkoutError",e.CHECKOUT_POPUP_OPEN="checkoutPopupOpen",e.CHECKOUT_POPUP_CLOSE="checkoutPopupClose"}(Ji||(Ji={})),function(e){e.CRITICAL_ERROR="CriticalError",e.USER_ERROR="UserError",e.SUCCESS="Success"}(Xi||(Xi={}));var pr,fr={PRIMARY_BUTTON_COLOR:"primary_button_color",SECONDARY_BUTTON_COLOR:"secondary_button_color",PRIMARY_BUTTON_TEXT_COLOR:"primary_button_text_color",SECONDARY_BUTTON_TEXT_COLOR:"secondary_button_text_color",FONT_FAMILY:"font_family",ENABLE_SRC_POPUP:"enable_src_popup"},mr=function(){return c((function e(t,n,i,r,o,a,c,l){s(this,e),this.meta=r,this.eventEmitter=o,this.autoResize=a,this.link=new Kn("/secure-remote-commerce/mastercard"),this.link.setParams(u({service_id:n,public_key:i},r&&{meta:JSON.stringify(r)})),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type}),c&&this.link.setEnv(c,l),this.iFrameContainer=new $n(t),this.iFrame=new Zn(this.iFrameContainer),this.iFrameEvent=new Xn(window),this.setupIFrameEvents()}),[{key:"setupIFrameEvents",value:function(){var e=this,t=this.link.getParams().widget_id;t&&(this.iFrameEvent.on(Ji.CHECKOUT_READY,t,(function(t){var n=t.data;e.eventEmitter.emit(Ji.CHECKOUT_READY,n)})),this.iFrameEvent.on(Ji.CHECKOUT_COMPLETED,t,(function(t){var n=t.data;e.eventEmitter.emit(Ji.CHECKOUT_COMPLETED,n)})),this.iFrameEvent.on(Ji.CHECKOUT_POPUP_OPEN,t,(function(t){var n=t.data;e.eventEmitter.emit(Ji.CHECKOUT_POPUP_OPEN,n)})),this.iFrameEvent.on(Ji.CHECKOUT_POPUP_CLOSE,t,(function(t){var n=t.data;e.eventEmitter.emit(Ji.CHECKOUT_POPUP_CLOSE,n)})),this.iFrameEvent.on(Ji.CHECKOUT_ERROR,t,(function(t){var n=t.data;e.eventEmitter.emit(Ji.CHECKOUT_ERROR,n)})),this.autoResize&&this.useAutoResize(!0))}},{key:"load",value:function(){var e=this;this.iFrame.load(this.link.getUrl(),{title:"Mastercard SRC checkout"});var t=this.iFrame.getElement();this.iFrame.setStyle("width","100%"),t&&(t.onload=function(){return e.eventEmitter.emit(Ji.IFRAME_LOADED,{})})}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"hideCheckout",value:function(e){this.iFrame&&this.iFrame.hide()}},{key:"showCheckout",value:function(){this.iFrame&&this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"useAutoResize",value:function(e){var t=this;if(!this.autoResize||e){this.autoResize=!0;var n=this.link.getParams();(null==n?void 0:n.widget_id)&&this.iFrameEvent.on("resize",n.widget_id,(function(e){var n,i,r=e.data,o=t.iFrame.getElement();o&&(o.scrolling="no",(null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.height)&&t.iFrame.setStyle("height",(null===(i=null==r?void 0:r.data)||void 0===i?void 0:i.height)+"px"))}))}}}])}(),vr=function(){return c((function e(t,n,i,r){s(this,e),this.iframe_selector=t,this.service_id=n,this.public_key_or_access_token=i,this.meta=r,this.autoResize=!1,this.style={},this.api=new di(i,Ln.PUBLIC_KEY),this.eventEmitter=new fi}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==ur.values(fr).indexOf(e)?this.style[e]=t:console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){var e=this;this.provider||this.api.service().getConfig(this.service_id).then((function(t){var n=t.type;if(e.meta.customizations=e.style,n===ei.MASTERCARD_SRC)e.provider=new mr(e.iframe_selector,e.service_id,e.public_key_or_access_token,e.meta,e.eventEmitter,e.autoResize,e.env,e.alias);e.provider&&e.provider.load()}))}},{key:"setEnv",value:function(e,t){this.provider||(this.env=e,this.alias=t,this.api.setEnv(e,t))}},{key:"getEnv",value:function(){return this.provider?this.provider.getEnv():this.env}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"hideCheckout",value:function(e){this.provider&&"function"==typeof this.provider.hideCheckout&&this.provider.hideCheckout(e)}},{key:"showCheckout",value:function(){this.provider&&"function"==typeof this.provider.showCheckout&&this.provider.showCheckout()}},{key:"reload",value:function(){this.provider&&this.provider.reload()}},{key:"useAutoResize",value:function(){this.autoResize=!0,this.provider&&"function"==typeof this.provider.useAutoResize&&this.provider.useAutoResize()}}])}(),gr=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i,r,o])).iframe_selector=e,a.service_id=i,a.public_key_or_access_token=r,a.meta=o,a}return d(n,e),c(n,[{key:"load",value:function(){this.provider||(this.meta.customizations=this.style,this.provider=new mr(this.iframe_selector,this.service_id,this.public_key_or_access_token,this.meta,this.eventEmitter,this.autoResize,this.env,this.alias),this.provider.load())}}])}(vr),yr={SUBMIT_FORM:"submit_form",CHANGE_TAB:"tab",HIDE_ELEMENTS:"hide_elements",SHOW_ELEMENTS:"show_elements",REFRESH_CHECKOUT:"refresh_checkout",UPDATE_FORM_VALUES:"update_form_values",INIT_CHECKOUT:"init_checkout"},br=function(){return c((function e(t){s(this,e),this.iFrame=t}),[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===ur.values(yr).indexOf(e)&&console.warn("unsupported trigger type");var n={trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}();!function(e){e.AFTER_LOAD="after_load",e.SYSTEM_ERROR="system_error",e.CVV_SECURE_CODE_REQUESTED="cvv_secure_code_requested",e.CARD_NUMBER_SECURE_CODE_REQUESTED="card_number_secure_code_requested",e.ACCESS_FORBIDDEN="access_forbidden",e.SESSION_EXPIRED="session_expired",e.OPERATION_FORBIDDEN="operation_forbidden"}(pr||(pr={}));var Er,wr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"on",value:function(e,t,n){for(var i in pr)pr.hasOwnProperty(i)&&e===pr[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(Xn),kr=function(){return c((function e(t,n){s(this,e),this.validationData={},this.configs=[],this.container=new $n(t),this.iFrame=new Zn(this.container),this.triggerElement=new br(this.iFrame),this.event=new wr(window),this.vaultDisplayToken=n,this.link=new Kn("/vault-display"),this.link.setParams({vault_display_token:n})}),[{key:"setEnv",value:function(e,t){this.link.setEnv(e,t)}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==ur.values(Ci).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){this.iFrame.load(this.link.getUrl(),{title:"Vault Display"})}}])}();!function(e){e.AFTER_LOAD="after_load",e.UNAVAILABLE="unavailable",e.START_LOADING="start_loading",e.END_LOADING="end_loading",e.UPDATE="update",e.PAYMENT_SUCCESSFUL="payment_successful",e.PAYMENT_IN_REVIEW="payment_in_review",e.PAYMENT_ERROR="payment_error"}(Er||(Er={}));var Sr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"on",value:function(e,t,n){for(var i in Er)Er.hasOwnProperty(i)&&e===Er[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(Xn),Cr={CLOSE:"close",UPDATED:"updated"},Tr=function(e){function n(e,i){var r;return s(this,n),(r=t(this,n,[e])).widgetId=i,r}return d(n,e),c(n,[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===ur.values(Cr).indexOf(e)&&console.warn("unsupported trigger type");var n={message_source:"wallet.paydock",reference_id:this.widgetId,trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}(br),_r=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return s(this,n),(i=t(this,n)).bgImageUrl=e,i.hideCloseButton=r,i.imageStyle=null,i}return d(n,e),c(n,[{key:"initControl",value:function(){this.imageStyle||this.createImageStyles(),f(h(n.prototype),"initControl",this).call(this)}},{key:"clear",value:function(){this.imageStyle&&this.imageStyle.parentNode.removeChild(this.imageStyle),this.imageStyle=null,f(h(n.prototype),"clear",this).call(this)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <div class="checkout-bg-logo"></div>\n <a href="#" data-close>Close</a>\n </div>\n');!0===this.hideCloseButton&&(n=n.replace('<a href="#" data-close>Close</a>',"")),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createImageStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n }\n\n .checkout-overlay {\n z-index: 2147483647;\n }\n\n .checkout-container [data-close] {\n opacity: 1;\n }\n .checkout-container [data-close]:before,\n .checkout-container [data-close]:after {\n background-color: #fff;\n }\n");document.querySelector(".checkout-container"),t=t.replace("{{url}}",this.bgImageUrl),this.imageStyle=document.createElement("style"),this.imageStyle.type="text/css",this.imageStyle.appendChild(document.createTextNode(t)),e.appendChild(this.imageStyle)}}])}(Fi),Nr={UNAVAILABLE:"unavailable",UPDATE:"update",PAYMENT_METHOD_SELECTED:"payment_method_selected",PAYMENT_SUCCESS:"payment_success",PAYMENT_IN_REVIEW:"payment_in_review",PAYMENT_ERROR:"payment_error",CALLBACK:"callback",AUTH_TOKENS_CHANGED:"auth_tokens_changed",BUTTON_CLICK:"button_click",CHECKOUT_OPEN:"checkout_open",CHECKOUT_CLOSE:"checkout_close"},Or=function(){return c((function e(t,n){s(this,e),this.publicKey=t,this.meta=n,this.env=q,this.eventEmitter=new fi,this.initializeChildWallets()}),[{key:"initializeChildWallets",value:function(){this.childWallets=[]}},{key:"getGatewayName",value:function(){throw new Error("Method not implemented")}},{key:"setEnv",value:function(e){return this.env=e,this}},{key:"load",value:function(e){this.childWallets.forEach((function(t){return t.load(e)}))}},{key:"update",value:function(e){}},{key:"enable",value:function(){}},{key:"disable",value:function(){}},{key:"on",value:function(e,t){var n=this;if(-1===ur.values(Nr).indexOf(e))throw new Error("invalid wallet event");return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}}])}(),Ir=function(e){function n(e,i){var r;s(this,n),(r=t(this,n,[e,i])).link=new Kn(qn);var o=i.amount,a=i.currency,c=i.id,l=i.gateway_mode,d=i.reference,h=i.request_shipping;return r.link.setParams(u({token:e,amount:o,currency:a,gateway_mode:l,credentials:d||c},h?{request_shipping:h}:{})),$.version&&r.link.setParams({sdk_version:$.version,sdk_type:$.type}),r.token=e,r.event=new Sr(window),r}return d(n,e),c(n,[{key:"load",value:function(e){this.container=e,this.iFrame=new Zn(this.container);var t=this.link.getParams().widget_id;this.triggerElement=new Tr(this.iFrame,t),this.setupIFrameEvents(t),this.background=this.initBackground(),this.iFrame.load(this.link.getUrl())}},{key:"close",value:function(){this.triggerElement.push(Cr.CLOSE),this.background.clear()}},{key:"update",value:function(e){this.triggerElement.push(Cr.UPDATED,e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),this}},{key:"initBackground",value:function(){var e=this,t=new _r(this.link.getNetUrl().replace(qn,Gn));return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Pi,(function(){return e.triggerElement.push(Cr.CLOSE)})),t}},{key:"setupIFrameEvents",value:function(e){var t=this;this.event.on(Er.UNAVAILABLE,e,(function(e){return t.eventEmitter.emit(Nr.UNAVAILABLE,null)})),this.event.on(Er.START_LOADING,e,(function(e){return t.background.initControl()})),this.event.on(Er.END_LOADING,e,(function(e){return t.background.clear()})),this.event.on(Er.UPDATE,e,(function(e){t.eventEmitter.emit(Nr.UPDATE,t.parseUpdateData(e))})),this.event.on(Er.PAYMENT_SUCCESSFUL,e,(function(e){t.eventEmitter.emit(Nr.PAYMENT_SUCCESS,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(Er.PAYMENT_IN_REVIEW,e,(function(e){t.eventEmitter.emit(Nr.PAYMENT_IN_REVIEW,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(Er.PAYMENT_ERROR,e,(function(e){t.eventEmitter.emit(Nr.PAYMENT_ERROR,e),t.iFrame.getElement()||t.background.clear()}))}},{key:"parsePaymentSuccessfulData",value:function(e){var t;return{id:this.meta.id,amount:e.amount,currency:e.currencyCode,status:null===(t=e.charge)||void 0===t?void 0:t.status}}},{key:"parseUpdateData",value:function(e){return u(u(u({wallet_response_code:e.responseCode,wallet_session_id:e.sessionId},e.paymentMethodDetails?{payment_source:{wallet_payment_method_id:e.paymentMethodDetails.paymentMethodId,card_number_last4:e.paymentMethodDetails.lastFourDigitsOfPan,card_scheme:e.paymentMethodDetails.paymentScheme}}:{}),e.loyaltyAccountSummary?{wallet_loyalty_account:{id:e.loyaltyAccountSummary.loyaltyAccountId,barcode:e.loyaltyAccountSummary.loyaltyAccountBarcode}}:{}),e.deliveryAddressDetails?{shipping:{address_line1:e.deliveryAddressDetails.line1,address_line2:e.deliveryAddressDetails.line2,address_postcode:e.deliveryAddressDetails.postalCode,address_city:e.deliveryAddressDetails.city,address_state:e.deliveryAddressDetails.state,address_country:e.deliveryAddressDetails.countryCode,address_company:e.deliveryAddressDetails.companyName,wallet_address_id:e.deliveryAddressDetails.addressId,post_office_box_number:e.deliveryAddressDetails.postOfficeBoxNumber,wallet_address_created_timestamp:e.deliveryAddressDetails.createdTimestamp,wallet_address_updated_timestamp:e.deliveryAddressDetails.updatedTimestamp,wallet_address_name:e.deliveryAddressDetails.name}}:{})}}])}(Or),Rr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"load",value:function(e){return window.Promise?(!0===this.meta.standalone?this.renderPaypalStandaloneComponent(e):this.renderPaypalCommonComponent(e),Promise.resolve()):(this.eventEmitter.emit(Nr.UNAVAILABLE,null),Promise.resolve())}},{key:"update",value:function(e){var t=this;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject)return e.success?void this.eventEmitter.emit(Nr.CALLBACK,{data:{request_type:"UPDATE_TRANSACTION",shipping:this.latestShippingData},onSuccess:function(e){return t.latestShippingChangePromiseResolve(!0)},onError:function(){return t.latestShippingChangePromiseReject()}}):this.latestShippingChangePromiseReject()}},{key:"renderPaypalCommonComponent",value:function(e){var t,n=this,i=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",r=document.createElement("script");r.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency).concat(!0===this.meta.pay_later?"&enable-funding=paylater&disable-funding=card":"&disable-funding=credit,card").concat(this.meta.capture?"":"&intent=authorize"),r.async=!0,r.onload=function(){window.paypal?(n.paypal=window.paypal,n.paypal.Buttons(u({},n.paypalSharedProps())).render("#".concat(i))):n.eventEmitter.emit(Nr.UNAVAILABLE,null)},document.head.appendChild(r)}},{key:"renderPaypalStandaloneComponent",value:function(e){var t,n,i=this,r=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",o=document.createElement("script");o.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency,"&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(this.meta.capture?"":"&intent=authorize").concat("live"===(null===(n=this.meta)||void 0===n?void 0:n.gateway_mode)?"":"&buyer-country=AU"),o.async=!0,o.onload=function(){if(window.paypal){i.paypal=window.paypal;var e=!!i.meta.pay_later,t=i.paypal.Buttons(u({fundingSource:e?i.paypal.FUNDING.PAYLATER:i.paypal.FUNDING.PAYPAL},i.paypalSharedProps()));if(t.isEligible()){if(t.render("#".concat(r)),e)i.paypal.Messages(u({amount:i.meta.amount,currency:i.meta.currency,placement:"payment"},i.meta.style&&i.meta.style.messages&&{style:i.meta.style.messages})).render("#".concat(r))}else i.eventEmitter.emit(Nr.UNAVAILABLE,null)}else i.eventEmitter.emit(Nr.UNAVAILABLE,null)},document.head.appendChild(o)}},{key:"paypalSharedProps",value:function(){var e=this;return u(u({},this.meta.style&&{style:this.meta.style}),{onClick:function(t,n){var i;return e.eventEmitter.emit(Nr.BUTTON_CLICK,{attachResult:function(e){i=e&&e instanceof Promise?e.then((function(){return n.resolve()})).catch((function(){return n.reject()})):e}}),i},createOrder:function(){return new Promise((function(t,n){e.eventEmitter.emit(Nr.CALLBACK,{data:u({request_type:"CREATE_TRANSACTION"},e.meta.request_shipping&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e.id)},onError:function(e){return n(e)}})}))},onShippingChange:function(t,n){return new Promise((function(n,i){var r=e.parseUpdateData(t);e.latestShippingData=r.shipping,e.latestShippingChangePromiseResolve=n,e.latestShippingChangePromiseReject=i,e.eventEmitter.emit(Nr.UPDATE,r)}))},onApprove:function(t){return e.pendingApprovalPromise=e.pendingApprovalPromise||new Promise((function(n,i){return e.eventEmitter.emit(Nr.PAYMENT_METHOD_SELECTED,{data:{payment_method_id:t.orderID,customer:{payment_source:{external_payer_id:t.payerID}}},onSuccess:function(){e.pendingApprovalPromise=void 0,n(!0)},onError:function(t){e.pendingApprovalPromise=void 0,i(t)}})})),e.pendingApprovalPromise},onCancel:function(){return e.eventEmitter.emit(Nr.CHECKOUT_CLOSE)},onError:function(e){}})}},{key:"parseUpdateData",value:function(e){var t;return u(u({wallet_order_id:e.orderID,wallet_session_id:e.paymentID,payment_source:{wallet_payment_method_id:e.paymentToken}},e.shipping_address&&{shipping:{address_city:e.shipping_address.city,address_state:e.shipping_address.state,address_postcode:e.shipping_address.postal_code,address_country:e.shipping_address.country_code}}),e.selected_shipping_option&&{selected_shipping_option:{id:e.selected_shipping_option.id,label:e.selected_shipping_option.label,amount:e.selected_shipping_option.amount.value,currency:e.selected_shipping_option.amount.currency_code,type:null===(t=e.selected_shipping_option)||void 0===t?void 0:t.type}})}}])}(Or),Ar={};function xr(e){return xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xr(e)}Object.defineProperty(Ar,"__esModule",{value:!0});var Mr,Lr="https://js.stripe.com/v3",Pr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Dr="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Fr=null,Ur=function(e){return null!==Fr||(Fr=new Promise((function(t,n){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(Dr),window.Stripe)t(window.Stripe);else try{var i=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Lr,'"]')),t=0;t<e.length;t++){var n=e[t];if(Pr.test(n.src))return n}return null}();i&&e?console.warn(Dr):i||(i=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(Lr).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n}(e)),i.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),i.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}))),Fr},Hr=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==xr(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)},jr=!1,Br=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];jr=!0;var i=Date.now();return Ur(Mr).then((function(e){return function(e,t,n){if(null===e)return null;var i=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.54.2",startTime:t})}(i,n),i}(e,t,i)}))};Br.setLoadParameters=function(e){if(jr&&Mr){var t=Hr(e);if(Object.keys(t).reduce((function(t,n){var i;return t&&e[n]===(null===(i=Mr)||void 0===i?void 0:i[n])}),!0))return}if(jr)throw new Error("You cannot change load parameters after calling loadStripe");Mr=Hr(e)},Ar.loadStripe=Br;var Vr=Ar,zr="success",Wr="fail",qr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"initPaymentRequest",value:function(){return this.stripe.paymentRequest({country:this.meta.country.toUpperCase(),currency:this.meta.currency.toLowerCase(),total:{label:this.meta.amount_label,amount:Math.floor(100*this.meta.amount)},requestPayerName:!0===this.meta.request_payer_name,requestPayerEmail:!0===this.meta.request_payer_email,requestPayerPhone:!0===this.meta.request_payer_phone})}},{key:"createWalletButton",value:function(){return this.stripe.elements().create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"load",value:function(e){var t=this;return Vr.loadStripe(this.publicKey).then((function(e){t.stripe=e,t.paymentRequest=t.initPaymentRequest()})).then((function(){return t.checkAvailability()})).then((function(n){return t.mount(e,n)})).then((function(){return t.setOnPaymentMethodSelected()}))}},{key:"checkAvailability",value:function(){var e=this;return this.paymentRequest.canMakePayment().then((function(t){if(t){var n=!e.meta.wallets||e.meta.wallets.includes(Ei.GOOGLE),i=!e.meta.wallets||e.meta.wallets.includes(Ei.APPLE);return{google_pay:n&&!t.applePay,apple_pay:i&&t.applePay,flypay:!1}}}))}},{key:"mount",value:function(e,t){if(!t||!t.apple_pay&&!t.google_pay)return this.eventEmitter.emit(Nr.UNAVAILABLE,null);this.createWalletButton().mount(e.getElement())}},{key:"setOnPaymentMethodSelected",value:function(){var e=this;this.paymentRequest.on("paymentmethod",(function(t){var n,i,r=t.paymentMethod,o=r.id,s=r.card,a=r.billing_details,c=a.name,l=a.address,u={payment_method_id:o,customer:{payer_name:t.payerName,payer_email:t.payerEmail,payer_phone:t.payerPhone,payment_source:{wallet_type:e.getWalletType(null===(n=null==s?void 0:s.wallet)||void 0===n?void 0:n.type),card_name:c,type:null===(i=null==s?void 0:s.wallet)||void 0===i?void 0:i.type,card_scheme:null==s?void 0:s.brand,card_number_last4:null==s?void 0:s.last4,expire_month:null==s?void 0:s.exp_month,expire_year:null==s?void 0:s.exp_year,address_line1:l.line1,address_line2:l.line2,address_city:l.city,address_postcode:l.postal_code,address_state:l.state,address_country:l.country}}};e.eventEmitter.emit(Nr.PAYMENT_METHOD_SELECTED,{data:u,onSuccess:function(){return t.complete(zr)},onError:function(e){return t.complete(Wr)}})}))}},{key:"getWalletType",value:function(e){return e?"google_pay"===e?Ei.GOOGLE:Ei.APPLE:null}}])}(Or),Gr=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i])).gatewayName=r,a.eventEmitter=o,a.latestShippingData={},a.onCancelPayment=function(e){return a.eventEmitter.emit(Nr.CHECKOUT_CLOSE)},a.onValidateMerchant=function(e){a.handleMerchantOnButtonClickEvent().then((function(){a.getMerchantSession().then((function(e){a.paymentSession.completeMerchantValidation(e)})).catch((function(e){console.error("Error fetching merchant session",e),a.paymentSession.abort()}))})).catch((function(e){console.error("Error while processing merchant callback",e),a.paymentSession.abort()}))},a.onPaymentAuthorized=function(e){var t,n=e.payment,i=n.token,r=n.billingContact,o=n.shippingContact;a.latestShippingData.shippingContact=o;var s=null===(t=a.selectedShippingOption)||void 0===t?void 0:t.type,c=[null==o?void 0:o.givenName,null==o?void 0:o.familyName].join(" ").trim();a.eventEmitter.emit(Nr.PAYMENT_METHOD_SELECTED,{data:u({customer:{payment_source:u(u({wallet_type:Ei.APPLE},c&&{card_name:c}),{type:i.paymentMethod.type,card_scheme:i.paymentMethod.network,address_line1:null==r?void 0:r.addressLines[0],address_line2:null==r?void 0:r.addressLines[1],address_country:null==r?void 0:r.countryCode,address_city:null==r?void 0:r.locality,address_postcode:null==r?void 0:r.postalCode,address_state:null==r?void 0:r.administrativeArea,ref_token:i.paymentData?JSON.stringify(i.paymentData):""})}},a.meta.request_shipping&&o&&{shipping:u(u(u({},s&&{method:s}),a.hasShippingOptions()&&{options:a.meta.shipping_options}),{address_line1:o.addressLines[0],address_line2:o.addressLines[1],address_country:o.countryCode,address_city:o.locality,address_postcode:o.postalCode,address_state:o.administrativeArea,contact:{first_name:o.givenName,last_name:o.familyName,email:o.emailAddress,phone:o.phoneNumber}})}),onSuccess:function(){return a.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS)},onError:function(){return a.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE)}})},a.onShippingContactSelected=function(e){a.latestShippingData.shippingContact=e.shippingContact;var t=a.parseUpdateData(a.latestShippingData);return a.eventEmitter.emit(Nr.UPDATE,t),new Promise((function(e,t){a.latestShippingChangePromiseResolve=e,a.latestShippingChangePromiseReject=t}))},a.onShippingMethodSelected=function(e){var t,n;a.latestShippingData.shippingMethod=e.shippingMethod;var i={newTotal:{label:a.meta.amount_label||(null===(n=null===(t=a.getMetaRawDataInitialization())||void 0===t?void 0:t.total)||void 0===n?void 0:n.label),amount:a.meta.amount.toString(),type:"final"}};a.paymentSession.completeShippingMethodSelection(i)},a.parseUpdateData=function(e){var t,n,i,r,o,s,a,c;return u({shipping:{address_city:null===(t=null==e?void 0:e.shippingContact)||void 0===t?void 0:t.locality,address_state:null===(n=null==e?void 0:e.shippingContact)||void 0===n?void 0:n.administrativeArea,address_postcode:null===(i=null==e?void 0:e.shippingContact)||void 0===i?void 0:i.postalCode,address_country:null===(r=null==e?void 0:e.shippingContact)||void 0===r?void 0:r.countryCode}},(null==e?void 0:e.shippingMethod)&&{selected_shipping_option:{id:null===(o=null==e?void 0:e.shippingMethod)||void 0===o?void 0:o.identifier,label:null===(s=null==e?void 0:e.shippingMethod)||void 0===s?void 0:s.label,detail:null===(a=null==e?void 0:e.shippingMethod)||void 0===a?void 0:a.detail,amount:null===(c=null==e?void 0:e.shippingMethod)||void 0===c?void 0:c.amount}})},a.formatShippingOptions=function(e){return e.map((function(e){return{identifier:e.id,label:e.label,detail:(null==e?void 0:e.detail)||"",amount:e.amount}}))},a.eventEmitter=o,a}return d(n,e),c(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[Ei.APPLE])||void 0===n?void 0:n.merchant)||""}},{key:"getMetaStyles",value:function(){var e,t,n;if((null===(e=this.meta)||void 0===e?void 0:e.style)&&"object"===o(null===(t=this.meta)||void 0===t?void 0:t.style)){var i=JSON.parse(JSON.stringify(null===(n=this.meta)||void 0===n?void 0:n.style));return"google"in i&&(null==i||delete i.google),"apple"in i?null==i?void 0:i.apple:i}return null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i;if((null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"object"===o(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)){var r=JSON.parse(JSON.stringify(null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization));return"google"in r&&(null==r||delete r.google),"apple"in r?null==r?void 0:r.apple:r}return null}},{key:"isShippingRequired",value:function(){var e;return null===(e=this.meta)||void 0===e?void 0:e.request_shipping}},{key:"hasShippingOptions",value:function(){var e,t;return(null===(e=this.meta)||void 0===e?void 0:e.request_shipping)&&!!(null===(t=this.meta)||void 0===t?void 0:t.shipping_options)}},{key:"load",value:function(e){var t=this;if(window.Promise)return this.checkAvailability().then((function(n){var i;n?(t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(i=t.meta)||void 0===i?void 0:i.shipping_options[0],t.latestShippingData.shippingMethod=t.formatShippingOptions([t.selectedShippingOption])[0]),t.mount(e)):t.eventEmitter.emit(Nr.UNAVAILABLE,{wallet:Ei.APPLE})})).catch((function(e){return console.error("Error checking ApplePay availability",e)}));this.eventEmitter.emit(Nr.UNAVAILABLE,{wallet:Ei.APPLE})}},{key:"update",value:function(e){var t,n,i;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success||!e.body)return this.latestShippingChangePromiseReject();var r=null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount,o=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;r&&(this.meta.amount=r),o&&(this.meta.shipping_options=o,this.selectedShippingOption=o?o[0]:void 0);var s=u({newTotal:{label:null===(i=this.meta)||void 0===i?void 0:i.amount_label,amount:this.meta.amount.toString(),type:"final"}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingMethods:this.formatShippingOptions(this.meta.shipping_options)});this.paymentSession.completeShippingContactSelection(s),this.latestShippingChangePromiseResolve({})}}},{key:"checkAvailability",value:function(){var e=this;return new Promise((function(t,n){window.ApplePaySession&&ApplePaySession||t(!1),ApplePaySession.canMakePaymentsWithActiveCard(e.getMerchantId()).then((function(e){return t(e)})).catch((function(e){return t(!1)}))}))}},{key:"mount",value:function(e){var t=this,n=document.createElement("style");n.innerHTML=this.createButtonStyle(),document.head.appendChild(n);var i=document.createElement("div");i.onclick=function(){return t.onApplePayButtonClicked()},i.classList.add("paydock-apple-container","apple-pay-button","apple-pay-button-black"),i.setAttribute("tabindex","0"),i.setAttribute("role","button"),e.getElement().appendChild(i)}},{key:"onApplePayButtonClicked",value:function(){this.paymentSession=new ApplePaySession(3,this.createRequest()),this.paymentSession.onvalidatemerchant=this.onValidateMerchant,this.paymentSession.onpaymentauthorized=this.onPaymentAuthorized,this.paymentSession.oncancel=this.onCancelPayment,this.paymentSession.onshippingcontactselected=this.onShippingContactSelected,this.paymentSession.onshippingmethodselected=this.onShippingMethodSelected,this.paymentSession.begin()}},{key:"createRequest",value:function(){var e,t=this.getMetaRawDataInitialization();return t&&"object"===o(t)&&("object"===o(t.total)?t.total.amount=this.meta.amount.toString():t.total={label:(null===(e=this.meta)||void 0===e?void 0:e.amount_label)||"",amount:this.meta.amount.toString()},this.isShippingRequired()&&this.hasShippingOptions()&&(t.shippingMethods=this.formatShippingOptions(this.meta.shipping_options))),t||u(u(u({countryCode:this.meta.country.toUpperCase(),currencyCode:this.meta.currency.toUpperCase(),merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard","amex","discover"]},this.meta.show_billing_address&&{requiredBillingContactFields:["name","postalAddress"]}),this.isShippingRequired()&&u({requiredShippingContactFields:["postalAddress","name","phone","email"]},this.hasShippingOptions()&&{shippingMethods:this.formatShippingOptions(this.meta.shipping_options)})),{total:{label:this.meta.amount_label,amount:this.meta.amount.toString(),type:"final"}})}},{key:"getMerchantSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Nr.CALLBACK,{data:u({request_type:"CREATE_SESSION",wallet_type:Ei.APPLE,session_id:window.location.hostname},e.isShippingRequired()&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e)},onError:function(e){return n(e)}})}))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Nr.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"createButtonStyle",value:function(){var e,t;return"\n .paydock-apple-container {\n width: 100%;\n height: 40px;\n }\n\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: ".concat((null===(e=this.getMetaStyles())||void 0===e?void 0:e.button_type)||"plain","\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n -apple-pay-button-type: ").concat((null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"plain","\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n ")}}])}(Or),Kr=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i])).gatewayName=r,a.eventEmitter=o,a.processingButtonClick=!1,a.parseUpdateData=function(e){var t,n,i,r,o,s,c=null===(n=null===(t=a.meta)||void 0===t?void 0:t.shipping_options)||void 0===n?void 0:n.find((function(t){var n;return t.id===(null===(n=null==e?void 0:e.shippingOptionData)||void 0===n?void 0:n.id)}));return u({shipping:{address_city:null===(i=e.shippingAddress)||void 0===i?void 0:i.locality,address_state:null===(r=e.shippingAddress)||void 0===r?void 0:r.administrativeArea,address_postcode:null===(o=null==e?void 0:e.shippingAddress)||void 0===o?void 0:o.postalCode,address_country:null===(s=null==e?void 0:e.shippingAddress)||void 0===s?void 0:s.countryCode}},c&&{selected_shipping_option:{id:null==c?void 0:c.id,label:null==c?void 0:c.label,detail:null==c?void 0:c.detail,type:null==c?void 0:c.type}})},a.formatShippingOptions=function(e){return e.map((function(e){return{id:e.id,label:e.label,description:(null==e?void 0:e.detail)||""}}))},a.eventEmitter=o,a}return d(n,e),c(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[Ei.GOOGLE])||void 0===n?void 0:n.merchant}},{key:"getMetaStyles",value:function(){var e,t,n,i;return"object"===o(null===(e=this.meta)||void 0===e?void 0:e.style)&&"google"in(null===(t=this.meta)||void 0===t?void 0:t.style)?null===(i=null===(n=this.meta)||void 0===n?void 0:n.style)||void 0===i?void 0:i.google:null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i,r;return(null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&"object"===o(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"google"in(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)?null===(r=null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization)||void 0===r?void 0:r.google:null}},{key:"isShippingRequired",value:function(){return!!this.meta.request_shipping}},{key:"hasShippingOptions",value:function(){return this.meta.request_shipping&&!!this.meta.shipping_options}},{key:"load",value:function(e){var t=this;if(window.Promise)return new Promise((function(n,i){var r=document.createElement("script");r.type="text/javascript",r.src="https://pay.google.com/gp/p/js/pay.js",r.async=!0,r.onload=function(){var r,o,s,a;if(!window.google)return t.eventEmitter.emit(Nr.UNAVAILABLE,{wallet:Ei.GOOGLE}),void i();t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(r=t.meta)||void 0===r?void 0:r.shipping_options[0]),t.paymentsClient=new google.payments.api.PaymentsClient(u({merchantInfo:u(u({},(null===(o=t.meta)||void 0===o?void 0:o.merchant_name)?{merchantName:null===(s=t.meta)||void 0===s?void 0:s.merchant_name}:{}),{merchantId:t.getMerchantId()}),paymentDataCallbacks:u({onPaymentAuthorized:function(e){return t.onPaymentAuthorized(e)}},t.isShippingRequired()&&{onPaymentDataChanged:function(e){return t.onPaymentDataChanged(e)}})},"live"===(null===(a=t.meta)||void 0===a?void 0:a.gateway_mode)?{environment:"PRODUCTION"}:{environment:"TEST"})),t.checkAvailability().then((function(r){if(!r)return t.eventEmitter.emit(Nr.UNAVAILABLE,{wallet:Ei.GOOGLE}),void i();t.mount(e),n()}))},document.head.appendChild(r)}));this.eventEmitter.emit(Nr.UNAVAILABLE,{wallet:Ei.GOOGLE})}},{key:"update",value:function(e){var t,n,i,r;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success)return this.latestShippingChangePromiseReject();var o=(null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount)||this.meta.amount,s=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;o&&(this.meta.amount=o),s&&(this.meta.shipping_options=s,this.selectedShippingOption=s?s[0]:void 0);var a=u({newTransactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:null===(i=this.meta.amount)||void 0===i?void 0:i.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()}},this.isShippingRequired()&&this.hasShippingOptions()&&s&&{newShippingOptionParameters:{defaultSelectedOptionId:null===(r=this.selectedShippingOption)||void 0===r?void 0:r.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}});this.latestShippingChangePromiseResolve(a)}}},{key:"checkAvailability",value:function(){return ee(this,void 0,void 0,i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.paymentsClient.isReadyToPay(this.createRequest()).then((function(e){return!!e.result})).catch((function(e){return console.error("Error checking GooglePay availability",e),!1})));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"mount",value:function(e){var t,n,i,r=this;e.getElement().appendChild(this.paymentsClient.createButton({onClick:function(){return r.onGooglePayButtonClicked()},buttonType:(null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"pay",buttonSizeMode:(null===(n=this.getMetaStyles())||void 0===n?void 0:n.button_size_mode)||"fill",buttonColor:(null===(i=this.getMetaStyles())||void 0===i?void 0:i.button_color)||"default"}))}},{key:"onGooglePayButtonClicked",value:function(){var e=this;this.processingButtonClick||(this.processingButtonClick=!0,this.handleMerchantOnButtonClickEvent().then((function(){e.loadPaymentData().finally((function(){e.processingButtonClick=!1}))})).catch((function(t){e.processingButtonClick=!1,console.error("Error while processing merchant callback",t)})))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Nr.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"loadPaymentData",value:function(){return ee(this,void 0,void 0,i().mark((function e(){var t=this;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.paymentsClient.loadPaymentData(this.createPaymentDataRequest()).catch((function(e){throw t.eventEmitter.emit(Nr.CHECKOUT_CLOSE),console.error("Error while loading payment data",e),e})));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"onPaymentAuthorized",value:function(e){var t,n,i,r,o,s,a,c,l,d,h,p,f,m,v,g=this,y=null===(i=null===(n=null===(t=e.paymentMethodData)||void 0===t?void 0:t.info)||void 0===n?void 0:n.billingAddress)||void 0===i?void 0:i.address1,b=null===(s=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===s?void 0:s.address2,E=null===(a=null==e?void 0:e.shippingAddress)||void 0===a?void 0:a.address1,w=null===(c=null==e?void 0:e.shippingAddress)||void 0===c?void 0:c.address2,k=null===(l=this.selectedShippingOption)||void 0===l?void 0:l.type,S=null===(d=null==e?void 0:e.shippingAddress)||void 0===d?void 0:d.countryCode,C=null===(h=null==e?void 0:e.shippingAddress)||void 0===h?void 0:h.locality,T=null===(p=null==e?void 0:e.shippingAddress)||void 0===p?void 0:p.postalCode,_=null===(f=null==e?void 0:e.shippingAddress)||void 0===f?void 0:f.administrativeArea,N=null===(m=null==e?void 0:e.shippingAddress)||void 0===m?void 0:m.name,O=null==e?void 0:e.email,I=null===(v=null==e?void 0:e.shippingAddress)||void 0===v?void 0:v.phoneNumber;return new Promise((function(t){var n,i,r,o,s,a,c,l,d,h,p,f,m,v;return g.eventEmitter.emit(Nr.PAYMENT_METHOD_SELECTED,{data:u({customer:{payment_source:u(u(u(u({wallet_type:Ei.GOOGLE,type:e.paymentMethodData.type,card_scheme:null===(i=null===(n=e.paymentMethodData)||void 0===n?void 0:n.info)||void 0===i?void 0:i.cardNetwork},y&&{address_line1:y}),b&&{address_line2:b}),b&&{address_line2:b}),{address_country:null===(s=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===s?void 0:s.countryCode,address_city:null===(l=null===(c=null===(a=e.paymentMethodData)||void 0===a?void 0:a.info)||void 0===c?void 0:c.billingAddress)||void 0===l?void 0:l.locality,address_postcode:null===(p=null===(h=null===(d=e.paymentMethodData)||void 0===d?void 0:d.info)||void 0===h?void 0:h.billingAddress)||void 0===p?void 0:p.postalCode,address_state:null===(v=null===(m=null===(f=e.paymentMethodData)||void 0===f?void 0:f.info)||void 0===m?void 0:m.billingAddress)||void 0===v?void 0:v.administrativeArea,ref_token:e.paymentMethodData.tokenizationData.token})}},g.isShippingRequired()&&{shipping:u(u(u(u(u(u(u(u(u({},k&&{method:k}),g.hasShippingOptions()&&{options:g.meta.shipping_options}),E&&{address_line1:E}),w&&{address_line2:w}),S&&{address_country:S}),C&&{address_city:C}),T&&{address_postcode:T}),_&&{address_state:_}),{contact:u(u(u({},N&&{first_name:N}),O&&{email:O}),I&&{phone:I})})}),onSuccess:function(){return t({transactionState:"SUCCESS"})},onError:function(e){return t({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:(null==e?void 0:e.message)||"Error processing payment",reason:"PAYMENT_DATA_INVALID"}})}})}))}},{key:"onPaymentDataChanged",value:function(e){var t=this;if(this.isShippingRequired()){var n=this.parseUpdateData(e),i=new Promise((function(e,n){t.latestShippingChangePromiseResolve=e,t.latestShippingChangePromiseReject=n}));return this.eventEmitter.emit(Nr.UPDATE,n),i}}},{key:"createRequest",value:function(){var e="Apple Safari"===b.getBrowserName();return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.createCardData()],existingPaymentMethodRequired:!e}}},{key:"createPaymentDataRequest",value:function(){var e,t,n,i;this.isShippingRequired()&&this.hasShippingOptions()&&(this.selectedShippingOption=null===(e=this.meta)||void 0===e?void 0:e.shipping_options[0]);var r=this.getMerchantId();return u({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[u(u({},this.createCardData()),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"paydock",gatewayMerchantId:r}}})],transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:this.meta.amount.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()},merchantInfo:u(u({},(null===(t=this.meta)||void 0===t?void 0:t.merchant_name)?{merchantName:null===(n=this.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:r}),callbackIntents:["PAYMENT_AUTHORIZATION"].concat(v(this.isShippingRequired()?["SHIPPING_ADDRESS"]:[]),v(this.hasShippingOptions()?["SHIPPING_OPTION"]:[]))},this.isShippingRequired()&&u({shippingAddressRequired:!0},this.hasShippingOptions()&&{shippingOptionRequired:!0,shippingOptionParameters:{defaultSelectedOptionId:null===(i=this.selectedShippingOption)||void 0===i?void 0:i.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}}))}},{key:"createCardData",value:function(){return this.getMetaRawDataInitialization()||{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!!this.meta.show_billing_address}}}}])}(Or),Yr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"initializeChildWallets",value:function(){var e,t,n,i,r,o;this.childWallets=[];var s=!!(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t.apple)||void 0===n?void 0:n.merchant),a=!!(null===(o=null===(r=null===(i=this.meta)||void 0===i?void 0:i.credentials)||void 0===r?void 0:r.google)||void 0===o?void 0:o.merchant);!s||this.meta.wallets&&!this.meta.wallets.includes(Ei.APPLE)||this.childWallets.push(new Gr(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter)),!a||this.meta.wallets&&!this.meta.wallets.includes(Ei.GOOGLE)||this.childWallets.push(new Kr(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter))}},{key:"getGatewayName",value:function(){return bi.MASTERCARD}},{key:"setEnv",value:function(e){return this.childWallets.forEach((function(t){return t.setEnv(e)})),this}},{key:"update",value:function(e){this.childWallets.forEach((function(t){return t.update(e)}))}}])}(Or),$r=function(e){function n(e,i){var r;return s(this,n),(r=t(this,n,[e,i])).token=e,r.storageDispatcher=new Qi("afterpay.wallet.paydock"),r}return d(n,e),c(n,[{key:"load",value:function(e){var t=this;this.storageDispatcher.create((function(){return t.mount(e)}))}},{key:"setEnv",value:function(e){return f(h(n.prototype),"setEnv",this).call(this,e),this.storageDispatcher.setEnv(e),this}},{key:"mount",value:function(e){var t,n,i,r,s=this,a={};(null===(t=this.meta)||void 0===t?void 0:t.style)&&"object"===o(null===(n=this.meta)||void 0===n?void 0:n.style)&&(a=JSON.parse(JSON.stringify((null===(i=this.meta)||void 0===i?void 0:i.style.afterpay)||(null===(r=this.meta)||void 0===r?void 0:r.style))));var c=this.getButton(a);c.onclick=function(){return s.onAfterPayButtonClicked()};var l=this.getButtonStyle(a);e.getElement().appendChild(c),e.getElement().appendChild(l)}},{key:"onAfterPayButtonClicked",value:function(){var e,t,n=this,i=document.createElement("script"),r=null===(e=this.meta)||void 0===e?void 0:e.country;i.type="text/javascript",i.src="live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"https://portal.afterpay.com/afterpay.js":"https://portal.sandbox.afterpay.com/afterpay.js",i.async=!0,i.defer=!0,i.onload=function(){window.AfterPay.initialize({countryCode:r}),n.storageDispatcher.push({intent:Ki.WIDGET_SESSION,data:{token:n.token}},{onSuccess:function(){n.getCheckoutSession().then((function(e){window.AfterPay.redirect({token:e.ref_token})})).catch((function(e){window.AfterPay.close(),n.eventEmitter.emit(Nr.UNAVAILABLE,{err:e})}))},onError:function(){console.error("Error initializing Afterpay wallet"),window.AfterPay.close(),n.eventEmitter.emit(Nr.UNAVAILABLE,{})}})},document.head.appendChild(i)}},{key:"getCheckoutSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Nr.CALLBACK,{data:{request_type:"CREATE_SESSION",wallet_type:Ei.AFTERPAY},onSuccess:function(e){t(e)},onError:function(e){n(e)}})}))}},{key:"getButton",value:function(e){var t=document.createElement("button");return t.classList.add("afterpay-checkout-btn"),t.setAttribute("type","button"),t.innerHTML='\n <div class="afterpay-checkout-btn__wrapper">\n <svg viewBox="0 0 390 94"\n height="'.concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <g fill="currentColor">\n <path\n d="M388.6 21.4l-34.8 71.8h-14.4l13-26.8-20.5-45h14.8l13.2 30.1 14.3-30.1zM41 46.9c0-8.6-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4C11 73.2.4 62 .4 46.9c0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51H41.1zM114.6 61.1c-4.4 0-5.6-1.6-5.6-5.9V32.5h8.1V21.4H109V8.9H96.1v12.4H79.5v-5.1c0-4.3 1.6-5.9 6.1-5.9h2.8V.4h-6.2C71.6.4 66.6 3.9 66.6 14.5v6.8h-7.1v11.1h7.1v39.9h12.9V32.5h16.6v25c0 10.4 4 14.9 14.4 14.9h6.6V61.1h-2.5zM160.7 42.3c-.9-6.6-6.3-10.6-12.6-10.6s-11.5 3.9-12.9 10.6h25.5zm-25.6 7.9c.9 7.5 6.3 11.8 13.2 11.8 5.4 0 9.6-2.6 12-6.6h13.2c-3.1 10.8-12.7 17.7-25.5 17.7-15.4 0-26.2-10.8-26.2-26.2 0-15.4 11.4-26.5 26.5-26.5 15.2 0 26.2 11.2 26.2 26.5 0 1.1-.1 2.2-.3 3.3h-39.1zM256.2 46.9c0-8.3-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.4 13.9-14.6m-40.4 46.3V21.4h12.5V28c3.8-4.7 9.4-7.5 16.1-7.5 13.8 0 24.6 11.3 24.6 26.3s-11 26.4-24.9 26.4c-6.4 0-11.7-2.6-15.4-6.8v26.8h-12.9zM314.2 46.9c0-8.6-6.2-14.6-13.9-14.6-7.6 0-13.9 6.1-13.9 14.6 0 8.4 6.2 14.6 13.9 14.6s13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4-14 0-24.6-11.2-24.6-26.3 0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51h-12.5zM193.2 26.4s3.2-5.9 11-5.9c3.3 0 5.5 1.2 5.5 1.2v13s-4.7-2.9-9.1-2.3c-4.3.6-7.1 4.6-7.1 9.9v30.2h-13v-51H193v4.9h.2z" />\n </g>\n </svg>\n <svg viewBox="0 0 107 96"\n height="').concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <path\n d="M99 19.5L84.2 11l-15-8.6c-10-5.7-22.4 1.5-22.4 13v1.9c0 1.1.6 2 1.5 2.6l7 4c1.9 1.1 4.4-.3 4.4-2.5v-4.6c0-2.3 2.5-3.7 4.4-2.6l13.8 7.9L91.6 30c2 1.1 2 4 0 5.1L77.9 43l-13.8 7.9c-2 1.1-4.4-.3-4.4-2.6V46c0-11.5-12.4-18.7-22.4-13l-15 8.6-14.8 8.5c-10 5.7-10 20.2 0 26l14.8 8.5 15 8.6c10 5.7 22.4-1.5 22.4-13v-1.9c0-1.1-.6-2-1.5-2.6l-7-4c-1.9-1.1-4.4.3-4.4 2.5v4.6c0 2.3-2.5 3.7-4.4 2.6l-13.8-7.9-13.7-7.9c-2-1.1-2-4 0-5.1l13.7-7.9 13.8-7.9c2-1.1 4.4.3 4.4 2.6v2.3c0 11.5 12.4 18.7 22.4 13l15-8.6L99 45.5c10.1-5.8 10.1-20.2 0-26"\n fill="currentColor" />\n </svg>\n </div>\n '),t}},{key:"getButtonStyle",value:function(e){var t=document.createElement("style"),n=this.generateButtonColor(e.button_type);return t.innerText="\n .afterpay-checkout-btn {\n outline: none;\n border: none;\n border-radius: ".concat(this.getHeight(e),";\n padding: 0;\n margin: 0;\n transition: all 300ms;\n cursor: pointer;\n }\n\n .afterpay-checkout-btn:active {\n opacity: 0.7;\n }\n\n .afterpay-checkout-btn__wrapper {\n display: flex;\n align-items: center;\n padding: 10px 20px;\n color: ").concat(n.color,";\n background-color: ").concat(n.background,";\n border-radius: ").concat(this.getHeight(e),";\n }\n "),t}},{key:"generateButtonColor",value:function(e){switch(e){case"black":return{color:"#B2FCE3",background:"#000"};case"mint":return{color:"#000",background:"#B2FCE3"};default:return{color:"#fff",background:"#000"}}}},{key:"getHeight",value:function(e){return e.height?Number.isNaN(Number(e.height))?e.height:"".concat(e.height,"px"):"40px"}}])}(Or);var Zr=class{DEFAULT_WIDTH=450;DEFAULT_HEIGHT=750;DEFAULT_FEATURES={resizable:"no"};auth;callback;error;frame;isCheckoutOpen;onMessage;url;orderId;accessToken;refreshToken;clientId;onCheckoutClosed;rootUrl;targetOrigin;title;windowFeatures;windowObserver;constructor({auth:e,url:t,clientId:n,mode:i,orderId:r,onCheckoutClosed:o,onError:s,onTokensChanged:a,onPaymentSuccess:c,onPaymentError:l,title:u,windowFeatures:d}){this.callback={ERROR({error:e,orderId:t}){s?.({error:e,orderId:t})},PAYMENT_ERROR({error:e,orderId:t}){l?.({error:e,orderId:t})},PAYMENT_SUCCESS({orderId:e}){c?.({orderId:e})},TOKENS_CHANGED({accessToken:e,refreshToken:t}){a?.({accessToken:e,refreshToken:t})}},this.auth=e,this.isCheckoutOpen=!1,this.error=void 0,this.frame=void 0,this.onMessage=e=>{const{data:n,origin:i}=e;i===t&&(!0===n?.isDomReady&&this.postMessage(),n?.isPaymentSuccessful&&this.callback.PAYMENT_SUCCESS({orderId:n.orderId}),!n?.isPaymentSuccessful&&n?.error&&this.callback.PAYMENT_ERROR({orderId:n.orderId,error:n.error}),!n?.paymentFlowState&&n?.error&&this.callback.ERROR({orderId:n.orderId,error:n.error}),n?.accessToken&&n?.refreshToken&&this.callback.TOKENS_CHANGED({accessToken:n.accessToken,refreshToken:n.refreshToken}))};const h=i||"default";this.rootUrl=t,this.targetOrigin=window.location.href.replace(/\/$/,""),this.url=`${t}?orderId=${r}&merchantUrl=${encodeURIComponent(this.targetOrigin)}&mode=${h}`,this.orderId=r,this.clientId=n,this.onCheckoutClosed=o,this.title=u,this.windowFeatures=d,this.windowObserver=void 0}get isWindowObserverOpen(){return!!this.windowObserver}open=()=>{this.isCheckoutOpen?this.frame?.focus():(this.frame=window.open(this.url,this.title,this.getFeatures()),this.isCheckoutOpen=!0,this.startWindowObserver())};close=()=>{this.frame=void 0,this.isCheckoutOpen=!1,this.stopWindowObserver()};listenMessage=()=>{this.onMessage&&window.addEventListener("message",this.onMessage,!1)};postMessage=()=>{this.frame&&this.rootUrl&&this.frame.postMessage({auth:{...this.auth}},this.rootUrl)};getFeatures(){const e=this.windowFeatures?.width||this.DEFAULT_WIDTH,t=this.windowFeatures?.height||this.DEFAULT_HEIGHT,n={...this.DEFAULT_FEATURES,...this.windowFeatures};return function(e,t="="){return Object.keys(e).length?Object.entries(e).reduce(((e,[n,i])=>[...e,`${n}${t}${i}`]),[]).join(","):""}({...this.getCenteredPosition(e,t),...n,width:e,height:t})}getCenteredPosition(e,t){return{left:screen.width/2-e/2,top:screen.height/2-t/2}}startWindowObserver(){this.isWindowObserverOpen||(this.windowObserver=setInterval((()=>{this.frame?.closed&&(this.close(),this.onCheckoutClosed?.({orderId:this.orderId}),this.onMessage&&window.removeEventListener("message",this.onMessage))}),300))}stopWindowObserver(){clearInterval(this.windowObserver)}};var Jr=function(e){function n(e,i){var r;return s(this,n),(r=t(this,n,[e,i])).onFlypayV2ButtonClick=function(){var e=function(e){var t=document.getElementById("loading-overlay");t&&(t.style.display=e)};r.disable(),e("flex"),r.handleMerchantOnButtonClickEvent().then((function(){var t=function(t){var n;e("none"),r.background=r.initBackground(),r.orderId?(null===(n=r.background)||void 0===n||n.initControl(),r.flypayV2Checkout(r.orderId)):r.eventEmitter.emit(Nr.UNAVAILABLE)};r.orderId?t(r.orderId):r.getOrderId().then((function(e){r.orderId=e,t()})).catch((function(t){!function(t){var n;null===(n=r.background)||void 0===n||n.clear(),e("none"),r.enable(),r.eventEmitter.emit(Nr.UNAVAILABLE,{err:t})}(t)}))})).catch((function(t){e("none"),r.enable()}))},r.accessToken=null==i?void 0:i.access_token,r.refreshToken=null==i?void 0:i.refresh_token,r.link=new Kn(""),r}return d(n,e),c(n,[{key:"load",value:function(e){this.containerId=e.getSelector(),this.mount(e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),f(h(n.prototype),"setEnv",this).call(this,e)}},{key:"enable",value:function(){var e=document.getElementById("flypay-v2-button");e&&(e.disabled=!1,this.flypayV2Button.innerHTML='\n <div id="loading-overlay"></div>\n <div class="flypay-v2-checkout-btn__wrapper">\n <svg viewBox="0 0 384 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_34013_168361)">\n <rect width="384" height="48" rx="24" fill="#212121"/>\n <path d="M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z" fill="white"/>\n <path d="M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z" fill="white"/>\n <path d="M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z" fill="white"/>\n <path d="M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z" fill="white"/>\n <path d="M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z" fill="white"/>\n <path d="M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z" fill="white"/>\n <path d="M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z" fill="white"/>\n <path d="M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z" fill="white"/>\n <path d="M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z" fill="white"/>\n <path d="M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0_34013_168361">\n <rect width="384" height="48" rx="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ')}},{key:"disable",value:function(){var e=document.getElementById("flypay-v2-button");e&&(e.disabled=!0,this.flypayV2Button.innerHTML='\n <div id="loading-overlay"></div>\n <div class="flypay-v2-checkout-btn-disabled">\n <svg viewBox="0 0 384 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_34032_180021)">\n <rect x="0.5" y="0.5" width="383" height="47" rx="23.5" stroke="#212121"/>\n <path d="M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z" fill="#212121"/>\n <path d="M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z" fill="#212121"/>\n <path d="M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z" fill="#212121"/>\n <path d="M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z" fill="#212121"/>\n <path d="M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z" fill="#212121"/>\n <path d="M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z" fill="#212121"/>\n <path d="M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z" fill="#212121"/>\n <path d="M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z" fill="#212121"/>\n <path d="M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z" fill="#212121"/>\n <path d="M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z" fill="#212121"/>\n </g>\n <defs>\n <clipPath id="clip0_34032_180021">\n <rect width="384" height="48" rx="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ')}},{key:"mount",value:function(e){this.flypayV2Button=this.getButton(),this.flypayV2Button.onclick=this.onFlypayV2ButtonClick,e.getElement().appendChild(this.flypayV2Button)}},{key:"getButton",value:function(){var e,t=document.createElement("style");return t.innerHTML=(e=this.containerId,"\n ".concat(e,' {\n position: relative;\n }\n\n #loading-overlay {\n position: absolute;\n height: 100%;\n width: 100%;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n cursor: not-allowed; /* Make it look not clickable */\n }\n\n #loading-overlay::after {\n content: "";\n height: 60%;\n aspect-ratio: 1 / 1;\n display: inline-block;\n border: 4px solid #ccc;\n border-top-color: #333;\n border-radius: 50%;\n\n /* Vendor prefixes for animation property */\n -webkit-animation: spin 1s infinite linear;\n -moz-animation: spin 1s infinite linear;\n -o-animation: spin 1s infinite linear;\n animation: spin 1s infinite linear;\n }\n\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-moz-keyframes spin {\n 0% {\n -moz-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -moz-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-o-keyframes spin {\n 0% {\n -o-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -o-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n\n .flypay-v2-checkout-btn {\n width: 100%;\n height: fit-content;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: pointer; /* Make it look clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n\n .flypay-v2-checkout-btn-disabled {\n width: 100%;\n height: fit-content;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: not-allowed; /* Make it look not clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n ')),document.head.appendChild(t),this.flypayV2Button=document.createElement("button"),this.flypayV2Button.classList.add("flypay-v2-checkout-btn"),this.flypayV2Button.setAttribute("type","button"),this.flypayV2Button.setAttribute("aria-label","Pay with flypay"),this.flypayV2Button.setAttribute("id","flypay-v2-button"),this.flypayV2Button.innerHTML='\n <div id="loading-overlay"></div>\n <div class="flypay-v2-checkout-btn__wrapper">\n <svg viewBox="0 0 384 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_34013_168361)">\n <rect width="384" height="48" rx="24" fill="#212121"/>\n <path d="M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z" fill="white"/>\n <path d="M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z" fill="white"/>\n <path d="M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z" fill="white"/>\n <path d="M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z" fill="white"/>\n <path d="M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z" fill="white"/>\n <path d="M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z" fill="white"/>\n <path d="M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z" fill="white"/>\n <path d="M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z" fill="white"/>\n <path d="M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z" fill="white"/>\n <path d="M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0_34013_168361">\n <rect width="384" height="48" rx="24" fill="white"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ',this.flypayV2Button}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Nr.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"getOrderId",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Nr.CALLBACK,{data:{request_type:"CREATE_SESSION"},onSuccess:function(e){return t(e.id)},onError:function(e){return n(e.error)}})}))}},{key:"flypayV2Checkout",value:function(e){var t,n,i=this;this.checkout=new Zr(u(u({orderId:e},this.accessToken&&this.refreshToken&&{auth:{access_token:this.accessToken,refresh_token:this.refreshToken},mode:"express"}),{clientId:"live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"dbbd114e-3583-4db5-915e-59f1b3dcd08b":"924ac1ce-00f4-44e4-8277-06cae751ef1a",url:"live"===(null===(n=this.meta)||void 0===n?void 0:n.gateway_mode)?"https://checkout.cxbflypay.com.au":"https://checkout.sandbox.cxbflypay.com.au",onCheckoutClosed:function(){var e;i.eventEmitter.emit(Nr.CHECKOUT_CLOSE),null===(e=i.background)||void 0===e||e.clear(),i.enable()},onError:function(e){return i.eventEmitter.emit(Nr.PAYMENT_ERROR,{error:e})},onPaymentSuccess:function(e){return i.eventEmitter.emit(Nr.PAYMENT_SUCCESS,e)},onPaymentError:function(e){return i.eventEmitter.emit(Nr.PAYMENT_ERROR,{error:e})},onTokensChanged:function(e){var t=e.accessToken,n=e.refreshToken;i.accessToken=t,i.refreshToken=n,i.eventEmitter.emit(Nr.AUTH_TOKENS_CHANGED,{accessToken:t,refreshToken:n})}})),this.checkout.open(),this.checkout.isCheckoutOpen&&this.eventEmitter.emit(Nr.CHECKOUT_OPEN,{}),this.checkout.listenMessage()}},{key:"initBackground",value:function(){var e=this,t=new _r(this.link.getNetUrl()+Gn);return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Pi,(function(){var t;e.checkout.close(),null===(t=e.background)||void 0===t||t.clear(),e.enable()})),t}}])}(Or),Xr="unavailable",Qr="update",eo="paymentSuccessful",to="paymentError",no="paymentInReview",io="authTokensChanged",ro="onClick",oo="onCheckoutOpen",so="onCheckoutClose",ao=function(){return c((function e(t,n,i){s(this,e),this.hasUpdateHandler=!1;var r=X.validateJWT(n);if(!r)throw new Error("Invalid charge token");this.eventEmitter=new fi,this.container=new $n(t);var o=X.extractMeta(r.body);switch(this.api=new di(n,Ln.TOKEN),o.gateway.type){case bi.STRIPE:this.service=new qr(o.credentials.client_auth,u(u({},i),{amount:o.charge.amount,currency:o.charge.currency}));break;case bi.FLYPAY:this.service=new Ir(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}));break;case bi.FLYPAY_V2:this.service=new Jr(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}));break;case bi.PAYPAL:this.service=new Rr(o.credentials.client_auth,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,capture:o.charge.capture}));break;case bi.MASTERCARD:this.service=new Yr("",u(u({},i),{credentials:o.gateway.credentials,amount:o.charge.amount,currency:o.charge.currency,gateway_mode:o.gateway.mode}));break;case bi.AFTERPAY:this.service=new $r(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}))}}),[{key:"load",value:function(){try{this.setupServiceCallbacks(),this.service.load(this.container)}catch(e){throw this.eventEmitter.emit(Xr,null),e}}},{key:"update",value:function(e){this.service.update(e)}},{key:"setEnv",value:function(e,t){this.api.setEnv(e,t),this.service.setEnv(e)}},{key:"enable",value:function(){this.service.enable()}},{key:"disable",value:function(){this.service.disable()}},{key:"close",value:function(){"function"==typeof this.service.close&&this.service.close()}},{key:"on",value:function(e,t){var n=this;return e===Qr&&(this.hasUpdateHandler=!0),"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"onUnavailable",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(Xr,e):new Promise((function(e){return t.eventEmitter.subscribe(Xr,(function(){return e()}))}))}},{key:"onUpdate",value:function(e){var t=this;return this.hasUpdateHandler=!0,"function"==typeof e?this.eventEmitter.subscribe(Qr,e):new Promise((function(e){return t.eventEmitter.subscribe(Qr,(function(t){return e(t)}))}))}},{key:"onPaymentSuccessful",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(eo,e):new Promise((function(e){return t.eventEmitter.subscribe(eo,(function(t){return e(t)}))}))}},{key:"onPaymentInReview",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(no,e):new Promise((function(e){return t.eventEmitter.subscribe(no,(function(t){return e(t)}))}))}},{key:"onPaymentError",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(to,e):new Promise((function(e){return t.eventEmitter.subscribe(to,(function(t){return e(t)}))}))}},{key:"onAuthTokensChanged",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(io,e):new Promise((function(e){return t.eventEmitter.subscribe(io,(function(t){return e(t)}))}))}},{key:"onClick",value:function(e){if("function"==typeof e)return this.eventEmitter.subscribe(ro,e)}},{key:"onCheckoutOpen",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(oo,e):new Promise((function(e){return t.eventEmitter.subscribe(oo,(function(t){return e(t)}))}))}},{key:"onCheckoutClose",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(so,e):new Promise((function(e){return t.eventEmitter.subscribe(so,(function(t){return e(t)}))}))}},{key:"setupServiceCallbacks",value:function(){this.setupUnavailableCallback(),this.setupUpdateCallback(),this.setupWalletCallback(),this.setupPaymentCallback(),this.setupPaymentSuccessCallback(),this.setupPaymentInReviewCallback(),this.setupPaymentErrorCallback(),this.setupAuthTokensChangedCallback(),this.setupOnClickCallback(),this.setupOnCheckoutOpenCallback(),this.setupOnCheckoutCloseCallback()}},{key:"setupUnavailableCallback",value:function(){var e=this;this.service.on(Nr.UNAVAILABLE,(function(t){return e.eventEmitter.emit(Xr,{event:Xr,data:t})}))}},{key:"setupUpdateCallback",value:function(){var e=this;this.service.on(Nr.UPDATE,(function(t){return e.hasUpdateHandler?e.eventEmitter.emit(Qr,{event:Qr,data:t}):e.update({success:!0})}))}},{key:"setupOnClickCallback",value:function(){var e=this;this.service.on(Nr.BUTTON_CLICK,(function(t){return e.eventEmitter.emit(ro,{event:ro,data:t})}))}},{key:"setupOnCheckoutOpenCallback",value:function(){var e=this;this.service.on(Nr.CHECKOUT_OPEN,(function(t){return e.eventEmitter.emit(oo,{event:oo,data:t})}))}},{key:"setupOnCheckoutCloseCallback",value:function(){var e=this;this.service.on(Nr.CHECKOUT_CLOSE,(function(t){return e.eventEmitter.emit(so,{event:so,data:t})}))}},{key:"setupWalletCallback",value:function(){var e=this;this.service.on(Nr.CALLBACK,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCallback(n).then((function(e){return i(e)}),(function(e){return r(e.message)}))}))}},{key:"setupPaymentCallback",value:function(){var e=this;this.service.on(Nr.PAYMENT_METHOD_SELECTED,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCapture(n).then((function(t){"function"==typeof i&&i();var r="inreview"===t.status?no:eo;e.eventEmitter.emit(r,{event:r,data:u(u({},t),n.customer&&{payer_name:n.customer.payer_name,payer_email:n.customer.payer_email,payer_phone:n.customer.payer_phone})})}),(function(t){"function"==typeof r&&r(t),e.eventEmitter.emit(to,{event:to,data:t})}))}))}},{key:"setupPaymentSuccessCallback",value:function(){var e=this;this.service.on(Nr.PAYMENT_SUCCESS,(function(t){return e.eventEmitter.emit(eo,{event:eo,data:t})}))}},{key:"setupPaymentInReviewCallback",value:function(){var e=this;this.service.on(Nr.PAYMENT_IN_REVIEW,(function(t){return e.eventEmitter.emit(no,{event:no,data:t})}))}},{key:"setupPaymentErrorCallback",value:function(){var e=this;this.service.on(Nr.PAYMENT_ERROR,(function(t){return e.eventEmitter.emit(to,{event:to,data:t})}))}},{key:"setupAuthTokensChangedCallback",value:function(){var e=this;this.service.on(Nr.AUTH_TOKENS_CHANGED,(function(t){return e.eventEmitter.emit(io,{event:io,data:t})}))}}])}(),co={CARD:"card",GIFT_CARD:"gift_card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},lo={PAYMENT_SOURCE:"payment_source",CARD_PAYMENT_SOURCE_WITH_CVV:"card_payment_source_with_cvv",CARD_PAYMENT_SOURCE_WITHOUT_CVV:"card_payment_source_without_cvv"},uo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:co.CARD,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:lo.PAYMENT_SOURCE;if(s(this,e),-1===ur.values(co).indexOf(n))throw new Error("unsupported payment type");if(n===co.CHECKOUT)throw new Error('Payment type "checkout" is deprecated. Use CheckoutButton for this type of payments https://www.npmjs.com/package/@paydock/client-sdk#checkout-button');if(-1===ur.values(lo).indexOf(i))throw new Error("unsupported purpose");this.env=new Y(z),this.configs={purpose:i,meta:{},dynamic_fields_position:!0,predefined_fields:{gateway_id:t,type:n,card_scheme:null,card_processing_network:null}}}return c(e,[{key:"setWebHookDestination",value:function(e){this.configs.webhook_destination=e}},{key:"setSuccessRedirectUrl",value:function(e){this.configs.success_redirect_url=e}},{key:"setErrorRedirectUrl",value:function(e){this.configs.error_redirect_url=e}},{key:"setFormFields",value:function(e){for(var t in Array.isArray(this.configs.defined_form_fields)||(this.configs.defined_form_fields=[]),e)e.hasOwnProperty(t)&&(-1!==ur.values(Si).indexOf(e[t].replace("*",""))?this.configs.defined_form_fields.push(e[t]):console.warn("Configuration::setFormFields: unsupported form field ".concat(e[t])))}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Oi.indexOf(t)?this.configs.meta[t]=e[t]:console.warn("Configuration::setMeta: unsupported meta key ".concat(t)))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"setLabel",value:function(e){this.configs.label=e}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"createToken",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.send(e,(function(e,i){if(i>=200&&i<300)return t(e.resource.data.configuration_token);void 0===e.error||void 0===e.error.message?n("unknown error"):n(e.error.message)}))}},{key:"send",value:function(e,t){var n=Q.create("POST",this.getUrl()).setHeader(X.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();n.onload=function(){var e={};try{e=JSON.parse(n.responseText)}catch(e){}t(e,n.status)},n.send(JSON.stringify(this.getConfigs()))}},{key:"getConfigs",value:function(){return this.configs}},{key:"getUrl",value:function(){return this.env.getConf().url+"/v1/remote-action/configs"}},{key:"setGiftCardSchemeData",value:function(e,t){if(this.configs.predefined_fields.type!==co.GIFT_CARD)throw new Error("unsupported payment type");if(!e||!t)throw new Error("");this.configs.predefined_fields.card_scheme=e,this.configs.predefined_fields.card_processing_network=t}}],[{key:"createEachToken",value:function(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){},o=new Array(n.length),s=[],a=0,c=function(c){n.hasOwnProperty(c)&&n[c].createToken(t,(function(t){o[c]=t,a++,n.length===a&&e.finishCreatingEachToken(o,s,i,r)}),(function(t){s.push("gateway: ".concat(n[c].getConfigs().predefined_fields.gateway_id," | ").concat(t)),a++,n.length===a&&e.finishCreatingEachToken(o,s,i,r)}))};for(var l in n)c(l)}},{key:"finishCreatingEachToken",value:function(e,t,n,i){t.length>=1?i(t):n(e)}}])}(),ho={INPUT:"input",SUBMIT_BUTTON:"submit_button",LABEL:"label",TITLE:"title",TITLE_DESCRIPTION:"title_description"},po={ERROR:"error",FOCUS:"focus",HOVER:"hover"},fo=[{element:ho.INPUT,states:[po.FOCUS,po.ERROR],styles:["color","border","border_radius","background_color","height","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition"]},{element:ho.SUBMIT_BUTTON,states:[po.HOVER],styles:["color","border","border_radius","background_color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition","opacity"]},{element:ho.LABEL,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin"]},{element:ho.TITLE,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]},{element:ho.TITLE_DESCRIPTION,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]}],mo=function(){return c((function e(){s(this,e)}),null,[{key:"check",value:function(e,t,n,i){for(var r in e)if(e.hasOwnProperty(r)&&e[r].element===t){if(-1===e[r].states.indexOf(n)&&n)return!1;for(var o in i)if(i.hasOwnProperty(o)&&-1===e[r].styles.indexOf(o.replace("-","_")))return!1;return!0}return!1}},{key:"encode",value:function(e,t,n){var i=[];for(var r in n)n.hasOwnProperty(r)&&i.push("".concat(r.replace("_","-"),":").concat(n[r]));var o=i.join(";");return t?"".concat(e,"::").concat(t,"{").concat(o,"}"):"".concat(e,"{").concat(o,"}")}},{key:"decode",value:function(e){var t=(e.match("::(.*){")||["",null])[1],n=null!==t?(e.match("(.*)::")||["",""])[1].trim():(e.match("(.*){")||["",""])[1].trim(),i=(e.match("{(.*)}")||["",""])[1].split(";"),r={};for(var o in i)if(i.hasOwnProperty(o)){var s=i[o].split(":");(s||2===s.length)&&(r[s[0].trim()]=(s[1]||"").trim())}return{element:n,state:t,styles:r}}}])}(),vo=function(){return c((function e(t,n){if(s(this,e),this.configs=[],this.configTokens=[],this.link=new Kn("/remote-action"),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type}),X.validateJWT(t)?this.link.setParams({token:t}):this.link.setParams({public_key:t}),this.accessToken=t,!n||Array.isArray(n)&&!n.length)throw Error("configuration token is required");if("string"==typeof n)this.configTokens.push(n);else if(n instanceof uo)this.configs.push(n);else if(Array.isArray(n)&&"string"==typeof n[0])this.configTokens=n;else{if(!(Array.isArray(n)&&n[0]instanceof uo))throw Error("Unsupported type of configuration token");this.configs=n}}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"usePhoneCountryMask",value:function(e){return e?!e.only_countries||/^[a-z]+$/.test(e.only_countries.join(""))&&2*e.only_countries.length===e.only_countries.join("").length?!e.preferred_countries||/^[a-z]+$/.test(e.preferred_countries.join(""))&&2*e.preferred_countries.length===e.preferred_countries.join("").length?e.default_country&&2!==e.default_country.length?console.warn("Widget::usePhoneCountryMask[s: default_country - incorrect value length"):(this.link.setParams({use_country_phone_mask:!0}),e.only_countries&&this.link.setParams({phone_mask_only_countries:e.only_countries.join(",")}),e.preferred_countries&&this.link.setParams({phone_mask_preferred_countries:e.preferred_countries.join(",")}),void(e.default_country&&this.link.setParams({phone_mask_default_country:e.default_country}))):console.warn("Widget::usePhoneCountryMask[s: preferred_countries - unsupported symbols or incorrect length of value"):console.warn("Widget::usePhoneCountryMask[s: only_countries - unsupported symbols or incorrect length of value"):this.link.setParams({use_country_phone_mask:!0})}},{key:"setStyle",value:function(e,t){-1!==ur.values(Ci).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setTexts",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setText(t,e[t])}},{key:"setText",value:function(e,t){-1!==ur.values(Ti).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setText[s: unsupported text param ".concat(e))}},{key:"setElementStyle",value:function(e,t,n){var i=3===arguments.length?t:null,r=3===arguments.length?n:t;if(!mo.check(fo,e,i,r))return console.warn('Styles for "'.concat(e,'" element with "').concat(i||"default",'" state was ignored because some of the arguments are unacceptable'));this.link.concatParams({element_styles:mo.encode(e,i,r)})}},{key:"setFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormValue(t,e[t])}},{key:"setFormValue",value:function(e,t){return-1===ur.values(Si).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void("string"==typeof this.link.getParams().form_values&&this.link.getParams().form_values.length?this.link.setParams({form_values:"".concat(this.link.getParams().form_values,",").concat(e,":").concat(t)}):this.link.setParams({form_values:"".concat(e,":").concat(t)}))}},{key:"setFormLabels",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormLabel(t,e[t])}},{key:"setFormLabel",value:function(e,t){if(-1===ur.values(Si).indexOf(e))return console.warn("Widget::setFormLabel[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormLabel[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_labels:"".concat(e,":").concat(n)})}},{key:"setFormPlaceholders",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormPlaceholder(t,e[t])}},{key:"setFormPlaceholder",value:function(e,t){if(-1===ur.values(Si).indexOf(e))return console.warn("Widget::setFormPlaceholder[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormPlaceholder[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_placeholders:"".concat(e,":").concat(n)})}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){e.value&&this.setFormValue(e.field,e.value),e.label&&this.setFormLabel(e.field,e.label),e.placeholder&&this.setFormPlaceholder(e.field,e.placeholder)}},{key:"setIcons",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setIcon(t,e[t])}},{key:"setIcon",value:function(e,t){if(/\,/.test(t)||/\:/.test(t))return console.warn("Widget::setIcon[s: ".concat(e," - unsupported symbols (: or ,) in value"));"string"==typeof this.link.getParams().icons&&this.link.getParams().icons.length?this.link.setParams({icons:"".concat(this.link.getParams().icons,",").concat(e,":").concat(t)}):this.link.setParams({icons:"".concat(e,":").concat(t)})}},{key:"setHiddenElements",value:function(e){var t=[],n=ur.values(_i).concat(ur.values(Si));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::setHiddenElements: unsupported element ".concat(e[i])));t.length&&this.link.concatParams({hidden_elements:t.join(",")})}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"useGatewayFieldValidation",value:function(){this.link.setParams({fields_validation:!0})}},{key:"setSupportedCardIcons",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(-1!==ur.values(Ni).indexOf(e[i])?n.push(e[i]):console.warn("Widget::cardTypes: unsupported type of cards ".concat(e[i])));n.length&&this.link.concatParams({supported_card_types:n.join(",")}),t&&this.link.setParams({validate_card_types:t})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"loadIFrameUrl",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){};if(this.link.setParams({configuration_tokens:""}),this.configTokens.length)return this.link.setParams({configuration_tokens:this.configTokens.join(",")}),e(this.link.getUrl());uo.createEachToken(this.accessToken,this.configs,(function(n){return t.link.concatParams({configuration_tokens:n.join(",")}),e(t.link.getUrl())}),(function(e){n(e)}))}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),go=function(){return c((function e(t){s(this,e),this.intercepted=!1,this.selector=t}),[{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"beforeSubmit",value:function(e){var t=this;this.isExist()&&this.subscribe(this.getElement(),(function(n){n.preventDefault(),t.intercepted=!0,e.apply(t,[])}))}},{key:"continueSubmit",value:function(){var e=this;this.isExist()&&this.intercepted&&(this.intercepted=!1,setTimeout((function(){e.getElement().submit()}),50))}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("submit",t):e.attachEvent("onsubmit",t)}}])}(),yo=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n,[i,r])).validationData={},o.container=new $n(e),o.iFrame=new Zn(o.container),o.triggerElement=new br(o.iFrame),o.event=new Xn(window),o}return d(n,e),c(n,[{key:"load",value:function(){var e=this;this.setStyles(this.container.getStyles(ur.values(Ci))),this.setTexts(this.container.getAttr(ur.values(Ti))),this.loadIFrameUrl((function(t){e.iFrame.load(t,{title:"Card details"}),e.afterLoad()}),(function(e){for(var t in console.error("Errors when creating a token[s, widget will not be load:"),e)e.hasOwnProperty(t)&&console.error("--- | ".concat(e[t]))}))}},{key:"afterLoad",value:function(){var e=this;this.on(Jn.VALIDATION,(function(t){e.validationData=t}))}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.triggerElement.push(e,t)}},{key:"getValidationState",value:function(){return this.validationData}},{key:"isValidForm",value:function(){return!!this.validationData.form_valid}},{key:"isInvalidField",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_fields&&-1!==this.validationData.invalid_fields.indexOf(e)}},{key:"isFieldErrorShowed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_showed_fields&&-1!==this.validationData.invalid_showed_fields.indexOf(e)}},{key:"isInvalidFieldByValidator",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=!1;if(!this.validationData.validators)return n;var i=this.validationData.validators[t];return i?-1!==i.indexOf(e):n}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"hideElements",value:function(e){var t=[],n=ur.values(_i).concat(ur.values(Si));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::hideElements: unsupported element ".concat(e[i])));t.length&&this.trigger(yr.HIDE_ELEMENTS,{elements:t.join(",")})}},{key:"showElements",value:function(e){var t=[],n=ur.values(_i).concat(ur.values(Si));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::showElements: unsupported element ".concat(e[i])));t.length&&this.trigger(yr.SHOW_ELEMENTS,{elements:t.join(",")})}},{key:"updateFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.updateFormValue(t,e[t])}},{key:"updateFormValue",value:function(e,t){return-1===ur.values(Si).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void this.trigger(yr.UPDATE_FORM_VALUES,{form_values:"".concat(e,":").concat(t)})}},{key:"onFinishInsert",value:function(e,t){this.on(Jn.FINISH,(function(n){Yn.insertToInput(e,t,n)}))}},{key:"interceptSubmitForm",value:function(e){var t=this;this.setHiddenElements([_i.SUBMIT_BUTTON]);var n=new go(e);n.beforeSubmit((function(){t.triggerElement.push(yr.SUBMIT_FORM,{}),t.event.on(Jn.FINISH,t.link.getParams().widget_id,(function(){n.continueSubmit()}))}))}},{key:"useCheckoutAutoSubmit",value:function(){var e=this;this.setHiddenElements([_i.SUBMIT_BUTTON]),this.on(Jn.CHECKOUT_SUCCESS,(function(t){e.trigger(yr.SUBMIT_FORM)})),this.on(Jn.VALIDATION_ERROR,(function(t){e.trigger(yr.REFRESH_CHECKOUT)})),this.on(Jn.SYSTEM_ERROR,(function(t){e.trigger(yr.REFRESH_CHECKOUT)}))}},{key:"useAutoResize",value:function(){var e=this;this.on(Jn.RESIZE,(function(t){e.iFrame.getElement()&&(e.iFrame.getElement().scrolling="no",t.height&&e.iFrame.setStyle("height",t.height+"px"))}))}}])}(vo),bo=function(e){function n(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return s(this,n),t(this,n,[e,i,new uo(r,o,a)])}return d(n,e),c(n,[{key:"setWebHookDestination",value:function(e){this.configs[0].setWebHookDestination(e)}},{key:"setSuccessRedirectUrl",value:function(e){this.configs[0].setSuccessRedirectUrl(e)}},{key:"setErrorRedirectUrl",value:function(e){this.configs[0].setErrorRedirectUrl(e)}},{key:"setFormFields",value:function(e){this.configs[0].setFormFields(e)}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){this.configs[0].setFormFields([e.field]),f(h(n.prototype),"setFormElement",this).call(this,u(u({},e),{field:e.field.replace("*","")}))}},{key:"setMeta",value:function(e){this.configs[0].setMeta(e)}},{key:"setGiftCardScheme",value:function(e,t){this.configs[0].setGiftCardSchemeData(e,t)}}])}(yo);class Eo{constructor(e,t){if(!e.onEnd)throw new Error("onEnd handler is required");if(!t)throw new Error("ms duration is required");this.onEnd=e.onEnd,this.initialMs=t,this.startTimestamp=Date.now(),this.timer=this.create(this.onEnd,t)}create(e,t){return this.timer&&this.clear(),setTimeout((()=>e?e():this.onEnd()),t||this.initialMs)}clear(){clearTimeout(this.timer),this.timer=null}end(){this.clear(),this.onEnd()}isValid(){return this.initialMs-(Date.now()-this.startTimestamp)>0}}function wo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Ot("visibilitychange",(function(){if(t)return void("hidden"===document.visibilityState&&e());e(document.visibilityState)}),arguments.length>2?arguments[2]:void 0,arguments.length>3?arguments[3]:void 0)}class ko extends Eo{constructor(e,t){super(e,t),this.onPause="function"==typeof e.onPause?e.onPause:()=>{},this.onRefresh="function"==typeof e.onRefresh?e.onRefresh:()=>{},this.onResume="function"==typeof e.onResume?e.onResume:()=>{},this.readStorage=e.readStorage,this.remainingMs=void 0,e.refreshEvents||(e.refreshEvents=["click","keydown","scroll"]);try{this.abortController=new AbortController}catch(e){}if(te&&e.ee){if(e.ee){this.ee=e.ee;const t=function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=i?.leading||!1;let o;return function(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r&&void 0===o&&(e.apply(t,s),o=setTimeout((()=>{o=clearTimeout(o)}),n)),r||(clearTimeout(o),o=setTimeout((()=>{e.apply(t,s)}),n))}}(this.refresh.bind(this),500,{leading:!0});this.refreshHandler=n=>{e.refreshEvents.includes(n?.[0]?.type)&&t()},e.ee.on("fn-end",this.refreshHandler)}wo((e=>{"hidden"===e?this.pause():this.resume()}),!1,!1,this.abortController?.signal)}}abort(){this.clear(),this.abortController?.abort(),this.refreshHandler&&(this.ee.removeEventListener("fn-end",this.refreshHandler),this.refreshHandler=this.ee=null)}pause(){this.onPause(),clearTimeout(this.timer),this.remainingMs=this.initialMs-(Date.now()-this.startTimestamp)}resume(){try{const t=this.readStorage(),n="string"==typeof t?JSON.parse(t):t;e(n.expiresAt)||e(n.inactiveAt)?this.end():(this.refresh(),this.onResume())}catch(e){this.end()}function e(e){return Date.now()>e}}refresh(e,t){this.clear(),this.timer=this.create(e,t),this.startTimestamp=Date.now(),this.remainingMs=void 0,this.onRefresh()}}const So="nr@original:".concat(it);var Co=Object.prototype.hasOwnProperty,To=!1;function _o(e,t){return e||(e=ot),n.inPlace=function(e,t,i,r,o){i||(i="");const s="-"===i.charAt(0);for(let a=0;a<t.length;a++){const c=t[a],l=e[c];Oo(l)||(e[c]=n(l,s?c+i:i,r,c,o))}},n.flag=So,n;function n(t,n,r,o,s){return Oo(t)?t:(n||(n=""),a[So]=t,function(e,t,n){if(Object.defineProperty&&Object.keys)try{return Object.keys(e).forEach((function(n){Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){return e[n]=t,t}})})),t}catch(e){No([e],n)}for(var i in e)Co.call(e,i)&&(t[i]=e[i])}(t,a,e),a);function a(){var a,c,l,u;try{c=this,a=[...arguments],l="function"==typeof r?r(a,c):r||{}}catch(t){No([t,"",[a,c,o],l],e)}i(n+"start",[a,c,o],l,s);try{return u=t.apply(c,a)}catch(e){throw i(n+"err",[a,c,e],l,s),e}finally{i(n+"end",[a,c,u],l,s)}}}function i(n,i,r,o){if(!To||t){var s=To;To=!0;try{e.emit(n,i,r,t,o)}catch(t){No([t,n,i,r],e)}To=s}}}function No(e,t){t||(t=ot);try{t.emit("internal-error",e)}catch(e){}}function Oo(e){return!(e&&"function"==typeof e&&e.apply&&!e[So])}const Io={},Ro=ie.XMLHttpRequest,Ao="addEventListener",xo="removeEventListener",Mo="nr@wrapped:".concat(rt);function Lo(e){var t=function(e){return(e||ot).get("events")}(e);if(Io[t.debugId]++)return t;Io[t.debugId]=1;var n=_o(t,!0);function i(e){n.inPlace(e,[Ao,xo],"-",r)}function r(e,t){return e[1]}return"getPrototypeOf"in Object&&(te&&Po(document,i),Po(ie,i),Po(Ro.prototype,i)),t.on(Ao+"-start",(function(e,t){var i=e[1];if(null!==i&&("function"==typeof i||"object"==typeof i)){var r=be(i,Mo,(function(){var e={object:function(){if("function"!=typeof i.handleEvent)return;return i.handleEvent.apply(i,arguments)},function:i}[typeof i];return e?n(e,"fn-",null,e.name||"anonymous"):i}));this.wrapped=e[1]=r}})),t.on(xo+"-start",(function(e){e[1]=this.wrapped||e[1]})),t}function Po(e,t){let n=e;for(;"object"==typeof n&&!Object.prototype.hasOwnProperty.call(n,Ao);)n=Object.getPrototypeOf(n);for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];n&&t(n,...r)}const Do={value:"",inactiveAt:0,expiresAt:0,updatedAt:Date.now(),sessionReplayMode:De.OFF,sessionReplaySentFirstChunk:!1,sessionTraceMode:De.OFF,traceHarvestStarted:!1,serverTimeDiff:null,custom:{}};class Fo{constructor(e){const{agentIdentifier:t,key:n,storage:i}=e;if(!t||!n||!i)throw new Error("Missing required field(s):".concat(t?"":" agentID").concat(n?"":" key").concat(i?"":" storage"));this.agentIdentifier=t,this.storage=i,this.state={},this.key=n,this.ee=ot.get(t),Lo(this.ee),this.setup(e),te&&Nt("storage",(e=>{if(e.key===this.lookupKey){const t="string"==typeof e.newValue?JSON.parse(e.newValue):e.newValue;this.sync(t),this.ee.emit(Me,[Pe,this.state])}}))}setup(e){let{value:t=nt(16),expiresMs:n=Ne,inactiveMs:i=Oe}=e;const r={serverTimeDiff:this.state.serverTimeDiff||Do.serverTimeDiff};this.state={},this.sync({...Do,...r}),this.state.value=t,this.expiresMs=n,this.inactiveMs=i;const o=this.read();n?(this.state.expiresAt=o?.expiresAt||this.getFutureTimestamp(n),this.expiresTimer=new Eo({onEnd:()=>{this.collectSM("expired"),this.collectSM("duration"),this.reset()}},this.state.expiresAt-Date.now())):this.state.expiresAt=1/0,i?(this.state.inactiveAt=o?.inactiveAt||this.getFutureTimestamp(i),this.inactiveTimer=new ko({onEnd:()=>{this.collectSM("inactive"),this.collectSM("duration"),this.reset()},onRefresh:this.refresh.bind(this),onResume:()=>{this.ee.emit(xe)},onPause:()=>{this.initialized&&this.ee.emit(Re),this.write(we(this.state,Do))},ee:this.ee,refreshEvents:["click","keydown","scroll"],readStorage:()=>this.storage.get(this.lookupKey)},this.state.inactiveAt-Date.now())):this.state.inactiveAt=1/0,this.isNew||=!Object.keys(o).length,this.isNew?this.write(we(this.state,Do),!0):this.sync(o),this.initialized=!0,this.ee.emit(Ie,[this.isNew])}get lookupKey(){return"".concat("NRBA","_").concat(this.key)}sync(e){Object.assign(this.state,e)}read(){try{const e=this.storage.get(this.lookupKey);if(!e)return{};const t="string"==typeof e?JSON.parse(e):e;return this.isInvalid(t)?{}:this.isExpired(t.expiresAt)?(this.collectSM("expired"),this.collectSM("duration",t,!0),this.reset()):this.isExpired(t.inactiveAt)?(this.collectSM("inactive"),this.collectSM("duration",t,!0),this.reset()):t}catch(e){return Ee("Failed to read from storage API",e),{}}}write(e){try{if(!e||"object"!=typeof e)return;return e.updatedAt=Date.now(),this.sync(e),this.storage.set(this.lookupKey,Zt(this.state)),this.ee.emit(Me,[Le,this.state]),e}catch(e){return Ee("Failed to write to the storage API",e),null}}reset(){try{return this.initialized&&this.ee.emit(Ae),this.storage.remove(this.lookupKey),this.inactiveTimer?.abort?.(),this.expiresTimer?.clear?.(),delete this.isNew,this.setup({agentIdentifier:this.agentIdentifier,key:this.key,storage:this.storage,expiresMs:this.expiresMs,inactiveMs:this.inactiveMs}),this.read()}catch(e){return{}}}refresh(){const e=this.read();this.write({...e,inactiveAt:this.getFutureTimestamp(this.inactiveMs)})}isExpired(e){return Date.now()>e}isInvalid(e){return!Object.keys(Do).every((t=>Object.keys(e).includes(t)))}collectSM(e,t,n){let i,r;"duration"===e&&(i=this.getDuration(t,n),r="Session/Duration/Ms"),"expired"===e&&(r="Session/Expired/Seen"),"inactive"===e&&(r="Session/Inactive/Seen"),r&&ct(ln,[r,i],void 0,pt.metrics,this.ee)}getDuration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=arguments.length>1?arguments[1]:void 0;const n=e.expiresAt-this.expiresMs;return(t?Date.now():e.updatedAt)-n}getFutureTimestamp(e){return Date.now()+e}syncCustomAttribute(e,t){if(te)if(null===t){const t=this.read();t.custom&&(delete t.custom[e],this.write({...t}))}else{const n=this.read();this.custom={...n?.custom||{},[e]:t},this.write({...n,custom:this.custom})}}}class Uo{get(e){try{return localStorage.getItem(e)||void 0}catch(e){return""}}set(e,t){try{return null==t?this.remove(e):localStorage.setItem(e,t)}catch(e){}}remove(e){try{localStorage.removeItem(e)}catch(e){}}}let Ho=0;var jo=Object.freeze({__proto__:null,setupAgentSession:function(e){const t=Je(e);if(Ho++)return t.session;const n=Be(e).session;t.session=new Fo({agentIdentifier:e,key:"SESSION",storage:new Uo,expiresMs:n?.expiresMs,inactiveMs:n?.inactiveMs});const i=t.session.state.custom,r=Ce(e);i&&(r.jsAttributes={...r.jsAttributes,...i});const o=ot.get(e);return dt("api-setCustomAttribute",((e,n,i)=>{t.session.syncCustomAttribute(n,i)}),"session",o),dt("api-setUserId",((e,n,i)=>{t.session.syncCustomAttribute(n,i)}),"session",o),bt(e,"session"),t.session}});var Bo=Object.freeze({__proto__:null,lazyFeatureLoader:function(e,t){if("aggregate"===t)switch(e){case pt.ajax:return Promise.resolve().then((function(){return Rs}));case pt.jserrors:return Promise.resolve().then((function(){return qs}));case pt.metrics:return Promise.resolve().then((function(){return ha}));case pt.pageAction:return Promise.resolve().then((function(){return pa}));case pt.pageViewEvent:return Promise.resolve().then((function(){return Bc}));case pt.pageViewTiming:return Promise.resolve().then((function(){return Yc}));case pt.sessionReplay:return Promise.resolve().then((function(){return Qc}));case pt.sessionTrace:return Promise.resolve().then((function(){return al}));case pt.spa:return Promise.resolve().then((function(){return Ul}));case pt.softNav:return Promise.resolve().then((function(){return Ql}));default:throw new Error("Attempted to load unsupported agent feature: ".concat(e," ").concat(t))}}});var Vo=Object.freeze({__proto__:null,setAPI:function(e){var t=ot.get(e),n={finished:Lt((function(e,n){var r=n?n-de:e;ct(un,["finished",{time:r}],void 0,pt.metrics,t),i(e,{name:"finished",start:r+de,origin:"nr"}),ct("api-addPageAction",[r,"finished"],void 0,pt.pageAction,t)})),setErrorHandler:function(t,n){Je(e).onerror=n},addToTrace:i,addRelease:function(t,n,i){if(++r>10)return;Je(e).releaseIds[n.slice(-200)]=(""+i).slice(-200)}};function i(e,n){n&&"object"==typeof n&&n.name&&n.start&&ct("bstApi",[{n:n.name,s:n.start-de,e:(n.end||n.start)-de,o:n.origin||"",t:"api"}],void 0,pt.sessionTrace,t)}Object.entries(n).forEach((e=>{let[n,i]=e;return dt("api-"+n,i,"api",t)}));var r=0}});
15
+ /**
16
+ * @file Contains common methods used to transmit harvested data.
17
+ * @copyright 2023 New Relic Corporation. All rights reserved.
18
+ * @license Apache-2.0
19
+ */function zo(){let{isFinalHarvest:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e&&te&&ue?qo:Wo}function Wo(e){let{url:t,body:n=null,sync:i,method:r="POST",headers:o=[{key:"content-type",value:"text/plain"}]}=e;const s=new XMLHttpRequest;s.open(r,t,!i);try{"withCredentials"in s&&(s.withCredentials=!0)}catch(e){}return o.forEach((e=>{s.setRequestHeader(e.key,e.value)})),s.send(n),s}function qo(e){let{url:t,body:n}=e;try{return window.navigator.sendBeacon.bind(window.navigator)(t,n)}catch(e){return!1}}var Go={"%2C":",","%3A":":","%2F":"/","%40":"@","%24":"$","%3B":";"},Ko=lt(Go,(function(e){return e})),Yo=new RegExp(Ko.join("|"),"g");function $o(e){return Go[e]}function Zo(e){return null==e?"null":encodeURIComponent(e).replace(Yo,$o)}function Jo(e,t){var n=0,i="";return lt(e,(function(e,r){var o,s,a=[];if("string"==typeof r||!Array.isArray(r)&&null!=r&&r.toString().length)o="&"+e+"="+Zo(r),n+=o.length,i+=o;else if(Array.isArray(r)&&r.length){for(n+=9,s=0;s<r.length&&(o=Zo(Zt(r[s])),n+=o.length,!(void 0!==t&&n>=t));s++)a.push(o);i+="&"+e+"=%5B"+a.join(",")+"%5D"}})),i}function Xo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(n).includes(e)?"":t&&"string"==typeof t?"&"+e+"="+Zo(t):""}function Qo(){return""+location}var es=/([^?#]*)[^#]*(#[^?]*|$).*/,ts=/([^?#]*)().*/;function ns(e,t){return e.replace(t?es:ts,"$1$2")}function is(){return Boolean("file:"===ie?.location?.protocol)}var rs={regex:/^file:\/\/(.*)/,replacement:atob("ZmlsZTovL09CRlVTQ0FURUQ=")};class os extends kn{shouldObfuscate(){return ss(this.sharedContext.agentIdentifier).length>0}obfuscateString(e){if(!e||"string"!=typeof e)return e;for(var t=ss(this.sharedContext.agentIdentifier),n=e,i=0;i<t.length;i++){var r=t[i].regex,o=t[i].replacement||"*";n=n.replace(r,o)}return n}}function ss(e){var t=[],n=Ve(e,"obfuscate")||[];return t=t.concat(n),is()&&t.push(rs),t}function as(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return e&&"object"==typeof e?(Object.keys(e).forEach((r=>{"object"==typeof e[r]?as(e[r],t,n,i):typeof e[r]!==n||i.includes(r)||(e[r]=t(e[r]))})),e):e}const cs={};class ls extends kn{constructor(e){super(e),this.tooManyRequestsDelay=Ve(this.sharedContext.agentIdentifier,"harvest.tooManyRequestsDelay")||60,this.obfuscator=new os(this.sharedContext),this._events={}}sendX(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=zo({isFinalHarvest:e.opts?.unload}),n={retry:!e.opts?.unload&&t===Wo,isFinalHarvest:!0===e.opts?.unload},i=this.createPayload(e.endpoint,n);return(this.obfuscator.shouldObfuscate()?this.obfuscateAndSend.bind(this):this._send.bind(this))({...e,payload:i,submitMethod:t})}send(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(this.obfuscator.shouldObfuscate()?this.obfuscateAndSend.bind(this):this._send.bind(this))(e)}obfuscateAndSend(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{payload:n={}}=t;return as(n,(function(){return e.obfuscator.obfuscateString(...arguments)}),"string",["e"]),this._send({...t,payload:n})}_send(e){let{endpoint:t,payload:n={},opts:i={},submitMethod:r,cbFinished:o,customUrl:s,raw:a,includeBaseParams:c=!0}=e;const l=Ce(this.sharedContext.agentIdentifier);if(!l.errorBeacon)return!1;const u=Je(this.sharedContext.agentIdentifier);let{body:d,qs:h}=this.cleanPayload(n);if(0===Object.keys(d).length&&!i?.sendEmptyBody)return o&&o({sent:!1}),!1;const p=Be(this.sharedContext.agentIdentifier),f=!1===p.ssl?"http":"https",m=p.proxy.beacon||l.errorBeacon,v="rum"!==t?"/".concat(t):"";let g="".concat(f,"://").concat(m).concat(v,"/1/").concat(l.licenseKey);s&&(g=s),a&&(g="".concat(f,"://").concat(m,"/").concat(t));const y=!a&&c?this.baseQueryString(h,t):"";let b=Jo(h,u.maxBytes);r||(r=zo({isFinalHarvest:i.unload})),""===y&&b.startsWith("&")&&(b=b.substring(1));const E="".concat(g,"?").concat(y).concat(b);!!h?.attributes?.includes("gzip")||(d="events"===t?d.e:Zt(d),d.length>75e4&&1===(cs[t]=(cs?.[t]||0)+1)&&Ee("The Browser Agent is attempting to send a very large payload to /".concat(t,". This is usually tied to large amounts of custom attributes. Please check your configurations."))),d&&0!==d.length&&"{}"!==d&&"[]"!==d||(d="");const w=[];w.push({key:"content-type",value:"text/plain"});let k=r({url:E,body:d,sync:i.unload&&(ne||le),headers:w});if(!i.unload&&o&&r===Wo){const e=this;k.addEventListener("loadend",(function(){const t={sent:0!==this.status,status:this.status,xhr:this,fullUrl:E};429===this.status?(t.retry=!0,t.delay=e.tooManyRequestsDelay):408!==this.status&&500!==this.status&&503!==this.status||(t.retry=!0),i.needResponse&&(t.responseText=this.responseText),o(t)}),_t(!1))}return Je(this.sharedContext.agentIdentifier).harvestCount++,k}baseQueryString(e,t){const n=Je(this.sharedContext.agentIdentifier),i=Ce(this.sharedContext.agentIdentifier),r=ns(Qo()),o=this.obfuscator.shouldObfuscate()?this.obfuscator.obfuscateString(r):r,s=1===n?.session?.state.sessionReplayMode&&"jserrors"!==t,a=["a="+i.applicationID,Xo("sa",i.sa?""+i.sa:""),Xo("v",Ke),us(i),Xo("ct",n.customTransaction),"&rst="+he(),"&ck=0","&s="+(n.session?.state.value||"0"),Xo("ref",o),Xo("ptid",n.ptid?""+n.ptid:"")];return s&&a.push(Xo("hr","1",e)),a.join("")}createPayload(e,t){const n=this._events[e],i={body:{},qs:{}};if(Array.isArray(n)&&n.length>0)for(let e=0;e<n.length;e++){const r=n[e](t);r&&(i.body={...i.body,...r.body||{}},i.qs={...i.qs,...r.qs||{}})}return i}cleanPayload(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e=>"undefined"!=typeof Uint8Array&&e instanceof Uint8Array||Array.isArray(e)?e:"string"==typeof e?e.length>0?e:null:Object.entries(e||{}).reduce(((e,t)=>{let[n,i]=t;return("number"==typeof i||"string"==typeof i&&i.length>0||"object"==typeof i&&Object.keys(i||{}).length>0)&&(e[n]=i),e}),{});return{body:t(e.body),qs:t(e.qs)}}on(e,t){Array.isArray(this._events[e])||(this._events[e]=[]),this._events[e].push(t)}}function us(e){return e.transactionName?Xo("to",e.transactionName):Xo("t",e.tNamePlain||"Unnamed Transaction")}if(ne){ie.cleanupTasks=[];const e=ie.close;ie.close=()=>{for(let e of ie.cleanupTasks)e();e()}}function ds(e){te?(wo(e,!0),Nt("pagehide",e)):ne&&ie.cleanupTasks.push(e)}class hs extends kn{constructor(e,t,n){super(n),this.endpoint=e,this.opts=t||{},this.started=!1,this.timeoutHandle=null,this.aborted=!1,this.harvesting=!1,this.harvest=new ls(this.sharedContext),ds(this.unload.bind(this)),this.sharedContext?.ee.on(Ae,(()=>this.runHarvest({forceNoRetry:!0})))}unload(){this.aborted||(this.opts.onUnload&&this.opts.onUnload(),this.runHarvest({unload:!0}))}startTimer(e,t){this.interval=e,this.started=!0,this.scheduleHarvest(null!=t?t:this.interval)}stopTimer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.aborted=e,this.started=!1,this.timeoutHandle&&clearTimeout(this.timeoutHandle)}scheduleHarvest(e,t){this.timeoutHandle||(null==e&&(e=this.interval),this.timeoutHandle=setTimeout((()=>{this.timeoutHandle=null,this.runHarvest(t)}),1e3*e))}runHarvest(e){if(this.aborted)return;this.harvesting=!0;const t=t=>{this.harvesting=!1,e?.forceNoRetry&&(t.retry=!1),this.onHarvestFinished(e,t)};let n,i,r=[];if(this.opts.getPayload){if(n=zo({isFinalHarvest:e?.unload}),!n)return!1;const t=!e?.unload&&n===Wo;if(i=this.opts.getPayload({retry:t,...e}),!i)return void(this.started&&this.scheduleHarvest());i="[object Array]"===Object.prototype.toString.call(i)?i:[i],r.push(...i)}let o=e=>this.harvest.sendX(e);r.length?o=this.opts.raw?e=>this.harvest._send(e):e=>this.harvest.send(e):r.push(void 0),r.forEach((i=>{o({endpoint:this.endpoint,payload:i,opts:e,submitMethod:n,cbFinished:t,customUrl:this.opts.customUrl,raw:this.opts.raw})})),this.started&&this.scheduleHarvest()}onHarvestFinished(e,t){if(this.opts.onFinished&&this.opts.onFinished(t),t.sent&&t.retry){const n=t.delay||this.opts.retryDelay;this.started&&n?(clearTimeout(this.timeoutHandle),this.timeoutHandle=null,this.scheduleHarvest(n,e)):!this.started&&n&&this.scheduleHarvest(n,e)}}}var ps=[];function fs(e){if(function(e){return void 0===e.hostname}(e))return!1;if(0===ps.length)return!0;for(var t=0;t<ps.length;t++){var n=ps[t];if("*"===n.hostname)return!1;if(ms(n.hostname,e.hostname)&&vs(n.pathname,e.pathname))return!1}return!0}function ms(e,t){return!(e.length>t.length)&&t.indexOf(e)===t.length-e.length}function vs(e,t){return 0===e.indexOf("/")&&(e=e.substring(1)),0===t.indexOf("/")&&(t=t.substring(1)),""===e||e===t}const gs=pt.ajax;class ys extends St{constructor(){super(...arguments),this.checkConfiguration()}waitForFlags(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new Promise(((t,n)=>{function i(t){return e.map((e=>t[e]?t[e]:0))}gn[this.agentIdentifier]?t(i(gn[this.agentIdentifier])):this.ee.on("rumresp",(function(){t(i(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}))}))}drain(){bt(this.agentIdentifier,this.featureName),this.drained=!0}checkConfiguration(){if(!Xe(this.agentIdentifier)){let e={...ge().info?.jsAttributes};try{e={...e,...Ce(this.agentIdentifier)?.jsAttributes}}catch(e){}En({agentIdentifier:this.agentIdentifier},{...ge(),info:{...ge().info,jsAttributes:e},runtime:Je(this.agentIdentifier)})}}}function bs(){let{body:e,query:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e||t)try{const n=function(e){if(!e)return;Array.isArray(e)||(e=[e]);const t=[],n=[];for(let i of e){const e=Es(i);e&&(t.push(e.operationName),n.push(e.operationType))}if(!n.length)return;return{operationName:t.join(","),operationType:n.join(","),operationFramework:"GraphQL"}}(ws(e));if(n)return n;const i=Es(function(e){if(!e||"string"!=typeof e)return;const t=new URLSearchParams(e);return ws(Object.fromEntries(t))}(t));if(i)return i}catch(e){}}function Es(e){if("object"!=typeof e||!e.query||"string"!=typeof e.query)return;const t=e.query.trim().match(/^(query|mutation|subscription)\s?(\w*)/),n=t?.[1];if(!n)return;return{operationName:e.operationName||t?.[2]||"Anonymous",operationType:n,operationFramework:"GraphQL"}}function ws(e){let t;if(!e||"string"!=typeof e&&"object"!=typeof e)return;if(t="string"==typeof e?JSON.parse(e):e,!function(e){return e?.constructor==={}.constructor}(t)&&!Array.isArray(t))return;let n=!1;return n=Array.isArray(t)?t.some((e=>ks(e))):ks(t),n?t:void 0}function ks(e){return!("object"!=typeof e||!e.query||"string"!=typeof e.query)}var Ss=Object.prototype.hasOwnProperty;function Cs(e,t,n){return e||0===e||""===e?t(e)+(n?",":""):"!"}function Ts(e,t){return t?Math.floor(e).toString(36):void 0===e||0===e?"":Math.floor(e).toString(36)}function _s(e){var t=Object.hasOwnProperty("create")?Object.create(null):{},n=0;return function(i){if(void 0===i||""===i)return"";var r=new os({agentIdentifier:e});i=String(i),r.shouldObfuscate()&&(i=r.obfuscateString(i));return Ss.call(t,i)?Ts(t[i],!0):(t[i]=n++,function(e){return"'"+e.replace(Os,"\\$1")}(i))}}function Ns(e,t){var n=[];return lt(e,(function(e,i){if(!(n.length>=64)){var r,o=5;switch(e=t(e),typeof i){case"object":i?r=t(Zt(i)):o=9;break;case"number":o=6,r=i%1?i:i+".";break;case"boolean":o=i?7:8;break;case"undefined":o=9;break;default:r=t(i)}n.push([o,e+(r?","+r:"")])}})),n}var Os=/([,\\;])/g;class Is{constructor(e,t){this.addString=_s(t.agentIdentifier),this.events=e,this.payload="bel.7;";for(let n=0;n<e.length;n++){const i=e[n],r=[Ts(i.startTime),Ts(i.endTime-i.startTime),Ts(0),Ts(0),this.addString(i.method),Ts(i.status),this.addString(i.domain),this.addString(i.path),Ts(i.requestSize),Ts(i.responseSize),"fetch"===i.type?1:"",this.addString(0),Cs(i.spanId,this.addString,!0)+Cs(i.traceId,this.addString,!0)+Cs(i.spanTimestamp,Ts,!1)];let o="2,";const s=Ns({...Ce(t.agentIdentifier).jsAttributes||{},...i.gql||{}},this.addString);r.unshift(Ts(s.length)),o+=r.join(","),s&&s.length>0&&(o+=";"+s.join(";")),n+1<e.length&&(o+=";"),this.payload+=o}this.tooBig=2*this.payload.length>t.MAX_PAYLOAD_SIZE}}var Rs=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=gs;#r;#o;#s;constructor(e,t){super(e,t,gs),this.#r=Ce(e),this.#o=Je(e),this.#s=Be(e);const n=this.#s.ajax.harvestTimeSeconds||10;this.MAX_PAYLOAD_SIZE=this.#s.ajax.maxPayloadSize||1e6,function(e){if(ps=[],e&&e.length)for(var t=0;t<e.length;t++){let n=e[t];if(!n)continue;0===n.indexOf("http://")?n=n.substring(7):0===n.indexOf("https://")&&(n=n.substring(8));const i=n.indexOf("/");let r,o;i>0?(r=n.substring(0,i),o=n.substring(i)):(r=n,o="");let[s]=r.split(":");ps.push({hostname:s,pathname:o})}}(this.#o.denyList),this.ajaxEvents=[],this.spaAjaxEvents={},this.sentAjaxEvents=[];const i=this;this.ee.on("interactionDone",((e,t)=>{this.spaAjaxEvents[e.id]&&(t||this.spaAjaxEvents[e.id].forEach((e=>this.ajaxEvents.push(e))),delete this.spaAjaxEvents[e.id])})),dt("returnAjax",(e=>this.ajaxEvents.push(e)),this.featureName,this.ee),dt("xhr",(function(){i.storeXhr(...arguments,this)}),this.featureName,this.ee),this.waitForFlags([]).then((()=>{new hs("events",{onFinished:this.onEventsHarvestFinished.bind(this),getPayload:this.prepareHarvest.bind(this)},this).startTimer(n),this.drain()}))}storeXhr(e,t,n,i,r,o){let s;t.time=n,s=e.cat?Zt([e.status,e.cat]):Zt([e.status,e.host,e.pathname]);const a=fs(e),c=this.#s.feature_flags?.includes("ajax_metrics_deny_list");if(!a&&c||this.aggregator.store("xhr",s,e,t),!a)return void(e.hostname===this.#r.errorBeacon||this.#s.proxy?.beacon&&e.hostname===this.#s.proxy.beacon?(ct(ln,["Ajax/Events/Excluded/Agent"],void 0,pt.metrics,this.ee),c&&ct(ln,["Ajax/Metrics/Excluded/Agent"],void 0,pt.metrics,this.ee)):(ct(ln,["Ajax/Events/Excluded/App"],void 0,pt.metrics,this.ee),c&&ct(ln,["Ajax/Metrics/Excluded/App"],void 0,pt.metrics,this.ee)));ct("bstXhrAgg",["xhr",s,e,t],void 0,pt.sessionTrace,this.ee);const l={method:e.method,status:e.status,domain:e.host,path:e.pathname,requestSize:t.txSize,responseSize:t.rxSize,type:r,startTime:n,endTime:i,callbackDuration:t.cbTime};o.dt&&(l.spanId=o.dt.spanId,l.traceId=o.dt.traceId,l.spanTimestamp=this.#o.timeKeeper.correctAbsoluteTimestamp(o.dt.timestamp)),l.gql=e.gql=bs({body:o.body,query:o.parsedOrigin?.search}),l.gql&&ct(ln,["Ajax/Events/GraphQL/Bytes-Added",Zt(l.gql).length],void 0,pt.metrics,this.ee);if(Boolean(ve(this.agentIdentifier)?.features?.[pt.softNav]))ct("ajax",[l],void 0,pt.softNav,this.ee);else if(o.spaNode){const e=o.spaNode.interaction.id;this.spaAjaxEvents[e]=this.spaAjaxEvents[e]||[],this.spaAjaxEvents[e].push(l)}else this.ajaxEvents.push(l)}prepareHarvest(e){if(e=e||{},0===this.ajaxEvents.length)return null;const t=this.#a(this.ajaxEvents),n=[];for(let e=0;e<t.length;e++)n.push({body:{e:t[e]}});return e.retry&&(this.sentAjaxEvents=this.ajaxEvents),this.ajaxEvents=[],n}onEventsHarvestFinished(e){e.retry&&this.sentAjaxEvents.length>0&&(this.ajaxEvents.unshift(...this.sentAjaxEvents),this.sentAjaxEvents=[])}#a(e,t){t=t||1;const n=[],i=e.length/t,r=function(e,t){t=t||e.length;const n=[];for(let i=0,r=e.length;i<r;i+=t)n.push(new Is(e.slice(i,i+t),this));return n}.call(this,e,i);let o=!1;for(let e=0;e<r.length;e++){const t=r[e];if(t.tooBig){if(t.events.length>1){o=!0;break}}else n.push(t.payload)}return o?this.#a(e,++t):n}}});const As=/([a-z0-9]+)$/i;function xs(e){if(!e)return;const t=e.match(As);return t?t[1]:void 0}var Ms=/^\n+|\n+$/g;function Ls(e){return function(e){var t;if(e.length>100){var n=e.length-100;t=e.slice(0,50).join("\n"),t+="\n< ...truncated "+n+" lines... >\n",t+=e.slice(-50).join("\n")}else t=e.join("\n");return t}(e).replace(Ms,"")}function Ps(e){if("string"!=typeof e)return"";const t=ns(e);return t===ns(se)?"<inline>":t}var Ds=/function (.+?)\s*\(/,Fs=/^\s*at (?:((?:\[object object\])?(?:[^(]*\([^)]*\))*[^()]*(?: \[as \S+\])?) )?\(?((?:file|http|https|chrome-extension):.*?)?:(\d+)(?::(\d+))?\)?\s*$/i,Us=/^\s*(?:(\S*|global code)(?:\(.*?\))?@)?((?:file|http|https|chrome|safari-extension).*?):(\d+)(?::(\d+))?\s*$/i,Hs=/^\s*at .+ \(eval at \S+ \((?:(?:file|http|https):[^)]+)?\)(?:, [^:]*:\d+:\d+)?\)$/i,js=/^\s*at Function code \(Function code:\d+:\d+\)\s*/i;function Bs(e){var t=null;try{if(t=function(e){if(!e.stack)return null;var t=e.stack.split("\n").reduce(Vs,{frames:[],stackLines:[],wrapperSeen:!1});return t.frames.length?{mode:"stack",name:e.name||zs(e),message:e.message,stackString:Ls(t.stackLines),frames:t.frames}:null}(e),t)return t}catch(e){}try{if(t=function(e){if(!("line"in e))return null;var t=e.name||zs(e);if(!e.sourceURL)return{mode:"sourceline",name:t,message:e.message,stackString:t+": "+e.message+"\n in evaluated code",frames:[{func:"evaluated code"}]};var n=Ps(e.sourceURL),i=t+": "+e.message+"\n at "+n;e.line&&(i+=":"+e.line,e.column&&(i+=":"+e.column));return{mode:"sourceline",name:t,message:e.message,stackString:i,frames:[{url:n,line:e.line,column:e.column}]}}(e),t)return t}catch(e){}try{if(t=function(e){var t=e.name||zs(e);return t?{mode:"nameonly",name:t,message:e.message,stackString:t+": "+e.message,frames:[]}:null}(e),t)return t}catch(e){}return{mode:"failed",stackString:"",frames:[]}}function Vs(e,t){let n=function(e){var t=e.match(Us);t||(t=e.match(Fs));if(t)return{url:t[2],func:"Anonymous function"!==t[1]&&"global code"!==t[1]&&t[1]||null,line:+t[3],column:t[4]?+t[4]:null};if(e.match(Hs)||e.match(js)||"anonymous"===e)return{func:"evaluated code"}}(t);if(!n)return e.stackLines.push(t),e;var i;if((i=n.func)&&i.indexOf("nrWrapper")>=0&&(e.wrapperSeen=!0),!e.wrapperSeen){let i=Ps(n.url);i!==n.url&&(t=t.replace(n.url,i),n.url=i),e.stackLines.push(t),e.frames.push(n)}return e}function zs(e){var t=Ds.exec(String(e.constructor));return t&&t.length>1?t[1]:"unknown"}function Ws(e){var t=0;if(!e||!e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}var qs=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=Dt;constructor(e,t){var n;super(e,t,Dt),n=this,this.stackReported={},this.observedAt={},this.pageviewReported={},this.bufferedErrorsUnderSpa={},this.currentBody=void 0,this.errorOnPage=!1,this.ee.on("interactionDone",((e,t)=>this.onInteractionDone(e,t))),dt("err",(function(){return n.storeError(...arguments)}),this.featureName,this.ee),dt("ierr",(function(){return n.storeError(...arguments)}),this.featureName,this.ee),dt("softNavFlush",((e,t,n)=>this.onSoftNavNotification(e,t,n)),this.featureName,this.ee);const i=Ve(this.agentIdentifier,"jserrors.harvestTimeSeconds")||10;this.waitForFlags(["err"]).then((e=>{let[t]=e;if(t){const e=new hs("jserrors",{onFinished:function(){return n.onHarvestFinished(...arguments)}},this);e.harvest.on("jserrors",(function(){return n.onHarvestStarted(...arguments)})),e.startTimer(i),this.drain()}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)}))}onHarvestStarted(e){var t=this.aggregator.take(["err","ierr","xhr"]);e.retry&&(this.currentBody=t);var n={body:t,qs:{}},i=Zt(Je(this.agentIdentifier).releaseIds);return"{}"!==i&&(n.qs.ri=i),t&&t.err&&t.err.length&&(this.#c(t.err),this.errorOnPage||(n.qs.pve="1",this.errorOnPage=!0)),n}onHarvestFinished(e){e.retry&&this.currentBody&&(lt(this.currentBody,((e,t)=>{for(var n=0;n<t.length;n++){var i=t[n],r=this.getBucketName(e,i.params,i.custom);this.aggregator.merge(e,r,i.metrics,i.params,i.custom)}})),this.currentBody=null)}nameHash(e){return Ws("".concat(e.exceptionClass,"_").concat(e.message,"_").concat(e.stack_trace||e.browser_stack_hash))}getBucketName(e,t,n){return"xhr"===e?Ws(Zt(t))+":"+Ws(Zt(n)):this.nameHash(t)+":"+Ws(Zt(n))}buildCanonicalStackString(e){for(var t="",n=0;n<e.frames.length;n++){var i=e.frames[n],r=xs(i.func);t&&(t+="\n"),r&&(t+=r+"@"),"string"==typeof i.url&&(t+=i.url),i.line&&(t+=":"+i.line)}return t}storeError(e,t,n,i,r){if(!e)return;t=t||he();const o=Je(this.agentIdentifier);let s;if(!n&&o.onerror&&(s=o.onerror(e),s&&("string"!=typeof s.group||!s.group.length)))return;var a=Bs(e);const c={stackHash:Ws(this.buildCanonicalStackString(a)),exceptionClass:a.name,request_uri:ie?.location.pathname};a.message&&(c.message=""+a.message),s?.group&&(c.errorGroup=s.group),r&&(c.hasReplay=r);var l,u=Ws("".concat(a.name,"_").concat(a.message,"_").concat(a.stackString,"_").concat(c.hasReplay?1:0));this.stackReported[u]?c.browser_stack_hash=Ws(a.stackString):(this.stackReported[u]=!0,c.stack_trace=(l=a.stackString).length>65530?l.substr(0,65530):l,this.observedAt[u]=o.timeKeeper.convertRelativeTimestamp(t)),c.releaseIds=Zt(o.releaseIds),this.pageviewReported[u]||(c.pageview=1,this.pageviewReported[u]=!0),c.firstOccurrenceTimestamp=this.observedAt[u],c.timestamp=o.timeKeeper.convertRelativeTimestamp(t);const d=[n?"ierr":"err",u,c,{time:t},i];if(ct("trace-jserror",d,void 0,pt.sessionTrace,this.ee),this.blocked)return;e?.__newrelic?.[this.agentIdentifier]&&(c._interactionId=e.__newrelic[this.agentIdentifier].interactionId,c._interactionNodeId=e.__newrelic[this.agentIdentifier].interactionNodeId);Boolean(ve(this.agentIdentifier)?.features[pt.softNav])?ct("jserror",[c,t],void 0,pt.softNav,this.ee):ct("spa-jserror",d,void 0,pt.spa,this.ee),c.browserInteractionId&&!c._softNavFinished?(this.bufferedErrorsUnderSpa[c.browserInteractionId]??=[],this.bufferedErrorsUnderSpa[c.browserInteractionId].push(d)):null!=c._interactionId?(this.bufferedErrorsUnderSpa[c._interactionId]=this.bufferedErrorsUnderSpa[c._interactionId]||[],this.bufferedErrorsUnderSpa[c._interactionId].push(d)):this.#l(d,void 0!==c.browserInteractionId,c._softNavAttributes)}#l(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},[i,r,o,s,a]=e;const c={};t?(Object.entries(n).forEach((e=>{let[t,n]=e;return u(t,n)})),r+=o.browserInteractionId,delete o._softNavAttributes,delete o._softNavFinished):(Object.entries(Ce(this.agentIdentifier).jsAttributes).forEach((e=>{let[t,n]=e;return u(t,n)})),delete o.browserInteractionId),a&&Object.entries(a).forEach((e=>{let[t,n]=e;return u(t,n)}));const l=r+":"+Ws(Zt(c));function u(e,t){c[e]=t&&"object"==typeof t?Zt(t):t}this.aggregator.store(i,l,o,s,c)}onInteractionDone(e,t){this.bufferedErrorsUnderSpa[e.id]&&!this.blocked&&(this.bufferedErrorsUnderSpa[e.id].forEach((n=>{var i={};const r=n[4];lt(e.root.attrs.custom,a),lt(r,a);var o=n[2];t&&(o.browserInteractionId=e.root.attrs.id,o._interactionNodeId&&(o.parentNodeId=o._interactionNodeId.toString())),delete o._interactionId,delete o._interactionNodeId;var s=(t?n[1]+e.root.attrs.id:n[1])+":"+Ws(Zt(i));function a(e,t){i[e]=t&&"object"==typeof t?Zt(t):t}this.aggregator.store(n[0],s,o,n[3],i)})),delete this.bufferedErrorsUnderSpa[e.id])}onSoftNavNotification(e,t,n){this.blocked||(this.bufferedErrorsUnderSpa[e]?.forEach((e=>this.#l(e,t,n))),delete this.bufferedErrorsUnderSpa[e])}#c(e){const t={errorHashes:e.map((e=>e.params.stackHash))};this.ee.emit("cfc.".concat(this.featureName),[t]),e.find((e=>e.params.hasReplay))&&!t.hasReplay&&e.forEach((e=>{delete e.params.hasReplay}))}}});const Gs="React",Ks="NextJS",Ys="Vue",$s="NuxtJS",Zs="Angular",Js="AngularUniversal",Xs="Svelte",Qs="SvelteKit",ea="Preact",ta="PreactSSR",na="AngularJS",ia="Backbone",ra="Ember",oa="Meteor",sa="Zepto",aa="Jquery",ca="MooTools",la="Qwik",ua="Electron";function da(){if(!te)return[];const e=[];try{(function(){try{return Object.prototype.hasOwnProperty.call(window,"React")||Object.prototype.hasOwnProperty.call(window,"ReactDOM")||Object.prototype.hasOwnProperty.call(window,"ReactRedux")||document.querySelector("[data-reactroot], [data-reactid]")||(()=>{const e=document.querySelectorAll("body > div");for(let t=0;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(e[t],"_reactRootContainer"))return!0})()}catch(e){return!1}})()&&(e.push(Gs),function(){try{return Object.prototype.hasOwnProperty.call(window,"next")&&Object.prototype.hasOwnProperty.call(window.next,"version")}catch(e){return!1}}()&&e.push(Ks)),function(){try{return Object.prototype.hasOwnProperty.call(window,"Vue")}catch(e){return!1}}()&&(e.push(Ys),function(){try{return Object.prototype.hasOwnProperty.call(window,"$nuxt")&&Object.prototype.hasOwnProperty.call(window.$nuxt,"nuxt")}catch(e){return!1}}()&&e.push($s)),function(){try{return Object.prototype.hasOwnProperty.call(window,"ng")||document.querySelector("[ng-version]")}catch(e){return!1}}()&&(e.push(Zs),function(){try{return document.querySelector("[ng-server-context]")}catch(e){return!1}}()&&e.push(Js)),function(){try{return Object.prototype.hasOwnProperty.call(window,"__svelte")}catch(e){return!1}}()&&(e.push(Xs),function(){try{return!!Object.keys(window).find((e=>e.startsWith("__sveltekit")))}catch(e){return!1}}()&&e.push(Qs)),function(){try{return Object.prototype.hasOwnProperty.call(window,"preact")}catch(e){return!1}}()&&(e.push(ea),function(){try{return document.querySelector('script[type="__PREACT_CLI_DATA__"]')}catch(e){return!1}}()&&e.push(ta)),function(){try{return Object.prototype.hasOwnProperty.call(window,"angular")||document.querySelector(".ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]")||document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]')}catch(e){return!1}}()&&e.push(na),Object.prototype.hasOwnProperty.call(window,"Backbone")&&e.push(ia),Object.prototype.hasOwnProperty.call(window,"Ember")&&e.push(ra),Object.prototype.hasOwnProperty.call(window,"Meteor")&&e.push(oa),Object.prototype.hasOwnProperty.call(window,"Zepto")&&e.push(sa),Object.prototype.hasOwnProperty.call(window,"jQuery")&&e.push(aa),Object.prototype.hasOwnProperty.call(window,"MooTools")&&e.push(ca),Object.prototype.hasOwnProperty.call(window,"qwikevents")&&e.push(la),function(){try{return"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}catch(e){return!1}}()&&e.push(ua)}catch(e){}return e}var ha=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=cn;constructor(e,t){super(e,t,cn),this.waitForFlags(["err"]).then((e=>{let[t]=e;if(t){new hs("jserrors",{onUnload:()=>this.unload()},this).harvest.on("jserrors",(()=>({body:this.aggregator.take(["cm","sm"])}))),this.drain()}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)})),dt(ln,this.storeSupportabilityMetrics.bind(this),this.featureName,this.ee),dt(un,this.storeEventMetrics.bind(this),this.featureName,this.ee),this.singleChecks(),this.eachSessionChecks()}storeSupportabilityMetrics(e,t){if(this.blocked)return;const n={name:e};this.aggregator.storeMetric("sm",e,n,t)}storeEventMetrics(e,t){if(this.blocked)return;const n={name:e};this.aggregator.store("cm",e,n,t)}singleChecks(){const{distMethod:e,loaderType:t}=Je(this.agentIdentifier),{proxy:n,privacy:i,page_view_timing:r}=Be(this.agentIdentifier);if(t&&this.storeSupportabilityMetrics("Generic/LoaderType/".concat(t,"/Detected")),e&&this.storeSupportabilityMetrics("Generic/DistMethod/".concat(e,"/Detected")),te){this.storeSupportabilityMetrics("Generic/Runtime/Browser/Detected");const e=document?.currentScript?.nonce;e&&""!==e&&this.storeSupportabilityMetrics("Generic/Runtime/Nonce/Detected"),function(e){if(It())return e();Ot("DOMContentLoaded",e)}((()=>{da().forEach((e=>{this.storeSupportabilityMetrics("Framework/"+e+"/Detected")}))})),i.cookies_enabled||this.storeSupportabilityMetrics("Config/SessionTracking/Disabled"),r.long_task&&this.storeSupportabilityMetrics("Config/LongTask/Enabled")}else ne?this.storeSupportabilityMetrics("Generic/Runtime/Worker/Detected"):this.storeSupportabilityMetrics("Generic/Runtime/Unknown/Detected");is()&&this.storeSupportabilityMetrics("Generic/FileProtocol/Detected");const o=ss(this.agentIdentifier);o.length>0&&this.storeSupportabilityMetrics("Generic/Obfuscate/Detected"),o.length>0&&!function(e){for(var t=!1,n=!1,i=0;i<e.length;i++){"regex"in e[i]?"string"==typeof e[i].regex||e[i].regex instanceof RegExp||(Ee('An obfuscation replacement rule contains a "regex" value with an invalid type (must be a string or RegExp)'),n=!0):(Ee('An obfuscation replacement rule was detected missing a "regex" value.'),n=!0);var r=e[i].replacement;r&&"string"!=typeof r&&(Ee('An obfuscation replacement rule contains a "replacement" value with an invalid type (must be a string)'),t=!0)}return!t&&!n}(o)&&this.storeSupportabilityMetrics("Generic/Obfuscate/Invalid"),n.assets&&this.storeSupportabilityMetrics("Config/AssetsUrl/Changed"),n.beacon&&this.storeSupportabilityMetrics("Config/BeaconUrl/Changed")}eachSessionChecks(){te&&Nt("pageshow",(e=>{e?.persisted&&this.storeSupportabilityMetrics("Generic/BFCache/PageRestored")}))}unload(){try{if(this.resourcesSent)return;this.resourcesSent=!0;const e=["beacon","fetch","xmlhttprequest"],t=["nr-data.net","newrelic.com","nr-local.net","localhost"];function n(e){return t.some((t=>e.name.indexOf(t)>=0))}function i(t){return e.includes(t.initiatorType)}if((performance?.getEntriesByType("resource")||[]).forEach((e=>{n(e)?i(e)?this.storeSupportabilityMetrics("Generic/Resources/Ajax/Internal"):this.storeSupportabilityMetrics("Generic/Resources/Non-Ajax/Internal"):i(e)?this.storeSupportabilityMetrics("Generic/Resources/Ajax/External"):this.storeSupportabilityMetrics("Generic/Resources/Non-Ajax/External")})),"undefined"!=typeof performance){const r=performance.getEntriesByType("mark"),o=performance.getEntriesByType("measure");this.storeSupportabilityMetrics("Generic/Performance/Mark/Seen",r.length),this.storeSupportabilityMetrics("Generic/Performance/Measure/Seen",o.length)}}catch(s){}}}});var pa=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=In;constructor(e,t){var n;super(e,t,In),n=this,this.eventsPerMinute=240,this.harvestTimeSeconds=Ve(this.agentIdentifier,"page_action.harvestTimeSeconds")||Ve(this.agentIdentifier,"ins.harvestTimeSeconds")||30,this.eventsPerHarvest=this.eventsPerMinute*this.harvestTimeSeconds/60,this.referrerUrl=void 0,this.currentEvents=void 0,this.events=[],this.att=Ce(this.agentIdentifier).jsAttributes,te&&document.referrer&&(this.referrerUrl=ns(document.referrer)),dt("api-addPageAction",(function(){return n.addPageAction(...arguments)}),this.featureName,this.ee),this.waitForFlags(["ins"]).then((e=>{let[t]=e;if(t){const e=new hs("ins",{onFinished:function(){return n.onHarvestFinished(...arguments)}},this);e.harvest.on("ins",(function(){return n.onHarvestStarted(...arguments)})),e.startTimer(this.harvestTimeSeconds,0),this.drain()}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)}))}onHarvestStarted(e){const{userAttributes:t,atts:n}=Ce(this.agentIdentifier);var i={qs:{ua:t,at:n},body:{ins:this.events}};return e.retry&&(this.currentEvents=this.events),this.events=[],i}onHarvestFinished(e){e&&e.sent&&e.retry&&this.currentEvents&&(this.events=this.events.concat(this.currentEvents),this.currentEvents=null)}addPageAction(e,t,n){if(this.events.length>=this.eventsPerHarvest||this.blocked)return;var i,r,o={};te&&window.document.documentElement&&(i=window.document.documentElement.clientWidth,r=window.document.documentElement.clientHeight);const s=Je(this.agentIdentifier);var a={timestamp:s.timeKeeper.convertRelativeTimestamp(e),timeSinceLoad:e/1e3,browserWidth:i,browserHeight:r,referrerUrl:this.referrerUrl,currentUrl:ns(""+location),pageUrl:ns(s.origin),eventType:"PageAction"};function c(e,t){o[e]=t&&"object"==typeof t?Zt(t):t}lt(a,c),lt(Ce(this.agentIdentifier).jsAttributes,c),n&&"object"==typeof n&&lt(n,c),o.actionName=t||"",this.events.push(o)}}}),fa="Start",ma="End",va="unloadEvent",ga="redirect",ya="domainLookup",ba="onnect",Ea="response",wa="loadEvent",ka="domContentLoadedEvent";const Sa=[];function Ca(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t)return n.of=e,_a(n.of,n,"n",!0),_a(t[va+fa],n,"u",i),_a(t[ga+fa],n,"r",i),_a(t[va+ma],n,"ue",i),_a(t[ga+ma],n,"re",i),_a(t["fetch"+fa],n,"f",i),_a(t[ya+fa],n,"dn",i),_a(t[ya+ma],n,"dne",i),_a(t["c"+ba+fa],n,"c",i),_a(t["secureC"+ba+"ion"+fa],n,"s",i),_a(t["c"+ba+ma],n,"ce",i),_a(t["request"+fa],n,"rq",i),_a(t[Ea+fa],n,"rp",i),_a(t[Ea+ma],n,"rpe",i),_a(t.domLoading,n,"dl",i),_a(t.domInteractive,n,"di",i),_a(t[ka+fa],n,"ds",i),_a(t[ka+ma],n,"de",i),_a(t.domComplete,n,"dc",i),_a(t[wa+fa],n,"l",i),_a(t[wa+ma],n,"le",i),n}function Ta(e,t){var n;return _a("number"==typeof(n=e.type)?n:{navigate:void 0,reload:1,back_forward:2,prerender:3}[n],t,"ty"),_a(e.redirectCount,t,"rc"),t}function _a(e,t,n,i){if("number"==typeof e&&e>0){if(i){const n=t?.of>0?t.of:0;e=Math.max(e-n,0)}e=Math.round(e),t[n]=e,Sa.push(e)}else Sa.push(void 0)}function Na(e){const t=[],n=fe();try{Object.keys(n.initializedAgents[e].features).forEach((e=>{switch(e){case pt.ajax:t.push("xhr");break;case pt.jserrors:t.push("err");break;case pt.pageAction:t.push("ins");break;case pt.sessionTrace:t.push("stn");break;case pt.softNav:case pt.spa:t.push("spa")}}))}catch(e){}return t}var Oa,Ia,Ra,Aa,xa,Ma=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},La=function(e){if("loading"===document.readyState)return"loading";var t=Ma();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},Pa=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Da=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var i=e,r=i.id?"#"+i.id:Pa(i)+(i.classList&&i.classList.value&&i.classList.value.trim()&&i.classList.value.trim().length?"."+i.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+r.length>(t||100)-1)return n||r;if(n=n?r+">"+n:r,i.id)break;e=i.parentNode}}catch(e){}return n},Fa=-1,Ua=function(){return Fa},Ha=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Fa=t.timeStamp,e(t))}),!0)},ja=function(){var e=Ma();return e&&e.activationStart||0},Ba=function(e,t){var n=Ma(),i="navigate";return Ua()>=0?i="back-forward-cache":n&&(document.prerendering||ja()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Va=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},n||{})),i}}catch(e){}},za=function(e,t,n,i){var r,o;return function(s){t.value>=0&&(s||i)&&((o=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Wa=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},qa=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},Ga=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},Ka=-1,Ya=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},$a=function(e){"hidden"===document.visibilityState&&Ka>-1&&(Ka="visibilitychange"===e.type?e.timeStamp:0,Ja())},Za=function(){addEventListener("visibilitychange",$a,!0),addEventListener("prerenderingchange",$a,!0)},Ja=function(){removeEventListener("visibilitychange",$a,!0),removeEventListener("prerenderingchange",$a,!0)},Xa=function(){return Ka<0&&(Ka=Ya(),Za(),Ha((function(){setTimeout((function(){Ka=Ya(),Za()}),0)}))),{get firstHiddenTime(){return Ka}}},Qa=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},ec=[1800,3e3],tc=function(e,t){t=t||{},Qa((function(){var n,i=Xa(),r=Ba("FCP"),o=Va("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-ja(),0),r.entries.push(e),n(!0)))}))}));o&&(n=za(e,r,ec,t.reportAllChanges),Ha((function(i){r=Ba("FCP"),n=za(e,r,ec,t.reportAllChanges),Wa((function(){r.value=performance.now()-i.timeStamp,n(!0)}))})))}))},nc=[.1,.25],ic={passive:!0,capture:!0},rc=new Date,oc=function(e,t){Oa||(Oa=t,Ia=e,Ra=new Date,cc(removeEventListener),sc())},sc=function(){if(Ia>=0&&Ia<Ra-rc){var e={entryType:"first-input",name:Oa.type,target:Oa.target,cancelable:Oa.cancelable,startTime:Oa.timeStamp,processingStart:Oa.timeStamp+Ia};Aa.forEach((function(t){t(e)})),Aa=[]}},ac=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){oc(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,ic),removeEventListener("pointercancel",i,ic)};addEventListener("pointerup",n,ic),addEventListener("pointercancel",i,ic)}(t,e):oc(t,e)}},cc=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,ac,ic)}))},lc=[100,300],uc=function(e,t){t=t||{},Qa((function(){var n,i=Xa(),r=Ba("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),n(!0))},s=function(e){e.forEach(o)},a=Va("first-input",s);n=za(e,r,lc,t.reportAllChanges),a&&qa(Ga((function(){s(a.takeRecords()),a.disconnect()}))),a&&Ha((function(){var i;r=Ba("FID"),n=za(e,r,lc,t.reportAllChanges),Aa=[],Ia=-1,Oa=null,cc(addEventListener),i=o,Aa.push(i),sc()}))}))},dc=0,hc=1/0,pc=0,fc=function(e){e.forEach((function(e){e.interactionId&&(hc=Math.min(hc,e.interactionId),pc=Math.max(pc,e.interactionId),dc=pc?(pc-hc)/7+1:0)}))},mc=function(){return xa?dc:performance.interactionCount||0},vc=[200,500],gc=0,yc=function(){return mc()-gc},bc=[],Ec={},wc=function(e){var t=bc[bc.length-1],n=Ec[e.interactionId];if(n||bc.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};Ec[i.id]=i,bc.push(i)}bc.sort((function(e,t){return t.latency-e.latency})),bc.splice(10).forEach((function(e){delete Ec[e.id]}))}},kc=function(e,t){t=t||{},Qa((function(){var n;"interactionCount"in performance||xa||(xa=Va("event",fc,{type:"event",buffered:!0,durationThreshold:0}));var i,r=Ba("INP"),o=function(e){e.forEach((function(e){e.interactionId&&wc(e),"first-input"===e.entryType&&!bc.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&wc(e)}));var t,n=(t=Math.min(bc.length-1,Math.floor(yc()/50)),bc[t]);n&&n.latency!==r.value&&(r.value=n.latency,r.entries=n.entries,i())},s=Va("event",o,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});i=za(e,r,vc,t.reportAllChanges),s&&("PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&s.observe({type:"first-input",buffered:!0}),qa((function(){o(s.takeRecords()),r.value<0&&yc()>0&&(r.value=0,r.entries=[]),i(!0)})),Ha((function(){bc=[],gc=mc(),r=Ba("INP"),i=za(e,r,vc,t.reportAllChanges)})))}))},Sc=[2500,4e3],Cc={},Tc=[800,1800],_c=function e(t){document.prerendering?Qa((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},Nc=function(e,t){t=t||{};var n=Ba("TTFB"),i=za(e,n,Tc,t.reportAllChanges);_c((function(){var r=Ma();if(r){var o=r.responseStart;if(o<=0||o>performance.now())return;n.value=Math.max(o-ja(),0),n.entries=[r],i(!0),Ha((function(){n=Ba("TTFB",0),(i=za(e,n,Tc,t.reportAllChanges))(!0)}))}}))};const Oc="fp",Ic="fcp",Rc="fi",Ac="lcp",xc="cls",Mc="inp",Lc="lt",Pc="ttfb";class Dc{#u=new Set;history=[];constructor(e,t){this.name=e,this.attrs={},this.roundingMethod="function"==typeof t?t:Math.floor}update(e){let{value:t,attrs:n={}}=e;if(null==t||t<0)return;const i={value:this.roundingMethod(t),name:this.name,attrs:n};this.history.push(i),this.#u.forEach((e=>{try{e(i)}catch(e){}}))}get current(){return this.history[this.history.length-1]||{value:void 0,name:this.name,attrs:{}}}get isValid(){return this.current.value>=0}subscribe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("function"==typeof e)return this.#u.add(e),this.isValid&&t&&this.history.forEach((t=>{e(t)})),()=>{this.#u.delete(e)}}}const Fc=new Dc(Ic);if(te)if(ce)try{if(!oe){performance.getEntriesByType("paint").forEach((e=>{"first-contentful-paint"===e.name&&Fc.update({value:Math.floor(e.startTime)})}))}}catch(Oa){}else!function(e,t){tc((function(t){!function(e){if(e.entries.length){var t=Ma(),n=e.entries[e.entries.length-1];if(t){var i=t.activationStart||0,r=Math.max(0,t.responseStart-i);return void(e.attribution={timeToFirstByte:r,firstByteToFCP:e.value-r,loadState:La(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:La(Ua())}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;if(oe||Fc.isValid)return;const i={timeToFirstByte:n.timeToFirstByte,firstByteToFCP:n.firstByteToFCP,loadState:n.loadState};Fc.update({value:t,attrs:i})}));const Uc=new Dc(Oc);if(te){const e=e=>{e.forEach((e=>{"first-paint"!==e.name||Uc.isValid||(t.disconnect(),Uc.update({value:e.startTime}))}))};let t;try{PerformanceObserver.supportedEntryTypes.includes("paint")&&!oe&&(t=new PerformanceObserver((t=>{Promise.resolve().then((()=>{e(t.getEntries())}))})),t.observe({type:"paint",buffered:!0}))}catch(Oa){}}const Hc=new Dc(Pc);if(te&&"undefined"!=typeof PerformanceNavigationTiming&&!ae&&window===window.parent)!function(e,t){Nc((function(t){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,i=Math.max(t.domainLookupStart-n,0),r=Math.max(t.connectStart-n,0),o=Math.max(t.requestStart-n,0);e.attribution={waitingTime:i,dnsTime:r-i,connectionTime:o-r,requestTime:e.value-o,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;Hc.isValid||Hc.update({value:t,attrs:{navigationEntry:n.navigationEntry}})}));else if(!Hc.isValid){const e={};for(let t in ie?.performance?.timing||{})e[t]=Math.max(ie?.performance?.timing[t]-de,0);Hc.update({value:e.responseStart,attrs:{navigationEntry:e}})}class jc{#d;#h;#p;#f=!1;constructor(e){this.#d=Je(e)?.session,this.processStoredDiff()}get ready(){return this.#f}get correctedOriginTime(){return this.#h}processRumRequest(e,t,n){if(this.processStoredDiff(),this.#f)return;const i=e.getResponseHeader("Date");if(!i)throw new Error("Missing date header on rum response.");const r=(n-t)/2,o=Math.floor(t+r);if(this.#h=Math.floor(Date.parse(i)-o),this.#p=de-this.#h,isNaN(this.#h))throw new Error("Date header invalid format.");this.#d?.write({serverTimeDiff:this.#p}),this.#f=!0}convertRelativeTimestamp(e){return this.#h+e}correctAbsoluteTimestamp(e){return Math.floor(e-this.#p)}processStoredDiff(){const e=this.#d?.read()?.serverTimeDiff;"number"!=typeof e||isNaN(e)||(this.#p=e,this.#h=de-this.#p,this.#f=!0)}}var Bc=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=rn;constructor(e,t){super(e,t,rn),this.timeToFirstByte=0,this.firstByteToWindowLoad=0,this.firstByteToDomContent=0,this.timeKeeper=new jc(this.agentIdentifier),te?Hc.subscribe((e=>{let{value:t,attrs:n}=e;const i=n.navigationEntry;this.timeToFirstByte=Math.max(t,this.timeToFirstByte),this.firstByteToWindowLoad=Math.max(Math.round(i.loadEventEnd-this.timeToFirstByte),this.firstByteToWindowLoad),this.firstByteToDomContent=Math.max(Math.round(i.domContentLoadedEventEnd-this.timeToFirstByte),this.firstByteToDomContent),this.sendRum()})):this.sendRum()}sendRum(){const e=Ce(this.agentIdentifier),t=Je(this.agentIdentifier),n=new ls(this);if(!e.beacon)return;e.queueTime&&this.aggregator.store("measures","qt",{value:e.queueTime}),e.applicationTime&&this.aggregator.store("measures","ap",{value:e.applicationTime}),this.aggregator.store("measures","be",{value:this.timeToFirstByte}),this.aggregator.store("measures","fe",{value:this.firstByteToWindowLoad}),this.aggregator.store("measures","dc",{value:this.firstByteToDomContent});const i={tt:e.ttGuid,us:e.user,ac:e.account,pr:e.product,af:Na(this.agentIdentifier).join(","),...Object.entries(this.aggregator.get("measures")||{}).reduce(((e,t)=>{let[n,i]=t;return e[n]=i.params?.value,e}),{}),xx:e.extra,ua:e.userAttributes,at:e.atts};let r;if(t.session&&(i.fsh=Number(t.session.isNew)),"object"==typeof e.jsAttributes&&Object.keys(e.jsAttributes).length>0&&(r={ja:e.jsAttributes}),ie.performance)if("undefined"!=typeof PerformanceNavigationTiming){const e=ie?.performance?.getEntriesByType("navigation")?.[0],t={timing:Ca(de,e,{}),navigation:Ta(e,{})};i.perf=Zt(t)}else if("undefined"!=typeof PerformanceTiming){const e={timing:Ca(de,ie.performance.timing,{},!0),navigation:Ta(ie.performance.navigation,{})};i.perf=Zt(e)}i.fp=Uc.current.value,i.fcp=Fc.current.value,this.timeKeeper?.ready&&(i.timestamp=this.timeKeeper.convertRelativeTimestamp(he()));const o=he();n.send({endpoint:"rum",payload:{qs:i,body:r},opts:{needResponse:!0,sendEmptyBody:!0},cbFinished:e=>{let{status:n,responseText:i,xhr:r}=e;const s=he();if(n>=400||0===n)this.ee.abort();else{try{if(this.timeKeeper.processRumRequest(r,o,s),!this.timeKeeper.ready)throw new Error("TimeKeeper not ready");t.timeKeeper=this.timeKeeper}catch(e){return ct(ln,["PVE/NRTime/Calculation/Failed"],void 0,pt.metrics,this.ee),bt(this.agentIdentifier,pt.metrics,!0),this.ee.abort(),void Ee("Could not calculate New Relic server time. Agent shutting down.",e)}try{const{app:e,...n}=JSON.parse(i);t.appMetadata=e,yn(n,this.agentIdentifier),this.drain()}catch(e){this.ee.abort(),Ee("RUM call failed. Agent shutting down.",e)}}}})}}});const Vc=pt.pageViewTiming,zc=new Dc(xc,(e=>e));te&&function(e,t){!function(e,t){t=t||{},tc(Ga((function(){var n,i=Ba("CLS",0),r=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=o[0],n=o[o.length-1];r&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>i.value&&(i.value=r,i.entries=o,n())},a=Va("layout-shift",s);a&&(n=za(e,i,nc,t.reportAllChanges),qa((function(){s(a.takeRecords()),n(!0)})),Ha((function(){r=0,i=Ba("CLS",0),n=za(e,i,nc,t.reportAllChanges),Wa((function(){return n()}))})),setTimeout(n,0))})))}((function(t){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(i=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||i[0];if(n)return void(e.attribution={largestShiftTarget:Da(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:La(t.startTime)})}}var i;e.attribution={}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n,id:i}=e;const r={metricId:i,largestShiftTarget:n.largestShiftTarget,largestShiftTime:n.largestShiftTime,largestShiftValue:n.largestShiftValue,loadState:n.loadState};zc.update({value:t,attrs:r})}),{reportAllChanges:!0});const Wc=new Dc(Rc);te&&function(e,t){uc((function(t){!function(e){var t=e.entries[0];e.attribution={eventTarget:Da(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:La(t.startTime)}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;if(oe||Wc.isValid)return;const i={type:n.eventType,fid:Math.round(t),eventTarget:n.eventTarget,loadState:n.loadState};Wc.update({value:n.eventTime,attrs:i})}));const qc=new Dc(Mc);te&&function(e,t){kc((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0],n=e.entries.find((function(e){return e.target}));e.attribution={eventTarget:Da(n&&n.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:La(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n,id:i}=e;const r={metricId:i,eventTarget:n.eventTarget,eventType:n.eventType,eventTime:n.eventTime,loadState:n.loadState};qc.update({value:t,attrs:r})}));const Gc=new Dc(Ac);te&&function(e,t){!function(e,t){t=t||{},Qa((function(){var n,i=Xa(),r=Ba("LCP"),o=function(e){var t=e[e.length-1];t&&t.startTime<i.firstHiddenTime&&(r.value=Math.max(t.startTime-ja(),0),r.entries=[t],n())},s=Va("largest-contentful-paint",o);if(s){n=za(e,r,Sc,t.reportAllChanges);var a=Ga((function(){Cc[r.id]||(o(s.takeRecords()),s.disconnect(),Cc[r.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),qa(a),Ha((function(i){r=Ba("LCP"),n=za(e,r,Sc,t.reportAllChanges),Wa((function(){r.value=performance.now()-i.timeStamp,Cc[r.id]=!0,n(!0)}))}))}}))}((function(t){!function(e){if(e.entries.length){var t=Ma();if(t){var n=t.activationStart||0,i=e.entries[e.entries.length-1],r=i.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===i.url}))[0],o=Math.max(0,t.responseStart-n),s=Math.max(o,r?(r.requestStart||r.startTime)-n:0),a=Math.max(s,r?r.responseEnd-n:0),c=Math.max(a,i?i.startTime-n:0),l={element:Da(i.element),timeToFirstByte:o,resourceLoadDelay:s-o,resourceLoadTime:a-s,elementRenderDelay:c-a,navigationEntry:t,lcpEntry:i};return i.url&&(l.url=i.url),r&&(l.lcpResourceEntry=r),void(e.attribution=l)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(t),e(t)}),t)}((e=>{let t,{value:n,attribution:i}=e;if(oe||Gc.isValid)return;const r=i.lcpEntry;r&&(t={size:r.size,eid:r.id,element:i.element,timeToFirstByte:i.timeToFirstByte,resourceLoadDelay:i.resourceLoadDelay,resourceLoadTime:i.resourceLoadTime,elementRenderDelay:i.elementRenderDelay},i.url&&(t.elUrl=ns(i.url)),r.element?.tagName&&(t.elTag=r.element.tagName)),Gc.update({value:n,attrs:t})}));const Kc=new Dc(Lc);if(te){const e=e=>{e.forEach((e=>{Kc.update({value:e.duration,attrs:{ltFrame:e.name,ltStart:e.startTime,ltCtr:e.attribution[0].containerType,..."window"!==e.attribution[0].containerType&&{ltCtrSrc:e.attribution[0].containerSrc,ltCtrId:e.attribution[0].containerId,ltCtrName:e.attribution[0].containerName}}})}))};let t;try{PerformanceObserver.supportedEntryTypes.includes("longtask")&&(t=new PerformanceObserver((t=>{Promise.resolve().then((()=>{e(t.getEntries())}))})),t.observe({type:"longtask",buffered:!0}))}catch(Oa){}t&&ds((()=>{e(t.takeRecords())}))}var Yc=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=Vc;#m=e=>{let{name:t,value:n,attrs:i}=e;this.addTiming(t,n,i)};constructor(e,t){var n;super(e,t,Vc),n=this,this.timings=[],this.timingsSent=[],this.curSessEndRecorded=!1,!0===Ve(this.agentIdentifier,"page_view_timing.long_task")&&Kc.subscribe(this.#m),dt("docHidden",(e=>this.endCurrentSession(e)),this.featureName,this.ee),dt("winPagehide",(e=>this.recordPageUnload(e)),this.featureName,this.ee);const i=Ve(this.agentIdentifier,"page_view_timing.initialHarvestSeconds")||10,r=Ve(this.agentIdentifier,"page_view_timing.harvestTimeSeconds")||30;this.waitForFlags([]).then((()=>{Uc.subscribe(this.#m),Fc.subscribe(this.#m),Wc.subscribe(this.#m),Gc.subscribe(this.#m),qc.subscribe(this.#m),Hc.subscribe((e=>{let{attrs:t}=e;this.addTiming("load",Math.round(t.navigationEntry.loadEventEnd))})),wo((()=>{const{name:e,value:t,attrs:n}=zc.current;void 0!==t&&this.addTiming(e,1e3*t,n)}),!0);const e=new hs("events",{onFinished:function(){return n.onHarvestFinished(...arguments)},getPayload:function(){return n.prepareHarvest(...arguments)}},this);e.startTimer(r,i),this.drain()}))}endCurrentSession(e){this.curSessEndRecorded||(this.addTiming("pageHide",e,null),this.curSessEndRecorded=!0)}recordPageUnload(e){this.addTiming("unload",e,null),this.endCurrentSession(e)}addTiming(e,t,n){(function(e){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(!t)return;t.type&&(e["net-type"]=t.type);t.effectiveType&&(e["net-etype"]=t.effectiveType);t.rtt&&(e["net-rtt"]=t.rtt);t.downlink&&(e["net-dlink"]=t.downlink)})(n=n||{}),e!==xc&&zc.current.value>=0&&(n.cls=zc.current.value),this.timings.push({name:e,value:t,attrs:n}),ct("pvtAdded",[e,t,n],void 0,pt.sessionTrace,this.ee)}onHarvestFinished(e){e.retry&&this.timingsSent.length>0&&(this.timings.unshift(...this.timingsSent),this.timingsSent=[])}appendGlobalCustomAttributes(e){var t=e.attrs||{},n=Ce(this.agentIdentifier).jsAttributes||{},i=["size","eid","cls","type","fid","elTag","elUrl","net-type","net-etype","net-rtt","net-dlink"];lt(n,(function(e,n){i.indexOf(e)<0&&(t[e]=n)}))}prepareHarvest(e){if(0!==this.timings.length){var t=this.getPayload(this.timings);if(e.retry)for(var n=0;n<this.timings.length;n++)this.timingsSent.push(this.timings[n]);return this.timings=[],{body:{e:t}}}}getPayload(e){for(var t=_s(this.agentIdentifier),n="bel.6;",i=0;i<e.length;i++){var r=e[i];n+="e,",n+=t(r.name)+",",n+=Cs(r.value,Ts,!1)+",",this.appendGlobalCustomAttributes(r);var o=Ns(r.attrs,t);o&&o.length>0&&(n+=Ts(o.length)+";"+o.join(";")),i+1<e.length&&(n+=";")}return n}}});let $c;const Zc=new Promise((e=>{$c=e})),Jc=Object.freeze({onReplayReady:$c,sessionReplayInitialized:Zc});const Xc=new class{#v=new WeakSet;#g=[];invalidStylesheetsDetected=!1;failedToFix=0;evaluate(){let e=0;if(te)for(let t=0;t<Object.keys(document.styleSheets).length;t++)if(!this.#v.has(document.styleSheets[t])){this.#v.add(document.styleSheets[t]);try{document.styleSheets[t].cssRules}catch(n){if(!document.styleSheets[t].href)return;e++,this.#g.push(this.#y(document.styleSheets[t]))}}return e&&(this.invalidStylesheetsDetected=!0),e}async fix(){await Promise.all(this.#g),this.#g=[];const e=this.failedToFix;return this.failedToFix=0,e}async#y(e){if(e?.href)try{const t=await Ge.FETCH.bind(window)(e.href);if(!t.ok)return void this.failedToFix++;const n=await t.text();try{const t=new CSSStyleSheet;await t.replace(n),Object.defineProperty(e,"cssRules",{get:()=>t.cssRules}),Object.defineProperty(e,"rules",{get:()=>t.rules})}catch(t){Object.defineProperty(e,"cssText",{get:()=>n}),this.failedToFix++}}catch(e){this.failedToFix++}}};var Qc=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=Ft;mode=De.OFF;constructor(e,t,n){super(e,t,Ft),this.harvestTimeSeconds=Ve(this.agentIdentifier,"session_replay.harvestTimeSeconds")||60,this.initialized=!1,this.blocked=!1,this.gzipper=void 0,this.u8=void 0,this.entitled=!1,this.timeKeeper=void 0,this.recorder=n?.recorder,this.errorNoticed=n?.errorNoticed||!1,ct(ln,["Config/SessionReplay/Enabled"],void 0,pt.metrics,this.ee),this.ee.on("cfc.".concat(pt.jserrors),(e=>{e.hasReplay=!(!this.scheduler?.started||!this.recorder||this.mode!==De.FULL||this.blocked||!this.entitled)})),this.ee.on(Ae,(()=>{this.abort(Vt)})),this.ee.on(Re,(()=>{this.recorder?.stopRecording()})),this.ee.on(xe,(()=>{if(!this.recorder)return;const{session:e}=Je(this.agentIdentifier);this.mode=e.state.sessionReplayMode,this.initialized&&this.mode!==De.OFF&&this.recorder?.startRecording()})),this.ee.on(Me,((e,t)=>{this.recorder&&this.initialized&&!this.blocked&&e===Pe&&(this.mode!==De.OFF&&t.sessionReplayMode===De.OFF&&this.abort(Gt),this.mode=t.sessionReplay)})),this.scheduler=new hs("browser/blobs",{onFinished:this.onHarvestFinished.bind(this),retryDelay:this.harvestTimeSeconds,getPayload:this.prepareHarvest.bind(this),raw:!0},this),dt(Ut.PAUSE,(()=>{this.forceStop(this.mode!==De.ERROR)}),this.featureName,this.ee),dt(Ut.ERROR_DURING_REPLAY,(e=>{this.handleError(e)}),this.featureName,this.ee);const{error_sampling_rate:i,sampling_rate:r,autoStart:o,block_selector:s,mask_text_selector:a,mask_all_inputs:c,inline_stylesheet:l,inline_images:u,collect_fonts:d}=Ve(this.agentIdentifier,"session_replay");this.waitForFlags(["srs","sr"]).then((e=>{let[t,n]=e;if(this.entitled=!!n,!this.entitled)return gt(this.agentIdentifier,this.featureName),void(this.recorder?.recording&&(this.abort(Kt),ct(ln,["SessionReplay/EnabledNotEntitled/Detected"],void 0,pt.metrics,this.ee)));this.drain(),this.initializeRecording(t)})).then((()=>{if(this.mode===De.OFF)for(this.recorder?.stopRecording();this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.();Jc.onReplayReady(this.mode)})),o||ct(ln,["Config/SessionReplay/AutoStart/Modified"],void 0,pt.metrics,this.ee),!0===d&&ct(ln,["Config/SessionReplay/CollectFonts/Modified"],void 0,pt.metrics,this.ee),!0!==l&&ct(ln,["Config/SessionReplay/InlineStylesheet/Modified"],void 0,pt.metrics,this.ee),!0===u&&ct(ln,["Config/SessionReplay/InlineImages/Modifed"],void 0,pt.metrics,this.ee),!0!==c&&ct(ln,["Config/SessionReplay/MaskAllInputs/Modified"],void 0,pt.metrics,this.ee),"[data-nr-block]"!==s&&ct(ln,["Config/SessionReplay/BlockSelector/Modified"],void 0,pt.metrics,this.ee),"*"!==a&&ct(ln,["Config/SessionReplay/MaskTextSelector/Modified"],void 0,pt.metrics,this.ee),ct(ln,["Config/SessionReplay/SamplingRate/Value",r],void 0,pt.metrics,this.ee),ct(ln,["Config/SessionReplay/ErrorSamplingRate/Value",i],void 0,pt.metrics,this.ee)}handleError(e){this.recorder&&(this.recorder.currentBufferTarget.hasError=!0),this.mode===De.ERROR&&"visible"===ie?.document.visibilityState&&this.switchToFull()}switchToFull(){this.entitled&&!this.blocked&&(this.mode=De.FULL,this.recorder&&this.initialized?(this.recorder.recording||this.recorder.startRecording(),this.scheduler.startTimer(this.harvestTimeSeconds),this.syncWithSessionManager({sessionReplayMode:this.mode})):this.initializeRecording(!1,!0,!0))}async initializeRecording(e,t){if(this.initialized=!0,!this.entitled)return;const{session:n,timeKeeper:i}=Je(this.agentIdentifier);if(this.timeKeeper=i,this.recorder?.parent.trigger===Yt&&this.recorder?.recording?this.mode=De.FULL:n.isNew||t?this.mode=e:this.mode=n.state.sessionReplayMode,this.mode!==De.OFF){if(this.recorder)this.recorder.parent=this;else try{const{Recorder:e}=await Promise.resolve().then((function(){return nu}));this.recorder=new e(this),this.recorder.currentBufferTarget.hasError=this.errorNoticed}catch(e){return this.abort(zt)}this.mode===De.ERROR&&this.errorNoticed&&(this.mode=De.FULL),this.mode===De.FULL&&("preloaded"===this.recorder?.getEvents().type&&this.prepUtils().then((()=>{this.scheduler.runHarvest()})),this.scheduler.started||this.scheduler.startTimer(this.harvestTimeSeconds)),await this.prepUtils(),this.recorder.recording||this.recorder.startRecording(),this.syncWithSessionManager({sessionReplayMode:this.mode})}}async prepUtils(){try{const{gzipSync:e,strToU8:t}=await Promise.resolve().then((function(){return ju}));this.gzipper=e,this.u8=t}catch(e){}}prepareHarvest(){let{opts:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.recorder||!this.timeKeeper?.ready)return;const t=this.recorder.getEvents();if(!t.events.length||this.mode!==De.FULL||this.blocked)return;const n=this.getHarvestContents(t);if(!n.body.length)return void this.recorder.clearBuffer();ct(ln,["SessionReplay/Harvest/Attempts"],void 0,pt.metrics,this.ee);let i=0;if(this.gzipper&&this.u8?(n.body=this.gzipper(this.u8("[".concat(n.body.map((e=>{let{__serialized:t,...n}=e;if(n.__newrelic&&t)return t;const i={...n};return i.__newrelic||(i.__newrelic=Mt(n.timestamp,this.timeKeeper),i.timestamp=this.timeKeeper.correctAbsoluteTimestamp(n.timestamp)),Zt(i)})).join(","),"]"))),i=n.body.length,this.scheduler.opts.gzip=!0):(n.body=n.body.map((e=>{let{__serialized:t,...n}=e;if(n.__newrelic)return n;const i={...n};return i.__newrelic=Mt(n.timestamp,this.timeKeeper),i.timestamp=this.timeKeeper.correctAbsoluteTimestamp(n.timestamp),i})),i=Zt(n.body).length,this.scheduler.opts.gzip=!1),i>1e6)return void this.abort(qt);const{session:r}=Je(this.agentIdentifier);return r.state.sessionReplaySentFirstChunk||this.syncWithSessionManager({sessionReplaySentFirstChunk:!0}),this.recorder.clearBuffer(),"preloaded"===t.type&&this.scheduler.runHarvest(e),[n]}getCorrectedTimestamp(e){if(e?.timestamp)return e.__newrelic?e.timestamp:this.timeKeeper.correctAbsoluteTimestamp(e.timestamp)}getHarvestContents(e){e??=this.recorder.getEvents();let t=e.events;const n=Je(this.agentIdentifier),i=Ce(this.agentIdentifier),r=i.jsAttributes?.["enduser.id"];t?.[0]?.type===Ht&&this.recorder.lastMeta&&(e.hasMeta=!0,t.unshift(this.recorder.lastMeta),this.recorder.lastMeta=void 0);t[t.length-1]?.type===jt&&(this.recorder.lastMeta=t[t.length-1],t=t.slice(0,t.length-1),e.hasMeta=!!t.find((e=>e.type===jt)));const o=he(),s=this.getCorrectedTimestamp(t[0]),a=this.getCorrectedTimestamp(t[t.length-1]),c=s||this.timeKeeper.correctAbsoluteTimestamp(e.cycleTimestamp),l=a||this.timeKeeper.convertRelativeTimestamp(o),u=n.appMetadata?.agents?.[0]||{};return{qs:{browser_monitoring_key:i.licenseKey,type:"SessionReplay",app_id:i.applicationID,protocol_version:"0",timestamp:c,attributes:Jo({...!!this.gzipper&&!!this.u8&&{content_encoding:"gzip"},...u.entityGuid&&{entityGuid:u.entityGuid},harvestId:[n.session?.state.value,n.ptid,n.harvestCount].filter((e=>e)).join("_"),"replay.firstTimestamp":c,"replay.lastTimestamp":l,"replay.nodes":t.length,"session.durationMs":n.session.getDuration(),agentVersion:n.version,session:n.session.state.value,rst:o,hasMeta:e.hasMeta||!1,hasSnapshot:e.hasSnapshot||!1,hasError:e.hasError||!1,isFirstChunk:!1===n.session.state.sessionReplaySentFirstChunk,decompressedBytes:e.payloadBytesEstimation,invalidStylesheetsDetected:Xc.invalidStylesheetsDetected,inlinedAllStylesheets:e.inlinedAllStylesheets,"rrweb.version":"2.0.0-alpha.12","payload.type":e.type,...r&&{"enduser.id":r}},5e3).substring(1)},body:t}}onHarvestFinished(e){429===e.status&&this.abort(Wt),this.blocked&&this.scheduler.stopTimer(!0)}forceStop(e){e&&this.scheduler.runHarvest(),this.mode=De.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode})}abort(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(Ee("SR aborted -- ".concat(e.message)),ct(ln,["SessionReplay/Abort/".concat(e.sm)],void 0,pt.metrics,this.ee),this.blocked=!0,this.mode=De.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode}),this.recorder?.clearTimestamps?.(),this.ee.emit("REPLAY_ABORTED");this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.()}syncWithSessionManager(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{session:t}=Je(this.agentIdentifier);t.write(e)}}});const el=pt.sessionTrace;function tl(e){if(0===(e||"").indexOf("data:"))return{protocol:"data"};try{const t=new URL(e,location.href),n={port:t.port,hostname:t.hostname,pathname:t.pathname,search:t.search,protocol:t.protocol.slice(0,t.protocol.indexOf(":")),sameOrigin:t.protocol===ie?.location?.protocol&&t.host===ie?.location?.host};return n.port&&""!==n.port||("http:"===t.protocol&&(n.port="80"),"https:"===t.protocol&&(n.port="443")),n.pathname&&""!==n.pathname?n.pathname.startsWith("/")||(n.pathname="/".concat(n.pathname)):n.pathname="/",n}catch(e){return{}}}class nl{constructor(e,t,n,i,r){this.n=e,this.s=t,this.e=n,this.o=i,this.t=r}}const il="function"==typeof ie.PerformanceObserver,rl={global:{mouseup:!0,mousedown:!0},window:{load:!0,pagehide:!0},xhrOriginMissing:{ignoreAll:!0}},ol={typing:[1e3,2e3],scrolling:[100,1e3],mousing:[1e3,2e3],touching:[1e3,2e3]};class sl{nodeCount=0;trace={};earliestTimeStamp=1/0;latestTimeStamp=0;tempStorage=[];prevStoredEvents=new Set;constructor(e){this.parent=e}storeSTN(e){if(!this.parent.blocked){if(this.nodeCount>=1e3){if(this.parent.agentRuntime.session.state.sessionTraceMode!==De.ERROR)return;if(0===this.trimSTNs(3e4))return}for(;this.tempStorage.length;)this.storeSTN(this.tempStorage.shift());this.trace[e.n]?this.trace[e.n].push(e):this.trace[e.n]=[e],e.s<this.earliestTimeStamp&&(this.earliestTimeStamp=e.s),e.s>this.latestTimeStamp&&(this.latestTimeStamp=e.s),this.nodeCount++}}trimSTNs(e){let t=0;const n=Math.max(he()-e,0);return Object.keys(this.trace).forEach((e=>{const i=this.trace[e];let r=i.findIndex((e=>n<=e.e));0!==r&&(r<0?(r=i.length,delete this.trace[e]):i.splice(0,r),this.nodeCount-=r,t+=r)})),t}takeSTNs(){il||this.storeResources(ie.performance?.getEntriesByType?.("resource"));const e=Object.entries(this.trace).flatMap((e=>{let[t,n]=e;if(!(t in ol))return n;const i=this.smearEvtsByOrigin(t),r=n.sort(((e,t)=>e.s-t.s)).reduce(i,{});return Object.values(r).flat()}),this);if(0===e.length)return{};this.trace={},this.nodeCount=0;const t=this.earliestTimeStamp;this.earliestTimeStamp=1/0;const n=this.latestTimeStamp;return this.latestTimeStamp=0,{stns:e,earliestTimeStamp:t,latestTimeStamp:n}}smearEvtsByOrigin(e){const t=ol[e][0],n=ol[e][1],i={};return(r,o)=>{let s=r[o.o];s||(s=r[o.o]=[]);const a=i[o.o];return"scrolling"!==e||function(e){const t=4;return!!(e&&"number"==typeof e.e&&"number"==typeof e.s&&e.e-e.s<t)}(o)?a&&o.s-a.s<n&&a.e>o.s-t?a.e=o.e:(i[o.o]=o,s.push(o)):(i[o.o]=null,o.n="scroll",s.push(o)),r}}processPVT(e,t,n){this.storeTiming({[e]:t}),function(e,t){return"fi"===e&&!!t&&"number"==typeof t.fid}(e,n)&&this.storeEvent({type:"fid",target:"document"},"document",t,t+n.fid)}storeTiming(e){if(e)for(let t in e){let n=e[t];const i=t.toLowerCase();i.indexOf("size")>=0||i.indexOf("status")>=0||"number"==typeof n&&n>=0&&(n=Math.round(n),this.storeSTN(new nl(t,n,n,"document","timing")))}}storeEvent(e,t,n,i){if(this.shouldIgnoreEvent(e,t))return;if(this.prevStoredEvents.has(e))return;this.prevStoredEvents.add(e);const r=new nl(this.evtName(e.type),n,i,void 0,"event");try{r.o=this.evtOrigin(e.target,t)}catch(e){r.o=this.evtOrigin(null,t)}this.storeSTN(r)}shouldIgnoreEvent(e,t){const n=this.evtOrigin(e.target,t);return e.type in rl.global||(!(!rl[n]||!rl[n].ignoreAll)||!(!rl[n]||!(e.type in rl[n])))}evtName(e){switch(e){case"keydown":case"keyup":case"keypress":return"typing";case"mousemove":case"mouseenter":case"mouseleave":case"mouseover":case"mouseout":return"mousing";case"scroll":return"scrolling";case"touchstart":case"touchmove":case"touchend":case"touchcancel":case"touchenter":case"touchleave":return"touching";default:return e}}evtOrigin(e,t){let n="unknown";if(e&&e instanceof XMLHttpRequest){const t=this.parent.ee.context(e).params;if(!(t&&t.status&&t.method&&t.host&&t.pathname))return"xhrOriginMissing";n=t.status+" "+t.method+": "+t.host+t.pathname}else if(e&&"string"==typeof e.tagName&&(n=e.tagName.toLowerCase(),e.id&&(n+="#"+e.id),e.className))for(let t=0;t<e.classList.length;t++)n+="."+e.classList[t];return"unknown"===n&&("string"==typeof t?n=t:t===document?n="document":t===window?n="window":t instanceof FileReader&&(n="FileReader")),n}storeHist(e,t,n){this.storeSTN(new nl("history.pushState",n,n,e,t))}#b=0;storeResources(e){e&&0!==e.length&&(e.forEach((e=>{if((0|e.fetchStart)<=this.#b)return;const{initiatorType:t,fetchStart:n,responseEnd:i,entryType:r}=e,{protocol:o,hostname:s,port:a,pathname:c}=tl(e.name),l=new nl(t,0|n,0|i,"".concat(o,"://").concat(s,":").concat(a).concat(c),r);this.storeSTN(l)})),this.#b=0|e[e.length-1].fetchStart)}storeErrorAgg(e,t,n,i){"err"===e&&this.storeSTN(new nl("error",i.time,i.time,n.message,n.stackHash))}storeXhrAgg(e,t,n,i){"xhr"===e&&this.storeSTN(new nl("Ajax",i.time,i.time+i.duration,"".concat(n.status," ").concat(n.method,": ").concat(n.host).concat(n.pathname)))}restoreNode(e,t){this.nodeCount>=1e3||(this.nodeCount+=t.length,this.trace[e]=this.trace[e]?t.concat(this.trace[e]):t)}}var al=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=el;constructor(e,t){super(e,t,el),this.agentRuntime=Je(e),this.agentInfo=Ce(e),this.sentTrace=null,this.harvestTimeSeconds=Ve(e,"session_trace.harvestTimeSeconds")||30,this.entitled=void 0,this.everHarvested=!1,this.harvesting=!1,this.traceStorage=new sl(this),this.waitForFlags(["sts","st"]).then((e=>{let[t,n]=e;return this.initialize(t,n)}))}initialize(e,t,n){var i=this;return this.entitled??=t,this.blocked||!this.entitled?gt(this.agentIdentifier,this.featureName):(this.initialized||(this.ee.on(Ae,(()=>{this.abort()})),this.ee.on(Me,((e,t)=>{this.mode===De.FULL||t.sessionReplayMode!==De.FULL&&t.sessionTraceMode!==De.FULL||this.switchToFull()}))),this.agentRuntime.session.isNew||n?this.mode=e:this.mode=this.agentRuntime.session.state.sessionTraceMode,this.initialized=!0,this.mode===De.OFF?gt(this.agentIdentifier,this.featureName):(this.timeKeeper??=this.agentRuntime.timeKeeper,this.scheduler=new hs("browser/blobs",{onFinished:this.onHarvestFinished.bind(this),retryDelay:this.harvestTimeSeconds,getPayload:this.prepareHarvest.bind(this),raw:!0},this),dt("bst",(function(){return i.traceStorage.storeEvent(...arguments)}),this.featureName,this.ee),dt("bstResource",(function(){return i.traceStorage.storeResources(...arguments)}),this.featureName,this.ee),dt("bstHist",(function(){return i.traceStorage.storeHist(...arguments)}),this.featureName,this.ee),dt("bstXhrAgg",(function(){return i.traceStorage.storeXhrAgg(...arguments)}),this.featureName,this.ee),dt("bstApi",(function(){return i.traceStorage.storeSTN(...arguments)}),this.featureName,this.ee),dt("trace-jserror",(function(){return i.traceStorage.storeErrorAgg(...arguments)}),this.featureName,this.ee),dt("pvtAdded",(function(){return i.traceStorage.processPVT(...arguments)}),this.featureName,this.ee),"undefined"!=typeof PerformanceNavigationTiming?this.traceStorage.storeTiming(ie.performance?.getEntriesByType?.("navigation")[0]):this.traceStorage.storeTiming(ie.performance?.timing),this.mode===De.FULL?this.startHarvesting():dt("trace-jserror",(()=>{this.mode===De.ERROR&&this.switchToFull()}),this.featureName,this.ee),this.agentRuntime.session.write({sessionTraceMode:this.mode}),void this.drain()))}startHarvesting(){this.scheduler.started||this.blocked||(this.scheduler.runHarvest(),this.scheduler.startTimer(this.harvestTimeSeconds))}prepareHarvest(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.traceStorage.prevStoredEvents.clear(),!this.timeKeeper?.ready)return;if(this.mode===De.OFF&&0===this.traceStorage.nodeCount)return;if(this.mode===De.ERROR)return;const{stns:t,earliestTimeStamp:n,latestTimeStamp:i}=this.traceStorage.takeSTNs();e.retry&&(this.sentTrace=t);const r=!this.agentRuntime.session.state.traceHarvestStarted;r&&this.agentRuntime.session.write({traceHarvestStarted:!0});const o=1===this.agentRuntime.session?.state.sessionReplayMode,s=this.agentInfo?.jsAttributes?.["enduser.id"];this.everHarvested=!0;const a=this.agentRuntime.appMetadata?.agents?.[0]||{};return{qs:{browser_monitoring_key:this.agentInfo.licenseKey,type:"BrowserSessionChunk",app_id:this.agentInfo.applicationID,protocol_version:"0",timestamp:this.timeKeeper.convertRelativeTimestamp(n),attributes:Jo({...a.entityGuid&&{entityGuid:a.entityGuid},harvestId:"".concat(this.agentRuntime.session?.state.value,"_").concat(this.agentRuntime.ptid,"_").concat(this.agentRuntime.harvestCount),"trace.firstTimestamp":this.timeKeeper.convertRelativeTimestamp(n),"trace.lastTimestamp":this.timeKeeper.convertRelativeTimestamp(i),"trace.nodes":t.length,"trace.originTimestamp":this.timeKeeper.correctedOriginTime,agentVersion:this.agentRuntime.version,...r&&{firstSessionHarvest:r},...o&&{hasReplay:o},ptid:"".concat(this.agentRuntime.ptid),session:"".concat(this.agentRuntime.session?.state.value),...s&&{"enduser.id":s}},5e3).substring(1)},body:t}}onHarvestFinished(e){e.sent&&e.retry&&this.sentTrace&&(Object.entries(this.sentTrace).forEach((e=>{let[t,n]=e;this.traceStorage.restoreNode(t,n)})),this.sentTrace=null)}switchToFull(){if(this.mode===De.FULL||!this.entitled||this.blocked)return;const e=this.mode;if(this.mode=De.FULL,this.agentRuntime.session.write({sessionTraceMode:this.mode}),e===De.OFF||!this.initialized)return this.initialize(this.mode,this.entitled);this.initialized&&this.traceStorage.trimSTNs(3e4),this.startHarvesting()}abort(){this.blocked=!0,this.mode=De.OFF,this.agentRuntime.session.write({sessionTraceMode:this.mode}),this.scheduler.stopTimer()}}}),cl=0;function ll(e,t,n,i){Object.defineProperty(this,"interaction",{value:e,writable:!0}),this.parent=t,this.id=++cl,this.type=n,this.children=[],this.end=null,this.jsEnd=this.start=i,this.jsTime=0,this.attrs={},this.cancelled=!1}var ul=ll.prototype;ul.child=function(e,t,n,i){var r=this.interaction;if(r.end||r.nodes>=128)return null;r.onNodeAdded(this);var o=new ll(r,this,e,t);return o.attrs.name=n,r.nodes++,i||r.remaining++,o},ul.callback=function(e,t){var n=this;n.jsTime+=e,t>n.jsEnd&&(n.jsEnd=t,n.interaction.lastCb=t)},ul.cancel=function(){this.cancelled=!0,this.interaction.remaining--},ul.finish=function(e){var t=this;if(t.end)return;t.end=e;let n=t.parent;for(;n?.cancelled;)n=n.parent;n&&n.children.push(t),t.parent=null;var i=this.interaction;i.remaining--,i.lastFinish=e,i.checkFinish()};var dl=Ge.ST,hl=Ge.CT,pl={};function fl(e,t,n,i,r,o){this.agentIdentifier=o,this.ee=ot.get(o),pl[o]=0,this.id=++pl[o],this.eventName=e,this.nodes=0,this.remaining=0,this.finishTimer=null,this.checkingFinish=!1,this.lastCb=this.lastFinish=t,this.handlers=[],this.onFinished=r,this.done=!1;var s=(this.root=new ll(this,null,"interaction",t)).attrs;s.trigger=e,s.initialPageURL=Je(o).origin,s.oldRoute=i,s.newURL=s.oldURL=n,s.custom={},s.store={}}var ml=fl.prototype;ml.checkFinish=function(){var e=this;e.remaining>0?e._resetFinishCheck():e.checkingFinish||null===e.root.end&&(e._resetFinishCheck(),e.checkingFinish=!0,e.finishTimer=dl((()=>{e.checkingFinish=!1,e.finishTimer=dl((()=>{e.finishTimer=null,e.remaining<=0&&e.finish()}),1)}),0))},ml.setNewURL=function(e){this.root.attrs.newURL=e},ml.setNewRoute=function(e){this.root.attrs.newRoute=e},ml.onNodeAdded=function(){this._resetFinishCheck()},ml._resetFinishCheck=function(){this.finishTimer&&(hl(this.finishTimer),this.finishTimer=null,this.checkingFinish=!1)},ml.finish=function(){var e=this,t=e.root;if(null===t.end){var n=Math.max(e.lastCb,e.lastFinish),i=t.attrs.custom;this.onFinished&&this.onFinished(this),lt(Ce(e.agentIdentifier).jsAttributes,(function(e,t){e in i||(i[e]=t)})),t.end=n,e.ee.emit("interaction",[this])}};class vl extends kn{constructor(e){super(e),this.firstTimestamp=void 0}serializeMultiple(e,t,n){const i=Ce(this.sharedContext.agentIdentifier);var r=_s(this.sharedContext.agentIdentifier),o="bel.7";return e.forEach((e=>{o+=";"+this.serializeInteraction(e.root,t,n,e.routeChange,r,i)})),this.firstTimestamp=void 0,o}serializeSingle(e,t,n,i){const r=Ce(this.sharedContext.agentIdentifier);var o=_s(this.sharedContext.agentIdentifier),s="bel.7;"+this.serializeInteraction(e,t,n,i,o,r);return this.firstTimestamp=void 0,s}serializeInteraction(e,t,n,i,r,o){t=t||0;var s="initialPageLoad"===e.attrs.trigger,a={interaction:1,ajax:2,customTracer:4},c=!0;const l=(e,u)=>{if("customEnd"===e.type)return u.push([3,Ts(e.end-this.firstTimestamp)]);var d=e.type,h=a[d],p=e.start,f=e.children.length,m=0,v=o.atts,g=s&&n.length&&1===h,y=[],b=e.attrs,E=b.metrics,w=b.params,k=o.queueTime,S=o.applicationTime;void 0===this.firstTimestamp?(p+=t,this.firstTimestamp=p):p-=this.firstTimestamp;var C=[Ts(p),Ts(e.end-e.start),Ts(e.jsEnd-e.end),Ts(e.jsTime)];switch(h){case 1:C[2]=Ts(e.jsEnd-this.firstTimestamp),C.push(r(b.trigger),r(ns(b.initialPageURL,c)),r(ns(b.oldURL,c)),r(ns(b.newURL,c)),r(b.customName),s?"":i?1:2,Cs(s&&k,Ts,!0)+Cs(s&&S,Ts,!0)+Cs(b.oldRoute,r,!0)+Cs(b.newRoute,r,!0)+r(b.id),r(e.id),Cs(b.firstPaint,Ts,!0)+Cs(b.firstContentfulPaint,Ts,!1));var T=Ns(b.custom,r);y=y.concat(T),m=T.length,v&&(f++,y.push("a,"+r(v)));break;case 2:if(C.push(r(w.method),Ts(w.status),r(w.host),r(w.pathname),Ts(E.txSize),Ts(E.rxSize),b.isFetch?1:b.isJSONP?2:"",r(e.id),Cs(e.dt&&e.dt.spanId,r,!0)+Cs(e.dt&&e.dt.traceId,r,!0)+Cs(e.dt&&e.dt.timestamp,Ts,!1)),Object.keys(w?.gql||{}).length){var _=Ns(w.gql,r);y=y.concat(_),m=_.length}break;case 4:var N=b.tracedTime;C.push(r(b.name),Cs(N,Ts,!0)+r(e.id))}for(var O=0;O<e.children.length;O++)l(e.children[O],y);if(C.unshift(Ts(h),Ts(f+=m)),u.push(C),f&&u.push(y.join(";")),g){var I=",",R="b",A=0;lt(n.slice(1,21),(function(e,t){void 0!==t?(R+=I+Ts(t-A),I=",",A=t):(R+=I+"!",I="")})),u.push(R)}else 1===h&&u.push("");return u};return l(e,[]).join(";")}}const gl=pt.spa,yl=Ge.ST,bl="-end",El="cb"+bl;var wl=Object.freeze({__proto__:null,BODY:"-body",CB_END:El,CB_START:"cb-start",END:bl,FEATURE_NAME:gl,FETCH:"fetch",FETCH_BODY:"fetch-body-",FETCH_DONE:"fetch-done",FETCH_START:"fetch-start",FN_END:"fn-end",FN_START:"fn-start",INTERACTION:"interaction",INTERACTION_API:"api-ixn-",INTERACTION_EVENTS:["click","submit","keypress","keydown","keyup","change"],JSONP_END:"jsonp-end",JSONP_NODE:"jsonpNode",JS_TIME:"jsTime",MAX_TIMER_BUDGET:999,REMAINING:"remaining",SPA_NODE:"spaNode",START:"-start",originalSetTimeout:yl});const{FEATURE_NAME:kl,INTERACTION_EVENTS:Sl,MAX_TIMER_BUDGET:Cl,FN_START:Tl,FN_END:_l,CB_START:Nl,INTERACTION_API:Ol,REMAINING:Il,INTERACTION:Rl,SPA_NODE:Al,JSONP_NODE:xl,FETCH_START:Ml,FETCH_DONE:Ll,FETCH_BODY:Pl,JSONP_END:Dl,originalSetTimeout:Fl}=wl;var Ul=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=kl;constructor(e,t){super(e,t,kl);const n=Je(e);let i;this.state={initialPageURL:n.origin,lastSeenUrl:n.origin,lastSeenRouteName:null,timerMap:{},timerBudget:Cl,currentNode:null,prevNode:null,nodeOnLastHashUpdate:null,initialPageLoad:null,pageLoaded:!1,childTime:0,depth:0,harvestTimeSeconds:Ve(e,"spa.harvestTimeSeconds")||10,interactionsToHarvest:[],interactionsSent:[],disableSpaFix:(Ve(e,"feature_flags")||[]).indexOf("disable-spa-fix")>-1},this.serializer=new vl(this);const{state:r,serializer:o}=this,s=ot.get(e),a=s.get("mutation"),c=s.get("promise"),l=s.get("history"),u=s.get("events"),d=s.get("timer"),h=s.get("fetch"),p=s.get("jsonp"),f=s.get("xhr"),m=s.get("tracer");if(this.waitForFlags(["spa"]).then((t=>{let[n]=t;n?(i=new hs("events",{onFinished:_,retryDelay:r.harvestTimeSeconds},{agentIdentifier:e,ee:s}),i.harvest.on("events",T),this.drain()):(this.blocked=!0,gt(this.agentIdentifier,this.featureName))})),!1===Ve(e,"spa.enabled"))return;r.initialPageLoad=new fl("initialPageLoad",0,r.lastSeenUrl,r.lastSeenRouteName,S,e),r.initialPageLoad.save=!0,r.prevInteraction=r.initialPageLoad,r.currentNode=r.initialPageLoad.root,r.initialPageLoad[Il]++,dt(Tl,g,this.featureName,s),dt(Nl,g,this.featureName,c);var v={getCurrentNode:function(){return r.currentNode},setCurrentNode:k};function g(){r.depth++,this.prevNode=r.currentNode,this.ct=r.childTime,r.childTime=0,r.timerBudget=Cl}function y(){r.depth--;var e=this.jsTime||0,t=e-r.childTime;r.childTime=this.ct+e,r.currentNode&&(r.currentNode.callback(t,this[_l]),this.isTraced&&(r.currentNode.attrs.tracedTime=t)),this.jsTime=r.currentNode?0:t,k(this.prevNode),this.prevNode=null,r.timerBudget=Cl}function b(e,t,n){var i=this[Al];if(i){var r=i[Rl],o=this.inc;this.isTraced=!0,o?r[Il]--:i&&i.finish(e),n?k(i):r.checkFinish()}}function E(e){return r.currentNode&&r.currentNode[Rl]===e?r.currentNode:e.root}function w(){this.resolved||(this.resolved=!0,this[Al]=r.currentNode)}function k(e){r.pageLoaded||e||!r.initialPageLoad||(e=r.initialPageLoad.root),r.currentNode&&r.currentNode[Rl].checkFinish(),r.prevNode=r.currentNode,r.currentNode=e&&!e[Rl].root.end?e:null}function S(e){e===r.initialPageLoad&&(r.initialPageLoad=null);var t=e.root,n=t.attrs;r.currentNode=t,lt(e.handlers,(function(e,t){t(n.store)})),k(null)}dt("spa-register",(function(e){"function"==typeof e&&e(v)}),pt.spa,s),dt(_l,y,this.featureName,s),dt("cb-end",y,this.featureName,c),dt(Tl,(function(t,n){var i=t[0],o=i.type,a=i["__nrNode:".concat(it)];if(!r.pageLoaded&&("load"===o&&n===window||re)&&(r.pageLoaded=!0,this.prevNode=r.currentNode=null,r.initialPageLoad&&(a=r.initialPageLoad.root,r.initialPageLoad[Il]=0,Fl((function(){Sl.push("popstate")})))),a)k(a);else if("hashchange"===o)k(r.nodeOnLastHashUpdate),r.nodeOnLastHashUpdate=null;else if(n instanceof XMLHttpRequest)k(s.context(n).spaNode);else if(!r.currentNode&&-1!==Sl.indexOf(o)){var c=new fl(o,this[Tl],r.lastSeenUrl,r.lastSeenRouteName,S,e);if(r.prevInteraction=c,k(c.root),"click"===o){var l=function(e){var t=e.tagName.toLowerCase();if(-1!==["a","button","input"].indexOf(t))return e.title||e.value||e.innerText}(i.target);l&&(r.currentNode.attrs.custom.actionText=l)}}i["__nrNode:".concat(it)]=r.currentNode}),this.featureName,u),dt("setTimeout-end",(function(e,t,n){!r.currentNode||r.timerBudget-this.timerDuration<0||(!e||e[0]instanceof Function)&&(r.currentNode[Rl][Il]++,this.timerId=n,r.timerMap[n]=r.currentNode,this.timerBudget=r.timerBudget-50)}),this.featureName,d),dt("clearTimeout-start",(function(e){var t=e[0],n=r.timerMap[t];if(n){var i=n[Rl];i[Il]--,i.checkFinish(),delete r.timerMap[t]}}),this.featureName,d),dt(Tl,(function(){r.timerBudget=this.timerBudget||Cl;var e=this.timerId,t=r.timerMap[e];k(t),delete r.timerMap[e],t&&t[Rl][Il]--}),this.featureName,d),dt(Tl,(function(){k(this[Al])}),this.featureName,f),dt("new-xhr",(function(){if(!r.disableSpaFix&&!r.currentNode&&r.prevInteraction&&!r.prevInteraction.ignored){const e=r.prevInteraction;r.currentNode=e.root,e.root.end=null}r.currentNode&&(this[Al]=r.currentNode.child("ajax",null,null,!0))}),this.featureName,f),dt("send-xhr-start",(function(){var e=this[Al];e&&!this.sent&&(this.sent=!0,e.dt=this.dt,e.dt?.timestamp&&(e.dt.timestamp=n.timeKeeper.correctAbsoluteTimestamp(e.dt.timestamp)),e.jsEnd=e.start=this.startTime,e[Rl][Il]++)}),this.featureName,f),dt("xhr-resolved",(function(){var e=this[Al];if(e){if(!fs(this.params))return void e.cancel();var t=e.attrs;t.params=this.params,t.metrics=this.metrics,e.finish(this.endTime),this.currentNode&&this.currentNode.interaction&&this.currentNode.interaction.checkFinish()}}),this.featureName,s),dt("new-jsonp",(function(e){r.currentNode&&((this[xl]=r.currentNode.child("ajax",this[Ml])).start=this["new-jsonp"],this.url=e,this.status=null)}),this.featureName,p),dt("cb-start",(function(e){var t=this[xl];t&&(k(t),this.status=200)}),this.featureName,p),dt("jsonp-error",(function(){var e=this[xl];e&&(k(e),this.status=0)}),this.featureName,p),dt(Dl,(function(){var e=this[xl];if(e){if(null===this.status)return void e.cancel();var t=e.attrs,n=t.params={},i=tl(this.url);n.method="GET",n.pathname=i.pathname,n.host=i.hostname+":"+i.port,n.status=this.status,t.metrics={txSize:0,rxSize:0},t.isJSONP=!0,e.jsEnd=this[Dl],e.jsTime=this[Nl]?this[Dl]-this[Nl]:0,e.finish(e.jsEnd)}}),this.featureName,p),dt(Ml,(function(e,t){if(e){if(!r.disableSpaFix&&!r.currentNode&&r.prevInteraction&&!r.prevInteraction.ignored){const e=r.prevInteraction;r.currentNode=e.root,e.root.end=null}r.currentNode&&(this[Al]=r.currentNode.child("ajax",this[Ml]),t&&this[Al]&&(this[Al].dt=t,this[Al].dt?.timestamp&&(this[Al].dt.timestamp=n.timeKeeper.correctAbsoluteTimestamp(this[Al].dt.timestamp))))}}),this.featureName,h),dt(Pl+"start",(function(e){r.currentNode&&(this[Al]=r.currentNode,r.currentNode[Rl][Il]++)}),this.featureName,h),dt(Pl+"end",(function(e,t,n){var i=this[Al];i&&i[Rl][Il]--}),this.featureName,h),dt(Ll,(function(e,t){var n=this[Al];if(n){if(e||!fs(this.params))return void n.cancel();var i=n.attrs;i.params=this.params,i.metrics={txSize:this.txSize,rxSize:this.rxSize},i.isFetch=!0,n.finish(this[Ll])}}),this.featureName,h),dt("newURL",(function(e,t){if(r.currentNode)r.currentNode[Rl].setNewURL(e);else if(r.prevInteraction&&!r.prevInteraction.ignored){const t=r.prevInteraction;t.setNewURL(e),t.root.end=null,k(t.root)}r.currentNode&&(r.lastSeenUrl!==e&&(r.currentNode[Rl].routeChange=!0),t&&(r.nodeOnLastHashUpdate=r.currentNode)),r.lastSeenUrl=e}),this.featureName,l),p.on("dom-start",(function(e){if(r.currentNode){var t=e[0],n=t&&"SCRIPT"===t.nodeName&&""!==t.src,i=r.currentNode.interaction;n&&(i[Il]++,t.addEventListener("load",(function(){i[Il]--,i.checkFinish()}),_t(!1)),t.addEventListener("error",(function(){i[Il]--,i.checkFinish()}),_t(!1)))}})),dt(Tl,(function(){k(r.prevNode)}),this.featureName,a),dt("resolve-start",w,this.featureName,c),dt("executor-err",w,this.featureName,c),dt("propagate",(function(e,t){!t&&this[Al]||(this[Al]=r.currentNode)}),this.featureName,c),dt(Nl,(function(){k((this.getCtx?this.getCtx():this)[Al])}),this.featureName,c),dt(Ol+"get",(function(t){var n;n=this.ixn=r?.currentNode?.[Rl]?r.currentNode[Rl]:null===r?.prevNode?.end&&"initialPageLoad"!==r?.prevNode?.[Rl]?.root?.[Rl]?.eventName?r.prevNode[Rl]:new fl("api",t,r.lastSeenUrl,r.lastSeenRouteName,S,e),r.currentNode||(n.checkFinish(),r.depth&&k(n.root))}),this.featureName,s),dt(Ol+"actionText",(function(e,t){var n=this.ixn.root.attrs.custom;t&&(n.actionText=t)}),this.featureName,s),dt(Ol+"setName",(function(e,t,n){var i=this.ixn.root.attrs;t&&(i.customName=t),n&&(i.trigger=n)}),this.featureName,s),dt(Ol+"setAttribute",(function(e,t,n){this.ixn.root.attrs.custom[t]=n}),this.featureName,s),dt(Ol+"end",(function(e){var t=this.ixn,n=E(t);k(null),n.child("customEnd",e).finish(e),t.finish()}),this.featureName,s),dt(Ol+"ignore",(function(e){this.ixn.ignored=!0}),this.featureName,s),dt(Ol+"save",(function(e){this.ixn.save=!0}),this.featureName,s),dt(Ol+"tracer",(function(e,t,n){var i=this.ixn,r=E(i),o=s.context(n);if(!t)return o.inc=++i[Il],o[Al]=r;o[Al]=r.child("customTracer",e,t)}),this.featureName,s),dt(Tl,b,this.featureName,m),dt("no-"+Tl,b,this.featureName,m),dt(Ol+"getContext",(function(e,t){var n=this.ixn.root.attrs.store;setTimeout((function(){t(n)}),0)}),this.featureName,s),dt(Ol+"onEnd",(function(e,t){this.ixn.handlers.push(t)}),this.featureName,s),dt("api-routeName",(function(e,t){r.lastSeenRouteName=t,r.currentNode&&r.currentNode[Rl].setNewRoute(t)}),this.featureName,s);const C=this;function T(e){if(0===r.interactionsToHarvest.length||C.blocked)return{};var t=o.serializeMultiple(r.interactionsToHarvest,0,Sa);return e.retry&&r.interactionsToHarvest.forEach((function(e){r.interactionsSent.push(e)})),r.interactionsToHarvest=[],{body:{e:t}}}function _(e){e.sent&&e.retry&&r.interactionsSent.length>0&&(r.interactionsSent.forEach((function(e){r.interactionsToHarvest.unshift(e)})),r.interactionsSent=[])}s.on("spa-jserror",(function(e,t,n,i){r.currentNode&&(n._interactionId=r.currentNode.interaction.id,r.currentNode.type&&"interaction"!==r.currentNode.type&&(n._interactionNodeId=r.currentNode.id))})),dt("function-err",(function(t,n,i){r.currentNode&&(i.__newrelic??={},i.__newrelic[e]={interactionId:r.currentNode.interaction.id},r.currentNode.type&&"interaction"!==r.currentNode.type&&(i.__newrelic[e].interactionNodeId=r.currentNode.id))}),this.featureName,s),s.on("interaction",(function(e){if(e.ignored||!e.save&&!e.routeChange)return void s.emit("interactionDone",[e,!1]);r.prevInteraction===e&&(r.prevInteraction=null);e.root.attrs.id=tt(),"initialPageLoad"===e.root.attrs.trigger&&(e.root.attrs.firstPaint=Uc.current.value,e.root.attrs.firstContentfulPaint=Fc.current.value);let t;s.emit("interactionDone",[e,!0]),r.interactionsToHarvest.push(e),t="initialPageLoad"===e.root?.attrs?.trigger?"InitialPageLoad":e.routeChange?"RouteChange":"Custom";ct(ln,["Spa/Interaction/".concat(t,"/Duration/Ms"),Math.max((e.root?.end||0)-(e.root?.start||0),0)],void 0,pt.metrics,s),i?.scheduleHarvest(0),i||Ee("SPA scheduler is not initialized. Saved interaction is not sent!")}))}}});const Hl=pt.softNav,jl="",Bl=1,Vl=2,zl=1,Wl=2,ql="in progress",Gl="finished",Kl="cancelled";let Yl=0;class $l{belType;children=[];start=he();end;callbackEnd=0;callbackDuration=0;nodeId=++Yl;constructor(e){if(!e)throw new Error("Interaction is missing core attributes");this.agentIdentifier=e}addChild(e){this.children.push(e)}serialize(){}}class Zl extends $l{constructor(e,t){super(e),this.belType=Wl,this.method=t.method,this.status=t.status,this.domain=t.domain,this.path=t.path,this.txSize=t.requestSize,this.rxSize=t.responseSize,this.requestedWith="fetch"===t.type?1:"",this.spanId=t.spanId,this.traceId=t.traceId,this.spanTimestamp=t.spanTimestamp,this.gql=t.gql,this.start=t.startTime,this.end=t.endTime}serialize(e){const t=_s(this.agentIdentifier),n=[],i=[Ts(this.belType),0,Ts(this.start-e),Ts(this.end-this.start),Ts(this.callbackEnd),Ts(this.callbackDuration),t(this.method),Ts(this.status),t(this.domain),t(this.path),Ts(this.txSize),Ts(this.rxSize),this.requestedWith,t(this.nodeId),Cs(this.spanId,t,!0)+Cs(this.traceId,t,!0)+Cs(this.spanTimestamp,Ts)];let r=[];return"object"==typeof this.gql&&(r=Ns(this.gql,t)),this.children.forEach((e=>r.push(e.serialize()))),i[1]=Ts(r.length),n.push(i),r.length&&n.push(r.join(";")),n.join(";")}}class Jl extends $l{id=tt();initialPageURL=se;oldURL=""+ie?.location;newURL=""+ie?.location;customName;customAttributes={};customDataByApi={};queueTime;appTime;newRoute;status=ql;domTimestamp=0;historyTimestamp=0;createdByApi=!1;keepOpenUntilEndApi=!1;onDone=[];cancellationTimer;constructor(e,t,n,i){super(e),this.belType=zl,this.trigger=t,this.start=n,this.oldRoute=i,this.eventSubscription=new Map([["finished",[]],["cancelled",[]]]),this.forceSave=this.forceIgnore=!1,"api"===this.trigger&&(this.createdByApi=!0)}updateDom(e){this.domTimestamp=e||performance.now()}updateHistory(e,t){this.newURL=t||""+ie?.location,this.historyTimestamp=e||performance.now()}seenHistoryAndDomChange(){return this.historyTimestamp>0&&this.domTimestamp>this.historyTimestamp}on(e,t){if(!this.eventSubscription.has(e))throw new Error("Cannot subscribe to non pre-defined events.");if("function"!=typeof t)throw new Error("Must supply function as callback.");this.eventSubscription.get(e).push(t)}done(e){return(!this.keepOpenUntilEndApi||void 0!==e)&&(this.onDone.forEach((e=>e(this.customDataByApi))),this.forceIgnore?this.#E():this.seenHistoryAndDomChange()?this.#w(e):this.forceSave?this.#w(e||performance.now()):this.#E(),!0)}#w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.status!==ql)return;clearTimeout(this.cancellationTimer),this.end=Math.max(this.domTimestamp,this.historyTimestamp,e),this.customAttributes={...Ce(this.agentIdentifier).jsAttributes,...this.customAttributes},this.status=Gl;this.eventSubscription.get("finished").forEach((e=>e()))}#E(){if(this.status!==ql)return;clearTimeout(this.cancellationTimer),this.status=Kl;this.eventSubscription.get("cancelled").forEach((e=>e()))}isActiveDuring(e){return this.status===ql?this.start<=e:this.status===Gl&&this.start<=e&&this.end>=e}get firstPaint(){}get firstContentfulPaint(){}get navTiming(){}serialize(e){const t=_s(this.agentIdentifier),n=[];let i;i="initialPageLoad"===this.trigger?jl:this.newURL!==this.oldURL?Bl:Vl;const r=[Ts(this.belType),0,Ts(Math.floor(this.start-e)),Ts(Math.floor(this.end-this.start)),Ts(this.callbackEnd),Ts(this.callbackDuration),t(this.trigger),t(ns(this.initialPageURL,!0)),t(ns(this.oldURL,!0)),t(ns(this.newURL,!0)),t(this.customName),i,Cs(this.queueTime,Ts,!0)+Cs(this.appTime,Ts,!0)+Cs(this.oldRoute,t,!0)+Cs(this.newRoute,t,!0)+t(this.id),t(this.nodeId),Cs(this.firstPaint,Ts,!0)+Cs(this.firstContentfulPaint,Ts)],o=Ns(this.customAttributes||{},t);return Ce(this.agentIdentifier).atts&&o.push("a,"+t(Ce(this.agentIdentifier).atts)),this.children.forEach((t=>o.push(t.serialize(e||this.start)))),r[1]=Ts(o.length),n.push(r),o.length&&n.push(o.join(";")),this.navTiming?n.push(this.navTiming):n.push(""),n.join(";")}}class Xl extends Jl{constructor(e){super(e,"initialPageLoad",0,null);const t=Ce(e);this.queueTime=t.queueTime,this.appTime=t.applicationTime}get firstPaint(){return Uc.current.value}get firstContentfulPaint(){return Fc.current.value}get navTiming(){if(!Sa.length)return;let e=",",t="b",n=0;return Sa.slice(1,21).forEach((i=>{void 0!==i?(t+=e+Ts(i-n),e=",",n=i):(t+=e+"!",e="")})),t}}var Ql=Object.freeze({__proto__:null,Aggregate:class extends ys{static featureName=Hl;constructor(e,t,n){let{domObserver:i}=n;super(e,t,Hl);const r=Ve(e,"soft_navigations.harvestTimeSeconds")||10;this.interactionsToHarvest=[],this.interactionsAwaitingRetry=[],this.domObserver=i,this.initialPageLoadInteraction=new Xl(e),Hc.subscribe((e=>{let{attrs:t}=e;const n=t.navigationEntry.loadEventEnd;this.initialPageLoadInteraction.forceSave=!0,this.initialPageLoadInteraction.done(n),this.interactionsToHarvest.push(this.initialPageLoadInteraction),this.initialPageLoadInteraction=null,ct(ln,["SoftNav/Interaction/InitialPageLoad/Duration/Ms",Math.round(n)],void 0,pt.metrics,this.ee)})),this.latestRouteSetByApi=null,this.interactionInProgress=null,this.blocked=!1,this.waitForFlags(["spa"]).then((t=>{let[n]=t;if(n){this.drain();const t=new hs("events",{onFinished:this.onHarvestFinished.bind(this),retryDelay:r,onUnload:()=>this.interactionInProgress?.done()},{agentIdentifier:e,ee:this.ee});t.harvest.on("events",this.onHarvestStarted.bind(this)),t.startTimer(r,0)}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)})),dt("newUIEvent",(e=>this.startUIInteraction(e.type,e.timeStamp,e.target)),this.featureName,this.ee),dt("newURL",((e,t)=>this.interactionInProgress?.updateHistory(e,t)),this.featureName,this.ee),dt("newDom",(e=>{this.interactionInProgress?.updateDom(e),this.interactionInProgress?.seenHistoryAndDomChange()&&this.interactionInProgress.done()}),this.featureName,this.ee),this.#k(),dt("ajax",this.#S.bind(this),this.featureName,this.ee),dt("jserror",this.#C.bind(this),this.featureName,this.ee)}onHarvestStarted(e){if(0===this.interactionsToHarvest.length||this.blocked)return;let t=0;const n=[];for(const e of this.interactionsToHarvest)n.push(e.serialize(t)),t||(t=Math.floor(e.start));const i="bel.7;".concat(n.join(";"));return e.retry&&(this.interactionsAwaitingRetry=this.interactionsToHarvest),this.interactionsToHarvest=[],{body:{e:i}}}onHarvestFinished(e){e.sent&&e.retry&&this.interactionsAwaitingRetry.length>0&&(this.interactionsToHarvest=[...this.interactionsAwaitingRetry,...this.interactionsToHarvest]),this.interactionsAwaitingRetry=[]}startUIInteraction(e,t,n){if(!this.interactionInProgress?.createdByApi&&!1!==this.interactionInProgress?.done()){if(this.interactionInProgress=new Jl(this.agentIdentifier,e,t,this.latestRouteSetByApi),"click"===e){const e=function(e){const t=e.tagName.toLowerCase();if(["a","button","input"].includes(t))return e.title||e.value||e.innerText}(n);e&&(this.interactionInProgress.customAttributes.actionText=e)}this.interactionInProgress.cancellationTimer=setTimeout((()=>{this.interactionInProgress.done(),ct(ln,["SoftNav/Interaction/TimeOut"],void 0,pt.metrics,this.ee)}),3e4),this.setClosureHandlers()}}setClosureHandlers(){this.interactionInProgress.on("finished",(()=>{const e=this.interactionInProgress;this.interactionsToHarvest.push(this.interactionInProgress),this.interactionInProgress=null,this.domObserver.disconnect(),ct(ln,["SoftNav/Interaction/".concat(e.newURL!==e.oldURL?"RouteChange":"Custom","/Duration/Ms"),Math.round(e.end-e.start)],void 0,pt.metrics,this.ee)})),this.interactionInProgress.on("cancelled",(()=>{this.interactionInProgress=null,this.domObserver.disconnect()}))}getInteractionFor(e){if(this.interactionInProgress?.isActiveDuring(e))return this.interactionInProgress;let t;for(let n=this.interactionsToHarvest.length-1;n>=0;n--){const i=this.interactionsToHarvest[n];if(i.isActiveDuring(e)){if("initialPageLoad"!==i.trigger)return i;t=i}}return t||(this.initialPageLoadInteraction?.isActiveDuring(e)?this.initialPageLoadInteraction:void 0)}#S(e){const t=this.getInteractionFor(e.startTime);function n(e,t,n){const i=new Zl(e,t);n.addChild(i)}t?t.status===Gl?n(this.agentIdentifier,e,t):(t.on("finished",(()=>n(this.agentIdentifier,e,t))),t.on("cancelled",(()=>ct("returnAjax",[e],void 0,pt.ajax,this.ee)))):ct("returnAjax",[e],void 0,pt.ajax,this.ee)}#C(e,t){const n=this.getInteractionFor(t);n&&(e.browserInteractionId=n.id,n.status===Gl?(e._softNavFinished=!0,e._softNavAttributes=n.customAttributes):(n.on("finished",Lt((()=>ct("softNavFlush",[n.id,!0,n.customAttributes],void 0,pt.jserrors,this.ee)))),n.on("cancelled",Lt((()=>ct("softNavFlush",[n.id,!1,void 0],void 0,pt.jserrors,this.ee))))))}#k(){const e="api-ixn-",t=this;dt(e+"get",(function(e){let{waitForEnd:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.associatedInteraction=t.getInteractionFor(e),this.associatedInteraction||(this.associatedInteraction=t.interactionInProgress=new Jl(t.agentIdentifier,"api",e,t.latestRouteSetByApi),t.setClosureHandlers()),!0===n&&(this.associatedInteraction.keepOpenUntilEndApi=!0)}),t.featureName,t.ee),dt(e+"end",(function(e){this.associatedInteraction.done(e)}),t.featureName,t.ee),dt(e+"save",(function(){this.associatedInteraction.forceSave=!0}),t.featureName,t.ee),dt(e+"ignore",(function(){this.associatedInteraction.forceIgnore=!0}),t.featureName,t.ee),dt(e+"getContext",(function(e,t){"function"==typeof t&&setTimeout((()=>t(this.associatedInteraction.customDataByApi)),0)}),t.featureName,t.ee),dt(e+"onEnd",(function(e,t){"function"==typeof t&&this.associatedInteraction.onDone.push(t)}),t.featureName,t.ee),dt(e+"actionText",(function(e,t){t&&(this.associatedInteraction.customAttributes.actionText=t)}),t.featureName,t.ee),dt(e+"setName",(function(e,t,n){t&&(this.associatedInteraction.customName=t),n&&(this.associatedInteraction.trigger=n)}),t.featureName,t.ee),dt(e+"setAttribute",(function(e,t,n){this.associatedInteraction.customAttributes[t]=n}),t.featureName,t.ee),dt(e+"routeName",(function(e,n){t.latestRouteSetByApi=n,t.interactionInProgress&&(t.interactionInProgress.newRoute=n)}),t.featureName,t.ee)}}}),eu={};!function(e){var t;function n(e){return e.nodeType===e.ELEMENT_NODE}function i(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function r(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function o(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,s).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function s(e){let t;if(function(e){return"styleSheet"in e}(e))try{t=o(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}Object.defineProperty(e,"__esModule",{value:!0}),function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(t||(t={}));class a{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function c(){return new a}function l({element:e,maskInputOptions:t,tagName:n,type:i,value:r,maskInputFn:o}){let s=r||"";const a=i&&u(i);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function u(e){return e.toLowerCase()}const d="__rrweb_original__";function h(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?u(t):null}function p(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(e){return null}const r=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==r?void 0:r[1])&&void 0!==n?n:null}let f=1;const m=new RegExp("[^a-z0-9-_:]"),v=-2;function g(){return f++}let y,b;const E=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,w=/^(?:[a-z+]+:)?\/\//i,k=/^www\..*/i,S=/^(data:)([^,]*),(.*)/i;function C(e,t){return(e||"").replace(E,((e,n,i,r,o,s)=>{const a=i||o||s,c=n||r||"";if(!a)return e;if(w.test(a)||k.test(a))return`url(${c}${a}${c})`;if(S.test(a))return`url(${c}${a}${c})`;if("/"===a[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${c})`;const l=t.split("/"),u=a.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const T=/^[^ \t\n\r\u000c]+/,_=/^[, \t\n\r\u000c]+/;function N(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function O(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function I(){const e=document.createElement("a");return e.href="",e.href}function R(e,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?N(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function i(e){let i;const r=e.exec(t.substring(n));return r?(i=r[0],n+=i.length,i):""}const r=[];for(;i(_),!(n>=t.length);){let o=i(T);if(","===o.slice(-1))o=N(e,o.substring(0,o.length-1)),r.push(o);else{let i="";o=N(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){r.push((o+i).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,r.push((o+i).trim());break}"("===e&&(s=!0)}i+=e,n+=1}}}return r.join(", ")}(e,i):"style"===n?C(i,I()):"object"===t&&"data"===n?N(e,i):i:N(e,i):i}function A(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function x(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&x(e.parentNode,t,n);for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}return!!n&&x(e.parentNode,t,n)}function M(e,t,n,i){try{const r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(i){if(r.closest(`.${t}`))return!0}else if(r.classList.contains(t))return!0}else if(x(r,t,i))return!0;if(n)if(i){if(r.closest(n))return!0}else if(r.matches(n))return!0}catch(e){}return!1}function L(e,n){const{doc:i,mirror:r,blockClass:s,blockSelector:a,needsMask:c,inlineStylesheet:p,maskInputOptions:f={},maskTextFn:v,maskInputFn:g,dataURLOptions:E={},inlineImages:w,recordCanvas:k,keepIframeSrcFn:S,newlyAddedElement:T=!1}=n,_=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(i,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:t.Document,childNodes:[],compatMode:e.compatMode}:{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:_};case e.ELEMENT_NODE:return function(e,n){const{doc:i,blockClass:r,blockSelector:s,inlineStylesheet:a,maskInputOptions:c={},maskInputFn:p,dataURLOptions:f={},inlineImages:v,recordCanvas:g,keepIframeSrcFn:E,newlyAddedElement:w=!1,rootId:k}=n,S=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,s),T=function(e){if(e instanceof HTMLFormElement)return"form";const t=u(e.tagName);return m.test(t)?"div":t}(e);let _={};const N=e.attributes.length;for(let t=0;t<N;t++){const n=e.attributes[t];A(T,n.name,n.value)||(_[n.name]=R(i,T,u(n.name),n.value))}if("link"===T&&a){const t=Array.from(i.styleSheets).find((t=>t.href===e.href));let n=null;t&&(n=o(t)),n&&(delete _.rel,delete _.href,_._cssText=C(n,t.href))}if("style"===T&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=o(e.sheet);t&&(_._cssText=C(t,I()))}if("input"===T||"textarea"===T||"select"===T){const t=e.value,n=e.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&t?_.value=l({element:e,type:h(e),tagName:T,value:t,maskInputOptions:c,maskInputFn:p}):n&&(_.checked=n)}"option"===T&&(e.selected&&!c.select?_.selected=!0:delete _.selected);if("canvas"===T&&g)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const r=t.getImageData,o=d in r?r[d]:r;if(new Uint32Array(o.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(_.rr_dataURL=e.toDataURL(f.type,f.quality));else if(!("__context"in e)){const t=e.toDataURL(f.type,f.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(f.type,f.quality)&&(_.rr_dataURL=t)}if("img"===T&&v){y||(y=i.createElement("canvas"),b=y.getContext("2d"));const t=e,n=t.crossOrigin;t.crossOrigin="anonymous";const r=()=>{t.removeEventListener("load",r);try{y.width=t.naturalWidth,y.height=t.naturalHeight,b.drawImage(t,0,0),_.rr_dataURL=y.toDataURL(f.type,f.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}n?_.crossOrigin=n:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?r():t.addEventListener("load",r)}"audio"!==T&&"video"!==T||(_.rr_mediaState=e.paused?"paused":"played",_.rr_mediaCurrentTime=e.currentTime);w||(e.scrollLeft&&(_.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(_.rr_scrollTop=e.scrollTop));if(S){const{width:t,height:n}=e.getBoundingClientRect();_={class:_.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==T||E(_.src)||(e.contentDocument||(_.rr_src=_.src),delete _.src);let x;try{customElements.get(T)&&(x=!0)}catch(e){}return{type:t.Element,tagName:T,attributes:_,childNodes:[],isSVG:O(e)||void 0,needBlock:S,rootId:k,isCustom:x}}(e,{doc:i,blockClass:s,blockSelector:a,inlineStylesheet:p,maskInputOptions:f,maskInputFn:g,dataURLOptions:E,inlineImages:w,recordCanvas:k,keepIframeSrcFn:S,newlyAddedElement:T,rootId:_});case e.TEXT_NODE:return function(e,n){var i;const{needsMask:r,maskTextFn:s,rootId:a}=n,c=e.parentNode&&e.parentNode.tagName;let l=e.textContent;const u="STYLE"===c||void 0,d="SCRIPT"===c||void 0;if(u&&l){try{e.nextSibling||e.previousSibling||(null===(i=e.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(l=o(e.parentNode.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}l=C(l,I())}d&&(l="SCRIPT_PLACEHOLDER");!u&&!d&&l&&r&&(l=s?s(l,e.parentElement):l.replace(/[\S]/g,"*"));return{type:t.Text,textContent:l||"",isStyle:u,rootId:a}}(e,{needsMask:c,maskTextFn:v,rootId:_});case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:"",rootId:_};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||"",rootId:_};default:return!1}}function P(e){return null==e?"":e.toLowerCase()}function D(e,o){const{doc:s,mirror:a,blockClass:c,blockSelector:l,maskTextClass:u,maskTextSelector:d,skipChild:h=!1,inlineStylesheet:f=!0,maskInputOptions:m={},maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w={},inlineImages:k=!1,recordCanvas:S=!1,onSerialize:C,onIframeLoad:T,iframeLoadTimeout:_=5e3,onStylesheetLoad:N,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:I=(()=>!1),newlyAddedElement:R=!1}=o;let{needsMask:A}=o,{preserveWhiteSpace:x=!0}=o;if(!A&&e.childNodes){A=M(e,u,d,void 0===A)}const F=L(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:A,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,dataURLOptions:w,inlineImages:k,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:R});if(!F)return console.warn(e,"not serialized"),null;let U;U=a.hasNode(e)?a.getId(e):!function(e,n){if(n.comment&&e.type===t.Comment)return!0;if(e.type===t.Element){if(n.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===p(e.attributes.href)))return!0;if(n.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(P(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===P(e.attributes.name)||"icon"===P(e.attributes.rel)||"apple-touch-icon"===P(e.attributes.rel)||"shortcut icon"===P(e.attributes.rel))))return!0;if("meta"===e.tagName){if(n.headMetaDescKeywords&&P(e.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(P(e.attributes.property).match(/^(og|twitter|fb):/)||P(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===P(e.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===P(e.attributes.name)||"googlebot"===P(e.attributes.name)||"bingbot"===P(e.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===P(e.attributes.name)||"generator"===P(e.attributes.name)||"framework"===P(e.attributes.name)||"publisher"===P(e.attributes.name)||"progid"===P(e.attributes.name)||P(e.attributes.property).match(/^article:/)||P(e.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===P(e.attributes.name)||"yandex-verification"===P(e.attributes.name)||"csrf-token"===P(e.attributes.name)||"p:domain_verify"===P(e.attributes.name)||"verify-v1"===P(e.attributes.name)||"verification"===P(e.attributes.name)||"shopify-checkout-api-token"===P(e.attributes.name)))return!0}}return!1}(F,E)&&(x||F.type!==t.Text||F.isStyle||F.textContent.replace(/^\s+|\s+$/gm,"").length)?g():v;const H=Object.assign(F,{id:U});if(a.add(e,H),U===v)return null;C&&C(e);let j=!h;if(H.type===t.Element){j=j&&!H.needBlock,delete H.needBlock;const t=e.shadowRoot;t&&r(t)&&(H.isShadowHost=!0)}if((H.type===t.Document||H.type===t.Element)&&j){E.headWhitespace&&H.type===t.Element&&"head"===H.tagName&&(x=!1);const i={doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:A,maskTextClass:u,maskTextSelector:d,skipChild:h,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:C,onIframeLoad:T,iframeLoadTimeout:_,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:I};if(H.type===t.Element&&"textarea"===H.tagName&&void 0!==H.attributes.value);else for(const t of Array.from(e.childNodes)){const e=D(t,i);e&&H.childNodes.push(e)}if(n(e)&&e.shadowRoot)for(const t of Array.from(e.shadowRoot.childNodes)){const n=D(t,i);n&&(r(e.shadowRoot)&&(n.isShadow=!0),H.childNodes.push(n))}}return e.parentNode&&i(e.parentNode)&&r(e.parentNode)&&(H.isShadow=!0),H.type===t.Element&&"iframe"===H.tagName&&function(e,t,n){const i=e.contentWindow;if(!i)return;let r,o=!1;try{r=i.document.readyState}catch(e){return}if("complete"!==r){const i=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),o=!0,t()}))}const s="about:blank";if(i.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&T){const n=D(t,{doc:t,mirror:a,blockClass:c,blockSelector:l,needsMask:A,maskTextClass:u,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:C,onIframeLoad:T,iframeLoadTimeout:_,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:I});n&&T(e,n)}}),_),H.type===t.Element&&"link"===H.tagName&&"string"==typeof H.attributes.rel&&("stylesheet"===H.attributes.rel||"preload"===H.attributes.rel&&"string"==typeof H.attributes.href&&"css"===p(H.attributes.href))&&function(e,t,n){let i,r=!1;try{i=e.sheet}catch(e){return}if(i)return;const o=setTimeout((()=>{r||(t(),r=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),r=!0,t()}))}(e,(()=>{if(N){const t=D(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:A,maskTextClass:u,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:C,onIframeLoad:T,iframeLoadTimeout:_,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:I});t&&N(e,t)}}),O),H}const F=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function U(e,t={}){let n=1,i=1;function r(e){const t=e.match(/\n/g);t&&(n+=t.length);const r=e.lastIndexOf("\n");i=-1===r?i+e.length:e.length-r}function o(){const e={line:n,column:i};return t=>(t.position=new s(e),p(),t)}class s{constructor(e){this.start=e,this.end={line:n,column:i},this.source=t.source}}s.prototype.content=e;const a=[];function c(r){const o=new Error(`${t.source||""}:${n}:${i}: ${r}`);if(o.reason=r,o.filename=t.source,o.line=n,o.column=i,o.source=e,!t.silent)throw o;a.push(o)}function l(){return h(/^{\s*/)}function u(){return h(/^}/)}function d(){let t;const n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=C()||T());)t&&(n.push(t),f(n));return n}function h(t){const n=t.exec(e);if(!n)return;const i=n[0];return r(i),e=e.slice(i.length),n}function p(){h(/^\s*/)}function f(e=[]){let t;for(;t=m();)t&&e.push(t),t=m();return e}function m(){const t=o();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const s=e.slice(2,n-2);return i+=2,r(s),e=e.slice(n),i+=2,t({type:"comment",comment:s})}function v(){const e=h(/^([^{]+)/);if(e)return H(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,"‌"))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function g(){const e=o(),t=h(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=H(t[0]);if(!h(/^:\s*/))return c("property missing ':'");const i=h(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),r=e({type:"declaration",property:n.replace(F,""),value:i?H(i[0]).replace(F,""):""});return h(/^[;\s]*/),r}function y(){const e=[];if(!l())return c("missing '{'");let t;for(f(e);t=g();)!1!==t&&(e.push(t),f(e)),t=g();return u()?e:c("missing '}'")}function b(){let e;const t=[],n=o();for(;e=h(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),h(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:y()})}const E=S("import"),w=S("charset"),k=S("namespace");function S(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=o(),i=h(t);if(!i)return;const r={type:e};return r[e]=i[1].trim(),n(r)}}function C(){if("@"===e[0])return function(){const e=o();let t=h(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=h(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const i=t[1];if(!l())return c("@keyframes missing '{'");let r,s=f();for(;r=b();)s.push(r),s=s.concat(f());return u()?e({type:"keyframes",name:i,vendor:n,keyframes:s}):c("@keyframes missing '}'")}()||function(){const e=o(),t=h(/^@media *([^{]+)/);if(!t)return;const n=H(t[1]);if(!l())return c("@media missing '{'");const i=f().concat(d());return u()?e({type:"media",media:n,rules:i}):c("@media missing '}'")}()||function(){const e=o(),t=h(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:H(t[1]),media:H(t[2])})}()||function(){const e=o(),t=h(/^@supports *([^{]+)/);if(!t)return;const n=H(t[1]);if(!l())return c("@supports missing '{'");const i=f().concat(d());return u()?e({type:"supports",supports:n,rules:i}):c("@supports missing '}'")}()||E()||w()||k()||function(){const e=o(),t=h(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=H(t[1]),i=H(t[2]);if(!l())return c("@document missing '{'");const r=f().concat(d());return u()?e({type:"document",document:i,vendor:n,rules:r}):c("@document missing '}'")}()||function(){const e=o();if(!h(/^@page */))return;const t=v()||[];if(!l())return c("@page missing '{'");let n,i=f();for(;n=g();)i.push(n),i=i.concat(f());return u()?e({type:"page",selectors:t,declarations:i}):c("@page missing '}'")}()||function(){const e=o();if(!h(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=f().concat(d());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=o();if(!h(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=f();for(;t=g();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function T(){const e=o(),t=v();return t?(f(),e({type:"rule",selectors:t,declarations:y()})):c("selector missing")}return j(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:a}}}())}function H(e){return e?e.replace(/^\s+|\s+$/g,""):""}function j(e,t){const n=e&&"string"==typeof e.type,i=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{j(e,i)})):n&&"object"==typeof n&&j(n,i)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const B={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function V(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const z=/(max|min)-device-(width|height)/,W=new RegExp(z.source,"g"),q=/([^\\]):hover/,G=new RegExp(q.source,"g");function K(e,t){const n=null==t?void 0:t.stylesWithHoverClass.get(e);if(n)return n;const i=U(e,{silent:!0});if(!i.stylesheet)return e;const r=[],o=[];!function e(t){"selectors"in t&&t.selectors&&t.selectors.forEach((e=>{q.test(e)&&r.push(e)})),"media"in t&&t.media&&z.test(t.media)&&o.push(t.media),"rules"in t&&t.rules&&t.rules.forEach(e)}(i.stylesheet);let s=e;if(r.length>0){const e=new RegExp(r.filter(((e,t)=>r.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>V(e))).join("|"),"g");s=s.replace(e,(e=>{const t=e.replace(G,"$1.\\:hover");return`${e}, ${t}`}))}if(o.length>0){const e=new RegExp(o.filter(((e,t)=>o.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>V(e))).join("|"),"g");s=s.replace(e,(e=>e.replace(W,"$1-$2")))}return null==t||t.stylesWithHoverClass.set(e,s),s}function Y(){return{stylesWithHoverClass:new Map}}function $(e,n){var i;const{doc:r,hackCss:o,cache:s}=n;switch(e.type){case t.Document:return r.implementation.createDocument(null,"",null);case t.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case t.Element:{const t=function(e){let t=B[e.tagName]?B[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);let n;e.isSVG?n=r.createElementNS("http://www.w3.org/2000/svg",t):(e.isCustom&&(null===(i=r.defaultView)||void 0===i?void 0:i.customElements)&&!r.defaultView.customElements.get(e.tagName)&&r.defaultView.customElements.define(e.tagName,class extends r.defaultView.HTMLElement{}),n=r.createElement(t));const a={};for(const i in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,i))continue;let c=e.attributes[i];if("option"===t&&"selected"===i&&!1===c)continue;if(null===c)continue;if(!0===c&&(c=""),i.startsWith("rr_")){a[i]=c;continue}const l="textarea"===t&&"value"===i,u="style"===t&&"_cssText"===i;if(u&&o&&"string"==typeof c&&(c=K(c,s)),!l&&!u||"string"!=typeof c)try{if(e.isSVG&&"xlink:href"===i)n.setAttributeNS("http://www.w3.org/1999/xlink",i,c.toString());else if("onload"===i||"onclick"===i||"onmouse"===i.substring(0,7))n.setAttribute("_"+i,c.toString());else{if("meta"===t&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===i){n.setAttribute("csp-content",c.toString());continue}("link"!==t||"preload"!==e.attributes.rel&&"modulepreload"!==e.attributes.rel||"script"!==e.attributes.as)&&("link"===t&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||("img"===t&&e.attributes.srcset&&e.attributes.rr_dataURL?n.setAttribute("rrweb-original-srcset",e.attributes.srcset):n.setAttribute(i,c.toString())))}}catch(e){}else n.appendChild(r.createTextNode(c)),e.childNodes=[]}for(const i in a){const r=a[i];if("canvas"===t&&"rr_dataURL"===i){const e=document.createElement("img");e.onload=()=>{const t=n.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=r.toString(),n.RRNodeType&&(n.rr_dataURL=r.toString())}else if("img"===t&&"rr_dataURL"===i){const t=n;t.currentSrc.startsWith("data:")||(t.setAttribute("rrweb-original-src",e.attributes.src),t.src=r.toString())}if("rr_width"===i)n.style.width=r.toString();else if("rr_height"===i)n.style.height=r.toString();else if("rr_mediaCurrentTime"===i&&"number"==typeof r)n.currentTime=r;else if("rr_mediaState"===i)switch(r){case"played":n.play().catch((e=>console.warn("media playback error",e)));break;case"paused":n.pause()}}if(e.isShadowHost)if(n.shadowRoot)for(;n.shadowRoot.firstChild;)n.shadowRoot.removeChild(n.shadowRoot.firstChild);else n.attachShadow({mode:"open"});return n}case t.Text:return r.createTextNode(e.isStyle&&o?K(e.textContent,s):e.textContent);case t.CDATA:return r.createCDATASection(e.textContent);case t.Comment:return r.createComment(e.textContent);default:return null}}function Z(e,i){const{doc:r,mirror:o,skipChild:s=!1,hackCss:a=!0,afterAppend:c,cache:l}=i;if(o.has(e.id)){const n=o.getNode(e.id);if(function(e,n){return!(!e||!n||e.type!==n.type)&&(e.type===t.Document?e.compatMode===n.compatMode:e.type===t.DocumentType?e.name===n.name&&e.publicId===n.publicId&&e.systemId===n.systemId:e.type===t.Comment||e.type===t.Text||e.type===t.CDATA?e.textContent===n.textContent:e.type===t.Element&&e.tagName===n.tagName&&JSON.stringify(e.attributes)===JSON.stringify(n.attributes)&&e.isSVG===n.isSVG&&e.needBlock===n.needBlock)}(o.getMeta(n),e))return o.getNode(e.id)}let u=$(e,{doc:r,hackCss:a,cache:l});if(!u)return null;if(e.rootId&&o.getNode(e.rootId)!==r&&o.replace(e.rootId,r),e.type===t.Document&&(r.close(),r.open(),"BackCompat"===e.compatMode&&e.childNodes&&e.childNodes[0].type!==t.DocumentType&&(e.childNodes[0].type===t.Element&&"xmlns"in e.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===e.childNodes[0].attributes.xmlns?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=r),o.add(u,e),(e.type===t.Document||e.type===t.Element)&&!s)for(const i of e.childNodes){const s=Z(i,{doc:r,mirror:o,skipChild:!1,hackCss:a,afterAppend:c,cache:l});if(s){if(i.isShadow&&n(u)&&u.shadowRoot)u.shadowRoot.appendChild(s);else if(e.type===t.Document&&i.type==t.Element){const e=s;let t=null;e.childNodes.forEach((e=>{"BODY"===e.nodeName&&(t=e)})),t?(e.removeChild(t),u.appendChild(s),e.appendChild(t)):u.appendChild(s)}else u.appendChild(s);c&&c(s,i.id)}else console.warn("Failed to rebuild",i)}return u}function J(e,n){const{doc:i,onVisit:r,hackCss:o=!0,afterAppend:s,cache:c,mirror:l=new a}=n,u=Z(e,{doc:i,mirror:l,skipChild:!1,hackCss:o,afterAppend:s,cache:c});return function(e,t){for(const i of e.getIds())e.has(i)&&(n=e.getNode(i),t(n));var n}(l,(e=>{r&&r(e),function(e,n){const i=n.getMeta(e);if((null==i?void 0:i.type)!==t.Element)return;const r=e;for(const e in i.attributes){if(!Object.prototype.hasOwnProperty.call(i.attributes,e)||!e.startsWith("rr_"))continue;const t=i.attributes[e];"rr_scrollLeft"===e&&(r.scrollLeft=t),"rr_scrollTop"===e&&(r.scrollTop=t)}}(e,l)})),u}function X(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const Q="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";function ee(e,t,n={}){let i=null,r=0;return function(...o){const s=Date.now();r||!1!==n.leading||(r=s);const a=t-(s-r),c=this;a<=0||a>t?(i&&(clearTimeout(i),i=null),r=s,e.apply(c,o)):i||!1===n.trailing||(i=setTimeout((()=>{r=!1===n.leading?0:Date.now(),i=null,e.apply(c,o)}),a))}}function te(e,t,n,i,r=window){const o=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>te(e,t,o||{},!0)}function ne(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],r=n(i);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=r,()=>{e[t]=i}}catch(e){return()=>{}}}e.mirror={map:{},getId:()=>(console.error(Q),-1),getNode:()=>(console.error(Q),null),removeNodeFromMap(){console.error(Q)},has:()=>(console.error(Q),!1),reset(){console.error(Q)}},"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(e.mirror=new Proxy(e.mirror,{get:(e,t,n)=>("map"===t&&console.error(Q),Reflect.get(e,t,n))}));let ie=Date.now;function re(e){var t,n,i,r,o,s;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(o=null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.parentElement)||void 0===o?void 0:o.scrollTop)||(null===(s=null==a?void 0:a.body)||void 0===s?void 0:s.scrollTop)||0}}function oe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function se(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ae(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function ce(e,t,n,i){if(!e)return!1;const r=ae(e);if(!r)return!1;try{if("string"==typeof t){if(r.classList.contains(t))return!0;if(i&&null!==r.closest("."+t))return!0}else if(x(r,t,i))return!0}catch(e){}if(n){if(r.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function le(e,t){return-1!==t.getId(e)}function ue(e,t){return t.getId(e)===v}function de(e,t){if(i(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||de(e.parentNode,t))}function he(e){return Boolean(e.changedTouches)}function pe(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}function fe(e){const t={},n=(e,n)=>{const i={value:e,parent:n,children:[]};return t[e.node.id]=i,i},i=[];for(const r of e){const{nextId:e,parentId:o}=r;if(e&&e in t){const o=t[e];if(o.parent){const e=o.parent.children.indexOf(o);o.parent.children.splice(e,0,n(r,o.parent))}else{const e=i.indexOf(o);i.splice(e,0,n(r,null))}}else if(o in t){const e=t[o];e.children.push(n(r,e))}else i.push(n(r,null))}return i}function me(e,t){t(e.value);for(let n=e.children.length-1;n>=0;n--)me(e.children[n],t)}function ve(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ge(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ye(e,t){var n,i;const r=null===(i=null===(n=e.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===i?void 0:i.frameElement;if(!r||r===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const o=r.getBoundingClientRect(),s=ye(r,t),a=o.height/r.clientHeight;return{x:o.x*s.relativeScale+s.x,y:o.y*s.relativeScale+s.y,relativeScale:a,absoluteScale:s.absoluteScale*a}}function be(e){return Boolean(null==e?void 0:e.shadowRoot)}function Ee(e,t){const n=e[t[0]];return 1===t.length?n:Ee(n.cssRules[t[1]].cssRules,t.slice(2))}function we(e){const t=[...e],n=t.pop();return{positions:t,index:n}}function ke(e){const t=new Set,n=[];for(let i=e.length;i--;){const r=e[i];t.has(r.id)||(n.push(r),t.add(r.id))}return n}/[1-9][0-9]{12}/.test(Date.now().toString())||(ie=()=>(new Date).getTime());class Se{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ce(e){var t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function Te(e){let t,n=e;for(;t=Ce(n);)n=t;return n}function _e(e){const t=e.ownerDocument;if(!t)return!1;const n=Te(e);return t.contains(n)}function Ne(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||_e(e))}var Oe=Object.freeze({__proto__:null,on:X,get _mirror(){return e.mirror},throttle:ee,hookSetter:te,patch:ne,get nowTimestamp(){return ie},getWindowScroll:re,getWindowHeight:oe,getWindowWidth:se,closestElementOfNode:ae,isBlocked:ce,isSerialized:le,isIgnored:ue,isAncestorRemoved:de,legacy_isTouchEvent:he,polyfill:pe,queueToResolveTrees:fe,iterateResolveTree:me,isSerializedIframe:ve,isSerializedStylesheet:ge,getBaseDimension:ye,hasShadowRoot:be,getNestedRule:Ee,getPositionsAndIndex:we,uniqueTextMutations:ke,StyleSheetMirror:Se,getShadowHost:Ce,getRootShadowHost:Te,shadowHostInDom:_e,inDom:Ne}),Ie=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Ie||{}),Re=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Re||{}),Ae=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Ae||{}),xe=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(xe||{}),Me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Me||{}),Le=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(Le||{});function Pe(e){return"__ln"in e}class De{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Pe(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Pe(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Fe=(e,t)=>`${e}@${t}`;class Ue{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new De,r=e=>{let t=e,n=v;for(;n===v;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!Ne(o)||"TEXTAREA"===o.parentNode.tagName)return;const s=i(o.parentNode)?this.mirror.getId(Ce(o)):this.mirror.getId(o.parentNode),a=r(o);if(-1===s||-1===a)return n.addNode(o);const c=D(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{ve(e,this.mirror)&&this.iframeManager.addIframe(e),ge(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),be(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)je(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)Ve(this.droppedSet,e)||je(this.removes,e,this.mirror)?Ve(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const a={texts:this.texts.map((e=>{const t=e.node;return"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!ue(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;ce(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:M(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ae(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,i=e.target.getAttribute(n);if("value"===n){const e=h(t);i=l({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:i,maskInputFn:this.maskInputFn})}if(ce(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let r=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(i)){if(t.contentDocument)return;n="rr_src"}if(r||(r={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(e.target,r)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!A(t.tagName,n)&&(r.attributes[n]=R(this.doc,u(t.tagName),u(n),i),"style"===n)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const i=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);i!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?r.styleDiff[e]=""===o?i:[i,o]:r._unchangedStyles[e]=[i,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(r.styleDiff[e]=!1)}break}case"childList":if(ce(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),o=i(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ce(e.target,this.blockClass,this.blockSelector,!1)||ue(t,this.mirror)||!le(t,this.mirror)||(this.addedSet.has(t)?(He(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||de(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Fe(n,o)]?He(this.movedSet,t):this.removes.push({parentId:o,id:n,isShadow:!(!i(e.target)||!r(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ue(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Fe(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ce(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),be(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function He(e,t){e.delete(t),t.childNodes.forEach((t=>He(e,t)))}function je(e,t,n){return 0!==e.length&&Be(e,t,n)}function Be(e,t,n){const{parentNode:i}=t;if(!i)return!1;const r=n.getId(i);return!!e.some((e=>e.id===r))||Be(e,i,n)}function Ve(e,t){return 0!==e.size&&ze(e,t)}function ze(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||ze(e,n))}let We;function qe(e){We=e}function Ge(){We=void 0}const Ke=e=>{if(!We)return e;return(...t)=>{try{return e(...t)}catch(e){if(We&&!0===We(e))return;throw e}}},Ye=[];function $e(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function Ze(e,t){var n,i;const r=new Ue;Ye.push(r),r.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const s=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");s&&window[s]&&(o=window[s]);const a=new o(Ke(r.processMutations.bind(r)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Je({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];let c=null;return Object.keys(Ae).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e])).forEach((o=>{let s=u(o);const l=(t=>o=>{const s=$e(o);if(ce(s,i,r,!0))return;let a=null,l=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=xe.Mouse;break;case"touch":a=xe.Touch;break;case"pen":a=xe.Pen}a===xe.Touch?Ae[t]===Ae.MouseDown?l="TouchStart":Ae[t]===Ae.MouseUp&&(l="TouchEnd"):xe.Pen}else he(o)&&(a=xe.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===xe.Touch||l.startsWith("Mouse")&&a===xe.Mouse)&&(a=null)):Ae[t]===Ae.Click&&(a=c,c=null);const u=he(o)?o.changedTouches[0]:o;if(!u)return;const d=n.getId(s),{clientX:h,clientY:p}=u;Ke(e)(Object.assign({type:Ae[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(o);if(window.PointerEvent)switch(Ae[o]){case Ae.MouseDown:case Ae.MouseUp:s=s.replace("mouse","pointer");break;case Ae.TouchStart:case Ae.TouchEnd:return}a.push(X(s,l,t))})),Ke((()=>{a.forEach((e=>e()))}))}function Xe({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,sampling:o}){return X("scroll",Ke(ee(Ke((o=>{const s=$e(o);if(!s||ce(s,i,r,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=re(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})})),o.scroll||100)),t)}const Qe=["INPUT","TEXTAREA","SELECT"],et=new WeakMap;function tt(e){return function(e,t){if(ot("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ot("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ot("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ot("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function nt(e,t,n){let i,r;return e?(e.ownerNode?i=t.getId(e.ownerNode):r=n.getId(e),{styleId:r,id:i}):{}}function it({mirror:e,stylesheetManager:t},n){var i,r,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(o=null===(r=n.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===o?void 0:o.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return i}}),Ke((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function rt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:r,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),r(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),f(...e)}}(e,t),e.recordDOM&&(i=Ze(e,e.doc));const r=function({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const r="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=ee(Ke((t=>{const n=Date.now()-s;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],s=null})),o),l=Ke(ee(Ke((e=>{const t=$e(e),{clientX:n,clientY:r}=he(e)?e.changedTouches[0]:e;s||(s=ie()),a.push({x:n,y:r,id:i.getId(t),timeOffset:ie()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?Re.Drag:e instanceof MouseEvent?Re.MouseMove:Re.TouchMove)})),r,{trailing:!1})),u=[X("mousemove",l,n),X("touchmove",l,n),X("drag",l,n)];return Ke((()=>{u.forEach((e=>e()))}))}(e),o=Je(e),s=Xe(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return X("resize",Ke(ee(Ke((()=>{const t=oe(),r=se();n===t&&i===r||(e({width:Number(r),height:Number(t)}),n=t,i=r)})),200)),t)}(e,{win:n}),c=function({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:c,sampling:u,userTriggeredOnInput:d}){function p(e){let n=$e(e);const u=e.isTrusted,p=n&&n.tagName;if(n&&"OPTION"===p&&(n=n.parentElement),!n||!p||Qe.indexOf(p)<0||ce(n,i,r,!0))return;if(n.classList.contains(o)||s&&n.matches(s))return;let m=n.value,v=!1;const g=h(n)||"";"radio"===g||"checkbox"===g?v=n.checked:(a[p.toLowerCase()]||a[g])&&(m=l({element:n,maskInputOptions:a,tagName:p,type:g,value:m,maskInputFn:c})),f(n,d?{text:m,isChecked:v,userTriggered:u}:{text:m,isChecked:v});const y=n.name;"radio"===g&&y&&v&&t.querySelectorAll(`input[type="radio"][name="${y}"]`).forEach((e=>{if(e!==n){const t=e.value;f(e,d?{text:t,isChecked:!v,userTriggered:!1}:{text:t,isChecked:!v})}}))}function f(t,i){const r=et.get(t);if(!r||r.text!==i.text||r.isChecked!==i.isChecked){et.set(t,i);const r=n.getId(t);Ke(e)(Object.assign(Object.assign({},i),{id:r}))}}const m=("last"===u.input?["change"]:["input","change"]).map((e=>X(e,Ke(p),t))),v=t.defaultView;if(!v)return()=>{m.forEach((e=>e()))};const g=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value"),y=[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&m.push(...y.map((e=>te(e[0],e[1],{set(){Ke(p)({target:this,isTrusted:!1})}},!1,v)))),Ke((()=>{m.forEach((e=>e()))}))}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:r,doc:o}){const s=Ke((o=>ee(Ke((r=>{const s=$e(r);if(!s||ce(s,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=s;e({type:o,id:i.getId(s),currentTime:a,volume:c,muted:l,playbackRate:u})})),r.media||500))),a=[X("play",s(0),o),X("pause",s(1),o),X("seeked",s(2),o),X("volumechange",s(3),o),X("ratechange",s(4),o)];return Ke((()=>{a.forEach((e=>e()))}))}(e);let d=()=>{},p=()=>{},f=()=>{},m=()=>{};e.recordDOM&&(d=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const r=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Ke(((i,r,o)=>{const[s,a]=o,{id:c,styleId:l}=nt(r,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:a}]}),i.apply(r,o)}))});const o=i.CSSStyleSheet.prototype.deleteRule;let s,a;i.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:s}]}),i.apply(r,o)}))}),i.CSSStyleSheet.prototype.replace&&(s=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:s}),i.apply(r,o)}))})),i.CSSStyleSheet.prototype.replaceSync&&(a=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:s}),i.apply(r,o)}))}));const c={};st("CSSGroupingRule")?c.CSSGroupingRule=i.CSSGroupingRule:(st("CSSMediaRule")&&(c.CSSMediaRule=i.CSSMediaRule),st("CSSConditionRule")&&(c.CSSConditionRule=i.CSSConditionRule),st("CSSSupportsRule")&&(c.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(c).forEach((([i,r])=>{l[i]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(l[i].insertRule,{apply:Ke(((i,r,o)=>{const[s,a]=o,{id:c,styleId:l}=nt(r.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:[...tt(r),a||0]}]}),i.apply(r,o)}))}),r.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...tt(r),s]}]}),i.apply(r,o)}))})})),Ke((()=>{i.CSSStyleSheet.prototype.insertRule=r,i.CSSStyleSheet.prototype.deleteRule=o,s&&(i.CSSStyleSheet.prototype.replace=s),a&&(i.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),p=it(e,e.doc),f=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:r}){const o=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Ke(((r,s,a)=>{var c;const[l,u,d]=a;if(n.has(l))return o.apply(s,[l,u,d]);const{id:h,styleId:p}=nt(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,i.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:l,value:u,priority:d},index:tt(s.parentRule)}),r.apply(s,a)}))});const s=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:Ke(((r,o,a)=>{var c;const[l]=a;if(n.has(l))return s.apply(o,[l]);const{id:u,styleId:d}=nt(null===(c=o.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,i.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,remove:{property:l},index:tt(o.parentRule)}),r.apply(o,a)}))}),Ke((()=>{r.CSSStyleDeclaration.prototype.setProperty=o,r.CSSStyleDeclaration.prototype.removeProperty=s}))}(e,{win:n}),e.collectFonts&&(m=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],r=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const i=new o(e,t,n);return r.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const s=ne(t.fonts,"add",(function(t){return function(n){return setTimeout(Ke((()=>{const t=r.get(n);t&&(e(t),r.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=o})),i.push(s),Ke((()=>{i.forEach((e=>e()))}))}(e)));const v=function(e){const{doc:t,mirror:n,blockClass:i,blockSelector:r,selectionCb:o}=e;let s=!0;const a=Ke((()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const o=e.getRangeAt(t),{startContainer:s,startOffset:c,endContainer:l,endOffset:u}=o;ce(s,i,r,!0)||ce(l,i,r,!0)||a.push({start:n.getId(s),startOffset:c,end:n.getId(l),endOffset:u})}o({ranges:a})}));return a(),X("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?ne(n.customElements,"define",(function(e){return function(n,i,r){try{t({define:{name:n}})}catch(e){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,r])}})):()=>{}}(e),y=[];for(const t of e.plugins)y.push(t.observer(t.callback,n,t.options));return Ke((()=>{Ye.forEach((e=>e.reset())),null==i||i.disconnect(),r(),o(),s(),a(),c(),u(),d(),p(),f(),m(),v(),g(),y.forEach((e=>e()))}))}function ot(e){return void 0!==window[e]}function st(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class at{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const r=n||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let s=r.get(t);return s||(s=this.generateIdFn(),r.set(t,s),o.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const r=i.get(t);return r||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class ct{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new at(g),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new at(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case Ie.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:Ie.IncrementalSnapshot,data:{source:Re.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ie.Meta:case Ie.Load:case Ie.DomContentLoaded:return!1;case Ie.Plugin:return t;case Ie.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ie.IncrementalSnapshot:switch(t.data.source){case Re.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Re.Drag:case Re.TouchMove:case Re.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Re.ViewportResize:return!1;case Re.MediaInteraction:case Re.MouseInteraction:case Re.Scroll:case Re.CanvasMutation:case Re.Input:return this.replaceIds(t.data,e,["id"]),t;case Re.StyleSheetRule:case Re.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Re.Font:return t;case Re.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Re.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const r of i)(Array.isArray(t[r])||"number"==typeof t[r])&&(Array.isArray(t[r])?t[r]=e.getIds(n,t[r]):t[r]=e.getId(n,t[r]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,n){e.type===t.Document||e.rootId||(e.rootId=n),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,n)}))}}class lt{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!r(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=Ze(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(Xe(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(it({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(ne(e.prototype,"attachShadow",(function(e){return function(i){const r=e.call(this,i);return this.shadowRoot&&Ne(this)&&n.addShadowRoot(this.shadowRoot,t),r}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
20
+ /*! *****************************************************************************
21
+ Copyright (c) Microsoft Corporation.
22
+
23
+ Permission to use, copy, modify, and/or distribute this software for any
24
+ purpose with or without fee is hereby granted.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
27
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
28
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
29
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
30
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
31
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
32
+ PERFORMANCE OF THIS SOFTWARE.
33
+ ***************************************************************************** */function ut(e,t,n,i){return new(n||(n=Promise))((function(t,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,s)}a((i=i.apply(e,[])).next())}))}for(var dt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ht="undefined"==typeof Uint8Array?[]:new Uint8Array(256),pt=0;pt<64;pt++)ht[dt.charCodeAt(pt)]=pt;var ft=function(e){var t,n,i,r,o,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=ht[e.charCodeAt(t)],i=ht[e.charCodeAt(t+1)],r=ht[e.charCodeAt(t+2)],o=ht[e.charCodeAt(t+3)],u[c++]=n<<2|i>>4,u[c++]=(15&i)<<4|r>>2,u[c++]=(3&r)<<6|63&o;return l};const mt=new Map;const vt=(e,t,n)=>{if(!e||!bt(e,t)&&"object"!=typeof e)return;const i=function(e,t){let n=mt.get(e);return n||(n=new Map,mt.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let r=i.indexOf(e);return-1===r&&(r=i.length,i.push(e)),r};function gt(e,t,n){if(e instanceof Array)return e.map((e=>gt(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),i=n.length,r="";for(t=0;t<i;t+=3)r+=dt[n[t]>>2],r+=dt[(3&n[t])<<4|n[t+1]>>4],r+=dt[(15&n[t+1])<<2|n[t+2]>>6],r+=dt[63&n[t+2]];return i%3==2?r=r.substring(0,r.length-1)+"=":i%3==1&&(r=r.substring(0,r.length-2)+"=="),r}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[gt(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[gt(e.data,t,n),e.width,e.height]}}if(bt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:vt(e,t,n)}}return e}const yt=(e,t,n)=>e.map((e=>gt(e,t,n))),bt=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Et(e,t,n,i){const r=[];try{const o=ne(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(r,...o){if(!ce(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(r);if("__context"in this||(this.__context=e),i&&["webgl","webgl2"].includes(e))if(o[0]&&"object"==typeof o[0]){const e=o[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[r,...o])}}));r.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach((e=>e()))}}function wt(e,t,n,i,r,o,s){const a=[],c=Object.getOwnPropertyNames(e);for(const o of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(o))try{if("function"!=typeof e[o])continue;const c=ne(e,o,(function(e){return function(...a){const c=e.apply(this,a);if(vt(c,s,this),"tagName"in this.canvas&&!ce(this.canvas,i,r,!0)){const e=yt(a,s,this),i={type:t,property:o,args:e};n(this.canvas,i)}return c}}));a.push(c)}catch(i){const r=te(e,o,{set(e){n(this.canvas,{type:t,property:o,args:[e],setter:!0})}});a.push(r)}return a}var kt,St,Ct=(kt=function(){!function(){
34
+ /*! *****************************************************************************
35
+ Copyright (c) Microsoft Corporation.
36
+
37
+ Permission to use, copy, modify, and/or distribute this software for any
38
+ purpose with or without fee is hereby granted.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
41
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
42
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
43
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
44
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
45
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
46
+ PERFORMANCE OF THIS SOFTWARE.
47
+ ***************************************************************************** */
48
+ function e(e,t,n,i){return new(n||(n=Promise))((function(t,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,s)}a((i=i.apply(e,[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),i=0;i<64;i++)n[t.charCodeAt(i)]=i;var r=function(e){var n,i=new Uint8Array(e),r=i.length,o="";for(n=0;n<r;n+=3)o+=t[i[n]>>2],o+=t[(3&i[n])<<4|i[n+1]>>4],o+=t[(15&i[n+1])<<2|i[n+2]>>6],o+=t[63&i[n+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o};const o=new Map,s=new Map,a=self;a.onmessage=function(t){return e(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{const{id:n,bitmap:i,width:c,height:l,dataURLOptions:u}=t.data,d=function(t,n,i){return e(this,0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(s.has(e))return s.get(e);const o=new OffscreenCanvas(t,n);o.getContext("2d");const a=yield o.convertToBlob(i),c=yield a.arrayBuffer(),l=r(c);return s.set(e,l),l}return""}))}(c,l,u),h=new OffscreenCanvas(c,l);h.getContext("2d").drawImage(i,0,0),i.close();const p=yield h.convertToBlob(u),f=p.type,m=yield p.arrayBuffer(),v=r(m);if(!o.has(n)&&(yield d)===v)return o.set(n,v),a.postMessage({id:n});if(o.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:f,base64:v,width:c,height:l}),o.set(n,v)}}))}}()},function(e){return St=St||function(e,t){var n=function(e,t){var n=e.toString().split("\n");n.pop(),n.shift();for(var i=n[0].search(/\S/),r=/(['"])__worker_loader_strict__(['"])/g,o=0,s=n.length;o<s;++o)n[o]=n[o].substring(i).replace(r,"$1use strict$2")+"\n";return n}(e),i=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(i)}(kt),new Worker(St,e)});class Tt{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:r,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,i,r),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,r,{dataURLOptions:s})}initCanvasFPSObserver(e,t,n,i,r){const o=Et(t,n,i,!0),s=new Map,a=new Ct;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:r,height:o}=e.data;this.mutationCb({id:t,type:Me["2D"],commands:[{property:"clearRect",args:[0,0,r,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{ce(t,n,i,!0)||e.push(t)})),e})().forEach((e=>ut(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(s.get(n))return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);a.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:r.dataURLOptions},[i])}))))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Et(e,t,n,!1),r=function(e,t,n,i){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=ne(t.CanvasRenderingContext2D.prototype,s,(function(r){return function(...o){return ce(this.canvas,n,i,!0)||setTimeout((()=>{const n=yt(o,t,this);e(this.canvas,{type:Me["2D"],property:s,args:n})}),0),r.apply(this,o)}}));r.push(o)}catch(n){const i=te(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:Me["2D"],property:s,args:[t],setter:!0})}});r.push(i)}return()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,i,r){const o=[];return o.push(...wt(t.WebGLRenderingContext.prototype,Me.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&o.push(...wt(t.WebGL2RenderingContext.prototype,Me.WebGL2,e,n,i,0,t)),()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),r(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["type"]);return t})),{type:r}=n[0];this.mutationCb({id:t,type:r,commands:i}),this.pendingCanvasMutations.delete(e)}}class _t{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Se,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),i.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:s(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Nt{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function Ot(e){return Object.assign(Object.assign({},e),{timestamp:ie()})}let It,Rt,At,xt=!1;const Mt=c();function Lt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:c=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:f,maskInputFn:m,maskTextFn:v,hooks:g,packFn:y,sampling:b={},dataURLOptions:E={},mousemoveWait:w,recordDOM:k=!0,recordCanvas:S=!1,recordCrossOriginIframes:C=!1,recordAfter:T=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:_=!1,collectFonts:N=!1,inlineImages:O=!1,plugins:I,keepIframeSrcFn:R=(()=>!1),ignoreCSSAttributes:A=new Set([]),errorHandler:x}=e;qe(x);const M=!C||window.parent===window;let L=!1;if(!M)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(M&&!t)throw new Error("emit function is required");void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),Mt.reset();const P=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==p?p:{password:!0},F=!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===f,headMetaDescKeywords:"all"===f}:f||{};let U;pe();let H=0;const j=e=>{for(const t of I||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!L&&(e=y(e)),e};It=(e,r)=>{var o;if(!(null===(o=Ye[0])||void 0===o?void 0:o.isFrozen())||e.type===Ie.FullSnapshot||e.type===Ie.IncrementalSnapshot&&e.data.source===Re.Mutation||Ye.forEach((e=>e.unfreeze())),M)null==t||t(j(e),r);else if(L){const t={type:"rrweb",event:j(e),origin:window.location.origin,isCheckout:r};window.parent.postMessage(t,"*")}if(e.type===Ie.FullSnapshot)U=e,H=0;else if(e.type===Ie.IncrementalSnapshot){if(e.data.source===Re.Mutation&&e.data.isAttachIframe)return;H++;const t=i&&H>=i,r=n&&e.timestamp-U.timestamp>n;(t||r)&&Rt(!0)}};const B=e=>{It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Mutation},e)}))},V=e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Scroll},e)})),z=e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.CanvasMutation},e)})),W=new _t({mutationCb:B,adoptedStyleSheetCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.AdoptedStyleSheet},e)}))}),q=new ct({mirror:Mt,mutationCb:B,stylesheetManager:W,recordCrossOriginIframes:C,wrappedEmit:It});for(const e of I||[])e.getMirror&&e.getMirror({nodeMirror:Mt,crossOriginIframeMirror:q.crossOriginIframeMirror,crossOriginIframeStyleMirror:q.crossOriginIframeStyleMirror});const G=new Nt;At=new Tt({recordCanvas:S,mutationCb:z,win:window,blockClass:r,blockSelector:o,mirror:Mt,sampling:b.canvas,dataURLOptions:E});const K=new lt({mutationCb:B,scrollCb:V,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:P,dataURLOptions:E,maskTextFn:v,maskInputFn:m,recordCanvas:S,inlineImages:O,sampling:b,slimDOMOptions:F,iframeManager:q,stylesheetManager:W,canvasManager:At,keepIframeSrcFn:R,processedNodeManager:G},mirror:Mt});Rt=(e=!1)=>{if(!k)return;It(Ot({type:Ie.Meta,data:{href:window.location.href,width:se(),height:oe()}}),e),W.reset(),K.init(),Ye.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new a,blockClass:i="rr-block",blockSelector:r=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:c=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,slimDOM:f=!1,dataURLOptions:m,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:k=(()=>!1)}=t||{};return D(e,{doc:e,mirror:n,blockClass:i,blockSelector:r,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===f,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===f?{}:f,dataURLOptions:m,inlineImages:l,recordCanvas:u,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:k,newlyAddedElement:!1})}(document,{mirror:Mt,blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:P,maskTextFn:v,slimDOM:F,dataURLOptions:E,recordCanvas:S,inlineImages:O,onSerialize:e=>{ve(e,Mt)&&q.addIframe(e),ge(e,Mt)&&W.trackLinkElement(e),be(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{q.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");It(Ot({type:Ie.FullSnapshot,data:{node:t,initialOffset:re(window)}}),e),Ye.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,Mt.getId(document))};try{const e=[],t=e=>{var t;return Ke(rt)({mutationCb:B,mousemoveCb:(e,t)=>It(Ot({type:Ie.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.MouseInteraction},e)})),scrollCb:V,viewportResizeCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.ViewportResize},e)})),inputCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Input},e)})),mediaInteractionCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.MediaInteraction},e)})),styleSheetRuleCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.StyleSheetRule},e)})),styleDeclarationCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.StyleDeclaration},e)})),canvasMutationCb:z,fontCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Font},e)})),selectionCb:e=>{It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Selection},e)}))},customElementCb:e=>{It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.CustomElement},e)}))},blockClass:r,ignoreClass:s,ignoreSelector:c,maskTextClass:l,maskTextSelector:u,maskInputOptions:P,inlineStylesheet:d,sampling:b,recordDOM:k,recordCanvas:S,inlineImages:O,userTriggeredOnInput:_,collectFonts:N,doc:e,maskInputFn:m,maskTextFn:v,keepIframeSrcFn:R,blockSelector:o,slimDOMOptions:F,dataURLOptions:E,mirror:Mt,iframeManager:q,stylesheetManager:W,shadowDomManager:K,processedNodeManager:G,canvasManager:At,ignoreCSSAttributes:A,plugins:(null===(t=null==I?void 0:I.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>It(Ot({type:Ie.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},g)};q.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{Rt(),e.push(t(document)),xt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(X("DOMContentLoaded",(()=>{It(Ot({type:Ie.DomContentLoaded,data:{}})),"DOMContentLoaded"===T&&n()}))),e.push(X("load",(()=>{It(Ot({type:Ie.Load,data:{}})),"load"===T&&n()}),window))),()=>{e.forEach((e=>e())),G.destroy(),xt=!1,Ge()}}catch(e){console.warn(e)}}var Pt;Lt.addCustomEvent=(e,t)=>{if(!xt)throw new Error("please add custom event after start recording");It(Ot({type:Ie.Custom,data:{tag:e,payload:t}}))},Lt.freezePage=()=>{Ye.forEach((e=>e.freeze()))},Lt.takeFullSnapshot=e=>{if(!xt)throw new Error("please take full snapshot after start recording");Rt(e)},Lt.mirror=Mt,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Pt||(Pt={}));class Dt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Ft(e){const t=[];for(const n in e){const i=e[n];if("string"!=typeof i)continue;const r=Vt(n);t.push(`${r}: ${i};`)}return t.join(" ")}const Ut=/-([a-z])/g,Ht=/^--[a-zA-Z0-9-]+$/,jt=e=>Ht.test(e)?e:e.replace(Ut,((e,t)=>t?t.toUpperCase():"")),Bt=/\B([A-Z])/g,Vt=e=>e.replace(Bt,"-$1").toLowerCase();class zt{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=Qt.ELEMENT_NODE,this.TEXT_NODE=Qt.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof zt))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Wt(e){return class extends e{constructor(e,t,n){super(),this.nodeType=Qt.DOCUMENT_TYPE_NODE,this.RRNodeType=Pt.DocumentType,this.name=e,this.publicId=t,this.systemId=n,this.nodeName=e,this.textContent=null}toString(){return"RRDocumentType"}}}function qt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.ELEMENT_NODE,this.RRNodeType=Pt.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new $t(this.attributes.class,(e=>{this.attributes.class=e}))}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const i=e.split(n);i.length>1&&(t[jt(i[0].trim())]=i[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(n,i,r)=>{if(t.test(n))return;const o=jt(n);i?e[o]=i:delete e[o],"important"===r&&(e[o]+=" !important"),this.attributes.style=Ft(e)},e.removeProperty=n=>{if(t.test(n))return"";const i=jt(n),r=e[i]||"";return delete e[i],this.attributes.style=Ft(e),r},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return Zt(this,e)}insertBefore(e,t){return Jt(this,e,t)}removeChild(e){return Xt(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function Gt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.TEXT_NODE,this.nodeName="#text",this.RRNodeType=Pt.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Kt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=Pt.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function Yt(e){return class extends e{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=Qt.CDATA_SECTION_NODE,this.RRNodeType=Pt.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class $t{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function Zt(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function Jt(e,t,n){if(!n)return Zt(e,t);if(n.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function Xt(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}var Qt;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Qt||(Qt={}));const en={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},tn={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let nn=null;function rn(e,t,n,i=t.mirror||t.ownerDocument.mirror){e=function(e,t,n,i){var r;n.afterAppend&&!nn&&(nn=new WeakSet,setTimeout((()=>{nn=null}),0));if(!an(e,t)){const o=sn(t,n.mirror,i);null===(r=e.parentNode)||void 0===r||r.replaceChild(o,e),e=o}switch(t.RRNodeType){case Pt.Document:if(!cn(e,t,n.mirror,i)){const r=i.getMeta(t);r&&(n.mirror.removeNodeFromMap(e),e.close(),e.open(),n.mirror.add(e,r),null==nn||nn.add(e))}break;case Pt.Element:{const r=e,o=t;switch(o.tagName){case"IFRAME":{const r=e.contentDocument;if(!r)break;rn(r,t.contentDocument,n,i);break}}o.shadowRoot&&(r.shadowRoot||r.attachShadow({mode:"open"}),on(r.shadowRoot,o.shadowRoot,n,i)),function(e,t,n){const i=e.attributes,r=t.attributes;for(const i in r){const o=r[i],s=n.getMeta(t);if((null==s?void 0:s.isSVG)&&en[i])e.setAttributeNS(en[i],i,o);else if("CANVAS"===t.tagName&&"rr_dataURL"===i){const t=document.createElement("img");t.src=o,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===i)continue;e.setAttribute(i,o)}}for(const{name:t}of Array.from(i))t in r||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(r,o,i);break}}return e}(e,t,n,i),on(e,t,n,i),function(e,t,n){var i;switch(t.RRNodeType){case Pt.Document:{const e=t.scrollData;e&&n.applyScroll(e,!0);break}case Pt.Element:{const i=e,r=t;switch(r.scrollData&&n.applyScroll(r.scrollData,!0),r.inputData&&n.applyInput(r.inputData),r.tagName){case"AUDIO":case"VIDEO":{const t=e,n=r;void 0!==n.paused&&(n.paused?t.pause():t.play()),void 0!==n.muted&&(t.muted=n.muted),void 0!==n.volume&&(t.volume=n.volume),void 0!==n.currentTime&&(t.currentTime=n.currentTime),void 0!==n.playbackRate&&(t.playbackRate=n.playbackRate);break}case"CANVAS":{const r=t;if(null!==r.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const t=i.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=r.rr_dataURL}r.canvasMutations.forEach((t=>n.applyCanvas(t.event,t.mutation,e)));break}case"STYLE":{const e=i.sheet;e&&t.rules.forEach((t=>n.applyStyleSheetMutation(t,e)));break}}break}case Pt.Text:case Pt.Comment:case Pt.CDATA:e.textContent!==t.data&&(e.textContent=t.data)}(null==nn?void 0:nn.has(e))&&(nn.delete(e),null===(i=n.afterAppend)||void 0===i||i.call(n,e,n.mirror.getId(e)))}(e,t,n)}function on(e,t,n,i){const r=Array.from(e.childNodes),o=t.childNodes;if(0===r.length&&0===o.length)return;let s,a,c=0,l=r.length-1,u=0,d=o.length-1,h=r[c],p=r[l],f=o[u],m=o[d];for(;c<=l&&u<=d;)if(void 0===h)h=r[++c];else if(void 0===p)p=r[--l];else if(cn(h,f,n.mirror,i))h=r[++c],f=o[++u];else if(cn(p,m,n.mirror,i))p=r[--l],m=o[--d];else if(cn(h,m,n.mirror,i)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=r[++c],m=o[--d]}else if(cn(p,f,n.mirror,i)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=r[--l],f=o[++u]}else{if(!s){s={};for(let e=c;e<=l;e++){const t=r[e];t&&n.mirror.hasNode(t)&&(s[n.mirror.getId(t)]=e)}}a=s[i.getId(f)];const t=r[a];if(void 0!==a&&t&&cn(t,f,n.mirror,i)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}r[a]=void 0}else{const t=sn(f,n.mirror,i);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=r[++c]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}f=o[++u]}if(c>l){const t=o[d+1];let r=null;for(t&&(r=n.mirror.getNode(i.getId(t)));u<=d;++u){const t=sn(o[u],n.mirror,i);try{e.insertBefore(t,r)}catch(e){console.warn(e)}}}else if(u>d)for(;c<=l;c++){const t=r[c];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let v=e.firstChild,g=t.firstChild;for(;null!==v&&null!==g;)rn(v,g,n,i),v=v.nextSibling,g=g.nextSibling}function sn(e,t,n){const i=n.getId(e),r=n.getMeta(e);let o=null;if(i>-1&&(o=t.getNode(i)),null!==o&&an(o,e))return o;switch(e.RRNodeType){case Pt.Document:o=new Document;break;case Pt.DocumentType:o=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case Pt.Element:{let t=e.tagName.toLowerCase();t=tn[t]||t,o=r&&"isSVG"in r&&(null==r?void 0:r.isSVG)?document.createElementNS(en.svg,t):document.createElement(e.tagName);break}case Pt.Text:o=document.createTextNode(e.data);break;case Pt.Comment:o=document.createComment(e.data);break;case Pt.CDATA:o=document.createCDATASection(e.data)}r&&t.add(o,Object.assign({},r));try{null==nn||nn.add(o)}catch(e){}return o}function an(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function cn(e,t,n,i){const r=n.getId(e),o=i.getId(t);return-1!==r&&r===o&&an(e,t)}class ln extends(function(e){return class t extends e{constructor(...e){super(e),this.nodeType=Qt.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=Pt.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((e=>e.RRNodeType===Pt.Element&&"HTML"===e.tagName))||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===Pt.Element&&"BODY"===e.tagName)))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===Pt.Element&&"HEAD"===e.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===Pt.Element||t===Pt.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===t)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===Pt.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const n=Zt(this,e);return n.parentElement=null,n}insertBefore(e,t){const n=e.RRNodeType;if((n===Pt.Element||n===Pt.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${n===Pt.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=Jt(this,e,t);return i.parentElement=null,i}removeChild(e){return Xt(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,n,i){return new t}createDocumentType(e,t,n){const i=new(Wt(zt))(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=new(qt(zt))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(Gt(zt))(e);return t.ownerDocument=this,t}createComment(e){const t=new(Kt(zt))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(Yt(zt))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}(zt)){get unserializedId(){return this._unserializedId--}constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=new wn,this.scrollData=null,e&&(this.mirror=e)}createDocument(e,t,n){return new ln}createDocumentType(e,t,n){const i=new un(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new hn(t);break;case"IFRAME":n=new mn(t,this.mirror);break;case"CANVAS":n=new pn(t);break;case"STYLE":n=new fn(t);break;default:n=new dn(t)}return n.ownerDocument=this,n}createComment(e){const t=new gn(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new yn(e);return t.ownerDocument=this,t}createTextNode(e){const t=new vn(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const un=Wt(zt);class dn extends(qt(zt)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class hn extends(function(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}(dn)){}class pn extends dn{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class fn extends dn{constructor(){super(...arguments),this.rules=[]}}class mn extends dn{constructor(e,t){super(e),this.contentDocument=new ln,this.contentDocument.mirror=t}}const vn=Gt(zt),gn=Kt(zt),yn=Yt(zt);function bn(e,t,n,i){let r;switch(e.nodeType){case Qt.DOCUMENT_NODE:i&&"IFRAME"===i.nodeName?r=i.contentDocument:(r=t,r.compatMode=e.compatMode);break;case Qt.DOCUMENT_TYPE_NODE:{const n=e;r=t.createDocumentType(n.name,n.publicId,n.systemId);break}case Qt.ELEMENT_NODE:{const n=e,i=(o=n)instanceof HTMLFormElement?"FORM":o.tagName.toUpperCase();r=t.createElement(i);const s=r;for(const{name:e,value:t}of Array.from(n.attributes))s.attributes[e]=t;n.scrollLeft&&(s.scrollLeft=n.scrollLeft),n.scrollTop&&(s.scrollTop=n.scrollTop);break}case Qt.TEXT_NODE:r=t.createTextNode(e.textContent||"");break;case Qt.CDATA_SECTION_NODE:r=t.createCDATASection(e.data);break;case Qt.COMMENT_NODE:r=t.createComment(e.textContent||"");break;case Qt.DOCUMENT_FRAGMENT_NODE:r=i.attachShadow({mode:"open"});break;default:return null}var o;let s=n.getMeta(e);return t instanceof ln&&(s||(s=kn(r,t.unserializedId),n.add(e,s)),t.mirror.add(r,Object.assign({},s))),r}function En(e,t=function(){return new Dt}(),n=new ln){return function e(i,r){const o=bn(i,n,t,r);if(null!==o)if("IFRAME"!==(null==r?void 0:r.nodeName)&&i.nodeType!==Qt.DOCUMENT_FRAGMENT_NODE&&(null==r||r.appendChild(o),o.parentNode=r,o.parentElement=r),"IFRAME"===i.nodeName){const t=i.contentDocument;t&&e(t,o)}else i.nodeType!==Qt.DOCUMENT_NODE&&i.nodeType!==Qt.ELEMENT_NODE&&i.nodeType!==Qt.DOCUMENT_FRAGMENT_NODE||(i.nodeType===Qt.ELEMENT_NODE&&i.shadowRoot&&e(i.shadowRoot,o),i.childNodes.forEach((t=>e(t,o))))}(e,null),n}class wn{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function kn(e,t){switch(e.RRNodeType){case Pt.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case Pt.DocumentType:{const n=e;return{id:t,type:e.RRNodeType,name:n.name,publicId:n.publicId,systemId:n.systemId}}case Pt.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case Pt.Text:case Pt.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case Pt.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function Sn(e){return{all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}}}var Cn,Tn=Object.freeze({__proto__:null,default:Sn});function _n(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&!0!==e.__forceSmoothScrollPolyfill__)return;const n=e.HTMLElement||e.Element,i=468,r={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:n.prototype.scroll||c,scrollIntoView:n.prototype.scrollIntoView},o=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;const s=(a=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(a)?1:0);var a;function c(e,t){this.scrollLeft=e,this.scrollTop=t}function l(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function u(e,t){return"Y"===t?e.clientHeight+s<e.scrollHeight:"X"===t?e.clientWidth+s<e.scrollWidth:void 0}function d(t,n){const i=e.getComputedStyle(t,null)["overflow"+n];return"auto"===i||"scroll"===i}function h(e){const t=u(e,"Y")&&d(e,"Y"),n=u(e,"X")&&d(e,"X");return t||n}function p(t){let n,r,s,a=(o()-t.startTime)/i;a=a>1?1:a,n=function(e){return.5*(1-Math.cos(Math.PI*e))}(a),r=t.startX+(t.x-t.startX)*n,s=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,r,s),r===t.x&&s===t.y||e.requestAnimationFrame(p.bind(e,t))}function f(n,i,s){let a,l,u,d;const h=o();n===t.body?(a=e,l=e.scrollX||e.pageXOffset,u=e.scrollY||e.pageYOffset,d=r.scroll):(a=n,l=n.scrollLeft,u=n.scrollTop,d=c),p({scrollable:a,method:d,startTime:h,startX:l,startY:u,x:i,y:s})}e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?f.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):r.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(l(arguments[0])?r.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):f.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},n.prototype.scroll=n.prototype.scrollTo=function(){if(void 0===arguments[0])return;if(!0===l(arguments[0])){if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");return void r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}const e=arguments[0].left,t=arguments[0].top;f.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)},n.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},n.prototype.scrollIntoView=function(){if(!0===l(arguments[0]))return void r.scrollIntoView.call(this,void 0===arguments[0]||arguments[0]);const n=function(e){for(;e!==t.body&&!1===h(e);)e=e.parentNode||e.host;return e}(this),i=n.getBoundingClientRect(),o=this.getBoundingClientRect();n!==t.body?(f.call(this,n,n.scrollLeft+o.left-i.left,n.scrollTop+o.top-i.top),"fixed"!==e.getComputedStyle(n).position&&e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})):e.scrollBy({left:o.left,top:o.top,behavior:"smooth"})}}class Nn{constructor(e=[],t){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=t.speed}addAction(e){const t=!0===this.raf;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const t=this.findActionIndex(e);this.actions.splice(t,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const e=this.actions[0];if(!(this.timeOffset>=e.delay))break;this.actions.shift(),e.doAction()}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(!0!==this.raf&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return null!==this.raf}findActionIndex(e){let t=0,n=this.actions.length-1;for(;t<=n;){const i=Math.floor((t+n)/2);if(this.actions[i].delay<e.delay)t=i+1;else{if(!(this.actions[i].delay>e.delay))return i+1;n=i-1}}return t}}function On(e,t){if(e.type===Ie.IncrementalSnapshot&&e.data.source===Re.MouseMove&&e.data.positions&&e.data.positions.length){const n=e.data.positions[0].timeOffset,i=e.timestamp+n;return e.delay=i-t,i-t}return e.delay=e.timestamp-t,e.delay}
49
+ /*! *****************************************************************************
50
+ Copyright (c) Microsoft Corporation.
51
+
52
+ Permission to use, copy, modify, and/or distribute this software for any
53
+ purpose with or without fee is hereby granted.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
56
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
57
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
58
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
59
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
60
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
61
+ PERFORMANCE OF THIS SOFTWARE.
62
+ ***************************************************************************** */function In(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(Cn||(Cn={}));var Rn={type:"xstate.init"};function An(e){return void 0===e?[]:[].concat(e)}function xn(e){return{type:"xstate.assign",assignment:e}}function Mn(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function Ln(e){return function(t){return e===t}}function Pn(e){return"string"==typeof e?{type:e}:e}function Dn(e,t){return{value:e,context:t,actions:[],changed:!1,matches:Ln(e)}}function Fn(e,t,n){var i=t,r=!1;return[e.filter((function(e){if("xstate.assign"===e.type){r=!0;var t=Object.assign({},i);return"function"==typeof e.assignment?t=e.assignment(i,n):Object.keys(e.assignment).forEach((function(r){t[r]="function"==typeof e.assignment[r]?e.assignment[r](i,n):e.assignment[r]})),i=t,!1}return!0})),i,r]}function Un(e,t){void 0===t&&(t={});var n=In(Fn(An(e.states[e.initial].entry).map((function(e){return Mn(e,t.actions)})),e.context,Rn),2),i=n[0],r=n[1],o={config:e,_options:t,initialState:{value:e.initial,actions:i,context:r,matches:Ln(e.initial)},transition:function(t,n){var i,r,s="string"==typeof t?{value:t,context:e.context}:t,a=s.value,c=s.context,l=Pn(n),u=e.states[a];if(u.on){var d=An(u.on[l.type]);try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),p=h.next();!p.done;p=h.next()){var f=p.value;if(void 0===f)return Dn(a,c);var m="string"==typeof f?{target:f}:f,v=m.target,g=m.actions,y=void 0===g?[]:g,b=m.cond,E=void 0===b?function(){return!0}:b,w=void 0===v,k=null!=v?v:a,S=e.states[k];if(E(c,l)){var C=In(Fn((w?An(y):[].concat(u.exit,y,S.entry).filter((function(e){return e}))).map((function(e){return Mn(e,o._options.actions)})),c,l),3),T=C[0],_=C[1],N=C[2],O=null!=v?v:a;return{value:O,context:_,actions:T,changed:v!==a||T.length>0||N,matches:Ln(O)}}}}catch(e){i={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}}return Dn(a,c)}};return o}var Hn=function(e,t){return e.actions.forEach((function(n){var i=n.exec;return i&&i(e.context,t)}))};function jn(e){var t=e.initialState,n=Cn.NotStarted,i=new Set,r={_machine:e,send:function(r){n===Cn.Running&&(t=e.transition(t,r),Hn(t,Pn(r)),i.forEach((function(e){return e(t)})))},subscribe:function(e){return i.add(e),e(t),{unsubscribe:function(){return i.delete(e)}}},start:function(i){if(i){var o="object"==typeof i?i:{context:e.config.context,value:i};t={value:o.value,actions:[],context:o.context,matches:Ln(o.value)}}return n=Cn.Running,Hn(t,Rn),r},stop:function(){return n=Cn.Stopped,i.clear(),r},get state(){return t},get status(){return n}};return r}function Bn(e,{getCastFn:t,applyEventsSynchronously:n,emitter:i}){const r=Un({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:xn({lastPlayedEvent:(e,t)=>"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}),recordTimeOffset:xn(((e,t)=>{let n=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(n=t.payload.timeOffset),Object.assign(Object.assign({},e),{timeOffset:n,baselineTime:e.events[0].timestamp+n})})),play(e){var r;const{timer:o,events:s,baselineTime:a,lastPlayedEvent:c}=e;o.clear();for(const e of s)On(e,a);const l=function(e,t){for(let n=e.length-1;n>=0;n--){const i=e[n];if(i.type===Ie.Meta&&i.timestamp<=t)return e.slice(n)}return e}(s,a);let u=null==c?void 0:c.timestamp;(null==c?void 0:c.type)===Ie.IncrementalSnapshot&&c.data.source===Re.MouseMove&&(u=c.timestamp+(null===(r=c.data.positions[0])||void 0===r?void 0:r.timeOffset)),a<(u||0)&&i.emit(Le.PlayBack);const d=new Array;for(const e of l)if(!(u&&u<a&&(e.timestamp<=u||e===c)))if(e.timestamp<a)d.push(e);else{const n=t(e,!1);o.addAction({doAction:()=>{n()},delay:e.delay})}n(d),i.emit(Le.Flush),o.start()},pause(e){e.timer.clear()},resetLastPlayedEvent:xn((e=>Object.assign(Object.assign({},e),{lastPlayedEvent:null}))),startLive:xn({baselineTime:(e,t)=>(e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now())}),addEvent:xn(((e,n)=>{const{baselineTime:i,timer:r,events:o}=e;if("ADD_EVENT"===n.type){const{event:e}=n.payload;On(e,i);let s=o.length-1;if(!o[s]||o[s].timestamp<=e.timestamp)o.push(e);else{let t=-1,n=0;for(;n<=s;){const t=Math.floor((n+s)/2);o[t].timestamp<=e.timestamp?n=t+1:s=t-1}-1===t&&(t=n),o.splice(t,0,e)}const a=e.timestamp<i,c=t(e,a);a?c():r.isActive()&&r.addAction({doAction:()=>{c()},delay:e.delay})}return Object.assign(Object.assign({},e),{events:o})}))}});return jn(r)}const Vn=new Map;function zn(e,t){let n=Vn.get(e);return n||(n=new Map,Vn.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}function Wn(e,t,n){return i=>ut(this,0,void 0,(function*(){if(i&&"object"==typeof i&&"rr_type"in i){if(n&&(n.isUnchanged=!1),"ImageBitmap"===i.rr_type&&"args"in i){const r=yield Wn(e,t,n)(i.args);return yield createImageBitmap.apply(null,r)}if("index"in i){if(n||null===t)return i;const{rr_type:e,index:r}=i;return zn(t,e)[r]}if("args"in i){const{rr_type:r,args:o}=i;return new(0,window[r])(...yield Promise.all(o.map(Wn(e,t,n))))}if("base64"in i)return ft(i.base64);if("src"in i){const t=e.get(i.src);if(t)return t;{const t=new Image;return t.src=i.src,e.set(i.src,t),t}}if("data"in i&&"Blob"===i.rr_type){const r=yield Promise.all(i.data.map(Wn(e,t,n)));return new Blob(r,{type:i.type})}}else if(Array.isArray(i)){return yield Promise.all(i.map(Wn(e,t,n)))}return i}))}const qn=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Gn({mutation:e,target:t,type:n,imageMap:i,errorHandler:r}){return ut(this,0,void 0,(function*(){try{const r=function(e,t){try{return t===Me.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(t,n);if(!r)return;if(e.setter)return void(r[e.property]=e.args[0]);const o=r[e.property],s=yield Promise.all(e.args.map(Wn(i,r)));!function(e,t){if(!(null==t?void 0:t.constructor))return;const{name:n}=t.constructor;if(!qn.includes(n))return;const i=zn(e,n);i.includes(t)||i.push(t)}(r,o.apply(r,s))}catch(t){r(e,t)}}))}function Kn({event:e,mutation:t,target:n,imageMap:i,canvasEventMap:r,errorHandler:o}){return ut(this,0,void 0,(function*(){try{const s=r.get(e)||t,a="commands"in s?s.commands:[s];if([Me.WebGL,Me.WebGL2].includes(t.type)){for(let e=0;e<a.length;e++){const r=a[e];yield Gn({mutation:r,type:t.type,target:n,imageMap:i,errorHandler:o})}return}yield function({event:e,mutations:t,target:n,imageMap:i,errorHandler:r}){return ut(this,0,void 0,(function*(){const o=n.getContext("2d");if(!o)return void r(t[0],new Error("Canvas context is null"));const s=t.map((e=>ut(this,0,void 0,(function*(){return Promise.all(e.args.map(Wn(i,o)))}))));(yield Promise.all(s)).forEach(((n,s)=>{const a=t[s];try{if(a.setter)return void(o[a.property]=a.args[0]);const t=o[a.property];"drawImage"===a.property&&"string"==typeof a.args[0]?(i.get(e),t.apply(o,a.args)):t.apply(o,n)}catch(e){r(a,e)}}))}))}({event:e,mutations:a,target:n,imageMap:i,errorHandler:o})}catch(e){o(t,e)}}))}const Yn=Sn||Tn,$n="[replayer]",Zn={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function Jn(e){return e.type==Ie.IncrementalSnapshot&&(e.data.source==Re.TouchMove||e.data.source==Re.MouseInteraction&&e.data.type==Ae.TouchStart)}const{addCustomEvent:Xn}=Lt,{freezePage:Qn}=Lt;var ei=Uint8Array,ti=Uint16Array,ni=Uint32Array,ii=new ei([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ri=new ei([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),oi=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),si=function(e,t){for(var n=new ti(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new ni(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},ai=si(ii,2),ci=ai[0],li=ai[1];ci[28]=258,li[258]=28;for(var ui=si(ri,0),di=ui[0],hi=ui[1],pi=new ti(32768),fi=0;fi<32768;++fi){var mi=(43690&fi)>>>1|(21845&fi)<<1;mi=(61680&(mi=(52428&mi)>>>2|(13107&mi)<<2))>>>4|(3855&mi)<<4,pi[fi]=((65280&mi)>>>8|(255&mi)<<8)>>>1}var vi=function(e,t,n){for(var i=e.length,r=0,o=new ti(t);r<i;++r)++o[e[r]-1];var s,a=new ti(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new ti(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var l=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[pi[d]>>>c]=l}else for(s=new ti(i),r=0;r<i;++r)s[r]=pi[a[e[r]-1]++]>>>15-e[r];return s},gi=new ei(288);for(fi=0;fi<144;++fi)gi[fi]=8;for(fi=144;fi<256;++fi)gi[fi]=9;for(fi=256;fi<280;++fi)gi[fi]=7;for(fi=280;fi<288;++fi)gi[fi]=8;var yi=new ei(32);for(fi=0;fi<32;++fi)yi[fi]=5;var bi=vi(gi,9,0),Ei=vi(gi,9,1),wi=vi(yi,5,0),ki=vi(yi,5,1),Si=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ci=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>>(7&t)&n},Ti=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>>(7&t)},_i=function(e){return(e/8|0)+(7&e&&1)},Ni=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof ti?ti:e instanceof ni?ni:ei)(n-t);return i.set(e.subarray(t,n)),i},Oi=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8},Ii=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ri=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[new ei(0),0];if(1==r){var s=new ei(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var p=new ti(h+1),f=Ai(n[u-1],p,0);if(f>t){i=0;var m=0,v=f-t,g=1<<v;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i<r;++i){var y=o[i].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var b=o[i].s;p[b]<t?m-=1<<t-p[b]++-1:++i}for(;i>=0&&m;--i){var E=o[i].s;p[E]==t&&(--p[E],++m)}f=t}return[new ei(p),f]},Ai=function(e,t,n){return-1==e.s?Math.max(Ai(e.l,t,n+1),Ai(e.r,t,n+1)):t[e.s]=n},xi=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ti(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Mi=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Li=function(e,t,n){var i=n.length,r=_i(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},Pi=function(e,t,n,i,r,o,s,a,c,l,u){Oi(t,u++,n),++r[256];for(var d=Ri(r,15),h=d[0],p=d[1],f=Ri(o,15),m=f[0],v=f[1],g=xi(h),y=g[0],b=g[1],E=xi(m),w=E[0],k=E[1],S=new ti(19),C=0;C<y.length;++C)S[31&y[C]]++;for(C=0;C<w.length;++C)S[31&w[C]]++;for(var T=Ri(S,7),_=T[0],N=T[1],O=19;O>4&&!_[oi[O-1]];--O);var I,R,A,x,M=l+5<<3,L=Mi(r,gi)+Mi(o,yi)+s,P=Mi(r,h)+Mi(o,m)+s+14+3*O+Mi(S,_)+(2*S[16]+3*S[17]+7*S[18]);if(M<=L&&M<=P)return Li(t,u,e.subarray(c,c+l));if(Oi(t,u,1+(P<L)),u+=2,P<L){I=vi(h,p,0),R=h,A=vi(m,v,0),x=m;var D=vi(_,N,0);Oi(t,u,b-257),Oi(t,u+5,k-1),Oi(t,u+10,O-4),u+=14;for(C=0;C<O;++C)Oi(t,u+3*C,_[oi[C]]);u+=3*O;for(var F=[y,w],U=0;U<2;++U){var H=F[U];for(C=0;C<H.length;++C){var j=31&H[C];Oi(t,u,D[j]),u+=_[j],j>15&&(Oi(t,u,H[C]>>>5&127),u+=H[C]>>>12)}}}else I=bi,R=gi,A=wi,x=yi;for(C=0;C<a;++C)if(i[C]>255){j=i[C]>>>18&31;Ii(t,u,I[j+257]),u+=R[j+257],j>7&&(Oi(t,u,i[C]>>>23&31),u+=ii[j]);var B=31&i[C];Ii(t,u,A[B]),u+=x[B],B>3&&(Ii(t,u,i[C]>>>5&8191),u+=ri[B])}else Ii(t,u,I[i[C]]),u+=R[i[C]];return Ii(t,u,I[256]),u+R[256]},Di=new ni([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fi=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new ei(i+s+5*(1+Math.floor(s/7e3))+r),c=a.subarray(i,a.length-r),l=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d<s?l=Li(c,l,e.subarray(u,d)):(c[u]=o,l=Li(c,l,e.subarray(u,s)))}else{for(var h=Di[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new ti(32768),g=new ti(m+1),y=Math.ceil(n/3),b=2*y,E=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&m},w=new ni(25e3),k=new ti(288),S=new ti(32),C=0,T=0,_=(u=0,0),N=0,O=0;u<s;++u){var I=E(u),R=32767&u,A=g[I];if(v[R]=A,g[I]=R,N<=u){var x=s-u;if((C>7e3||_>24576)&&x>423){l=Pi(e,c,0,w,k,S,T,_,O,u-O,l),_=C=T=0,O=u;for(var M=0;M<286;++M)k[M]=0;for(M=0;M<30;++M)S[M]=0}var L=2,P=0,D=f,F=R-A&32767;if(x>2&&I==E(u-F))for(var U=Math.min(p,x)-1,H=Math.min(32767,u),j=Math.min(258,x);F<=H&&--D&&R!=A;){if(e[u+L]==e[u+L-F]){for(var B=0;B<j&&e[u+B]==e[u+B-F];++B);if(B>L){if(L=B,P=F,B>U)break;var V=Math.min(F,B-2),z=0;for(M=0;M<V;++M){var W=u-F+M+32768&32767,q=W-v[W]+32768&32767;q>z&&(z=q,A=W)}}}F+=(R=A)-(A=v[R])+32768&32767}if(P){w[_++]=268435456|li[L]<<18|hi[P];var G=31&li[L],K=31&hi[P];T+=ii[G]+ri[K],++k[257+G],++S[K],N=u+L,++C}else w[_++]=e[u],++k[e[u]]}}l=Pi(e,c,o,w,k,S,T,_,O,u-O,l)}return Ni(a,0,i+_i(l)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)};function Ui(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var i=e,r=t,o=n.length,s=0;s!=o;){for(var a=Math.min(s+5552,o);s<a;++s)r+=i+=n[s];i%=65521,r%=65521}e=i,t=r},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();n.p(e);var i=Fi(e,t,2,4);return function(e,t){var n=t.level,i=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=i<<6|(i?32-2*i:1)}(i,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(i,i.length-4,n.d()),i}function Hi(e,t){return function(e,t,n){var i=e.length,r=!t||n,o=!n||n.i;n||(n={}),t||(t=new ei(3*i));var s=function(e){var n=t.length;if(e>n){var i=new ei(Math.max(2*n,e));i.set(t),t=i}},a=n.f||0,c=n.p||0,l=n.b||0,u=n.l,d=n.d,h=n.m,p=n.n,f=8*i;do{if(!u){n.f=a=Ci(e,c,1);var m=Ci(e,c+1,3);if(c+=3,!m){var v=e[(N=_i(c)+4)-4]|e[N-3]<<8,g=N+v;if(g>i){if(o)throw"unexpected EOF";break}r&&s(l+v),t.set(e.subarray(N,g),l),n.b=l+=v,n.p=c=8*g;continue}if(1==m)u=Ei,d=ki,h=9,p=5;else{if(2!=m)throw"invalid block type";var y=Ci(e,c,31)+257,b=Ci(e,c+10,15)+4,E=y+Ci(e,c+5,31)+1;c+=14;for(var w=new ei(E),k=new ei(19),S=0;S<b;++S)k[oi[S]]=Ci(e,c+3*S,7);c+=3*b;var C=Si(k),T=(1<<C)-1;if(!o&&c+E*(C+7)>f)break;var _=vi(k,C,1);for(S=0;S<E;){var N,O=_[Ci(e,c,T)];if(c+=15&O,(N=O>>>4)<16)w[S++]=N;else{var I=0,R=0;for(16==N?(R=3+Ci(e,c,3),c+=2,I=w[S-1]):17==N?(R=3+Ci(e,c,7),c+=3):18==N&&(R=11+Ci(e,c,127),c+=7);R--;)w[S++]=I}}var A=w.subarray(0,y),x=w.subarray(y);h=Si(A),p=Si(x),u=vi(A,h,1),d=vi(x,p,1)}if(c>f)throw"unexpected EOF"}r&&s(l+131072);for(var M=(1<<h)-1,L=(1<<p)-1,P=h+p+18;o||c+P<f;){var D=(I=u[Ti(e,c)&M])>>>4;if((c+=15&I)>f)throw"unexpected EOF";if(!I)throw"invalid length/literal";if(D<256)t[l++]=D;else{if(256==D){u=null;break}var F=D-254;if(D>264){var U=ii[S=D-257];F=Ci(e,c,(1<<U)-1)+ci[S],c+=U}var H=d[Ti(e,c)&L],j=H>>>4;if(!H)throw"invalid distance";if(c+=15&H,x=di[j],j>3&&(U=ri[j],x+=Ti(e,c)&(1<<U)-1,c+=U),c>f)throw"unexpected EOF";r&&s(l+131072);for(var B=l+F;l<B;l+=4)t[l]=t[l-x],t[l+1]=t[l+1-x],t[l+2]=t[l+2-x],t[l+3]=t[l+3-x];l=B}}n.l=u,n.p=c,n.b=l,u&&(a=1,n.m=h,n.d=d,n.n=p)}while(!a);return l==t.length?t:Ni(t,0,l)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}function ji(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new ei(e.length+(e.length>>>1)),r=0,o=function(e){i[r++]=e},s=0;s<n;++s){if(r+5>i.length){var a=new ei(r+8+(n-s<<1));a.set(i),i=a}var c=e.charCodeAt(s);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return Ni(i,0,r)}function Bi(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var i=0;i<e.length;){var r=e[i++];r<128||t?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((31&r)<<6|63&e[i++]):r<240?n+=String.fromCharCode((15&r)<<12|(63&e[i++])<<6|63&e[i++]):(r=((15&r)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}const Vi="v1";class zi{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const Wi=/(^|@)\S+:\d+/,qi=/^\s*at .*(\S+:\d+|\(native\))/m,Gi=/^(eval@)?(\[native code])?$/,Ki={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(qi)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(qi)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const i=t.split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:i.pop()),o=i.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new zi({functionName:o,fileName:s,lineNumber:r[1],columnNumber:r[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Gi)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new zi({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(e.replace(t,""));return new zi({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),i=[];for(let e=2,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new zi({fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),i=[];for(let e=0,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new zi({functionName:r[3]||void 0,fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Wi)&&!e.match(/^Error created at/)}),this).map((function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new zi({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function Yi(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const i=e.parentElement,r=[];if(i.children&&i.children.length>0)for(let e=0;e<i.children.length;e++){const t=i.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&r.push(t)}r.length>1&&(n+=`:eq(${r.indexOf(e)})`),t=n+(t?">"+t:""),e=i}return t}function $i(e){return"[object Object]"===Object.prototype.toString.call(e)}function Zi(e,t){if(0===t)return!0;const n=Object.keys(e);for(const i of n)if($i(e[i])&&Zi(e[i],t-1))return!0;return!1}function Ji(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const i=[],r=[];return JSON.stringify(e,(function(e,t){if(i.length>0){const n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?r.splice(n,1/0,e):r.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if($i(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if($i(e)&&Zi(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const n in t){const i=t[n];Array.isArray(i)?e[n]=Yi(i.length?i[0]:null):e[n]=i}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}const Xi={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Qi(e,t,n){const i=n?Object.assign({},Xi,n):Xi,r=i.logger;if(!r)return()=>{};let o;o="string"==typeof r?t[r]:r;let s=0,a=!1;const c=[];if(i.level.includes("error")){const n=t=>{const n=t.message,r=t.error,o=Ki.parse(r).map((e=>e.toString())),s=[Ji(n,i.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",n),c.push((()=>{t.removeEventListener("error",n)}));const r=t=>{let n,r;t.reason instanceof Error?(n=t.reason,r=[Ji(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[Ji("Uncaught (in promise)",i.stringifyOptions),Ji(t.reason,i.stringifyOptions)]);const o=Ki.parse(n).map((e=>e.toString()));e({level:"error",trace:o,payload:r})};t.addEventListener("unhandledrejection",r),c.push((()=>{t.removeEventListener("unhandledrejection",r)}))}for(const e of i.level)c.push(l(o,e));return()=>{c.forEach((e=>e()))};function l(t,n){return t[n]?ne(t,n,(t=>(...r)=>{if(t.apply(this,r),!a){a=!0;try{const t=Ki.parse(new Error).map((e=>e.toString())).splice(1),o=r.map((e=>Ji(e,i.stringifyOptions)));s++,s<i.lengthThreshold?e({level:n,trace:t,payload:o}):s===i.lengthThreshold&&e({level:"warn",trace:[],payload:[Ji("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...r)}finally{a=!1}}})):()=>{}}}const er="rrweb/console@1",tr="__rrweb_original__",nr={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0};class ir{constructor(e){this.config=Object.assign(nr,e)}getConsoleLogger(){const e={};for(const t of this.config.level)e[t]="trace"===t?e=>{(console.log[tr]?console.log[tr]:console.log)(...e.payload.map((e=>JSON.parse(e))),this.formatMessage(e))}:e=>{(console[t][tr]?console[t][tr]:console[t])(...e.payload.map((e=>JSON.parse(e))),this.formatMessage(e))};return e}formatMessage(e){if(0===e.trace.length)return"";const t="\n\tat ";let n=t;return n+=e.trace.join(t),n}}e.EventType=Ie,e.IncrementalSource=Re,e.MouseInteractions=Ae,e.PLUGIN_NAME=er,e.Replayer=class{get timer(){return this.service.state.context.timer}constructor(e,t){if(this.usingVirtualDom=!1,this.virtualDom=new ln,this.mouseTail=null,this.tailPositions=[],this.emitter=Yn(),this.legacy_missingNodeRetryMap={},this.cache=Y(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=c(),this.styleMirror=new Se,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=e=>{this.iframe.style.display="inherit";for(const t of[this.mouseTail,this.iframe])t&&(t.setAttribute("width",String(e.width)),t.setAttribute("height",String(e.height)))},this.applyEventsSynchronously=e=>{for(const t of e){switch(t.type){case Ie.DomContentLoaded:case Ie.Load:case Ie.Custom:continue;case Ie.FullSnapshot:case Ie.Meta:case Ie.Plugin:case Ie.IncrementalSnapshot:}this.getCastFn(t,!0)()}},this.getCastFn=(e,t=!1)=>{let n;switch(e.type){case Ie.DomContentLoaded:case Ie.Load:break;case Ie.Custom:n=()=>{this.emitter.emit(Le.CustomEvent,e)};break;case Ie.Meta:n=()=>this.emitter.emit(Le.Resize,{width:e.data.width,height:e.data.height});break;case Ie.FullSnapshot:n=()=>{var n;if(this.firstFullSnapshot){if(this.firstFullSnapshot===e)return void(this.firstFullSnapshot=!0)}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(e,t),null===(n=this.iframe.contentWindow)||void 0===n||n.scrollTo(e.data.initialOffset),this.styleMirror.reset()};break;case Ie.IncrementalSnapshot:n=()=>{if(this.applyIncremental(e,t),!t&&(e===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const t of this.service.state.context.events)if(!(t.timestamp<=e.timestamp)&&this.isUserInteraction(t)){t.delay-e.delay>1e4*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=t);break}if(this.nextUserInteractionEvent){const t=this.nextUserInteractionEvent.delay-e.delay,n={speed:Math.min(Math.round(t/5e3),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:n}),this.emitter.emit(Le.SkipStart,n)}}}}return()=>{n&&n();for(const n of this.config.plugins||[])n.handler&&n.handler(e,t,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:e}});const i=this.service.state.context.events.length-1;if(!this.config.liveMode&&e===this.service.state.context.events[i]){const t=()=>{i<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(Le.Finish))};let n=50;e.type===Ie.IncrementalSnapshot&&e.data.source===Re.MouseMove&&e.data.positions.length&&(n+=Math.max(0,-e.data.positions[0].timeOffset)),setTimeout(t,n)}this.emitter.emit(Le.EventCast,e)}},!(null==t?void 0:t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const n={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Zn,useVirtualDom:!0,logger:console};this.config=Object.assign({},n,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(Le.Resize,this.handleResize),this.setupDom();for(const e of this.config.plugins||[])e.getMirror&&e.getMirror({nodeMirror:this.mirror});this.emitter.on(Le.Flush,(()=>{if(this.usingVirtualDom){const e={mirror:this.mirror,applyCanvas:(e,t,n)=>{Kn({event:e,mutation:t,target:n,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(e,t)=>{e.source===Re.StyleSheetRule?this.applyStyleSheetRule(e,t):e.source===Re.StyleDeclaration&&this.applyStyleDeclaration(e,t)},afterAppend:(e,t)=>{for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})}};if(this.iframe.contentDocument)try{rn(this.iframe.contentDocument,this.virtualDom,e,this.virtualDom.mirror)}catch(e){console.warn(e)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const t in this.legacy_missingNodeRetryMap)try{const n=this.legacy_missingNodeRetryMap[t],i=sn(n.node,this.mirror,this.virtualDom.mirror);rn(i,n.node,e,this.virtualDom.mirror),n.node=i}catch(e){this.warn(e)}this.constructedStyleMutations.forEach((e=>{this.applyStyleSheetMutation(e)})),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach((e=>{this.applyAdoptedStyleSheet(e)})),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[e,t]=this.lastMouseDownEvent;e.dispatchEvent(t)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)})),this.emitter.on(Le.PlayBack,(()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()}));const i=new Nn([],{speed:this.config.speed});this.service=Bn({events:e.map((e=>t&&t.unpackFn?t.unpackFn(e):e)).sort(((e,t)=>e.timestamp-t.timestamp)),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe((e=>{this.emitter.emit(Le.StateChange,{player:e})})),this.speedService=jn(Un({id:"speed",context:{normalSpeed:-1,timer:i},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(e,t)=>{"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:xn({normalSpeed:e=>e.timer.speed}),restoreSpeed:e=>{e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((e=>{this.emitter.emit(Le.StateChange,{speed:e})}));const r=this.service.state.context.events.find((e=>e.type===Ie.Meta)),o=this.service.state.context.events.find((e=>e.type===Ie.FullSnapshot));if(r){const{width:e,height:t}=r.data;setTimeout((()=>{this.emitter.emit(Le.Resize,{width:e,height:t})}),0)}o&&setTimeout((()=>{var e;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),null===(e=this.iframe.contentWindow)||void 0===e||e.scrollTo(o.data.initialOffset))}),1),this.service.state.context.events.find(Jn)&&this.mouse.classList.add("touch-device")}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach((t=>{e[t],this.config[t]=e[t]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,n;this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.remove("rrweb-paused"),this.emitter.emit(Le.Start)}pause(e){var t,n;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.add("rrweb-paused"),this.emitter.emit(Le.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(Le.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(Le.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;Jn(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then((()=>this.service.send({type:"ADD_EVENT",payload:{event:t}})))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Y()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(_n(this.iframe.contentWindow,this.iframe.contentDocument),pe(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const n=[],i=(e,t)=>{this.collectIframeAndAttachDocument(n,e);for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),J(e.data.node,{doc:this.iframe.contentDocument,afterAppend:i,cache:this.cache,mirror:this.mirror}),i(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:e,builtNode:t}of n)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e));const{documentElement:r,head:o}=this.iframe.contentDocument;this.insertStyleRules(r,o),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(Le.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var n;const i=(r=this.config.blockClass,[`.${r} { background: currentColor }`,"noscript { display: none !important; }"]).concat(this.config.insertStyleRules);var r;if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,kn(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:Re.StyleSheetRule,adds:i.map(((e,t)=>({rule:e,index:t})))})}else{const r=document.createElement("style");e.insertBefore(r,t);for(let e=0;e<i.length;e++)null===(n=r.sheet)||void 0===n||n.insertRule(i[e],e)}}attachDocumentToIframe(e,n){const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,r=[],o=(e,o)=>{this.collectIframeAndAttachDocument(r,e);const s=i.getMeta(e);if((null==s?void 0:s.type)===t.Element&&"HTML"===(null==s?void 0:s.tagName.toUpperCase())){const{documentElement:e,head:t}=n.contentDocument;this.insertStyleRules(e,t)}if(!this.usingVirtualDom)for(const t of this.config.plugins||[])t.onBuild&&t.onBuild(e,{id:o,replayer:this})};Z(e.node,{doc:n.contentDocument,mirror:i,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(n.contentDocument,e.node.id);for(const{mutationInQueue:e,builtNode:t}of r)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e))}collectIframeAndAttachDocument(e,t){if(ve(t,this.mirror)){const n=this.newDocumentQueue.find((e=>e.parentId===this.mirror.getId(t)));n&&e.push({mutationInQueue:n,builtNode:t})}}waitForStylesheetLoad(){var e;const t=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(t){const e=new Set;let n,i=this.service.state;const r=()=>{i=this.service.state};this.emitter.on(Le.Start,r),this.emitter.on(Le.Pause,r);const o=()=>{this.emitter.off(Le.Start,r),this.emitter.off(Le.Pause,r)};t.querySelectorAll('link[rel="stylesheet"]').forEach((t=>{t.sheet||(e.add(t),t.addEventListener("load",(()=>{e.delete(t),0===e.size&&-1!==n&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(Le.LoadStylesheetEnd),n&&clearTimeout(n),o())})))})),e.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(Le.LoadStylesheetStart),n=setTimeout((()=>{i.matches("playing")&&this.play(this.getCurrentTime()),n=-1,o()}),this.config.loadTimeout))}}preloadAllImages(){return ut(this,0,void 0,(function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(Le.Start,e),this.emitter.on(Le.Pause,e);const t=[];for(const e of this.service.state.context.events)if(e.type===Ie.IncrementalSnapshot&&e.data.source===Re.CanvasMutation){t.push(this.deserializeAndPreloadCanvasEvents(e.data,e));("commands"in e.data?e.data.commands:[e.data]).forEach((t=>{this.preloadImages(t,e)}))}return Promise.all(t)}))}preloadImages(e,t){if("drawImage"===e.property&&"string"==typeof e.args[0]&&!this.imageMap.has(t)){const t=document.createElement("canvas"),n=t.getContext("2d"),i=null==n?void 0:n.createImageData(t.width,t.height);null==i||i.data,JSON.parse(e.args[0]),null==n||n.putImageData(i,0,0)}}deserializeAndPreloadCanvasEvents(e,t){return ut(this,0,void 0,(function*(){if(!this.canvasEventMap.has(t)){const n={isUnchanged:!0};if("commands"in e){const i=yield Promise.all(e.commands.map((e=>ut(this,0,void 0,(function*(){const t=yield Promise.all(e.args.map(Wn(this.imageMap,null,n)));return Object.assign(Object.assign({},e),{args:t})})))));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{commands:i}))}else{const i=yield Promise.all(e.args.map(Wn(this.imageMap,null,n)));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{args:i}))}}}))}applyIncremental(e,t){var n,i,r;const{data:o}=e;switch(o.source){case Re.Mutation:try{this.applyMutation(o,t)}catch(e){this.warn(`Exception in mutation ${e.message||e}`,o)}break;case Re.Drag:case Re.TouchMove:case Re.MouseMove:if(t){const e=o.positions[o.positions.length-1];this.mousePos={x:e.x,y:e.y,id:e.id,debugData:o}}else o.positions.forEach((n=>{const i={doAction:()=>{this.moveAndHover(n.x,n.y,n.id,t,o)},delay:n.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(i)})),this.timer.addAction({doAction(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case Re.MouseInteraction:{if(-1===o.id)break;const e=new Event(u(Ae[o.type])),n=this.mirror.getNode(o.id);if(!n)return this.debugNodeNotFound(o,o.id);this.emitter.emit(Le.MouseInteraction,{type:o.type,target:n});const{triggerFocus:i}=this.config;switch(o.type){case Ae.Blur:"blur"in n&&n.blur();break;case Ae.Focus:i&&n.focus&&n.focus({preventScroll:!0});break;case Ae.Click:case Ae.TouchStart:case Ae.TouchEnd:case Ae.MouseDown:case Ae.MouseUp:t?(o.type===Ae.TouchStart?this.touchActive=!0:o.type===Ae.TouchEnd&&(this.touchActive=!1),o.type===Ae.MouseDown?this.lastMouseDownEvent=[n,e]:o.type===Ae.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===Ae.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===Ae.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===Ae.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===Ae.TouchEnd?this.mouse.classList.remove("touch-active"):n.dispatchEvent(e));break;case Ae.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:n.dispatchEvent(e)}break}case Re.Scroll:if(-1===o.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);e.scrollData=o;break}this.applyScroll(o,t);break;case Re.ViewportResize:this.emitter.emit(Le.Resize,{width:o.width,height:o.height});break;case Re.Input:if(-1===o.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);e.inputData=o;break}this.applyInput(o);break;case Re.MediaInteraction:{const e=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);const t=e;try{void 0!==o.currentTime&&(t.currentTime=o.currentTime),void 0!==o.volume&&(t.volume=o.volume),void 0!==o.muted&&(t.muted=o.muted),1===o.type&&t.pause(),0===o.type&&t.play(),4===o.type&&(t.playbackRate=o.playbackRate)}catch(e){this.warn(`Failed to replay media interactions: ${e.message||e}`)}break}case Re.StyleSheetRule:case Re.StyleDeclaration:this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&(null===(i=this.virtualDom.mirror.getNode(o.id))||void 0===i||i.rules.push(o)):this.applyStyleSheetMutation(o);break;case Re.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const t=this.virtualDom.mirror.getNode(o.id);if(!t)return this.debugNodeNotFound(o,o.id);t.canvasMutations.push({event:e,mutation:o})}else{const t=this.mirror.getNode(o.id);if(!t)return this.debugNodeNotFound(o,o.id);Kn({event:e,mutation:o,target:t,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case Re.Font:try{const e=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(e)}catch(e){this.warn(e)}break;case Re.Selection:if(t){this.lastSelectionData=o;break}this.applySelection(o);break;case Re.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o)}}applyMutation(e,n){if(this.config.useVirtualDom&&!this.usingVirtualDom&&n&&(this.usingVirtualDom=!0,En(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const e in this.legacy_missingNodeRetryMap)try{const t=this.legacy_missingNodeRetryMap[e],n=bn(t.node,this.virtualDom,this.mirror);n&&(t.node=n)}catch(e){this.warn(e)}const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter((t=>!!i.getNode(t.id)||(this.warnNodeNotFound(e,t.id),!1))),e.removes.forEach((t=>{var n;const r=i.getNode(t.id);if(!r)return;let o=i.getNode(t.parentId);if(!o)return this.warnNodeNotFound(e,t.parentId);if(t.isShadow&&be(o)&&(o=o.shadowRoot),i.removeNodeFromMap(r),o)try{o.removeChild(r),this.usingVirtualDom&&"#text"===r.nodeName&&"STYLE"===o.nodeName&&(null===(n=o.rules)||void 0===n?void 0:n.length)>0&&(o.rules=[])}catch(t){if(!(t instanceof DOMException))throw t;this.warn("parent could not remove child in mutation",o,r,e)}}));const r=Object.assign({},this.legacy_missingNodeRetryMap),o=[],s=e=>{var n,s;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let a=i.getNode(e.parentId);if(!a)return e.node.type===t.Document?this.newDocumentQueue.push(e):o.push(e);e.node.isShadow&&(be(a)||a.attachShadow({mode:"open"}),a=a.shadowRoot);let c=null,l=null;if(e.previousId&&(c=i.getNode(e.previousId)),e.nextId&&(l=i.getNode(e.nextId)),(e=>{let t=null;return e.nextId&&(t=i.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t})(e))return o.push(e);if(e.node.rootId&&!i.getNode(e.node.rootId))return;const u=e.node.rootId?i.getNode(e.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(ve(a,i))return void this.attachDocumentToIframe(e,a);const d=(e,t)=>{if(!this.usingVirtualDom)for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})},h=Z(e.node,{doc:u,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:d});if(-1===e.previousId||-1===e.nextId)return void(r[e.node.id]={node:h,mutation:e});const p=i.getMeta(a);if(p&&p.type===t.Element&&"textarea"===p.tagName&&e.node.type===t.Text){const e=Array.isArray(a.childNodes)?a.childNodes:Array.from(a.childNodes);for(const t of e)t.nodeType===a.TEXT_NODE&&a.removeChild(t)}else if((null==p?void 0:p.type)===t.Document){const i=a;e.node.type===t.DocumentType&&(null===(n=i.childNodes[0])||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_TYPE_NODE&&i.removeChild(i.childNodes[0]),"HTML"===h.nodeName&&i.documentElement&&i.removeChild(i.documentElement)}if(c&&c.nextSibling&&c.nextSibling.parentNode?a.insertBefore(h,c.nextSibling):l&&l.parentNode?a.contains(l)?a.insertBefore(h,l):a.insertBefore(h,null):a.appendChild(h),d(h,e.node.id),this.usingVirtualDom&&"#text"===h.nodeName&&"STYLE"===a.nodeName&&(null===(s=a.rules)||void 0===s?void 0:s.length)>0&&(a.rules=[]),ve(h,this.mirror)){const e=this.mirror.getId(h),t=this.newDocumentQueue.find((t=>t.parentId===e));t&&(this.attachDocumentToIframe(t,h),this.newDocumentQueue=this.newDocumentQueue.filter((e=>e!==t)))}(e.previousId||e.nextId)&&this.legacy_resolveMissingNode(r,a,h,e)};e.adds.forEach((e=>{s(e)}));const a=Date.now();for(;o.length;){const e=fe(o);if(o.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",e);break}for(const t of e){i.getNode(t.value.parentId)?me(t,(e=>{s(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",t)}}Object.keys(r).length&&Object.assign(this.legacy_missingNodeRetryMap,r),ke(e.texts).forEach((t=>{var n;const r=i.getNode(t.id);if(!r){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}if(r.textContent=t.value,this.usingVirtualDom){const e=r.parentNode;(null===(n=null==e?void 0:e.rules)||void 0===n?void 0:n.length)>0&&(e.rules=[])}})),e.attributes.forEach((t=>{var n;const r=i.getNode(t.id);if(!r){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}for(const e in t.attributes)if("string"==typeof e){const o=t.attributes[e];if(null===o)r.removeAttribute(e);else if("string"==typeof o)try{if("_cssText"===e&&("LINK"===r.nodeName||"STYLE"===r.nodeName))try{const e=i.getMeta(r);Object.assign(e.attributes,t.attributes);const n=Z(e,{doc:r.ownerDocument,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache}),o=r.nextSibling,s=r.parentNode;if(n&&s){s.removeChild(r),s.insertBefore(n,o),i.replace(t.id,n);break}}catch(e){}if("value"===e&&"TEXTAREA"===r.nodeName){const e=r;e.childNodes.forEach((t=>e.removeChild(t)));const t=null===(n=r.ownerDocument)||void 0===n?void 0:n.createTextNode(o);t&&e.appendChild(t)}else r.setAttribute(e,o)}catch(e){this.warn("An error occurred may due to the checkout feature.",e)}else if("style"===e){const e=o,t=r;for(const n in e)if(!1===e[n])t.style.removeProperty(n);else if(e[n]instanceof Array){const i=e[n];t.style.setProperty(n,i[0],i[1])}else{const i=e[n];t.style.setProperty(n,i)}}}}))}applyScroll(e,n){var i,r;const o=this.mirror.getNode(e.id);if(!o)return this.debugNodeNotFound(e,e.id);const s=this.mirror.getMeta(o);if(o===this.iframe.contentDocument)null===(i=this.iframe.contentWindow)||void 0===i||i.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else if((null==s?void 0:s.type)===t.Document)null===(r=o.defaultView)||void 0===r||r.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else try{o.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"})}catch(e){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}}applySelection(e){try{const t=new Set,n=e.ranges.map((({start:e,startOffset:n,end:i,endOffset:r})=>{const o=this.mirror.getNode(e),s=this.mirror.getNode(i);if(!o||!s)return;const a=new Range;a.setStart(o,n),a.setEnd(s,r);const c=o.ownerDocument,l=null==c?void 0:c.getSelection();return l&&t.add(l),{range:a,selection:l}}));t.forEach((e=>e.removeAllRanges())),n.forEach((e=>{var t;return e&&(null===(t=e.selection)||void 0===t?void 0:t.addRange(e.range))}))}catch(e){}}applyStyleSheetMutation(e){var t;let n=null;e.styleId?n=this.styleMirror.getStyle(e.styleId):e.id&&(n=(null===(t=this.mirror.getNode(e.id))||void 0===t?void 0:t.sheet)||null),n&&(e.source===Re.StyleSheetRule?this.applyStyleSheetRule(e,n):e.source===Re.StyleDeclaration&&this.applyStyleDeclaration(e,n))}applyStyleSheetRule(e,t){var n,i,r,o;if(null===(n=e.adds)||void 0===n||n.forEach((({rule:e,index:n})=>{try{if(Array.isArray(n)){const{positions:i,index:r}=we(n);Ee(t.cssRules,i).insertRule(e,r)}else{const i=void 0===n?void 0:Math.min(n,t.cssRules.length);null==t||t.insertRule(e,i)}}catch(e){}})),null===(i=e.removes)||void 0===i||i.forEach((({index:e})=>{try{if(Array.isArray(e)){const{positions:n,index:i}=we(e);Ee(t.cssRules,n).deleteRule(i||0)}else null==t||t.deleteRule(e)}catch(e){}})),e.replace)try{null===(r=t.replace)||void 0===r||r.call(t,e.replace)}catch(e){}if(e.replaceSync)try{null===(o=t.replaceSync)||void 0===o||o.call(t,e.replaceSync)}catch(e){}}applyStyleDeclaration(e,t){if(e.set){Ee(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority)}if(e.remove){Ee(t.rules,e.index).style.removeProperty(e.remove.property)}}applyAdoptedStyleSheet(e){var t;const n=this.mirror.getNode(e.id);if(!n)return;null===(t=e.styles)||void 0===t||t.forEach((e=>{var t;let i=null,r=null;if(be(n)?r=(null===(t=n.ownerDocument)||void 0===t?void 0:t.defaultView)||null:"#document"===n.nodeName&&(r=n.defaultView),r)try{i=new r.CSSStyleSheet,this.styleMirror.add(i,e.styleId),this.applyStyleSheetRule({source:Re.StyleSheetRule,adds:e.rules},i)}catch(e){}}));let i=0;const r=(e,t)=>{const n=t.map((e=>this.styleMirror.getStyle(e))).filter((e=>null!==e));be(e)?e.shadowRoot.adoptedStyleSheets=n:"#document"===e.nodeName&&(e.adoptedStyleSheets=n),n.length!==t.length&&i<10&&(setTimeout((()=>r(e,t)),0+100*i),i++)};r(n,e.styleIds)}legacy_resolveMissingNode(e,t,n,i){const{previousId:r,nextId:o}=i,s=r&&e[r],a=o&&e[o];if(s){const{node:i,mutation:r}=s;t.insertBefore(i,n),delete e[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],(r.previousId||r.nextId)&&this.legacy_resolveMissingNode(e,t,i,r)}if(a){const{node:i,mutation:r}=a;t.insertBefore(i,n.nextSibling),delete e[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],(r.previousId||r.nextId)&&this.legacy_resolveMissingNode(e,t,i,r)}}moveAndHover(e,t,n,i,r){const o=this.mirror.getNode(n);if(!o)return this.debugNodeNotFound(r,n);const s=ye(o,this.iframe),a=e*s.absoluteScale+s.x,c=t*s.absoluteScale+s.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,i||this.drawMouseTail({x:a,y:c}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:n,strokeStyle:i,duration:r}=!0===this.config.mouseTail?Zn:Object.assign({},Zn,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;const e=this.mouseTail.getContext("2d");e&&this.tailPositions.length&&(e.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),e.beginPath(),e.lineWidth=n,e.lineCap=t,e.strokeStyle=i,e.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach((t=>e.lineTo(t.x,t.y))),e.stroke())};this.tailPositions.push(e),o(),setTimeout((()=>{this.tailPositions=this.tailPositions.filter((t=>t!==e)),o()}),r/this.speedService.state.context.timer.speed)}hoverElements(e){var t;null===(t=this.lastHoveredRootNode||this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((e=>{e.classList.remove(":hover")})),this.lastHoveredRootNode=e.getRootNode();let n=e;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(e){return e.type===Ie.IncrementalSnapshot&&(e.data.source>Re.Mutation&&e.data.source<=Re.Input)}backToNormal(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(Le.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn($n,...e)}debug(...e){this.config.showDebug&&this.config.logger.log($n,...e)}},e.ReplayerEvents=Le,e.addCustomEvent=Xn,e.canvasMutation=Kn,e.freezePage=Qn,e.getRecordConsolePlugin=e=>({name:er,observer:Qi,options:e}),e.getReplayConsolePlugin=e=>{const t=(null==e?void 0:e.replayLogger)||new ir(e).getConsoleLogger();return{handler(e,n,i){let r=null;if(e.type===Ie.IncrementalSnapshot&&e.data.source===Re.Log?r=e.data:e.type===Ie.Plugin&&e.data.plugin===er&&(r=e.data.payload),r)try{"function"==typeof t[r.level]&&t[r.level](r)}catch(e){i.replayer.config.showWarning&&console.warn(e)}}}},e.pack=e=>{const t=Object.assign(Object.assign({},e),{v:Vi});return Bi(Ui(ji(JSON.stringify(t))),!0)},e.record=Lt,e.unpack=e=>{if("string"!=typeof e)return e;try{const t=JSON.parse(e);if(t.timestamp)return t}catch(e){}try{const t=JSON.parse(Bi(Hi(ji(e,!0))));if(t.v===Vi)return t;throw new Error(`These events were packed with packer ${t.v} which is incompatible with current packer ${Vi}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}},e.utils=Oe}(eu);class tu{constructor(){this.events=[],this.cycleTimestamp=Date.now(),this.payloadBytesEstimation=0,this.hasSnapshot=!1,this.hasMeta=!1,this.hasError=!1,this.inlinedAllStylesheets=!0}add(e){this.events.push(e)}}var nu=Object.freeze({__proto__:null,Recorder:class{#T;#_;#N;#O=!1;constructor(e){this.#T=new tu,this.#_=new tu,this.#N=[new tu],this.recording=!1,this.currentBufferTarget=this.#T,this.lastMeta=!1,this.parent=e,this.shouldInlineStylesheets=Ve(this.parent.agentIdentifier,"session_replay.inline_stylesheet"),this.shouldFix=this.shouldInlineStylesheets,this.stopRecording=()=>{}}getEvents(){return this.#N[0]?.events.length?{...this.#N[0],type:"preloaded"}:{events:[...this.#_.events,...this.#T.events].filter((e=>e)),type:"standard",cycleTimestamp:Math.min(this.#_.cycleTimestamp,this.#T.cycleTimestamp),payloadBytesEstimation:this.#_.payloadBytesEstimation+this.#T.payloadBytesEstimation,hasError:this.#_.hasError||this.#T.hasError,hasMeta:this.#_.hasMeta||this.#T.hasMeta,hasSnapshot:this.#_.hasSnapshot||this.#T.hasSnapshot,inlinedAllStylesheets:!!this.#_.events.length&&this.#_.inlinedAllStylesheets||this.#T.inlinedAllStylesheets}}clearBuffer(){this.#N[0]?.events.length?this.#N.shift():this.parent.mode===De.ERROR?this.#_=this.#T:this.#_=new tu,this.#T=new tu}startRecording(){this.recording=!0;const{block_class:e,ignore_class:t,mask_text_class:n,block_selector:i,mask_input_options:r,mask_text_selector:o,mask_all_inputs:s,inline_stylesheet:a,inline_images:c,collect_fonts:l}=Ve(this.parent.agentIdentifier,"session_replay"),u=(e,t)=>"password"===t?.type?.toLowerCase()||void 0===t?.dataset.nrUnmask&&!t?.classList.contains("nr-unmask")?"*".repeat(e.length):e,d=eu.record({emit:this.audit.bind(this),blockClass:e,ignoreClass:t,maskTextClass:n,blockSelector:i,maskInputOptions:r,maskTextSelector:o,maskTextFn:u,maskAllInputs:s,maskInputFn:u,inlineStylesheet:a,inlineImages:c,collectFonts:l,checkoutEveryNms:Bt[this.parent.mode],errorHandler:e=>(this.parent.ee.emit("internal-error",[e]),!0)});this.stopRecording=()=>{this.recording=!1,this.parent.ee.emit(Ut.REPLAY_RUNNING,[!1,this.parent.mode]),d?.()}}audit(e,t){if(!1===this.shouldInlineStylesheets||!this.shouldFix)return this.currentBufferTarget.inlinedAllStylesheets=!1,this.store(e,t);const n=Xc.evaluate();!n&&this.#O&&e.type===jt&&(this.#O=!1),n>0&&(Xc.fix().then((e=>{e>0&&(this.currentBufferTarget.inlinedAllStylesheets=!1,this.shouldFix=!1),ct(ln,["SessionReplay/Payload/Missing-Inline-Css/Failed",e],void 0,pt.metrics,this.parent.ee),ct(ln,["SessionReplay/Payload/Missing-Inline-Css/Fixed",n-e],void 0,pt.metrics,this.parent.ee),this.takeFullSnapshot()})),e.type!==Ht&&e.type!==jt||(this.#O=!0)),this.#O||this.store(e,t)}store(e,t){if(!e)return;if(!this.parent.scheduler&&this.#N.length?this.currentBufferTarget=this.#N[this.#N.length-1]:this.currentBufferTarget=this.#T,this.parent.blocked)return;this.notified||(this.parent.ee.emit(Ut.REPLAY_RUNNING,[!0,this.parent.mode]),this.notified=!0),this.parent.timeKeeper?.ready&&!e.__newrelic&&(e.__newrelic=Mt(e.timestamp,this.parent.timeKeeper),e.timestamp=this.parent.timeKeeper.correctAbsoluteTimestamp(e.timestamp)),e.__serialized=Zt(e);const n=e.__serialized.length,i=this.getPayloadSize(n);this.parent.mode===De.ERROR&&t&&e.type===jt&&this.clearBuffer(),e.type===jt&&(this.currentBufferTarget.hasMeta=!0),e.type===Ht&&(this.currentBufferTarget.hasSnapshot=!0),this.currentBufferTarget.add(e),this.currentBufferTarget.payloadBytesEstimation+=n,(e.type===Ht&&this.currentBufferTarget.hasMeta||i>64e3)&&this.parent.mode===De.FULL&&(this.parent.scheduler?this.parent.scheduler.runHarvest():this.#N.push(new tu))}takeFullSnapshot(){try{if(!this.recording)return;eu.record.takeFullSnapshot()}catch(e){}}clearTimestamps(){this.currentBufferTarget.cycleTimestamp=void 0}getPayloadSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.estimateCompression(this.currentBufferTarget.payloadBytesEstimation+e)+5e3}estimateCompression(e){return this.parent.gzipper&&this.parent.u8?.12*e:e}}}),iu=Uint8Array,ru=Uint16Array,ou=Uint32Array,su=new iu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),au=new iu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),cu=new iu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lu=function(e,t){for(var n=new ru(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new ou(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},uu=lu(su,2),du=uu[0],hu=uu[1];du[28]=258,hu[258]=28;for(var pu=lu(au,0)[1],fu=new ru(32768),mu=0;mu<32768;++mu){var vu=(43690&mu)>>>1|(21845&mu)<<1;vu=(61680&(vu=(52428&vu)>>>2|(13107&vu)<<2))>>>4|(3855&vu)<<4,fu[mu]=((65280&vu)>>>8|(255&vu)<<8)>>>1}var gu=function(e,t,n){for(var i=e.length,r=0,o=new ru(t);r<i;++r)e[r]&&++o[e[r]-1];var s,a=new ru(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new ru(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var l=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[fu[d]>>>c]=l}else for(s=new ru(i),r=0;r<i;++r)e[r]&&(s[r]=fu[a[e[r]-1]++]>>>15-e[r]);return s},yu=new iu(288);for(mu=0;mu<144;++mu)yu[mu]=8;for(mu=144;mu<256;++mu)yu[mu]=9;for(mu=256;mu<280;++mu)yu[mu]=7;for(mu=280;mu<288;++mu)yu[mu]=8;var bu=new iu(32);for(mu=0;mu<32;++mu)bu[mu]=5;var Eu=gu(yu,9,0),wu=gu(bu,5,0),ku=function(e){return(e+7)/8|0},Su=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(2==e.BYTES_PER_ELEMENT?ru:4==e.BYTES_PER_ELEMENT?ou:iu)(n-t);return i.set(e.subarray(t,n)),i},Cu=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8},Tu=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},_u=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[Mu,0];if(1==r){var s=new iu(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var p=new ru(h+1),f=Nu(n[u-1],p,0);if(f>t){i=0;var m=0,v=f-t,g=1<<v;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i<r;++i){var y=o[i].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var b=o[i].s;p[b]<t?m-=1<<t-p[b]++-1:++i}for(;i>=0&&m;--i){var E=o[i].s;p[E]==t&&(--p[E],++m)}f=t}return[new iu(p),f]},Nu=function(e,t,n){return-1==e.s?Math.max(Nu(e.l,t,n+1),Nu(e.r,t,n+1)):t[e.s]=n},Ou=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ru(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Iu=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Ru=function(e,t,n){var i=n.length,r=ku(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},Au=function(e,t,n,i,r,o,s,a,c,l,u){Cu(t,u++,n),++r[256];for(var d=_u(r,15),h=d[0],p=d[1],f=_u(o,15),m=f[0],v=f[1],g=Ou(h),y=g[0],b=g[1],E=Ou(m),w=E[0],k=E[1],S=new ru(19),C=0;C<y.length;++C)S[31&y[C]]++;for(C=0;C<w.length;++C)S[31&w[C]]++;for(var T=_u(S,7),_=T[0],N=T[1],O=19;O>4&&!_[cu[O-1]];--O);var I,R,A,x,M=l+5<<3,L=Iu(r,yu)+Iu(o,bu)+s,P=Iu(r,h)+Iu(o,m)+s+14+3*O+Iu(S,_)+(2*S[16]+3*S[17]+7*S[18]);if(M<=L&&M<=P)return Ru(t,u,e.subarray(c,c+l));if(Cu(t,u,1+(P<L)),u+=2,P<L){I=gu(h,p,0),R=h,A=gu(m,v,0),x=m;var D=gu(_,N,0);Cu(t,u,b-257),Cu(t,u+5,k-1),Cu(t,u+10,O-4),u+=14;for(C=0;C<O;++C)Cu(t,u+3*C,_[cu[C]]);u+=3*O;for(var F=[y,w],U=0;U<2;++U){var H=F[U];for(C=0;C<H.length;++C){var j=31&H[C];Cu(t,u,D[j]),u+=_[j],j>15&&(Cu(t,u,H[C]>>>5&127),u+=H[C]>>>12)}}}else I=Eu,R=yu,A=wu,x=bu;for(C=0;C<a;++C)if(i[C]>255){j=i[C]>>>18&31;Tu(t,u,I[j+257]),u+=R[j+257],j>7&&(Cu(t,u,i[C]>>>23&31),u+=su[j]);var B=31&i[C];Tu(t,u,A[B]),u+=x[B],B>3&&(Tu(t,u,i[C]>>>5&8191),u+=au[B])}else Tu(t,u,I[i[C]]),u+=R[i[C]];return Tu(t,u,I[256]),u+R[256]},xu=new ou([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mu=new iu(0),Lu=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&-306674912)^n>>>1;e[t]=n}return e}(),Pu=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new iu(i+s+5*(1+Math.ceil(s/7e3))+r),c=a.subarray(i,a.length-r),l=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d>=s&&(c[l>>3]=o),l=Ru(c,l+1,e.subarray(u,d))}else{for(var h=xu[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new ru(32768),g=new ru(m+1),y=Math.ceil(n/3),b=2*y,E=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&m},w=new ou(25e3),k=new ru(288),S=new ru(32),C=0,T=0,_=(u=0,0),N=0,O=0;u<s;++u){var I=E(u),R=32767&u,A=g[I];if(v[R]=A,g[I]=R,N<=u){var x=s-u;if((C>7e3||_>24576)&&x>423){l=Au(e,c,0,w,k,S,T,_,O,u-O,l),_=C=T=0,O=u;for(var M=0;M<286;++M)k[M]=0;for(M=0;M<30;++M)S[M]=0}var L=2,P=0,D=f,F=R-A&32767;if(x>2&&I==E(u-F))for(var U=Math.min(p,x)-1,H=Math.min(32767,u),j=Math.min(258,x);F<=H&&--D&&R!=A;){if(e[u+L]==e[u+L-F]){for(var B=0;B<j&&e[u+B]==e[u+B-F];++B);if(B>L){if(L=B,P=F,B>U)break;var V=Math.min(F,B-2),z=0;for(M=0;M<V;++M){var W=u-F+M+32768&32767,q=W-v[W]+32768&32767;q>z&&(z=q,A=W)}}}F+=(R=A)-(A=v[R])+32768&32767}if(P){w[_++]=268435456|hu[L]<<18|pu[P];var G=31&hu[L],K=31&pu[P];T+=su[G]+au[K],++k[257+G],++S[K],N=u+L,++C}else w[_++]=e[u],++k[e[u]]}}l=Au(e,c,o,w,k,S,T,_,O,u-O,l)}return Su(a,0,i+ku(l)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)},Du=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Fu(e,t){t||(t={});var n=function(){var e=-1;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=Lu[255&n^t[i]]^n>>>8;e=n},d:function(){return~e}}}(),i=e.length;n.p(e);var r=Pu(e,t,function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),8),o=r.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Du(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}}(r,t),Du(r,o-8,n.d()),Du(r,o-4,i),r}var Uu="undefined"!=typeof TextEncoder&&new TextEncoder,Hu="undefined"!=typeof TextDecoder&&new TextDecoder;try{Hu.decode(Mu,{stream:!0}),1}catch(Oa){}var ju=Object.freeze({__proto__:null,compressSync:Fu,gzipSync:Fu,strToU8:function(e,t){if(t){for(var n=new iu(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(Uu)return Uu.encode(e);var r=e.length,o=new iu(e.length+(e.length>>1)),s=0,a=function(e){o[s++]=e};for(i=0;i<r;++i){if(s+5>o.length){var c=new iu(s+8+(r-i<<1));c.set(o),o=c}var l=e.charCodeAt(i);l<128||t?a(l):l<2048?(a(192|l>>6),a(128|63&l)):l>55295&&l<57344?(a(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++i))>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|63&l)):(a(224|l>>12),a(128|l>>6&63),a(128|63&l))}return Su(o,0,s)}});e.AfterpayCheckoutButton=cr,e.Api=Vn,e.CHECKOUT_BUTTON_EVENT=yi,e.Canvas3ds=gi,e.Configuration=uo,e.ELEMENT=_i,e.EVENT=Jn,e.ExternalCheckoutBuilder=Ai,e.ExternalCheckoutChecker=xi,e.FORM_FIELD=Si,e.HtmlMultiWidget=yo,e.HtmlPaymentSourceWidget=hr,e.HtmlWidget=bo,e.MastercardSRCClickToPay=gr,e.MultiWidget=vo,e.PAYMENT_TYPE=co,e.PURPOSE=lo,e.PaymentSourceBuilder=rr,e.PaymentSourceWidget=dr,e.PaypalCheckoutButton=lr,e.STYLABLE_ELEMENT=ho,e.STYLABLE_ELEMENT_STATE=po,e.STYLE=Ci,e.SUPPORTED_CARD_TYPES=Ni,e.TEXT=Ti,e.TRIGGER=yr,e.TYPE=ir,e.VAULT_DISPLAY_STYLE={BACKGROUND_COLOR:"background_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",BUTTON_COLOR:"button_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},e.VaultDisplayWidget=kr,e.WalletButtons=ao,e.ZipmoneyCheckoutButton=ar}));
2
63
  //# sourceMappingURL=widget.umd.min.js.map