
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b835aa90-9467-52dd-8dcd-6d069582112c")}catch(e){}}();
(()=>{"use strict";var e={9386:(e,t,r)=>{var n=r(6357),i=r(215),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a function")}},5292:(e,t,r)=>{var n=r(6653),i=r(215),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a constructor")}},2834:(e,t,r)=>{var n=r(6357),i=String,o=TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},5845:(e,t,r)=>{var n=r(3683),i=r(2104),o=r(8449).f,a=n("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},7157:(e,t,r)=>{var n=r(4775).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},2135:(e,t,r)=>{var n=r(5161),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new i("Incorrect invocation")}},151:(e,t,r)=>{var n=r(1634),i=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not an object")}},2372:(e,t,r)=>{var n=r(4543);e.exports=n((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},3371:(e,t,r)=>{var n=r(2077).forEach,i=r(4486)("forEach");e.exports=i?[].forEach:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}},2753:(e,t,r)=>{var n=r(853),i=r(7418),o=r(5526),a=function(e){return function(t,r,a){var s,c=n(t),l=o(c),u=i(a,l);if(e&&r!=r){for(;l>u;)if((s=c[u++])!=s)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===r)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},2077:(e,t,r)=>{var n=r(1232),i=r(1008),o=r(191),a=r(581),s=r(5526),c=r(797),l=i([].push),u=function(e){var t=1===e,r=2===e,i=3===e,u=4===e,d=6===e,h=7===e,p=5===e||d;return function(f,m,v,g){for(var y,E,b=a(f),_=o(b),C=n(m,v),S=s(_),I=0,O=g||c,w=t?O(f,S):r||h?O(f,0):void 0;S>I;I++)if((p||I in _)&&(E=C(y=_[I],I,b),e))if(t)w[I]=E;else if(E)switch(e){case 3:return!0;case 5:return y;case 6:return I;case 2:l(w,y)}else switch(e){case 4:return!1;case 7:l(w,y)}return d?-1:i||u?u:w}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}},4486:(e,t,r)=>{var n=r(4543);e.exports=function(e,t){var r=[][e];return!!r&&n((function(){r.call(null,t||function(){return 1},1)}))}},7262:(e,t,r)=>{var n=r(9386),i=r(581),o=r(191),a=r(5526),s=TypeError,c=function(e){return function(t,r,c,l){n(r);var u=i(t),d=o(u),h=a(u),p=e?h-1:0,f=e?-1:1;if(c<2)for(;;){if(p in d){l=d[p],p+=f;break}if(p+=f,e?p<0:h<=p)throw new s("Reduce of empty array with no initial value")}for(;e?p>=0:h>p;p+=f)p in d&&(l=r(l,d[p],p,u));return l}};e.exports={left:c(!1),right:c(!0)}},231:(e,t,r)=>{var n=r(7418),i=r(5526),o=r(9904),a=Array,s=Math.max;e.exports=function(e,t,r){for(var c=i(e),l=n(t,c),u=n(void 0===r?c:r,c),d=a(s(u-l,0)),h=0;l<u;l++,h++)o(d,h,e[l]);return d.length=h,d}},9929:(e,t,r)=>{var n=r(6872),i=r(6653),o=r(1634),a=r(3683)("species"),s=Array;e.exports=function(e){var t;return n(e)&&(t=e.constructor,(i(t)&&(t===s||n(t.prototype))||o(t)&&null===(t=t[a]))&&(t=void 0)),void 0===t?s:t}},797:(e,t,r)=>{var n=r(9929);e.exports=function(e,t){return new(n(e))(0===t?0:t)}},668:(e,t,r)=>{var n=r(3683)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},6032:(e,t,r)=>{var n=r(1008),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},7611:(e,t,r)=>{var n=r(3644),i=r(6357),o=r(6032),a=r(3683)("toStringTag"),s=Object,c="Arguments"===o(function(){return arguments}());e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?r:c?o(t):"Object"===(n=o(t))&&i(t.callee)?"Arguments":n}},8137:(e,t,r)=>{var n=r(1008),i=r(6519),o=r(8907).getWeakData,a=r(2135),s=r(151),c=r(3445),l=r(1634),u=r(3308),d=r(2077),h=r(5889),p=r(4317),f=p.set,m=p.getterFor,v=d.find,g=d.findIndex,y=n([].splice),E=0,b=function(e){return e.frozen||(e.frozen=new _)},_=function(){this.entries=[]},C=function(e,t){return v(e.entries,(function(e){return e[0]===t}))};_.prototype={get:function(e){var t=C(this,e);if(t)return t[1]},has:function(e){return!!C(this,e)},set:function(e,t){var r=C(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=g(this.entries,(function(t){return t[0]===e}));return~t&&y(this.entries,t,1),!!~t}},e.exports={getConstructor:function(e,t,r,n){var d=e((function(e,i){a(e,p),f(e,{type:t,id:E++,frozen:void 0}),c(i)||u(i,e[n],{that:e,AS_ENTRIES:r})})),p=d.prototype,v=m(t),g=function(e,t,r){var n=v(e),i=o(s(t),!0);return!0===i?b(n).set(t,r):i[n.id]=r,e};return i(p,{delete:function(e){var t=v(this);if(!l(e))return!1;var r=o(e);return!0===r?b(t).delete(e):r&&h(r,t.id)&&delete r[t.id]},has:function(e){var t=v(this);if(!l(e))return!1;var r=o(e);return!0===r?b(t).has(e):r&&h(r,t.id)}}),i(p,r?{get:function(e){var t=v(this);if(l(e)){var r=o(e);return!0===r?b(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return g(this,e,t)}}:{add:function(e){return g(this,e,!0)}}),d}}},196:(e,t,r)=>{var n=r(6566),i=r(4523),o=r(1008),a=r(4396),s=r(9704),c=r(8907),l=r(3308),u=r(2135),d=r(6357),h=r(3445),p=r(1634),f=r(4543),m=r(668),v=r(6143),g=r(3103);e.exports=function(e,t,r){var y=-1!==e.indexOf("Map"),E=-1!==e.indexOf("Weak"),b=y?"set":"add",_=i[e],C=_&&_.prototype,S=_,I={},O=function(e){var t=o(C[e]);s(C,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(E&&!p(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return E&&!p(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(E&&!p(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(a(e,!d(_)||!(E||C.forEach&&!f((function(){(new _).entries().next()})))))S=r.getConstructor(t,e,y,b),c.enable();else if(a(e,!0)){var w=new S,A=w[b](E?{}:-0,1)!==w,T=f((function(){w.has(1)})),P=m((function(e){new _(e)})),N=!E&&f((function(){for(var e=new _,t=5;t--;)e[b](t,t);return!e.has(-0)}));P||((S=t((function(e,t){u(e,C);var r=g(new _,e,S);return h(t)||l(t,r[b],{that:r,AS_ENTRIES:y}),r}))).prototype=C,C.constructor=S),(T||N)&&(O("delete"),O("has"),y&&O("get")),(N||A)&&O(b),E&&C.clear&&delete C.clear}return I[e]=S,n({global:!0,constructor:!0,forced:S!==_},I),v(S,e),E||r.setStrong(S,e,y),S}},812:(e,t,r)=>{var n=r(5889),i=r(7527),o=r(9763),a=r(8449);e.exports=function(e,t,r){for(var s=i(t),c=a.f,l=o.f,u=0;u<s.length;u++){var d=s[u];n(e,d)||r&&n(r,d)||c(e,d,l(t,d))}}},6412:(e,t,r)=>{var n=r(3683)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,"/./"[e](t)}catch(e){}}return!1}},99:(e,t,r)=>{var n=r(4543);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},5025:e=>{e.exports=function(e,t){return{value:e,done:t}}},6587:(e,t,r)=>{var n=r(5180),i=r(8449),o=r(6372);e.exports=n?function(e,t,r){return i.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},6372:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},9904:(e,t,r)=>{var n=r(9833),i=r(8449),o=r(6372);e.exports=function(e,t,r){var a=n(t);a in e?i.f(e,a,o(0,r)):e[a]=r}},3642:(e,t,r)=>{var n=r(27),i=r(8449);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),i.f(e,t,r)}},9704:(e,t,r)=>{var n=r(6357),i=r(8449),o=r(27),a=r(2969);e.exports=function(e,t,r,s){s||(s={});var c=s.enumerable,l=void 0!==s.name?s.name:t;if(n(r)&&o(r,l,s),s.global)c?e[t]=r:a(t,r);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=r:i.f(e,t,{value:r,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6519:(e,t,r)=>{var n=r(9704);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},2969:(e,t,r)=>{var n=r(4523),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},5180:(e,t,r)=>{var n=r(4543);e.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},2155:e=>{var t="object"==typeof document&&document.all,r=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:r}},2679:(e,t,r)=>{var n=r(4523),i=r(1634),o=n.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},792:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},832:(e,t,r)=>{var n=r(2679)("span").classList,i=n&&n.constructor&&n.constructor.prototype;e.exports=i===Object.prototype?void 0:i},2224:(e,t,r)=>{var n=r(4523),i=r(6032);e.exports="process"===i(n.process)},4848:e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},2844:(e,t,r)=>{var n,i,o=r(4523),a=r(4848),s=o.process,c=o.Deno,l=s&&s.versions||c&&c.version,u=l&&l.v8;u&&(i=(n=u.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},8471:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6566:(e,t,r)=>{var n=r(4523),i=r(9763).f,o=r(6587),a=r(9704),s=r(2969),c=r(812),l=r(4396);e.exports=function(e,t){var r,u,d,h,p,f=e.target,m=e.global,v=e.stat;if(r=m?n:v?n[f]||s(f,{}):(n[f]||{}).prototype)for(u in t){if(h=t[u],d=e.dontCallGetSet?(p=i(r,u))&&p.value:r[u],!l(m?u:f+(v?".":"#")+u,e.forced)&&void 0!==d){if(typeof h==typeof d)continue;c(h,d)}(e.sham||d&&d.sham)&&o(h,"sham",!0),a(r,u,h,e)}}},4543:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},1644:(e,t,r)=>{r(3831);var n=r(1316),i=r(9704),o=r(8779),a=r(4543),s=r(3683),c=r(6587),l=s("species"),u=RegExp.prototype;e.exports=function(e,t,r,d){var h=s(e),p=!a((function(){var t={};return t[h]=function(){return 7},7!==""[e](t)})),f=p&&!a((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[l]=function(){return r},r.flags="",r[h]=/./[h]),r.exec=function(){return t=!0,null},r[h](""),!t}));if(!p||!f||r){var m=n(/./[h]),v=t(h,""[e],(function(e,t,r,i,a){var s=n(e),c=t.exec;return c===o||c===u.exec?p&&!a?{done:!0,value:m(t,r,i)}:{done:!0,value:s(r,t,i)}:{done:!1}}));i(String.prototype,e,v[0]),i(u,h,v[1])}d&&c(u[h],"sham",!0)}},5240:(e,t,r)=>{var n=r(4543);e.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},1881:(e,t,r)=>{var n=r(9944),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(o):function(){return a.apply(o,arguments)})},1232:(e,t,r)=>{var n=r(1316),i=r(9386),o=r(9944),a=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},9944:(e,t,r)=>{var n=r(4543);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},2957:(e,t,r)=>{var n=r(9944),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},94:(e,t,r)=>{var n=r(5180),i=r(5889),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=i(o,"name"),c=s&&"something"===function(){}.name,l=s&&(!n||n&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:l}},2946:(e,t,r)=>{var n=r(1008),i=r(9386);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},1316:(e,t,r)=>{var n=r(6032),i=r(1008);e.exports=function(e){if("Function"===n(e))return i(e)}},1008:(e,t,r)=>{var n=r(9944),i=Function.prototype,o=i.call,a=n&&i.bind.bind(o,o);e.exports=n?a:function(e){return function(){return o.apply(e,arguments)}}},7735:(e,t,r)=>{var n=r(4523),i=r(6357);e.exports=function(e,t){return arguments.length<2?(r=n[e],i(r)?r:void 0):n[e]&&n[e][t];var r}},787:(e,t,r)=>{var n=r(7611),i=r(6046),o=r(3445),a=r(7869),s=r(3683)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[n(e)]}},6417:(e,t,r)=>{var n=r(2957),i=r(9386),o=r(151),a=r(215),s=r(787),c=TypeError;e.exports=function(e,t){var r=arguments.length<2?s(e):t;if(i(r))return o(n(r,e));throw new c(a(e)+" is not iterable")}},6046:(e,t,r)=>{var n=r(9386),i=r(3445);e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}},9070:(e,t,r)=>{var n=r(1008),i=r(581),o=Math.floor,a=n("".charAt),s=n("".replace),c=n("".slice),l=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,r,n,d,h){var p=r+e.length,f=n.length,m=u;return void 0!==d&&(d=i(d),m=l),s(h,m,(function(i,s){var l;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return c(t,0,r);case"'":return c(t,p);case"<":l=d[c(s,1,-1)];break;default:var u=+s;if(0===u)return i;if(u>f){var h=o(u/10);return 0===h?i:h<=f?void 0===n[h-1]?a(s,1):n[h-1]+a(s,1):i}l=n[u-1]}return void 0===l?"":l}))}},4523:function(e,t,r){var n=function(e){return e&&e.Math===Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||function(){return this}()||this||Function("return this")()},5889:(e,t,r)=>{var n=r(1008),i=r(581),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},5525:e=>{e.exports={}},2093:(e,t,r)=>{var n=r(7735);e.exports=n("document","documentElement")},9053:(e,t,r)=>{var n=r(5180),i=r(4543),o=r(2679);e.exports=!n&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},191:(e,t,r)=>{var n=r(1008),i=r(4543),o=r(6032),a=Object,s=n("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},3103:(e,t,r)=>{var n=r(6357),i=r(1634),o=r(7943);e.exports=function(e,t,r){var a,s;return o&&n(a=t.constructor)&&a!==r&&i(s=a.prototype)&&s!==r.prototype&&o(e,s),e}},6842:(e,t,r)=>{var n=r(1008),i=r(6357),o=r(3965),a=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},8907:(e,t,r)=>{var n=r(6566),i=r(1008),o=r(5525),a=r(1634),s=r(5889),c=r(8449).f,l=r(9712),u=r(3834),d=r(3452),h=r(6048),p=r(5240),f=!1,m=h("meta"),v=0,g=function(e){c(e,m,{value:{objectID:"O"+v++,weakData:{}}})},y=e.exports={enable:function(){y.enable=function(){},f=!0;var e=l.f,t=i([].splice),r={};r[m]=1,e(r).length&&(l.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===m){t(n,i,1);break}return n},n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:u.f}))},fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,m)){if(!d(e))return"F";if(!t)return"E";g(e)}return e[m].objectID},getWeakData:function(e,t){if(!s(e,m)){if(!d(e))return!0;if(!t)return!1;g(e)}return e[m].weakData},onFreeze:function(e){return p&&f&&d(e)&&!s(e,m)&&g(e),e}};o[m]=!0},4317:(e,t,r)=>{var n,i,o,a=r(158),s=r(4523),c=r(1634),l=r(6587),u=r(5889),d=r(3965),h=r(9847),p=r(5525),f="Object already initialized",m=s.TypeError,v=s.WeakMap;if(a||d.state){var g=d.state||(d.state=new v);g.get=g.get,g.has=g.has,g.set=g.set,n=function(e,t){if(g.has(e))throw new m(f);return t.facade=e,g.set(e,t),t},i=function(e){return g.get(e)||{}},o=function(e){return g.has(e)}}else{var y=h("state");p[y]=!0,n=function(e,t){if(u(e,y))throw new m(f);return t.facade=e,l(e,y,t),t},i=function(e){return u(e,y)?e[y]:{}},o=function(e){return u(e,y)}}e.exports={set:n,get:i,has:o,enforce:function(e){return o(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!c(t)||(r=i(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return r}}}},5745:(e,t,r)=>{var n=r(3683),i=r(7869),o=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},6872:(e,t,r)=>{var n=r(6032);e.exports=Array.isArray||function(e){return"Array"===n(e)}},6357:(e,t,r)=>{var n=r(2155),i=n.all;e.exports=n.IS_HTMLDDA?function(e){return"function"==typeof e||e===i}:function(e){return"function"==typeof e}},6653:(e,t,r)=>{var n=r(1008),i=r(4543),o=r(6357),a=r(7611),s=r(7735),c=r(6842),l=function(){},u=[],d=s("Reflect","construct"),h=/^\s*(?:class|function)\b/,p=n(h.exec),f=!h.test(l),m=function(e){if(!o(e))return!1;try{return d(l,u,e),!0}catch(e){return!1}},v=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!p(h,c(e))}catch(e){return!0}};v.sham=!0,e.exports=!d||i((function(){var e;return m(m.call)||!m(Object)||!m((function(){e=!0}))||e}))?v:m},4396:(e,t,r)=>{var n=r(4543),i=r(6357),o=/#|\.prototype\./,a=function(e,t){var r=c[s(e)];return r===u||r!==l&&(i(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=a.data={},l=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},3445:e=>{e.exports=function(e){return null==e}},1634:(e,t,r)=>{var n=r(6357),i=r(2155),o=i.all;e.exports=i.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:n(e)||e===o}:function(e){return"object"==typeof e?null!==e:n(e)}},7051:e=>{e.exports=!1},2388:(e,t,r)=>{var n=r(1634),i=r(6032),o=r(3683)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},2357:(e,t,r)=>{var n=r(7735),i=r(6357),o=r(5161),a=r(2496),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&o(t.prototype,s(e))}},3308:(e,t,r)=>{var n=r(1232),i=r(2957),o=r(151),a=r(215),s=r(5745),c=r(5526),l=r(5161),u=r(6417),d=r(787),h=r(2675),p=TypeError,f=function(e,t){this.stopped=e,this.result=t},m=f.prototype;e.exports=function(e,t,r){var v,g,y,E,b,_,C,S=r&&r.that,I=!(!r||!r.AS_ENTRIES),O=!(!r||!r.IS_RECORD),w=!(!r||!r.IS_ITERATOR),A=!(!r||!r.INTERRUPTED),T=n(t,S),P=function(e){return v&&h(v,"normal",e),new f(!0,e)},N=function(e){return I?(o(e),A?T(e[0],e[1],P):T(e[0],e[1])):A?T(e,P):T(e)};if(O)v=e.iterator;else if(w)v=e;else{if(!(g=d(e)))throw new p(a(e)+" is not iterable");if(s(g)){for(y=0,E=c(e);E>y;y++)if((b=N(e[y]))&&l(m,b))return b;return new f(!1)}v=u(e,g)}for(_=O?e.next:v.next;!(C=i(_,v)).done;){try{b=N(C.value)}catch(e){h(v,"throw",e)}if("object"==typeof b&&b&&l(m,b))return b}return new f(!1)}},2675:(e,t,r)=>{var n=r(2957),i=r(151),o=r(6046);e.exports=function(e,t,r){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw r;return r}a=n(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw r;if(s)throw a;return i(a),r}},714:(e,t,r)=>{var n=r(793).IteratorPrototype,i=r(2104),o=r(6372),a=r(6143),s=r(7869),c=function(){return this};e.exports=function(e,t,r,l){var u=t+" Iterator";return e.prototype=i(n,{next:o(+!l,r)}),a(e,u,!1,!0),s[u]=c,e}},3952:(e,t,r)=>{var n=r(6566),i=r(2957),o=r(7051),a=r(94),s=r(6357),c=r(714),l=r(7763),u=r(7943),d=r(6143),h=r(6587),p=r(9704),f=r(3683),m=r(7869),v=r(793),g=a.PROPER,y=a.CONFIGURABLE,E=v.IteratorPrototype,b=v.BUGGY_SAFARI_ITERATORS,_=f("iterator"),C="keys",S="values",I="entries",O=function(){return this};e.exports=function(e,t,r,a,f,v,w){c(r,t,a);var A,T,P,N=function(e){if(e===f&&k)return k;if(!b&&e&&e in L)return L[e];switch(e){case C:case S:case I:return function(){return new r(this,e)}}return function(){return new r(this)}},D=t+" Iterator",R=!1,L=e.prototype,x=L[_]||L["@@iterator"]||f&&L[f],k=!b&&x||N(f),M="Array"===t&&L.entries||x;if(M&&(A=l(M.call(new e)))!==Object.prototype&&A.next&&(o||l(A)===E||(u?u(A,E):s(A[_])||p(A,_,O)),d(A,D,!0,!0),o&&(m[D]=O)),g&&f===S&&x&&x.name!==S&&(!o&&y?h(L,"name",S):(R=!0,k=function(){return i(x,this)})),f)if(T={values:N(S),keys:v?k:N(C),entries:N(I)},w)for(P in T)(b||R||!(P in L))&&p(L,P,T[P]);else n({target:t,proto:!0,forced:b||R},T);return o&&!w||L[_]===k||p(L,_,k,{name:f}),m[t]=k,T}},793:(e,t,r)=>{var n,i,o,a=r(4543),s=r(6357),c=r(1634),l=r(2104),u=r(7763),d=r(9704),h=r(3683),p=r(7051),f=h("iterator"),m=!1;[].keys&&("next"in(o=[].keys())?(i=u(u(o)))!==Object.prototype&&(n=i):m=!0),!c(n)||a((function(){var e={};return n[f].call(e)!==e}))?n={}:p&&(n=l(n)),s(n[f])||d(n,f,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:m}},7869:e=>{e.exports={}},5526:(e,t,r)=>{var n=r(5966);e.exports=function(e){return n(e.length)}},27:(e,t,r)=>{var n=r(1008),i=r(4543),o=r(6357),a=r(5889),s=r(5180),c=r(94).CONFIGURABLE,l=r(6842),u=r(4317),d=u.enforce,h=u.get,p=String,f=Object.defineProperty,m=n("".slice),v=n("".replace),g=n([].join),y=s&&!i((function(){return 8!==f((function(){}),"length",{value:8}).length})),E=String(String).split("String"),b=e.exports=function(e,t,r){"Symbol("===m(p(t),0,7)&&(t="["+v(p(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!a(e,"name")||c&&e.name!==t)&&(s?f(e,"name",{value:t,configurable:!0}):e.name=t),y&&r&&a(r,"arity")&&e.length!==r.arity&&f(e,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=d(e);return a(n,"source")||(n.source=g(E,"string"==typeof t?t:"")),e};Function.prototype.toString=b((function(){return o(this)&&h(this).source||l(this)}),"toString")},4469:e=>{var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},495:(e,t,r)=>{var n=r(2388),i=TypeError;e.exports=function(e){if(n(e))throw new i("The method doesn't accept regular expressions");return e}},3280:(e,t,r)=>{var n=r(4523),i=r(4543),o=r(1008),a=r(2255),s=r(8906).trim,c=r(8908),l=o("".charAt),u=n.parseFloat,d=n.Symbol,h=d&&d.iterator,p=1/u(c+"-0")!=-1/0||h&&!i((function(){u(Object(h))}));e.exports=p?function(e){var t=s(a(e)),r=u(t);return 0===r&&"-"===l(t,0)?-0:r}:u},3957:(e,t,r)=>{var n=r(5180),i=r(1008),o=r(2957),a=r(4543),s=r(2528),c=r(2981),l=r(5),u=r(581),d=r(191),h=Object.assign,p=Object.defineProperty,f=i([].concat);e.exports=!h||a((function(){if(n&&1!==h({b:1},h(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!==h({},e)[r]||s(h({},t)).join("")!==i}))?function(e,t){for(var r=u(e),i=arguments.length,a=1,h=c.f,p=l.f;i>a;)for(var m,v=d(arguments[a++]),g=h?f(s(v),h(v)):s(v),y=g.length,E=0;y>E;)m=g[E++],n&&!o(p,v,m)||(r[m]=v[m]);return r}:h},2104:(e,t,r)=>{var n,i=r(151),o=r(8337),a=r(8471),s=r(5525),c=r(2093),l=r(2679),u=r(9847),d="prototype",h="script",p=u("IE_PROTO"),f=function(){},m=function(e){return"<"+h+">"+e+"</"+h+">"},v=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},g=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;g="undefined"!=typeof document?document.domain&&n?v(n):(t=l("iframe"),r="java"+h+":",t.style.display="none",c.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):v(n);for(var i=a.length;i--;)delete g[d][a[i]];return g()};s[p]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(f[d]=i(e),r=new f,f[d]=null,r[p]=e):r=g(),void 0===t?r:o.f(r,t)}},8337:(e,t,r)=>{var n=r(5180),i=r(7310),o=r(8449),a=r(151),s=r(853),c=r(2528);t.f=n&&!i?Object.defineProperties:function(e,t){a(e);for(var r,n=s(t),i=c(t),l=i.length,u=0;l>u;)o.f(e,r=i[u++],n[r]);return e}},8449:(e,t,r)=>{var n=r(5180),i=r(9053),o=r(7310),a=r(151),s=r(9833),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",h="configurable",p="writable";t.f=n?o?function(e,t,r){if(a(e),t=s(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&p in r&&!r[p]){var n=u(e,t);n&&n[p]&&(e[t]=r.value,r={configurable:h in r?r[h]:n[h],enumerable:d in r?r[d]:n[d],writable:!1})}return l(e,t,r)}:l:function(e,t,r){if(a(e),t=s(t),a(r),i)try{return l(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new c("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},9763:(e,t,r)=>{var n=r(5180),i=r(2957),o=r(5),a=r(6372),s=r(853),c=r(9833),l=r(5889),u=r(9053),d=Object.getOwnPropertyDescriptor;t.f=n?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return a(!i(o.f,e,t),e[t])}},3834:(e,t,r)=>{var n=r(6032),i=r(853),o=r(9712).f,a=r(231),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"Window"===n(e)?function(e){try{return o(e)}catch(e){return a(s)}}(e):o(i(e))}},9712:(e,t,r)=>{var n=r(1156),i=r(8471).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},2981:(e,t)=>{t.f=Object.getOwnPropertySymbols},7763:(e,t,r)=>{var n=r(5889),i=r(6357),o=r(581),a=r(9847),s=r(99),c=a("IE_PROTO"),l=Object,u=l.prototype;e.exports=s?l.getPrototypeOf:function(e){var t=o(e);if(n(t,c))return t[c];var r=t.constructor;return i(r)&&t instanceof r?r.prototype:t instanceof l?u:null}},3452:(e,t,r)=>{var n=r(4543),i=r(1634),o=r(6032),a=r(2372),s=Object.isExtensible,c=n((function(){s(1)}));e.exports=c||a?function(e){return!!i(e)&&(!a||"ArrayBuffer"!==o(e))&&(!s||s(e))}:s},5161:(e,t,r)=>{var n=r(1008);e.exports=n({}.isPrototypeOf)},1156:(e,t,r)=>{var n=r(1008),i=r(5889),o=r(853),a=r(2753).indexOf,s=r(5525),c=n([].push);e.exports=function(e,t){var r,n=o(e),l=0,u=[];for(r in n)!i(s,r)&&i(n,r)&&c(u,r);for(;t.length>l;)i(n,r=t[l++])&&(~a(u,r)||c(u,r));return u}},2528:(e,t,r)=>{var n=r(1156),i=r(8471);e.exports=Object.keys||function(e){return n(e,i)}},5:(e,t)=>{var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},7943:(e,t,r)=>{var n=r(2946),i=r(151),o=r(2834);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return i(r),o(n),t?e(r,n):r.__proto__=n,r}}():void 0)},5221:(e,t,r)=>{var n=r(5180),i=r(4543),o=r(1008),a=r(7763),s=r(2528),c=r(853),l=o(r(5).f),u=o([].push),d=n&&i((function(){var e=Object.create(null);return e[2]=2,!l(e,2)})),h=function(e){return function(t){for(var r,i=c(t),o=s(i),h=d&&null===a(i),p=o.length,f=0,m=[];p>f;)r=o[f++],n&&!(h?r in i:l(i,r))||u(m,e?[r,i[r]]:i[r]);return m}};e.exports={entries:h(!0),values:h(!1)}},5774:(e,t,r)=>{var n=r(2957),i=r(6357),o=r(1634),a=TypeError;e.exports=function(e,t){var r,s;if("string"===t&&i(r=e.toString)&&!o(s=n(r,e)))return s;if(i(r=e.valueOf)&&!o(s=n(r,e)))return s;if("string"!==t&&i(r=e.toString)&&!o(s=n(r,e)))return s;throw new a("Can't convert object to primitive value")}},7527:(e,t,r)=>{var n=r(7735),i=r(1008),o=r(9712),a=r(2981),s=r(151),c=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(s(e)),r=a.f;return r?c(t,r(e)):t}},4192:(e,t,r)=>{var n=r(8449).f;e.exports=function(e,t,r){r in e||n(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})}},6010:(e,t,r)=>{var n=r(2957),i=r(151),o=r(6357),a=r(6032),s=r(8779),c=TypeError;e.exports=function(e,t){var r=e.exec;if(o(r)){var l=n(r,e,t);return null!==l&&i(l),l}if("RegExp"===a(e))return n(s,e,t);throw new c("RegExp#exec called on incompatible receiver")}},8779:(e,t,r)=>{var n,i,o=r(2957),a=r(1008),s=r(2255),c=r(4315),l=r(9933),u=r(9441),d=r(2104),h=r(4317).get,p=r(3027),f=r(8702),m=u("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,g=v,y=a("".charAt),E=a("".indexOf),b=a("".replace),_=a("".slice),C=(i=/b*/g,o(v,n=/a/,"a"),o(v,i,"a"),0!==n.lastIndex||0!==i.lastIndex),S=l.BROKEN_CARET,I=void 0!==/()??/.exec("")[1];(C||I||S||p||f)&&(g=function(e){var t,r,n,i,a,l,u,p=this,f=h(p),O=s(e),w=f.raw;if(w)return w.lastIndex=p.lastIndex,t=o(g,w,O),p.lastIndex=w.lastIndex,t;var A=f.groups,T=S&&p.sticky,P=o(c,p),N=p.source,D=0,R=O;if(T&&(P=b(P,"y",""),-1===E(P,"g")&&(P+="g"),R=_(O,p.lastIndex),p.lastIndex>0&&(!p.multiline||p.multiline&&"\n"!==y(O,p.lastIndex-1))&&(N="(?: "+N+")",R=" "+R,D++),r=new RegExp("^(?:"+N+")",P)),I&&(r=new RegExp("^"+N+"$(?!\\s)",P)),C&&(n=p.lastIndex),i=o(v,T?r:p,R),T?i?(i.input=_(i.input,D),i[0]=_(i[0],D),i.index=p.lastIndex,p.lastIndex+=i[0].length):p.lastIndex=0:C&&i&&(p.lastIndex=p.global?i.index+i[0].length:n),I&&i&&i.length>1&&o(m,i[0],r,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&A)for(i.groups=l=d(null),a=0;a<A.length;a++)l[(u=A[a])[0]]=i[u[1]];return i}),e.exports=g},4315:(e,t,r)=>{var n=r(151);e.exports=function(){var e=n(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},1274:(e,t,r)=>{var n=r(2957),i=r(5889),o=r(5161),a=r(4315),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||i(e,"flags")||!o(s,e)?t:n(a,e)}},9933:(e,t,r)=>{var n=r(4543),i=r(4523).RegExp,o=n((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||n((function(){return!i("a","y").sticky})),s=o||n((function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},3027:(e,t,r)=>{var n=r(4543),i=r(4523).RegExp;e.exports=n((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},8702:(e,t,r)=>{var n=r(4543),i=r(4523).RegExp;e.exports=n((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},9286:(e,t,r)=>{var n=r(3445),i=TypeError;e.exports=function(e){if(n(e))throw new i("Can't call method on "+e);return e}},9089:(e,t,r)=>{var n=r(7735),i=r(3642),o=r(3683),a=r(5180),s=o("species");e.exports=function(e){var t=n(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},6143:(e,t,r)=>{var n=r(8449).f,i=r(5889),o=r(3683)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!i(e,o)&&n(e,o,{configurable:!0,value:t})}},9847:(e,t,r)=>{var n=r(9441),i=r(6048),o=n("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},3965:(e,t,r)=>{var n=r(4523),i=r(2969),o="__core-js_shared__",a=n[o]||i(o,{});e.exports=a},9441:(e,t,r)=>{var n=r(7051),i=r(3965);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.33.0",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"})},8581:(e,t,r)=>{var n=r(151),i=r(5292),o=r(3445),a=r(3683)("species");e.exports=function(e,t){var r,s=n(e).constructor;return void 0===s||o(r=n(s)[a])?t:i(r)}},4775:(e,t,r)=>{var n=r(1008),i=r(4827),o=r(2255),a=r(9286),s=n("".charAt),c=n("".charCodeAt),l=n("".slice),u=function(e){return function(t,r){var n,u,d=o(a(t)),h=i(r),p=d.length;return h<0||h>=p?e?"":void 0:(n=c(d,h))<55296||n>56319||h+1===p||(u=c(d,h+1))<56320||u>57343?e?s(d,h):n:e?l(d,h,h+2):u-56320+(n-55296<<10)+65536}};e.exports={codeAt:u(!1),charAt:u(!0)}},4567:(e,t,r)=>{var n=r(4848);e.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(n)},613:(e,t,r)=>{var n=r(1008),i=r(5966),o=r(2255),a=r(4458),s=r(9286),c=n(a),l=n("".slice),u=Math.ceil,d=function(e){return function(t,r,n){var a,d,h=o(s(t)),p=i(r),f=h.length,m=void 0===n?" ":o(n);return p<=f||""===m?h:((d=c(m,u((a=p-f)/m.length))).length>a&&(d=l(d,0,a)),e?h+d:d+h)}};e.exports={start:d(!1),end:d(!0)}},4458:(e,t,r)=>{var n=r(4827),i=r(2255),o=r(9286),a=RangeError;e.exports=function(e){var t=i(o(this)),r="",s=n(e);if(s<0||s===1/0)throw new a("Wrong number of repetitions");for(;s>0;(s>>>=1)&&(t+=t))1&s&&(r+=t);return r}},82:(e,t,r)=>{var n=r(94).PROPER,i=r(4543),o=r(8908);e.exports=function(e){return i((function(){return!!o[e]()||"​᠎"!=="​᠎"[e]()||n&&o[e].name!==e}))}},8906:(e,t,r)=>{var n=r(1008),i=r(9286),o=r(2255),a=r(8908),s=n("".replace),c=RegExp("^["+a+"]+"),l=RegExp("(^|[^"+a+"])["+a+"]+$"),u=function(e){return function(t){var r=o(i(t));return 1&e&&(r=s(r,c,"")),2&e&&(r=s(r,l,"$1")),r}};e.exports={start:u(1),end:u(2),trim:u(3)}},4687:(e,t,r)=>{var n=r(2844),i=r(4543),o=r(4523).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},3048:(e,t,r)=>{var n=r(1008);e.exports=n(1..valueOf)},7418:(e,t,r)=>{var n=r(4827),i=Math.max,o=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):o(r,t)}},853:(e,t,r)=>{var n=r(191),i=r(9286);e.exports=function(e){return n(i(e))}},4827:(e,t,r)=>{var n=r(4469);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},5966:(e,t,r)=>{var n=r(4827),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},581:(e,t,r)=>{var n=r(9286),i=Object;e.exports=function(e){return i(n(e))}},9113:(e,t,r)=>{var n=r(2957),i=r(1634),o=r(2357),a=r(6046),s=r(5774),c=r(3683),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var r,c=a(e,u);if(c){if(void 0===t&&(t="default"),r=n(c,e,t),!i(r)||o(r))return r;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},9833:(e,t,r)=>{var n=r(9113),i=r(2357);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},3644:(e,t,r)=>{var n={};n[r(3683)("toStringTag")]="z",e.exports="[object z]"===String(n)},2255:(e,t,r)=>{var n=r(7611),i=String;e.exports=function(e){if("Symbol"===n(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},215:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6048:(e,t,r)=>{var n=r(1008),i=0,o=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},2496:(e,t,r)=>{var n=r(4687);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7310:(e,t,r)=>{var n=r(5180),i=r(4543);e.exports=n&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},158:(e,t,r)=>{var n=r(4523),i=r(6357),o=n.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},3683:(e,t,r)=>{var n=r(4523),i=r(9441),o=r(5889),a=r(6048),s=r(4687),c=r(2496),l=n.Symbol,u=i("wks"),d=c?l.for||l:l&&l.withoutSetter||a;e.exports=function(e){return o(u,e)||(u[e]=s&&o(l,e)?l[e]:d("Symbol."+e)),u[e]}},8908:e=>{e.exports="\t\n\v\f\r                　\u2028\u2029\ufeff"},935:(e,t,r)=>{var n=r(6566),i=r(2753).includes,o=r(4543),a=r(5845);n({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},6656:(e,t,r)=>{var n=r(853),i=r(5845),o=r(7869),a=r(4317),s=r(8449).f,c=r(3952),l=r(5025),u=r(7051),d=r(5180),h="Array Iterator",p=a.set,f=a.getterFor(h);e.exports=c(Array,"Array",(function(e,t){p(this,{type:h,target:n(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,r=e.kind,n=e.index++;if(!t||n>=t.length)return e.target=void 0,l(void 0,!0);switch(r){case"keys":return l(n,!1);case"values":return l(t[n],!1)}return l([n,t[n]],!1)}),"values");var m=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!u&&d&&"values"!==m.name)try{s(m,"name",{value:"values"})}catch(e){}},6104:(e,t,r)=>{var n=r(6566),i=r(7262).left,o=r(4486),a=r(2844);n({target:"Array",proto:!0,forced:!r(2224)&&a>79&&a<83||!o("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},7156:(e,t,r)=>{var n=r(6566),i=r(3280);n({target:"Number",stat:!0,forced:Number.parseFloat!==i},{parseFloat:i})},6460:(e,t,r)=>{var n=r(6566),i=r(1008),o=r(4827),a=r(3048),s=r(4458),c=r(4543),l=RangeError,u=String,d=Math.floor,h=i(s),p=i("".slice),f=i(1..toFixed),m=function(e,t,r){return 0===t?r:t%2==1?m(e,t-1,r*e):m(e*e,t/2,r)},v=function(e,t,r){for(var n=-1,i=r;++n<6;)i+=t*e[n],e[n]=i%1e7,i=d(i/1e7)},g=function(e,t){for(var r=6,n=0;--r>=0;)n+=e[r],e[r]=d(n/t),n=n%t*1e7},y=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var n=u(e[t]);r=""===r?n:r+h("0",7-n.length)+n}return r};n({target:"Number",proto:!0,forced:c((function(){return"0.000"!==f(8e-5,3)||"1"!==f(.9,0)||"1.25"!==f(1.255,2)||"1000000000000000128"!==f(0xde0b6b3a7640080,0)}))||!c((function(){f({})}))},{toFixed:function(e){var t,r,n,i,s=a(this),c=o(e),d=[0,0,0,0,0,0],f="",E="0";if(c<0||c>20)throw new l("Incorrect fraction digits");if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return u(s);if(s<0&&(f="-",s=-s),s>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(s*m(2,69,1))-69)<0?s*m(2,-t,1):s/m(2,t,1),r*=4503599627370496,(t=52-t)>0){for(v(d,0,r),n=c;n>=7;)v(d,1e7,0),n-=7;for(v(d,m(10,n,1),0),n=t-1;n>=23;)g(d,1<<23),n-=23;g(d,1<<n),v(d,1,1),g(d,2),E=y(d)}else v(d,0,r),v(d,1<<-t,0),E=y(d)+h("0",c);return c>0?f+((i=E.length)<=c?"0."+h("0",c-i)+E:p(E,0,i-c)+"."+p(E,i-c)):f+E}})},2221:(e,t,r)=>{var n=r(6566),i=r(3957);n({target:"Object",stat:!0,arity:2,forced:Object.assign!==i},{assign:i})},8370:(e,t,r)=>{var n=r(6566),i=r(5221).entries;n({target:"Object",stat:!0},{entries:function(e){return i(e)}})},3249:(e,t,r)=>{var n=r(6566),i=r(3308),o=r(9904);n({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,r){o(t,e,r)}),{AS_ENTRIES:!0}),t}})},9170:(e,t,r)=>{var n=r(6566),i=r(5221).values;n({target:"Object",stat:!0},{values:function(e){return i(e)}})},1152:(e,t,r)=>{var n=r(5180),i=r(4523),o=r(1008),a=r(4396),s=r(3103),c=r(6587),l=r(9712).f,u=r(5161),d=r(2388),h=r(2255),p=r(1274),f=r(9933),m=r(4192),v=r(9704),g=r(4543),y=r(5889),E=r(4317).enforce,b=r(9089),_=r(3683),C=r(3027),S=r(8702),I=_("match"),O=i.RegExp,w=O.prototype,A=i.SyntaxError,T=o(w.exec),P=o("".charAt),N=o("".replace),D=o("".indexOf),R=o("".slice),L=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,x=/a/g,k=/a/g,M=new O(x)!==x,j=f.MISSED_STICKY,U=f.UNSUPPORTED_Y;if(a("RegExp",n&&(!M||j||C||S||g((function(){return k[I]=!1,O(x)!==x||O(k)===k||"/a/i"!==String(O(x,"i"))}))))){for(var B=function(e,t){var r,n,i,o,a,l,f=u(w,this),m=d(e),v=void 0===t,g=[],b=e;if(!f&&m&&v&&e.constructor===B)return e;if((m||u(w,e))&&(e=e.source,v&&(t=p(b))),e=void 0===e?"":h(e),t=void 0===t?"":h(t),b=e,C&&"dotAll"in x&&(n=!!t&&D(t,"s")>-1)&&(t=N(t,/s/g,"")),r=t,j&&"sticky"in x&&(i=!!t&&D(t,"y")>-1)&&U&&(t=N(t,/y/g,"")),S&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,l=0,u="";n<=r;n++){if("\\"===(t=P(e,n)))t+=P(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:T(L,R(e,n+1))&&(n+=2,c=!0),i+=t,l++;continue;case">"===t&&c:if(""===u||y(a,u))throw new A("Invalid capture group name");a[u]=!0,o[o.length]=[u,l],c=!1,u="";continue}c?u+=t:i+=t}return[i,o]}(e),e=o[0],g=o[1]),a=s(O(e,t),f?this:w,B),(n||i||g.length)&&(l=E(a),n&&(l.dotAll=!0,l.raw=B(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=P(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+P(e,++n);return i}(e),r)),i&&(l.sticky=!0),g.length&&(l.groups=g)),e!==b)try{c(a,"source",""===b?"(?:)":b)}catch(e){}return a},q=l(O),H=0;q.length>H;)m(B,O,q[H++]);w.constructor=B,B.prototype=w,v(i,"RegExp",B,{constructor:!0})}b("RegExp")},3831:(e,t,r)=>{var n=r(6566),i=r(8779);n({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},4237:(e,t,r)=>{var n=r(94).PROPER,i=r(9704),o=r(151),a=r(2255),s=r(4543),c=r(1274),l="toString",u=RegExp.prototype[l],d=s((function(){return"/a/b"!==u.call({source:"a",flags:"b"})})),h=n&&u.name!==l;(d||h)&&i(RegExp.prototype,l,(function(){var e=o(this);return"/"+a(e.source)+"/"+a(c(e))}),{unsafe:!0})},1257:(e,t,r)=>{var n,i=r(6566),o=r(1316),a=r(9763).f,s=r(5966),c=r(2255),l=r(495),u=r(9286),d=r(6412),h=r(7051),p=o("".endsWith),f=o("".slice),m=Math.min,v=d("endsWith");i({target:"String",proto:!0,forced:!(!h&&!v&&(n=a(String.prototype,"endsWith"),n&&!n.writable)||v)},{endsWith:function(e){var t=c(u(this));l(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:m(s(r),n),o=c(e);return p?p(t,o,i):f(t,i-o.length,i)===o}})},8291:(e,t,r)=>{var n=r(6566),i=r(1008),o=r(495),a=r(9286),s=r(2255),c=r(6412),l=i("".indexOf);n({target:"String",proto:!0,forced:!c("includes")},{includes:function(e){return!!~l(s(a(this)),s(o(e)),arguments.length>1?arguments[1]:void 0)}})},9964:(e,t,r)=>{var n=r(6566),i=r(613).start;n({target:"String",proto:!0,forced:r(4567)},{padStart:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},8304:(e,t,r)=>{var n=r(1881),i=r(2957),o=r(1008),a=r(1644),s=r(4543),c=r(151),l=r(6357),u=r(3445),d=r(4827),h=r(5966),p=r(2255),f=r(9286),m=r(7157),v=r(6046),g=r(9070),y=r(6010),E=r(3683)("replace"),b=Math.max,_=Math.min,C=o([].concat),S=o([].push),I=o("".indexOf),O=o("".slice),w="$0"==="a".replace(/./,"$0"),A=!!/./[E]&&""===/./[E]("a","$0");a("replace",(function(e,t,r){var o=A?"$":"$0";return[function(e,r){var n=f(this),o=u(e)?void 0:v(e,E);return o?i(o,e,n,r):i(t,p(n),e,r)},function(e,i){var a=c(this),s=p(e);if("string"==typeof i&&-1===I(i,o)&&-1===I(i,"$<")){var u=r(t,a,s,i);if(u.done)return u.value}var f=l(i);f||(i=p(i));var v,E=a.global;E&&(v=a.unicode,a.lastIndex=0);for(var w,A=[];null!==(w=y(a,s))&&(S(A,w),E);)""===p(w[0])&&(a.lastIndex=m(s,h(a.lastIndex),v));for(var T,P="",N=0,D=0;D<A.length;D++){for(var R,L=p((w=A[D])[0]),x=b(_(d(w.index),s.length),0),k=[],M=1;M<w.length;M++)S(k,void 0===(T=w[M])?T:String(T));var j=w.groups;if(f){var U=C([L],k,x,s);void 0!==j&&S(U,j),R=p(n(i,void 0,U))}else R=g(L,s,x,k,j,i);x>=N&&(P+=O(s,N,x)+R,N=x+L.length)}return P+O(s,N)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!w||A)},488:(e,t,r)=>{var n=r(1881),i=r(2957),o=r(1008),a=r(1644),s=r(151),c=r(3445),l=r(2388),u=r(9286),d=r(8581),h=r(7157),p=r(5966),f=r(2255),m=r(6046),v=r(231),g=r(6010),y=r(8779),E=r(9933),b=r(4543),_=E.UNSUPPORTED_Y,C=4294967295,S=Math.min,I=[].push,O=o(/./.exec),w=o(I),A=o("".slice);a("split",(function(e,t,r){var o;return o="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var o=f(u(this)),a=void 0===r?C:r>>>0;if(0===a)return[];if(void 0===e)return[o];if(!l(e))return i(t,o,e,a);for(var s,c,d,h=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),m=0,g=new RegExp(e.source,p+"g");(s=i(y,g,o))&&!((c=g.lastIndex)>m&&(w(h,A(o,m,s.index)),s.length>1&&s.index<o.length&&n(I,h,v(s,1)),d=s[0].length,m=c,h.length>=a));)g.lastIndex===s.index&&g.lastIndex++;return m===o.length?!d&&O(g,"")||w(h,""):w(h,A(o,m)),h.length>a?v(h,0,a):h}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:i(t,this,e,r)}:t,[function(t,r){var n=u(this),a=c(t)?void 0:m(t,e);return a?i(a,t,n,r):i(o,f(n),t,r)},function(e,n){var i=s(this),a=f(e),c=r(o,i,a,n,o!==t);if(c.done)return c.value;var l=d(i,RegExp),u=i.unicode,m=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(_?"g":"y"),v=new l(_?"^(?:"+i.source+")":i,m),y=void 0===n?C:n>>>0;if(0===y)return[];if(0===a.length)return null===g(v,a)?[a]:[];for(var E=0,b=0,I=[];b<a.length;){v.lastIndex=_?0:b;var O,T=g(v,_?A(a,b):a);if(null===T||(O=S(p(v.lastIndex+(_?b:0)),a.length))===E)b=h(a,b,u);else{if(w(I,A(a,E,b)),I.length===y)return I;for(var P=1;P<=T.length-1;P++)if(w(I,T[P]),I.length===y)return I;b=E=O}}return w(I,A(a,E)),I}]}),!!b((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),_)},7680:(e,t,r)=>{var n,i=r(6566),o=r(1316),a=r(9763).f,s=r(5966),c=r(2255),l=r(495),u=r(9286),d=r(6412),h=r(7051),p=o("".startsWith),f=o("".slice),m=Math.min,v=d("startsWith");i({target:"String",proto:!0,forced:!(!h&&!v&&(n=a(String.prototype,"startsWith"),n&&!n.writable)||v)},{startsWith:function(e){var t=c(u(this));l(e);var r=s(m(arguments.length>1?arguments[1]:void 0,t.length)),n=c(e);return p?p(t,n,r):f(t,r,r+n.length)===n}})},9098:(e,t,r)=>{var n=r(6566),i=r(8906).trim;n({target:"String",proto:!0,forced:r(82)("trim")},{trim:function(){return i(this)}})},9399:(e,t,r)=>{var n=r(6566),i=r(5180),o=r(4523),a=r(1008),s=r(5889),c=r(6357),l=r(5161),u=r(2255),d=r(3642),h=r(812),p=o.Symbol,f=p&&p.prototype;if(i&&c(p)&&(!("description"in f)||void 0!==p().description)){var m={},v=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:u(arguments[0]),t=l(f,this)?new p(e):void 0===e?p():p(e);return""===e&&(m[t]=!0),t};h(v,p),v.prototype=f,f.constructor=v;var g="Symbol(description detection)"===String(p("description detection")),y=a(f.valueOf),E=a(f.toString),b=/^Symbol\((.*)\)[^)]+$/,_=a("".replace),C=a("".slice);d(f,"description",{configurable:!0,get:function(){var e=y(this);if(s(m,e))return"";var t=E(e),r=g?C(t,7,-1):_(t,b,"$1");return""===r?void 0:r}}),n({global:!0,constructor:!0,forced:!0},{Symbol:v})}},7250:(e,t,r)=>{var n,i=r(5240),o=r(4523),a=r(1008),s=r(6519),c=r(8907),l=r(196),u=r(8137),d=r(1634),h=r(4317).enforce,p=r(4543),f=r(158),m=Object,v=Array.isArray,g=m.isExtensible,y=m.isFrozen,E=m.isSealed,b=m.freeze,_=m.seal,C={},S={},I=!o.ActiveXObject&&"ActiveXObject"in o,O=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},w=l("WeakMap",O,u),A=w.prototype,T=a(A.set);if(f)if(I){n=u.getConstructor(O,"WeakMap",!0),c.enable();var P=a(A.delete),N=a(A.has),D=a(A.get);s(A,{delete:function(e){if(d(e)&&!g(e)){var t=h(this);return t.frozen||(t.frozen=new n),P(this,e)||t.frozen.delete(e)}return P(this,e)},has:function(e){if(d(e)&&!g(e)){var t=h(this);return t.frozen||(t.frozen=new n),N(this,e)||t.frozen.has(e)}return N(this,e)},get:function(e){if(d(e)&&!g(e)){var t=h(this);return t.frozen||(t.frozen=new n),N(this,e)?D(this,e):t.frozen.get(e)}return D(this,e)},set:function(e,t){if(d(e)&&!g(e)){var r=h(this);r.frozen||(r.frozen=new n),N(this,e)?T(this,e,t):r.frozen.set(e,t)}else T(this,e,t);return this}})}else i&&p((function(){var e=b([]);return T(new w,e,1),!y(e)}))&&s(A,{set:function(e,t){var r;return v(e)&&(y(e)?r=C:E(e)&&(r=S)),T(this,e,t),r===C&&b(e),r===S&&_(e),this}})},5372:(e,t,r)=>{r(7250)},2892:(e,t,r)=>{var n=r(4523),i=r(792),o=r(832),a=r(3371),s=r(6587),c=function(e){if(e&&e.forEach!==a)try{s(e,"forEach",a)}catch(t){e.forEach=a}};for(var l in i)i[l]&&c(n[l]&&n[l].prototype);c(o)},5993:(e,t,r)=>{var n=r(4523),i=r(792),o=r(832),a=r(6656),s=r(6587),c=r(3683),l=c("iterator"),u=c("toStringTag"),d=a.values,h=function(e,t){if(e){if(e[l]!==d)try{s(e,l,d)}catch(t){e[l]=d}if(e[u]||s(e,u,t),i[t])for(var r in a)if(e[r]!==a[r])try{s(e,r,a[r])}catch(t){e[r]=a[r]}}};for(var p in i)h(n[p]&&n[p].prototype,p);h(o,"DOMTokenList")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(9399),r(6656),r(2221),r(3831),r(4237),r(5993),r(935),r(8291),r(2892);var n=/android/i;function i(){var e=window.navigator.userAgent;return!!e&&Boolean((e.includes("Safari")&&(e.includes("iPhone")||e.includes("iPad"))&&!e.includes("Trident")||e.includes("AppleWebKit")&&!(e.includes("Android")||e.includes("Linux")||e.includes("Trident"))&&(e.includes("Mobile")||e.includes("iPhone")||e.includes("iPad"))&&!e.includes("Macintosh")&&!e.includes("Windows"))&&!(e.includes("Chrome")||e.includes("CriOS")||e.includes("Edg")))}function o(){var e=window.navigator.userAgent;return!!e&&Boolean((e.includes("Safari")||e.includes("AppleWebKit"))&&(e.includes("Macintosh")||e.includes("Windows"))&&!e.includes("iPhone")&&!e.includes("iPad")&&!e.includes("Chrome")&&!e.includes("Edg")&&!e.includes("Firefox"))}var a={get documentBody(){return window.document.body},get documentReferrer(){return window.document.referrer},get documentVisibilityState(){return document.visibilityState},getQueryParams:function(e,t){var r=new URL(e),n={};return t.forEach((e=>{var t=r.searchParams.get(e);null!==t&&(n[e]=t)})),n},isAndroid:function(){return n.test(window.navigator.userAgent)},isDesktopSafari:o,isMobileSafari:i,isSafari:function(){return i()||o()},get isSecureContext(){return window.isSecureContext},isSupported:function(){return void 0!==window.postMessage&&void 0!==window.fetch&&void 0!==document.createElement("a").classList},get isTopLevelWindow(){return window.parent===window},get supportsCryptoDigest(){var e;return void 0!==(null===(e=crypto.subtle)||void 0===e?void 0:e.digest)},get supportsDocumentVisibilityState(){return void 0!==document.visibilityState},get supportsPerformanceEntries(){return"performance"in window&&"function"==typeof window.performance.getEntriesByType},get supportsSendBeacon(){return"function"==typeof window.navigator.sendBeacon},get windowInnerHeight(){return window.innerHeight},get windowInnerWidth(){return window.innerWidth},get windowLocation(){return window.location},get windowNavigationBeacon(){return(e,t)=>window.navigator.sendBeacon(e,t)},get windowNavigatorLanguages(){var e=window.navigator,t=e.language,r=e.languages;return Array.isArray(r)?t&&t!==r[0]?[t,...r]:r:t?[t]:["en-US"]},get windowParentLocation(){return window.parent.location},get windowPerformance(){return window.performance}};const s="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function c(e){return e&&e.Math==Math?e:void 0}const l="object"==typeof globalThis&&c(globalThis)||"object"==typeof window&&c(window)||"object"==typeof self&&c(self)||"object"==typeof r.g&&c(r.g)||function(){return this}()||{};function u(){return l}function d(e,t,r){const n=r||l,i=n.__SENTRY__=n.__SENTRY__||{};return i[e]||(i[e]=t())}const h=["debug","info","warn","error","log","assert","trace"],p={};function f(e){if(!("console"in l))return e();const t=l.console,r={},n=Object.keys(p);n.forEach((e=>{const n=p[e];r[e]=t[e],t[e]=n}));try{return e()}finally{n.forEach((e=>{t[e]=r[e]}))}}const m=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return s?h.forEach((r=>{t[r]=(...t)=>{e&&f((()=>{l.console[r](`Sentry Logger [${r}]:`,...t)}))}})):h.forEach((e=>{t[e]=()=>{}})),t}(),v=Object.prototype.toString;function g(e){switch(v.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return A(e,Error)}}function y(e,t){return v.call(e)===`[object ${t}]`}function E(e){return y(e,"ErrorEvent")}function b(e){return y(e,"DOMError")}function _(e){return y(e,"String")}function C(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function S(e){return null===e||C(e)||"object"!=typeof e&&"function"!=typeof e}function I(e){return y(e,"Object")}function O(e){return"undefined"!=typeof Event&&A(e,Event)}function w(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function A(e,t){try{return e instanceof t}catch(e){return!1}}const T=u();function P(e,t){const r=e,n=[];let i,o,a,s,c;if(!r||!r.tagName)return"";if(T.HTMLElement&&r instanceof HTMLElement&&r.dataset&&r.dataset.sentryComponent)return r.dataset.sentryComponent;n.push(r.tagName.toLowerCase());const l=t&&t.length?t.filter((e=>r.getAttribute(e))).map((e=>[e,r.getAttribute(e)])):null;if(l&&l.length)l.forEach((e=>{n.push(`[${e[0]}="${e[1]}"]`)}));else if(r.id&&n.push(`#${r.id}`),i=r.className,i&&_(i))for(o=i.split(/\s+/),c=0;c<o.length;c++)n.push(`.${o[c]}`);const u=["aria-label","type","name","title","alt"];for(c=0;c<u.length;c++)a=u[c],s=r.getAttribute(a),s&&n.push(`[${a}="${s}"]`);return n.join("")}function N(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function D(e,t=[],r=!1){return t.some((t=>function(e,t,r=!1){return!!_(e)&&(y(t,"RegExp")?t.test(e):!!_(t)&&(r?e===t:e.includes(t)))}(e,t,r)))}function R(e){if(g(e))return{message:e.message,name:e.name,stack:e.stack,...x(e)};if(O(e)){const t={type:e.type,target:L(e.target),currentTarget:L(e.currentTarget),...x(e)};return"undefined"!=typeof CustomEvent&&A(e,CustomEvent)&&(t.detail=e.detail),t}return e}function L(e){try{return"undefined"!=typeof Element&&A(e,Element)?function(e,t={}){if(!e)return"<unknown>";try{let r=e;const n=5,i=[];let o=0,a=0;const s=" > ",c=s.length;let l;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;r&&o++<n&&(l=P(r,u),!("html"===l||o>1&&a+i.length*c+l.length>=d));)i.push(l),a+=l.length,r=r.parentNode;return i.reverse().join(s)}catch(e){return"<unknown>"}}(e):Object.prototype.toString.call(e)}catch(e){return"<unknown>"}}function x(e){if("object"==typeof e&&null!==e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}return{}}function k(e){return M(e,new Map)}function M(e,t){if(function(e){if(!I(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch(e){return!0}}(e)){const r=t.get(e);if(void 0!==r)return r;const n={};t.set(e,n);for(const r of Object.keys(e))void 0!==e[r]&&(n[r]=M(e[r],t));return n}if(Array.isArray(e)){const r=t.get(e);if(void 0!==r)return r;const n=[];return t.set(e,n),e.forEach((e=>{n.push(M(e,t))})),n}return e}function j(){const e=l,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(e){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^(15&r())>>e/4).toString(16)))}function U(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function B(e){const{message:t,event_id:r}=e;if(t)return t;const n=U(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function q(e,t,r){const n=e.exception=e.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type=r||"Error")}function H(e,t){const r=U(e);if(!r)return;const n=r.mechanism;if(r.mechanism={type:"generic",handled:!0,...n,...t},t&&"data"in t){const e={...n&&n.data,...t.data};r.mechanism.data=e}}function F(e){if(e&&e.__sentry_captured__)return!0;try{!function(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch(r){s&&m.log(`Failed to add non-enumerable property "${t}" to object`,e)}}(e,"__sentry_captured__",!0)}catch(e){}return!1}const V="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;var G;function z(e){return new Y((t=>{t(e)}))}function $(e){return new Y(((t,r)=>{r(e)}))}!function(e){e[e.PENDING=0]="PENDING",e[e.RESOLVED=1]="RESOLVED",e[e.REJECTED=2]="REJECTED"}(G||(G={}));class Y{constructor(e){Y.prototype.__init.call(this),Y.prototype.__init2.call(this),Y.prototype.__init3.call(this),Y.prototype.__init4.call(this),this._state=G.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new Y(((r,n)=>{this._handlers.push([!1,t=>{if(e)try{r(e(t))}catch(e){n(e)}else r(t)},e=>{if(t)try{r(t(e))}catch(e){n(e)}else n(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new Y(((t,r)=>{let n,i;return this.then((t=>{i=!1,n=t,e&&e()}),(t=>{i=!0,n=t,e&&e()})).then((()=>{i?r(n):t(n)}))}))}__init(){this._resolve=e=>{this._setResult(G.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(G.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{this._state===G.PENDING&&(w(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===G.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===G.RESOLVED&&e[1](this._value),this._state===G.REJECTED&&e[2](this._value),e[0]=!0)}))}}}function W(){return d("globalEventProcessors",(()=>[]))}function K(e){W().push(e)}function Z(e,t,r,n=0){return new Y(((i,o)=>{const a=e[n];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},r);V&&a.id&&null===s&&m.log(`Event processor "${a.id}" dropped event`),w(s)?s.then((t=>Z(e,t,r,n+1).then(i))).then(null,o):Z(e,s,r,n+1).then(i).then(null,o)}}))}function J(){return Date.now()/1e3}const X=function(){const{performance:e}=l;if(!e||!e.now)return J;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/1e3}();let Q;(()=>{const{performance:e}=l;if(!e||!e.now)return void(Q="none");const t=36e5,r=e.now(),n=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,o=i<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+r-n):t;o||s<t?i<=s?(Q="timeOrigin",e.timeOrigin):Q="navigationStart":Q="dateNow"})();const ee="production";function te(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||X(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:j()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function re(e,t){return Ce().captureEvent(e,t)}function ne(){return Ce().getClient()}function ie(){return Ce().getScope()}function oe(e){return e.transaction}function ae(e){const{spanId:t,traceId:r}=e.spanContext(),{data:n,op:i,parent_span_id:o,status:a,tags:s,origin:c}=se(e);return k({data:n,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:r,origin:c})}function se(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function ce(e,t,r){const n=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=r&&r.getUser()||{},a=k({environment:n.environment||ee,release:n.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function le(e){const t=ne();if(!t)return{};const r=ce(se(e).trace_id||"",t,ie()),n=oe(e);if(!n)return r;const i=n&&n._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:a}=n.metadata;null!=o&&(r.sample_rate=`${o}`);const s=se(n);return a&&"url"!==a&&(r.transaction=s.description),r.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return Boolean(1&t)}(n)),t.emit&&t.emit("createDsc",r),r}function ue(e,t){const{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,transactionName:s}=t,c=k(r);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});const l=k(n);l&&Object.keys(l).length&&(e.tags={...l,...e.tags});const u=k(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const d=k(o);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),a&&(e.level=a),s&&(e.transaction=s)}(e,t),n&&function(e,t){e.contexts={trace:ae(t),...e.contexts};const r=oe(t);if(r){e.sdkProcessingMetadata={dynamicSamplingContext:le(t),...e.sdkProcessingMetadata};const n=se(r).description;n&&(e.tags={transaction:n,...e.tags})}}(e,n),function(e,t){var r;e.fingerprint=e.fingerprint?(r=e.fingerprint,Array.isArray(r)?r:[r]):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,r),function(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}function de(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:h,transactionName:p,span:f}=t;he(e,"extra",r),he(e,"tags",n),he(e,"user",i),he(e,"contexts",o),he(e,"sdkProcessingMetadata",s),a&&(e.level=a),p&&(e.transactionName=p),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function he(e,t,r){if(r&&Object.keys(r).length){e[t]={...e[t]};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[t][n]=r[n])}}let pe;class fe{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=me()}static clone(e){return e?e.clone():new fe}clone(){const e=new fe;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&te(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e;if(t instanceof fe){const e=t.getScopeData();this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&Object.keys(e.user).length&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint.length&&(this._fingerprint=e.fingerprint),t.getRequestSession()&&(this._requestSession=t.getRequestSession()),e.propagationContext&&(this._propagationContext=e.propagationContext)}else if(I(t)){const t=e;this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession),t.propagationContext&&(this._propagationContext=t.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=me(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:100;if(r<=0)return this;const n={timestamp:J(),...e},i=this._breadcrumbs;return i.push(n),this._breadcrumbs=i.length>r?i.slice(-r):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:t,_contexts:r,_tags:n,_extra:i,_user:o,_level:a,_fingerprint:s,_eventProcessors:c,_propagationContext:l,_sdkProcessingMetadata:u,_transactionName:d,_span:h}=this;return{breadcrumbs:e,attachments:t,contexts:r,tags:n,extra:i,user:o,level:a,fingerprint:s||[],eventProcessors:c,propagationContext:l,sdkProcessingMetadata:u,transactionName:d,span:h}}applyToEvent(e,t={},r=[]){return ue(e,this.getScopeData()),Z([...r,...W(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:j();if(!this._client)return m.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:j();if(!this._client)return m.warn("No client configured on scope - will not capture message!"),n;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:j();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(m.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}function me(){return{traceId:j(),spanId:j().substring(16)}}const ve="7.120.4",ge=parseFloat(ve),ye=100;class Ee{constructor(e,t,r,n=ge){let i,o;this._version=n,t?i=t:(i=new fe,i.setClient(e)),r?o=r:(o=new fe,o.setClient(e)),this._stack=[{scope:i}],e&&this.bindClient(e),this._isolationScope=o}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1||!this.getStack().pop())}withScope(e){const t=this.pushScope();let r;try{r=e(t)}catch(e){throw this.popScope(),e}return w(r)?r.then((e=>(this.popScope(),e)),(e=>{throw this.popScope(),e})):(this.popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){const r=this._lastEventId=t&&t.event_id?t.event_id:j(),n=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:n,...t,event_id:r}),r}captureMessage(e,t,r){const n=this._lastEventId=r&&r.event_id?r.event_id:j(),i=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n}),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:j();return e.type||(this._lastEventId=r),this.getScope().captureEvent(e,{...t,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:r,client:n}=this.getStackTop();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=ye}=n.getOptions&&n.getOptions()||{};if(o<=0)return;const a={timestamp:J(),...e},s=i?f((()=>i(a,t))):a;null!==s&&(n.emit&&n.emit("beforeAddBreadcrumb",s,t),r.addBreadcrumb(s,o))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){const{scope:t,client:r}=this.getStackTop();r&&e(t)}run(e){const t=_e(this);try{e(this)}finally{_e(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return V&&m.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const r=this._callExtensionMethod("startTransaction",e,t);return V&&!r&&(this.getClient()?m.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):m.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const e=this.getStackTop().scope,t=e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),te(e,t)}(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:r}=this.getStackTop(),{release:n,environment:i=ee}=r&&r.getOptions()||{},{userAgent:o}=l.navigator||{},a=function(e){const t=X(),r={sid:j(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return k({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(r)};return e&&te(r,e),r}({release:n,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&te(s,{status:"exited"}),this.endSession(),t.setSession(a),a}shouldSendDefaultPii(){const e=this.getClient(),t=e&&e.getOptions();return Boolean(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop(),r=e.getSession();r&&t&&t.captureSession&&t.captureSession(r)}_callExtensionMethod(e,...t){const r=be().__SENTRY__;if(r&&r.extensions&&"function"==typeof r.extensions[e])return r.extensions[e].apply(this,t);V&&m.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function be(){return l.__SENTRY__=l.__SENTRY__||{extensions:{},hub:void 0},l}function _e(e){const t=be(),r=Se(t);return Ie(t,e),r}function Ce(){const e=be();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=be()){return t=e,!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)&&!Se(e).isOlderThan(ge)||Ie(e,new Ee),Se(e);var t}(e)}function Se(e){return d("hub",(()=>new Ee),e)}function Ie(e,t){return!!e&&((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0)}const Oe=[];function we(e,t){for(const r of t)r&&r.afterAllSetup&&r.afterAllSetup(e)}function Ae(e,t,r){if(r[t.name])V&&m.log(`Integration skipped because it was already installed: ${t.name}`);else{if(r[t.name]=t,-1===Oe.indexOf(t.name)&&(t.setupOnce(K,Ce),Oe.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,n)=>r(t,n,e)))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const r=t.processEvent.bind(t),n=(t,n)=>r(t,n,e);n.id=t.name,e.addEventProcessor(n)}V&&m.log(`Integration installed: ${t.name}`)}}function Te(e,t){const r=function(...e){return t(...e)};return r.id=e,r}const Pe=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],Ne=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],De="InboundFilters",Re=(e={})=>({name:De,setupOnce(){},processEvent(t,r,n){const i=n.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Pe],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:Ne],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,i);return function(e,t){return t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1}(e)?(V&&m.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${B(e)}`),!0):function(e,t){return!(e.type||!t||!t.length)&&function(e){const t=[];let r;e.message&&t.push(e.message);try{r=e.exception.values[e.exception.values.length-1]}catch(e){}return r&&r.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`)),V&&0===t.length&&m.error(`Could not extract message for event ${B(e)}`),t}(e).some((e=>D(e,t)))}(e,t.ignoreErrors)?(V&&m.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${B(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const r=e.transaction;return!!r&&D(r,t)}(e,t.ignoreTransactions)?(V&&m.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${B(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const r=Le(e);return!!r&&D(r,t)}(e,t.denyUrls)?(V&&m.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${B(e)}.\nUrl: ${Le(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const r=Le(e);return!r||D(r,t)}(e,t.allowUrls)&&(V&&m.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${B(e)}.\nUrl: ${Le(e)}`),!0)}(t,o)?null:t}});function Le(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch(e){}return t?function(e=[]){for(let t=e.length-1;t>=0;t--){const r=e[t];if(r&&"<anonymous>"!==r.filename&&"[native code]"!==r.filename)return r.filename||null}return null}(t):null}catch(t){return V&&m.error(`Cannot extract url for event ${B(e)}`),null}}let xe;Te(De,Re);const ke="FunctionToString",Me=new WeakMap,je=()=>({name:ke,setupOnce(){xe=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=this.__sentry_original__,r=Me.has(ne())&&void 0!==t?t:this;return xe.apply(r,e)}}catch(e){}},setup(e){Me.set(e,!0)}});Te(ke,je);const Ue=/\(error: (.*)\)/,Be=/captureMessage|captureException/;const qe="<anonymous>";function He(e){try{return e&&"function"==typeof e&&e.name||qe}catch(e){return qe}}const Fe={},Ve={};function Ge(e,t){Fe[e]=Fe[e]||[],Fe[e].push(t)}function ze(e,t){Ve[e]||(t(),Ve[e]=!0)}function $e(e,t){const r=e&&Fe[e];if(r)for(const n of r)try{n(t)}catch(t){s&&m.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${He(n)}\nError:`,t)}}let Ye=null;function We(){Ye=l.onerror,l.onerror=function(e,t,r,n,i){return $e("error",{column:n,error:i,line:r,msg:e,url:t}),!(!Ye||Ye.__SENTRY_LOADER__)&&Ye.apply(this,arguments)},l.onerror.__SENTRY_INSTRUMENTED__=!0}let Ke=null;function Ze(){Ke=l.onunhandledrejection,l.onunhandledrejection=function(e){return $e("unhandledrejection",e),!(Ke&&!Ke.__SENTRY_LOADER__)||Ke.apply(this,arguments)},l.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Je="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function Xe(e,t=100,r=1/0){try{return et("",e,t,r)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Qe(e,t=3,r=102400){const n=Xe(e,t);return i=n,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>r?Qe(e,t-1,r):n;var i}function et(e,t,n=1/0,i=1/0,o=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(r){if(e)return!!t.has(r)||(t.add(r),!1);for(let e=0;e<t.length;e++)if(t[e]===r)return!0;return t.push(r),!1},function(r){if(e)t.delete(r);else for(let e=0;e<t.length;e++)if(t[e]===r){t.splice(e,1);break}}]}()){const[a,s]=o;if(null==t||["number","boolean","string"].includes(typeof t)&&("number"!=typeof(c=t)||c==c))return t;var c;const l=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if(void 0!==r.g&&t===r.g)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(function(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}(t))return"[VueViewModel]";if(function(e){return I(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}(t))return"[SyntheticEvent]";if("number"==typeof t&&t!=t)return"[NaN]";if("function"==typeof t)return`[Function: ${He(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const n=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}(e,t);if(!l.startsWith("[object "))return l;if(t.__sentry_skip_normalization__)return t;const u="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===u)return l.replace("object ","");if(a(t))return"[Circular ~]";const d=t;if(d&&"function"==typeof d.toJSON)try{return et("",d.toJSON(),u-1,i,o)}catch(e){}const h=Array.isArray(t)?[]:{};let p=0;const f=R(t);for(const e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(p>=i){h[e]="[MaxProperties ~]";break}const t=f[e];h[e]=et(e,t,u-1,i,o),p++}return s(t),h}function tt(e,t){const r=nt(e,t),n={type:t&&t.name,value:ot(t)};return r.length&&(n.stacktrace={frames:r}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function rt(e,t){return{exception:{values:[tt(e,t)]}}}function nt(e,t){const r=t.stacktrace||t.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(it.test(e.message))return 1}return 0}(t);try{return e(r,n)}catch(e){}return[]}const it=/Minified React error #\d+;/i;function ot(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function at(e,t,r,n,i){let o;if(E(t)&&t.error)return rt(e,t.error);if(b(t)||y(t,"DOMException")){const i=t;if("stack"in t)o=rt(e,t);else{const t=i.name||(b(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=st(e,a,r,n),q(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return g(t)?rt(e,t):I(t)||O(t)?(o=function(e,t,r,n){const i=ne(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:O(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:ct(t,{isUnhandledRejection:n})}]},extra:{__serialized__:Qe(t,o)}};if(r){const t=nt(e,r);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,r,i),H(o,{synthetic:!0}),o):(o=st(e,t,r,n),q(o,`${t}`,void 0),H(o,{synthetic:!0}),o)}function st(e,t,r,n){const i={};if(n&&r){const n=nt(e,r);n.length&&(i.exception={values:[{value:t,stacktrace:{frames:n}}]})}if(C(t)){const{__sentry_template_string__:e,__sentry_template_values__:r}=t;return i.logentry={message:e,params:r},i}return i.message=t,i}function ct(e,{isUnhandledRejection:t}){const r=function(e,t=40){const r=Object.keys(R(e));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=t)return N(r[0],t);for(let e=r.length;e>0;e--){const n=r.slice(0,e).join(", ");if(!(n.length>t))return e===r.length?n:N(n,t)}return""}(e),n=t?"promise rejection":"exception";return E(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:O(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){}}(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}const lt=l;const ut="GlobalHandlers",dt=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:ut,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";Ge(t,(t=>{const{stackParser:r,attachStacktrace:n}=ft();if(ne()!==e)return;const{msg:i,url:o,line:a,column:s,error:c}=t,l=void 0===c&&_(i)?function(e,t,r,n){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=E(e)?e.message:e,a="Error";const s=o.match(i);s&&(a=s[1],o=s[2]);return ht({exception:{values:[{type:a,value:o}]}},t,r,n)}(i,o,a,s):ht(at(r,c||i,void 0,n,!1),o,a,s);l.level="error",re(l,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})),ze(t,We)}()}(e),pt("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";Ge(t,(t=>{const{stackParser:r,attachStacktrace:n}=ft();if(ne()!==e)return;const i=function(e){if(S(e))return e;const t=e;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(e){}return e}(t),o=S(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:at(r,i,void 0,n,!0);o.level="error",re(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})),ze(t,Ze)}()}(e),pt("onunhandledrejection"))}}};function ht(e,t,r,n){const i=e.exception=e.exception||{},o=i.values=i.values||[],a=o[0]=o[0]||{},s=a.stacktrace=a.stacktrace||{},c=s.frames=s.frames||[],l=isNaN(parseInt(n,10))?void 0:n,u=isNaN(parseInt(r,10))?void 0:r,d=_(t)&&t.length>0?t:function(){try{return T.document.location.href}catch(e){return""}}();return 0===c.length&&c.push({colno:l,filename:d,function:"?",in_app:!0,lineno:u}),e}function pt(e){Je&&m.log(`Global Handler attached: ${e}`)}function ft(){const e=ne();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function mt(e,t,r=250,n,i,o,a){if(!(o.exception&&o.exception.values&&a&&A(a.originalException,Error)))return;const s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var c,l;s&&(o.exception.values=(c=vt(e,t,i,a.originalException,n,o.exception.values,s,0),l=r,c.map((e=>(e.value&&(e.value=N(e.value,l)),e)))))}function vt(e,t,r,n,i,o,a,s){if(o.length>=r+1)return o;let c=[...o];if(A(n[i],Error)){gt(a,s);const o=e(t,n[i]),l=c.length;yt(o,i,l,s),c=vt(e,t,r,n[i],i,[o,...c],o,l)}return Array.isArray(n.errors)&&n.errors.forEach(((n,o)=>{if(A(n,Error)){gt(a,s);const l=e(t,n),u=c.length;yt(l,`errors[${o}]`,u,s),c=vt(e,t,r,n,i,[l,...c],l,u)}})),c}function gt(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function yt(e,t,r,n){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}Te(ut,dt);const Et="LinkedErrors",bt=(e={})=>{const t=e.limit||5,r=e.key||"cause";return{name:Et,setupOnce(){},preprocessEvent(e,n,i){const o=i.getOptions();mt(tt,o.stackParser,o.maxValueLength,r,t,e,n)}}},_t=(Te(Et,bt),"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__),Ct="Dedupe",St=()=>{let e;return{name:Ct,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const r=e.message,n=t.message;return!(!r&&!n)&&(!(r&&!n||!r&&n)&&(r===n&&(!!Ot(e,t)&&!!It(e,t))))}(e,t)||!!function(e,t){const r=wt(t),n=wt(e);return!(!r||!n)&&(r.type===n.type&&r.value===n.value&&(!!Ot(e,t)&&!!It(e,t)))}(e,t))}(t,e))return _t&&m.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return e=t}}};function It(e,t){let r=At(e),n=At(t);if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e],i=r[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Ot(e,t){let r=e.fingerprint,n=t.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;try{return!(r.join("")!==n.join(""))}catch(e){return!1}}function wt(e){return e.exception&&e.exception.values&&e.exception.values[0]}function At(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(e){return}}Te(Ct,St);const Tt="HttpContext",Pt=()=>({name:Tt,setupOnce(){},preprocessEvent(e){if(!lt.navigator&&!lt.location&&!lt.document)return;const t=e.request&&e.request.url||lt.location&&lt.location.href,{referrer:r}=lt.document||{},{userAgent:n}=lt.navigator||{},i={...e.request&&e.request.headers,...r&&{Referer:r},...n&&{"User-Agent":n}},o={...e.request,...t&&{url:t},headers:i};e.request=o}}),Nt=(Te(Tt,Pt),"?");function Dt(e,t,r,n){const i={filename:e,function:t,in_app:!0};return void 0!==r&&(i.lineno=r),void 0!==n&&(i.colno=n),i}const Rt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Lt=/\((\S*)(?::(\d+))(?::(\d+))\)/,xt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Mt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,jt=function(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,r=0)=>{const n=[],i=e.split("\n");for(let e=r;e<i.length;e++){const r=i[e];if(r.length>1024)continue;const o=Ue.test(r)?r.replace(Ue,"$1"):r;if(!o.match(/\S*Error: /)){for(const e of t){const t=e(o);if(t){n.push(t);break}}if(n.length>=50)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),Be.test(t[t.length-1].function||"")&&(t.pop(),Be.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,50).map((e=>({...e,filename:e.filename||t[t.length-1].filename,function:e.function||"?"})))}(n)}}([30,e=>{const t=Rt.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=Lt.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,r]=Ut(t[1]||Nt,t[2]);return Dt(r,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,e=>{const t=xt.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=kt.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],r=t[1]||Nt;return[r,e]=Ut(r,e),Dt(e,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,e=>{const t=Mt.exec(e);return t?Dt(t[2],t[1]||Nt,+t[3],t[4]?+t[4]:void 0):void 0}]),Ut=(e,t)=>{const r=-1!==e.indexOf("safari-extension"),n=-1!==e.indexOf("safari-web-extension");return r||n?[-1!==e.indexOf("@")?e.split("@")[0]:Nt,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};class Bt extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}}const qt=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Ht(e,t=!1){const{host:r,path:n,pass:i,port:o,projectId:a,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n?`${n}/`:n}${a}`}function Ft(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Vt(e,t=[]){return[e,t]}function Gt(e,t){const[r,n]=e;return[r,[...n,t]]}function zt(e,t){const r=e[1];for(const e of r)if(t(e,e[0].type))return!0;return!1}function $t(e,t){return(t||new TextEncoder).encode(e)}function Yt(e,t){const[r,n]=e;let i=JSON.stringify(r);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[$t(i,t),e]:i.push("string"==typeof e?$t(e,t):e)}for(const e of n){const[t,r]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof r||r instanceof Uint8Array)o(r);else{let e;try{e=JSON.stringify(r)}catch(t){e=JSON.stringify(Xe(r))}o(e)}}return"string"==typeof i?i:function(e){const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(i)}function Wt(e,t){const r="string"==typeof e.data?$t(e.data,t):e.data;return[k({type:"attachment",length:r.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),r]}const Kt={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Zt(e){return Kt[e]}function Jt(e){if(!e||!e.sdk)return;const{name:t,version:r}=e.sdk;return{name:t,version:r}}function Xt(e,t,r=function(e){const t=[];function r(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(n){if(!(void 0===e||t.length<e))return $(new Bt("Not adding Promise because buffer limit was reached."));const i=n();return-1===t.indexOf(i)&&t.push(i),i.then((()=>r(i))).then(null,(()=>r(i).then(null,(()=>{})))),i},drain:function(e){return new Y(((r,n)=>{let i=t.length;if(!i)return r(!0);const o=setTimeout((()=>{e&&e>0&&r(!1)}),e);t.forEach((e=>{z(e).then((()=>{--i||(clearTimeout(o),r(!0))}),n)}))}))}}}(e.bufferSize||30)){let n={};function i(i){const o=[];if(zt(i,((t,r)=>{const i=Zt(r);if(function(e,t,r=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>r}(n,i)){const n=Qt(t,r);e.recordDroppedEvent("ratelimit_backoff",i,n)}else o.push(t)})),0===o.length)return z();const a=Vt(i[0],o),s=t=>{zt(a,((r,n)=>{const i=Qt(r,n);e.recordDroppedEvent(t,Zt(n),i)}))};return r.add((()=>t({body:Yt(a,e.textEncoder)}).then((e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&V&&m.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),n=function(e,{statusCode:t,headers:r},n=Date.now()){const i={...e},o=r&&r["x-sentry-rate-limits"],a=r&&r["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,r,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(r)for(const e of r.split(";"))"metric_bucket"===e&&o&&!o.split(";").includes("custom")||(i[e]=n+s);else i.all=n+s}else a?i.all=n+function(e,t=Date.now()){const r=parseInt(`${e}`,10);if(!isNaN(r))return 1e3*r;const n=Date.parse(`${e}`);return isNaN(n)?6e4:n-t}(a,n):429===t&&(i.all=n+6e4);return i}(n,e),e)),(e=>{throw s("network_error"),e})))).then((e=>e),(e=>{if(e instanceof Bt)return V&&m.error("Skipped sending event because buffer is full."),s("queue_overflow"),z();throw e}))}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>r.drain(e)}}function Qt(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}let er;function tr(e,t=function(){if(er)return er;if((e=lt.fetch)&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString()))return er=lt.fetch.bind(lt);var e;const t=lt.document;let r=lt.fetch;if(t&&"function"==typeof t.createElement)try{const e=t.createElement("iframe");e.hidden=!0,t.head.appendChild(e);const n=e.contentWindow;n&&n.fetch&&(r=n.fetch),t.head.removeChild(e)}catch(e){Je&&m.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return er=r.bind(lt)}()){let r=0,n=0;return Xt(e,(function(i){const o=i.body.length;r+=o,n++;const a={body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:r<=6e4&&n<15,...e.fetchOptions};try{return t(e.url,a).then((e=>(r-=o,n--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}})))}catch(e){return er=void 0,r-=o,n--,$(e)}}))}function rr(e,t={}){const r="string"==typeof t?t:t.tunnel,n="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return r||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${function(e,t){return r={sentry_key:e.publicKey,sentry_version:"7",...t&&{sentry_client:`${t.name}/${t.version}`}},Object.keys(r).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(r[e])}`)).join("&");var r}(e,n)}`}u();const nr=new WeakMap,ir="Not capturing exception because it's already been captured.";class or{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=function(e){const t="string"==typeof e?function(e){const t=qt.exec(e);if(!t)return void f((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[r,n,i="",o,a="",s]=t.slice(1);let c="",l=s;const u=l.split("/");if(u.length>1&&(c=u.slice(0,-1).join("/"),l=u.pop()),l){const e=l.match(/^\d+/);e&&(l=e[0])}return Ft({host:o,pass:i,path:c,projectId:l,port:a,protocol:r,publicKey:n})}(e):Ft(e);if(t&&function(e){if(!s)return!0;const{port:t,projectId:r,protocol:n}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(m.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(r.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(n)?t&&isNaN(parseInt(t,10))&&(m.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(m.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),1):(m.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),1)))}(t))return t}(e.dsn):V&&m.warn("No DSN provided, client will not send events."),this._dsn){const t=rr(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,r){if(F(e))return void(V&&m.log(ir));let n=t&&t.event_id;return this._process(this.eventFromException(e,t).then((e=>this._captureEvent(e,t,r))).then((e=>{n=e}))),n}captureMessage(e,t,r,n){let i=r&&r.event_id;const o=C(e)?e:String(e),a=S(e)?this.eventFromMessage(o,t,r):this.eventFromException(e,r);return this._process(a.then((e=>this._captureEvent(e,r,n))).then((e=>{i=e}))),i}captureEvent(e,t,r){if(t&&t.originalException&&F(t.originalException))return void(V&&m.log(ir));let n=t&&t.event_id;const i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||r).then((e=>{n=e}))),n}captureSession(e){"string"!=typeof e.release?V&&m.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),te(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then((r=>t.flush(e).then((e=>r&&e))))):z(!0)}close(e){return this.flush(e).then((e=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),e)))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch(t){return V&&m.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];Ae(this,e,this._integrations),t||we(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let r=function(e,t,r,n){const i=Jt(r),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]])}(e,r&&r.sdk);const a=function(e,t,r,n){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!r&&n&&{dsn:Ht(n)},...i&&{trace:k({...i})}}}(e,i,n,t);return delete e.sdkProcessingMetadata,Vt(a,[[{type:o},e]])}(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])r=Gt(r,Wt(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));const n=this._sendEnvelope(r);n&&n.then((t=>this.emit("afterSendEvent",e,t)),null)}sendSession(e){const t=function(e,t,r,n){const i=Jt(r);return Vt({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!n&&t&&{dsn:Ht(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,r){if(this._options.sendClientReports){const n="number"==typeof r?r:1,i=`${e}:${t}`;V&&m.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}captureAggregateMetrics(e){V&&m.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=function(e,t,r,n){const i={sent_at:(new Date).toISOString()};r&&r.sdk&&(i.sdk={name:r.sdk.name,version:r.sdk.version}),n&&t&&(i.dsn=Ht(t));const o=function(e){const t=function(e){let t="";for(const r of e){const e=Object.entries(r.tags),n=e.length>0?`|#${e.map((([e,t])=>`${e}:${t}`)).join(",")}`:"";t+=`${r.name}@${r.unit}:${r.metric}|${r.metricType}${n}|T${r.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return Vt(i,[o])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach((e=>e(...t)))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const r={};return t.forEach((t=>{t&&Ae(e,t,r)})),r}(this,e),we(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let r=!1,n=!1;const i=t.exception&&t.exception.values;if(i){n=!0;for(const e of i){const t=e.mechanism;if(t&&!1===t.handled){r=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&r)&&(te(e,{...r&&{status:"crashed"},errors:e.errors||Number(n||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Y((t=>{let r=0;const n=setInterval((()=>{0==this._numProcessing?(clearInterval(n),t(!0)):(r+=1,e&&r>=e&&(clearInterval(n),t(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,r,n=function(){return Ce().getIsolationScope()}()){const i=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),function(e,t,r,n,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||r.event_id||j(),timestamp:t.timestamp||J()},u=r.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:r,release:n,dist:i,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?r:ee),void 0===e.release&&void 0!==n&&(e.release=n),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=N(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=N(a.value,o));const s=e.request;s&&s.url&&(s.url=N(s.url,o))}(c,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(c,u),void 0===t.type&&function(e,t){const r=l._sentryDebugIds;if(!r)return;let n;const i=nr.get(t);i?n=i:(n=new Map,nr.set(t,n));const o=Object.keys(r).reduce(((e,i)=>{let o;const a=n.get(i);a?o=a:(o=t(i),n.set(i,o));for(let t=o.length-1;t>=0;t--){const n=o[t];if(n.filename){e[n.filename]=r[i];break}}return e}),{});try{e.exception.values.forEach((e=>{e.stacktrace.frames.forEach((e=>{e.filename&&(e.debug_id=o[e.filename])}))}))}catch(e){}}(c,e.stackParser);const d=function(e,t){if(!t)return e;const r=e?e.clone():new fe;return r.update(t),r}(n,r.captureContext);r.mechanism&&H(c,r.mechanism);const h=i&&i.getEventProcessors?i.getEventProcessors():[],p=(pe||(pe=new fe),pe).getScopeData();o&&de(p,o.getScopeData()),d&&de(p,d.getScopeData());const f=[...r.attachments||[],...p.attachments];return f.length&&(r.attachments=f),ue(c,p),Z([...h,...W(),...p.eventProcessors],c,r).then((e=>(e&&function(e){const t={};try{e.exception.values.forEach((e=>{e.stacktrace.frames.forEach((e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)}))}))}catch(e){}if(0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const r=e.debug_meta.images;Object.keys(t).forEach((e=>{r.push({type:"sourcemap",code_file:e,debug_id:t[e]})}))}(e),"number"==typeof a&&a>0?function(e,t,r){if(!e)return null;const n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map((e=>({...e,...e.data&&{data:Xe(e.data,t,r)}})))},...e.user&&{user:Xe(e.user,t,r)},...e.contexts&&{contexts:Xe(e.contexts,t,r)},...e.extra&&{extra:Xe(e.extra,t,r)}};return e.contexts&&e.contexts.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=Xe(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map((e=>{const n=se(e).data;return n&&(e.data=Xe(n,t,r)),e}))),n}(e,a,s):e)))}(i,e,t,r,this,n).then((e=>{if(null===e)return e;const t={...n.getPropagationContext(),...r?r.getPropagationContext():void 0};if((!e.contexts||!e.contexts.trace)&&t){const{traceId:n,spanId:i,parentSpanId:o,dsc:a}=t;e.contexts={trace:{trace_id:n,span_id:i,parent_span_id:o},...e.contexts};const s=a||ce(n,this,r);e.sdkProcessingMetadata={dynamicSamplingContext:s,...e.sdkProcessingMetadata}}return e}))}_captureEvent(e,t={},r){return this._processEvent(e,t,r).then((e=>e.event_id),(e=>{if(V){const t=e;"log"===t.logLevel?m.log(t.message):m.warn(t)}}))}_processEvent(e,t,r){const n=this.getOptions(),{sampleRate:i}=n,o=sr(e),a=ar(e),s=e.type||"error",c=`before send for type \`${s}\``;if(a&&"number"==typeof i&&Math.random()>i)return this.recordDroppedEvent("sample_rate","error",e),$(new Bt(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const l="replay_event"===s?"replay":s,u=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,r,u).then((r=>{if(null===r)throw this.recordDroppedEvent("event_processor",l,e),new Bt("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return r;const i=function(e,t,r){const{beforeSend:n,beforeSendTransaction:i}=e;if(ar(t)&&n)return n(t,r);if(sr(t)&&i){if(t.spans){const e=t.spans.length;t.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return i(t,r)}return t}(n,r,t);return function(e,t){const r=`${t} must return \`null\` or a valid event.`;if(w(e))return e.then((e=>{if(!I(e)&&null!==e)throw new Bt(r);return e}),(e=>{throw new Bt(`${t} rejected with ${e}`)}));if(!I(e)&&null!==e)throw new Bt(r);return e}(i,c)})).then((n=>{if(null===n){if(this.recordDroppedEvent("before_send",l,e),o){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw new Bt(`${c} returned \`null\`, will not send event.`,"log")}const i=r&&r.getSession();if(!o&&i&&this._updateSessionFromEvent(i,n),o){const e=(n.sdkProcessingMetadata&&n.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(n.spans?n.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const a=n.transaction_info;if(o&&a&&n.transaction!==e.transaction){const e="custom";n.transaction_info={...a,source:e}}return this.sendEvent(n,t),n})).then(null,(e=>{if(e instanceof Bt)throw e;throw this.captureException(e,{data:{__sentry__:!0},originalException:e}),new Bt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)}))}_process(e){this._numProcessing++,e.then((e=>(this._numProcessing--,e)),(e=>(this._numProcessing--,e)))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,(e=>{V&&m.error("Error while sending event:",e)}));V&&m.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map((t=>{const[r,n]=t.split(":");return{reason:r,category:n,quantity:e[t]}}))}}function ar(e){return void 0===e.type}function sr(e){return"transaction"===e.type}class cr extends or{constructor(e){!function(e,t,r=[t],n="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:r.map((e=>({name:`${n}:@sentry/${e}`,version:ve}))),version:ve}),e._metadata=i}(e,"browser",["browser"],lt.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&lt.document&&lt.document.addEventListener("visibilitychange",(()=>{"hidden"===lt.document.visibilityState&&this._flushOutcomes()}))}eventFromException(e,t){return function(e,t,r,n){const i=at(e,t,r&&r.syntheticException||void 0,n);return H(i),i.level="error",r&&r.event_id&&(i.event_id=r.event_id),z(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return function(e,t,r="info",n,i){const o=st(e,t,n&&n.syntheticException||void 0,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),z(o)}(this._options.stackParser,e,t,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(Je&&m.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:r,dsn:n}){const i={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!r&&!!n&&{dsn:Ht(n)}},o=function(e){return[{type:"user_report"},e]}(e);return Vt(i,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(Je&&m.log("No outcomes to send"));if(!this._dsn)return void(Je&&m.log("No dsn provided, will not send outcomes"));Je&&m.log("Sending outcomes:",e);const t=(r=e,Vt((n=this._options.tunnel&&Ht(this._dsn))?{dsn:n}:{},[[{type:"client_report"},{timestamp:J(),discarded_events:r}]]));var r,n;this._sendEnvelope(t)}}class lr{constructor(e){this.debug=e.debug??!1;const t={debug:this.debug,dist:`${e.release.split("@")[1]}-${e.environment}`,dsn:e.dsn,environment:e.environment,integrations:[Re(),je(),...!0===e.useGlobalHandlers?[dt()]:[],bt(),St(),Pt()],release:e.release,stackParser:jt,transport:e.transport??tr};e.beforeSend&&(t.beforeSend=e.beforeSend),this.client=new cr(t),!0===e.useGlobalHandlers?(function(e){const t=Ce().getStackTop();t.client=e,t.scope.setClient(e)}(this.client),this.scope=ie(),this.scope.clear()):this.scope=new fe,e.initialScope&&this.scope.update(e.initialScope),this.scope.setClient(this.client),this.client.init()}setCustomTags(e){Object.entries(e).forEach((([e,t])=>{this.scope.setTag(e,t)}))}setUser(e){this.scope.setUser({id:e})}captureException(e,t){this.debug&&console.error("[Sentry exception]",e,t),this.scope.captureException(e,t)}addBreadcrumb(e){this.debug&&console.log("[Sentry Breadcrumb]",e),this.scope.addBreadcrumb(e)}}async function ur(e,t,r=new Error("Promise timeout exceeded")){let n=-1;const i=new Promise(((e,i)=>{n=window.setTimeout((()=>{i(r)}),t)})),o=await Promise.race([i,e()]);return window.clearTimeout(n),o}const dr=(e,t)=>Math.min(200*Math.pow(2,e-1)+Math.floor(1e3*Math.random()),t);class hr extends Error{constructor(e,t,r){super(`Request timeout exceeded (attempts=${e}; duration=${t}ms; url=${r})`),this.name="HttpRequestTimeoutError",Object.setPrototypeOf(this,hr.prototype)}}class pr extends Error{constructor(e,t,r){super(`Invalid JSON received (status=${t}; url=${e})`),this.originalErrorMessage=r,this.name="HttpRequestInvalidJsonError",Object.setPrototypeOf(this,pr.prototype)}}class fr extends Error{constructor(e,t,r){super(`Network error during request (attempts=${e}; duration=${t}ms; url=${r})`),this.name="HttpRequestNetworkError",Object.setPrototypeOf(this,fr.prototype)}}function mr(e,t){return{body:e,status:t.status,statusText:t.statusText}}function vr(e){const t=new Headers([["Accept","application/json"],["Content-Type","application/json; charset=utf-8"]]);for(const r in e){const n=e[r];void 0!==n&&t.set(r,n)}return t}async function gr(e,t,r=1,n=Date.now()){const i=Date.now()-n,{body:o,headers:a={},credentials:s="include",mode:c="cors",timeoutMs:l=1e4,maxAttempts:u=3,maxBackoffMs:d=32e3}=t;let h=null;void 0!==window.AbortController&&null!==window.AbortController&&(h=new window.AbortController);const p={...t,body:null!=o?JSON.stringify(o):null,credentials:s,headers:vr(a),mode:c,signal:h?h.signal:null};try{const t=await ur(window.fetch.bind(null,e,p),l,new hr(r,i,e));return await async function(e,t){let r={};const n=e.status;if(!(n<500))return mr(r,e);{let i;try{return 204!==n&&(r=await e.json()),mr(r,e)}catch(r){if(r instanceof Error){const n=r.toString();try{i=await e.text(),i=`${i} ${n}`}catch{i=n}throw new pr(t,e.status,i)}throw new pr(t,e.status,JSON.stringify(r))}}}(t,e)}catch(o){if(o instanceof hr)h?.abort();else{if(o instanceof pr)throw o;if(r===u)throw new fr(r,i,e)}if(r===u)throw o;const a=dr(r,d);return new Promise((i=>{setTimeout((()=>{i(gr(e,t,r+1,n))}),a)}))}}const yr=function(e,t){return gr(e,{...t,method:"POST"})};var Er=null!=="production"?"production":"development",br="local",_r={get ANALYTICS_CLIENT_VERSION(){},get API_PROTOCOL(){return"https://"},get API_PUBLIC_HOST(){switch(Er){case"production":return"squareup.com";case"sandbox":return"squareupsandbox.com";default:return"squareupstaging.com"}},get API_URL(){return"".concat(this.API_PROTOCOL).concat(this.PCI_CONNECT_API_HOST)},get ASSET_BASE_URL(){return function(e){switch(e){case"production":return"https://web.squarecdn.com";case"sandbox":return"https://sandbox.web.squarecdn.com";case"development":return"https://localhost:1779";default:return"https://staging.web.squarecdn.com"}}(Er)},get ASSET_URL(){return this.VERSION===br?this.ASSET_BASE_URL:"".concat(this.ASSET_BASE_URL,"/").concat(this.VERSION)},get ASYNC_TRANSACTION_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/async-transaction-nonce")},get BANK_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/bank-nonce")},get BITCOIN_STYLES(){return"".concat(this.ASSET_URL,"/bitcoin.css")},get CARD_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/card-nonce")},get CONNECT_API_URL(){return"https://connect.".concat(this.API_PUBLIC_HOST)},get CREATE_OAUTH_PLAID_LINK_SESSION_ENDPOINT(){return"".concat(this.API_URL,"/digital-wallets/plaid/oauth-link-session")},get ENABLE_ERROR_LOGGING(){return"development"!==Er},GET_ASYNC_NONCE_STATUS_ENDPOINT(e){return"".concat(this.API_URL,"/v2/async-transaction-nonce/").concat(e,"/status")},get GET_PRODUCT_INFORMATION_ENDPOINT(){return"".concat(this.API_URL,"/v2/tokenization/product-information")},get GIFT_CARD_IFRAME(){return"".concat(this.ASSET_URL,"/gift-card-element-iframe.html")},get GOOGLE_PAY_GENERATE_TOKEN_ENDPOINT(){return"".concat(this.API_URL,"/digital-wallets/google-pay/token")},get HYDRATION_ENDPOINT(){return"".concat(this.API_URL,"/payments/hydrate")},get IFRAME_SRC(){return"".concat(this.ASSET_URL,"/main-iframe.html")},get INITIALIZE_THREE_DS_METHOD_ENDPOINT(){return"".concat(this.API_URL,"/v2/analytics/three-ds-method")},get INSTANT_WALLET_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/instant-wallet-nonce")},get METRICS_URL(){return"".concat(this.API_URL,"/payments/mtx")},get METRICS_V2_URL(){return"".concat(this.API_URL,"/payments/mtx/v2")},get PCI_CONNECT_API_HOST(){return"pci-connect.".concat(this.API_PUBLIC_HOST)},get QR_CODE_GENERATOR_SCRIPT(){return"".concat(this.ASSET_URL,"/qr-code-generator.js")},get SENTRY_DSN(){switch(Er){case"test":case"development":return"https://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001";default:return"https://565ee38bb5ff45dabc25ab6d7b8bebe3@o160250.ingest.sentry.io/3478832"}},get SINGLE_CARD_IFRAME(){return"".concat(this.ASSET_URL,"/single-card-element-iframe.html")},get SINGLE_CARD_WRAPPER_STYLES(){return"".concat(this.ASSET_URL,"/card-wrapper.css")},THREE_DS_AUTHENTICATE_ENDPOINT(e){return"".concat(this.VERIFICATION_ENDPOINT,"/").concat(e,"/three-ds-authentication")},get VERIFICATION_ENDPOINT(){return"".concat(this.API_URL,"/v2/analytics/verifications")},VERIFICATION_UPDATE_ENDPOINT(e){return"".concat(this.VERIFICATION_ENDPOINT,"/").concat(e)},get VERSION(){return null!=="1.84.2"?"1.84.2":br},get ZELLE_STYLES(){return"".concat(this.ASSET_URL,"/zelle.css")},env:Er,staticAsset(e){return"".concat(this.ASSET_URL,"/static-assets/").concat(e)}};class Cr extends Error{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unknown Error",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=e;t.length>0&&(r=function(e,t){return"".concat(e,"\n  ").concat(t.map((e=>{switch(!0){case"message"in e:return e.message;case"detail"in e:return e.detail;default:return"[Unspecified Error]"}})).join("\n  "))}(e,t)),super(r),this.errors=t,this.name="SqError",Object.setPrototypeOf(this,Cr.prototype)}fromSerializedError(e){this.name=e.name,this.message=e.message,e.errors&&Object.assign(this,{errors:e.errors})}}r(9170);var Sr,Ir,Or,wr,Ar,Tr,Pr,Nr,Dr,Rr,Lr,xr,kr,Mr,jr,Ur=Object.freeze({SHIPPING_CONTACT_CHANGED:"shippingcontactchanged",SHIPPING_OPTION_CHANGED:"shippingoptionchanged"}),Br=Object.freeze({AFTERPAY_SHIPPING_ADDRESS_CHANGED:"afterpay_shippingaddresschanged",AFTERPAY_SHIPPING_OPTION_CHANGED:"afterpay_shippingoptionchanged"}),qr=Object.freeze({ACH:"ACH",AFTERPAY_CLEARPAY:"AfterpayClearpay",APPLE_PAY:"Apple Pay",CARD:"Card",CASH_APP_PAY:"Cash App Pay",GIFT_CARD:"Gift Card",GOOGLE_PAY:"Google Pay"}),Hr="Cancel",Fr="Error",Vr="Invalid",Gr="OK";class zr extends Cr{constructor(){super("Tokenization has failed. `accountHolderName` is a required option when calling ach.tokenize()"),this.name="PlaidMissingNameError",Object.setPrototypeOf(this,zr.prototype)}}class $r extends Cr{constructor(){super("You cannot call `tokenize` when using an `onTokenize` callback"),this.name="AfterpayOnTokenizeListenerError",Object.setPrototypeOf(this,$r.prototype)}}class Yr extends Cr{constructor(e,t){super("This instance of ".concat(e," is missing the ").concat(t," listener.")),this.name="PaymentMethodMissingListener",Object.setPrototypeOf(this,Yr.prototype)}}class Wr extends Cr{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super("The payment request used for Afterpay/Clearpay caused a failure",e),this.errors=e,this.name="AfterpayRequestError",Object.setPrototypeOf(this,Wr.prototype)}}class Kr extends Cr{constructor(){super("The amount is outside of the merchant's Afterpay payment limits."),this.name="AfterpayAmountOutsideLimitsError",Object.setPrototypeOf(this,Kr.prototype)}}class Zr extends Cr{constructor(){super("The currency provided is not supported for use with Afterpay/Clearpay"),this.name="AfterpayUnsupportedCurrencyError",Object.setPrototypeOf(this,Zr.prototype)}}class Jr extends Cr{constructor(){super("Afterpay/Clearpay is not enabled for this merchant."),this.name="AfterpayMerchantError",Object.setPrototypeOf(this,Jr.prototype)}}class Xr extends Cr{constructor(e){super(e),this.name="AfterpayInvalidPaymentRequestError",Object.setPrototypeOf(this,Xr.prototype)}}class Qr extends Cr{constructor(e){super("An issue occurred while verifying the buyer",[e]),this.name="VerifyBuyerError",Object.setPrototypeOf(this,Qr.prototype)}toJSON(){return{errors:this.errors.map((e=>{var t={};return["name","message","type","code","token"].forEach((function(r){r in e&&(t[r]=e[r])})),t})),name:this.name}}}function en(e){return"type"in e&&"message"in e}function tn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rn(e,t):void 0}}(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 rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}class nn extends Cr{constructor(e){var t=e instanceof HTMLElement?e.nodeName:e;super("The element ".concat(t," was not found")),this.name="ElementNotFoundError",Object.setPrototypeOf(this,nn.prototype)}}class on extends Cr{constructor(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((e=>{var t=tn(e,2),r=t[0],n=t[1];return'expected property: "'.concat(r,'" of type "').concat(n,'"')})).concat(e);super("Please ensure you call payments.paymentRequest (https://developer.squareup.com/reference/sdks/web/payments#Payments.paymentRequest) with the appropriate options.\n".concat(t.join("\n"))),this.name="InvalidPaymentRequestError",Object.setPrototypeOf(this,on.prototype)}}class an extends Cr{constructor(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((e=>{var t=tn(e,2),r=t[0],n=t[1];return'expected property: "'.concat(r,'" of type "').concat(n,'"')})).join("\n");super("\n".concat(e)),this.name="InvalidPaymentRequestUpdateError",Object.setPrototypeOf(this,an.prototype)}}class sn extends Cr{constructor(e,t){super("The callback provided to the event listener ".concat(e," threw an error with message: ").concat(t)),this.name="InvalidEventListenerCallbackError",Object.setPrototypeOf(this,sn.prototype)}}class cn extends Cr{constructor(e){super(e),this.name="InvalidOptionError",Object.setPrototypeOf(this,cn.prototype)}}!function(e){e.FOCUS_CLASS_ADDED="focusClassAdded",e.FOCUS_CLASS_REMOVED="focusClassRemoved",e.ERROR_CLASS_ADDED="errorClassAdded",e.ERROR_CLASS_REMOVED="errorClassRemoved",e.CARD_BRAND_CHANGED="cardBrandChanged",e.POSTAL_CODE_CHANGED="postalCodeChanged",e.ESCAPE="escape",e.SUBMIT="submit"}(Sr||(Sr={})),function(e){e.CARD_NUMBER="cardNumber",e.CVV="cvv",e.EXPIRATION_DATE="expirationDate",e.POSTAL_CODE="postalCode"}(Ir||(Ir={})),function(e){e.CARD_INPUT="input",e.CARD_INPUT_FOCUS="input.is-focus",e.CARD_INPUT_PLACEHOLDER="input::placeholder",e.CARD_INPUT_FOCUS_PLACEHOLDER="input.is-focus::placeholder",e.CARD_INPUT_ERROR="input.is-error",e.CARD_INPUT_ERROR_PLACEHOLDER="input.is-error::placeholder",e.CARD_COMPONENT=".input-container",e.CARD_COMPONENT_FOCUS=".input-container.is-focus",e.CARD_COMPONENT_ERROR=".input-container.is-error",e.CARD_INPUT_HELPER_TEXT=".message-text",e.CARD_INPUT_HELPER_ICON=".message-icon",e.CARD_INPUT_ERROR_TEXT=".message-text.is-error",e.CARD_INPUT_ERROR_ICON=".message-icon.is-error"}(Or||(Or={})),function(e){e.GIFT_CARD_NUMBER="giftCardNumber"}(wr||(wr={})),function(e){e.FOCUS_CLASS_ADDED="focusClassAdded",e.FOCUS_CLASS_REMOVED="focusClassRemoved",e.ERROR_CLASS_ADDED="errorClassAdded",e.ERROR_CLASS_REMOVED="errorClassRemoved",e.CARD_BRAND_CHANGED="cardBrandChanged",e.ESCAPE="escape",e.SUBMIT="submit"}(Ar||(Ar={})),function(e){e.UNKNOWN="Unknown"}(Tr||(Tr={})),function(e){e.GIFT="Gift"}(Pr||(Pr={}));class ln extends Cr{constructor(e){super("".concat(e," is not a valid field name. Valid field names are ").concat([...Object.values(Ir),...Object.values(wr)].join(", "))),this.name="InvalidFieldNameError",Object.setPrototypeOf(this,ln.prototype)}}class un extends Cr{constructor(e){super("Configuration property '".concat(e,"' is invalid")),this.name="InvalidConfigurationPropertyError",Object.setPrototypeOf(this,un.prototype)}}class dn extends Cr{constructor(e,t,r){super("Configuration property '".concat(e,"' has an invalid value '").concat(t,"'.").concat(void 0!==r?" ".concat(r,"."):"")),this.name="InvalidConfigurationValueError",Object.setPrototypeOf(this,dn.prototype)}}function hn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pn(e,t):void 0}}(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 pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}class fn extends Cr{constructor(e){var t=e.map((e=>{var t=hn(e,2),r=t[0],n=t[1];return'expected property: "'.concat(r,'" of type "').concat(n,'"')})).join("\n");super("\n".concat(t)),this.name="InvalidCashAppPayV1OptionsFieldTypes",Object.setPrototypeOf(this,fn.prototype)}}class mn extends Cr{constructor(e){var t=e.map((e=>{var t=hn(e,2),r=t[0],n=t[1];return'accepted property: "'.concat(r,'" values are "').concat(n,'"')})).join("\n");super("\n".concat(t)),this.name="InvalidCashAppPayV1OptionsFieldValues",Object.setPrototypeOf(this,mn.prototype)}}class vn extends Cr{constructor(e){super(e),this.name="CashAppPayInvalidPaymentRequestError",Object.setPrototypeOf(this,vn.prototype)}}class gn extends Cr{constructor(){super("A redirect url is always required for requests. This must also be a secure link."),this.name="CashAppPayMissingRedirectUrlError",Object.setPrototypeOf(this,gn.prototype)}}class yn extends Cr{constructor(){super("Non function passed as shouldTokenize checker"),this.name="CashAppPayInvalidShouldTokenizeError",Object.setPrototypeOf(this,yn.prototype)}}class En extends Cr{constructor(e,t){super("amount '".concat(e,"' in ").concat(t," is not expressed in a valid format")),this.name="InvalidCurrencyFormatError",Object.setPrototypeOf(this,En.prototype)}}class bn extends Cr{constructor(){super("Web Payments SDK does not support this browser"),this.name="BrowserNotSupportedError",Object.setPrototypeOf(this,bn.prototype)}}class _n extends Cr{constructor(){super("Web Payments SDK can only be embedded on sites that use HTTPS and have a secure context"),this.name="WebSdkEmbedError",Object.setPrototypeOf(this,_n.prototype)}}class Cn extends Cr{constructor(e,t){var r=null!=t?t:null==e?void 0:e.field;super("Method unsupported: ".concat(null==e?void 0:e.message).concat(void 0!==r?" (field=".concat(r,")"):"")),this.name="PaymentMethodUnsupportedError",Object.setPrototypeOf(this,Cn.prototype)}}class Sn extends Cr{constructor(e){super("This instance of ".concat(e," has already been attached to the page.")),this.name="PaymentMethodAlreadyAttachedError",Object.setPrototypeOf(this,Sn.prototype)}}class In extends Cr{constructor(e){super("".concat(e," has not been attached to the page. It must be attached before you can call this method.")),this.name="PaymentMethodNotAttachedError",Object.setPrototypeOf(this,In.prototype)}}class On extends Cr{constructor(e){super("This instance of ".concat(e," has already been destroyed.")),this.name="PaymentMethodAlreadyDestroyedError",Object.setPrototypeOf(this,On.prototype)}}class wn extends Cr{constructor(e,t){var r=e instanceof HTMLElement?e.nodeName:e;super("The value ".concat(r," is not a valid element type or selector. Only valid elements or selectors referring to ").concat([...t].join(", ")," elements are allowed.")),this.name="InvalidElementTypeError",Object.setPrototypeOf(this,wn.prototype)}}class An extends Cr{constructor(e,t){super("An element with one of the following conflicting IDs was found on the page: ".concat(t,". You must change those elements' ID before you can use ").concat(e)),this.name="InvalidElementPresentError",Object.setPrototypeOf(this,An.prototype)}}class Tn extends Cr{constructor(e){super("Invalid style property '".concat(e,"'.")),this.name="InvalidInputStylePropertyError",Object.setPrototypeOf(this,Tn.prototype)}}class Pn extends Cr{constructor(e,t){super("Invalid style value '".concat(t,"' for property '").concat(e,"'.")),this.name="InvalidInputStyleValueError",Object.setPrototypeOf(this,Pn.prototype)}}class Nn extends Cr{constructor(e){super("Invalid style selector '".concat(e,"'.")),this.name="InvalidInputStyleSelectorError",Object.setPrototypeOf(this,Nn.prototype)}}class Dn extends Cr{constructor(e){super("One or more style selectors and/or CSS properties are invalid",e),this.errors=e,this.name="InvalidStylesError",Object.setPrototypeOf(this,Dn.prototype)}}class Rn extends Cr{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super("Tokenization has failed",e),this.errors=e,this.name="TokenizationError",Object.setPrototypeOf(this,Rn.prototype)}}class Ln extends Cr{constructor(e){var t="An unexpected error occurred";e&&(t+=" while ".concat(e)),super("".concat(t,".")),this.name="UnexpectedError",Object.setPrototypeOf(this,Ln.prototype)}}!function(e){e.ON_TOKENIZATION="ontokenization",e.CLOSE_OAUTH="CLOSE_OAUTH",e.ERROR="ERROR",e.EXIT="EXIT",e.FAIL_OAUTH="FAIL_OAUTH",e.HANDOFF="HANDOFF",e.MATCHED_SELECT_INSTITUTION="MATCHED_SELECT_INSTITUTION",e.MATCHED_SELECT_VERIFY_METHOD="MATCHED_SELECT_VERIFY_METHOD",e.OPEN="OPEN",e.OPEN_MY_PLAID="OPEN_MY_PLAID",e.OPEN_OAUTH="OPEN_OAUTH",e.SEARCH_INSTITUTION="SEARCH_INSTITUTION",e.SELECT_BRAND="SELECT_BRAND",e.SELECT_INSTITUTION="SELECT_INSTITUTION",e.SUBMIT_CREDENTIALS="SUBMIT_CREDENTIALS",e.SUBMIT_MFA="SUBMIT_MFA",e.TRANSITION_VIEW="TRANSITION_VIEW"}(Nr||(Nr={})),function(e){e.BLACK="black",e.MINT="mint",e.GREEN="green"}(Dr||(Dr={})),function(e){e.CheckoutWithAfterpay="checkout_with_afterpay",e.BuyNowWithAfterpay="buy_now_with_afterpay",e.PlaceOrderWithAfterpay="place_order_with_afterpay"}(Rr||(Rr={})),function(e){e.REVIEW_MY_ORDER="review_my_order",e.BUY_NOW="buy_now"}(Lr||(Lr={})),function(e){e.BLACK_ON_MINT="black-on-mint",e.BLACK_ON_WHITE="black-on-white",e.MINT_ON_BLACK="mint-on-black",e.WHITE_ON_BLACK="white-on-black"}(xr||(xr={})),function(e){e.XS="xs",e.SM="sm",e.MD="md",e.LG="lg"}(kr||(kr={})),function(e){e.CIRCLED_INFO_ICON="circled-info-icon",e.CIRCLED_QUESTION_ICON="circled-question-icon",e.LEARN_MORE_TEXT="learn-more-text",e.MORE_INFO_TEXT="more-info-text",e.NONE="none"}(Mr||(Mr={})),function(e){e.MINT="mint",e.WHITE="white"}(jr||(jr={}));var xn,kn,Mn,jn,Un,Bn,qn,Hn,Fn,Vn,Gn,zn,$n=["CLASSIC","TIMELINE","COLLAPSIBLE","MODAL"],Yn=["borderColor","borderRadius","borderWidth"],Wn=["borderColor","borderWidth"],Kn=["color"],Zn=["color"];!function(e){e.UNKNOWN="OTHER_BRAND",e.AMERICAN_EXPRESS="AMERICAN_EXPRESS",e.DINERS_CLUB="DISCOVER_DINERS",e.DISCOVER="DISCOVER",e.JCB="JCB",e.MASTERCARD="MASTERCARD",e.UNION_PAY="CHINA_UNIONPAY",e.VISA="VISA"}(xn||(xn={})),function(e){e.UNKNOWN_CARD_TYPE="UNKNOWN_CARD_TYPE",e.CREDIT="CREDIT",e.DEBIT="DEBIT"}(kn||(kn={})),function(e){e.UNKNOWN_PAYMENT_TYPE="UNKNOWN_PREPAID_TYPE",e.NOT_PREPAID="NOT_PREPAID",e.PREPAID="PREPAID"}(Mn||(Mn={})),function(e){e.ROUND="round",e.SEMIROUND="semiround"}(jn||(jn={})),function(e){e.MEDIUM="medium",e.SMALL="small"}(Un||(Un={})),function(e){e.DARK="dark",e.LIGHT="light"}(Bn||(Bn={})),function(e){e.FULL="full",e.STATIC="static"}(qn||(qn={})),function(e){e.ONTOKENIZATION="ontokenization",e.CUSTOMER_INTERACTION="customerInteraction",e.CUSTOMER_DISMISSED="customerDismissed"}(Hn||(Hn={})),function(e){e.DEFAULT="default",e.BLACK="black",e.WHITE="white"}(Fn||(Fn={})),function(e){e.STATIC="static",e.FILL="fill"}(Vn||(Vn={})),function(e){e.LONG="long",e.SHORT="short"}(Gn||(Gn={})),function(e){e.PAYMENT_METHOD_DESTROYED="PAYMENT_METHOD_DESTROYED",e.SHIPPING_ADDRESS_UNSERVICEABLE="SHIPPING_ADDRESS_UNSERVICEABLE",e.SHIPPING_ADDRESS_INVALID="SHIPPING_ADDRESS_INVALID"}(zn||(zn={}));class Jn{constructor(e,t){this.type=e,this.detail=t,this.type=e,this.detail=t}}class Xn extends Cr{constructor(){super("The Payment 'applicationId' option is not in the correct format."),this.name="InvalidApplicationIdError",Object.setPrototypeOf(this,Xn.prototype)}}class Qn extends Cr{constructor(e,t){super("Web Payments SDK was initialized with an application ID created in ".concat(e," however you are currently using ").concat(t,".")),this.name="ApplicationIdEnvironmentMismatchError ",Object.setPrototypeOf(this,Qn.prototype)}}class ei extends Cr{constructor(){super("The Payment 'locationId' option is not in the correct format."),this.name="InvalidLocationIdError",Object.setPrototypeOf(this,ei.prototype)}}var ti={message:"An internal error has occurred. Unable to complete the request.",type:"INTERNAL_SERVER_ERROR"},ri={message:"The requested resource was not found.",type:"NOT_FOUND"},ni={message:"The endpoint is currently unavailable.",type:"SERVICE_UNAVAILABLE"},ii={message:"Too many requests in progress.",type:"TOO_MANY_REQUESTS"},oi={message:"Request not authorized.",type:"UNAUTHORIZED"},ai={message:"An unknown error has occurred",type:"UNKNOWN"};class si extends Cr{constructor(e){super(e),this.name="InternalError",Object.setPrototypeOf(this,si.prototype)}}class ci extends Cr{constructor(e){super(e),this.name="AlreadyCapturedError",Object.setPrototypeOf(this,ci.prototype)}}class li extends Cr{constructor(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=function(e){switch(e){case 401:return oi;case 404:return ri;case 429:return ii;case 500:return ti;case 503:return ni;default:return ai}}(t);super("".concat(i.message," (message=").concat(r,"; url=").concat(e,")"),n),this.name="InternalHttpError",Object.setPrototypeOf(this,li.prototype)}}class ui extends Cr{constructor(e,t){super("".concat(e," (payment_method=").concat(t,")")),this.name="InternalPaymentMethodError",Object.setPrototypeOf(this,ui.prototype)}}class di extends Cr{constructor(e){super(e),this.name="InvalidIframeError",Object.setPrototypeOf(this,di.prototype)}}class hi extends Cr{constructor(e){super("Received error event from iframe"),this.event=e,this.name="IframeErrorEventError",Object.setPrototypeOf(this,hi.prototype)}}class pi extends Cr{constructor(e,t,r){super("Request timeout exceeded (attempts=".concat(e,"; duration=").concat(t,"ms; url=").concat(r,")")),this.name="InternalTimeoutError",Object.setPrototypeOf(this,pi.prototype)}}function fi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mi(e,t):void 0}}(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 mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}r(7156),r(6460),r(8370),r(1152),r(1257),r(8304),r(7680);var vi=new RegExp(/^[\w.-]+$/i),gi=new RegExp(/sq0at/i);function yi(e){return _r.env===e}function Ei(){return yi("production")}var bi=/^_/g,_i=/(?!^)([A-Z])/g,Ci=/[\s_]+(?=[A-Za-z])/g;function Si(e){return"JPY"===e.toUpperCase()?0:2}function Ii(e,t){var r=fi(e,3),n=(r[0],r[1]),i=r[2],o=void 0===i?"":i;if(0===t)return Number(n);var a="0".repeat(t-o.length);return Number(n+o+a)}function Oi(e,t){var r=Si(t);return(e/Math.pow(10,r)).toFixed(r)}var wi={buildUrl:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Object.entries(t).map((e=>{var t=fi(e,2),r=t[0],n=t[1];return"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n))})).join("&");return encodeURI(e)+(r.length>0?"?".concat(r):"")},convertLocaleToUnderscore:function(e){return e.replace(/-/,"_")},cssProperty:function(e){return e.replace(bi,"-").replace(_i," $1").replace(Ci,"-").toLowerCase()},decimalPlaces:Si,delay:function(e){return new Promise((t=>{setTimeout(t,e)}))},enumValues:function(e){return Object.values(e)},formatCSSKeyValuePair:function(e,t){return"".concat(e,": ").concat(t,";")},isInstanceOf:function(e,t){return t.some((function(t){return e instanceof t}))},isNonBlankString:function(e){return void 0!==e&&""!==e},isProduction:Ei,isStaging:function(){return yi("staging")},isValidUrl:function(e){try{return new URL(e),!0}catch(e){return!1}},moneyAmountToInternationalizedCurrency:function(e,t,r){var n=Si(t),i=e/Math.pow(10,n);return new Intl.NumberFormat(r,{currency:t,style:"currency"}).format(i)},moneyAmountToPaymentRequestAmount:Oi,paymentRequestAmountToMoneyAmount:function(e,t){var r=Si(t),n="^(-?[0-9]+)";r>0&&(n="".concat(n,"(?:\\.([0-9]{1,").concat(r,"})[0-9]*)?")),n="".concat(n,"$");var i=new RegExp(n).exec(e);if(!i)throw new En(e,t);return Ii(i,r)},requestId:function(){return Date.now()+Number.parseFloat(Math.random().toFixed(8))},sanitizePaymentRequestAmount:function(e,t){var r=Si(t),n="^(-?[0-9]+)(?:\\.([0-9]{0,".concat(r,"})[0-9]*)?$"),i=new RegExp(n).exec(e);return i?Oi(Ii(i,r),t):e}},Ai={message:"An unknown error has occurred",type:"UNKNOWN"},Ti={message:"An error occurred while verifying the buyer",type:"VERIFICATION_ERROR"},Pi={UNKNOWN:Ai};new Set(["EXPIRED_PLAID_SESSION","INVALID_SELECTED_PLAID_BANK_ACCOUNT_ID","DATABASE_INSIGHTS_VERIFICATION_FAILURE"]);var Ni=["INVALID_APPLICATION_ID","VALIDATION_ERROR","MISSING_APPLICATION_ID","MISSING_CARD_DATA","UNSUPPORTED_CARD_BRAND","UNAUTHORIZED","TOO_MANY_REQUESTS","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","UNKNOWN"];function Di(e){return Ni.includes(e)?e:"OTHER"}class Ri extends Cr{constructor(e){super("Internal Validation Error",e),this.errors=e,this.name="InternalValidationError",Object.setPrototypeOf(this,Ri.prototype)}}function Li(e,t){return{field:e,message:"".concat(e," is required and must be a(n) ").concat(t,"."),type:"VALIDATION_ERROR"}}function xi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ki(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xi(Object(r),!0).forEach((function(t){Mi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mi(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ji={AlreadyCapturedError:ci,HttpRequestInvalidJsonError:pr,HttpRequestNetworkError:fr,HttpRequestTimeoutError:hr,InternalError:si,InternalHttpError:li,InternalPaymentMethodError:ui,InternalTimeoutError:pi,InternalValidationError:Ri,InvalidIframeError:di},Ui={AfterpayAmountOutsideLimitsError:Kr,AfterpayMerchantError:Jr,AfterpayRequestError:Wr,AfterpayUnsupportedCurrencyError:Zr,BrowserNotSupportedError:bn,ElementNotFoundError:nn,InvalidCurrencyFormatError:En,InvalidElementTypeError:wn,InvalidEventListenerCallbackError:sn,InvalidOptionError:cn,InvalidPaymentRequestError:on,InvalidPaymentRequestUpdateError:an,PaymentMethodUnsupportedError:Cn,PlaidMissingNameError:zr,TokenizationError:Rn,UnexpectedError:Ln,VerifyBuyerError:Qr,WebSdkEmbedError:_n},Bi=ki(ki(ki({},Ui),ji),{},{AfterpayInvalidPaymentRequestError:Xr,AfterpayOnTokenizeListenerError:$r,InvalidApplicationIdError:Xn,InvalidInputStylePropertyError:Tn,InvalidInputStyleValueError:Pn,InvalidStylesError:Dn,PaymentMethodAlreadyAttachedError:Sn,PaymentMethodAlreadyDestroyedError:On,PaymentMethodMissingListener:Yr,PaymentMethodNotAttachedError:In,SqError:Cr});function qi(e){return e instanceof Error?e:new Error(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;if("string"==typeof e)return e.length>t?"".concat(e.slice(0,t),"...[truncated]"):e;if(void 0===e)return"undefined";try{var r=JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t));return r&&r.length>t?"".concat(r.slice(0,t),"...[truncated]"):r}catch(e){return"[Error]"}}(e))}function Hi(e){return qi(e).message}var Fi,Vi=function(e){var t,r=new(null!==(t=Bi[e.name])&&void 0!==t?t:Cr);return r.fromSerializedError(e),r},Gi=function(e){return{_isSerializedError:!0,errors:e.errors,message:e.message,name:e.name}};class zi{constructor(e){var t={beforeSend:(e,t)=>{var r;return _r.ENABLE_ERROR_LOGGING?e:(console.error(e.exception),null!==(r=e.exception)&&void 0!==r&&r.values&&e.exception.values.forEach((e=>{console.error(e)})),null)},dsn:_r.SENTRY_DSN,environment:_r.env,release:"web-payments-sdk@".concat(_r.VERSION),transport:e.transport,useGlobalHandlers:e.useGlobalHandlers};this.browserErrorLogger=new lr(t),this.browserErrorLogger.setCustomTags({applicationId:e.applicationId,applicationUrl:e.applicationUrl,source:e.source,version:_r.VERSION})}setCustomTags(e){this.browserErrorLogger.setCustomTags(e)}setUser(e){this.browserErrorLogger.setUser(e)}addBreadcrumb(e){this.browserErrorLogger.addBreadcrumb(e)}captureException(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};wi.isInstanceOf(e,[fr,hr])||e instanceof Error&&"AnalyticsError"===e.name||(e instanceof pr&&this.browserErrorLogger.addBreadcrumb({category:"invalid json error message",message:e.originalErrorMessage}),this.browserErrorLogger.captureException(qi(e),{captureContext:{tags:t}}))}}function $i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Yi=["en","ja","fr","es"],Wi=["en-US","en-IE","en-CA","en-GB","en-AU","ja-JP","fr-FR","fr-CA","es-ES","es-US"];function Ki(e){return Wi.includes(e)}var Zi={"en-AU":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid ZIP code."}},formTitle:"Secure credit card form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the ZIP code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square gift card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure gift card form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected shipping contact. Please try again.",optionsError:"There was an error processing your selected shipping option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with Bitcoin",modalTitle:"Scan to Pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning payment QR code",closeButtonAriaLabel:"Close"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"en-CA":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid zip code."}},formTitle:"Secure Credit Card Form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the ZIP code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square gift card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure Gift Card Form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected shipping contact. Please try again.",optionsError:"There was an error processing your selected shipping option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit Card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning Payment QR Code",closeButtonAriaLabel:"Close"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"en-GB":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid ZIP code."}},formTitle:"Secure card form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the zip code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square Gift Card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure gift card form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected delivery contact. Please try again.",optionsError:"There was an error processing your selected delivery option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or debit card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning payment QR code",closeButtonAriaLabel:"Close"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"en-IE":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiry date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid zip code."}},formTitle:"Secure card form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiry date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the ZIP code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square Gift Card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure gift card form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected delivery contact. Please try again.",optionsError:"There was an error processing your selected delivery option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit Card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to Pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning payment QR code",closeButtonAriaLabel:"Close"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"en-US":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid zip code."}},formTitle:"Secure Credit Card Form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the zip code"}},cardIcon:{brandNames:{visa:"Visa",masterCard:"Mastercard",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",JCB:"JCB",unionPay:"UnionPay",squareGiftCardV2:"Square gift card",unknown:"Unknown card"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure Gift Card Form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected shipping contact. Please try again.",optionsError:"There was an error processing your selected shipping option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit Card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning Payment QR Code",closeButtonAriaLabel:"Close"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone, or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number, or Zelle tag.",submitButtonText:"Send payment request"}}},"es-ES":{paymentMethods:{afterpay:{checkoutWidget:{title:"Tus 4 pagos sin intereses",today:"Hoy",weeks:"semanas"}},cards:{errors:{cardNumberError:"Introduce un número de tarjeta válido.",cvvError:"Introduce un código de seguridad válido.",expirationDateError:"Introduce una fecha de caducidad válida.",multipleErrors:"Corrige los errores resaltados.",postalCodeErrors:{CA:"Introduce un código postal válido.",GB:"Introduce un código postal válido.",US:"Introduce un código postal válido."}},formTitle:"Formulario seguro para tarjetas de crédito",helperText:{cardNumber:"Introduce tu número de tarjeta",cvv:"Introduce el código de seguridad",expirationDate:"Introduce la fecha de caducidad",postalCodes:{CA:"Introduce el código postal",GB:"Introduce el código postal",US:"Introduce el código postal"}},inputFieldTitles:{cardNumber:"Número de la tarjeta de crédito",cvv:"Código CVV",expirationDate:"Fecha de vencimiento",postalCodes:{CA:"Código postal",GB:"Código postal",US:"Código postal"}},placeholderText:{cardNumber:"Número de tarjeta",cvv:"Código CVV",expirationDate:"MM/AA",postalCodes:{CA:"Código postal",GB:"Código postal",US:"C.P."}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Tarjeta regalo de Square",unionPay:"UnionPay",unknown:"Tarjeta desconocida",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Introduce un número de tarjeta de regalo válido."},formTitle:"Formulario seguro para tarjetas regalo",helperText:{giftCardNumber:"Introduce el número de tu tarjeta de regalo"},inputFieldTitles:{giftCardNumber:"Número de la tarjeta regalo"},placeholderText:{giftCardNumber:"Tarjeta de regalo"}},wallets:{callbackErrors:{contactError:"Se ha producido un error al procesar el contacto de envío que has seleccionado. Inténtalo de nuevo.",optionsError:"Se ha producido un error al procesar la opción de envío que has seleccionado. Inténtalo de nuevo."}},clickToPay:{modal:{headerTitle:"Tarjeta de crédito o débito",cardNetworksAlt:"Mastercard o Visa",cancelAriaLabel:"Cancelar",continueButton:"Continuar"}},bitcoin:{buttonText:"Continuar con bitcoines",modalTitle:"Escanear para pagar",lightningPayButtonText:"Abrir la billetera Lightning",lightningPayButtonAriaLabel:"Abrir la billetera Lightning",qrCodeAltText:"Código QR de pago con bitcóin y Lightning",closeButtonAriaLabel:"Cerrar"},zelle:{identifierLabel:"ID de Zelle",identifierPlaceholder:"Correo electrónico, teléfono o etiqueta de Zelle",identifierHelperText:"Utiliza el ID de Zelle vinculado a tu cuenta bancaria.",identifierErrorText:"Indica un correo electrónico, un número de teléfono o una etiqueta de Zelle válidos.",submitButtonText:"Enviar solicitud de pago"}}},"es-US":{paymentMethods:{afterpay:{checkoutWidget:{title:"Tus pagos de 4 cuotas sin interés",today:"Hoy",weeks:"semanas"}},cards:{errors:{cardNumberError:"Introduce un número de tarjeta válido.",cvvError:"Ingresa un código de seguridad válido.",expirationDateError:"Ingresar una fecha de vencimiento válida.",multipleErrors:"Arregla los errores resaltados.",postalCodeErrors:{CA:"Introduce un código postal válido.",GB:"Introduce un código postal válido.",US:"Introduce un código zip válido."}},formTitle:"Formulario seguro para tarjetas de crédito",helperText:{cardNumber:"Ingresa el número de la tarjeta",cvv:"Ingresa el código de seguridad",expirationDate:"Ingresa la fecha de vencimiento",postalCodes:{CA:"Ingresa el código postal",GB:"Ingresa el código postal",US:"Ingresar el código ZIP"}},inputFieldTitles:{cardNumber:"Número de la tarjeta de crédito",cvv:"CVV",expirationDate:"Fecha de vencimiento",postalCodes:{CA:"Código postal",GB:"Código postal",US:"Código ZIP"}},placeholderText:{cardNumber:"Número de tarjeta",cvv:"CVV",expirationDate:"MM/AA",postalCodes:{CA:"Código postal",GB:"Código postal",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Descubre",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Tarjeta de regalo Square",unionPay:"UnionPay",unknown:"Tarjeta desconocida",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Ingresa un número válido de tarjeta de regalo."},formTitle:"Formulario seguro para tarjetas de regalo",helperText:{giftCardNumber:"Ingresar el número de la tarjeta de regalo"},inputFieldTitles:{giftCardNumber:"Número de la tarjeta de regalo"},placeholderText:{giftCardNumber:"Tarjeta de regalo"}},wallets:{callbackErrors:{contactError:"Ocurrió un error al procesar el contacto de envío seleccionado. Vuelve a intentarlo.",optionsError:"Ocurrió un error al procesar la opción de envío seleccionada. Vuelve a intentarlo."}},clickToPay:{modal:{headerTitle:"Tarjeta de crédito o débito",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancelar",continueButton:"Continuar"}},bitcoin:{buttonText:"Continuar con bitcoins",modalTitle:"Escanear para pagar",lightningPayButtonText:"Abrir cartera Lightning",lightningPayButtonAriaLabel:"Abrir cartera Lightning",qrCodeAltText:"Código QR del pago Lightning con bitcoin",closeButtonAriaLabel:"Cerrar"},zelle:{identifierLabel:"ID de Zelle",identifierPlaceholder:"Correo electrónico, teléfono o etiqueta de Zelle",identifierHelperText:"Usa el ID de Zelle asociado a tu cuenta bancaria.",identifierErrorText:"Indica un correo electrónico, un número de teléfono o una etiqueta de Zelle válidos.",submitButtonText:"Enviar solicitud de pago"}}},"fr-CA":{paymentMethods:{cards:{errors:{cardNumberError:"Saisissez un numéro de carte valide.",cvvError:"Veuillez saisir un code de sécurité valide.",expirationDateError:"Veuillez saisir une date d’expiration valide.",multipleErrors:"Corrigez les erreurs mises en évidence.",postalCodeErrors:{CA:"Saisissez un code postal valide.",GB:"Saisissez un code postal valide.",US:"Saisissez un code postal valide."}},formTitle:"Formulaire de carte de crédit sécurisé",helperText:{cardNumber:"Saisir votre numéro de carte",cvv:"Saisir le code de sécurité",expirationDate:"Saisir la date d’expiration",postalCodes:{CA:"Saisir le code postal",GB:"Saisir le code postal",US:"Saisir le code postal"}},inputFieldTitles:{cardNumber:"Numéro de carte bancaire",cvv:"CVV",expirationDate:"Date d’expiration",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code postal"}},placeholderText:{cardNumber:"Numéro de la carte",cvv:"CVV",expirationDate:"MM/AA",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code postal"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Carte cadeau Square",unionPay:"UnionPay",unknown:"Carte inconnue",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Saisissez un numéro de carte cadeau valide."},formTitle:"Formulaire de carte cadeau sécurisé",helperText:{giftCardNumber:"Saisir le numéro de votre carte cadeau"},inputFieldTitles:{giftCardNumber:"Numéro de carte cadeau"},placeholderText:{giftCardNumber:"Carte cadeau"}},afterpay:{checkoutWidget:{title:"Vos quatre paiements sans intérêts",today:"Aujourd’hui",weeks:"semaines"}},wallets:{callbackErrors:{contactError:"Une erreur s‘est produite lors du traitement du contact de livraison sélectionné. Veuillez réessayer.",optionsError:"Une erreur s‘est produite lors du traitement de l‘option d‘expédition sélectionnée. Veuillez réessayer."}},clickToPay:{modal:{headerTitle:"Carte de crédit ou débit",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Annuler",continueButton:"Continuer"}},bitcoin:{buttonText:"Continuer avec bitcoin",modalTitle:"Lisez le code pour payer",lightningPayButtonText:"Ouvrir le portefeuille Lightning",lightningPayButtonAriaLabel:"Ouvrir le portefeuille Lightning",qrCodeAltText:"Code QR de paiement avec Bitcoin Lightning",closeButtonAriaLabel:"Fermer"},zelle:{identifierLabel:"Identifiant Zelle",identifierPlaceholder:"Adresse courriel, numéro de téléphone ou balise Zelle",identifierHelperText:"Utilisez l’identifiant Zelle associé à votre compte bancaire.",identifierErrorText:"Saisissez une adresse courriel, un numéro de téléphone ou un identifiant Zelle valide.",submitButtonText:"Envoyer une demande de paiement"}}},"fr-FR":{paymentMethods:{afterpay:{checkoutWidget:{title:"Vos quatre paiements sans intérêts",today:"Aujourd’hui",weeks:"semaines"}},cards:{errors:{cardNumberError:"Saisissez un numéro de carte valide",cvvError:"Veuillez saisir un code de sécurité valide.",expirationDateError:"Saisir une date d’expiration valide",multipleErrors:"Corrigez les erreurs mises en évidence.",postalCodeErrors:{CA:"Saisissez un code postal valide",GB:"Saisissez un code postal valide",US:"Saisissez un code ZIP valide"}},formTitle:"Formulaire de carte bancaire sécurisé",helperText:{cardNumber:"Saisir votre numéro de carte",cvv:"Saisir le code de sécurité",expirationDate:"Saisir la date d’expiration",postalCodes:{CA:"Saisir un code postal",GB:"Saisir un code postal",US:"Saisir un code ZIP"}},inputFieldTitles:{cardNumber:"Numéro de carte bancaire",cvv:"CVV",expirationDate:"Date d’expiration",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code postal"}},placeholderText:{cardNumber:"Numéro de carte",expirationDate:"MM/AA",cvv:"CVV",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Carte cadeau Square",unionPay:"UnionPay",unknown:"Carte inconnue",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Saisir un numéro de carte cadeau valide"},formTitle:"Formulaire de carte cadeau sécurisé",helperText:{giftCardNumber:"Saisir le numéro de votre carte cadeau"},inputFieldTitles:{giftCardNumber:"Numéro de carte cadeau"},placeholderText:{giftCardNumber:"Carte cadeau"}},wallets:{callbackErrors:{contactError:"Une erreur s‘est produite lors du traitement du contact de livraison sélectionné. Veuillez réessayer.",optionsError:"Une erreur s‘est produite lors du traitement de l‘option d‘expédition sélectionnée. Veuillez réessayer."}},clickToPay:{modal:{headerTitle:"Carte bancaire",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Annuler",continueButton:"Continuer"}},bitcoin:{buttonText:"Continuer avec les bitcoins",modalTitle:"Scanner pour payer",lightningPayButtonText:"Ouvrir le portefeuille Lightning",lightningPayButtonAriaLabel:"Ouvrir le portefeuille Lightning",qrCodeAltText:"Code QR de paiement avec Bitcoin Lightning",closeButtonAriaLabel:"Fermer"},zelle:{identifierLabel:"Identifiant Zelle",identifierPlaceholder:"Adresse e-mail, numéro de téléphone ou identifiant Zelle",identifierHelperText:"Utilisez l’identifiant Zelle associé à votre compte bancaire.",identifierErrorText:"Saisissez une adresse e-mail, un numéro de téléphone ou un identifiant Zelle valide.",submitButtonText:"Envoyer une demande de paiement"}}},"ja-JP":{paymentMethods:{afterpay:{checkoutWidget:{title:"無利息の4回払い",today:"今日",weeks:"週間"}},cards:{errors:{cardNumberError:"正しいカード番号を入力してください。",cvvError:"有効なセキュリティコードを入力してください。",expirationDateError:"正しい有効期限を入力してください。",multipleErrors:"強調表示されたエラーを修正してください。",postalCodeErrors:{CA:"正しい郵便番号を入力してください。",GB:"有効な郵便番号を入力してください。",US:"正しいZIPコードを入力してください。"}},formTitle:"セキュアクレジットカードフォーム",helperText:{cardNumber:"カード番号を入力してください",cvv:"セキュリティコードを入力してください",expirationDate:"有効期限を入力してください",postalCodes:{CA:"郵便番号を入力してください",GB:"郵便番号を入力してください",US:"ZIPコードを入力してください"}},inputFieldTitles:{cardNumber:"クレジットカード番号",cvv:"CVV",expirationDate:"有効期限",postalCodes:{CA:"郵便番号",GB:"郵便番号",US:"ZIPコード"}},placeholderText:{cardNumber:"カード番号",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"郵便番号",GB:"郵便番号",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square ギフトカード",unionPay:"UnionPay",unknown:"不明なカード",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"有効なギフトカード番号を入力してください。"},formTitle:"セキュアギフトカードフォーム",helperText:{giftCardNumber:"ギフトカード番号を入力してください"},inputFieldTitles:{giftCardNumber:"ギフトカード番号"},placeholderText:{giftCardNumber:"ギフトカード"}},wallets:{callbackErrors:{contactError:"選択された配送住所を処理する際にエラーが発生しました。もう一度やり直してください。",optionsError:"選択された配送方法を処理する際にエラーが発生しました。もう一度やり直してください。"}},clickToPay:{modal:{headerTitle:"クレジットカードまたはデビットカード",cardNetworksAlt:"Mastercard、Visa",cancelAriaLabel:"キャンセル",continueButton:"続行"}},bitcoin:{buttonText:"ビットコインで続行",modalTitle:"セルフ会計",lightningPayButtonText:"ライトニング対応ウォレットを開く",lightningPayButtonAriaLabel:"ライトニング対応ウォレットを開く",qrCodeAltText:"ライトニング対応ビットコイン決済QRコード",closeButtonAriaLabel:"閉じる"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"メール、電話番号、またはZelleタグ",identifierHelperText:"ご利用の銀行口座に登録されているZelle IDを使用してください。",identifierErrorText:"有効なメールアドレス、電話番号、またはZelleタグを入力してください。",submitButtonText:"支払いリクエストを送信"}}}},Ji={en:"en-US",es:"es-ES",fr:"fr-FR",ja:"ja-JP"};class Xi{constructor(e){this.currentLocale="en-US",this.setLocale(e)}setLocale(e){var t,r,n=(t=e.split("-"),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return $i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$i(e,t):void 0}}(t,r)||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.")}()),i=n[0],o=n[1],a=this.currentLocale;return Ki(e)?(this.currentLocale=e,{newLocale:this.currentLocale,previousLocale:a}):function(e){return Yi.includes(e)}(i)?(this.currentLocale=Ji[i],{message:"Locale ".concat(e," is not supported. Language ").concat(i," is supported, but region ").concat(o," is not. Falling back to ").concat(this.currentLocale,"."),newLocale:this.currentLocale,previousLocale:a}):{message:"Locale ".concat(e," is not supported. Language ").concat(i," and region ").concat(o," are both unsupported."),newLocale:this.currentLocale,previousLocale:a}}getCurrentLocale(){return this.currentLocale}getLocaleString(){return Zi[this.currentLocale]}}function Qi(e){return"[object Object]"===Object.prototype.toString.call(e)}function eo(e){return"object"==typeof e&&null!==e}function to(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ro="INVALID_VALUE",no="SANITIZED",io=new Set(["countryCode","currencyCode","requestBillingContact","requestShippingContact","lineItems","total","shippingOptions","shippingContact"]),oo=new Set(["error","shippingErrors","lineItems","total","shippingOptions","taxLineItems","shippingLineItems","discounts"]),ao=new Set([...oo.values(),"eventName"]),so=new Set(["accountHolderName","amount","bankAccountId","currency","total"]),co=new Set([...so.values(),"intent","cadence","startDate"]),lo=new Set(["amount","currencyCode","total","billingContact"]),uo=new Set([...lo.values(),"intent","customerInitiated","sellerKeyedIn"]),ho=new Set(["includeInputLabels","postalCode","style"]),po=new Set(["includeInputLabels","style"]),fo=new Set(["lineItems","total","shippingOptions","shippingContact"]),mo=new Set(["buttonColor","buttonSizeMode","buttonType"]),vo=new Set(["shape","size","values","theme","width"]),go=Lo(Nr),yo=Lo(Sr),Eo=Lo(Ar),bo=Lo(Ur),_o=Lo(Ir),Co=Lo(wr),So=Lo(Fn),Io=Lo(Vn),Oo=Lo(Gn),wo=Lo(Un),Ao=Lo(jn),To=Lo(Bn),Po=Lo(qn),No=new Set(["shippingOption"]),Do=new Set([...No.values(),"error"]),Ro=new Set(["checkoutWidgetLaunch","locale","selectorOrElement"]);function Lo(e){return new Set(Object.values(e))}function xo(e){return JSON.stringify({value:e})}function ko(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(Qi(e)){var a={};return Object.entries(e).forEach((e=>{var r,s,c=(s=2,function(e){if(Array.isArray(e))return e}(r=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,s)||function(e,t){if(e){if("string"==typeof e)return to(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?to(e,t):void 0}}(r,s)||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.")}()),l=c[0],u=c[1];if(t.has(l)){var d=u;n.has(l)?d=no:l in i&&(d=i[l].has(u)?u:ro),a[l]=d}else o&&(a[l]=no)})),JSON.stringify(a)}return"invalid non-struct type: ".concat("object"!=typeof(r=e)?typeof r:Array.isArray(r)?"array":null===r?"null":Object.prototype.toString.call(r))}var Mo=function(e,t,r){switch(e){case"TOKENIZE_CONFIGURED":return function(e,t){switch(e){case"ACH":return function(e){return ko(e,co,so)}(t);case"Card":return function(e){var t=e.verificationDetails,r=void 0===t?{}:t,n=e.cofToken,i=ko(r,uo,lo,void 0,!0),o={verificationDetails:JSON.parse(i)};return void 0!==n&&(o.cofToken=function(e){return"string"==typeof e&&e.startsWith("ccof:")?no:ro}(n)),JSON.stringify(o)}(t)}return ro}(t,r);case"CONFIGURED":case"CONFIG_UPDATED":return function(e,t){switch(e){case"Card":case"Gift Card":return function(e,t){return ko(t,"Card"===e?ho:po)}(e,t);case"Google Pay":return function(e){return ko(e,mo,void 0,{buttonColor:So,buttonSizeMode:Io,buttonType:Oo})}(t);case"Payment Request":return function(e){return ko(e,io,fo)}(t);case qr.CASH_APP_PAY:return function(e){return ko(e,vo,void 0,{shape:Ao,size:wo,theme:To,values:To,width:Po})}(t)}return ro}(t,r);case"FOCUSED":return xo(function(e,t){if("string"!=typeof t)return ro;switch(e){case"Card":if(_o.has(t))return t;break;case"Gift Card":if(Co.has(t))return t}return ro}(t,r));case"SET_LOCALE":return xo(function(e){return"string"!=typeof e?ro:Ki(e)?e:ro}(r));case"EVENT_LISTENER_ADDED":return xo(function(e,t){if("string"!=typeof t)return ro;switch(e){case"ACH":if(go.has(t))return t;break;case"Card":if(yo.has(t))return t;break;case"Gift Card":if(Eo.has(t))return t;break;case"Payment Request":if(bo.has(t))return t}return ro}(t,r));case"EVENT_LISTENER_ON_COMPLETE_RESPONSE":return function(e,t){return"Payment Request"===e?function(e){return ko(e,ao,oo,{eventName:bo})}(t):ro}(t,r);case"SHIPPING_OPTION_UPDATE_RECEIVED":return ko(r,Do,No,void 0,!0);case"AFTERPAY_CHECKOUT_WIDGET_CONFIGURED":return ko(r,Ro);default:return""}};function jo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Uo(e,t){return void 0!==e.document.body&&null!==e.document.createNodeIterator(e.document.body,NodeFilter.SHOW_ELEMENT,{acceptNode:t}).nextNode()}function Bo(e,t){return Boolean(e.querySelector(t))}r(3249);var qo=function(e){var t,r=void 0!==e.angular,n=Bo(e.document,"[ng-version]")||void 0!==e.getAllAngularRootElements||void 0!==e.getAngularVersion,i=void 0!==e.bootstrap,o=void 0!==e.Ember,a=void 0!==e.jQuery,s=Bo(e.document,'form[action*="paypal.com"]'),c=function(e){return Uo(e,(function(e){return"__k"in e||"_component"in e||"__c"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),l=function(e){var t=Bo(e.document,"*[data-reactroot]");if(t)return t;return Uo(e,(function(e){return"_reactRootContainer"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),u=function(e){var t=void 0!==e.__NUXT__||void 0!==e.$nuxt,r=void 0!==e.__VUE__;if(r||t)return r||t;return Uo(e,(function(e){return"__vue__"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),d={angular:n,angularJS:r,bootstrap:i,ember:o,jquery:a,nextJS:void 0!==(null===(t=e.__NEXT_DATA__)||void 0===t?void 0:t.buildId),paypalBuyNow:s,preact:c,react:l,vue:u};return Object.fromEntries(Object.entries(d).filter((e=>{var t,r,n=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return jo(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?jo(e,t):void 0}}(t,r)||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.")}());return n[0],n[1]})))},Ho=new Set(["AFTERPAY_CHECKOUT_WIDGET_CONFIGURED","CLEAR","CONFIG_UPDATED","CONFIGURED","DESTROYED","DETACHED","EVENT_LISTENER_ADDED","EVENT_LISTENER_ON_COMPLETE_RESPONSE","FOCUSED","RECALCULATED_SIZE","SET_LOCALE","SET_ERROR","SHIPPING_OPTION_UPDATE_RECEIVED","TOKENIZE_CONFIGURED"]),Fo=new Set(["PAYMENTS_REUSE","PAYMENTS_ENV_METADATA","DEVELOPER_ERROR","DEVELOPER_ERROR_PENDING","REQUEST_AFTERPAY_INVALID","CLICK_TO_PAY_EXTERNAL_SESSION_ERROR"]),Vo=new Set(["GET_PRODUCT_INFORMATION","LOAD","MAIN_IFRAME","NONCE"]),Go={ATTACH:!0,BUILD:!0,CONFIGURE:!0,EXTERNAL_SESSION:!0,INITIALIZATION:!1,PROOF_OF_WORK:!1,TOKENIZE:!1};function zo(e){return e in Go}var $o=/[$()*+.?[\\\]^{|}]/g,Yo=new RegExp($o.source),Wo=function(e){return Yo.test(e)?e.replace($o,"\\$&"):e},Ko={CARD_NONCE_ENDPOINT:new RegExp(Wo(_r.CARD_NONCE_ENDPOINT)),GET_PRODUCT_INFORMATION_ENDPOINT:new RegExp(Wo(_r.GET_PRODUCT_INFORMATION_ENDPOINT)),LIBRARY_RESOURCE:new RegExp("".concat(Wo(_r.ASSET_BASE_URL),"/([\\w\\d.-]*/)?square\\.js")),MAIN_IFRAME_RESOURCE:new RegExp("".concat(Wo(_r.ASSET_URL),"/main-iframe"))};function Zo(e,t){if(!a.supportsPerformanceEntries)return null;var r=a.windowPerformance,n=function(e,t,r){var n=e.filter((e=>e.initiatorType===t&&r.test(e.name)));return n[n.length-1]}([...r.getEntriesByType("resource"),...r.getEntriesByType("navigation")],e,t);return n?Math.round(function(e){return e.duration>0?e.duration:Math.max(Math.trunc(e.responseEnd-e.startTime),0)}(n)):null}var Jo=function(e){switch(e){case"GET_PRODUCT_INFORMATION":return Zo("fetch",Ko.GET_PRODUCT_INFORMATION_ENDPOINT);case"MAIN_IFRAME":return Zo("navigation",Ko.MAIN_IFRAME_RESOURCE);case"LOAD":return Zo("script",Ko.LIBRARY_RESOURCE);case"NONCE":return Zo("fetch",Ko.CARD_NONCE_ENDPOINT);default:return null}};function Xo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Qo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xo(Object(r),!0).forEach((function(t){ea(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ea(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ra=_r.METRICS_URL,na=_r.METRICS_V2_URL;function ia(e){return t=e.event,Ho.has(t);var t}function oa(e){return t=e.event,Fo.has(t);var t}function aa(e){return!ia(e)&&!oa(e)}class sa{constructor(e,t){this.manualTelemetryStarts=new Map,this.logVisibilityEvent=()=>{var e={event:"visible"===a.documentVisibilityState?"VISIBILITY:VISIBLE":"VISIBILITY:HIDDEN",eventSource:"WebSDK"},t=this.getMetricsLoggerBody(e,this.session.instanceId,this.session.sessionId,this.session.paymentMethodTrackingId);this.metricsBuffer.push(t)},this.flushAllMetrics=()=>{"hidden"===a.documentVisibilityState&&(this.buildAndSendBeacon(),clearInterval(this.currentInterval),this.currentInterval=void 0)},this.sdkVersion=_r.VERSION,this.jsFramework="",this.applicationData=t,this.metricsBuffer=[],this.errorLogger=e,this.disableBeacon=!1}setAvt(e){this.avt=e}setFeatureFlagValues(e){this.featureFlagValues=e}logEvent(e,t,r,n){try{var i=this.getMetricsLoggerBody(e,t,r,n);if(this.session=i.session,this.disableBeacon||!a.supportsSendBeacon||!a.supportsDocumentVisibilityState)return void yr(ra,{body:i}).catch((e=>{this.errorLogger.captureException(e)}));this.metricsBuffer.push(i),"NONCE:OK"!==e.event&&"DESTROYED"!==e.event||this.buildAndSendBeacon(),void 0===this.currentInterval&&(document.addEventListener("visibilitychange",this.logVisibilityEvent),document.addEventListener("visibilitychange",this.flushAllMetrics),this.currentInterval=window.setInterval((()=>{this.buildAndSendBeacon()}),1e3))}catch(e){this.errorLogger.captureException(e)}}clearEventListener(){document.removeEventListener("visibilitychange",this.logVisibilityEvent),document.removeEventListener("visibilitychange",this.flushAllMetrics)}getJSFrameworkValue(){return 0===this.jsFramework.length&&(this.jsFramework=JSON.stringify(qo(window))),this.jsFramework}eventDuration(e,t){var r,n,i,o=(n=e.event.split(":"),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return ta(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ta(e,t):void 0}}(n,i)||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.")}()),a=o[0],s=o[1];if(zo(a)){var c;if(zo(r=a)&&!Go[r]?c=a:void 0!==t&&(c="".concat(a,":").concat(t)),void 0===c)return null;if("START"===s){var l=Date.now();return this.manualTelemetryStarts.set(c,l),null}if("OK"===s||"ERROR"===s||"CANCEL"===s){var u=this.manualTelemetryStarts.get(c);return void 0===u?null:(this.manualTelemetryStarts.delete(c),Date.now()-u)}}return"START"!==s&&function(e){return Vo.has(e)}(a)?Jo(a):null}buildAndSendBeacon(){if(0!==this.metricsBuffer.length){try{var e=new Blob([JSON.stringify({metrics:this.metricsBuffer})],{type:"text/plain;charset=UTF-8"});window.navigator.sendBeacon(na,e)}catch(e){(function(e){return e instanceof Error&&"TypeError"===e.name&&(e.message.includes("Not implemented")||e.message.includes("Illegal invocation"))})(e)||this.errorLogger.captureException(e),this.disableBeacon=!0,void 0!==this.currentInterval&&(clearInterval(this.currentInterval),this.currentInterval=void 0),yr(na,{body:{metrics:this.metricsBuffer}}).catch((e=>{this.errorLogger.captureException(e)}))}this.metricsBuffer=[]}}metricsSession(e,t,r){var n=Qo(Qo({},this.applicationData),{},{instanceId:e,sessionId:t});return void 0!==r&&(n.paymentMethodTrackingId=r),n}getMetricsLoggerBody(e,t,r,n){var i=function(){if(a.isTopLevelWindow)return{origin:a.windowLocation.origin,pathname:a.windowLocation.pathname};var e=a.documentReferrer;return e&&0!==e.length?(null!=Fi||(Fi=document.createElement("a")),Fi.href=e,{origin:Fi.origin,pathname:""}):{origin:"",pathname:""}}(),o={innerHeight:a.windowInnerHeight,innerWidth:a.windowInnerWidth,isSecureContext:a.isSecureContext,language:a.windowNavigatorLanguages[0]},s=this.eventDuration(e,n),c=e.event,l=e.eventSource,u=this.sdkVersion,d=this.metricsSession(t,r,n),h={appLocation:i,avt:this.avt,browserData:o,event:c,eventSource:l,paymentMethodTrackingId:n,sdkVersion:u,session:d};return ia(e)&&void 0!==e.eventConfigurationValues&&(h.eventConfigurationValues=Mo(e.event,l,e.eventConfigurationValues)),oa(e)?h.internalConfigurationValues=e.errorMessage:aa(e)&&void 0!==this.featureFlagValues&&(h.internalConfigurationValues=JSON.stringify(this.featureFlagValues)),null!==s&&s>0&&(h.duration=s),aa(e)&&void 0!==e.sloStatus&&(h.sloStatus=e.sloStatus),"INITIALIZATION:OK"===c&&(h.jsFramework=this.getJSFrameworkValue()),h}}r(5372);class ca{constructor(e,t){this.errorLogger=e,this.messenger=t}}function la(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var ua="LOCALE_CHANGED_EVENT";class da extends ca{constructor(e,t,r,n,i,o,a,s,c){super(e,t),this.session=n,this.localeStrings=o,this.paymentMethodSupportDetail=i,this.metricsHandler=r,this.eventTarget=a,this.featureFlagValues=s,this.analyticsBackend=c}addLocaleChangedListener(e){this.eventTarget.addEventListener(ua,e)}removeLocaleChangedListener(e){this.eventTarget.removeEventListener(ua,e)}getSession(){return this.session.serialize()}getFeatureFlagValues(){return this.featureFlagValues}getLocaleString(){return this.localeStrings.getLocaleString()}setLocale(e){var t=this.localeStrings.setLocale(e);if(t.previousLocale===t.newLocale)return t;var r=this.localeStrings.getCurrentLocale();return this.session.setLocale(r),this.eventTarget.dispatchEvent(ua,r),this.messenger.sendOneWayMessage("UPDATE_SESSION",{session:this.session.serialize()}),t}updateSession(e){var t,r=this;return(t=function*(){r.session.setSessionId(e),r.errorLogger.setCustomTags({sessionId:e}),yield r.messenger.sendOneWayMessage("UPDATE_SESSION",{session:r.session.serialize()})},function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){la(o,n,i,a,s,"next",e)}function s(e){la(o,n,i,a,s,"throw",e)}a(void 0)}))})()}setPaymentMethodTrackingId(e){this.metricsHandler.setPaymentMethodTrackingId(e)}getPaymentMethodTrackingId(){return this.metricsHandler.getPaymentMethodTrackingId()}}var ha={attach:[nn,wn,dn,Tn,Nn,Pn,Dn,Sn,On,Cn,fn,mn,yn],attachMessaging:[nn,wn,On],build:[un,dn,An,cn,on,Cn,Xr,Wr,vn,gn,En],configure:[nn,un,dn,Tn,Nn,Pn,cn,Dn,In,On],tokenize:[cn,On,In,Cn,Rn,$r]};function pa(e){return ha[e]}var fa={APPLE_PAY_BROWSER_NOT_SUPPORTED:{message:"Apple Pay is only available on Safari.",type:"BROWSER_NOT_SUPPORTED"},APPLE_PAY_CONSISTENT_DOMAIN_REQUIRED:{message:"Apple Pay should be hosted on the same domain as its top-level frame.",type:"CONSISTENT_DOMAIN_REQUIRED"},APPLE_PAY_DEVICE_NOT_SUPPORTED:{message:"Device does not support Apple Pay.\nSee: https://developer.squareup.com/docs/web-payments/apple-pay#prerequisites-and-assumptions",type:"DEVICE_NOT_SUPPORTED"},APPLE_PAY_NOT_REGISTERED:{message:"No active card available in the Apple Wallet or domain not registered.",type:"NOT_REGISTERED"},APPLE_PAY_REQUIRES_SECURE_CONTEXT:{message:"Apple Pay requires a fully secure HTTPS context.\nSee: https://developer.squareup.com/docs/web-payments/apple-pay#prerequisites-and-assumptions",type:"IFRAME_NOT_ALLOWED"},GOOGLE_PAY_BROWSER_NOT_SUPPORTED:{message:"Browser does not support Google Pay. \nSee: https://developer.squareup.com/docs/web-payments/google-pay#prerequisites-and-assumptions",type:"BROWSER_NOT_SUPPORTED"},GOOGLE_PAY_REQUIRES_HTTPS:{message:"Google Pay requires HTTPS. \nSee: https://developer.squareup.com/docs/web-payments/google-pay#prerequisites-and-assumptions",type:"BROWSER_NOT_SUPPORTED"},INVALID_CONFIG:{message:"Configuration is invalid.",type:"INVALID_CONFIG"},MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED:{message:"Third-party iframes are not allowed to request payments unless explicitly allowed via Permissions-Policy Configuration.\n    Please configure the relevant permissions policy (via the Permissions-Policy header or <iframe allow...> ) to allow 'payment' in order to enable this functionality.\n    See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/payment",type:"IFRAME_NOT_ALLOWED"},UNABLE_TO_LOAD:{message:"Temporarily unable to register the payment method.",type:"UNABLE_TO_LOAD"},UNKNOWN:{message:"An unknown error has occurred.",type:"UNKNOWN"}},ma=["COUNTRY_NOT_SUPPORTED","APPLICATION_DISABLED","MISSING_LOCATION_ID","UNVERIFIED_DOMAIN","NOT_ONBOARDED","US_AND_UK_MERCHANT_ONLY","US_MERCHANT_ONLY","INTERNAL_ERROR","DOMAIN_NOT_REGISTERED"],va={APPLICATION_DISABLED:{message:"Wallet is disabled for your application.",type:"APPLICATION_DISABLED"},COUNTRY_NOT_SUPPORTED:{message:"Wallet is not available in this merchant country.",type:"COUNTRY_NOT_SUPPORTED"},DOMAIN_NOT_REGISTERED:{message:"Your website's domain is not registered for use with Apple Pay.\nSee: https://developer.squareup.com/docs/web-payments/apple-pay#production-configuration",type:"DOMAIN_NOT_REGISTERED"},INTERNAL_ERROR:{message:"There was a temporary error determining your website's payment method status",type:"INTERNAL_ERROR"},MISSING_LOCATION_ID:{field:"locationId",message:"Missing locationId in the payment request configuration.\nSee: https://developer.squareup.com/reference/sdks/web/payments/objects/Payments",type:"MISSING_LOCATION_ID"},NOT_ONBOARDED:{message:"Your merchant account has not yet been onboarded for this payment method. Please visit the Seller Dashboard to enable the payment method",type:"NOT_ONBOARDED"},UNVERIFIED_DOMAIN:{message:"Your website's domain is not verified for use with Apple Pay. Please visit the Square Developer Dashboard at https://developer.squareup.com/ to register your domain for use with Apple Pay",type:"UNVERIFIED_DOMAIN"},US_AND_UK_MERCHANT_ONLY:{message:"Wallet is available for US and UK merchants only.",type:"US_AND_UK_MERCHANT_ONLY"},US_MERCHANT_ONLY:{message:"Wallet is available for US merchants only.",type:"US_MERCHANT_ONLY"}};class ga extends Cr{constructor(e,t,r){var n="".concat(e," was called with a missing or invalid parameter. '").concat(t,"' is required");n+=" and must be a(n) ".concat(r),super("".concat(n,".")),this.name="InvalidFunctionArgumentError",Object.setPrototypeOf(this,ga.prototype)}}class ya extends Cr{constructor(e){super("One or more of the arguments needed are missing or invalid."),this.argumentErrors=e,this.name="InvalidArgumentsError",Object.setPrototypeOf(this,ya.prototype)}}class Ea{constructor(){this.listeners={}}addEventListener(e,t){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(t)}removeEventListener(e,t){if(e in this.listeners)for(var r=this.listeners[e],n=0;n<r.length;n+=1)r[n]===t&&(r.splice(n,1),n-=1)}listenersForType(e){return e in this.listeners?[...this.listeners[e]]:[]}hasEventListener(e){return e in this.listeners&&this.listeners[e].length>0}}class ba{constructor(){this.listenerRegistry=new Ea}addEventListener(e,t){this.listenerRegistry.addEventListener(e,t)}removeEventListener(e,t){this.listenerRegistry.removeEventListener(e,t)}dispatchEvent(e,t){var r=new Jn(e,t),n=this.listenerRegistry.listenersForType(e);for(var i of n)try{i(r)}catch(e){console.error(e)}}hasEventListener(e){return this.listenerRegistry.hasEventListener(e)}}var _a=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).slice(1)}return"".concat(e()+e(),"-").concat(e(),"-").concat(e(),"-").concat(e(),"-").concat(e()).concat(e()).concat(e())};class Ca{constructor(e,t,r,n){this.metricsLogger=e,this.methodType=r,this.session=t,this.paymentMethodTrackingId=n}logDeveloperError(e,t){var r={operation:t,paymentMethod:this.methodType,type:e.name};if("errors"in e){var n=e.errors;Array.isArray(n)&&n.length>0&&"type"in n[0]&&(r.errors=n.map((e=>{var t=e.type;return"Click to Pay"===this.methodType?Di(t):t})))}e instanceof Cn&&(r.message=e.message.replace("Method unsupported: ","")),this.logValidationEvent("DEVELOPER_ERROR",r)}logValidationEvent(e,t){this.logMetricEvent({errorMessage:JSON.stringify(t),event:e,eventSource:this.methodType})}logConfigurationEvent(e,t){this.logMetricEvent({event:e,eventConfigurationValues:t,eventSource:this.methodType})}logEvent(e,t){this.logMetricEvent({event:e,eventSource:this.methodType,sloStatus:t})}setPaymentMethodTrackingId(e){this.paymentMethodTrackingId=e}getPaymentMethodTrackingId(){return this.paymentMethodTrackingId}logMetricEvent(e){this.metricsLogger.logEvent(e,this.session.instanceId,this.session.sessionId,this.paymentMethodTrackingId)}}function Sa(e,t,r){return void 0===e?[{code:"missing_property",expected:r,propertyPath:t}]:[]}function Ia(e,t,r,n){return r(e)?[]:[{code:"invalid_value",expected:n,propertyPath:t}]}function Oa(e,t,r,n){var i=[];i.push((()=>Sa(e,t,r))),i.push((()=>function(e,t,r){return typeof e===r?[]:[{code:"invalid_type",expected:r,propertyPath:t}]}(e,t,r)));var o=n.legalValues;return void 0!==o&&i.push((()=>function(e,t,r){return(r instanceof Set?r.has(e):r.includes(e))?[]:[{code:"invalid_value",expected:(r instanceof Set?[...r]:r).map((e=>String(e))).join(", "),propertyPath:t}]}(e,t,o))),i}function wa(e){for(var t of e){var r=t();if(r.length>0)return r}return[]}function Aa(){return{sanitizeFunction:e=>e,validateFunction:function(e,t){return Sa(e,t,"any")}}}function Ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Pa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sanitizeFunction:function(t){return t.map((t=>e.sanitizeFunction(t)))},validateFunction:function(r,n){if(!Array.isArray(r))return[{code:"invalid_type",expected:"array",propertyPath:n}];var i,o,a=[],s=0;for(var c of r.entries()){var l=(o=2,function(e){if(Array.isArray(e))return e}(i=c)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(i,o)||function(e,t){if(e){if("string"==typeof e)return Ta(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ta(e,t):void 0}}(i,o)||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.")}()),u=l[0],d=l[1];a.push(...e.validateFunction(d,"".concat(n,"[").concat(u,"]"))),s+=1}var h=t.maxLength,p=t.minLength;return void 0!==p&&s<p&&a.push({code:"invalid_value",expected:"Array must contain ".concat(p," or more items"),propertyPath:n}),void 0!==h&&s>h&&a.push({code:"invalid_value",expected:"Array must contain no more than ".concat(h," items"),propertyPath:n}),a}}}function Na(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,r){return wa(Oa(t,r,"boolean",e))}}}function Da(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}r(9964);var Ra,La=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function xa(e){var t,r,n,i,o=function(e){var t,r,n=(t=La.exec(e).map(Number),r=4,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return Da(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Da(e,t):void 0}}(t,r)||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.")}()),i=(n[0],n[1]),o=n[2],a=n[3];return new Date(i,o-1,a)}(e);return(t=o,r="".concat(t.getFullYear(),"-").concat((t.getMonth()+1).toString().padStart(2,"0"),"-").concat(t.getDate().toString().padStart(2,"0")),n=new Date("".concat(r,"T00:00:00").concat("-08:00")),i=new Date(n.getTime()),i.setDate(i.getDate()+1),{endDate:i,endDateMillis:i.getTime(),startDate:n,startDateMillis:n.getTime()}).endDateMillis}function ka(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,r){var n=Oa(t,r,"string",{});return"string"==typeof t&&(n.push((()=>Ia(t,r,(e=>La.test(e)),"Date did not match the YYYY-MM-DD format"))),!0===e.futureDate&&xa(t)<Date.now()&&n.push((()=>[{code:"invalid_value",expected:"Date should be a future date",propertyPath:r}]))),wa(n)}}}function Ma(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,r){return wa(Oa(t,r,"number",e))}}}function ja(e,t){function r(t){var r=[];for(var n of e)n.eligible(t)&&r.push(n.schemaOperation);return r}return{isRecordSchema:!0,sanitizeFunction:function(e){var t=r(e).filter((t=>0===t.validateFunction(e,"").length));return t[0].sanitizeFunction(e)},validateFunction:function(e,n){var i=r(e);if(0===i.length){var o=t.code,a=t.expected,s=t.propertyPath;return[{code:o,expected:a,propertyPath:""===n?s:"".concat(s," in ").concat(n)}]}var c=i.map((t=>t.validateFunction(e,n))).filter((e=>e.length>0));return c.length===i.length?c[0]:[]}}}function Ua(e){return{sanitizeFunction:function(t){if(null!=t)return e.sanitizeFunction(t)},validateFunction:function(t,r){return null==t?[]:e.validateFunction(t,r)}}}function Ba(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function qa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null==e)return e;if("object"!=typeof e)return e;if(e instanceof Date)return new Date(e);var r=t.get(e);if(void 0!==r)return r;if(Array.isArray(e)){var n=[];for(var i of(t.set(e,n),e))n.push(qa(i,t));return n}var o={};return t.set(e,o),Object.entries(e).reduce(((e,r)=>{var n,i,o=(i=2,function(e){if(Array.isArray(e))return e}(n=r)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Ba(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ba(e,t):void 0}}(n,i)||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.")}()),a=o[0],s=o[1];return e[a]=qa(s,t),e}),o)}function Ha(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fa(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Fa(e,t):void 0}}(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 Fa(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Va(e){return{isRecordSchema:!0,sanitizeFunction:function(t){var r=t;if(void 0===e)return qa(t);var n={};return Object.entries(e).forEach((e=>{var t=Ha(e,2),i=t[0],o=t[1].sanitizeFunction(r[i]);void 0!==o&&(n[i]=o)})),n},validateFunction:function(t,r){if(!eo(t))return[{code:"invalid_type",expected:"object",propertyPath:r}];var n=[];if(void 0!==e){var i=""===r?"":"".concat(r,".");Object.entries(e).forEach((e=>{var r=Ha(e,2),o=r[0],a=r[1],s=t[o];n.push(...a.validateFunction(s,"".concat(i).concat(o)))}))}return n}}}function Ga(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;return{sanitizeFunction:function(e){return t(e)},validateFunction:function(t,r){var n=Oa(t,r,"string",e),i=t,o=e.nonBlank,a=e.minLength,s=e.maxLength,c=e.matchRegexp,l=e.formatExample;return!0===o&&n.push((()=>Ia(i,r,(e=>""!==e.trim()),"non-blank string"))),void 0!==a&&n.push((()=>Ia(i,r,(e=>e.length>=a),"minimum length ".concat(e.minLength)))),void 0!==s&&n.push((()=>Ia(i,r,(e=>e.length<=s),"maximum length ".concat(e.maxLength)))),void 0!==c&&n.push((()=>Ia(i,r,(e=>c.test(e)),void 0!==l?"string with format ".concat(l):"correctly formatted string"))),wa(n)}}}r(6104),r(9098);class za extends Error{constructor(e){super("Unable to sanitize value: ".concat(JSON.stringify(e))),this.name="SanitizationError"}}function $a(e){var t=new WeakMap;function r(r,n){if(""!==n||"object"!=typeof r||null===r)return e.validateFunction(r,n);var i=t.get(r);if(void 0!==i)return i;var o=e.validateFunction(r,n);return t.set(r,o),o}return{logValidationFailures(e,t,n,i){var o=r(i,arguments.length>4&&void 0!==arguments[4]?arguments[4]:"");o.length>0&&e.logValidationEvent("DEVELOPER_ERROR_PENDING",{error:o.map((e=>"".concat(e.code," ").concat(e.expected," ").concat(e.propertyPath))).join(", "),operation:n,paymentMethod:t})},sanitize:function(t){if(r(t,"").length>0)throw new za(t);return e.sanitizeFunction(t)},validate:function(e){var t=r(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"");return{isValid:0===t.length,issues:t}}}}function Ya(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Wa(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Ya(o,n,i,a,s,"next",e)}function s(e){Ya(o,n,i,a,s,"throw",e)}a(void 0)}))}}!function(e){e[e.DETACHED=0]="DETACHED",e[e.ATTACHED=1]="ATTACHED",e[e.DESTROYED=2]="DESTROYED"}(Ra||(Ra={}));class Ka{constructor(e){this.status=Ra.DETACHED,this.eventTarget=new ba,this.eventBuffer={},this.context=e}get session(){return this.context.getSession()}get messenger(){return this.context.messenger}get metricsHandler(){return this.context.metricsHandler}get errorLogger(){return this.context.errorLogger}addEventListener(e,t){this.eventTarget.addEventListener(e,t),e in this.eventBuffer&&this.eventBuffer[e].length>0&&(this.eventBuffer[e].forEach((t=>{this.eventTarget.dispatchEvent(e,t)})),this.eventBuffer[e]=[])}hasEventListener(e){return this.eventTarget.hasEventListener(e)}removeEventListener(e,t){this.eventTarget.removeEventListener(e,t)}destroy(){return Promise.resolve(!0)}detach(){return Promise.resolve(!0)}dispatchEvent(e,t){this.hasEventListener(e)?this.eventTarget.dispatchEvent(e,t):(e in this.eventBuffer||(this.eventBuffer[e]=[]),this.eventBuffer[e].push(t))}withErrorHandling(e,t){var r=this.methodType,n=this.context;return Wa((function*(){var i=function(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}(t);try{n.metricsHandler.logEvent("".concat(i,":START"));var o=yield e(...arguments);return n.metricsHandler.logEvent("".concat(i,":OK"),"good"),o}catch(e){if(wi.isInstanceOf(e,pa(t)))throw n.metricsHandler.logEvent("".concat(i,":ERROR"),"good"),n.metricsHandler.logDeveloperError(e,t),e;throw n.metricsHandler.logEvent("".concat(i,":ERROR"),"bad"),["UnexpectedError","UnexpectedAnalyticsClientError"].includes(qi(e).name)||n.errorLogger.captureException(e),new Ln("using ".concat(r))}}))}throwIfDestroyed(){if(this.status===Ra.DESTROYED)throw new On(this.methodType)}throwIfDestroyedOrAlreadyAttached(){if(this.throwIfDestroyed(),this.status===Ra.ATTACHED)throw new Sn(this.methodType)}throwIfDestroyedOrNotAttached(){if(this.throwIfDestroyed(),this.status!==Ra.ATTACHED)throw new In(this.methodType)}}var Za={message:"the tokenization request is already in process",type:"TOKENIZATION_IN_PROCESS"};class Ja extends Error{constructor(e,t,r){super(`error loading script ${e}: ${t} ${r?r.toString():""}`),this.name="ScriptLoaderError",Object.setPrototypeOf(this,Ja.prototype)}}const Xa=new Map;function Qa(e){Xa.delete(e),document.getElementById(e)?.remove()}function es(e,t){const r=t();if(void 0!==r)return Promise.resolve(r);const n=Xa.get(e.id);if(void 0!==n)return n;const i=document.createElement("script");for(const t in e){const r=e[t];void 0!==r&&i.setAttribute(t,r)}const o=new Promise(((r,n)=>{i.onload=()=>{const i=t();void 0===i?(Qa(e.id),n(new Ja(e.src,"location returned undefined"))):r(i)},i.onerror=(t,r,i,o,a)=>{Qa(e.id),n(new Ja(e.src,"Unknown error occurred",a))}}));return Xa.set(e.id,o),document.body.appendChild(i),o}function ts(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rs(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ns(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function is(){var e;return e=function*(e,t,r){try{var n="square-payments-".concat(e,"-script"),i=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ts(Object(r),!0).forEach((function(t){rs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ts(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:n},t);return void 0===r?void(yield es(i,(()=>null!==document.getElementById(n)||void 0))):yield es(i,(()=>{var e,t;return"google.payments"===r?null===(e=window.google)||void 0===e?void 0:e.payments:"Square.utils.QRCodeFactory"===r?null===(t=window.Square.utils)||void 0===t?void 0:t.QRCodeFactory:window[r]}))}catch(e){throw new Cn(fa.UNABLE_TO_LOAD)}},is=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){ns(o,n,i,a,s,"next",e)}function s(e){ns(o,n,i,a,s,"throw",e)}a(void 0)}))},is.apply(this,arguments)}var os={load:function(e,t,r){return is.apply(this,arguments)}},as=Va({transactionId:Ga({nonBlank:!0})});function ss(e){return $a(as).validate(e).isValid?e.transactionId:_a()}const cs=["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"],ls=["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"];class us extends Error{constructor(e){super(e),this.name="InvalidAuthorizationParameter",Object.setPrototypeOf(this,us.prototype)}}Error,Error;class ds extends Error{constructor(e,t){super(`The listener provided for event type ${e} threw an error: ${t}`),this.name="InvalidEventListenerError",Object.setPrototypeOf(this,ds.prototype)}}class hs{constructor(){this.listeners=new Map,this.eventBuffer=new Map}addEventListener(e,t,r={}){if(!0===r.once){const r=t;t=n=>{this.removeEventListener(e,t),r(n)}}if(r.signal){if(r.signal.aborted)return;r.signal.addEventListener("abort",(()=>{this.removeEventListener(e,t)}))}const n=this.listeners.get(e);void 0===n?this.listeners.set(e,[t]):n.push(t);const i=this.eventBuffer.get(e);i&&(i.forEach((e=>{this.dispatchEvent(e)})),this.eventBuffer.set(e,[]))}removeEventListener(e,t){const r=this.listeners.get(e);if(void 0!==r)for(let e=0;e<r.length;e++)r[e]===t&&(r.splice(e,1),e--)}hasEventListener(e){const t=this.listeners.get(e);return void 0!==t&&t.length>0}dispatchEvent(e){if(this.hasEventListener(e.type)){const t=[...this.listeners.get(e.type)??[]];for(const r of t)try{r(e)}catch(t){throw new ds(e.type,t.message)}}else{const t=this.eventBuffer.get(e.type);void 0===t?this.eventBuffer.set(e.type,[e]):t.push(e)}}}class ps{constructor(){this.eventTarget=new hs}addEventListener(e,t){this.eventTarget.addEventListener(e,(e=>{t(e.detail)}))}dispatchEvent(e){this.eventTarget.dispatchEvent(new CustomEvent(e.type,{detail:e}))}}const fs={get DEV_ENV(){return"development"},get IFRAME_NAME(){return"authz"},get IFRAME_TITLE(){return"Square EFT Authorization"},get PRODUCTION_ENV(){return"production"},get SANDBOX_ENV(){return"sandbox"},get TEST_ENV(){return"test"},getDebitAuthHostname(e){switch(e){case this.PRODUCTION_ENV:return"https://connect.squareup.com";case this.SANDBOX_ENV:return"https://connect.squareupsandbox.com";default:return"https://connect.squareupstaging.com"}},getIframeSrc(e,t){return`${this.getSDKBaseUrlForEnv(e)}${"development"===e?"":`/${t}`}/ach-authz-sdk/enclave.html`},getSDKBaseUrlForEnv(e){switch(e){case"production":return"https://web.squarecdn.com";case"sandbox":return"https://sandbox.web.squarecdn.com";case"development":return"https://localhost:1779";default:return"https://staging.web.squarecdn.com"}}};class ms extends Error{constructor(e){super("Received error event from iframe"),this.event=e,this.name="IframeErrorEventError",Object.setPrototypeOf(this,ms.prototype)}}const vs=function(e,t){const r=document.createElement("iframe");return new Promise(((n,i)=>{r.onerror=e=>{i(new ms(e))},r.onload=()=>{n(r)},r.setAttribute("id","authz-enclave"),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("src",fs.getIframeSrc(e,t)),r.setAttribute("title",fs.IFRAME_TITLE),r.style.position="fixed",r.style.inset="0px",r.style.zIndex="2147483647",r.style.borderWidth="0px",r.style.display="block",r.style.overflow="hidden auto",document.body.append(r)}))},gs=function(e){e.parentElement?.removeChild(e)};class ys extends Error{constructor(e,t){super(e),this.severity=t??"error"}}class Es extends ys{constructor(e){super(e),this.name="IframeMessengerImplementationError",Object.setPrototypeOf(this,Es.prototype)}}class bs extends ys{constructor(e){super(e),this.name="IframeMessengerInternalMessageError",Object.setPrototypeOf(this,bs.prototype)}}class _s extends ys{constructor(e,t,r,n){void 0!==r?(super(`Messenger has not received an acknowledgement of message ${e} with id ${t} from iframe id=${r} which ${null===document.getElementById(r)?"does not exist":"exists"}`,n),this.iframeID=r):super(`Messenger has not received an acknowledgement of message ${e} with id ${t}, no iframeID was set`,n),this.type=e,this.id=t,this.name="IframeMessengerTimeoutError",Object.setPrototypeOf(this,_s.prototype)}}const Cs="channel:connected",Ss="channel:connecting",Is="channel:close",Os="channel:error";class ws{constructor(e){this.receiveMessage=e=>{switch(e.data){case this.messageWithName(Ss):this.handleConnecting(e);break;case this.messageWithName(Cs):this.handleConnected();break;case this.messageWithName(Is):this.close();break;case this.messageWithName(Os):break;default:this.handleMessage(e)}},this.connected=!1,this.listeners=[],this.messageBuffer=[],this.name=void 0!==e?`:${e}`:""}set onmessage(e){this.listeners.push(e)}close(){this.port&&(this.postMessage(this.messageWithName(Is)),this.port.close(),this.port=void 0,this.connected||window.removeEventListener("message",this.receiveMessage)),this.connected=!1}connect(e){if(this.connected)throw new Es("message channel is already connected");if(e){if(void 0===e.origin)throw new Es("message channel remote.origin must be defined");if(null===e.window)throw new Es("message channel remote.window cannot be null");const t=new MessageChannel;this.setupPort(t.port1),e.window.postMessage(this.messageWithName(Ss),e.origin,[t.port2])}else window.addEventListener("message",this.receiveMessage)}setErrorHandler(e){this.errorHandler=e}postMessage(e){this.port&&this.connected?this.port.postMessage(e):this.messageBuffer.push(e)}handleConnecting(e){if(this.connected)throw new Es("message channel should not be connecting because already connected");window.removeEventListener("message",this.receiveMessage),e.ports[0]&&(this.setupPort(e.ports[0]),this.postMessage(this.messageWithName(Cs)),this.connectionEstablished())}handleConnected(){if(this.connected)throw new Es("message channel already connected");this.connectionEstablished()}connectionEstablished(){for(this.connected=!0;this.messageBuffer.length>0;)this.postMessage(this.messageBuffer.shift())}handleMessage(e){this.listeners.forEach((t=>{t(e)}))}setupPort(e){this.port=e,this.port.onmessage=this.receiveMessage,this.port.onmessageerror=e=>{this.postMessage(this.messageWithName(Os)),this.errorHandler&&this.errorHandler(new Es("message channel failed to deserialize message"),e)}}messageWithName(e){return e+this.name}}function As(){return`${Date.now()}${Math.floor(8e3*Math.random())}`}const Ts=["ack","ok","error"];function Ps(e={}){let t,r;const{errorSerializer:n,payloadSerializer:i}=e,o=new ws(e.name),a=new Map;function s(e,t){const{messageType:r,listener:n}=e,i=a.get(r);if(i){const e=i.get(t);e?e.push(n):i.set(t,[n])}else a.set(r,new Map([[t,[n]]]))}function c(e){const c=function(e){if(!e.mustAcknowledge)return Promise.resolve(void 0);let o;const c=()=>{Ts.forEach((t=>{const r=a.get(`${e.type}:${t}`);void 0!==r&&r.delete(o)}))},l=window.setTimeout((()=>{!function(e){const n=new _s(e.type,e.id,r,"warning");t&&t(n,new MessageEvent(e.type,{data:e}))}(e)}),1e4);return new Promise(((t,r)=>{o=As(),s({listener(){clearTimeout(l),e.mustRespond||(c(),t(void 0))},messageType:`${e.type}:ack`},o),s({listener(e){c();const{payload:r}=e.data;if(void 0===i)t(r);else{const e=i.deserialize(r);t(e)}},messageType:`${e.type}:ok`},o),s({listener(e){c();const{payload:t}=e.data;if(void 0===n)r(t);else{const e=n.deserialize(t);r(e)}},messageType:`${e.type}:error`},o)}))}(e);return e.type&&"undefined"!==e.type||void 0===t||t(new bs("attempting to send a messenger message with an undefined type")),o.postMessage(e),c}function l(e,t,r){return c({id:t.id,mustAcknowledge:!1,mustRespond:!1,payload:r,type:e})}return o.onmessage=function(e){if(void 0===e.data.type||"undefined"===e.data.type)return void(void 0!==t&&t(new bs("Received a messenger message with an undefined type"),e));const r=a.get(e.data.type);if(r)!0===e.data.mustAcknowledge&&function(e){const t=`${e.type}:ack`;c({id:e.id,mustAcknowledge:!1,mustRespond:!1,payload:void 0,type:t})}(e.data),r.forEach((t=>{t.forEach((t=>{t(e)}))}));else{const r=e.data.type;t&&t(new Es(`Listener does not exist for ${r}. Add one to your messenger instance:\n            messenger.onMessage({\n                    listener: (msg) => {},\n                    messageType: '${r}',\n                });\n          `),e)}},Object.freeze({close:function(){o.close()},connect:function(e,t){o.connect(e),r=t},onMessage:function(e,t=As()){return s(e,t),t},reject:function(e,t){const r=`${e.type}:error`;let i=t;return void 0!==n&&(i=n.serialize(t)),l(r,e,i)},request:function(e,t){let r=t;return void 0!==t&&void 0!==i&&(r=i.serialize(t)),c({id:As(),mustAcknowledge:!0,mustRespond:!0,payload:r,type:e})},respond:function(e,t){const r=`${e.type}:ok`;let n=t;return void 0!==i&&(n=i.serialize(t)),l(r,e,n)},sendMessage:function(e,t){let r=t;return void 0!==t&&void 0!==i&&(r=i.serialize(t)),c({id:As(),mustAcknowledge:!0,mustRespond:!1,payload:r,type:e})},sendOneWayMessage:function(e,t){let r=t;return void 0!==t&&void 0!==i&&(r=i.serialize(t)),c({id:As(),mustAcknowledge:!1,mustRespond:!1,payload:r,type:e})},setErrorHandler:function(e){t=e,o.setErrorHandler(e)}})}const Ns=function(){return Ps({name:fs.IFRAME_NAME})},Ds=async function(e,t,r){const n=fs.getSDKBaseUrlForEnv(r);e.connect({origin:n,window:t.contentWindow},t.id),await e.sendMessage("INITIALIZE",{env:r})},Rs=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function Ls(e){const t=function(e){const t=Rs.exec(e);if(!t)throw new us("Date did not match the YYYY-MM-DD format");const[,r,n,i]=t.map(Number);return new Date(r,n-1,i)}(e);return{day:t.getDate(),month:t.getMonth()+1,weekday:cs[t.getDay()],year:t.getFullYear()}}function xs(e){return{applicationId:e.applicationId,avt:e.avt,featureFlagValues:e.featureFlagValues,idempotencyKey:e.idempotencyKey,locationId:e.locationId}}const ks={convert:function(e){return{...xs(e),accountHolderName:e.accountHolderName,accountUse:e.accountUse,bankNonce:e.bankNonce,countryCode:"CA",customerDetails:e.customerDetails,intent:e.intent,total:e.total}}},Ms={convert:function(e){const t={...xs(e),countryCode:"US"};if("CHARGE"===e.intent)return"bankNonce"in e?{...t,bankNonce:e.bankNonce,kind:"ONE_TIME_BANK_NONCE",total:e.total}:{...t,bankAccountId:e.bankAccountId,kind:"ONE_TIME_BANK_ACCOUNT_ID",total:e.total};const r=Ls(e.startDate);let n;n="frequency"in e?e.frequency:"WEEKLY"===e.cadence?{weekly:{daysOfWeek:[r.weekday],occurrence:1}}:{monthly:{days:{daysOfMonth:[r.day]}}};const i={...t,bankAccountId:e.bankAccountId,frequency:n,startDate:r};return"variableAmount"in e?{...i,kind:"VARIABLE_RECURRING"}:{...i,...void 0!==e.offCadencePayments&&{offCadencePayments:e.offCadencePayments.map((e=>({paymentOn:Ls(e.date),total:e.total})))},kind:"RECURRING",total:e.total}}},js={build(e,t){const r=Ns(),n=new ps;return Promise.resolve(Object.freeze({addEventListener:function(e,t){n.addEventListener(e,t)},captureAuthorization:async function(i){let o;try{const a=function(e){const t=void 0===e.countryCode?"US":e.countryCode;if("US"!==t&&"CA"!==t)throw new us(`Unsupported countryCode: ${String(t)}`);return"CA"===e.countryCode?ks.convert(e):Ms.convert({...e,countryCode:"US"})}(i);o=await vs(e,t),await Ds(r,o,e);const s=await r.request("CAPTURE_AUTHORIZATION",a);"success"===s.kind?n.dispatchEvent({token:s.token,type:"signed"}):n.dispatchEvent({type:"canceled"})}catch(e){n.dispatchEvent({error:e,type:"error"})}o&&gs(o)}}))}};function Us(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Bs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Us(Object(r),!0).forEach((function(t){qs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Us(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qs(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hs(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var Fs={build(e){var t=e.env,r=e.transactionId,n=e.session,i=e.context,o=e.onSigned,a=e.onCanceled,s=e.onError;function c(){var e;return e=function*(e,c,l){var u,d=null!=l?l:{onCanceled:a,onError:s,onSigned:o},h=yield js.build(t,_r.VERSION);i.metricsHandler.logEvent("ACH_AUTH:START"),h.addEventListener("signed",(function(t){d.onSigned(t.token,e.intent,..."bankAccountDetails"in e?[e.bankAccountDetails]:[]),i.metricsHandler.logEvent("ACH_AUTH:OK")})),h.addEventListener("canceled",(function(){i.metricsHandler.logEvent("ACH_AUTH:CANCEL"),d.onCanceled()})),h.addEventListener("error",(function(e){var t=e.error;t instanceof us?d.onError(new cn(t.message)):t.message.includes("The provided bank account ID was not found")?d.onError(new Rn([{message:t.message,type:"INVALID_BANK_ACCOUNT"}])):(d.onError(new Ln("authorizing the payment")),i.errorLogger.captureException(t)),i.metricsHandler.logEvent("ACH_AUTH:ERROR")})),yield h.captureAuthorization(Bs(Bs({},e),{},{applicationId:n.applicationId,avt:n.avt,featureFlagValues:(u=Bs(Bs({},i.getFeatureFlagValues()),void 0!==c&&{ach_architecture_changes:c}),{ach_architecture_changes:u.ach_architecture_changes,show_square_monochrome:u.show_square_monochrome}),idempotencyKey:r,locationId:n.locationId}))},c=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Hs(o,n,i,a,s,"next",e)}function s(e){Hs(o,n,i,a,s,"throw",e)}a(void 0)}))},c.apply(this,arguments)}return Object.freeze({run:function(e,t,r){return c.apply(this,arguments)}})}};function Vs(e,t){var r=e.map((e=>{switch(e.code){case"missing_property":return'Missing property: "'.concat(e.propertyPath,'" for ').concat(t,'. Expected "').concat(e.expected,'"');case"invalid_type":return'Invalid type: "'.concat(e.propertyPath,'" for ').concat(t,'. Expected "').concat(e.expected,'"');default:return'Invalid value: "'.concat(e.propertyPath,'" for ').concat(t,'. Expected "').concat(e.expected,'"')}}));return new cn(r.join("; "))}function Gs(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function zs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zs(Object(r),!0).forEach((function(t){Ys(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ys(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ws=Va({intent:Ua(Ga({legalValues:["CHARGE","STORE","RECURRING_CHARGE"]}))}),Ks=ja([{eligible:function(e){return eo(e)&&"bankAccountId"in e},schemaOperation:Va({bankAccountId:Ga({nonBlank:!0})})},{eligible:function(e){return eo(e)&&"accountHolderName"in e&&void 0===e.bankAccountId},schemaOperation:Va({accountHolderName:Ga({nonBlank:!0})})}],{code:"missing_property",expected:"string",propertyPath:"accountHolderName"}),Zs=Va({accountHolderName:Ga({nonBlank:!0})}),Js=Va({amount:Ga({matchRegexp:/^-?[0-9]+(\.[0-9]+)?$/}),currency:Ga({legalValues:["USD"]}),date:ka({futureDate:!0})}),Xs={bankAccountId:Ga({minLength:1}),offCadencePayments:Ua(Pa(Js,{minLength:1})),startDate:ka({futureDate:!0})},Qs=Va($s($s({},Xs),{},{cadence:Ga({legalValues:["WEEKLY","MONTHLY"]})})),ec=Va($s($s({},Xs),{},{frequency:Va({weekly:Va({daysOfWeek:Pa(Ga({legalValues:cs})),occurrence:Ua(Ma())})})})),tc=Va({daysOfMonth:Pa(Ma()),endOfMonth:Ua(Na())}),rc=Va($s($s({},Xs),{},{frequency:Va({monthly:Va({days:tc,occurrence:Ua(Ma())})})})),nc=Va($s($s({},Xs),{},{frequency:Va({yearly:Va({days:tc,months:Pa(Ga({legalValues:ls})),occurrence:Ua(Ma())})})})),ic=ja([{eligible:e=>eo(e)&&"daysOfMonth"in e,schemaOperation:Va({daysOfMonth:Pa(Ma())})},{eligible:e=>eo(e)&&"endOfMonth"in e,schemaOperation:Va({endOfMonth:Na()})}],{code:"missing_property",expected:"key value",propertyPath:"daysOfMonth or endOfMonth"}),oc=Va($s($s({},Xs),{},{frequency:Va({monthly:Va({days:ic,occurrence:Ua(Ma())})})})),ac=Va($s($s({},Xs),{},{frequency:Va({yearly:Va({days:ic,months:Pa(Ga({legalValues:ls})),occurrence:Ua(Ma())})})})),sc=Va($s($s({},Xs),{},{frequency:Va({days:Ma()})}));function cc(e,t){return eo(e)&&"frequency"in e&&Qi(e.frequency)&&1===Object.keys(e.frequency).length&&t in e.frequency}var lc=ja([{eligible:e=>eo(e)&&"cadence"in e,schemaOperation:Qs},{eligible:e=>cc(e,"days"),schemaOperation:sc},{eligible:e=>cc(e,"weekly"),schemaOperation:ec},{eligible:e=>cc(e,"monthly"),schemaOperation:rc},{eligible:e=>cc(e,"yearly"),schemaOperation:nc}],{code:"invalid_value",expected:"exactly one of the keys: days, weekly, monthly, yearly",propertyPath:"frequency"}),uc=ja([{eligible:e=>eo(e)&&"cadence"in e,schemaOperation:Qs},{eligible:e=>cc(e,"days"),schemaOperation:sc},{eligible:e=>cc(e,"weekly"),schemaOperation:ec},{eligible:e=>cc(e,"monthly"),schemaOperation:oc},{eligible:e=>cc(e,"yearly"),schemaOperation:ac}],{code:"invalid_value",expected:"exactly one of the keys: days, weekly, monthly, yearly",propertyPath:"frequency"}),dc=ja([{eligible:e=>eo(e)&&!("total"in e),schemaOperation:Va({amount:Ga({nonBlank:!0}),currency:Ga({nonBlank:!0})})},{eligible:e=>eo(e)&&"total"in e,schemaOperation:Va({total:Va({amount:Ma(),currencyCode:Ga({nonBlank:!0})})})}],{code:"missing_property",expected:"string",propertyPath:"amount, currency"});function hc(e,t,r){if(!eo(e))throw new cn("Tokenize options must be an object.");var n,i,o=e;if("intent"in o){var a=$a(Ws).validate(e);if(!a.isValid){var s=(n=a.issues,i=1,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Gs(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gs(e,t):void 0}}(n,i)||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.")}())[0];throw new cn("Unsupported ".concat(s.propertyPath,". Must be one of: ").concat(s.expected))}!function(e,t){if("CHARGE"===e.intent)pc($a(Ks).validate(e)),fc(e);else if("STORE"===e.intent)pc($a(Zs).validate(e));else{!0!==e.variableAmount&&fc(e);var r=$a(uc).validate(e);$a(lc).logValidationFailures(t,qr.ACH,"tokenize",e),pc(r)}}(o,r)}else{if("SUPPORTED"!==t)throw new cn("Invalid parameter format for ACH tokenize");if(!$a(Zs).validate(o).isValid)throw new zr}}function pc(e){if(!e.isValid)throw Vs(e.issues,"ACH tokenize")}function fc(e){pc($a(dc).validate(e))}function mc(e){return"total"in e?e.total:{amount:wi.paymentRequestAmountToMoneyAmount(e.amount,e.currency),currencyCode:e.currency}}function vc(){return{status:Hr}}function gc(e,t,r){var n={method:qr.ACH};return void 0!==r&&(n.ach={intent:r}),t&&(n.bankAccount=t),{details:n,status:Gr,token:e}}var yc=function(){var e=document.createElement("div");return e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100vw",e.style.height="100%",e.style.zIndex="3",e.style.backgroundColor="rgba(0, 0, 0, 0.8)",e.style.opacity="0",document.body.appendChild(e),e.style.transition="opacity ".concat("cubic-bezier(0.26, 0.1, 0.48, 1)"," ").concat("0.24s"),setTimeout((function(){e.style.opacity="1"})),new Promise((function(t){setTimeout((function(){t(e)}),240)}))},Ec=function(e){e&&(e.style.transition="opacity ".concat("cubic-bezier(0.52, 0, 0.74, 0)"," ").concat("0.16s"),setTimeout((function(){e.style.opacity="0"})),setTimeout((function(){e.remove()}),160))};function bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}class _c{constructor(e){this.id=_a(),this.context=e}request(e,t){return this.context.messenger.request(e,{body:t,featureFlagValues:this.context.getFeatureFlagValues(),paymentMethodInstanceId:this.id,paymentMethodTrackingId:this.context.getPaymentMethodTrackingId(),session:this.context.getSession()})}initializeMessageBus(e){var t,r=this,n=function(){var e,n,o=(e=i,n=2,t=function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,n)||function(e,t){if(e){if("string"==typeof e)return bc(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bc(e,t):void 0}}(e,n)||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.")}())[0],a=t[1];r.context.messenger.onMessage({listener(e){a(e)},messageType:"".concat(o,":").concat(r.id)})};for(var i of Object.entries(e))n()}}function Cc(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var Sc=new Set(["ITEM_ERROR","INSTITUTION_ERROR"]),Ic=new Set(["en","es"]);function Oc(){var e;return null!==(e=a.windowNavigatorLanguages.map((e=>e.split("-")[0])).find((e=>Ic.has(e))))&&void 0!==e?e:"en"}function wc(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Ac(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){wc(o,n,i,a,s,"next",e)}function s(e){wc(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Tc={build(e,t,r,n){var i=new _c(e),o=function(e,t,r,n){var i;function o(){var a;return a=function*(){var o=yield function(e,t){var r=e.getSession();if(void 0===r.locationId||""===r.locationId)throw new Ln("locationId not defined when creating OAuth Plaid Link Session");var n={createOAuthPlaidLinkSessionRequest:{clientId:r.applicationId,languageCode:Oc(),locationId:r.locationId,redirectUri:""}};return t.request("CREATE_OAUTH_PLAID_LINK_SESSION",n)}(t,r);return function(r){return new Promise(((o,a)=>{var s,c=t.errorLogger,l=t.metricsHandler,u=void 0!==(s=n.countryCode)?{countryCode:s,errorPaymentMethod:"Bank",rejectOnExitError:!0}:{countryCode:"US",errorPaymentMethod:"ACH",rejectOnExitError:!1},d="sandbox";function h(e,t,r){var n,i,o,a=new ui("Plaid error received",u.errorPaymentMethod),s={plaid_context:e,plaid_error_code:"error_code"in t?t.error_code:null!==(n=null==r?void 0:r.error_code)&&void 0!==n?n:"",plaid_error_message:"error_message"in t?t.error_message:null!==(i=null==r?void 0:r.error_message)&&void 0!==i?i:"",plaid_error_type:"error_type"in t?t.error_type:null!==(o=null==r?void 0:r.error_type)&&void 0!==o?o:"",plaid_link_session_id:t.link_session_id,plaid_request_id:"request_id"in t?t.request_id:"",plaid_status:"status"in t?t.status:"",plaid_timestamp:"timestamp"in t?t.timestamp:""};return c.captureException(a,s),a}"production"===_r.env&&(d="production"),i=e.create({clientName:"Square, Inc.",countryCodes:[u.countryCode],env:d,language:Oc(),onEvent:(e,t)=>{e!==Nr.ERROR||Sc.has(t.error_type)||h("onEvent error",t),n.onEvent(e,t)},onExit:(e,t)=>{if(e){l.logEvent("EXTERNAL_SESSION:ERROR");var r=Sc.has(e.error_type)?new ui("Plaid error received",u.errorPaymentMethod):h("onExit",t,e);if(u.rejectOnExitError)return void a(r)}o({kind:"canceled"})},onSuccess:(e,t)=>{if(0!==t.accounts.length)l.logEvent("EXTERNAL_SESSION:OK"),o({gringottsSessionToken:r.gringottsSessionToken,kind:"success",publicToken:e,selectedBankAccountId:t.accounts[0].id});else{l.logEvent("EXTERNAL_SESSION:ERROR");var n=h("noAccountSelected",t);a(n)}},product:["auth"],token:r.plaidLinkToken}),l.logEvent("EXTERNAL_SESSION:START"),i.open()}))}(o)},o=function(){var e=this,t=arguments;return new Promise((function(r,n){var i=a.apply(e,t);function o(e){Cc(i,r,n,o,s,"next",e)}function s(e){Cc(i,r,n,o,s,"throw",e)}o(void 0)}))},o.apply(this,arguments)}return{beginFlow:function(){return o.apply(this,arguments)},destroy:function(){i&&(i.exit({force:!0}),i.destroy(),i=void 0)}}}(t,e,i,{countryCode:null==n?void 0:n.countryCode,onEvent:r});function a(){return a=Ac((function*(e){var t=yield o.beginFlow();if("success"===t.kind){var r=yield function(e,t,r,n){return s.apply(this,arguments)}(e.accountHolderName,t.publicToken,t.selectedBankAccountId,t.gringottsSessionToken);return r}return{status:"cancelled"}})),a.apply(this,arguments)}function s(){return(s=Ac((function*(t,r,n,o){var a=e.getSession(),s={accountHolderName:t,gringottsSessionToken:o,plaidPublicToken:r,selectedPlaidBankAccountId:n},c={bankNonceRequest:{clientId:a.applicationId,instanceId:a.instanceId,locationId:a.locationId,paymentMethodTrackingId:e.getPaymentMethodTrackingId(),plaidLinkData:s,sessionId:a.sessionId,websdkVersion:_r.VERSION}};try{var l=yield i.request("REQUEST_ACH_BANK_NONCE",c);return e.setPaymentMethodTrackingId(l.paymentMethodTrackingId),{accountDetails:l.accountDetails,bankNonce:l.bankNonce,status:"successful"}}catch(e){throw e instanceof Rn?e:new Rn([Ai])}}))).apply(this,arguments)}return Object.freeze({destroy:function(){o.destroy()},run:function(e){return a.apply(this,arguments)}})}};function Pc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Nc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pc(Object(r),!0).forEach((function(t){Dc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dc(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rc(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Lc(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Rc(o,n,i,a,s,"next",e)}function s(e){Rc(o,n,i,a,s,"throw",e)}a(void 0)}))}}class xc extends Ka{constructor(e,t,r){super(e),this.methodType=qr.ACH,this.tokenizeInProgress=!1,this.wasFirstInteractionCalled=!1,this.transactionId=ss(r),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.plaidNonceFlow=Tc.build(this.context,t,this.dispatchPlaidEvent.bind(this)),this.achAuthFlow=Fs.build({context:this.context,env:_r.env,onCanceled:this.dispatchCancelResult.bind(this),onError:this.dispatchError.bind(this),onSigned:this.dispatchSuccessfulTokenResult.bind(this),session:this.session,transactionId:this.transactionId})}handleLegacyFlow(e){var t=this;return Lc((function*(){t.context.metricsHandler.logEvent("ACH_LEGACY:START");var r=yield t.runPlaidFlow(e.accountHolderName);switch(t.context.metricsHandler.logEvent("ACH_LEGACY:OK"),r.status){case"successful":t.resetFirstInteraction();var n=gc(r.bankNonce,r.accountDetails);return t.dispatchTokenizationEvent(n),n;case"cancelled":var i=vc();return t.dispatchTokenizationEvent(i),i;default:throw new Error("Unexpected tokenize flow status")}}))()}tokenize(e){var t=this;return Lc((function*(){try{if(t.throwIfDestroyed(),t.tokenizeInProgress)throw new Rn([Za]);if(hc(e,t.context.getFeatureFlagValues().can_use_ach_auth,t.metricsHandler),!t.hasEventListener(Nr.ON_TOKENIZATION)){var r="Add event listener for '".concat(Nr.ON_TOKENIZATION,"' before calling tokenize.");console.error("".concat(r," This will result in an error when using the Plaid OAuth flow."))}if(t.tokenizeInProgress=!0,t.handleFirstInteraction(),t.metricsHandler.logConfigurationEvent("TOKENIZE_CONFIGURED",e),!function(e){return"intent"in e}(e))return yield t.handleLegacyFlow(e);switch(t.veil=yield yc(),e.intent){case"STORE":var n=yield t.runPlaidFlow(e.accountHolderName);"successful"===n.status?t.dispatchSuccessfulTokenResult(n.bankNonce,e.intent,n.accountDetails):t.dispatchTokenizationEvent(vc());break;case"CHARGE":var i=(l=e,$s($s({},$a(Ks).sanitize(l)),{},{intent:"CHARGE",total:mc(l)}));if("bankAccountId"in i)yield t.achAuthFlow.run(i);else{var o=yield t.runPlaidFlow(i.accountHolderName);"successful"===o.status?yield t.achAuthFlow.run({bankAccountDetails:o.accountDetails,bankNonce:o.bankNonce,intent:i.intent,total:i.total}):t.dispatchTokenizationEvent(vc())}break;case"RECURRING_CHARGE":var a={bankAccountId:e.bankAccountId,intent:e.intent,startDate:e.startDate};if("variableAmount"in e){"frequency"in e?yield t.achAuthFlow.run(Nc(Nc({},a),{},{frequency:e.frequency,variableAmount:!0})):"cadence"in e&&(yield t.achAuthFlow.run(Nc(Nc({},a),{},{cadence:e.cadence,variableAmount:!0})));break}var s=Nc(Nc({},a),{},{total:mc(e)},void 0!==e.offCadencePayments&&{offCadencePayments:e.offCadencePayments.map((e=>({date:e.date,total:mc(e)})))});"cadence"in e?yield t.achAuthFlow.run(Nc(Nc({},s),{},{cadence:e.cadence})):yield t.achAuthFlow.run(Nc(Nc({},s),{},{frequency:e.frequency}))}return}catch(e){var c=qi(e);throw t.dispatchError(c),c}finally{t.tokenizeInProgress=!1,Ec(t.veil)}var l}))()}runPlaidFlow(e){var t=this;return Lc((function*(){return yield t.plaidNonceFlow.run({accountHolderName:e})}))()}destroy(){return this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),this.plaidNonceFlow.destroy(),Promise.resolve(!0)}addEventListener(e,t){this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}resetFirstInteraction(){this.wasFirstInteractionCalled=!1}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK"))}dispatchCancelResult(){this.dispatchTokenizationEvent(vc())}dispatchSuccessfulTokenResult(e,t,r){this.resetFirstInteraction();var n=gc(e,r,t);this.dispatchTokenizationEvent(n)}dispatchError(e){this.dispatchEvent(Nr.ON_TOKENIZATION,{error:e})}dispatchPlaidEvent(e,t){this.dispatchEvent(e,t)}dispatchTokenizationEvent(e){this.dispatchEvent(Nr.ON_TOKENIZATION,{tokenResult:e})}}var kc=()=>os.load("plaid-link",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js"},"Plaid"),Mc=new Set(["DIV","SPAN"]),jc=new Set(["DIV","SPAN"]),Uc=new Set(["DIV","SPAN","BUTTON"]);function Bc(e,t){var r;if(function(e){return"string"==typeof e}(e)){var n=document.querySelector(e);if(!n)throw new nn(e);r=n}else{if(!(e instanceof HTMLElement))throw new wn(e,t);if(r=e,!document.contains(r))throw new nn(r)}if(!t.has(r.nodeName))throw new wn(r,t);return r}function qc(e){return Bc(e,Mc)}function Hc(e){return Bc(e,Uc)}function Fc(e){return Bc(e,jc)}var Vc="sq-focus",Gc="sq-error",zc=".".concat(Vc),$c=".".concat(Gc),Yc="sq-apply-monochrome",Wc=function(e,t,r){return new Promise(((n,i)=>{if(function(e){return Boolean(document.getElementById(e))}(t))n();else{var o=document.createElement("link");o.onload=()=>{n()},o.onerror=()=>{i(new Error("Failed to load stylesheet at ".concat(e,". The onerror callback was invoked.")))},o.href=e,o.rel="stylesheet",o.type="text/css",o.id=t,r.appendChild(o)}}))},Kc=["black","green","mint"],Zc=Object.freeze({UPDATE:"update"});function Jc(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sanitizeFunction:e=>e,validateFunction:function(r,n){var i=Oa(r,n,"string",{}),o=r,a=/^-?[0-9]+$/;return"JPY"!==e&&(a=/^-?[0-9]+(\.([0-9]{1,2}))?$/),i.push((()=>Ia(o,n,(e=>a.test(e)),"amount is not expressed in a valid format"))),("requireNonNegativeAmount"in t||"requirePositiveAmount"in t||!0===t.requireSafeIntegerAmount)&&i.push((()=>{var r=wi.paymentRequestAmountToMoneyAmount(o,e);return"requireNonNegativeAmount"in t&&!0===t.requireNonNegativeAmount&&r<0?[{code:"invalid_value",expected:"amount should be non-negative",propertyPath:n}]:"requirePositiveAmount"in t&&!0===t.requirePositiveAmount&&r<=0?[{code:"invalid_value",expected:"amount should be greater than zero",propertyPath:n}]:!0!==t.requireSafeIntegerAmount||Number.isSafeInteger(r)?[]:[{code:"invalid_value",expected:"amount should convert to a safe integer in minor currency units",propertyPath:n}]})),wa(i)}}}r(488);var Xc={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua And Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Finland",AZ:"Azerbaijan",BA:"Bosnia And Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria (rep.)",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthelemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius, And Saba",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos (keeling) Islands",CD:"Congo (dem. Rep.)",CF:"Central African Republic",CG:"Congo (rep.)",CH:"Switzerland",CI:"Cote D'ivoire",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CV:"Cape Verde",CW:"Curacao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czech Rep.",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Rep.",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands (malvinas)",FM:"Micronesia (federated State Of)",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada (west Indies)",GE:"Georgia",GF:"French Guiana",GG:"Channel Islands",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia",GT:"Guatemala",GU:"Guam",GW:"Guinea-bissau",GY:"Guyana",HK:"Hong Kong",HM:"Heard And Mcdonald Islands",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary (rep.)",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle Of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Channel Islands",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts And Nevis",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Lao (people's Dem. Rep.)",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Rep. Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru Central Pacific",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama (rep.)",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"St. Pierre And Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestinian Territory",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Reunion",RO:"Romania",RS:"Republic Of Serbia",RU:"Russian Federation",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SE:"Sweden",SG:"Rep. Of Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard And Jan Mayen Islands",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome And Principe",SV:"El Salvador",SX:"Sint Maarten",SZ:"Swaziland",TC:"Turks And Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad And Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania (united Rep.)",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VA:"Vatican",VC:"Saint Vincent And The Grenadines (antilles)",VE:"Venezuela",VG:"Virgin Islands (british)",VI:"Virgin Islands (u.s.)",VN:"Viet Nam",VU:"Vanuatu",WF:"Wallis And Futuna Islands",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"};function Qc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function el(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qc(Object(r),!0).forEach((function(t){tl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function tl(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rl=Va({amount:Ga(),label:Ga()}),nl=Va({amount:Ga(),id:Ga(),label:Ga()}),il=Va({discounts:Ua(Pa(rl)),error:Ua(Ga()),lineItems:Ua(Pa(rl)),shippingErrors:Ua(Va()),shippingLineItems:Ua(Pa(rl)),shippingOptions:Ua(Pa(nl)),taxLineItems:Ua(Pa(rl)),total:Ua(rl)});function ol(e,t){var r=e.lineItems,n=e.taxLineItems,i=e.discounts,o=e.shippingLineItems,a=!1,s=[],c=r,l=n,u=o,d=ll(i);return void 0===t||void 0===r&&void 0===n&&void 0===o&&void 0===d||(null!=c||(c=t.lineItems),null!=l||(l=t.taxLineItems),null!=d||(d=ll(t.discounts)),null!=u||(u=t.shippingLineItems)),[c,l,d,u].forEach((e=>{void 0!==e&&(a=!0,s.push(...e))})),a?s:void 0}function al(e,t,r,n){$a(Va({amount:Jc(t)})).logValidationFailures(r,"Payment Request",n,e)}var sl=Va({countryCode:Ga(),currencyCode:Ga(),total:Va({amount:Ga(),label:Ga()})});function cl(e){var t=$a(sl).validate(e),r=t.isValid,n=t.issues.map((e=>[e.propertyPath,e.expected])),i=[],o=e.countryCode;if(o in Xc||i.push("Country code '".concat(o,"' is not a valid ISO country code.")),!r||i.length>0)throw new on(n,i)}function ll(e){return void 0===e?e:e.map((e=>el(el({},e),{},{amount:"-".concat(e.amount)})))}function ul(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dl(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dl(e,t):void 0}}(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 dl(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var hl="".concat(_r.ASSET_URL,"/afterpay.css"),pl="sq-afterpay-styles",fl={production:{marketplace:"https://js.squarecdn.com/square-marketplace.js",messaging:"https://js.afterpay.com/afterpay-1.x.js"},sandbox:{marketplace:"https://js-sandbox.squarecdn.com/square-marketplace.js",messaging:"https://js.afterpay.com/afterpay-1.x.js"},staging:{marketplace:"https://portal.stage.afterpay-beta.com/square-marketplace.js",messaging:"https://js.sandbox.afterpay.com/afterpay-1.x.js"}},ml=Va({addressLines:Aa(),city:Ga(),countryCode:Ga(),familyName:Ga(),givenName:Ga(),postalCode:Ga(),state:Ga()}),vl=Va({amount:Ga(),id:Ga(),label:Ga(),taxLineItems:Ua(Pa(rl)),total:rl}),gl=ja([{eligible:e=>eo(e)&&"shippingOptions"in e,schemaOperation:Va({shippingOptions:Pa(vl)})},{eligible:e=>eo(e)&&"error"in e,schemaOperation:Va({error:Aa()})},{eligible:e=>eo(e)&&"shippingErrors"in e,schemaOperation:Va({shippingErrors:Aa()})}],{code:"missing_property",expected:"object",propertyPath:"shippingOptions, error, or shippingErrors"}),yl=ja([{eligible:e=>eo(e)&&"shippingOption"in e,schemaOperation:Va({shippingOption:vl})},{eligible:e=>eo(e)&&"error"in e,schemaOperation:Va({error:Aa()})}],{code:"missing_property",expected:"object",propertyPath:"shippingOption or error"}),El="#000",bl="#00d533",_l="#b2fce4",Cl={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:El,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_Checkout_Button_Black-White.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:El,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_BuyNow_Button_Black-White.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:El,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_PlaceOrder_Button_Black-White.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_Checkout_Button_Mint-Black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_BuyNow_Button_Mint-Black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_PlaceOrder_Button_Mint-Black.svg"}}},Sl={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:El,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/checkout-with-afterpay/color-on-black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:El,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/buy-with-afterpay/color-on-black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:El,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/place-order-with-afterpay/color-on-black.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:bl,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/checkout-with-afterpay/black-on-green.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:bl,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/buy-with-afterpay/black-on-green.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:bl,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/place-order-with-afterpay/black-on-green.svg"}}},Il={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:El,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_Checkout_Button_Black-White.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:El,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_BuyNow_Button_Black-White.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:El,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_PlaceOrder_Button_Black-White.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_Checkout_Button_Mint-Black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_BuyNow_Button_Mint-Black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_PlaceOrder_Button_Mint-Black.svg"}}},Ol={AU:"AFTERPAY",CA:"AFTERPAY",NZ:"AFTERPAY",US:"AFTERPAY_CASHAPP"},wl={AFTERPAY:Cl,AFTERPAY_CASHAPP:Sl,CLEARPAY:Il};function Al(e,t){var r=0;return e.forEach((e=>{r+=wi.paymentRequestAmountToMoneyAmount(e,t)})),wi.moneyAmountToPaymentRequestAmount(r,t)}function Tl(e,t){return Al(e.map((e=>e.amount)),t)}function Pl(e){return e.requestShippingContact&&void 0!==e.lineItems&&e.lineItems.length>0}function Nl(e,t){var r,n;return{description:"",id:e.id,name:e.label,orderAmount:{amount:null!==(r=e.total.amount)&&void 0!==r?r:"0.00",currency:t},shippingAmount:{amount:e.amount,currency:t},taxAmount:{amount:Tl(null!==(n=e.taxLineItems)&&void 0!==n?n:[],t),currency:t}}}var Dl={buildAfterpayContact:function(e){return{area1:e.city,countryCode:e.countryCode,line1:e.addressLines[0],line2:e.addressLines[1],name:"".concat(e.givenName," ").concat(e.familyName),phoneNumber:e.phone,postcode:e.postalCode,region:e.state}},buildDiscounts:function(e,t){return e.map((e=>({amount:{amount:e.amount,currency:t},displayName:e.label})))},buildLineItems:function(e,t){return e.map((e=>({imageUrl:e.imageUrl,name:e.label,pageUrl:e.productUrl,price:{amount:e.amount,currency:t},quantity:1,sku:e.id})))},shippingOption:Nl,shippingOptions:function(e,t){return e.shippingOptions.map((e=>Nl(e,t.currencyCode)))},totalAmount:function(e){if(Pl(e)){var t=Tl(e.lineItems,e.currencyCode);return e.discounts&&(t=Al([t,(r=e.discounts,n=e.currencyCode,"-".concat(Tl(r,n)))],e.currencyCode)),{amount:t,currency:e.currencyCode}}var r,n;return{amount:Al([e.total.amount],e.currencyCode),currency:e.currencyCode}}},Rl=function(e){var t,r,n=[];if([e.address1,e.address2].forEach((e=>{void 0!==e&&n.push(e)})),e.name){var i=ul(e.name.split(/\s(?=\S+$)/),2);t=i[0],r=i[1]}return{addressLines:n,city:e.suburb,countryCode:e.countryCode,familyName:r,givenName:t,phone:e.phoneNumber,postalCode:e.postcode,state:e.state}},Ll=function(e){return{amount:e.shippingAmount.amount,id:e.id,label:e.name}},xl=function(e){return $a(ml).validate(e,"shippingContact")};function kl(e){var t=Dl.totalAmount(e);if(wi.paymentRequestAmountToMoneyAmount(t.amount,t.currency)<=0)throw Pl(e)?new Xr("Total line item amount must be greater than zero"):new Xr("Total amount must be greater than zero")}function Ml(e){var t,r=ul(e.split("-"),2),n=(r[0],r[1]);return null!==(t=Ol[n])&&void 0!==t?t:"CLEARPAY"}function jl(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var Ul=[25,50,75,100];function Bl(e){return"CLEARPAY"===Ml(e)?"clearpay-brand.svg":"afterpay-brand.svg"}class ql{constructor(e,t){this.attached=!1,this.req=e,this.context=t,this.locale=this.context.getSession().locale,this.currencyCode=this.req.currencyCode;var r=this.context.getLocaleString().paymentMethods.afterpay.checkoutWidget,n=r.today,i=r.weeks;this.periodText=[n,"2 ".concat(i),"4 ".concat(i),"6 ".concat(i)],e.addEventListener(Zc.UPDATE,(()=>{this.update()}))}attach(e,t){var r,n=this;return(r=function*(){n.element=e;try{yield Wc(hl,pl,document.head)}catch(e){throw new Ln("attaching the Afterpay Checkout Widget")}var r=n.buildAmounts().map((e=>wi.moneyAmountToInternationalizedCurrency(e,n.currencyCode,n.locale))),i=!1;!0===(null==t?void 0:t.includeBranding)&&(i=!0);var o,a=Bl(n.locale),s='\n      <div class="sq-ap__checkout-widget-container">\n        '.concat(i?'<div class="sq-ap__wordmark">\n                <img id="ap-wordmark-image" src="'.concat(_r.staticAsset(a),'"/>\n              </div>'):"",'\n        <p class="sq-ap__checkout-title">').concat(n.context.getLocaleString().paymentMethods.afterpay.checkoutWidget.title,'</p>\n        <div class="sq-ap__payment-container">\n          ').concat(r.map(((e,t)=>'\n              <div id="ap-payment-container-'.concat(t,'" class="sq-ap__individual-payment">\n                <div class="sq-ap__harvey-ball-container">\n                  ').concat(function(e){var t=12,r=2*Math.PI*6,n=r*Ul[e]/100;return'\n      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '.concat(24," ").concat(24,'" class="sq-ap__harvey-ball">\n        <circle\n          r="').concat(t,'"\n          cx="').concat(t,'"\n          cy="').concat(t,'"\n          fill="white"\n        />\n        <circle\n          r="').concat(6,'"\n          cx="').concat(t,'"\n          cy="').concat(t,'"\n          fill="none"\n          stroke="').concat("#B2FCE4",'"\n          stroke-width="').concat(t,'"\n          stroke-dasharray="').concat(n," ").concat(r,'"\n          transform="rotate(-90) translate(-').concat(24,')"\n        />\n        <circle\n          r="').concat(t,'"\n          cx="').concat(t,'"\n          cy="').concat(t,'"\n          fill="none"\n          stroke-width="2"\n          stroke="black"\n       />\n      </svg>\n    ')}(t),'\n                </div>\n                <p id="ap-payment-amount-').concat(t,'" class="sq-ap__amount">').concat(e,'</p>\n                <p class="sq-ap__period">').concat(n.periodText[t],"</p>\n              </div>\n            "))).join(""),"\n        </div>\n      </div>\n    ");n.element.insertAdjacentHTML("afterbegin",s),n.context.getFeatureFlagValues().show_square_monochrome&&(null===(o=n.element.querySelector(".sq-ap__checkout-widget-container"))||void 0===o||o.classList.add(Yc)),n.attached=!0},function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function a(e){jl(o,n,i,a,s,"next",e)}function s(e){jl(o,n,i,a,s,"throw",e)}a(void 0)}))})()}update(){if(this.attached&&this.element){var e=document.getElementById("ap-wordmark-image");if(e){var t=Bl(this.locale);e.src=_r.staticAsset(t)}this.buildAmounts().map((e=>wi.moneyAmountToInternationalizedCurrency(e,this.currencyCode,this.locale))).forEach(((e,t)=>{var r,n=null===(r=this.element)||void 0===r?void 0:r.querySelector("#ap-payment-amount-".concat(t));n&&(n.innerHTML=e)}))}}buildAmounts(){var e=wi.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode),t=e/4;switch(e%4){case 0:return Hl(t,0);case 1:return Hl(t,1);case 2:return Hl(t,-2);case 3:return Hl(t,-1);default:return[]}}}function Hl(e,t){var r=Array.from({length:3}).fill(Math.round(e));return r.push(e+t),r}function Fl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Vl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fl(Object(r),!0).forEach((function(t){Gl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Gl(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zl(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function $l(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){zl(o,n,i,a,s,"next",e)}function s(e){zl(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Yl=new Set(["en_US","en_CA","fr_CA","en_AU","en_NZ","en_GB","fr_FR","es_ES","it_IT"]),Wl=new Set(["AUD","GBP","USD","CAD","EUR"]);class Kl extends Ka{constructor(e,t,r,n,i){if(super(n),this.methodType=qr.AFTERPAY_CLEARPAY,this.onTokenizeCallbacks=[],this.tokenizationBuffer=[],this.wasFirstInteractionCalled=!1,this.onTokenizeHandlerAdded=!1,this.transferOptions={},this.buyNowOption=!1,this.afterpayLibrary=e,this.afterpayMessagingLibrary=t,this.req=r,this.paymentRequestLockController=i,this.paymentMessenger=new _c(this.context),this.total=this.totalMoney(),void 0===this.session.locationId||""===this.session.locationId)throw new Cn(fa.INVALID_CONFIG,"locationId");this.locationID=this.session.locationId,this.req.addPaymentMethodUsage("AfterpayClearpay"),kl(this.req),this.req.addEventListener("update",(()=>{delete this.checkoutTokenResponse,this.element&&this.initializeAfterpayPopup(this.element),this.total=this.totalMoney()})),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.attachMessaging=this.withErrorHandling(this.attachMessaging.bind(this),"attachMessaging")}attach(e,t){var r=this;return $l((function*(){r.throwIfDestroyedOrAlreadyAttached(),r.status=Ra.ATTACHED,r.metricsHandler.logConfigurationEvent("CONFIGURED",t);try{var n=Hc(e);if(!0!==(null==t?void 0:t.useCustomButton)){var i,o,a=document.createElement("div");n.appendChild(a);var s=a.attachShadow({mode:"open"});yield Wc(hl,pl,s);var c=null!==(i=null==t?void 0:t.buttonColor)&&void 0!==i?i:Dr.BLACK;c===Dr.MINT&&console.warn("The 'mint' option has been deprecated. Please use 'green' instead.");var l=null!==(o=null==t?void 0:t.buttonType)&&void 0!==o?o:Rr.BuyNowWithAfterpay;if(p=c,!Kc.includes(p))throw new dn("buttonColor",c);var u=function(e,t){var r="mint"===e?"green":e;return wl[Ml(t)][r]}(c,r.session.locale);if(!(l in u))throw new dn("buttonType",l);var d=u[l],h=document.createElement("button");h.setAttribute("type","button"),h.setAttribute("class","sq-ap__button"),r.context.getFeatureFlagValues().show_square_monochrome&&h.classList.add(Yc),h.style.backgroundColor=d.backgroundColor,h.style.backgroundImage="AFTERPAY_CDN"===d.cdn?"url(".concat(d.url,")"):"url(".concat(_r.staticAsset(d.url),")"),s.append(h)}r.buyNowOption=(null==t?void 0:t.finalCtaButtonType)===Lr.BUY_NOW,r.initializeAfterpayPopup(n),r.element=n,r.onTokenizeHandlerAdded&&r.element.addEventListener("click",(()=>{r.openPaymentModal()}))}catch(e){throw r.status=Ra.DETACHED,e}var p}))()}attachMessaging(e,t){this.throwIfDestroyed(),Fc(e);var r={amount:Number(this.req.total.amount),currency:this.req.currencyCode,locale:this.session.locale};return void 0!==(null==t?void 0:t.badgeTheme)&&(r.badgeTheme=t.badgeTheme),void 0!==(null==t?void 0:t.modalLinkStyle)&&(r.modalLinkStyle=t.modalLinkStyle),void 0!==(null==t?void 0:t.modalTheme)&&(r.modalTheme=t.modalTheme),void 0!==(null==t?void 0:t.size)&&(r.size=t.size),this.afterpayMessagingLibrary.createPlacements({attributes:r,targetSelector:e}),Promise.resolve()}attachCheckoutWidget(e,t){var r=this;return $l((function*(){if(!Wl.has(r.req.currencyCode))throw new Xr("Currency is not supported by Afterpay. Valid currencies are: ".concat([...Wl].join(", ")));var n=Fc(e);if(r.metricsHandler.logConfigurationEvent("AFTERPAY_CHECKOUT_WIDGET_CONFIGURED",{checkoutWidgetLaunch:r.context.getFeatureFlagValues().use_new_afterpay_checkout_widget,locale:r.session.locale,selectorOrElement:e instanceof HTMLElement?"element":"selector"}),r.context.getFeatureFlagValues().use_new_afterpay_checkout_widget){var i=document.createElement("div");if(i.id="sq-ap__payment-schedule-container-".concat(_a()),i.classList.add("sq-ap__payment-schedule-container"),void 0!==(null==t?void 0:t.theme)&&!$n.includes(t.theme))throw new dn("theme",t.theme);try{yield Wc(hl,pl,document.head)}catch(e){throw new Ln("attaching the Afterpay Checkout Widget")}return n.appendChild(i),new Promise(((e,n)=>{var o,a,s,c,l=new r.afterpayLibrary.Widgets.PaymentSchedule({amount:Dl.totalAmount(r.req),locale:r.session.locale,onError:e=>{r.errorLogger.captureException(e),n(qi(e))},onReady:function(){e()},style:{border:null===(o=null==t?void 0:t.border)||void 0===o||o,heading:null===(a=null==t?void 0:t.heading)||void 0===a||a,logo:null===(s=null==t?void 0:t.includeBranding)||void 0===s||s,theme:null!==(c=null==t?void 0:t.theme)&&void 0!==c?c:"CLASSIC"},target:"#".concat(i.id)});r.req.addEventListener(Zc.UPDATE,(()=>{l.update({amount:Dl.totalAmount(r.req)})}))}))}return new ql(r.req,r.context).attach(n,t)}))()}displayInformationModal(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=wi.convertLocaleToUnderscore(this.session.locale);Yl.has(t)||(t="en_US"),this.afterpayMessagingLibrary.launchModal(Vl(Vl({},e),{},{locale:t}))}onTokenize(e){var t;this.throwIfDestroyed(),this.onTokenizeCallbacks.push(e),1===this.onTokenizeCallbacks.length&&(this.tokenizationBuffer.forEach((e=>{var t=e.result,r=e.error;this.emitTokenizationResult(t,r)})),this.tokenizationBuffer=[]),this.onTokenizeHandlerAdded||void 0===this.element||null===(t=this.element)||void 0===t||t.addEventListener("click",(()=>{this.openPaymentModal()})),this.onTokenizeHandlerAdded=!0}tokenize(){var e=this;return $l((function*(){if(e.throwIfDestroyedOrNotAttached(),e.onTokenizeHandlerAdded)throw new $r;var t,r,n=new Promise(((e,n)=>{t=e,r=n}));return e.onTokenizeCallbacks=[function(e,n){void 0===n?void 0!==e?t(e):r(new Rn([Pi.UNKNOWN])):r(n)}],yield e.openPaymentModal(),n}))()}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):(this.detachElement(Ra.DESTROYED,"DESTROYED"),Promise.resolve(!0))}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(Ra.DETACHED,"DETACHED"),Promise.resolve(!0)}internalSetCheckoutToken(){var e=this;return $l((function*(){try{var t=yield e.paymentMessenger.request("REQUEST_AFTERPAY_CHECKOUT_HANDLER",e.buildCheckoutPayload());return e.checkoutTokenResponse=t,e.checkoutTokenResponse.token}catch(t){var r=t;throw wi.isInstanceOf(t,[Wr,En,on,Xr])||(e.errorLogger.captureException(t),r=new Ln("tokenizing with Afterpay")),r}}))()}commenceCheckout(e){var t=this;return $l((function*(){if(t.wasFirstInteractionCalled||(t.wasFirstInteractionCalled=!0,t.metricsHandler.logEvent("FIRST_INTERACTION:OK")),t.metricsHandler.logEvent("EXTERNAL_SESSION:START"),t.paymentRequestLockController.lock(t),void 0!==t.checkoutTokenResponse&&new Date(t.checkoutTokenResponse.expires)>new Date)e.resolve(t.checkoutTokenResponse.token);else try{var r=yield t.internalSetCheckoutToken();e.resolve(r)}catch(r){t.paymentRequestLockController.unlock(t),t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR");var n=qi(r);t.emitTokenizationResult(void 0,n),e.reject(n.message)}}))()}completeCheckout(e){var t=this;return $l((function*(){try{if(function(e){return"SUCCESS"===e.status&&void 0!==e.orderToken}(e)){var r=yield t.paymentMessenger.request("REQUEST_AFTERPAY_INSTANT_WALLET_TOKEN",t.buildInstantWalletTokenPayload(e.orderToken,t.total));t.metricsHandler.logEvent("EXTERNAL_SESSION:OK");var n={method:qr.AFTERPAY_CLEARPAY,shipping:{contact:{email:r.afterpayData.email}}};r.billingContact&&(n.billing=r.billingContact),r.shippingContact&&(n.shipping={contact:r.shippingContact}),delete t.checkoutTokenResponse,t.emitTokenizationResult({details:n,status:Gr,token:r.token})}else t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),t.emitTokenizationResult({status:Hr})}catch(e){var i;t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e instanceof Rn?i=e:(t.errorLogger.captureException(e),i=new Ln("tokenizing Afterpay")),t.emitTokenizationResult(void 0,i)}t.paymentRequestLockController.unlock(t)}))()}onShippingOptionChange(e,t){this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.req.dispatchEvent(Br.AFTERPAY_SHIPPING_OPTION_CHANGED,{contactOrOption:Ll(e),requireValidation:!0},(e=>{if(void 0===e.error){if(void 0!==e.shippingOption){this.total.amount=wi.paymentRequestAmountToMoneyAmount(e.shippingOption.total.amount,this.req.currencyCode);var r=Dl.shippingOption(e.shippingOption,this.req.currencyCode);t.resolve(r)}}else t.reject(e.error)}))}onShippingOptionChangeLegacy(e){this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.total.amount=wi.paymentRequestAmountToMoneyAmount(e.orderAmount.amount,this.req.currencyCode),this.req.dispatchEvent(Br.AFTERPAY_SHIPPING_OPTION_CHANGED,{contactOrOption:Ll(e)},(e=>{}))}onShippingAddressChange(e,t){if(!this.req.hasEventListener(Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED))return this.emitTokenizationResult(void 0,new Yr("PaymentRequest",Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED)),t.reject("SERVICE_UNAVAILABLE"),void this.afterpayLibrary.close();var r=this.req;this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.req.dispatchEvent(Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED,{contactOrOption:Rl(e)},(e=>{if(void 0===e.error)if(e.shippingErrors)t.reject("SHIPPING_ADDRESS_UNRECOGNIZED");else{var n=Dl.shippingOptions(e,r);t.resolve(n)}else t.reject("SHIPPING_ADDRESS_UNSUPPORTED")}))}emitTokenizationResult(e,t){0===this.onTokenizeCallbacks.length?this.tokenizationBuffer.push({error:t,result:e}):this.onTokenizeCallbacks.forEach((r=>{r(e,t)}))}buildInstantWalletTokenPayload(e,t){return{afterpayData:{afterpayToken:e,buyerAmount:t},clientID:this.session.applicationId,instanceID:this.session.instanceId,locationID:this.locationID,paymentMethodTrackingID:this.context.getPaymentMethodTrackingId(),requestBillingContact:this.req.requestBillingContact,requestShippingContact:this.req.requestShippingContact,sessionID:this.session.sessionId,websdkVersion:_r.VERSION}}buildCheckoutPayload(){var e,t={amount:Dl.totalAmount(this.req),applicationID:this.session.applicationId,discounts:[],locationID:this.locationID,popupOriginUrl:this.session.sourceUrl};if(this.req.lineItems&&(t.items=Dl.buildLineItems(this.req.lineItems,this.req.currencyCode)),this.req.discounts&&(t.discounts=Dl.buildDiscounts(this.req.discounts,this.req.currencyCode)),this.req.requestShippingContact?e=this.req.shippingContact:this.req.pickupContact&&(e=this.req.pickupContact),void 0!==e){var r=xl(e);if(!r.isValid)throw new on(r.issues.map((e=>[e.propertyPath,e.expected])));t.shipping=Dl.buildAfterpayContact(e)}return t}totalMoney(){return{amount:wi.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode),currency:this.req.currencyCode}}openPaymentModal(){var e=this;return $l((function*(){e.afterpayLibrary.open();var t=yield new Promise(((t,r)=>{e.commenceCheckout({reject:r,resolve:t})}));e.afterpayLibrary.transfer(Vl({token:t},e.transferOptions))}))()}initializeAfterpayPopup(e){var t=this.commenceCheckout.bind(this),r=this.completeCheckout.bind(this),n=document.createElement("div");n.id="sq-afterpay-dummy-element-".concat(_a()),n.style.visibility="hidden",e.appendChild(n),this.transferOptions={buyNow:this.buyNowOption,shippingOptionRequired:this.req.requestShippingContact},this.req.requestShippingContact||this.req.pickupContact||(this.transferOptions.addressMode="NO_ADDRESS");var i,o,a={addressMode:this.transferOptions.addressMode,countryCode:this.req.countryCode,onCommenceCheckout:(o=$l((function*(e){yield t(e)})),function(e){return o.apply(this,arguments)}),onComplete:(i=$l((function*(e){var t=e.data;yield r(t)})),function(e){return i.apply(this,arguments)}),shippingOptionRequired:this.req.requestShippingContact,target:"#".concat(n.id)};this.req.requestShippingContact?(a.onShippingAddressChange=this.onShippingAddressChange.bind(this),this.context.getFeatureFlagValues().can_use_afterpay_on_shipping_options_changed&&this.req.hasEventListener(Br.AFTERPAY_SHIPPING_OPTION_CHANGED)?a.onShippingOptionChange=this.onShippingOptionChange.bind(this):a.onShippingOptionChange=this.onShippingOptionChangeLegacy.bind(this)):this.req.pickupContact&&(this.transferOptions.pickup=!0),this.afterpayLibrary.initializeForPopup(a),e.removeChild(n)}detachElement(e,t){this.afterpayLibrary.close(),this.element&&(this.element.innerHTML=""),this.element=null,this.tokenizationBuffer=[],this.onTokenizeCallbacks=[],this.status=e,this.metricsHandler.logConfigurationEvent(t)}}var Zl=function(){var e,t,r=(e=_r.env,null!==(t=fl[e])&&void 0!==t?t:fl.staging),n=r.messaging,i=r.marketplace;return Promise.all([os.load("afterpay",{src:i},"AfterPay"),os.load("afterpay-messaging",{src:n},"Afterpay")])},Jl=["amount","currency"];function Xl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ql(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xl(Object(r),!0).forEach((function(t){eu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function eu(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var tu={message:"Bank is not currently available.",type:"NOT_AVAILABLE"},ru=new Set(["AB","BC","MB","NB","NL","NS","NT","NU","ON","PE","QC","SK","YT"]),nu=Pa(Ga({nonBlank:!0}),{maxLength:2,minLength:1}),iu=Jc("CAD",{requirePositiveAmount:!0,requireSafeIntegerAmount:!0}),ou=Va({addressLines:nu,city:Ga({nonBlank:!0}),countryCode:Ga({legalValues:["CA"]}),email:Ga({formatExample:"example@domain.com",matchRegexp:/^\S+@\S+\.\S+$/,nonBlank:!0}),phone:Ga({formatExample:"+14165551234",matchRegexp:/^\+1\d{10}$/,nonBlank:!0}),postalCode:Ga({nonBlank:!0}),state:Ga({legalValues:ru})}),au=Va({accountHolderName:Ga({nonBlank:!0}),accountUse:Ga({legalValues:["PERSONAL","BUSINESS"]}),amount:iu,currency:Ga({legalValues:["CAD"]}),customerDetails:ou,intent:Ga({legalValues:["CHARGE"]})}),su={CA:function(e){if(!eo(e))throw new cn("Tokenize options must be an object.");var t=$a(au),r=t.validate(e);if(!r.isValid)throw Vs(r.issues,"Bank tokenize");var n=t.sanitize(e),i=n.amount,o=n.currency;return Ql(Ql({},function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(n,Jl)),{},{total:{amount:wi.paymentRequestAmountToMoneyAmount(i,o),currencyCode:o}})}};function cu(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var lu=()=>{},uu=class extends Ka{constructor(e,t,r,n){super(e),this.methodType="Bank",this.tokenizeInProgress=!1,this.plaid=t,this.countryCode=r,this.transactionId=ss(n),this.plaidNonceFlow=Tc.build(this.context,t,lu,{countryCode:this.countryCode}),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}tokenize(e){var t,r=this;return(t=function*(){if(r.throwIfDestroyed(),r.tokenizeInProgress)throw new Rn([Za]);var t=function(e,t){return su[e](t)}(r.countryCode,e);r.tokenizeInProgress=!0;try{var n=yield r.plaidNonceFlow.run({accountHolderName:t.accountHolderName});return"cancelled"===n.status?{status:Hr}:{status:Gr,token:n.bankNonce}}finally{r.tokenizeInProgress=!1}},function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){cu(o,n,i,a,s,"next",e)}function s(e){cu(o,n,i,a,s,"throw",e)}a(void 0)}))})()}destroy(){return this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),this.plaidNonceFlow.destroy(),Promise.resolve(!0)}};function du(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function hu(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){du(o,n,i,a,s,"next",e)}function s(e){du(o,n,i,a,s,"throw",e)}a(void 0)}))}}class pu{constructor(e,t){this.isRunning=!1,this.fetchStatus=e,this.onError=t}start(){var e=this;return hu((function*(){e.isRunning||(e.isRunning=!0,yield e.poll())}))()}stop(){this.isRunning=!1,void 0!==this.nextPollTimeoutId&&(clearTimeout(this.nextPollTimeoutId),this.nextPollTimeoutId=void 0)}poll(){var e=this;return hu((function*(){try{if(!(yield e.fetchStatus()))return void e.stop();e.isRunning&&(e.nextPollTimeoutId=setTimeout((()=>{e.poll()}),1e3))}catch(t){e.stop(),e.onError(t)}}))()}}function fu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mu(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mu(e,t):void 0}}(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 mu(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var vu={ASPECT_RATIO:/^\d+\/\d+$/,HEX:/^#([\dA-Fa-f]{3}|[\dA-Fa-f]{6})$/,NEGATIVE_EM:/^-\d*\.?\d+em$/,NEGATIVE_PERCENT:/^\d*\.?\d+%$/,NEGATIVE_PT:/^-\d*\.?\d+pt$/,NEGATIVE_PX:/^-\d*\.?\d+px$/,POSITIVE_EM:/^\d*\.?\d+em$/,POSITIVE_PERCENT:/^\d*\.?\d+%$/,POSITIVE_PT:/^\d*\.?\d+pt$/,POSITIVE_PX:/^\d*\.?\d+px$/,POSITIVE_RESOLUTION:/^\d*\.?\d+(?:dpi|dpcm|dppx|x)$/,RGB:/^rgb\((\s*\d{1,3},){2}\s*\d{1,3}\)$/,RGBA:/^rgba\((\s*\d{1,3},){3}\s*(1|0*.\d*)\)$/},gu=/\s(?![^(]*\))/,yu=new Set(["screen","all","print","speech"]),Eu=new Set(["and"]),bu=new Set(["not","only"]),_u=new Set(["portrait","landscape"]),Cu=new Set(["xx-small","x-small","small","medium","large","x-large","xx-large"]),Su=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),Iu=new Set([100,200,300,400,500,600,700,800,900]),Ou=new Set(["100","200","300","400","500","600","700","800","900","normal","bold","bolder","lighter"]),wu=new Set(["normal"]),Au=new Set(["smaller","larger"]),Tu=new Set(["andale mono","arial","arial black","arial narrow","arial rounded mt bold","avant garde","baskerville","big caslon","bodoni mt","book antiqua","brush script mt","calibri","calisto mt","cambria","candara","century gothic","charcoal","comic sans ms","consolas","copperplate","copperplate gothic light","courier","courier new","cursive","didot","fantasy","franklin gothic medium","futura","garamond","geneva","georgia","gill sans","goudy old style","helvetica","helvetica neue","hoefler text","impact","lucida bright","lucida console","lucida grande","lucida sans unicode","lucida sans typewriter","monaco","monospace","optima","palatino","palatino linotype","papyrus","perpetua","rockwell","rockwell extra bold","sans-serif","segoe ui","serif","square market","square sans text","tahoma","times","times new roman","trebuchet ms","verdana"]),Pu=new Set(["none","antialiased","subpixel-antialiased"]),Nu=new Set(["grayscale","auto"]),Du=new Set(["none"]);function Ru(e){return e.split(/, ?(?![^(]*\))/).every((e=>function(e){if("none"===e)return!0;var t=e.split(/ (?![^(]*\))/),r=0;if("inset"===t[0]&&(t.shift(),r+=1),"inset"===t[t.length-1]){if(r>0)return!1;t.pop()}for(var n=0;n<2;n+=1){var i=t.shift();if(void 0===i||!Uu(i))return!1}switch(t.length){case 0:return!0;case 1:return Hu(t[0])||qu(t[0]);case 2:return qu(t[0])&&(Hu(t[1])||Bu(t[1]));case 3:return qu(t[0])&&Bu(t[1])&&Hu(t[2]);default:return!1}}(e)))}function Lu(e){return["border-box","content-box"].includes(e)}function xu(e){return e.split(" ").every((e=>function(e){return 0===Number(e)||Qu(e)||rd(e)}(e)))}function ku(e){var t=e.split(" ");return!(0===t.length||t.length>4)&&t.every(Mu)}function Mu(e){return 0===Number(e)||Qu(e)||rd(e)}function ju(e){return 0===Number(e)||Qu(e)||rd(e)||ed(e)||nd(e)}function Uu(e){return 0===Number(e)||Xu(e)||td(e)}function Bu(e){return 0===Number(e)||Xu(e)||td(e)}function qu(e){return 0===Number(e)||Qu(e)||rd(e)}function Hu(e){return function(e){return Su.has(e.toLowerCase())}(e)||function(e){return vu.HEX.test(e)}(e)||function(e){return vu.RGB.test(e)}(e)||function(e){return vu.RGBA.test(e)}(e)}function Fu(e){return function(e){return Cu.has(e.toLowerCase())}(e)||function(e){return Au.has(e.toLowerCase())}(e)||Qu(e)||id(e)||rd(e)||od(e)}function Vu(e){return null!==e&&e.split(", ").every((e=>{return t=e.toLowerCase().trim().replace(/["']+/g,""),Tu.has(t);var t}))}function Gu(e){var t=Number(e);return Number.isNaN(t)?Ou.has(e.toLowerCase()):Iu.has(t)}function zu(e){return"normal"===e||td(e)||function(e){return id(e)||function(e){return vu.NEGATIVE_PT.test(e)}(e)}(e)||Xu(e)}function $u(e){var t=Number(e);return!Number.isNaN(t)&&t>=0||wu.has(e)||rd(e)||Qu(e)||id(e)||od(e)}function Yu(e){return Pu.has(e)}function Wu(e){return Nu.has(e)}function Ku(e){return Du.has(e)}function Zu(e){if(null===e)return!1;var t=e.toString().split(" ");return!(t.length>4)&&t.every((e=>function(e){return Qu(e)||rd(e)||od(e)||0===Number(e)}(e)))}function Ju(e){if(!e.startsWith("(")||!e.endsWith(")"))return!1;var t=fu(e.slice(1,-1).split(/: */),2),r=t[0],n=t[1];switch(r){case"width":case"min-width":case"max-width":case"height":case"min-height":case"max-height":case"device-width":case"min-device-width":case"max-device-width":case"device-height":case"min-device-height":case"max-device-height":return Qu(n)||rd(n)||od(n);case"resolution":case"min-resolution":case"max-resolution":return function(e){return vu.POSITIVE_RESOLUTION.test(e)}(n);case"aspect-ratio":case"min-aspect-ratio":case"max-aspect-ratio":case"device-aspect-ratio":case"min-device-aspect-ratio":case"max-device-aspect-ratio":return function(e){return vu.ASPECT_RATIO.test(e)}(n);case"color":case"color-index":case"monochrome":return void 0===n;case"min-color":case"max-color":case"min-color-index":case"max-color-index":case"min-monochrome":case"max-monochrome":return function(e){return Number(e)>=0}(n);case"orientation":return function(e){return _u.has(e)}(n);default:return!1}}function Xu(e){return Qu(e)||ed(e)}function Qu(e){return vu.POSITIVE_PX.test(e)}function ed(e){return vu.NEGATIVE_PX.test(e)}function td(e){return rd(e)||nd(e)}function rd(e){return vu.POSITIVE_EM.test(e)}function nd(e){return vu.NEGATIVE_EM.test(e)}function id(e){return vu.POSITIVE_PT.test(e)}function od(e){return vu.POSITIVE_PERCENT.test(e)}var ad=function(e,t){var r=(e=>{switch(e){case"border-color":case"background-color":case"color":case"-webkit-text-fill-color":return Hu;case"-webkit-box-shadow":case"box-shadow":return Ru;case"box-sizing":return Lu;case"font-family":return Vu;case"font-size":return Fu;case"font-weight":return Gu;case"letter-spacing":return zu;case"line-height":return $u;case"padding":return Zu;case"-webkit-font-smoothing":return Yu;case"-moz-osx-font-smoothing":return Wu;case"display":return Ku;case"border-radius":return xu;case"border-width":return ku;case"top":case"bottom":case"left":case"right":return ju;case"width":return function(e){return""!==e};default:return}})(e);return!0===(null==r?void 0:r(t))||function(e){return["unset","inherit","revert","initial"].includes(e)}(t)?t:""},sd=function(e){return!!(t=e).startsWith("@media")&&t.slice(7,t.length).split(/, */).every((e=>{var t=e.split(gu);if(0===t.length)return!1;var r=0;if(!t[0].startsWith("(")){var n=0;if(bu.has(t[0])&&(n=1),t.length===n+1)return yu.has(t[n]);if(!yu.has(t[n])||!Eu.has(t[n+1]))return!1;r=2+n}if((t.length-r)%2==0)return!1;for(var i of Object.entries(t.slice(r))){var o=fu(i,2),a=o[0],s=o[1];if(!(Number(a)%2==0?Ju(s):Eu.has(s)))return!1}return!0}));var t};function cd(e){return function(t){return ad(e,t)}}var ld=Ua(Va({rounded:Ua(Na()),style:Ua(Va({backgroundColor:Ua(Ga({},cd("background-color"))),color:Ua(Ga({},cd("color")))}))})),ud="sq-bitcoin-lightning-modal",dd="sq-bitcoin-lightning-modal-content",hd="sq-bitcoin-qr-container",pd="sq-bitcoin-pay",fd="sq-bitcoin-payment-details";class md{constructor(e,t,r){this.isShown=!1,this.modalElement=null,this.closeButtonHandler=null,this.lightningPayButtonHandler=null,this.modalOverlayHandler=null,this.qrCodeFactory=e,this.context=t,this.onClose=r}static updatePaymentDetails(e,t,r){var n=document.getElementById(fd);if(!n)throw new Error("Payment details container not found");var i=n.querySelector("h2");n.innerHTML="",i&&n.appendChild(i);var o=Math.round(e.amountMilliSats/1e3),a=new Intl.NumberFormat(t).format(o),s=null!=r?r:e.currencyExchange,c=wi.moneyAmountToInternationalizedCurrency(s.amount,s.currency,t),l=document.createElement("div");l.className="sq-bitcoin-amount";var u=document.createElement("div");u.className="sq-bitcoin-amount-btc",u.textContent="₿".concat(a);var d=document.createElement("div");d.className="sq-bitcoin-amount-usd",d.textContent=c,l.appendChild(u),l.appendChild(d);var h=document.createElement("p");h.className="sq-bitcoin-instruction",h.textContent="Scan with your Bitcoin Lightning wallet";var p=document.createElement("div");p.className="sq-bitcoin-invoice";var f=document.createElement("div");f.className="sq-bitcoin-invoice-label",f.textContent="Lightning invoice";var m=document.createElement("div");m.className="sq-bitcoin-invoice-value-container";var v=document.createElement("div");v.className="sq-bitcoin-invoice-value";var g=/lightning:(.+)/.exec(e.paymentUrl),y=g?g[1]:e.paymentUrl,E=y.length>13?"".concat(y.substring(0,7),"...").concat(y.substring(y.length-6)):y;v.textContent=E.toLowerCase();var b=document.createElement("button");b.className="sq-bitcoin-invoice-copy",b.type="button",b.setAttribute("aria-label","Copy invoice"),b.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path fill-rule="evenodd" clip-rule="evenodd" d="M20 7C20.2652 7 20.5195 7.10544 20.707 7.29297C20.8946 7.4805 21 7.73479 21 8V21C21 21.5523 20.5523 22 20 22H9C8.44772 22 8 21.5523 8 21V8L8.00488 7.89746C8.05622 7.39334 8.48233 7 9 7H20ZM10 20H19V9H10V20Z" fill="#101010"/>\n    <path d="M16 4H5V17H3V3C3 2.73478 3.10543 2.48051 3.29297 2.29297C3.48051 2.10543 3.73478 2 4 2H16V4Z" fill="#101010"/>\n  </svg>',b.onclick=()=>{md.copyToClipboard(y.toLowerCase()),md.showCopyConfirmation(b)},m.appendChild(v),m.appendChild(b),p.appendChild(f),p.appendChild(m),n.appendChild(l),n.appendChild(h),n.appendChild(p)}static createMobileDuplicates(e){var t=document.getElementById(dd),r=document.getElementById(pd);if(t&&r){for(var n of t.querySelectorAll(".sq-bitcoin-instruction--mobile, .sq-bitcoin-invoice--mobile"))n.remove();var i=t.querySelector(".sq-bitcoin-instruction"),o=t.querySelector(".sq-bitcoin-invoice");if(null==i||i.classList.add("sq-bitcoin-instruction--desktop"),null==o||o.classList.add("sq-bitcoin-invoice--desktop"),i){var a=i.cloneNode(!0);a.classList.remove("sq-bitcoin-instruction--desktop"),a.classList.add("sq-bitcoin-instruction--mobile"),t.insertBefore(a,r)}if(o){var s=o.cloneNode(!0);s.classList.remove("sq-bitcoin-invoice--desktop"),s.classList.add("sq-bitcoin-invoice--mobile"),t.insertBefore(s,r);var c=s.querySelector(".sq-bitcoin-invoice-copy");if(c){var l=/lightning:(.+)/.exec(e.paymentUrl),u=l?l[1]:e.paymentUrl;c.onclick=()=>{md.copyToClipboard(u.toLowerCase()),md.showCopyConfirmation(c)}}}}}static copyToClipboard(e){var t;return null!==(t=navigator.clipboard)&&void 0!==t&&t.writeText?navigator.clipboard.writeText(e):new Promise(((t,r)=>{var n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",n.setAttribute("readonly",""),document.body.appendChild(n);try{n.select(),n.setSelectionRange(0,e.length);var i=document.execCommand("copy");document.body.removeChild(n),i?t():r(new Error("Copy command failed"))}catch(e){document.body.removeChild(n),r(e instanceof Error?e:new Error("Failed to copy to clipboard"))}}))}static showCopyConfirmation(e){"true"!==e.dataset.copying&&(e.dataset.copying="true",e.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path d="M22.7573 5.65039L10.7573 19.6504C10.5673 19.872 10.2905 20 9.99854 20C9.70678 19.9999 9.42963 19.8719 9.23975 19.6504L3.23975 12.6504L4.75732 11.3496L9.99854 17.4639L21.2397 4.34961L22.7573 5.65039Z" fill="#00B23B"/>\n  </svg>',e.classList.add("sq-bitcoin-invoice-copy--pop"),setTimeout((()=>{e.classList.remove("sq-bitcoin-invoice-copy--pop")}),300),setTimeout((()=>{e.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path fill-rule="evenodd" clip-rule="evenodd" d="M20 7C20.2652 7 20.5195 7.10544 20.707 7.29297C20.8946 7.4805 21 7.73479 21 8V21C21 21.5523 20.5523 22 20 22H9C8.44772 22 8 21.5523 8 21V8L8.00488 7.89746C8.05622 7.39334 8.48233 7 9 7H20ZM10 20H19V9H10V20Z" fill="#101010"/>\n    <path d="M16 4H5V17H3V3C3 2.73478 3.10543 2.48051 3.29297 2.29297C3.48051 2.10543 3.73478 2 4 2H16V4Z" fill="#101010"/>\n  </svg>',delete e.dataset.copying}),2e3))}show(e,t){this.isShown||(this.isShown=!0,this.modalElement||this.createModal(e),this.updateQRCode(e.paymentUrl),md.updatePaymentDetails(e,this.context.getSession().locale,t),md.createMobileDuplicates(e),this.modalElement&&(this.modalElement.style.display="flex"))}hide(){this.isShown&&(this.isShown=!1,this.modalElement&&(this.modalElement.style.display="none"))}createModal(e){var t=document.getElementById(ud);t&&t.remove();var r=this.context.getLocaleString().paymentMethods.bitcoin,n=document.createElement("div");n.id=ud,n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby","sq-bitcoin-modal-title");var i=document.createElement("div");i.id=dd;var o=document.createElement("button");o.id="sq-bitcoin-modal-close",o.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path d="M19.707 5.70703L13.4141 12L19.707 18.293L18.293 19.707L12 13.4141L5.70703 19.707L4.29297 18.293L10.5859 12L4.29297 5.70703L5.70703 4.29297L12 10.5859L18.293 4.29297L19.707 5.70703Z" fill="#101010"/>\n  </svg>',o.type="button",o.setAttribute("aria-label",r.closeButtonAriaLabel);var a=document.createElement("h2");a.id="sq-bitcoin-modal-title",a.textContent=r.modalTitle;var s=document.createElement("div");s.id=hd;var c=document.createElement("div");c.id=fd,c.appendChild(a);var l=document.createElement("button");l.id=pd,l.type="button",l.innerHTML=r.lightningPayButtonText,l.setAttribute("aria-label",r.lightningPayButtonAriaLabel),i.appendChild(o),i.appendChild(c),i.appendChild(s),i.appendChild(l),n.appendChild(i),document.body.appendChild(n),this.modalElement=n,this.closeButtonHandler=()=>{this.hide(),this.onClose()},o.addEventListener("click",this.closeButtonHandler),this.modalOverlayHandler=e=>{e.target===n&&(this.hide(),this.onClose())},n.addEventListener("click",this.modalOverlayHandler),this.lightningPayButtonHandler=()=>{var t=document.createElement("a");t.href=e.paymentUrl,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)},l.addEventListener("click",this.lightningPayButtonHandler)}updateQRCode(e){var t=document.getElementById(hd);if(!t)throw new Error("QR container not found");t.innerHTML="";var r=this.context.getLocaleString().paymentMethods.bitcoin,n=this.qrCodeFactory(0,"M");n.addData(e),n.make();var i=n.createImgTag(8,4,r.qrCodeAltText),o=document.createElement("div");o.innerHTML=i;var a=o.firstChild,s=document.createElement("div");s.className="sq-bitcoin-qr-wrapper",s.appendChild(a);var c=document.createElement("div");c.className="sq-bitcoin-qr-icon",c.innerHTML='<svg width="13" height="18" viewBox="0 0 13 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path d="M8.0257 7.55728H4.85995L5.47985 4.75085H8.16013C9.25594 4.75085 9.88985 5.25034 9.88985 6.0773C9.88985 7.05716 9.12151 7.55728 8.0257 7.55728ZM6.89166 13.2663H3.5985L4.32479 9.97953H7.00698C8.33342 9.97953 9.14063 10.5364 9.14063 11.536C9.14063 12.5547 8.31431 13.2663 6.89166 13.2663ZM12.9849 5.59692C12.9849 3.76908 11.5941 2.5828 9.68216 2.24004L10.0147 0.658125C10.0854 0.318551 9.82678 0 9.4802 0H7.46569C7.20767 0 6.98532 0.179663 6.9318 0.431955L6.56865 2.13683H3.2602C3.06843 2.13683 2.90215 2.26999 2.86073 2.45729L0.00971339 15.3637C-0.0463514 15.6191 0.147327 15.8612 0.409175 15.8612H3.52141L3.20986 17.3247C3.13851 17.663 3.39462 17.9821 3.73993 17.9847L5.75763 18C6.01756 18.0019 6.2431 17.8203 6.29661 17.5655L6.65403 15.8612H6.96812C10.1976 15.8612 12.2541 14.0927 12.2541 11.8055C12.2541 10.4599 11.524 9.3641 10.39 8.80663C11.8126 8.40335 12.9849 7.26867 12.9849 5.59692Z" fill="white"/>\n  </svg>',s.appendChild(c),t.appendChild(s)}}function vd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function gd(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function yd(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){gd(o,n,i,a,s,"next",e)}function s(e){gd(o,n,i,a,s,"throw",e)}a(void 0)}))}}class Ed extends Ka{constructor(e,t){super(e),this.methodType="Bitcoin",this.paymentInProgress=!1,this.wasFirstInteractionCalled=!1,this.modalState="active",this.paymentMethodMessenger=new _c(this.context),this.container=null,this.bitcoinButton=null,this.lightningModal=new md(t,e,(()=>{"terminal"!==this.modalState&&(this.modalState="dismissed",this.dispatchEvent("onModalCancelled",void 0))})),this.attach=this.withErrorHandling(this.attach.bind(this),"attach")}attach(e,t){var r=this;return yd((function*(){r.throwIfDestroyedOrAlreadyAttached(),r.status=Ra.ATTACHED;try{var n=function(e){var t,r=$a(ld),n=r.validate(e);if(!n.isValid)throw Vs(n.issues,"Bitcoin attach");return null!==(t=r.sanitize(e))&&void 0!==t?t:{}}(t),i=n.rounded,o=n.style;if(r.container=qc(e),yield Wc(_r.BITCOIN_STYLES,"sq-bitcoin-styles",document.head),r.bitcoinButton=document.createElement("button"),r.bitcoinButton.type="button",r.bitcoinButton.classList.add("sq-bitcoin-button"),!1!==i&&r.bitcoinButton.classList.add("sq-bitcoin-button--rounded"),void 0!==o)for(var a of Object.entries(o)){var s=(p=2,function(e){if(Array.isArray(e))return e}(h=a)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(h,p)||function(e,t){if(e){if("string"==typeof e)return vd(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vd(e,t):void 0}}(h,p)||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.")}()),c=s[0],l=s[1];r.bitcoinButton.style[c]=l}var u=document.createElement("span");u.classList.add("sq-bitcoin-button__content"),u.innerText=r.context.getLocaleString().paymentMethods.bitcoin.buttonText;var d=document.createElement("span");d.classList.add("sq-bitcoin-button__spinner"),d.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n    <path clip-rule="evenodd" fill-rule="evenodd" d="M21.3333 12C21.3333 6.84534 17.1547 2.66667 12 2.66667V0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12H2.66667C2.66667 17.1547 6.84534 21.3333 12 21.3333C17.1547 21.3333 21.3333 17.1547 21.3333 12Z"/>\n  </svg>',r.bitcoinButton.appendChild(u),r.bitcoinButton.appendChild(d),r.container.appendChild(r.bitcoinButton),r.bitcoinButton.addEventListener("click",(()=>{r.handleButtonClick()})),r.metricsHandler.logConfigurationEvent("CONFIGURED",n)}catch(e){throw r.status=Ra.DETACHED,e}var h,p;return Promise.resolve()}))()}destroy(){var e;return this.status===Ra.DESTROYED?Promise.resolve(!1):(null===(e=this.poller)||void 0===e||e.stop(),this.container&&(this.container.innerHTML=""),this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),Promise.resolve(!0))}registerPayment(e,t){var r=this;return yd((function*(){var n;null===(n=r.poller)||void 0===n||n.stop(),r.modalState="active",r.metricsHandler.logEvent("EXTERNAL_SESSION:START"),r.poller=new pu(yd((function*(){var n=yield r.requestBitcoinStatus(e,t),i=n.status,o=n.lightningDetails,a=n.totalAmount;switch(i){case"COMPLETED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),r.modalState="terminal",r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onPaymentCompletion",{paymentId:t}),!1;case"FAILED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.modalState="terminal",r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onPaymentFailure",{paymentId:t}),!1;case"CANCELLED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),r.modalState="terminal",r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onPaymentCancelled",{paymentId:t}),!1;default:return void 0!==o&&"active"===r.modalState&&(r.lightningModal.show(o,a),r.setButtonLoading(!1)),!0}})),(e=>{r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onError",{error:e})})),yield r.poller.start()}))()}requestBitcoinStatus(e,t){var r=this;return yd((function*(){var n=r.context.getSession(),i={bitcoinNonce:e,clientId:n.applicationId,instanceId:n.instanceId,locationId:n.locationId,paymentId:t,sessionId:n.sessionId};return r.paymentMethodMessenger.request("REQUEST_BITCOIN_STATUS",i)}))()}setButtonLoading(e){this.bitcoinButton&&(e?(this.bitcoinButton.classList.add("sq-bitcoin-button--loading"),this.bitcoinButton.disabled=!0):(this.bitcoinButton.classList.remove("sq-bitcoin-button--loading"),this.bitcoinButton.disabled=!1))}handleButtonClick(){var e=this;return yd((function*(){if(!e.paymentInProgress){e.wasFirstInteractionCalled||(e.wasFirstInteractionCalled=!0,e.metricsHandler.logEvent("FIRST_INTERACTION:OK")),e.paymentInProgress=!0,e.setButtonLoading(!0);try{var t={paymentMethodTrackingId:e.context.getPaymentMethodTrackingId()},r=(yield e.paymentMethodMessenger.request("REQUEST_BITCOIN_NONCE",t)).bitcoinNonce;e.dispatchEvent("onPaymentCreationNeeded",{bitcoinNonce:r})}catch(t){e.setButtonLoading(!1),e.dispatchEvent("onError",{error:t})}finally{e.paymentInProgress=!1}}}))()}}function bd(){return(bd=yd((function*(){return yield os.load("qr-code",{src:_r.QR_CODE_GENERATOR_SCRIPT},"Square.utils.QRCodeFactory")}))).apply(this,arguments)}var _d={initialize:function(){return bd.apply(this,arguments)}},Cd=["style"];function Sd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Id(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Id(e,t):void 0}}(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 Id(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Od=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("iframe");return new Promise(((i,o)=>{n.onerror=e=>{o(new hi(e))},n.onload=()=>{r||i(n)};var a=e.style,s=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,Cd);Object.entries(s).forEach((e=>{var t=Sd(e,2),r=t[0],i=t[1];void 0!==i&&n.setAttribute(r,i)})),void 0!==a&&Object.entries(a).forEach((e=>{var t=Sd(e,2),r=t[0],i=t[1];n.style.setProperty(r,i,"important")})),t?t.appendChild(n):document.body.appendChild(n)}))},wd=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)};function Ad(e,t,r){switch(e){case Ir.CARD_NUMBER:return t.paymentMethods.cards.errors.cardNumberError;case Ir.CVV:return t.paymentMethods.cards.errors.cvvError;case Ir.EXPIRATION_DATE:return t.paymentMethods.cards.errors.expirationDateError;case Ir.POSTAL_CODE:return t.paymentMethods.cards.errors.postalCodeErrors[r];case wr.GIFT_CARD_NUMBER:return t.paymentMethods.giftCards.errors.giftCardNumberError;default:return""}}function Td(e,t,r){switch(e){case Ir.CARD_NUMBER:return t.paymentMethods.cards.helperText.cardNumber;case Ir.CVV:return t.paymentMethods.cards.helperText.cvv;case Ir.EXPIRATION_DATE:return t.paymentMethods.cards.helperText.expirationDate;case Ir.POSTAL_CODE:return t.paymentMethods.cards.helperText.postalCodes[r];case wr.GIFT_CARD_NUMBER:return t.paymentMethods.giftCards.helperText.giftCardNumber;default:return""}}class Pd{constructor(e,t){this.errorList=new Set,this.focusedInput=void 0,this.fieldOrdering=e,this._postalCountry=null!=t?t:"US"}get postalCountry(){return this._postalCountry}setErrorOnField(e){this.errorList.add(e)}removeErrorFromField(e){this.errorList.delete(e)}setFocusOnField(e){this.focusedInput=e}removeFocusFromField(e){this.focusedInput===e&&(this.focusedInput=null)}setPostalCountry(e){this._postalCountry=e}hasFocus(){return null!==this.focusedInput&&void 0!==this.focusedInput}hasError(){return this.errorList.size>0}fieldHelperMessage(e){if(0===this.errorList.size)return{fieldName:this.focusedInput,isError:!1,message:Td(this.focusedInput,e,this.postalCountry)};var t=this.fieldOrdering.find((e=>this.errorList.has(e)));return{fieldName:t,isError:!0,message:Ad(t,e,this.postalCountry)}}}var Nd=["top","right","bottom","left"];function Dd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rd(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rd(e,t):void 0}}(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 Rd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ld(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(r.length>0&&!r.includes(e))throw new Tn(e);var i=wi.cssProperty(e),o=ad(i,t);if(0===o.length)throw new Pn(e,t);return n&&(o+=" !important"),wi.formatCSSKeyValuePair(i,o)}function xd(e,t,r){var n,i=[],o=[],a=new Set(null!==(n=e.excludeProperties)&&void 0!==n?n:[]);for(var s of Object.entries(t)){var c=Dd(s,2),l=c[0],u=c[1];if(!a.has(l))try{i.push(Ld(l,null!=u?u:"",r))}catch(e){(e instanceof Tn||e instanceof Pn)&&o.push(e)}}if(o.length>0)throw new Dn(o);return Object.fromEntries(e.toSelectors.map((function(e){return[e,i]})))}function kd(e,t,r){var n={},i=[];if(e.forEach((function(e){var o=e.property,a=e.setAsImportant,s=e.toProperty,c=e.toSelectors,l=e.transformPropertyValue,u=t[o];if(wi.isNonBlankString(u)){var d=l?l(u):u;try{var h=Ld(null!=s?s:o,d,void 0!==s?[...r,s]:r,a);c.forEach((e=>{e in n||(n[e]=[]),n[e].push(h)}))}catch(e){(e instanceof Tn||e instanceof Pn)&&i.push(e)}}})),i.length>0)throw new Dn(i);return n}var Md=function(e,t){var r=t.split(" ");switch(r.length){case 1:return r[0];case 2:switch(e){case"top":case"bottom":return r[0];default:return r[1]}case 3:switch(e){case"top":return r[0];case"bottom":return r[2];default:return r[1]}case 4:switch(e){case"top":return r[0];case"right":return r[1];case"bottom":return r[2];case"left":return r[3];default:return""}default:return""}},jd=function e(t,r,n){var i,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=[],s=[...Object.keys(r.selectorMappings),...Object.keys(null!==(i=r.selectorPropertyMappings)&&void 0!==i?i:{})],c=new Set(s),l=new Set(Object.values(n));Object.keys(t).forEach((e=>{l.has(e)||function(e,t){return!t&&sd(e)}(e,o)||a.push(new Nn(e))}));var u={};function d(e){for(var t of Object.entries(e)){var r=Dd(t,2),n=r[0],i=r[1];n in u||(u[n]=[]),u[n].push(...i)}}for(var h of c){var p,f,m,v,g=t[h],y=null!==(p=r.allowedAttributes[h])&&void 0!==p?p:[],E=null!==(f=r.selectorMappings[h])&&void 0!==f?f:[],b=null!==(m=null===(v=r.selectorPropertyMappings)||void 0===v?void 0:v[h])&&void 0!==m?m:[];if(g){try{d(xd(E,g,y))}catch(e){e instanceof Dn&&a.push(...e.errors)}try{d(kd(b,g,y))}catch(e){e instanceof Dn&&a.push(...e.errors)}}}if(Object.keys(t).filter((e=>!c.has(e)&&sd(e))).forEach((i=>{try{var o=e(t[i],r,n,!0);u[i]=[o]}catch(e){e instanceof Dn&&a.push(...e.errors)}})),a.length>0)throw new Dn(a);return function(e){var t=[];for(var r of Object.entries(e)){var n=Dd(r,2),i=n[0],o=n[1];o&&o.length>0&&t.push("\n      ".concat(i," { ").concat(o.join(" ")," }\n      "))}return t.join("")}(u)},Ud="sq-card-iframe-container",Bd="sq-card-wrapper",qd="sq-card-component",Hd="sq-card-message",Fd="sq-card-message-error",Vd="sq-card-message-no-error",Gd="sq-visible",zd=".".concat(Bd),$d=".".concat(qd),Yd=".".concat(Ud),Wd="".concat(zd).concat(zc),Kd="".concat(zd).concat($c),Zd="".concat(zd," ").concat($d),Jd="".concat(zd," ").concat(Yd),Xd="".concat(Wd," ").concat(Yd),Qd="".concat(Kd," ").concat(Yd),eh=".sq-card-message-error::before",th=".sq-card-message-no-error::before",rh="".concat(Yd).concat("::before"),nh=["borderWidth"];function ih(e){var t=["".concat(e).concat($c," ").concat(rh),"".concat(e).concat(zc," ").concat(rh)];return Nd.map((e=>{return{property:"borderWidth",toProperty:e,toSelectors:t,transformPropertyValue:(r=e,function(e){var t=Md(r,e);return t.startsWith("0")?t:"-".concat(t)})};var r}))}function oh(e,t){return jd(e,function(e){var t="#".concat(e);return{allowedAttributes:{[Or.CARD_COMPONENT]:Yn,[Or.CARD_COMPONENT_FOCUS]:Wn,[Or.CARD_COMPONENT_ERROR]:Wn,[Or.CARD_INPUT_HELPER_TEXT]:Kn,[Or.CARD_INPUT_HELPER_ICON]:Zn,[Or.CARD_INPUT_ERROR_TEXT]:Kn,[Or.CARD_INPUT_ERROR_ICON]:Zn},selectorMappings:{[Or.CARD_COMPONENT]:{toSelectors:["".concat(t).concat(Jd)]},[Or.CARD_COMPONENT_FOCUS]:{excludeProperties:nh,toSelectors:["".concat(t).concat(Xd)]},[Or.CARD_COMPONENT_ERROR]:{excludeProperties:nh,toSelectors:["".concat(t).concat(Qd)]},[Or.CARD_INPUT_HELPER_TEXT]:{toSelectors:["".concat(t," ").concat(".sq-card-message-no-error")]},[Or.CARD_INPUT_HELPER_ICON]:{toSelectors:["".concat(t," ").concat(th)]},[Or.CARD_INPUT_ERROR_TEXT]:{toSelectors:["".concat(t," ").concat(".sq-card-message-error")]},[Or.CARD_INPUT_ERROR_ICON]:{toSelectors:["".concat(t," ").concat(eh)]}},selectorPropertyMappings:{[Or.CARD_INPUT]:[{property:"backgroundColor",toSelectors:["".concat(t).concat(Jd)]}],[Or.CARD_COMPONENT]:[{property:"borderRadius",toSelectors:["".concat(t," ").concat(rh),"".concat(t).concat(Zd)]},{property:"borderWidth",toProperty:"width",toSelectors:["".concat(t).concat(Jd)],transformPropertyValue:e=>function(e){var t=["left","right"].map((t=>{var r=Md(t,e);return"0"===r&&(r="0px"),r})).join(" + ");return"calc(100% - (".concat(t,"))")}(e)},...ih(t)],[Or.CARD_COMPONENT_ERROR]:[{property:"borderColor",toSelectors:["".concat(t).concat($c," ").concat(rh)]},{property:"borderWidth",toSelectors:["".concat(t).concat($c," ").concat(rh)]}],[Or.CARD_COMPONENT_FOCUS]:[{property:"borderColor",toSelectors:["".concat(t).concat(zc," ").concat(rh)]},{property:"borderWidth",toSelectors:["".concat(t).concat(zc," ").concat(rh)]}],[Or.CARD_INPUT_ERROR_ICON]:[{property:"color",toProperty:"backgroundColor",toSelectors:["".concat(t," ").concat(eh)]}],[Or.CARD_INPUT_HELPER_ICON]:[{property:"color",toProperty:"backgroundColor",toSelectors:["".concat(t," ").concat(th)]}]}}}(t),Or)}function ah(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ah(Object(r),!0).forEach((function(t){ch(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ah(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ch(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function uh(e,t,r){return dh.apply(this,arguments)}function dh(){var e;return e=function*(e,t,r){try{e.metricsHandler.logEvent("OSA_VERIFICATION:START");var n=function(e){if("STORE"===e.intent)return e;var t,r,n=sh({},e);return"total"in n?(t=wi.moneyAmountToPaymentRequestAmount(n.total.amount,n.total.currencyCode),r=n.total.currencyCode,delete n.total):(t=n.amount,r=n.currencyCode),sh(sh({},n),{},{amount:t,currencyCode:r})}(t),i=yield e.analyticsBackend.verifyBuyer(r,n);return e.metricsHandler.logEvent("OSA_VERIFICATION:OK"),i}catch(t){if(e.metricsHandler.logEvent("OSA_VERIFICATION:ERROR"),en(t))throw new Rn([Ti]);throw t}},dh=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){lh(o,n,i,a,s,"next",e)}function s(e){lh(o,n,i,a,s,"throw",e)}a(void 0)}))},dh.apply(this,arguments)}function hh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ph(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var fh=/^-?[0-9]+(\.[0-9]+)?$/,mh=Va({includeInputLabels:Ua(Na()),postalCode:Ua(Ga()),style:Ua(Va())});function vh(e){var t=$a(mh),r=t.validate(e);if(r.isValid)return t.sanitize(e);throw Vs(r.issues,"card() configuration options")}function gh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gh(Object(r),!0).forEach((function(t){Eh(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gh(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Eh(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function _h(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){bh(o,n,i,a,s,"next",e)}function s(e){bh(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Ch(e,t){return void 0!==t?{status:Gr,token:"".concat(e,"#").concat(t)}:{status:Gr,token:e}}function Sh(e){return"".concat("single-card-wrapper","-").concat(e)}function Ih(e,t){var r=function(e){return"".concat("sq-single-card-custom-styles","-").concat(e)}(t),n=document.getElementById(r);null===n&&((n=document.createElement("style")).id=r,document.head.appendChild(n)),n.innerHTML=oh(e,Sh(t))}var Oh=class extends Ka{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.methodType=qr.CARD,this.updateCardDetailText=()=>{if(this.cardDetail){var e=this.fieldState.fieldHelperMessage(this.context.getLocaleString()),t=e.message,r=e.isError;this.cardDetail.classList.toggle(Fd,r),this.cardDetail.classList.toggle(Vd,!r),this.cardDetail.textContent!==t&&(this.cardDetail.textContent=t),this.cardDetail.classList.toggle(Gd,t.length>0)}},this.onResize=e=>{var t;if(this.iframe&&this.wrapperElement&&this.iframeContainer&&(this.lastResizeWidth=this.iframe.clientWidth,void 0===this.currentResizeTimeout)){var r=e=>{if(this.wrapperElement&&this.iframe&&this.iframeContainer){var t=this.inputLabelsIncluded?62:48;e<=505&&(t=2*t+1),this.iframeContainer.style.height="".concat(Math.round(t),"px"),this.iframe.height="".concat(Math.round(t),"px")}};r(null!==(t=this.lastResizeWidth)&&void 0!==t?t:0),this.currentResizeTimeout=window.setTimeout((()=>{var e;r(null!==(e=this.lastResizeWidth)&&void 0!==e?e:0),this.currentResizeTimeout=void 0}),100)}};var r=vh(t);this.id=_a(),this.iframeName="".concat("single-card","-").concat(this.id),this.paymentMessenger=new _c(this.context),this.tokenizeInProcess=!1,this.inputLabelsIncluded=!0===r.includeInputLabels,this.initializeMessageBus(),this.fieldState=new Pd([Ir.CARD_NUMBER,Ir.EXPIRATION_DATE,Ir.CVV,Ir.POSTAL_CODE],"US"),this.context.addLocaleChangedListener(this.updateCardDetailText),this.initialOptions=r,this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.configure=this.withErrorHandling(this.configure.bind(this),"configure"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}configure(){var e=arguments,t=this;return _h((function*(){var r=e.length>0&&void 0!==e[0]?e[0]:{};t.throwIfDestroyedOrNotAttached();var n=vh(r);t.metricsHandler.logConfigurationEvent("CONFIG_UPDATED",n),void 0!==n.includeInputLabels&&(t.inputLabelsIncluded=n.includeInputLabels,t.onResize()),void 0!==n.style&&Ih(n.style,t.id),yield t.paymentMessenger.request("configure",{includeInputLabels:t.inputLabelsIncluded,postalCode:n.postalCode,style:n.style,type:t.methodType})}))()}attach(e){var t=this;return _h((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED",t.initialOptions);try{var r=qc(e);t.attachPromise=t.buildElementOnIframe(r),yield t.attachPromise,t.attachPromise=void 0,t.throwIfDestroyed(),t.element=r,window.addEventListener("resize",t.onResize),t.showCardElement(),t.onResize()}catch(e){throw t.status=Ra.DETACHED,e}}))()}detach(){return this.throwIfDestroyed(),this.detachElement(Ra.DETACHED,"DETACHED")}destroy(){var e=this;return _h((function*(){if(e.status===Ra.DESTROYED)return!1;var t=yield e.detachElement(Ra.DESTROYED,"DESTROYED");return e.context.removeLocaleChangedListener(e.updateCardDetailText),t}))()}focus(e){var t=this;return _h((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Ir).includes(e))throw new ln(e);t.metricsHandler.logConfigurationEvent("FOCUSED",e);try{return yield t.paymentMessenger.request("setFocus",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}clear(){var e=this;return _h((function*(){e.throwIfDestroyedOrNotAttached(),e.metricsHandler.logConfigurationEvent("CLEAR");try{return yield e.paymentMessenger.request("clear")}catch(t){e.errorLogger.captureException(t)}return!1}))()}addEventListener(e,t){this.throwIfDestroyed(),this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){this.throwIfDestroyed(),super.removeEventListener(e,t)}tokenize(e,t){var r=this;return _h((function*(){var n,i,o,a,s=r.context.getFeatureFlagValues().one_shot_authentication_eligibility;try{var c,l,u,d=function(e,t){if(t&&void 0!==e){!function(e){var t=[];if(!eo(e))throw new Ri([Li("verificationDetails","object")]);if("billingContact"in e&&"object"==typeof e.billingContact||t.push(Li("verificationDetails.billingContact","object")),"intent"in e&&"string"==typeof e.intent&&["CHARGE","CHARGE_AND_STORE","STORE"].includes(e.intent)||t.push(Li("verificationDetails.intent","string")),"customerInitiated"in e&&"boolean"==typeof e.customerInitiated||t.push(Li("verificationDetails.customerInitiated","boolean")),"sellerKeyedIn"in e&&"boolean"==typeof e.sellerKeyedIn||t.push(Li("verificationDetails.sellerKeyedIn","boolean")),t.length>0)throw new Ri(t)}(e);var r=[];if(function(e){return"STORE"===e.intent}(e)?function(e,t){["amount","currencyCode","total"].forEach((r=>{r in e&&t.push({field:"verificationDetails.".concat(r),message:"The STORE intent does not support the ".concat(r," field."),type:"VALIDATION_ERROR"})}))}(e,r):function(e){return"total"in e}(e)?function(e,t){"object"!=typeof e.total?t.push(Li("verificationDetails.total","object")):"number"!=typeof e.total.amount?t.push(Li("verificationDetails.total.amount","number")):"string"!=typeof e.total.currencyCode&&t.push(Li("verificationDetails.total.currencyCode","string"))}(e,r):function(e,t){"string"!=typeof e.amount?t.push(Li("verificationDetails.amount","string")):fh.test(e.amount)||t.push({field:"verificationDetails.amount",message:"The amount needs to be a valid decimal monetary value.",type:"VALIDATION_ERROR"}),"string"!=typeof e.currencyCode&&t.push(Li("verificationDetails.currencyCode","string"))}(e,r),r.length>0)throw new Ri(r);return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hh(Object(r),!0).forEach((function(t){ph(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hh(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)}}(e,s),h=function(e){if(void 0!==e){if("string"!=typeof e)throw new Ri([Li("cofToken","string")]);return e.trim().length>0?e:void 0}}(t);if(void 0===h&&r.throwIfDestroyedOrNotAttached(),r.tokenizeInProcess)throw new Rn([Za]);if(r.metricsHandler.logConfigurationEvent("TOKENIZE_CONFIGURED",{cofToken:h,verificationDetails:d}),void 0!==h?(l=h,u=Ch(h)):(r.tokenizeInProcess=!0,c=yield r.paymentMessenger.request("requestCardNonceIfValidForm",{type:r.methodType}),r.tokenizeInProcess=!1,r.context.setPaymentMethodTrackingId(c.paymentMethodTrackingId),i=(n=c).card,o=n.billingContact,a=n.cardNonce,l=(u={details:{billing:o,card:i,method:qr.CARD},status:Gr,token:a}).token),s&&void 0!==d){var p;(function(e,t,r){if(!e)return!1;if(void 0===r)return!1;var n=t.billingContact.postalCode;return(null==n?void 0:n.toLowerCase())!==r.toLowerCase()})(r.context.getFeatureFlagValues().can_override_postal_code,d,null===(p=u.details)||void 0===p||null===(p=p.billing)||void 0===p?void 0:p.postalCode)&&(d.billingContact={postalCode:u.details.billing.postalCode},r.metricsHandler.logEvent("OSA_VERIFICATION:POSTAL_CODE_OVERRIDE"));var f=yield uh(r.context,d,l);void 0!==h&&(u=Ch(h,f.token))}return u}catch(e){if(e instanceof Ri)return{errors:e.errors,status:Vr};throw e}finally{r.tokenizeInProcess=!1}}))()}recalculateSize(){this.throwIfDestroyedOrNotAttached(),this.metricsHandler.logConfigurationEvent("RECALCULATED_SIZE"),this.onResize()}setError(e){var t=this;return _h((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Ir).includes(e))throw new ln(e);t.metricsHandler.logConfigurationEvent("SET_ERROR",e);try{return yield t.paymentMessenger.request("setError",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}buildElementOnIframe(e){var t=this;return _h((function*(){var r=Wc(_r.SINGLE_CARD_WRAPPER_STYLES,"sq-single-card-styles",document.head);yield t.buildCardElement(e),yield t.paymentMessenger.request("loadCardsForm",{configuration:yh(yh({},t.initialOptions),{},{type:t.methodType}),iframeName:t.iframeName}),yield r}))()}addErrorMessage(e){this.fieldState.setErrorOnField(e),this.updateCardDetailText()}removeErrorMessage(e){this.fieldState.removeErrorFromField(e),this.updateCardDetailText()}addFocusMessage(e){this.fieldState.setFocusOnField(e),this.updateCardDetailText()}removeFocusMessage(e){this.fieldState.removeFocusFromField(e),setTimeout((()=>{this.fieldState.hasFocus()||this.updateCardDetailText()}),50)}removeFocusClass(){setTimeout((()=>{var e;this.fieldState.hasFocus()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Vc)}),50)}removeErrorClass(){var e;this.fieldState.hasError()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Gc)}handleInputEvent(e){var t=e.data.payload.body;switch(t.eventType){case Sr.ERROR_CLASS_ADDED:var r;this.addErrorMessage(t.field),null===(r=this.wrapperElement)||void 0===r||r.classList.add(Gc);break;case Sr.ERROR_CLASS_REMOVED:this.removeErrorMessage(t.field),this.removeErrorClass();break;case Sr.FOCUS_CLASS_ADDED:var n;this.addFocusMessage(t.field),null===(n=this.wrapperElement)||void 0===n||n.classList.add(Vc);break;case Sr.FOCUS_CLASS_REMOVED:this.removeFocusMessage(t.field),this.removeFocusClass()}super.dispatchEvent(t.eventType,t)}handleSetPostalCountry(e){var t=e.data;this.fieldState.setPostalCountry(t.payload.body.postalCountry)}handleBankIdentificationNumberChanged(e){this.processBankIdentificationNumberChange(e).catch((e=>{this.errorLogger.captureException(e)}))}processBankIdentificationNumberChange(e){var t=this;return _h((function*(){var r=e.data;if(t.context.getFeatureFlagValues().eager_three_ds_method_execution_eligibility){var n=r.payload.body.bankIdentificationNumber,i=yield t.paymentMessenger.request("REQUEST_THREE_DS_METHOD_INITIALIZATION",{applicationId:t.context.getSession().applicationId,bin:n,locationId:t.context.getSession().locationId});"string"==typeof i.three_ds_server_transaction_id&&""!==i.three_ds_server_transaction_id.trim()&&"string"==typeof i.three_ds_method_url&&""!==i.three_ds_method_url.trim()&&"string"==typeof i.three_ds_method_notification_url&&""!==i.three_ds_method_notification_url.trim()&&t.context.analyticsBackend.execute3DSMethod({threeDSServerTransId:i.three_ds_server_transaction_id,threeDsMethodNotificationUrl:i.three_ds_method_notification_url,threeDsMethodUrl:i.three_ds_method_url})}}))()}initializeMessageBus(){var e=this.handleInputEvent.bind(this),t=this.handleSetPostalCountry.bind(this),r={bankIdentificationNumberChanged:this.handleBankIdentificationNumberChanged.bind(this),cardBrandChanged:e,errorClassAdded:e,errorClassRemoved:e,escape:e,focusClassAdded:e,focusClassRemoved:e,postalCodeChanged:e,setPostalCountry:t,submit:e};this.paymentMessenger.initializeMessageBus(r)}buildCardIframe(e){return Od({frameborder:"0",height:"0px",name:this.iframeName,scrolling:"no",src:_r.SINGLE_CARD_IFRAME,title:this.context.getLocaleString().paymentMethods.cards.formTitle,width:"100%"},e)}hideCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.setAttribute("hidden","")}showCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.removeAttribute("hidden")}buildCardElement(e){var t=this;return _h((function*(){var r;t.wrapperElement=document.createElement("div"),t.wrapperElement.id=Sh(t.id),t.wrapperElement.classList.add(Bd),t.context.getFeatureFlagValues().show_square_monochrome&&t.wrapperElement.classList.add(Yc),t.hideCardElement(),t.cardDetail=document.createElement("span"),t.cardDetail.classList.add(Hd),e.appendChild(t.wrapperElement),t.iframeContainer=document.createElement("div"),t.iframeContainer.classList.add(Ud),t.wrapperElement.appendChild(t.iframeContainer),t.iframe=yield t.buildCardIframe(t.iframeContainer),t.iframe.classList.add(qd),t.wrapperElement.appendChild(t.cardDetail),null!==(r=t.initialOptions)&&void 0!==r&&r.style&&Ih(t.initialOptions.style,t.id)}))()}detachElement(e,t){var r=this;return _h((function*(){var n=r.status;if(r.attachPromise)try{yield r.attachPromise}catch(e){}try{var i=yield r.paymentMessenger.request("destroy");return r.element&&(wd(r.element),window.removeEventListener("resize",r.onResize)),r.status=e,r.metricsHandler.logConfigurationEvent(t),i}catch(e){throw r.status=n,e}}))()}};class wh extends Cr{constructor(){super("A grant was not returned from CashApp and is required for tokenization"),this.name="CashAppPayGrantIsUndefinedError",Object.setPrototypeOf(this,wh.prototype)}}var Ah=["CUSTOMER_INTERACTION","CUSTOMER_DISMISSED","CUSTOMER_REQUEST_APPROVED","CUSTOMER_REQUEST_DECLINED","CUSTOMER_REQUEST_FAILED"],Th=Ua(ja([{eligible:e=>eo(e),schemaOperation:Va({shape:Ua(Ga({legalValues:Ao})),size:Ua(Ga({legalValues:wo})),theme:Ua(Ga({legalValues:To})),values:Ua(Ga({legalValues:To})),width:Ua(Ga({legalValues:Po}))})},{eligible:e=>!1===e,schemaOperation:Na({legalValues:[!1]})}],{code:"invalid_value",expected:"options hash or false value",propertyPath:""}));function Ph(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Nh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ph(Object(r),!0).forEach((function(t){Dh(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ph(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dh(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Lh(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Rh(o,n,i,a,s,"next",e)}function s(e){Rh(o,n,i,a,s,"throw",e)}a(void 0)}))}}var xh=new Set(["USD"]),kh="cash_app_pay_v1_element";class Mh extends Ka{constructor(e,t,r,n,i){if(super(n),this.methodType=qr.CASH_APP_PAY,this.wasFirstInteractionCalled=!1,this.isMobile=!1,this.payKit=e,this.req=t,this.req.addPaymentMethodUsage("Cash App Pay"),this.context=n,this.paymentRequestLockController=i,this.paymentMessenger=new _c(this.context),this.tokenizeValidator=function(){return Promise.resolve(!0)},this.clickEventHandler=()=>{this.beginAuthorizationFlow()},!wi.isNonBlankString(this.session.locationId))throw new Cn(fa.INVALID_CONFIG,"locationId");if(!wi.isNonBlankString(this.session.cashAppPayMerchantIdentifier))throw new Cn(fa.INVALID_CONFIG,"merchantId");if(!xh.has(this.req.currencyCode))throw new vn("".concat(this.req.currencyCode," is not supported by CashAppPay. Valid currencies are: ").concat([...xh].join(", ")));if(wi.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode)<1)throw new vn("".concat(this.req.total.amount," is an invalid payment amount. Total amount should be greater than 0"));if(!r.redirectURL)throw new gn;for(var o of(this.cashAppPaymentRequestOptions=r,this.cashAppPayMerchantIdentifier=this.session.cashAppPayMerchantIdentifier,this.cashAppEventHandler={CUSTOMER_DISMISSED:()=>{this.dispatchEvent("customerDismissed",null)},CUSTOMER_INTERACTION:e=>{this.registerExternalEventStart(e)},CUSTOMER_REQUEST_APPROVED:e=>{this.customerRequestApprovedEvent(e)},CUSTOMER_REQUEST_DECLINED:()=>{this.customerRequestDeclinedEvent()},CUSTOMER_REQUEST_FAILED:()=>{this.customerRequestFailedEvent()}},Ah))this.payKit.addEventListener(o,this.cashAppEventHandler[o]);this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.paymentRequestLockController.lock(this)}attach(e,t,r){var n=this;return Lh((function*(){var i;n.throwIfDestroyedOrAlreadyAttached();try{var o=!1===(i=function(e){var t=$a(Th).validate(e);if(!t.isValid)throw t.issues.some((e=>"invalid_type"===e.code))?new fn(t.issues.map((e=>[e.propertyPath,e.expected]))):new mn(t.issues.map((e=>[e.propertyPath,e.expected])));var r,n=e;return!1===n||void 0===n||!("values"in n)||null!==(r=n.theme)&&void 0!==r||(n.theme=n.values),n}(t));if(r&&(n.tokenizeValidator=r),"function"!=typeof n.tokenizeValidator)throw new yn;void 0===i||o||n.metricsHandler.logConfigurationEvent("CONFIGURED",t),n.status=Ra.ATTACHED,n.element=o?Hc(e):qc(e);var a=document.createElement("div");a.id=kh,o?n.element.before(a):n.element.appendChild(a);var s="#".concat(kh);n.renderController=yield n.payKit.render(s,{button:i,manage:!1}),n.element.addEventListener("click",n.clickEventHandler)}catch(e){n.status=Ra.DETACHED;var c=qi(e);if("CashAppPayError"===c.name&&c.message.includes("already rendered"))throw new Sn(qr.CASH_APP_PAY);throw e}}))()}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):(this.detachElement(Ra.DESTROYED,"DESTROYED"),this.paymentRequestLockController.unlock(this),this.payKit.restart(),Ah.forEach((e=>{this.payKit.removeEventListener(e,this.cashAppEventHandler[e])})),Promise.resolve(!0))}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(Ra.DETACHED,"DETACHED"),Promise.resolve(!0)}addEventListener(e,t){this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}initializeCustomerRequest(){var e=this;return Lh((function*(){var t=Nh({actions:{payment:{amount:{currency:e.req.currencyCode,value:wi.paymentRequestAmountToMoneyAmount(e.req.total.amount,e.req.currencyCode)},scopeId:e.cashAppPayMerchantIdentifier}}},e.cashAppPaymentRequestOptions);try{yield e.payKit.customerRequest(t)}catch(e){var r=e.name,n=e.message;if("CashAppPayError"===r&&"redirectURL must be a valid URL"===n)throw new vn(n);throw e}}))()}customerRequestApprovedEvent(e){var t=this;return Lh((function*(){var r=yield t.createNonce(e);t.dispatchEvent("ontokenization",{tokenResult:r})}))()}customerRequestDeclinedEvent(){var e={status:Hr};this.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),this.dispatchEvent("ontokenization",{tokenResult:e})}customerRequestFailedEvent(){var e={errors:[new Ln("tokenizing Cash App Pay")],status:Fr};this.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),this.dispatchEvent("ontokenization",{tokenResult:e})}createNonce(e){var t=this;return Lh((function*(){var r=e.customerProfile.cashtag,n=e.grants,i=e.referenceId,o=n.payment,a=t.req,s=a.total.amount,c=a.currencyCode;try{if(!o)throw new wh;var l=yield t.paymentMessenger.request("REQUEST_CASH_APP_PAY_INSTANT_WALLET_TOKEN",{applicationId:t.session.applicationId,cashAppPayData:{cashtag:r,grantId:o.grantId,isMobile:t.isMobile,referenceId:i,totalAmount:{amount:s,currency:c}},clientID:t.session.applicationId,instanceID:t.session.instanceId,locationID:t.session.locationId,paymentMethodTrackingID:t.context.getPaymentMethodTrackingId(),requestBillingContact:t.req.requestBillingContact,requestShippingContact:t.req.requestShippingContact,sessionID:t.session.sessionId,websdkVersion:_r.VERSION});return t.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),{details:{cashAppPay:{cashtag:r,referenceId:i},method:qr.CASH_APP_PAY},status:Gr,token:l.token}}catch(e){var u;return t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e instanceof Rn?u=e:(t.errorLogger.captureException(e),u=new Ln("tokenizing CashAppPay")),{errors:[u],status:Fr}}}))()}beginAuthorizationFlow(){var e=this;return Lh((function*(){if(e.throwIfDestroyedOrNotAttached(),!e.renderController)throw new Ln("Could not begin Cash App Pay authorization flow");e.metricsHandler.logEvent("CASH_APP_PAY_CLICK:VALIDATING");try{(yield e.tokenizeValidator())?(e.renderController.begin(),e.metricsHandler.logEvent("CASH_APP_PAY_AUTH:START")):e.metricsHandler.logEvent("CASH_APP_PAY_CLICK:INVALID")}catch(t){throw e.metricsHandler.logEvent("CASH_APP_PAY_CLICK:ERROR"),t}}))()}registerExternalEventStart(e){this.metricsHandler.logEvent("EXTERNAL_SESSION:START"),this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK")),this.isMobile=e.isMobile,this.dispatchEvent("customerInteraction",Nh({},e))}detachElement(e,t){this.renderController&&this.renderController.destroy();var r=document.getElementById(kh);r&&r.remove(),this.element&&this.element.removeEventListener("click",this.clickEventHandler),this.status=e,this.metricsHandler.logConfigurationEvent(t)}}function jh(){return(jh=Lh((function*(){var e="https://kit.cashstaging.app/v1/pay.js",t="SQ_SELLER";return"sandbox"===_r.env?(e="https://sandbox.kit.cash.app/v1/pay.js",t="CAS-CI_SQ_SELLER_SANDBOX"):"production"===_r.env&&(e="https://kit.cash.app/v1/pay.js",t="CA-CI_SQ_SELLER"),(yield os.load("cash-app-pay",{src:e},"CashApp")).pay({clientId:t})}))).apply(this,arguments)}var Uh={initialize:function(){return jh.apply(this,arguments)}};function Bh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function qh(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Bh(o,n,i,a,s,"next",e)}function s(e){Bh(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Hh(){return(Hh=qh((function*(e,t){var r="production"===_r.env?"https://src.mastercard.com/srci/integration/2/lib.js":"https://sandbox.src.mastercard.com/srci/integration/2/lib.js",n=wi.buildUrl(r,{locale:e,srcDpaId:t});return new(yield os.load("mastercard-ctp",{src:n},"Click2Pay"))}))).apply(this,arguments)}var Fh="https://src.mastercard.com/srci/integration/components/src-ui-kit/src-ui-kit.css",Vh="sq-mastercard-ui-styles";function Gh(){return(Gh=qh((function*(){var e,t=document.querySelector('link[href="'.concat(Fh,'"]'));null!==t?(t.id||(t.id=Vh),e=Promise.resolve()):e=Wc(Fh,Vh,document.head),yield Promise.all([os.load("mastercard-ui",{src:"https://src.mastercard.com/srci/integration/components/src-ui-kit/src-ui-kit.esm.js",type:"module"}),e])}))).apply(this,arguments)}var zh={attachUiScripts:function(){return Gh.apply(this,arguments)},initialize:function(e,t){return Hh.apply(this,arguments)}},$h=Va({includeInputLabels:Ua(Na()),style:Ua(Va())});function Yh(e){var t=$a($h),r=t.validate(e);if(r.isValid)return t.sanitize(e);throw Vs(r.issues,"giftCard() configuration options")}function Wh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Kh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wh(Object(r),!0).forEach((function(t){Zh(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wh(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Zh(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Xh(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Jh(o,n,i,a,s,"next",e)}function s(e){Jh(o,n,i,a,s,"throw",e)}a(void 0)}))}}class Qh extends Ka{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.methodType=qr.GIFT_CARD,this.onResize=e=>{if(this.iframe&&this.wrapperElement&&this.iframeContainer&&void 0===this.currentResizeTimeout){var t=()=>{if(this.wrapperElement&&this.iframe&&this.iframeContainer){var e=this.inputLabelsIncluded?62:48;e+=2,this.iframe.style.height="".concat(e,"px"),this.iframeContainer.style.height="".concat(Math.round(e),"px")}};t(),this.currentResizeTimeout=window.setTimeout((()=>{t(),this.currentResizeTimeout=void 0}),100)}};var r=Yh(t);this.id=_a(),this.iframeName="".concat("gift-card","-").concat(this.id),this.paymentMessenger=new _c(this.context),this.tokenizeInProcess=!1,this.inputLabelsIncluded=Boolean(r.includeInputLabels),this.initializeMessageBus(),this.initialOptions=r,this.fieldState=new Pd([wr.GIFT_CARD_NUMBER]),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.configure=this.withErrorHandling(this.configure.bind(this),"configure"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}attach(e){var t=this;return Xh((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED",t.initialOptions);try{var r=qc(e);t.attachPromise=t.buildElementOnIframe(r),yield t.attachPromise,t.attachPromise=void 0,t.throwIfDestroyed(),t.element=r,window.addEventListener("resize",t.onResize),t.showCardElement(),t.onResize()}catch(e){throw t.status=Ra.DETACHED,e}}))()}detach(){return this.throwIfDestroyed(),this.detachElement(Ra.DETACHED,"DETACHED")}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):this.detachElement(Ra.DESTROYED,"DESTROYED")}configure(e){var t=this;return Xh((function*(){t.throwIfDestroyedOrNotAttached();var r=Yh(e);void 0!==r.includeInputLabels&&(t.inputLabelsIncluded=r.includeInputLabels,t.onResize()),void 0!==r.style&&tp(r.style,t.id),t.metricsHandler.logConfigurationEvent("CONFIG_UPDATED",r),yield t.paymentMessenger.request("giftCardConfigure",{includeInputLabels:t.inputLabelsIncluded,style:r.style,type:t.methodType})}))()}focus(e){var t=this;return Xh((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(wr).includes(e))throw new ln(e);t.metricsHandler.logConfigurationEvent("FOCUSED",e);try{return yield t.paymentMessenger.request("giftCardSetFocus",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}clear(){var e=this;return Xh((function*(){e.throwIfDestroyedOrNotAttached();try{return yield e.paymentMessenger.request("giftCardClear")}catch(t){e.errorLogger.captureException(t)}return e.metricsHandler.logConfigurationEvent("CLEAR"),!1}))()}addEventListener(e,t){this.throwIfDestroyed(),this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){this.throwIfDestroyed(),super.removeEventListener(e,t)}tokenize(){var e=this;return Xh((function*(){if(e.throwIfDestroyedOrNotAttached(),e.tokenizeInProcess)throw new Rn([Za]);e.tokenizeInProcess=!0;try{var t=yield e.paymentMessenger.request("giftCardRequestCardNonceIfValidForm",{type:e.methodType});return e.tokenizeInProcess=!1,e.context.setPaymentMethodTrackingId(t.paymentMethodTrackingId),n=(r=t).card,i=r.cardNonce,{details:{giftCard:n,method:qr.GIFT_CARD},status:Gr,token:i}}catch(e){if(e instanceof Ri)return{errors:e.errors,status:Vr};throw e}finally{e.tokenizeInProcess=!1}var r,n,i}))()}setError(e){var t=this;return Xh((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(wr).includes(e))throw new ln(e);t.metricsHandler.logConfigurationEvent("SET_ERROR",e);try{return yield t.paymentMessenger.request("giftCardSetError",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}buildElementOnIframe(e){var t=this;return Xh((function*(){var r=Wc(_r.SINGLE_CARD_WRAPPER_STYLES,"sq-single-card-styles",document.head);yield t.buildCardElement(e),yield t.paymentMessenger.request("loadGiftCardsForm",{configuration:Kh(Kh({},t.initialOptions),{},{type:t.methodType}),iframeName:t.iframeName}),yield r}))()}buildCardElement(e){var t=this;return Xh((function*(){var r;t.wrapperElement=document.createElement("div"),t.wrapperElement.id=ep(t.id),t.wrapperElement.classList.add(Bd),t.hideCardElement(),t.cardDetail=document.createElement("span"),t.cardDetail.classList.add(Hd),e.appendChild(t.wrapperElement),t.context.getFeatureFlagValues().show_square_monochrome&&t.wrapperElement.classList.add(Yc),t.iframeContainer=document.createElement("div"),t.iframeContainer.classList.add(Ud),t.wrapperElement.appendChild(t.iframeContainer),t.iframe=yield t.buildCardIframe(t.iframeContainer),t.iframe.classList.add(qd),t.wrapperElement.appendChild(t.cardDetail),null!==(r=t.initialOptions)&&void 0!==r&&r.style&&tp(t.initialOptions.style,t.id)}))()}buildCardIframe(e){return Od({frameborder:"0",height:"0px",name:this.iframeName,scrolling:"no",src:_r.GIFT_CARD_IFRAME,title:this.context.getLocaleString().paymentMethods.giftCards.formTitle,width:"100%"},e)}hideCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.setAttribute("hidden","")}showCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.removeAttribute("hidden")}updateCardDetailText(){if(this.cardDetail){var e=this.fieldState.fieldHelperMessage(this.context.getLocaleString()),t=e.message,r=e.isError;this.cardDetail.classList.toggle(Fd,r),this.cardDetail.classList.toggle(Vd,!r),this.cardDetail.textContent!==t&&(this.cardDetail.textContent=t),this.cardDetail.classList.toggle(Gd,t.length>0)}}addErrorMessage(e){this.fieldState.setErrorOnField(e),this.updateCardDetailText()}removeErrorMessage(e){this.fieldState.removeErrorFromField(e),this.updateCardDetailText()}addFocusMessage(e){this.fieldState.setFocusOnField(e),this.updateCardDetailText()}removeFocusMessage(e){this.fieldState.removeFocusFromField(e),setTimeout((()=>{this.fieldState.hasFocus()||this.updateCardDetailText()}),50)}handleInputEvent(e){var t=e.data.payload.body;switch(t.eventType){case Ar.ERROR_CLASS_ADDED:var r;this.addErrorMessage(t.field),null===(r=this.wrapperElement)||void 0===r||r.classList.add(Gc);break;case Ar.ERROR_CLASS_REMOVED:this.removeErrorMessage(t.field),this.removeErrorClass();break;case Ar.FOCUS_CLASS_ADDED:var n;this.addFocusMessage(t.field),null===(n=this.wrapperElement)||void 0===n||n.classList.add(Vc);break;case Ar.FOCUS_CLASS_REMOVED:this.removeFocusMessage(t.field),this.removeFocusClass()}super.dispatchEvent(t.eventType,t)}removeFocusClass(){setTimeout((()=>{var e;this.fieldState.hasFocus()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Vc)}),50)}removeErrorClass(){var e;this.fieldState.hasError()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Gc)}initializeMessageBus(){var e=this.handleInputEvent.bind(this),t={cardBrandChanged:e,errorClassAdded:e,errorClassRemoved:e,escape:e,focusClassAdded:e,focusClassRemoved:e,submit:e};this.paymentMessenger.initializeMessageBus(t)}detachElement(e,t){var r=this;return Xh((function*(){var n=r.status;if(r.attachPromise)try{yield r.attachPromise}catch(e){}try{var i=yield r.paymentMessenger.request("giftCardDestroy");return r.element&&(wd(r.element),window.removeEventListener("resize",r.onResize)),r.status=e,r.metricsHandler.logConfigurationEvent(t),i}catch(e){throw r.status=n,e}}))()}}function ep(e){return"".concat("gift-card-wrapper","-").concat(e)}function tp(e,t){var r=function(e){return"".concat("sq-gift-card-custom-styles","-").concat(e)}(t),n=document.getElementById(r);null===n&&((n=document.createElement("style")).id=r,document.head.appendChild(n)),n.innerHTML=oh(e,ep(t))}class rp extends Cr{constructor(e){super("The event listener for ".concat(e," timed out (30 seconds). If you've returned a promise, ensure it is resolving")),this.name="EventListenerTimeoutError",Object.setPrototypeOf(this,rp.prototype)}}function np(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}class ip{constructor(){this.listenerRegistry=new Ea}addEventListener(e,t){this.listenerRegistry.addEventListener(e,t)}removeEventListener(e,t){this.listenerRegistry.removeEventListener(e,t)}dispatchEvent(e,t,r){var n,i=this;return(n=function*(){var n=new Jn(e,t),o=i.listenerRegistry.listenersForType(e),a=function*(){var t,i;try{t=s(n)}catch(t){throw new sn(e,Hi(t))}if(t instanceof Promise)try{i=yield ur((()=>t),3e4,new rp(e))}catch(t){if(t instanceof rp)throw t;throw new sn(e,Hi(t))}else i=t;r&&r(i)};for(var s of o)yield*a()},function(){var e=this,t=arguments;return new Promise((function(r,i){var o=n.apply(e,t);function a(e){np(o,r,i,a,s,"next",e)}function s(e){np(o,r,i,a,s,"throw",e)}a(void 0)}))})()}hasEventListener(e){return this.listenerRegistry.hasEventListener(e)}}function op(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function ap(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){op(o,n,i,a,s,"next",e)}function s(e){op(o,n,i,a,s,"throw",e)}a(void 0)}))}}function sp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function cp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lp(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class up{constructor(e,t,r){this.eventTarget=new ip,this.metricsBuffer=[],cl(e),this.localeStrings=t,this._requestBillingContact=Boolean(e.requestBillingContact),this._requestShippingContact=Boolean(e.requestShippingContact),this._countryCode=e.countryCode,this._currencyCode=e.currencyCode,this._lineItems=e.lineItems,this._shippingLineItems=e.shippingLineItems,this._taxLineItems=e.taxLineItems,this._discounts=e.discounts,this._total=e.total,this._shippingOptions=e.shippingOptions,this._shippingContact=e.shippingContact,this._pickupContact=e.pickupContact,this.updateLock=r,this.paymentMethodUsages=[]}get requestBillingContact(){return this._requestBillingContact}get requestShippingContact(){return this._requestShippingContact}get countryCode(){return this._countryCode}get currencyCode(){return this._currencyCode}get lineItems(){return this._lineItems}get pickupContact(){return this._pickupContact}get shippingLineItems(){return this._shippingLineItems}get taxLineItems(){return this._taxLineItems}get discounts(){return this._discounts}get total(){return this._total}get shippingOptions(){return this._shippingOptions}get shippingContact(){return this._shippingContact}addPaymentMethodUsage(e){this.paymentMethodUsages.push(e),"Google Pay"===e&&(this.total.amount=wi.sanitizePaymentRequestAmount(this.total.amount,this.currencyCode))}update(e){var t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cp(Object(r),!0).forEach((function(t){lp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({countryCode:this.countryCode,currencyCode:this.currencyCode,discounts:this.discounts,lineItems:this.lineItems,pickupContact:this.pickupContact,requestBillingContact:this.requestBillingContact,requestShippingContact:this.requestShippingContact,shippingContact:this.shippingContact,shippingLineItems:this.shippingLineItems,shippingOptions:this.shippingOptions,taxLineItems:this.taxLineItems,total:this.total},e);if(this.updateLock.isLocked)return!1;cl(t),e.total&&(void 0!==this.metricsHandler&&al(t.total,t.currencyCode,this.metricsHandler,"update"),this._total=e.total,this.paymentMethodUsages.includes("Google Pay")&&(this._total.amount=wi.sanitizePaymentRequestAmount(t.total.amount,t.currencyCode),t.total=this._total));var r=new up(t,this.localeStrings,this.updateLock);if(this.paymentMethodUsages.includes("AfterpayClearpay"))try{kl(r)}catch(e){var n;null===(n=this.metricsHandler)||void 0===n||n.logValidationEvent("REQUEST_AFTERPAY_INVALID",{exceptionMessage:Hi(e),paymentMethodUsages:this.paymentMethodUsages})}return void 0!==e.requestBillingContact&&(this._requestBillingContact=Boolean(e.requestBillingContact)),void 0!==e.requestShippingContact&&(this._requestShippingContact=Boolean(e.requestShippingContact)),void 0!==e.countryCode&&(this._countryCode=e.countryCode),void 0!==e.currencyCode&&(this._currencyCode=e.currencyCode),e.lineItems&&(this._lineItems=e.lineItems),e.shippingLineItems&&(this._shippingLineItems=e.shippingLineItems),e.taxLineItems&&(this._taxLineItems=e.taxLineItems),e.discounts&&(this._discounts=e.discounts),e.pickupContact&&(this._pickupContact=e.pickupContact),e.shippingOptions&&(this._shippingOptions=e.shippingOptions),e.shippingContact&&(this._shippingContact=e.shippingContact),this.eventTarget.dispatchEvent(Zc.UPDATE,r),this.logMetrics("CONFIG_UPDATED",t),!0}addEventListener(e,t){switch(wi.enumValues(Ur).includes(e)&&this.logMetrics("EVENT_LISTENER_ADDED",e),e){case Ur.SHIPPING_CONTACT_CHANGED:this.shippingContactEventListener(t);break;case Ur.SHIPPING_OPTION_CHANGED:this.shippingOptionEventListener(t);break;case Zc.UPDATE:this.updateEventListener(t);break;case Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED:this.afterpayShippingContactEventListener(t);break;case Br.AFTERPAY_SHIPPING_OPTION_CHANGED:this.afterpayShippingOptionEventListener(t);break;default:throw new ga("PaymentRequest.addEventListener","event","PaymentRequestEvent")}}dispatchEvent(e,t,r){return this.eventTarget.dispatchEvent(e,t,(n=>{if(e===Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED)return function(e){var t=$a(gl).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new an(t.issues.map((e=>[e.propertyPath,e.expected])))}(n),void r(n);if(e!==Br.AFTERPAY_SHIPPING_OPTION_CHANGED)!function(e){var t=$a(il).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new an(t.issues.map((e=>[e.propertyPath,e.expected])))}(n),r(n);else try{this.logMetrics("SHIPPING_OPTION_UPDATE_RECEIVED",n),function(e){var t=$a(yl).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new an(t.issues.map((e=>[e.propertyPath,e.expected])))}(n),r(n)}catch(e){if("requireValidation"in t&&!0===t.requireValidation||!(e instanceof an))throw e}}))}hasEventListener(e){return this.eventTarget.hasEventListener(e)}setMetricsHandler(e){this.metricsHandler=e,this.metricsBuffer.length>0&&(this.metricsBuffer.forEach((t=>{var r,n,i=(n=2,function(e){if(Array.isArray(e))return e}(r=t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,n)||function(e,t){if(e){if("string"==typeof e)return sp(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?sp(e,t):void 0}}(r,n)||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.")}()),o=i[0],a=i[1];e.logConfigurationEvent(o,a)})),this.metricsBuffer=[])}shippingContactEventListener(e){var t=this;this.eventTarget.addEventListener(Ur.SHIPPING_CONTACT_CHANGED,function(){var r=ap((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return console.error("ShippingContactUpdateError",e),{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.contactError}}}));return function(e){return r.apply(this,arguments)}}())}shippingOptionEventListener(e){var t=this;this.eventTarget.addEventListener(Ur.SHIPPING_OPTION_CHANGED,function(){var r=ap((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return console.error("ShippingOptionUpdateError",e),{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return r.apply(this,arguments)}}())}afterpayShippingContactEventListener(e){var t=this;this.eventTarget.addEventListener(Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED,function(){var r=ap((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return r.apply(this,arguments)}}())}afterpayShippingOptionEventListener(e){var t=this;this.eventTarget.addEventListener(Br.AFTERPAY_SHIPPING_OPTION_CHANGED,function(){var r=ap((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return r.apply(this,arguments)}}())}updateEventListener(e){this.eventTarget.addEventListener(Zc.UPDATE,(t=>{e(t.detail)}))}logMetrics(e,t){this.metricsHandler?this.metricsHandler.logConfigurationEvent(e,t):this.metricsBuffer.push([e,t])}}function dp(e){return Boolean(e.shippingOptions&&e.shippingOptions.length>0)}function hp(e,t){return new Intl.NumberFormat(a.windowNavigatorLanguages,{currency:t,style:"currency"}).format(Number.parseFloat(e))}function pp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function fp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function mp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fp(Object(r),!0).forEach((function(t){vp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function vp(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gp=["PAN_ONLY","CRYPTOGRAM_3DS"],yp=["AMEX","DISCOVER","JCB","MASTERCARD","VISA"];function Ep(e){return{label:e.label,price:e.amount,status:!0===e.pending?"ESTIMATED":"FINAL",type:"LINE_ITEM"}}function bp(e,t){var r=null!=t?t:e;return r?r.map((e=>Ep(e))):[]}function _p(e,t){return t.map((t=>function(e,t){return{description:hp(t.amount,e),id:t.id,label:t.label}}(e,t)))}function Cp(e,t,r,n){var i=null!=n?n:r;if(i&&i.length>0){var o={shippingOptions:_p(e,i)},a=i.some((e=>e.id===t));return a&&(o.defaultSelectedOptionId=t),o}}function Sp(e,t){return null==t?void 0:t.find((t=>t.id===e))}function Ip(e,t,r,n,i,o){var a=t.countryCode,s=t.currencyCode,c=t.total,l=t.lineItems,u=t.taxLineItems,d=t.discounts,h=t.requestBillingContact,p=t.requestShippingContact,f=t.shippingOptions,m=dp(t),v=Boolean(p||m),g=mp(mp({},e),{},{emailRequired:Boolean(h),merchantInfo:i,shippingAddressRequired:v,shippingOptionRequired:m,transactionInfo:{countryCode:a,currencyCode:s,totalPrice:c.amount,totalPriceLabel:c.label,totalPriceStatus:n}});if(l&&l.length>0&&(g.transactionInfo.displayItems=bp([],ol({discounts:d,lineItems:l,taxLineItems:u},t))),v&&(g.shippingAddressParameters={phoneNumberRequired:!0}),m){var y=Cp(s,o,[],f);y&&(g.shippingOptionParameters=y)}return r.length>0&&(g.callbackIntents=r),g}function Op(e,t){var r=[];return void 0!==e.error&&r.push({intent:t,message:e.error,reason:zn.SHIPPING_ADDRESS_UNSERVICEABLE}),e.shippingErrors&&Object.entries(e.shippingErrors).forEach((e=>{var n,i,o=(i=2,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return pp(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pp(e,t):void 0}}(n,i)||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.")}()),a=o[0],s=o[1];r.push({intent:t,message:"".concat(a,": ").concat(s),reason:zn.SHIPPING_ADDRESS_INVALID})})),r}function wp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ap(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wp(Object(r),!0).forEach((function(t){Tp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Tp(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pp(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Np(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Pp(o,n,i,a,s,"next",e)}function s(e){Pp(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Dp=["#google"];class Rp extends Ka{constructor(e,t,r,n,i){var o;super(r),this.methodType=qr.GOOGLE_PAY,this.shippingOptions=void 0,this.wasFirstInteractionCalled=!1,this.validateConfiguration(),this.logDebugInfoIfEnabled("init"),this.paymentRequestLockController=i,this.req=t,this.req.addPaymentMethodUsage("Google Pay"),this.merchantInfo=n,this.element=null,this.isReadyToPayChecked=!1,this.paymentMethodMessenger=new _c(r),dp(this.req)&&(this.shippingOptions=this.req.shippingOptions,this.selectedShippingOptionId=null===(o=this.req.shippingOptions)||void 0===o?void 0:o[0].id),this.callbackIntents=function(e,t){var r=[],n=dp(e)&&t.includes(Ur.SHIPPING_OPTION_CHANGED),i=e.requestShippingContact&&t.includes(Ur.SHIPPING_CONTACT_CHANGED);return n?r.push("SHIPPING_ADDRESS","SHIPPING_OPTION"):i&&r.push("SHIPPING_ADDRESS"),(!a.isAndroid()||n||i)&&r.push("PAYMENT_AUTHORIZATION"),r}(this.req,this.handlers);var s,c,l,u,d=function(e,t,r){var n="TEST";"production"===_r.env&&(n="PRODUCTION");var i={environment:n,merchantInfo:r},o=e.includes("SHIPPING_OPTION")||e.includes("SHIPPING_ADDRESS");if(!a.isAndroid()||o){var s={onPaymentAuthorized:()=>({transactionState:"SUCCESS"})};o&&(s.onPaymentDataChanged=t),i.paymentDataCallbacks=s}return i}(this.callbackIntents,this.onPaymentDataChanged.bind(this),this.merchantInfo);this.googlePayClient=new e.api.PaymentsClient(d),this.isReadyToPayRequest=(s=this.session.applicationId,c=this.req.requestBillingContact,l=this.context.getFeatureFlagValues().can_use_interac,u=[...yp],l&&u.push("INTERAC"),{allowedPaymentMethods:[{parameters:{allowedAuthMethods:gp,allowedCardNetworks:u,billingAddressParameters:{format:c?"FULL":"MIN",phoneNumberRequired:Boolean(c)},billingAddressRequired:!0},tokenizationSpecification:{parameters:{gateway:"square",gatewayMerchantId:s},type:"PAYMENT_GATEWAY"},type:"CARD"}],apiVersion:2,apiVersionMinor:0}),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}get handlers(){var e=[];return this.req.hasEventListener(Ur.SHIPPING_OPTION_CHANGED)&&e.push(Ur.SHIPPING_OPTION_CHANGED),this.req.hasEventListener(Ur.SHIPPING_CONTACT_CHANGED)&&e.push(Ur.SHIPPING_CONTACT_CHANGED),e}attach(e,t){var r=this;return Np((function*(){r.throwIfDestroyedOrAlreadyAttached(),r.status=Ra.ATTACHED,r.metricsHandler.logConfigurationEvent("CONFIGURED",t);try{r.element=Hc(e),yield r.checkIfReadyToPay(),r.isReadyToPayChecked=!0;var n=null!=t?t:{},i=n.buttonColor,o=n.buttonSizeMode,a=n.buttonType,s=n.buttonBorderType,c=n.buttonRadius,l=r.context.getFeatureFlagValues().show_square_monochrome,u=l?20:void 0,d={buttonBorderType:null!=s?s:l?"no_border":"default_border",buttonColor:null!=i?i:Fn.DEFAULT,buttonRadius:null!=c?c:u,buttonSizeMode:null!=o?o:Vn.STATIC,buttonType:null!=a?a:Gn.LONG,onClick:()=>{}},h=r.googlePayClient.createButton(d);r.element.appendChild(h)}catch(e){throw r.status=Ra.DETACHED,Lp(e)}}))()}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(Ra.DETACHED,"DETACHED"),Promise.resolve(!0)}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):(this.detachElement(Ra.DESTROYED,"DESTROYED"),Promise.resolve(!0))}tokenize(e){var t=this;return Np((function*(){var r;t.throwIfDestroyed(),t.handleFirstInteraction();try{t.metricsHandler.logEvent("EXTERNAL_SESSION:START"),t.isReadyToPayChecked||(yield t.checkIfReadyToPay(),t.isReadyToPayChecked=!0),t.paymentRequestLockController.lock(t),r=yield t.loadPaymentData(),delete t.googlePayTokenDeferred,t.metricsHandler.logEvent("EXTERNAL_SESSION:OK")}catch(e){if(delete t.googlePayTokenDeferred,t.paymentRequestLockController.unlock(t),function(e){return null!==e&&"object"==typeof e&&"statusCode"in e}(e)&&"CANCELED"===e.statusCode)return t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),{status:Hr};throw t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),Lp(e)}var n=yield t.requestGooglePayCardNonce(r),i=n.token,o=n.details;if(t.context.getFeatureFlagValues().one_shot_authentication_google_pay){var a,s=Ap(Ap({},e),{},{amount:t.req.total.amount,billingContact:null!==(a=o.billing)&&void 0!==a?a:{},currencyCode:t.req.currencyCode,customerInitiated:!0,intent:"CHARGE",sellerKeyedIn:!1});yield uh(t.context,s,i)}return{details:o,status:Gr,token:i}}))()}validateConfiguration(){var e=Dp.join(", ");if(document.querySelectorAll(e).length>0)throw new An(this.methodType,e)}logDebugInfoIfEnabled(e){"GOOGLE_PAY"===this.context.getFeatureFlagValues().enable_payment_debug_output&&console.debug(e)}checkIfReadyToPay(){var e=this;return Np((function*(){if(!(yield e.googlePayClient.isReadyToPay(e.isReadyToPayRequest)).result)throw new Cn(fa.GOOGLE_PAY_BROWSER_NOT_SUPPORTED);var t=e.callbackIntents.length>0?"NOT_CURRENTLY_KNOWN":"FINAL",r=Ip(e.isReadyToPayRequest,e.req,e.callbackIntents,t,e.merchantInfo,e.selectedShippingOptionId);e.logDebugInfoIfEnabled(r),e.googlePayClient.prefetchPaymentData(r)}))()}loadPaymentData(){if(this.googlePayTokenDeferred)return this.googlePayTokenDeferred;var e=Ip(this.isReadyToPayRequest,this.req,this.callbackIntents,"FINAL",this.merchantInfo,this.selectedShippingOptionId);return this.logDebugInfoIfEnabled(e),this.googlePayTokenDeferred=this.googlePayClient.loadPaymentData(e),this.googlePayTokenDeferred}onPaymentDataChanged(e){switch(e.callbackTrigger){case"INITIALIZE":case"SHIPPING_ADDRESS":return this.onPaymentDataChangedShippingAddress(e);case"SHIPPING_OPTION":return this.onPaymentDataChangedShippingOption(e);default:return this.errorLogger.captureException(new ui("Unknown callbackTrigger: ".concat(e.callbackTrigger),qr.GOOGLE_PAY)),Promise.resolve({})}}onPaymentDataChangedShippingOption(e){var t=this;return Np((function*(){var r;t.selectedShippingOptionId=null===(r=e.shippingOptionData)||void 0===r?void 0:r.id;var n=yield t.dispatchShippingOptionChanged(t.selectedShippingOptionId,t.shippingOptions),i=n.updatedOptionRequest,o=n.optionErrors;return t.paymentDataChangedComplete(i,o)}))()}dispatchShippingOptionChanged(e,t){var r=this,n={optionErrors:[],updatedOptionRequest:{}};if(!this.handlers.includes(Ur.SHIPPING_OPTION_CHANGED))return Promise.resolve(n);var i=Sp(e,t);return i?this.status===Ra.DESTROYED?Promise.resolve({optionErrors:[{intent:"SHIPPING_OPTION",message:"An error occurred when attempting to submit payment, please close this window and try again.",reason:zn.PAYMENT_METHOD_DESTROYED}],updatedOptionRequest:{}}):new Promise((e=>{this.req.dispatchEvent(Ur.SHIPPING_OPTION_CHANGED,{contactOrOption:i},(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",Ap(Ap({},t),{},{eventName:Ur.SHIPPING_OPTION_CHANGED})),r.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),e({optionErrors:Op(t,"SHIPPING_OPTION"),updatedOptionRequest:t})}))})):Promise.resolve(n)}onPaymentDataChangedShippingAddress(e){var t=this;return Np((function*(){var r=yield t.dispatchShippingContactChanged(e),n=r.updatedContactRequest,i=r.contactErrors;if(void 0===t.req.shippingOptions||0===t.req.shippingOptions.length)return t.paymentDataChangedComplete(n,i);var o,a=t.shippingOptions;n.shippingOptions?(a=n.shippingOptions,t.selectedShippingOptionId=n.shippingOptions[0].id):t.selectedShippingOptionId=null===(o=t.shippingOptions)||void 0===o?void 0:o[0].id;var s=yield t.dispatchShippingOptionChanged(t.selectedShippingOptionId,a),c=s.updatedOptionRequest,l=s.optionErrors,u=Ap(Ap({},n),c),d=[...i,...l];return t.paymentDataChangedComplete(u,d)}))()}dispatchShippingContactChanged(e){var t=this,r={contactErrors:[],updatedContactRequest:{}};return new Promise((n=>{var i;void 0!==e.shippingAddress&&this.handlers.includes(Ur.SHIPPING_CONTACT_CHANGED)?this.status!==Ra.DESTROYED?this.req.dispatchEvent(Ur.SHIPPING_CONTACT_CHANGED,{contactOrOption:(i=e.shippingAddress,{city:i.locality,countryCode:i.countryCode,postalCode:i.postalCode,state:i.administrativeArea})},(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",Ap(Ap({},e),{},{eventName:Ur.SHIPPING_CONTACT_CHANGED})),t.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),n({contactErrors:Op(e,"SHIPPING_ADDRESS"),updatedContactRequest:e})})):n({contactErrors:[{intent:"SHIPPING_ADDRESS",message:"An error occurred when attempting to submit payment, please close this window and try again.",reason:zn.PAYMENT_METHOD_DESTROYED}],updatedContactRequest:{}}):n(r)}))}paymentDataChangedComplete(e,t){e.shippingOptions&&e.shippingOptions.length>0&&(this.shippingOptions=e.shippingOptions);var r=function(e,t,r,n){var i,o=t.total,a=t.countryCode,s=t.currencyCode,c=r,l=Ep(null!==(i=e.total)&&void 0!==i?i:o),u={countryCode:a,currencyCode:s,totalPrice:l.price,totalPriceLabel:l.label,totalPriceStatus:l.status},d=bp(ol(t),ol(e,t));d.length>0&&(u.displayItems=d);var h={newTransactionInfo:u},p=Cp(s,n,c,e.shippingOptions);return p&&(h.newShippingOptionParameters=p),h}(e,this.req,this.shippingOptions,this.selectedShippingOptionId);return t.length>0&&(r.error=t[0]),r}requestGooglePayCardNonce(e){var t=this;return Np((function*(){var r=Sp(t.selectedShippingOptionId,t.shippingOptions);try{var n=yield t.paymentMethodMessenger.request("REQUEST_GOOGLE_PAY_CARD_NONCE",e);return t.context.setPaymentMethodTrackingId(n.paymentMethodTrackingId),t.wasFirstInteractionCalled=!1,t.paymentRequestLockController.unlock(t),function(e,t){var r=e.card,n=e.cardNonce,i=e.shippingContact,o=e.billingContact,a={details:{card:r,method:qr.GOOGLE_PAY},token:n};return i&&(a.details.shipping={contact:i},t&&(a.details.shipping.option=t)),o&&(a.details.card&&(a.details.card.billing=o),a.details.billing=o),a}(n,r)}catch(e){throw t.paymentRequestLockController.unlock(t),Lp(e)}}))()}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK"))}detachElement(e,t){this.element&&(this.element.innerHTML=""),this.status=e,this.metricsHandler.logConfigurationEvent(t)}}function Lp(e){if(e instanceof Error)return"SecurityError"===e.name?new Cn(fa.MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED):e;var t=e;return"DEVELOPER_ERROR"===t.statusCode&&t.statusMessage.includes("secure context")?new Cn(fa.GOOGLE_PAY_REQUIRES_HTTPS):new ui(JSON.stringify(e),qr.GOOGLE_PAY)}function xp(){return(xp=Np((function*(e,t){return{authJwt:(yield e.request("GENERATE_GOOGLE_PAY_AUTH_TOKEN",{session:t})).token,merchantId:"05498866192997955200",merchantName:t.merchantName}}))).apply(this,arguments)}var kp=function(e){var t=function(e,t){return xp.apply(this,arguments)}(e.messenger,e.getSession()),r=os.load("google-link",{src:"https://pay.google.com/gp/p/js/pay.js"},"google.payments");return Promise.all([r,t])};class Mp{constructor(e,t,r){this.handleSubmitClick=()=>{var e,t;this.onSubmit(null!==(e=null===(t=this.inputElement)||void 0===t?void 0:t.value)&&void 0!==e?e:"")},this.handleInput=()=>{var e,t;""!==(null!==(e=null===(t=this.errorTextElement)||void 0===t?void 0:t.textContent)&&void 0!==e?e:"")&&this.setValidationError(!1)},this.handleInputKeydown=e=>{"Enter"===e.key&&(e.preventDefault(),this.handleSubmitClick())},this.context=e,this.inputId=function(e){return"sq-zelle-identifier-".concat(e)}(t),this.helperTextId=function(e){return"sq-zelle-helper-text-".concat(e)}(t),this.errorTextId=function(e){return"sq-zelle-error-text-".concat(e)}(t),this.onSubmit=r}attach(e){var t=this.context.getLocaleString().paymentMethods.zelle,r=document.createElement("p");r.id=this.errorTextId,r.classList.add("sq-zelle-error-text"),r.setAttribute("role","alert");var n=document.createElement("div");n.classList.add("sq-zelle-field");var i=document.createElement("label");i.setAttribute("for",this.inputId),i.textContent=t.identifierLabel;var o=document.createElement("input");o.id=this.inputId,o.setAttribute("type","text"),o.setAttribute("inputmode","email"),o.setAttribute("autocomplete","disabled"),o.setAttribute("autocapitalize","off"),o.setAttribute("autocorrect","off"),o.setAttribute("spellcheck","false"),o.setAttribute("placeholder",t.identifierPlaceholder),o.setAttribute("aria-describedby","".concat(this.errorTextId," ").concat(this.helperTextId)),o.addEventListener("input",this.handleInput),o.addEventListener("keydown",this.handleInputKeydown),n.appendChild(i),n.appendChild(o);var a=document.createElement("p");a.id=this.helperTextId,a.classList.add("sq-zelle-helper-text"),a.textContent=t.identifierHelperText;var s=document.createElement("button");s.type="button",s.classList.add("sq-zelle-submit"),s.textContent=t.submitButtonText,s.addEventListener("click",this.handleSubmitClick),e.appendChild(r),e.appendChild(n),e.appendChild(a),e.appendChild(s),this.errorTextElement=r,this.fieldElement=n,this.helperTextElement=a,this.inputElement=o,this.submitElement=s}setPending(e){this.inputElement&&(this.inputElement.disabled=e),this.submitElement&&(this.submitElement.disabled=e)}setValidationError(e){var t,r,n;this.errorTextElement&&(this.errorTextElement.textContent="",e&&(this.errorTextElement.textContent=this.context.getLocaleString().paymentMethods.zelle.identifierErrorText)),null===(t=this.fieldElement)||void 0===t||t.classList.toggle("sq-zelle-field-error",e),e?null===(r=this.inputElement)||void 0===r||r.setAttribute("aria-invalid","true"):null===(n=this.inputElement)||void 0===n||n.removeAttribute("aria-invalid")}clear(){this.inputElement&&(this.inputElement.value=""),this.setValidationError(!1)}destroy(){var e,t,r,n,i,o,a;this.inputElement&&(this.inputElement.value=""),null===(e=this.inputElement)||void 0===e||e.removeEventListener("input",this.handleInput),null===(t=this.inputElement)||void 0===t||t.removeEventListener("keydown",this.handleInputKeydown),this.inputElement=void 0,null===(r=this.errorTextElement)||void 0===r||r.remove(),this.errorTextElement=void 0,null===(n=this.fieldElement)||void 0===n||n.remove(),this.fieldElement=void 0,null===(i=this.helperTextElement)||void 0===i||i.remove(),this.helperTextElement=void 0,null===(o=this.submitElement)||void 0===o||o.removeEventListener("click",this.handleSubmitClick),null===(a=this.submitElement)||void 0===a||a.remove(),this.submitElement=void 0}}function jp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Up="Zelle identifier (email, US mobile number, or Zelle tag)",Bp=/[ ().-]/g,qp=/^(?:\+?1)?([2-9]\d{2})([2-9]\d{2})(\d{4})$/,Hp=$a(Ga({nonBlank:!0},(e=>e.trim()))),Fp=$a(Ga({matchRegexp:/^(?:[-\w!#$%&'*+/=?^{|}~`]+\.)*[-\w!#$%&'*+/=?^{|}~`]+@(?:(?:(?:[a-z0-9][-a-z0-9]{0,62}[a-z0-9]|[a-z])\.)+[-a-z0-9]{1,24}|(?:\d{1,3}\.){3}\d{1,3}(?::\d{1,5})?)$/i,maxLength:254},(e=>e.toLowerCase()))),Vp=$a(Ga({matchRegexp:/^[a-z0-9-]+$/i,maxLength:40,minLength:6},(e=>e.toLowerCase()))),Gp={EMAIL:function(e){return Fp.validate(e).isValid?Fp.sanitize(e):void 0},MOBILE:function(e){var t=qp.exec(e.replace(Bp,""));if(t){var r,n,i=(n=4,function(e){if(Array.isArray(e))return e}(r=t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,n)||function(e,t){if(e){if("string"==typeof e)return jp(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?jp(e,t):void 0}}(r,n)||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.")}()),o=i[1],a=i[2],s=i[3];return"+1".concat(o).concat(a).concat(s)}},ZELLE_TAG:function(e){if(Vp.validate(e).isValid){var t=Vp.sanitize(e);if(!(function(e){var t=0;for(var r of e)r>="a"&&r<="z"&&(t+=1);return t}(t)<2||function(e){var t=e.replace(/-/g,"");return""!==t&&t.split("").every((e=>e===t[0]))}(t)))return t}}};function zp(){return Vs([{code:"invalid_value",expected:"a well-formed email address, US mobile number, or Zelle tag",propertyPath:"identifier"}],Up)}function $p(e){return e>="0"&&e<="9"}function Yp(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Wp(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Yp(o,n,i,a,s,"next",e)}function s(e){Yp(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Kp=class extends Ka{constructor(e){super(e),this.methodType="Zelle",this.nonceRequestInFlight=!1,this.destroyRequested=!1,this.id=_a(),this.paymentMethodMessenger=new _c(this.context),this.attach=this.withErrorHandling(this.attach.bind(this),"attach")}attach(e){var t=this;return Wp((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED");try{var r=qc(e),n=Wc(_r.ZELLE_STYLES,"sq-zelle-styles",document.head);t.field=new Mp(t.context,t.id,(e=>{t.handleSubmit(e)})),t.field.attach(r),t.attachPromise=n,yield n,t.attachPromise=void 0}catch(e){var i;throw t.attachPromise=void 0,null===(i=t.field)||void 0===i||i.destroy(),t.field=void 0,t.status=Ra.DETACHED,e}}))()}registerPayment(e,t){var r=this;return Wp((function*(){var n;if(r.destroyRequested)throw new On(r.methodType);r.throwIfDestroyed(),null===(n=r.poller)||void 0===n||n.stop(),r.metricsHandler.logEvent("EXTERNAL_SESSION:START");var i=new pu(Wp((function*(){var n=(yield r.requestStatus(e,t)).status;if(r.poller!==i)return!1;switch(n){case"COMPLETED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),r.dispatchEvent("onPaymentCompletion",{paymentId:t}),!1;case"FAILED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.releaseField(),r.dispatchEvent("onPaymentFailure",{paymentId:t}),!1;case"CANCELED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),r.releaseField(),r.dispatchEvent("onPaymentCancelled",{paymentId:t}),!1;default:return!0}})),(()=>{r.poller===i&&(r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.dispatchEvent("onError",{code:"UNEXPECTED",recoverable:!1}))}));r.poller=i,yield i.start()}))()}destroy(){var e=this;return Wp((function*(){var t,r;if(e.status===Ra.DESTROYED)return!1;if(e.destroyRequested=!0,null===(t=e.poller)||void 0===t||t.stop(),e.poller=void 0,e.attachPromise)try{yield e.attachPromise}catch(e){}return e.status=Ra.DESTROYED,null===(r=e.field)||void 0===r||r.destroy(),e.field=void 0,e.metricsHandler.logConfigurationEvent("DESTROYED"),!0}))()}handleSubmit(e){var t=this;return Wp((function*(){if(!t.nonceRequestInFlight){var r=t.field;try{var n;null==r||r.setValidationError(!1);var i=function(e){var t=Hp.validate(e);if(!t.isValid)throw Vs(t.issues,Up);var r=Hp.sanitize(e),n=function(e){var t=e.trim();return""===t?"UNKNOWN":t.includes("@")?"EMAIL":function(e){var t=e.replace(Bp,""),r=t.startsWith("+")?t.slice(1):t;return""!==r&&function(e){for(var t of e)if(!$p(t))return!1;return!0}(r)}(t)?"MOBILE":"ZELLE_TAG"}(r);if("UNKNOWN"===n)throw zp();var i=Gp[n](r);if(void 0===i)throw zp();return{type:n,value:i}}(e);if(t.nonceRequestInFlight=!0,null===(n=t.field)||void 0===n||n.setPending(!0),t.attachPromise&&(yield t.attachPromise),t.destroyRequested||t.field!==r)return void(t.nonceRequestInFlight=!1);var o=yield t.createNonce(i);if(t.field!==r)return void(t.nonceRequestInFlight=!1);null==r||r.clear(),t.dispatchEvent("onPaymentCreationNeeded",{zelleNonce:o})}catch(e){if(t.nonceRequestInFlight=!1,null==r||r.setPending(!1),t.field!==r)return;if(e instanceof cn)return null==r||r.setValidationError(!0),void t.dispatchEvent("onError",{code:"INVALID_IDENTIFIER",recoverable:!0});var a,s;if(e instanceof Rn)return void t.dispatchEvent("onError",{code:null!==(a=null===(s=e.errors[0])||void 0===s?void 0:s.type)&&void 0!==a?a:"UNKNOWN",recoverable:!0});t.dispatchEvent("onError",{code:"UNEXPECTED",recoverable:!1})}}}))()}createNonce(e){var t=this;return Wp((function*(){var r=e.type,n={identifier:e.value,identifierType:r,paymentMethodTrackingId:t.context.getPaymentMethodTrackingId()};return(yield t.paymentMethodMessenger.request("REQUEST_ZELLE_NONCE",n)).zelleNonce}))()}requestStatus(e,t){var r=this;return Wp((function*(){var n=r.session,i=n.applicationId,o=n.instanceId,a=n.locationId,s=n.sessionId,c={clientId:i,instanceId:o,locationId:a,paymentId:t,sessionId:s,zelleNonce:e};return r.paymentMethodMessenger.request("REQUEST_ZELLE_STATUS",c)}))()}releaseField(){var e;this.nonceRequestInFlight=!1,null===(e=this.field)||void 0===e||e.setPending(!1)}};class Zp{constructor(){this.lockSet=new Set}get isLocked(){return this.lockSet.size>0}lock(e){this.lockSet.add(e)}unlock(e){this.lockSet.delete(e)}}class Jp extends Error{constructor(e,t){super(e),this.name=t,this.type="VERIFY_BUYER_DEVELOPER_ERROR"}}const Xp=function(){return new Jp("The Analytics library must be initialized with analyticsParameters to call verifyBuyer.","AnalyticsParametersRequiredError")},Qp=function(e,t){return new Jp(`The Analytics '${e}' argument must be of type '${t}'`,"InvalidArgumentError")},ef=function(e,t){return new Jp(`An element with selector ${e} must be of type '${t}'`,"InvalidElementTypeError")},tf=function(e,t,r){return new Jp(`The '${e}' function '${t}' argument must be of type '${r}'.`,"InvalidFunctionArgumentError")},rf=function(e,t){return new Jp(`The '${e}' '${t}' callback must be a function.`,"InvalidFunctionCallbackError")},nf=function(e){return new Jp(`The Analytics '${e}' argument is required.`,"MissingArgumentError")},of=function(e,t){return new Jp(`The '${e}' '${t}' is required when verificationDetails.intent is 'CHARGE'.`,"MissingChargeVerificationArgumentError")},af=function(e,t){return new Jp(`An element with selector '${e}' attribute '${t}' is required`,"MissingElementAttributeError")},sf=function(e){return new Jp(`An element with selector '${e}' cannot be found.`,"MissingElementError")},cf=function(e,t){return new Jp(`The '${e}' '${t}' argument is required.`,"MissingFunctionArgumentError")},lf=function(e,t){return new Jp(`The '${e}' '${t}' callback is required.`,"MissingFunctionCallbackError")},uf=function(){return new Jp("One of analyticsParameters.locationId or analyticsParameters.accountId must be specified.","NoIdsError")},df=function(e,t,r,n,i=!1){return new Jp(`The '${e}' function '${t}' argument must be within range: ${r} and ${n} (${(i?"inclusive":"exclusive")+" of upper limit"}).`,"OutOfRangeArgumentError")},hf=function(){return new Jp("Only one of analyticsParameters.locationId or analyticsParameters.accountId can be specified.","TooManyIdsError")},pf=function(){const e=new Error("An unknown error has occurred");return e.name="UnexpectedAnalyticsClientError",e};class ff extends Error{constructor(e="Unknown error",t){super(e),void 0!==t&&(this.token=t),this.name="AnalyticsError"}}class mf extends ff{constructor(){super("Three ds method timed out while waiting for a response"),this.name="ThreeDSMethodTimeoutError"}}class vf extends ff{constructor(){super("Form is no longer connected"),this.name="ThreeDSMethodFormError"}}class gf extends ff{constructor(e){super("Three ds method failed with unexpected error"),this.name="ThreeDSMethodError","string"==typeof e&&""!==e&&(this.message+=`: ${e}`)}}class yf extends ff{constructor(e,t){super(`Received 3DS method response with transaction ID ${e}, expected ${t}`),this.name="ThreeDSMethodTransactionIdError"}}class Ef{constructor(e){this.isLoadListenerAttached=!1,this.iframeInputs=e,this.eventListenerReference=this.handleResponse.bind(this),this.loadEventListenerReference=this.handleLoad.bind(this)}async handle(){const e=new Promise(((e,t)=>{this.threeDSPromiseResolve=e,this.threeDSPromiseReject=t}));return this.build(),this.submit(),e}build(){void 0!==this.iframeInputs.iframeSelector&&document.querySelector(this.iframeInputs.iframeSelector)?this.iframe=document.querySelector(this.iframeInputs.iframeSelector):this.buildDefault();const e=`${this.iframeInputs.baseID}-form`;if(document.getElementById(e))this.form=document.getElementById(e);else{this.form=document.createElement("form"),this.form.setAttribute("id",e),this.form.setAttribute("name",`${this.iframeInputs.baseName}Form`),this.form.setAttribute("method","POST"),this.form.setAttribute("action",this.iframeInputs.notificationURL),this.form.setAttribute("target",this.iframe.name);const t=document.createElement("input");t.setAttribute("name",this.iframeInputs.notificationData.name),t.setAttribute("value",this.iframeInputs.notificationData.data),t.setAttribute("type","hidden"),this.form.appendChild(t),document.body.appendChild(this.form)}window.addEventListener("message",this.eventListenerReference)}buildDefault(){const e=`${this.iframeInputs.baseID}-modal`;document.getElementById(e)?this.modal=document.getElementById(e):(this.modal=document.createElement("div"),this.modal.id=e,this.modal.classList.add("square_threeds_modal"),document.body.appendChild(this.modal));const t=`${this.iframeInputs.baseID}-iframe`,r=document.getElementById(t);r&&this.modal.contains(r)?this.iframe=document.getElementById(t):(this.iframe=document.createElement("iframe"),this.iframe.id=t,this.iframe.name=`${this.iframeInputs.baseName}Iframe`,this.iframe.setAttribute("frameBorder","0"),this.iframe.setAttribute("width",this.iframeInputs.width),this.iframe.setAttribute("height",this.iframeInputs.height),this.iframe.setAttribute("sandbox","allow-forms allow-scripts allow-same-origin allow-pointer-lock"),this.iframe.style.visibility="hidden",this.iframe.setAttribute("allowpaymentrequest","false"),this.iframe.setAttribute("allowfullscreen","false"),this.iframe.setAttribute("allow","payment *;publickey-credentials-get *"),this.iframe.classList.add("square_threeds_iframe"),this.modal.appendChild(this.iframe))}addLoadListener(){void 0===this.iframeInputs.onLoadObserved||this.isLoadListenerAttached||(this.iframe.addEventListener("load",this.loadEventListenerReference),this.isLoadListenerAttached=!0)}handleLoad(){this.iframeInputs.onLoadObserved?.(),this.removeLoadListener()}removeLoadListener(){this.isLoadListenerAttached&&(this.iframe?.removeEventListener("load",this.loadEventListenerReference),this.isLoadListenerAttached=!1)}handleResponse(e){const t=e.data;if("object"==typeof t&&this.iframeInputs.listenerMessageTypes.includes(t.type)){try{this.iframeInputs.validateMessage(t)}catch(e){const t=e;return this.iframeInputs.onError?.(t),this.destroy(),void this.threeDSPromiseReject(t)}this.iframeInputs.onCompleted?.(),this.destroy(),this.threeDSPromiseResolve(t)}}submit(){this.form.isConnected?(this.addLoadListener(),this.form.submit(),this.iframeInputs.onFormSubmitted?.(),void 0!==this.iframeInputs.onShow&&this.iframeInputs.onShow(this.iframe,this.modal),void 0!==this.iframeInputs.timeoutSeconds&&(this.timeoutID=window.setTimeout(this.timedOut.bind(this),1e3*this.iframeInputs.timeoutSeconds))):(this.iframeInputs.onError?.("SQUARE_3DS_IFRAME_FORM_DISCONNECTED"),this.destroy(),this.threeDSPromiseReject(this.iframeInputs.getErrorMessage("SQUARE_3DS_IFRAME_FORM_DISCONNECTED")))}timedOut(){this.iframeInputs.onError?.("SQUARE_3DS_IFRAME_TIMEOUT"),this.destroy(),this.threeDSPromiseReject(this.iframeInputs.getErrorMessage("SQUARE_3DS_IFRAME_TIMEOUT"))}destroy(){void 0!==this.timeoutID&&window.clearTimeout(this.timeoutID),window.removeEventListener("message",this.eventListenerReference),this.removeLoadListener(),void 0!==this.iframeInputs.onDestroy&&this.iframeInputs.onDestroy(this.iframe),this.form.isConnected&&this.form.remove(),!0===this.modal?.isConnected&&(this.iframe.isConnected&&this.iframe.remove(),this.modal.remove())}}function bf(e){switch(e){case"SQUARE_3DS_IFRAME_TIMEOUT":return new mf;case"SQUARE_3DS_IFRAME_FORM_DISCONNECTED":return new vf;default:return new gf}}class _f{constructor(e){if(void 0===e.threeDsMethodUrl||void 0===e.threeDsMethodNotificationUrl)throw new Error(`Cannot complete 3DS method flow, one or more of threeDSMethodUrl and threeDSMethodNotificationUrl are undefined. Transaction data: ${JSON.stringify(e)}`);this.threeDsMethodUrl=e.threeDsMethodUrl,this.threeDSMethodData={threeDSMethodNotificationURL:e.threeDsMethodNotificationUrl,threeDSServerTransID:e.threeDSServerTransId},this.square3DSMethodIframe=new Ef({baseID:"sq-threeds-3ds-method-"+1e6*Math.random(),baseName:"3DSMethod",getErrorMessage:bf,height:"10",listenerMessageTypes:[`threeDsMethodResponse-${this.threeDSMethodData.threeDSServerTransID}`,"threeDsMethodError"],notificationData:{data:btoa(JSON.stringify(this.threeDSMethodData)),name:"threeDSMethodData"},notificationURL:this.threeDsMethodUrl,timeoutSeconds:11,validateMessage:this.validateMessage.bind(this),width:"10"})}async handle3DSMethod(){return this.square3DSMethodIframe.handle()}validateMessage(e){if("threeDsMethodError"===e.type)throw new gf(e.error);if(e.threeDsServerTransId!==this.threeDSMethodData.threeDSServerTransID)throw new yf(e.threeDsServerTransId,this.threeDSMethodData.threeDSServerTransID)}}class Cf{constructor(e,t){this.threeDsMethodPromise=e,this.threeDsServerTransactionId=t}reset(){this.threeDsMethodPromise=void 0,this.threeDsServerTransactionId=void 0}}class Sf extends ff{constructor(e){super(`The verification was not successful: ${e}`,e),this.name="VerificationError",this.type="VERIFICATION_NOT_SUCCESSFUL"}}class If extends ff{constructor(){super("A verification request is already in progress"),this.name="VerificationInProgressError",this.type="VERIFICATION_IN_PROGRESS"}}class Of extends ff{constructor(e){super(`The time to complete the verification has expired: ${e}`),this.name="VerificationTimeoutError",this.type="VERIFICATION_TIMEOUT"}}var wf,Af;!function(e){e.AUTHENTICATED="Y",e.AUTHENTICATION_ATTEMPTED="A",e.CHALLENGE_REQUIRED="C",e.DECOUPLED_CHALLENGE_REQUIRED="D",e.NOT_AUTHENTICATED="N",e.AUTHENTICATION_COULD_NOT_BE_PERFORMED="U",e.INFORMATIONAL_ONLY="I",e.REJECTED="R"}(wf||(wf={})),function(e){e._250X400="01",e._390X400="02",e._500X600="03",e._600X400="04",e.FULL_SCREEN="05"}(Af||(Af={}));class Tf extends ff{constructor(){super("Form is no longer connected"),this.name="ChallengeFlowFormError"}}class Pf extends ff{constructor(e){super("Challenge flow failed with unknown error"),this.name="ChallengeFlowError","string"==typeof e&&""!==e&&(this.message+=`: ${e}`)}}class Nf extends ff{constructor(e,t){super(`Received Challenge response with transaction ID ${e}, expected ${t}`),this.name="ChallengeResponseTransactionIdError"}}const Df="data-challenge-displayed",Rf="VISIBLE";function Lf(e){return"SQUARE_3DS_IFRAME_FORM_DISCONNECTED"===e?new Tf:new Pf}class xf{constructor(e,t,r,n){if(this.errorLogger=t,this.esLogger=r,this.verificationId=e.verificationId,void 0===e.acsUrl||void 0===e.encodedCReq)throw this.trackStageForChallengeData(e.threeDSServerTransId,e.verificationId,"requested"),this.trackStageForChallengeData(e.threeDSServerTransId,e.verificationId,"error","INVALID_CHALLENGE_DATA"),new Error(`Cannot complete Challenge flow, acsUrl or encodedCReq is undefined. Transaction data: ${JSON.stringify(e)}`);this.acsUrl=e.acsUrl,this.challengeFlowData={encodedCReq:e.encodedCReq,threeDSServerTransID:e.threeDSServerTransId};const i=this.decodeChallengeWindowSize();void 0!==n&&({challengeDisplayedCallback:this.challengeDisplayedCallback,challengeHiddenCallback:this.challengeHiddenCallback,elementSelector:this.iframeSelector}=n);const o={baseID:"sq-threeds-challenge-flow",baseName:"3DSChallengeFlow",getErrorMessage:Lf,height:`${i.height}`,listenerMessageTypes:[`challengeResponse-${this.challengeFlowData.threeDSServerTransID}`,"challengeError"],notificationData:{data:this.challengeFlowData.encodedCReq,name:"creq"},notificationURL:this.acsUrl,onCompleted:()=>{this.trackStage("completed")},onDestroy:this.onDestroy.bind(this),onError:e=>{if("SQUARE_3DS_IFRAME_TIMEOUT"===e)return void this.trackStage("timeout","TIMEOUT");let t="CHALLENGE_ERROR";"SQUARE_3DS_IFRAME_FORM_DISCONNECTED"===e?t="FORM_DISCONNECTED":e instanceof Nf&&(t="TRANSACTION_ID_MISMATCH"),this.trackStage("error",t)},onFormSubmitted:()=>{this.trackStage("form_submitted")},onLoadObserved:()=>{this.trackStage("load_observed")},onShow:this.onShow.bind(this),timeoutSeconds:610,validateMessage:this.validateMessage.bind(this),width:`${i.width}`};void 0!==this.iframeSelector&&(o.iframeSelector=this.iframeSelector),this.squareChallengeFlowIframe=new Ef(o)}async handleChallengeFlow(){this.trackStage("requested");const e=this.decodeCReq(this.challengeFlowData.encodedCReq);return e&&this.esLogger.trackTdsEvent({catalog_name:"tds_analyticsjs_c_req",tds_analyticsjs_c_req_message_version:e.messageVersion,tds_base_three_ds_server_trans_id:e.threeDsServerTransId||this.challengeFlowData.threeDSServerTransID}),this.squareChallengeFlowIframe.handle().then((e=>(this.esLogger.trackTdsEvent({catalog_name:"tds_analyticsjs_c_res",tds_analyticsjs_c_res_message_version:e.messageVersion,tds_analyticsjs_c_res_trans_status:e.transStatus,tds_base_three_ds_server_trans_id:e.threeDsServerTransId}),e)))}trackStage(e,t){this.trackStageForChallengeData(this.challengeFlowData.threeDSServerTransID,this.verificationId,e,t)}trackStageForChallengeData(e,t,r,n){this.esLogger.trackAnalyticsEvent({analyticsjs_event:`square_three_ds_challenge_${r}`,analyticsjsverification_error:n,analyticsjsverification_id:t,three_ds_server_transaction_id:e})}onShow(e,t){e.setAttribute(Df,Rf),e.style.visibility="visible",void 0!==this.challengeDisplayedCallback&&this.challengeDisplayedCallback(),t&&t.classList.add("square_threeds_modal__show")}onDestroy(e){const t=e.getAttribute(Df)===Rf;e.setAttribute(Df,"REMOVED"),void 0!==this.challengeHiddenCallback&&t&&this.challengeHiddenCallback()}validateMessage(e){if("challengeError"===e.type)throw new Pf(e.error);if(e.threeDsServerTransId!==this.challengeFlowData.threeDSServerTransID)throw new Nf(e.threeDsServerTransId,this.challengeFlowData.threeDSServerTransID)}decodeChallengeWindowSize(){let e=Af._250X400;try{const t=JSON.parse(atob(this.challengeFlowData.encodedCReq));null!==t&&"object"==typeof t&&"challengeWindowSize"in t&&(e=t.challengeWindowSize)}catch(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}})}switch(e){case Af._390X400:return{height:400,width:390};case Af._500X600:return{height:600,width:500};case Af._600X400:return{height:400,width:600};case Af.FULL_SCREEN:return{height:document.documentElement.clientHeight,width:document.documentElement.clientWidth};case Af._250X400:default:return{height:400,width:250}}}decodeCReq(e){try{return JSON.parse(atob(e))}catch(t){return this.errorLogger.addBreadcrumb({data:{encodedCReq:e},message:"Unable to parse JSON for challenge request message",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-challenge"}}}),null}}}var kf;!function(e){e.COMPLETED="COMPLETED",e.ERROR="ERROR"}(kf||(kf={}));class Mf{constructor(e,t,r){this.userChallenged=!1,this.esLogger=e,this.errorLogger=t,this.threeDsMethodData=r}async execute3dsAuthentication(e,t){this.configuration=e,this.threeDsTransactionData=t,await this.handle3DSMethodFlow();try{const e=await this.authenticate();await this.handleAuthenticateResponse(e)}catch(e){this.handleError(e)}}async handle3DSMethodFlow(){if(void 0===this.threeDsMethodData.threeDsServerTransactionId||void 0===this.threeDsMethodData.threeDsMethodPromise){if(void 0!==this.threeDsTransactionData?.threeDsMethodUrl)try{const e=new _f(this.threeDsTransactionData),t=new URL(this.threeDsTransactionData.threeDsMethodUrl).hostname;this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_invoked",analyticsjsverification_id:this.threeDsTransactionData.verificationId,analyticsjsverification_verification_token:this.threeDsTransactionData.verificationToken,is_eager_three_ds_method_execution:!1,three_ds_method_url_hostname:t,three_ds_server_transaction_id:this.threeDsTransactionData.threeDSServerTransId}),await e.handle3DSMethod(),this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_completed",analyticsjsverification_id:this.threeDsTransactionData.verificationId,analyticsjsverification_verification_token:this.threeDsTransactionData.verificationToken,is_eager_three_ds_method_execution:!1,three_ds_method_url_hostname:t,three_ds_server_transaction_id:this.threeDsTransactionData.threeDSServerTransId})}catch(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}})}}else try{await this.threeDsMethodData.threeDsMethodPromise}catch(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}})}}async handleChallengeFlow(e){this.esLogger.trackAnalyticsEvent({analyticsjs_event:"buyer_challenged",analyticsjsverification_challenge_type:"3DS",analyticsjsverification_id:this.threeDsTransactionData.verificationId,analyticsjsverification_user_challenged:!0,analyticsjsverification_verification_token:this.threeDsTransactionData.verificationToken});const t={threeDSServerTransId:e.three_ds_server_trans_id,...void 0!==this.threeDsTransactionData.verificationId&&{verificationId:this.threeDsTransactionData.verificationId}};return void 0!==e.encoded_creq&&(t.encodedCReq=e.encoded_creq),void 0!==e.challenge_acs_url&&(t.acsUrl=e.challenge_acs_url),new xf(t,this.errorLogger,this.esLogger,this.configuration.verifyBuyerCustomElement).handleChallengeFlow()}authenticate(){const e={browser_info:{color_depth:window.screen.colorDepth,java_enabled:!1,screen_height:window.innerHeight,screen_width:window.innerWidth},client_id:"",token:this.threeDsTransactionData.verificationToken};return this.configuration.callbacks.postAuthenticate(e)}async handleAuthenticateResponse(e){if(void 0===e.errors)if(e.three_ds_trans_status===wf.CHALLENGE_REQUIRED)try{this.userChallenged=!0,await this.handleChallengeFlow(e),this.configuration.callbacks.onComplete({status:kf.COMPLETED,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:!0})}catch(e){this.handleError(e)}else this.configuration.callbacks.onComplete({status:kf.COMPLETED,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged});else this.configuration.callbacks.onComplete({status:kf.ERROR,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged})}handleError(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}}),this.configuration.callbacks.onComplete({...e instanceof Tf&&{error:{errorDescription:"BAD_REQUEST",errorDetail:"The verification could not be completed. Please try again in a different browser."}},status:kf.ERROR,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged})}}class jf{constructor(e,t,r){this.callback=e,this.onError=r,this.called=!1,this.callback=e,this.timeout=window.setTimeout((()=>{this.timedOut()}),t),this.onError=r}invoke(...e){this.called?this.callback(...this.onError):(clearTimeout(this.timeout),this.called=!0,this.callback(...e))}timedOut(){this.invoke(...this.onError)}}function Uf(e){return e instanceof ff}function Bf(e,t,r){return Uf(e)?e:e instanceof Error&&"SqError"===e.name?new ff(e.message,r):new ff(t,r)}function qf(e){return void 0!==e.square_three_ds_verification?.three_ds_server_transaction_id}class Hf{constructor(e,t,r,n,i,o){this.applicationId=e,this.analyticsParameters=t,this.esLogger=r,this.errorLogger=n,this.challengeUpdatesQueue=[],this.verificationUpdatePending=!1,this.userChallenged=!1,this.messenger=i,this.threeDsMethodData=o,this.squareThreeds=new Mf(this.esLogger,this.errorLogger,this.threeDsMethodData),(()=>{this.pendingVerifyBuyerCall&&this.verifyBuyer(this.pendingVerifyBuyerCall.verificationId,this.pendingVerifyBuyerCall.source,this.pendingVerifyBuyerCall.details,this.pendingVerifyBuyerCall.callback,this.pendingVerifyBuyerCall.verifyBuyerCustomElement)})()}verifyBuyer(e,t,r,n,i){void 0===this.verifyBuyerCallback?(this.verifyBuyerCallback=new jf(((e,t)=>{n(e,t),delete this.verifyBuyerCallback}),9e5,[new Of(e)]),this.getVerification(e,t,r)):n(new If,null)}async updateVerification(e,t){const r=t.some((e=>{if("SQUARE_THREEDS"===e.type){const t=e.square_threeds_verification?.status;return function(e){return"CANCELED"===e||"REJECTED"===e||"AUTHENTICATED"===e||"COMPLETED"===e}(t)||"ERROR"===t}return!1}));if(!this.verificationUpdatePending||r){this.verificationUpdatePending=!r;try{const r={analyticsParameters:this.analyticsParameters,applicationId:this.applicationId,challengeUpdates:t,token:this.token,verificationId:e},n=await this.messenger.request("REQUEST_VERIFICATION_UPDATE",{body:{...r}});this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification_update",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,n)}catch(t){this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification_update",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,Bf(t,"Update verification failed",this.token))}}else this.challengeUpdatesQueue.push(t)}handleChallenges(e,t){if(void 0===this.verifyBuyerCallback)return;const r=this.challengeUpdatesQueue.shift();if(void 0!==r?this.updateVerification(e,r):this.verificationUpdatePending=!1,Uf(t))return void this.verifyBuyerCallback.invoke(this.consumeChallengeRenderError()??t,null);this.token=t.token;const n={token:this.token,userChallenged:this.userChallenged};switch(t.status){case"COMPLETED":this.verifyBuyerCallback.invoke(null,n);break;case"CANCELED":this.verifyBuyerCallback.invoke(this.consumeChallengeRenderError()??new Sf(t.token),null);break;case"PENDING":if(void 0===t.challenges||0===t.challenges.length)return void this.verifyBuyerCallback.invoke(new Sf(t.token),null);for(const r of t.challenges)if("SQUARE_THREEDS"===r.type){if(this.squareThreedsConfiguration={callbacks:{onComplete:t=>{this.handleSquareThreeDsComplete(t,e)},postAuthenticate:t=>this.handlePostAuthenticate(t,e)}},!qf(r))return;this.squareThreeDsTransactionData={directoryServerId:r.square_three_ds_verification.directory_server_id,messageVersion:r.square_three_ds_verification.message_version,threeDSServerTransId:r.square_three_ds_verification.three_ds_server_transaction_id,...void 0!==r.square_three_ds_verification?.three_ds_method_notification_url&&{threeDsMethodNotificationUrl:r.square_three_ds_verification.three_ds_method_notification_url},...void 0!==r.square_three_ds_verification?.three_ds_method_url&&{threeDsMethodUrl:r.square_three_ds_verification.three_ds_method_url},verificationId:e,verificationToken:this.token},this.squareThreeds.execute3dsAuthentication(this.squareThreedsConfiguration,this.squareThreeDsTransactionData)}break;default:this.errorLogger.captureException(new Error(`Invalid verification response status: ${t.status}`),{captureContext:{tags:{action:"nonFatal-verify"}}})}}async getVerification(e,t,r){const n={analyticsParameters:this.analyticsParameters,applicationId:this.applicationId,source:t,verificationDetails:r,verificationId:e};try{const t=await this.messenger.request("REQUEST_VERIFICATION_CREATE",{body:{...n,...void 0!==this.threeDsMethodData.threeDsMethodPromise&&void 0!==this.threeDsMethodData.threeDsServerTransactionId?{threeDsServerTransactionId:this.threeDsMethodData.threeDsServerTransactionId}:{}}}),r=t.challenges?.find((e=>"SQUARE_THREEDS"===e.type));r?.square_three_ds_verification?.three_ds_server_transaction_id===this.threeDsMethodData.threeDsServerTransactionId||this.threeDsMethodData.reset(),this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification",analyticsjsverification_id:e,analyticsjsverification_verification_token:t.token}),this.handleChallenges(e,t)}catch(t){this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,Bf(t,"Create verification failed",this.token))}}handleSquareThreeDsComplete(e,t){this.userChallenged=e.userChallenged,void 0!==e.error&&(this.challengeRenderError=new ff(e.error.errorDetail,this.token));const r={square_threeds_verification:{directory_server_id:this.squareThreeDsTransactionData.directoryServerId,message_version:this.squareThreeDsTransactionData.messageVersion,status:e.status===kf.COMPLETED?kf.COMPLETED:kf.ERROR,three_ds_server_transaction_id:e.threeDsServerTransId},type:"SQUARE_THREEDS"};this.updateVerification(t,[r])}async handlePostAuthenticate(e,t){const r={analyticsParameters:this.analyticsParameters,applicationId:this.applicationId,browser_info:e.browser_info,client_id:e.client_id,token:this.token,verificationId:t};try{const e=await this.messenger.request("REQUEST_THREE_DS_AUTHENTICATION",{body:{...r}});return this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_three_ds_authenticate",analyticsjsverification_id:t,analyticsjsverification_verification_token:this.token}),e}catch(e){throw this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_three_ds_authenticate",analyticsjsverification_id:t,analyticsjsverification_verification_token:this.token}),Bf(e,"Three ds authentication failed",this.token)}}consumeChallengeRenderError(){const e=this.challengeRenderError;return delete this.challengeRenderError,e}}function Ff(e,t){if(!e)throw lf("IframeCustomElement",t);if("function"!=typeof e)throw rf("IframeCustomElement",t)}function Vf(e){return"string"==typeof e&&""!==e}function Gf(e){if("object"!=typeof e||null===e)return"";const t=[];return"familyName"in e&&Vf(e.familyName)&&t.push("familyName"),"givenName"in e&&Vf(e.givenName)&&t.push("givenName"),"email"in e&&Vf(e.email)&&t.push("email"),"country"in e&&Vf(e.country)&&t.push("country"),"countryName"in e&&Vf(e.countryName)&&t.push("countryName"),"region"in e&&Vf(e.region)&&t.push("region"),"city"in e&&Vf(e.city)&&t.push("city"),"addressLines"in e&&Array.isArray(e.addressLines)&&Vf(e.addressLines.join())&&t.push("addressLines"),"postalCode"in e&&Vf(e.postalCode)&&t.push("postalCode"),"phone"in e&&Vf(e.phone)&&t.push("phone"),t.join(",")}function zf(){return`verify-buyer-${(new Date).getMilliseconds()}-${1e5*Math.random()}`}class $f{constructor(e,t,r,n,i,o={generateVerificationId:zf}){this.verificationId=void 0,this.applicationId=e,this.esLogger=t,this.errorLogger=r,this.messenger=n,this.threeDsMethodData=new Cf,this.verificationIdGenerator=o,function(e,t){if(!e)throw nf("applicationId");if("string"!=typeof e)throw Qp("applicationId","string");if(t){const e="locationId"in t,r="accountId"in t;if(!e&&!r)throw uf();if(e&&r)throw hf();if(e&&"string"!=typeof t.locationId)throw Qp("analyticsParameters.locationId","string");if(r&&"string"!=typeof t.accountId)throw Qp("analyticsParameters.accountId","string")}}(e,i),i&&(this.verifier=new Hf(this.applicationId,i,this.esLogger,this.errorLogger,this.messenger,this.threeDsMethodData),this.analyticsParameters=i)}async execute3DSMethod(e){const t=new _f({threeDSServerTransId:e.threeDSServerTransId,threeDsMethodNotificationUrl:e.threeDsMethodNotificationUrl,threeDsMethodUrl:e.threeDsMethodUrl});this.verificationId=this.verificationIdGenerator.generateVerificationId();const r=new URL(e.threeDsMethodUrl).hostname;this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_invoked",analyticsjsverification_id:this.verificationId,analyticsjsverification_verification_token:void 0,is_eager_three_ds_method_execution:!0,three_ds_method_url_hostname:r,three_ds_server_transaction_id:e.threeDSServerTransId});const n=t.handle3DSMethod();this.threeDsMethodData.threeDsMethodPromise=n,this.threeDsMethodData.threeDsServerTransactionId=e.threeDSServerTransId;try{await n}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}}),e}finally{this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_completed",analyticsjsverification_id:this.verificationId,analyticsjsverification_verification_token:void 0,is_eager_three_ds_method_execution:!0,three_ds_method_url_hostname:r,three_ds_server_transaction_id:e.threeDSServerTransId})}}async verifyBuyer(e,t,r){return new Promise(((n,i)=>{this._verifyBuyer(e,t,((e,t)=>{this.threeDsMethodData.reset(),this.verificationId=void 0,e?i(e):n(t)}),r)}))}_verifyBuyer(e,t,r,n){const i=this.verificationId??this.verificationIdGenerator.generateVerificationId();try{this.esLogger.trackAnalyticsEvent({analyticsjs_event:"verify_buyer_invoked",analyticsjsverification_amount:t.amount,analyticsjsverification_contact_fields:Gf(t.billingContact),analyticsjsverification_currency:t.currencyCode,analyticsjsverification_custom_score:null===t.customScore?void 0:t.customScore,analyticsjsverification_id:i,analyticsjsverification_intent:t.intent,analyticsjsverification_source:e,analyticsjsverification_source_prefix:e.substring(0,5),analyticsjsverification_square_product:t.squareProduct})}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"verifyBuyer"}}}),pf()}try{!function(e,t,r,n,i){const o="verifyBuyer";if(!e)throw Xp();if(void 0===t)throw cf(o,"source");if("string"!=typeof t)throw tf(o,"source","string");if(!r)throw cf(o,"verificationDetails");if("object"!=typeof r)throw tf(o,"verificationDetails","object");if(function(e,t){const r="verificationDetails";if("object"!=typeof t.billingContact)throw tf(e,`${r}.billingContact`,"object");const{customScore:n}=t;if(null!=n){if("number"!=typeof n||Number.isNaN(n))throw tf(e,`${r}.customScore`,"integer");if(n<0||n>1e3)throw df(e,`${r}.customScore`,0,1e3,!0)}if("string"!=typeof t.intent)throw tf(e,`${r}.intent`,"string");if("CHARGE"===t.intent||"CHARGE_AND_STORE"===t.intent){if(!t.currencyCode)throw of(e,`${r}.currencyCode`);if("string"!=typeof t.currencyCode)throw tf(e,`${r}.currencyCode`,"string");if(!t.amount)throw of(e,`${r}.amount`);if("string"!=typeof t.amount)throw tf(e,`${r}.amount`,"string")}}(o,r),!n)throw lf(o,"verifyBuyerCallback");if("function"!=typeof n)throw rf(o,"verifyBuyerCallback");void 0!==i&&(function(e){if("string"!=typeof e)throw Qp("iframeElementSelector","string");const t=document.querySelector(e);if(null===t)throw sf(e);if(null===t.getAttribute("name"))throw af(e,"name");if("iframe"!==t.tagName.toLowerCase()||null===t.contentDocument&&null===t.contentWindow)throw ef(e,"IFrameElement")}(i.elementSelector),Ff(i.challengeDisplayedCallback,"elementVisibleCallback"),Ff(i.challengeHiddenCallback,"elementRemovedCallback"))}(this.analyticsParameters,e,t,r,n)}catch(t){throw this.esLogger.trackAnalyticsEvent({analyticsjs_event:"verify_buyer_completed",analyticsjsverification_error:t.name,analyticsjsverification_id:i,analyticsjsverification_source:e}),t}try{this.verifier.verifyBuyer(i,e,t,((t,n)=>{const o={analyticsjs_event:"verify_buyer_completed",analyticsjsverification_id:i,analyticsjsverification_source:e};t&&(o.analyticsjsverification_error=t.name),n&&(o.analyticsjsverification_user_challenged=n.userChallenged,o.analyticsjsverification_verification_token=n.token),this.esLogger.trackAnalyticsEvent(o),r(t,n)}),n)}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"verifyBuyer"}}}),pf()}}}const Yf=(e,t,r,n,i)=>new $f(e,t,r,n,i),Wf={get documentVisibilityState(){return document.visibilityState},windowLocationHref:()=>window.location.href,get windowLocationOrigin(){return window.location.origin},get windowNavigationBeacon(){return window.navigator.sendBeacon.bind(window.navigator)}},Kf=/^https?:\/\//;function Zf(e){if(!e)return"";if(!Kf.test(e))return"[Not Parsable]";const t=new URL(e);return`${t.protocol}//${t.host}`}const Jf={buyer_challenged:"analyticsjsverification",receive_three_ds_authenticate:"analyticsjsverification",receive_verification:"analyticsjsverification",receive_verification_update:"analyticsjsverification",square_three_ds_challenge_completed:"analyticsjsverification",square_three_ds_challenge_error:"analyticsjsverification",square_three_ds_challenge_form_submitted:"analyticsjsverification",square_three_ds_challenge_load_observed:"analyticsjsverification",square_three_ds_challenge_requested:"analyticsjsverification",square_three_ds_challenge_timeout:"analyticsjsverification",three_ds_method_completed:"analyticsjsverification",three_ds_method_invoked:"analyticsjsverification",verify_buyer_completed:"analyticsjsverification",verify_buyer_invoked:"analyticsjsverification"};function Xf(e){const t=document.cookie.split(";");for(const r of t){const[t,n]=r.split("=");if(void 0!==t&&t.trim()===e&&void 0!==n)return decodeURIComponent(n)}return null}class Qf{constructor(e,t,r,n){this.telemetryStarts=new Map;const{locationId:i,avt:o}=r;this.es=e,this.errorLogger=n,this.baseEvent=function(e,t,r){return"accountId"in r?{anonymous_user_token:t,oauth_credential_account_id:r.accountId,oauth_credential_client_id:e}:{anonymous_user_token:t,oauth_credential_client_id:e,oauth_credential_location_id:r.locationId}}(t,o,{locationId:i??""})}trackAnalyticsEvent(e){try{const t={catalog_name:Jf[e.analyticsjs_event],...this.baseEvent,analyticsjsverification_duration:this.getAnalyticsEventDuration(e),browser_height:window.innerHeight,browser_width:window.innerWidth,device_screen_height:window.screen.height,device_screen_width:window.screen.width,subject_anonymous_token:Xf("_savt"),webpage_base_url:Wf.windowLocationOrigin,webpage_full_url:Zf(Wf.windowLocationHref()),webpage_path:"",webpage_referrer:Zf(window.document.referrer),webpage_referrer_path:"",webpage_referrer_search:"",webpage_search:"",webpage_title:window.document.title,...e};this.es.trackV2(t)}catch(t){this.errorLogger.addBreadcrumb({data:{event:e},message:"Eventstream Track Error",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-es2"}}})}}trackTdsEvent(e){try{this.es.trackV2(e)}catch(t){this.errorLogger.addBreadcrumb({data:{event:e},message:"Eventstream TrackTdsEvent Error",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-es2"}}})}}getAnalyticsEventDuration(e){const{analyticsjs_event:t,analyticsjsverification_id:r}=e,n=e=>(this.telemetryStarts.set(e,performance.now()),null),i=e=>{const t=this.telemetryStarts.get(e);return void 0===t?null:(this.telemetryStarts.delete(e),performance.now()-t)};switch(t){case"verify_buyer_invoked":return n(r);case"verify_buyer_completed":return i(r);case"three_ds_method_invoked":return n(`three_ds_method_${r}`);case"three_ds_method_completed":return i(`three_ds_method_${r}`);case"square_three_ds_challenge_requested":return n(`square_three_ds_challenge_${r}`);case"square_three_ds_challenge_completed":case"square_three_ds_challenge_error":case"square_three_ds_challenge_timeout":return i(`square_three_ds_challenge_${r}`);default:return null}}}class em{constructor(e){this.metricsBatchUrl=`${e.pciConnectApiUrl}/v2/analytics/aux`,this.errorLogger=e.errorLogger,this.analyticsClientVersion=e.analyticsClientVersion,this.webSdkVersion=e.webSdkVersion,this.metricsBuffer=[],this.disableBeacon=!1}trackV2(e){const t={u_library_name:"analytics-client",u_library_version:this.analyticsClientVersion,web_sdk_version:this.webSdkVersion,...e};this.postMetricsEvent(t,!1)}postMetricsEvent(e,t=!1){this.disableBeacon?yr(this.metricsBatchUrl,{body:{analytics:[e]}}).catch((t=>{this.errorLogger.addBreadcrumb({data:{event:e},message:"Unable to HTTP Post analytics event",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-es2"}}})})):(this.metricsBuffer.push(e),t&&this.buildAndSendBeacon(),void 0===this.currentInterval&&(document.addEventListener("visibilitychange",(()=>{"hidden"===Wf.documentVisibilityState&&(this.buildAndSendBeacon(),clearInterval(this.currentInterval),this.currentInterval=void 0)})),this.currentInterval=setInterval((()=>{this.buildAndSendBeacon()}),1e3)))}buildAndSendBeacon(){if(0!==this.metricsBuffer.length){try{const e=new Blob([JSON.stringify({analytics:this.metricsBuffer})],{type:"text/plain;charset=UTF-8"});Wf.windowNavigationBeacon(this.metricsBatchUrl,e)}catch(e){this.errorLogger.addBreadcrumb({data:{events:this.metricsBuffer},message:"Unable to send beacons for analytics events",type:"error"}),this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-es2"}}}),this.disableBeacon=!0,void 0!==this.currentInterval&&(clearInterval(this.currentInterval),this.currentInterval=void 0),yr(this.metricsBatchUrl,{body:{analytics:this.metricsBuffer}}).catch((e=>{this.errorLogger.addBreadcrumb({data:{events:this.metricsBuffer},message:"Unable to send HTTP request for analytics events",type:"error"}),this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-es2"}}})}))}this.metricsBuffer=[]}}}const tm={setupClient(e,t){const{environment:r,hostname:n,locationId:i,pciConnectApiUrl:o,clientVersion:a,webSdkVersion:s,messenger:c}=t,l=void 0===a||""===a?`web-payments-sdk@${s}`:`analytics-client@${a}`,u=new lr({dsn:"https://4197e265423545aba2d849d023e8cd33@o160250.ingest.sentry.io/1516559",environment:r,initialScope:{tags:{applicationId:e,applicationUrl:n,source:"analytics-client",webSdkVersion:s}},release:l}),d=new em({analyticsClientVersion:l,errorLogger:u,pciConnectApiUrl:o,webSdkVersion:s}),h=new Qf(d,e,t,u);return void 0===i?Yf(e,h,u,c):Yf(e,h,u,c,{locationId:i})}};function rm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function nm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rm(Object(r),!0).forEach((function(t){im(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function im(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var om="".concat(_r.ASSET_URL,"/square-threeds-modal.css");class am{constructor(e){var t=e.applePayMerchantIdentifier,r=e.cashAppPayMerchantIdentifier,n=e.merchantCountryCode,i=e.merchantName,o=e.applicationId,a=e.avt,s=e.hostname,c=e.locationId,l=e.instanceId,u=e.sessionId,d=e.sourceUrl,h=e.locale,p=e.srcDpaId,f=e.parentPathname;this.applicationId=o,this.locationId=c,this._sessionId=u,this.instanceId=l,this.applePayMerchantIdentifier=t,this.cashAppPayMerchantIdentifier=r,this.merchantCountryCode=n,this.merchantName=i,this.hostname=s,this.sourceUrl=d,this._locale=h,this.avt=a,this.srcDpaId=p,this.parentPathname=f}get sessionId(){return this._sessionId}setSessionId(e){this._sessionId=e,this._serialized=void 0}setLocale(e){this._locale=e,this._serialized=void 0}serialize(){var e,t;return this._serialized||(this._serialized={applePayMerchantIdentifier:null!==(e=this.applePayMerchantIdentifier)&&void 0!==e?e:"",applicationId:this.applicationId,avt:this.avt,cashAppPayMerchantIdentifier:null!==(t=this.cashAppPayMerchantIdentifier)&&void 0!==t?t:"",hostname:this.hostname,instanceId:this.instanceId,locale:this._locale,locationId:this.locationId,merchantCountryCode:this.merchantCountryCode,merchantName:this.merchantName,parentPathname:this.parentPathname,sessionId:this._sessionId,sourceUrl:this.sourceUrl,srcDpaId:this.srcDpaId}),this._serialized}}function sm(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function cm(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){sm(o,n,i,a,s,"next",e)}function s(e){sm(o,n,i,a,s,"throw",e)}a(void 0)}))}}function lm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return um(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?um(e,t):void 0}}(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 um(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function dm(){return(dm=cm((function*(e,t){var r=yield Od({frameborder:"0",height:"0",scrolling:"no",src:e,style:{border:"none",display:"block",visibility:"hidden"},width:"0"});return t.addBreadcrumb({message:"main iframe loaded"}),r}))).apply(this,arguments)}function hm(){return hm=cm((function*(e,t){var r=new Promise(((e,r)=>{var n=setTimeout((function(){var e;window.removeEventListener("message",i),r(((e=new Error("Web Payments SDK was unable to be initialized in time")).type="InitializationTimeoutError",e))}),1e4),i=function(r){"main-iframe:loaded"===r.data&&r.origin===_r.ASSET_BASE_URL&&(clearTimeout(n),window.removeEventListener("message",i),t.addBreadcrumb({message:"Processed main-iframe:loaded message"}),e())};window.addEventListener("message",i)})),n=function(e,t){return dm.apply(this,arguments)}(e,t),i=lm(yield Promise.all([n,r]),2),o=i[0];return i[1],o})),hm.apply(this,arguments)}var pm={build:function(e,t){return hm.apply(this,arguments)},getIframeSrc:function(e){var t=new URL(_r.IFRAME_SRC);return Object.entries(e).forEach((e=>{var r=lm(e,2),n=r[0],i=r[1];t.searchParams.set(n,i)})),t.toString()}},fm=function(e){return Ps({errorSerializer:{deserialize:e=>e instanceof Error?e:Vi(e),serialize:e=>e instanceof Cr?Gi(e):e},name:e})};function mm(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function vm(){var e;return e=function*(e,t,r,n){var i=fm(n);return i.setErrorHandler((function(e){"warning"!==e.severity&&t.captureException(e)})),i.connect({origin:_r.ASSET_URL,window:e.contentWindow},e.id),yield i.sendMessage("INITIALIZE",r),i},vm=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){mm(o,n,i,a,s,"next",e)}function s(e){mm(o,n,i,a,s,"throw",e)}a(void 0)}))},vm.apply(this,arguments)}var gm={build:function(e,t,r,n){return vm.apply(this,arguments)}};function ym(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Em(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function bm(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _m={ach_architecture_changes:"AMOUNT_SCHEMA",can_override_postal_code:!1,can_use_ach_auth:"REQUIRED",can_use_afterpay_on_shipping_options_changed:!1,can_use_apple_pay_recurring_payments:!1,can_use_interac:!1,click_to_pay_embedded_3ds:!1,eager_three_ds_method_execution_eligibility:!1,enable_payment_debug_output:"NONE",handle_insecure_contexts:"IGNORE",one_shot_authentication_apple_pay:!1,one_shot_authentication_click_to_pay:!1,one_shot_authentication_eligibility:!1,one_shot_authentication_google_pay:!1,show_square_monochrome:!1,use_new_afterpay_checkout_widget:!1},Cm={ach_architecture_changes:["AMOUNT_SCHEMA"],can_use_ach_auth:["SUPPORTED","REQUIRED"],enable_payment_debug_output:["NONE","APPLE_PAY","GOOGLE_PAY"],handle_insecure_contexts:["IGNORE","WARN","BLOCK"]};function Sm(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Im(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Sm(o,n,i,a,s,"next",e)}function s(e){Sm(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Om(){return Om=Im((function*(e,t,r,n){var i=e.applicationId,o=e.locationId,s=e.hostname,c=e.sourceUrl,l=e.parentPathname;t.logEvent({errorMessage:JSON.stringify({hostname:s,sourceUrl:c}),event:"PAYMENTS_ENV_METADATA",eventSource:"WebSDK"}),t.logEvent({event:"INITIALIZATION:START",eventSource:"WebSDK"});var u,d,h=n.getCurrentLocale();try{u=yield function(e,t,r,n,i,o,a){return wm.apply(this,arguments)}(i,o,s,h,r,c,l)}catch(e){var p=(d=e)instanceof Error&&"type"in d&&"InitializationTimeoutError"===d.type?"good":"bad";if(t.logEvent({event:"INITIALIZATION:ERROR",eventSource:"WebSDK",sloStatus:p}),"bad"===p)throw r.captureException(e,{step:"MESSENGER_SETUP"}),new Ln("initializing the payment method");throw e}try{var f=yield u.request("REQUEST_HYDRATION",{body:{applicationId:i,hostname:s,locationId:o}}),m=f.avt,v=f.sessionId,g=f.applePartnerInternalMerchantIdentifier,y=f.cashAppPayMerchantIdentifier,E=f.merchantDetails,b=f.instanceId,_=f.paymentMethodSupportDetail,C=f.featureFlagValues,S=f.srcDpaId,I=function(e){var t,r,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Em(Object(r),!0).forEach((function(t){bm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Em(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},_m);for(var i of Object.entries(_m)){var o=(r=2,function(e){if(Array.isArray(e))return e}(t=i)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return ym(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ym(e,t):void 0}}(t,r)||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.")}()),a=o[0],s=o[1],c=a;if(c in e){var l=e[c],u=Cm[c];n[c]=void 0===u?"true"===l:u.includes(l)?l:s}}return n}(C);if(!0!==a.isSecureContext){if("BLOCK"===I.handle_insecure_contexts)throw new _n;"WARN"===I.handle_insecure_contexts&&console.warn("[Square Web Payments SDK] WARNING: We have detected that this instance of the Web Payments SDK is being loaded in an insecure context.  As of October 31, 2025, the Web Payments SDK will block traffic from insecure contexts.  See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts for more details.")}t.setAvt(m);var O=new am({applePayMerchantIdentifier:g,applicationId:i,avt:m,cashAppPayMerchantIdentifier:y,hostname:s,instanceId:b,locale:h,locationId:o,merchantCountryCode:null==E?void 0:E.merchantCountryCode,merchantName:null==E?void 0:E.merchantName,sessionId:v,sourceUrl:c,srcDpaId:S});t.setFeatureFlagValues(I),t.logEvent({event:"INITIALIZATION:OK",eventSource:"WebSDK",sloStatus:"good"},b,v);var w=function(e,t,r,n){var i,o=void 0!==t&&t.length>0?t:void 0,s=null!=r?r:"";function c(){if(i)return i;Wc(om,"sq-threeds-modal-styles",document.head);var t=tm.setupClient(e,{avt:s,clientVersion:_r.ANALYTICS_CLIENT_VERSION,connectApiUrl:_r.CONNECT_API_URL,environment:_r.env,hostname:a.windowLocation.origin,locationId:o,messenger:n,pciConnectApiUrl:_r.API_URL,webSdkVersion:_r.VERSION});return i=t,t}return Object.freeze({execute3DSMethod:function(e){return c().execute3DSMethod(e)},verifyBuyer:function(e,t){var r,n=c(),i=nm(nm({},t),{},{billingContact:(r=t.billingContact,function(e){return"region"in e||"country"in e||"countryName"in e}(r)?r:{addressLines:r.addressLines,city:r.city,country:r.countryCode,email:r.email,familyName:r.familyName,givenName:r.givenName,phone:r.phone,postalCode:r.postalCode,region:r.state})});return n.verifyBuyer(e,i)}})}(O.applicationId,O.locationId,O.avt,u);return{analyticsBackend:w,featureFlagValues:I,localeStrings:n,messenger:u,paymentMethodSupportDetail:_,session:O}}catch(e){var A=qi(e),T="WebSdkEmbedError"===A.name?"good":"bad";if(t.logEvent({event:"INITIALIZATION:ERROR",eventSource:"WebSDK",sloStatus:T}),"bad"===T)throw"AlreadyCapturedError"!==A.name&&r.captureException(e,{step:"HYDRATION_REQUEST"}),new Ln("initializing the payment method");throw A}})),Om.apply(this,arguments)}function wm(){return(wm=Im((function*(e,t,r,n,i,o,a){var s=yield pm.build(pm.getIframeSrc({applicationId:e,hostname:r}),i);return yield gm.build(s,i,{applicationId:e,hostname:r,locale:n,locationId:t,parentPathname:a,sourceUrl:o})}))).apply(this,arguments)}var Am={initializePayment:function(e,t,r,n){return Om.apply(this,arguments)},validateVerificationDetails:function(e,t){var r=[];return eo(e.billingContact)||r.push(new ga(t,"details.billingContact","object")),e.intent&&"string"==typeof e.intent&&["CHARGE","STORE","CHARGE_AND_STORE"].includes(e.intent)||r.push(new ga(t,"details.intent","string")),"CHARGE"!==e.intent&&"CHARGE_AND_STORE"!==e.intent||(e.amount&&"string"==typeof e.amount||r.push(new ga(t,"details.amount","string")),e.currencyCode&&"string"==typeof e.currencyCode||r.push(new ga(t,"details.currencyCode","string"))),r}};function Tm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tm(Object(r),!0).forEach((function(t){Nm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Nm(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Rm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Dm(Object(r),!0).forEach((function(t){Lm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Lm(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var km={addressLines:"addressLines",city:"locality",country:"countryCode",postalCode:"postalCode",state:"administrativeArea"},Mm=["visa","masterCard","jcb","discover","amex"];function jm(e){var t;return{amount:e.amount,label:e.label,type:null!==(t=e.pending)&&void 0!==t&&t?"pending":"final"}}function Um(e){return{amount:e.amount,detail:"",identifier:e.id,label:e.label}}function Bm(e,t){return t?jm(t):e}function qm(e,t){return t?t.map(jm):e}function Hm(e,t){return t?t.map(Um):e}function Fm(e){for(var t=3;t>0&&!e.supportsVersion(t);)t-=1;return t}function Vm(e){return{amount:e.amount,id:e.identifier,label:e.label}}function Gm(e,t,r){return{errors:(n=e,i=[],void 0!==n.error&&i.push(new window.ApplePayError("addressUnserviceable","postalAddress",n.error)),n.shippingErrors&&Object.entries(n.shippingErrors).forEach((e=>{var t,r,n,o=(n=2,function(e){if(Array.isArray(e))return e}(r=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,n)||function(e,t){if(e){if("string"==typeof e)return xm(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?xm(e,t):void 0}}(r,n)||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.")}()),a=o[0],s=o[1],c=null!==(t=km[a])&&void 0!==t?t:"postalAddress";i.push(new window.ApplePayError("shippingContactInvalid",c,s))})),i),newLineItems:qm(t.lineItems,ol(e,r)),newShippingMethods:Hm(t.shippingMethods,e.shippingOptions),newTotal:Bm(t.total,e.total)};var n,i}function zm(e){return new Date(e).toISOString()}function $m(e){var t,r={amount:e.amount,label:e.label,paymentTiming:"recurring",recurringPaymentIntervalCount:1,recurringPaymentIntervalUnit:"month",recurringPaymentStartDate:zm(e.startDate)};if(e.frequency){var n="yearly"in(t=e.frequency)?{recurringPaymentIntervalCount:t.yearly.occurrence,recurringPaymentIntervalUnit:"year"}:"daily"in t?{recurringPaymentIntervalCount:t.daily.occurrence,recurringPaymentIntervalUnit:"day"}:{recurringPaymentIntervalCount:t.monthly.occurrence,recurringPaymentIntervalUnit:"month"};r.recurringPaymentIntervalUnit=n.recurringPaymentIntervalUnit,r.recurringPaymentIntervalCount=n.recurringPaymentIntervalCount}return r}var Ym=Va({name:Ga({nonBlank:!0}),value:Ga({nonBlank:!0})}),Wm=Va({amount:Ga({nonBlank:!0}),frequency:Ua(Aa()),label:Ga({nonBlank:!0}),startDate:Ga({nonBlank:!0})}),Km=Va({billingAgreement:Ua(Ga({nonBlank:!0})),managementURL:Ga({nonBlank:!0}),paymentDescription:Ga({nonBlank:!0}),regularBilling:Wm,tokenNotificationURL:Ua(Ga({nonBlank:!0})),trialBilling:Ua(Wm)}),Zm=ja([{eligible:e=>eo(e)&&"intent"in e&&"RECURRING_CHARGE"===e.intent,schemaOperation:Va({intent:Ga({legalValues:["RECURRING_CHARGE"]}),recurringPaymentRequest:Km})},{eligible:e=>eo(e)&&(!("intent"in e)||"CHARGE"===e.intent)&&!("recurringPaymentRequest"in e),schemaOperation:Va({intent:Ua(Ga({legalValues:["CHARGE"]}))})}],{code:"invalid_value",expected:"recurringPaymentRequest can only be present when intent is RECURRING_CHARGE",propertyPath:"recurringPaymentRequest"}),Jm=Ua(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return{isRecordSchema:!0,sanitizeFunction:function(e){var r={};for(var n of t){var i=n.sanitizeFunction(e);r=Pm(Pm({},r),i)}return r},validateFunction:function(e,r){var n=[];for(var i of t)n.push(...i.validateFunction(e,r));return n}}}(Va({additionalSignals:Ua(Pa(Ym)),cashCustomerToken:Ua(Ga({nonBlank:!0})),squareProduct:Ua(Ga({nonBlank:!0}))}),Zm));function Xm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Qm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xm(Object(r),!0).forEach((function(t){ev(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ev(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tv(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function rv(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){tv(o,n,i,a,s,"next",e)}function s(e){tv(o,n,i,a,s,"throw",e)}a(void 0)}))}}class nv extends Error{}var iv=[{messageContains:"",name:"SecurityError",unsupportedReason:fa.MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED},{messageContains:"insecure document",name:"InvalidAccessError",unsupportedReason:fa.APPLE_PAY_REQUIRES_SECURE_CONTEXT},{messageContains:"insecure parent frame",name:"InvalidAccessError",unsupportedReason:fa.APPLE_PAY_REQUIRES_SECURE_CONTEXT},{messageContains:"different security origin",name:"InvalidAccessError",unsupportedReason:fa.APPLE_PAY_CONSISTENT_DOMAIN_REQUIRED}];class ov extends Ka{constructor(e,t,r){if(super(t),this.methodType=qr.APPLE_PAY,this.sessionInProgress=!1,this.wasFirstInteractionCalled=!1,this.paymentMethodMessenger=new _c(this.context),this.paymentRequestLockController=r,this.req=e,this.req.addPaymentMethodUsage("Apple Pay"),void 0===window.ApplePaySession)throw new Cn(fa.APPLE_PAY_BROWSER_NOT_SUPPORTED);var n;try{n=window.ApplePaySession.canMakePayments()}catch(e){var i=qi(e);for(var o of iv)if(i.name===o.name&&i.message.includes(o.messageContains))throw new Cn(o.unsupportedReason);throw e}if(!n)throw new Cn(fa.APPLE_PAY_DEVICE_NOT_SUPPORTED);this.SessionHandle=window.ApplePaySession,this.validateConfiguration(),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}tokenize(e){var t=this;return rv((function*(){t.handleFirstInteraction(),t.throwIfDestroyed();var r=function(e,t){return $a(Jm).logValidationFailures(t,qr.APPLE_PAY,"tokenize",e,""),null!=e?e:{}}(e,t.metricsHandler),n=t.context.getFeatureFlagValues();if("RECURRING_CHARGE"===r.intent&&!n.can_use_apple_pay_recurring_payments)throw new Cn(fa.INVALID_CONFIG,"Apple Pay recurring payments are not enabled");var i,o="RECURRING_CHARGE"===r.intent?r.recurringPaymentRequest:void 0;if(t.sessionInProgress)throw new Rn([Za]);t.applePayPaymentRequest=function(e,t,r){var n=[...Mm];null!=t&&t&&n.push("interac");var i,o,a,s,c,l={countryCode:e.countryCode,currencyCode:e.currencyCode,lineItems:qm([],ol(e)),merchantCapabilities:["supports3DS"],requiredBillingContactFields:["postalAddress"],shippingMethods:Hm([],e.shippingOptions),supportedNetworks:n,total:jm(e.total)};return e.shippingContact&&(l.shippingContact={addressLines:(i=e.shippingContact).addressLines,administrativeArea:i.state,country:Xc[null!==(o=i.countryCode)&&void 0!==o?o:""],countryCode:i.countryCode,emailAddress:i.email,familyName:i.familyName,givenName:i.givenName,locality:i.city,phoneNumber:i.phone,postalCode:i.postalCode}),e.requestBillingContact&&(l.requiredShippingContactFields=["email","name","phone"]),e.requestShippingContact&&(l.requiredShippingContactFields=["postalAddress","name","email","phone"]),r&&(l.recurringPaymentRequest=(s=$m((a=r).regularBilling),c={managementURL:a.managementURL,paymentDescription:a.paymentDescription,regularBilling:s},void 0!==a.trialBilling&&(c.trialBilling=$m(a.trialBilling)),wi.isNonBlankString(a.billingAgreement)&&(c.billingAgreement=a.billingAgreement),wi.isNonBlankString(a.tokenNotificationURL)&&(c.tokenNotificationURL=a.tokenNotificationURL),c)),l}(t.req,n.can_use_interac,o),t.logDebugInfoIfEnabled(t.applePayPaymentRequest);try{i=new t.SessionHandle(Fm(t.SessionHandle),t.applePayPaymentRequest)}catch(e){var a=function(e){var t=qi(e);if("InvalidAccessError"===t.name&&"Must create a new ApplePaySession from a user gesture handler."===t.message)return{detail:"Due to Apple Pay security requirements, no async operations (like API calls or await statements) can occur between the button click and the tokenize() call.",message:"Apple Pay session creation failed. No async operations can be called between the user gesture (click) and tokenize().",type:"INVALID_APPLE_PAY_SESSION_CONTEXT"}}(e);if(void 0!==a)throw new Rn([a]);throw e}var s=t.shippingContactChanged.bind(t);i.onshippingcontactselected=e=>{s(e.shippingContact,t.applePayPaymentRequest)};var c=t.shippingOptionChanged.bind(t);i.onshippingmethodselected=e=>{c(e.shippingMethod,t.applePayPaymentRequest)};var l,u,d=new Promise(((e,t)=>{i.oncancel=()=>{t(new nv)}})),h=new Promise(((e,r)=>{i.onvalidatemerchant=n=>{t.requestApplePayMerchantValidity(n.validationURL,t.applePayPaymentRequest).then(e).catch((e=>{r(qi(e))}))}})),p=new Promise(((e,r)=>{i.onpaymentauthorized=n=>{t.requestApplePayCardNonce(n).then(e).catch((e=>{r(qi(e))}))}}));t.currentSession=i,t.sessionInProgress=!0,t.paymentRequestLockController.lock(t),t.metricsHandler.logEvent("EXTERNAL_SESSION:START"),i.begin();try{var f=yield Promise.race([h,d]);i.completeMerchantValidation(f);var m=yield Promise.race([p,d]);l=m.token,u=m.details,t.metricsHandler.logEvent("EXTERNAL_SESSION:OK")}catch(e){if(e instanceof nv)return t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),{status:Hr};throw t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e}finally{t.deleteApplePaySession()}if(t.context.getFeatureFlagValues().one_shot_authentication_apple_pay){var v,g=r.additionalSignals,y=r.squareProduct,E=r.cashCustomerToken,b=Qm(Qm(Qm({},void 0!==g&&{additionalSignals:g}),{},{amount:t.req.total.amount,billingContact:null!==(v=u.billing)&&void 0!==v?v:{}},void 0!==E&&{cashCustomerToken:E}),{},{currencyCode:t.req.currencyCode,customerInitiated:!0,intent:"RECURRING_CHARGE"===r.intent?"CHARGE_AND_STORE":"CHARGE",sellerKeyedIn:!1},void 0!==y&&{squareProduct:y});yield uh(t.context,b,l)}return{details:u,status:Gr,token:l}}))()}destroy(){return this.currentSession&&(this.abortSessionSafely(),this.deleteApplePaySession()),this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),Promise.resolve(!0)}validateConfiguration(){var e=this.session;if(void 0===e.applePayMerchantIdentifier||""===e.applePayMerchantIdentifier)throw new Cn(fa.INVALID_CONFIG,"applePayMerchantIdentifier");if(void 0===e.locationId||""===e.locationId)throw new Cn(fa.INVALID_CONFIG,"locationId")}requestApplePayCardNonce(e){var t=this;return rv((function*(){var r,n={applepayData:e.payment},i=null!==(r=t.selectedShippingMethod)&&void 0!==r?r:t.getDefaultShippingMethod();try{var o=yield t.paymentMethodMessenger.request("REQUEST_APPLE_PAY_CARD_NONCE",n);return t.getApplePaySession().completePayment(t.SessionHandle.STATUS_SUCCESS),t.context.setPaymentMethodTrackingId(o.paymentMethodTrackingId),t.wasFirstInteractionCalled=!1,function(e,t){var r=e.card,n=e.cardNonce,i=e.shippingContact,o=e.billingContact,a={details:{card:r,method:qr.APPLE_PAY},token:n};if(i){var s={contact:i};t&&(s.option=Vm(t)),a.details.shipping=s}return o&&(a.details.card&&(a.details.card.billing=o),a.details.billing=o),a}(o,i)}catch(e){throw t.getApplePaySession().completePayment(t.SessionHandle.STATUS_FAILURE),e}}))()}requestApplePayMerchantValidity(e,t){var r=this;return rv((function*(){var n,i=t.total.label,o=r.session,a={clientId:o.applicationId,locationId:o.locationId,merchantName:i,sourceUrl:o.sourceUrl,validationUrl:e};try{n=yield r.paymentMethodMessenger.request("REQUEST_APPLE_PAY_MERCHANT_VALIDITY",a)}catch(e){throw r.abortSessionSafely(),e}try{return JSON.parse(n.session)}catch(e){throw r.abortSessionSafely(),e}}))()}shippingContactChanged(e,t){var r,n,i,o,a,s,c,l,u,d,h=Fm(this.SessionHandle)>=3?this.updateApplePayShippingContactV3(t):this.updateApplePayShippingContactLegacy(t);this.req.hasEventListener(Ur.SHIPPING_CONTACT_CHANGED)?this.req.dispatchEvent(Ur.SHIPPING_CONTACT_CHANGED,{contactOrOption:(r=e,n=r.addressLines,i=r.locality,o=r.administrativeArea,a=r.postalCode,s=r.countryCode,c=r.givenName,l=r.familyName,u=r.emailAddress,d=r.phoneNumber,{addressLines:n,city:i,countryCode:null==s?void 0:s.toUpperCase(),email:u,familyName:l,givenName:c,phone:d,postalCode:a,state:o})},(e=>{this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",Qm(Qm({},e),{},{eventName:Ur.SHIPPING_CONTACT_CHANGED})),this.handleShippingContactUpdate(h,e)})):this.handleShippingContactUpdate(h)}handleShippingContactUpdate(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null===(t=r.shippingOptions)||void 0===t?void 0:t[0],i=this.getDefaultShippingMethod();void 0===n&&null!==i&&(n=Vm(i)),void 0!==n&&this.req.hasEventListener(Ur.SHIPPING_OPTION_CHANGED)?(this.selectedShippingMethod=Um(n),this.req.dispatchEvent(Ur.SHIPPING_OPTION_CHANGED,{contactOrOption:n},(t=>{this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",Qm(Qm({},t),{},{eventName:Ur.SHIPPING_OPTION_CHANGED})),e(Qm(Qm({},r),t))}))):e(r)}shippingOptionChanged(e,t){this.selectedShippingMethod=e;var r=Fm(this.SessionHandle)>=3?this.updateApplePayShippingMethodV3(t):this.updateApplePayShippingMethodLegacy(t);this.req.hasEventListener(Ur.SHIPPING_OPTION_CHANGED)?this.req.dispatchEvent(Ur.SHIPPING_OPTION_CHANGED,{contactOrOption:Vm(e)},r):r({})}updateApplePayPaymentRequest(e){this.applePayPaymentRequest.total=e.newTotal,e.newLineItems&&(this.applePayPaymentRequest.lineItems=e.newLineItems),function(e){return"newShippingMethods"in e}(e)&&(this.applePayPaymentRequest.shippingMethods=e.newShippingMethods)}updateApplePayShippingContactV3(e){return t=>{var r=Gm(t,e,this.req);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.getApplePaySession().completeShippingContactSelection(r)}}updateApplePayShippingContactLegacy(e){return t=>{var r=function(e,t,r,n){return Rm({status:n},Gm(e,t,r))}(t,e,this.req,this.SessionHandle.STATUS_SUCCESS);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.getApplePaySession().completeShippingContactSelection(r.status,r.newShippingMethods,r.newTotal,r.newLineItems)}}updateApplePayShippingMethodV3(e){return t=>{var r=function(e,t,r){return{newLineItems:qm(t.lineItems,ol(e,r)),newTotal:Bm(t.total,e.total)}}(t,e,this.req);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.getApplePaySession().completeShippingMethodSelection(r)}}updateApplePayShippingMethodLegacy(e){return t=>{var r=function(e,t,r,n){return Rm({status:n},Gm(e,t,r))}(t,e,this.req,this.SessionHandle.STATUS_SUCCESS);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.getApplePaySession().completeShippingMethodSelection(r.status,r.newTotal,r.newLineItems)}}getDefaultShippingMethod(){return this.applePayPaymentRequest.shippingMethods.length>0?this.applePayPaymentRequest.shippingMethods[0]:null}deleteApplePaySession(){delete this.currentSession,this.paymentRequestLockController.unlock(this),this.sessionInProgress=!1}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.metricsHandler.logEvent("FIRST_INTERACTION:OK"),this.wasFirstInteractionCalled=!0)}abortSessionSafely(){try{this.getApplePaySession().abort()}catch(e){}}getApplePaySession(){if(void 0===this.currentSession)throw new Ln("getting Apple Pay Session");return this.currentSession}logDebugInfoIfEnabled(e){"APPLE_PAY"===this.context.getFeatureFlagValues().enable_payment_debug_output&&console.debug(e)}}var av=ja([{eligible:function(e){return eo(e)&&"email"in e},schemaOperation:Va({dpaPresentationName:Ua(Ga({nonBlank:!0})),email:Ga({formatExample:"example@domain.com",matchRegexp:/^\S+@\S+\.\S+$/,nonBlank:!0})})},{eligible:function(e){return eo(e)&&"mobileNumber"in e},schemaOperation:Va({dpaPresentationName:Ua(Ga({nonBlank:!0})),mobileNumber:Va({countryCode:Ga({formatExample:"+X / +XX / +XXX (non-zero first digit)",matchRegexp:/^\+?[1-9]\d{0,2}$/,nonBlank:!0},(e=>e.replace(/\+/g,""))),phoneNumber:Ga({nonBlank:!0},(e=>e.replace(/[^\d]/g,"")))})})}],{code:"missing_property",expected:"string",propertyPath:"email"});class sv extends Error{constructor(){super("Click to Pay checkout was canceled by the user."),this.name="ClickToPayCanceledError"}}function cv(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var lv="".concat(_r.ASSET_URL,"/modal.css");class uv{constructor(e){var t=e.paymentMethods.clickToPay.modal;this.modalVeilContext=document.createElement("div"),this.modalVeilContext.className="modal-veil-context";var r=document.createElement("div");r.className="modal-veil",this.modal=document.createElement("div"),this.modal.classList.add("modal"),this.modal.setAttribute("role","dialog"),this.modal.setAttribute("aria-modal","true"),this.modal.setAttribute("aria-labelledby","ctp-modal-title");var n=document.createElement("div");n.classList.add("header-left");var i=document.createElement("img");i.classList.add("ctp-logo"),i.src=_r.staticAsset("click-to-pay/ctp-logo.svg"),i.alt="",i.setAttribute("aria-hidden","true");var o=document.createElement("span");o.classList.add("header-title"),o.id="ctp-modal-title",o.textContent=t.headerTitle,n.appendChild(i),n.appendChild(o);var a=document.createElement("div");a.classList.add("header-right");var s,c=document.createElement("img");c.classList.add("card-networks"),c.src=_r.staticAsset("click-to-pay/card-networks.svg"),c.alt=t.cardNetworksAlt,this.cancelButton=document.createElement("button"),this.cancelButton.classList.add("cancel"),this.cancelButton.setAttribute("type","button"),this.cancelButton.setAttribute("aria-label",t.cancelAriaLabel),this.cancelButton.innerHTML='<svg width="'.concat(s=48,'" height="').concat(s,'" viewBox="0 0 ').concat(s," ").concat(s,'" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <rect width="').concat(s,'" height="').concat(s,'" rx="').concat(Math.floor(24),'" fill="black" fill-opacity="0.05"/>\n    <path d="M18.71 30.71L24 25.41L29.29 30.71L30.71 29.29L25.41 24L30.71 18.71L29.29 17.29L24 22.59L18.71 17.29L17.29 18.71L22.59 24L17.29 29.29L18.71 30.71Z" fill="black" fill-opacity="0.9"/>\n  </svg>'),a.appendChild(c),a.appendChild(this.cancelButton);var l=document.createElement("div");l.classList.add("modal-header","content"),l.appendChild(n),l.appendChild(a),this.contentElement=document.createElement("div"),this.contentElement.classList.add("content"),this.contentElement.classList.add("modal-body"),this.contentElement.id="js-content",this.modal.appendChild(l),this.modal.appendChild(this.contentElement),r.appendChild(this.modal),this.modalVeilContext.appendChild(r)}getElement(){return this.modalVeilContext}getContentElement(){return this.contentElement}getCancelButton(){return this.cancelButton}loadStyles(){var e,t=this;return(e=function*(){yield Wc(lv,"click-to-pay-modal-styles",t.modalVeilContext)},function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){cv(o,n,i,a,s,"next",e)}function s(e){cv(o,n,i,a,s,"throw",e)}a(void 0)}))})()}showModal(){this.modalVeilContext.setAttribute("active",""),this.modal.removeAttribute("hidden"),this.contentElement.innerHTML=""}hideModal(){return this.modal.setAttribute("hidden",""),new Promise((e=>{setTimeout((()=>{this.modalVeilContext.removeAttribute("active"),e()}),240)}))}}function dv(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function hv(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){dv(o,n,i,a,s,"next",e)}function s(e){dv(o,n,i,a,s,"throw",e)}a(void 0)}))}}var pv=["mastercard","visa"];class fv extends Ka{constructor(e,t,r,n,i){var o;super(r),this.methodType="Click to Pay",this.tokenizeInProgress=!1,this.wasFirstInteractionCalled=!1,this.paymentRequestLockController=i,this.mastercardSdk=e,this.req=t,this.srcDpaId=r.getSession().srcDpaId,function(e){if(!eo(e))throw new cn("Click to Pay options must be an object.");var t=$a(av).validate(e);if(!t.isValid)throw Vs(t.issues,"Click to Pay constructor")}(n),this.clickToPayOptions=(o=n,$a(av).sanitize(o)),this.clickToPayButton=null,this.element=null,this.modal=new uv(this.context.getLocaleString()),this.paymentMessenger=new _c(this.context),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.paymentRequestLockController.lock(this),this.uiScriptsLoadedPromise=zh.attachUiScripts()}attach(e){var t=this;return hv((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED;try{t.element=Hc(e),yield t.uiScriptsLoadedPromise}catch(e){throw t.status=Ra.DETACHED,e}return document.body.appendChild(t.modal.getElement()),yield t.modal.loadStyles(),t.clickToPayButton=document.createElement("src-button"),t.clickToPayButton.setAttribute("card-brands",pv.join(", ")),t.element.appendChild(t.clickToPayButton),Promise.resolve()}))()}initialize(){var e=this;return hv((function*(){var t,r=e.context.getSession().locale;yield e.mastercardSdk.init({cardBrands:pv,checkoutExperience:"WITHIN_CHECKOUT",dpaData:{dpaName:"production"===_r.env?"Click To Pay":"ClickToPayStaging",dpaPresentationName:null!==(t=e.clickToPayOptions.dpaPresentationName)&&void 0!==t?t:"Square Inc."},dpaTransactionOptions:{consumerEmailAddressRequested:!0,consumerNameRequested:!0,consumerPhoneNumberRequested:!0,dpaBillingPreference:"FULL",dpaLocale:wi.convertLocaleToUnderscore(r)},srcDpaId:e.srcDpaId});var n=function(e){if("email"in e)return{email:e.email};var t=e.mobileNumber,r=t.countryCode,n=t.phoneNumber;return{countryCode:r,phoneNumber:Number(n)}}(e.clickToPayOptions);try{if(!(yield e.mastercardSdk.idLookup(n)).consumerPresent)throw new Cn({message:"Buyer is not registered for Click to Pay",type:"BUYER_NOT_REGISTERED"})}catch(e){var i=qi(e);if("click2PayError"===i.name&&"reason"in i&&"ACCT_INACCESSIBLE"===i.reason)throw new Cn({message:"Buyer is not registered for Click to Pay",type:"BUYER_NOT_REGISTERED"});throw e}}))()}tokenize(){var e=this;return hv((function*(){if(e.throwIfDestroyedOrNotAttached(),e.handleFirstInteraction(),e.tokenizeInProgress)throw new Rn([Za]);e.tokenizeInProgress=!0;var t=!1;e.modal.showModal(),e.metricsHandler.logEvent("EXTERNAL_SESSION:START");var r=document.createElement("iframe");r.classList.add("embedded-iframe");var n=e.modal.getContentElement();n.appendChild(r);var i=function(e){if("email"in e)return{consumerIdentity:{identityType:"EMAIL_ADDRESS",identityValue:e.email}};var t=e.mobileNumber,r=t.countryCode,n=t.phoneNumber;return{consumerIdentity:{identityType:"MOBILE_PHONE_NUMBER",identityValue:r.concat(n)}}}(e.clickToPayOptions),o=e.modal.getCancelButton(),a=new Promise(((e,t)=>{o.addEventListener("click",(()=>{t(new sv)}))})),s="AUTHENTICATE",c="CLICK_TO_PAY_PROVIDER",l="REQUEST_REJECTED",u="OTHER";try{var d=yield Promise.race([e.mastercardSdk.authenticate({accountReference:i,windowRef:r.contentWindow}),a]);n.removeChild(r);var h=d.cards;if(void 0===h||0===h.length)throw l="NO_CARDS",new Cn({message:"Buyer has no cards available for Click to Pay",type:"NO_CARDS_AVAILABLE"});if(s="LOAD_CARDS",c="CLICK_TO_PAY_PROVIDER",l="UNEXPECTED",yield Promise.race([e.displayCards(h,a,(()=>{s="WAIT_FOR_SELECTION",c="WEB_SDK",l="NO_SELECTION"})),a]),void 0===e.selectedCardId)throw new Error("No card selected for Click to Pay");s="CHECKOUT",c="CLICK_TO_PAY_PROVIDER",l="REQUEST_REJECTED",n.appendChild(r);var p=yield Promise.race([e.mastercardSdk.checkoutWithCard({srcDigitalCardId:e.selectedCardId,windowRef:r.contentWindow}),a]);l="INVALID_RESPONSE";var f=function(e){if("object"!=typeof e||null===e)throw new Error("Click to Pay checkout returned an invalid response");var t=e,r=t.checkoutActionCode,n=t.headers;if("CANCEL"===r)throw new sv;if("COMPLETE"!==r||"string"!=typeof t.checkoutResponse||"object"!=typeof n||null===n)throw new Error("Click to Pay checkout did not complete successfully");var i=n,o=i["merchant-transaction-id"],a=i["x-src-cx-flow-id"];if("string"!=typeof o||"string"!=typeof a)throw new Error("Click to Pay checkout omitted required headers");return{checkoutResponse:t.checkoutResponse,merchantTransactionId:o,srcCxFlowId:a}}(p);s="CREATE_NONCE",c="SQUARE_NONCE",l="UNEXPECTED";var m=yield e.paymentMessenger.request("REQUEST_CLICK_TO_PAY_CARD_NONCE",{clickToPayData:{checkout_response:f.checkoutResponse,merchant_transaction_id:f.merchantTransactionId,src_cx_flow_id:f.srcCxFlowId}}),v=m.cardNonce;e.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),t=!0,e.context.setPaymentMethodTrackingId(m.paymentMethodTrackingId);var g=e.context.getFeatureFlagValues();if(g.one_shot_authentication_click_to_pay&&!g.click_to_pay_embedded_3ds){var y={amount:e.req.total.amount,billingContact:{},currencyCode:e.req.currencyCode,customerInitiated:!0,intent:"CHARGE",sellerKeyedIn:!1};yield uh(e.context,y,v)}return{details:{card:m.card,method:"Click To Pay"},status:"OK",token:v}}catch(r){if(r instanceof sv)return e.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),{status:"Cancel"};var E,b;if(!t)"CREATE_NONCE"===s&&r instanceof Rn&&(l="APPLICATION_ERROR",u=Di(null!==(E=null===(b=r.errors[0])||void 0===b?void 0:b.type)&&void 0!==E?E:"")),e.metricsHandler.logValidationEvent("CLICK_TO_PAY_EXTERNAL_SESSION_ERROR",{errorCode:u,errorFamily:l,errorSource:c,selectedCardPresent:String(void 0!==e.selectedCardId),stage:s}),e.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR");throw r}finally{yield e.modal.hideModal(),e.tokenizeInProgress=!1,e.selectedCardId=void 0}}))()}destroy(){return this.status!==Ra.ATTACHED?Promise.resolve(!1):(this.selectedCardId=void 0,document.body.removeChild(this.modal.getElement()),this.element.removeChild(this.clickToPayButton),this.status=Ra.DESTROYED,this.paymentRequestLockController.unlock(this),Promise.resolve(!0))}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK"))}displayCards(e,t,r){var n=this;return hv((function*(){var i=n.context.getSession().locale,o=document.createElement("src-card-list");o.setAttribute("card-brands",pv.join(", ")),o.setAttribute("locale",wi.convertLocaleToUnderscore(i)),o.setAttribute("card-selection-type","radioButton"),o.setAttribute("display-header","false");var a=document.createElement("button");a.classList.add("ctp-continue-button"),a.disabled=!0,a.textContent=n.context.getLocaleString().paymentMethods.clickToPay.modal.continueButton;var s=n.modal.getContentElement();s.appendChild(o),s.appendChild(a),yield Promise.race([customElements.whenDefined("src-card-list"),t]);var c=o,l=!1;return c.addEventListener("selectSrcDigitalCardId",(e=>{var t=e.detail,r="string"==typeof t&&""!==t.trim();n.selectedCardId=r?t:void 0,a.disabled=!r,r&&!l&&(l=!0,n.metricsHandler.logEvent("CARD_SELECTED:OK"))})),c.loadCards(e),n.metricsHandler.logEvent("CARDS_SHOWN:OK"),r(),new Promise((e=>{a.addEventListener("click",(()=>{a.disabled||void 0===n.selectedCardId||(n.metricsHandler.logEvent("CONTINUE_CLICKED:OK"),s.removeChild(o),s.removeChild(a),e())}))}))}))()}}var mv=function(e,t,r,n,i){return new Kl(e,t,r,n,i)},vv=function(e,t,r){return new ov(e,t,r)},gv=function(e,t,r,n,i){return new Mh(e,t,r,n,i)},yv=function(e,t,r,n,i){return new fv(e,t,n,r,i)},Ev=function(e,t,r,n,i){return new Rp(e,t,r,n,i)};function bv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _v(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_v(e,t):void 0}}(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,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Cv(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Sv(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Cv(o,n,i,a,s,"next",e)}function s(e){Cv(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Iv=["addEventListener","attach","clear","configure","destroy","detach","focus","recalculateSize","removeEventListener","setError","tokenize"],Ov=["addEventListener","attach","destroy","detach","removeEventListener","tokenize"],wv=["addEventListener","destroy","removeEventListener","tokenize"],Av=["addEventListener","destroy","removeEventListener","tokenize"],Tv=["addEventListener","attach","clear","configure","destroy","detach","focus","removeEventListener","setError","tokenize"],Pv=["addEventListener","attach","attachCheckoutWidget","attachMessaging","destroy","detach","displayInformationModal","removeEventListener","tokenize"],Nv=["addEventListener","attach","destroy","detach","removeEventListener"],Dv=["attach","destroy","tokenize"],Rv=["addEventListener","attach","registerPayment"],Lv=["addEventListener","attach","destroy","registerPayment"],xv=["destroy","tokenize"];function kv(e,t){var r=t.paymentMethodSupportDetail,n=t.getSession();if(!wi.isNonBlankString(n.locationId))throw new Cn(fa.INVALID_CONFIG,"locationId");var i=r[e];if(void 0!==i&&!i.IsSupported){var o=i.UnsupportedReasonType,a=fa.UNKNOWN;throw function(e){return ma.includes(e)}(o)&&(a=va[o]),new Cn(a)}}function Mv(e){if(!(e instanceof up))throw new on([["paymentRequest","PaymentRequest"]])}function jv(e,t){var r=t instanceof Error&&wi.isInstanceOf(t,pa("build"));return e.metricsHandler.logEvent("BUILD:ERROR",r?"good":"bad"),r?(e.metricsHandler.logDeveloperError(t,"build"),t):t instanceof Ln?t:(e.errorLogger.captureException(t),new Ln("initializing ".concat(e.metricsHandler.methodType)))}class Uv{constructor(e,t,r){this.localeStrings=new Xi(navigator.language),this.paymentOptions=e,this.metrics=t,this.errorLogger=r,this.paymentRequestLockMap=new WeakMap,this.paymentsNumCalls=1}setLocale(e){var t=this;return Sv((function*(){try{var r=yield t.getPaymentContext("WebSDK");return r.metricsHandler.logConfigurationEvent("SET_LOCALE",e),r.setLocale(e)}catch(e){if(function(e){return Object.values(ji).some((t=>e instanceof t))}(e))throw t.errorLogger.captureException(e),new Ln("setting the locale");throw e}}))()}verifyBuyer(e,t){var r=this;return Sv((function*(){var n=[];if(r.paymentOptions.locationId&&0!==r.paymentOptions.locationId.length||n.push(new ga("verifyBuyer","locationId","string")),e&&"string"==typeof e&&0!==e.length||n.push(new ga("verifyBuyer","source","string")),eo(t)?n.push(...Am.validateVerificationDetails(t,"verifyBuyer")):n.push(new ga("verifyBuyer","details","object")),n.length>0)throw new ya(n);var i=yield r.getPaymentContext("WebSDK");try{i.metricsHandler.logEvent("VERIFICATION:START");var o=yield i.analyticsBackend.verifyBuyer(e,t);return i.metricsHandler.logEvent("VERIFICATION:OK"),o}catch(e){if(i.metricsHandler.logEvent("VERIFICATION:ERROR"),en(e))throw new Qr(e);throw"UnexpectedAnalyticsClientError"!==qi(e).name&&r.errorLogger.captureException(e),new Ln("verifying buyer")}}))()}card(e){var t=this;return Sv((function*(){var r=yield t.getPaymentContext(qr.CARD);r.metricsHandler.logEvent("BUILD:START");try{var n=new Oh(r,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Bv(n,Iv)}catch(e){throw jv(r,e)}}))()}paymentRequest(e){var t=new Zp,r=new up(e,this.localeStrings,t);return this.paymentRequestLockMap.set(r,t),this.getPaymentContext("Payment Request").then((t=>{var n=t.metricsHandler;r.setMetricsHandler(n),al(e.total,e.currencyCode,n,"create"),n.logConfigurationEvent("CONFIGURED",e)})),r}googlePay(e){var t=this;return Sv((function*(){var r=yield t.getPaymentContext(qr.GOOGLE_PAY);r.metricsHandler.logEvent("BUILD:START");try{kv("GOOGLE_PAY",r),function(){if("undefined"==typeof ShadowRoot)throw new Cn(fa.GOOGLE_PAY_BROWSER_NOT_SUPPORTED)}(),Mv(e);var n=t.getPaymentRequestLock(e),i=bv(yield kp(r),2),o=i[0],a=i[1],s=Ev(o,e,r,a,n);return r.metricsHandler.logEvent("BUILD:OK","good"),Bv(s,Ov)}catch(e){throw jv(r,e)}}))()}applePay(e){var t=this;return Sv((function*(){var r=yield t.getPaymentContext(qr.APPLE_PAY);r.metricsHandler.logEvent("BUILD:START");try{kv("APPLE_PAY",r),Mv(e);var n=t.getPaymentRequestLock(e),i=vv(e,r,n);return r.metricsHandler.logEvent("BUILD:OK","good"),Bv(i,wv)}catch(e){throw jv(r,e)}}))()}ach(e){var t=this;return Sv((function*(){var r=yield t.getPaymentContext(qr.ACH);r.metricsHandler.logEvent("BUILD:START");try{kv("ACH",r);var n=yield kc(),i=new xc(r,n,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Bv(i,Av)}catch(e){throw jv(r,e)}}))()}bitcoin(){var e=this;return Sv((function*(){var t=yield e.getPaymentContext("Bitcoin");t.metricsHandler.logEvent("BUILD:START");try{kv("BITCOIN",t);var r=yield _d.initialize(),n=new Ed(t,r);return t.metricsHandler.logEvent("BUILD:OK","good"),Bv(n,Rv)}catch(e){throw jv(t,e)}}))()}zelle(){var e=this;return Sv((function*(){var t=yield e.getPaymentContext("Zelle");t.metricsHandler.logEvent("BUILD:START");try{kv("ZELLE",t);var r=new Kp(t);return t.metricsHandler.logEvent("BUILD:OK","good"),Bv(r,Lv)}catch(e){throw jv(t,e)}}))()}bank(e){var t=this;return Sv((function*(){var r=yield t.getPaymentContext("Bank");r.metricsHandler.logEvent("BUILD:START");try{kv("BANK",r);var n=function(e){if(void 0!==(t=e)&&Object.prototype.hasOwnProperty.call(su,t))return e;var t;throw new Cn(tu)}(r.getSession().merchantCountryCode),i=yield kc(),o=new uu(r,i,n,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Bv(o,xv)}catch(e){throw jv(r,e)}}))()}giftCard(e){var t=this;return Sv((function*(){var r=yield t.getPaymentContext(qr.GIFT_CARD);r.metricsHandler.logEvent("BUILD:START");try{var n=new Qh(r,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Bv(n,Tv)}catch(e){throw jv(r,e)}}))()}afterpayClearpay(e){var t=this;return Sv((function*(){var r=yield t.getPaymentContext(qr.AFTERPAY_CLEARPAY);r.metricsHandler.logEvent("BUILD:START");try{kv("AFTERPAY",r),Mv(e);var n=t.getPaymentRequestLock(e),i=bv(yield Zl(),2),o=i[0],a=i[1],s=mv(o,a,e,r,n);return yield s.internalSetCheckoutToken(),r.metricsHandler.logEvent("BUILD:OK","good"),Bv(s,Pv)}catch(e){throw jv(r,e)}}))()}cashAppPay(e,t){var r=this;return Sv((function*(){var n=yield r.getPaymentContext(qr.CASH_APP_PAY);n.metricsHandler.logEvent("BUILD:START");try{kv("CASH_APP_PAY_V1",n),Mv(e);var i=r.getPaymentRequestLock(e),o=yield Uh.initialize(),a=gv(o,e,t,n,i);return yield a.initializeCustomerRequest(),n.metricsHandler.logEvent("BUILD:OK","good"),Bv(a,Nv)}catch(e){throw jv(n,e)}}))()}clickToPay(e,t){var r=this;return Sv((function*(){var n=yield r.getPaymentContext("Click to Pay");n.metricsHandler.logEvent("BUILD:START");try{Mv(e);var i=r.getPaymentRequestLock(e),o=n.getSession(),a=o.srcDpaId,s=o.locale;if(!wi.isNonBlankString(a))throw new Cn(fa.INVALID_CONFIG,"srcDpaId");var c=yield zh.initialize(wi.convertLocaleToUnderscore(s),a),l=yv(c,e,t,n,i);return yield l.initialize(),n.metricsHandler.logEvent("BUILD:OK","good"),Bv(l,Dv)}catch(e){throw jv(n,e)}}))()}markPaymentsReuse(){this.paymentsNumCalls+=1,this.metrics.logEvent({errorMessage:JSON.stringify({paymentsNumCalls:this.paymentsNumCalls}),event:"PAYMENTS_REUSE",eventSource:"WebSDK"})}getPaymentContext(e){var t=this;return Sv((function*(){var r,n=yield t.initializePaymentMethod(),i=n.featureFlagValues,o=n.messenger,a=n.session,s=n.paymentMethodSupportDetail,c=n.analyticsBackend,l={instanceId:a.instanceId,sessionId:a.sessionId};void 0!==a.avt&&(t.errorLogger.setUser(a.avt),l.avt=a.avt),t.errorLogger.setCustomTags(l);var u=_a(),d=new Ca(t.metrics,a,e,u);return null!==(r=t.contextEventTarget)&&void 0!==r||(t.contextEventTarget=new ba),new da(t.errorLogger,o,d,a,s,t.localeStrings,t.contextEventTarget,i,c)}))()}initializePaymentMethod(){return this.initializePaymentParamPromise||(this.initializePaymentParamPromise=Am.initializePayment(this.paymentOptions,this.metrics,this.errorLogger,this.localeStrings)),this.initializePaymentParamPromise}getPaymentRequestLock(e){var t=this.paymentRequestLockMap.get(e);if(!t){var r=new Ln("PaymentRequestLockMap entry does not exist. This should never happen.");throw this.errorLogger.captureException(r),r}return t}}function Bv(e,t){var r={};for(var n of t)"function"==typeof e[n]&&(r[n]=e[n].bind(e));return Object.freeze(r)}function qv(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Hv=new Map,Fv=["ach","afterpayClearpay","applePay","bank","bitcoin","card","cashAppPay","clickToPay","giftCard","googlePay","paymentRequest","setLocale","verifyBuyer","zelle"],Vv={errors:Ui,payments:function(e,t){var r,n,i,o=function(e){if(null!=e&&"string"!=typeof e)throw new ei;return null!=e?e:""}(t),s="".concat(e,"-").concat(o),c=Hv.get(s);if(void 0!==c){var l=(i=2,function(e){if(Array.isArray(e))return e}(n=c)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return qv(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qv(e,t):void 0}}(n,i)||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.")}()),u=l[0],d=l[1];return u.markPaymentsReuse(),d}if(!(r=a.windowLocation).hostname.endsWith("localhost")&&"https:"!==r.protocol)throw new _n;if(!a.isSupported())throw new bn;!function(e){if(!function(e){return!(e.length<22||e.length>37)&&vi.test(e)&&!gi.test(e)}(e))throw new Xn;var t=/^[\w-]{22}$/.exec(e),r=e.startsWith("sq0idp-"),n=e.startsWith("sandbox-sq0idb"),i=e.startsWith("sq0ids-");if(!(t||r||n||i))throw new Xn;if(r&&!Ei())throw new Qn("production",_r.env);if(n&&!yi("sandbox"))throw new Qn("sandbox",_r.env)}(e);var h=a.windowLocation,p=h.hostname,f=h.origin,m=h.pathname,v=new zi({applicationId:e,applicationUrl:f,source:"web-payments-sdk-public",useGlobalHandlers:!1}),g={applicationId:e,hostname:p,locationId:o,parentPathname:m,sourceUrl:f},y=new sa(v,{applicationId:e,hostname:p,locationId:o});y.logEvent({event:"LOAD:OK",eventSource:"WebSDK"});var E=new Uv(g,y,v),b=Bv(E,Fv);return Hv.set(s,[E,b]),b}};"Square"in window?Object.assign(window.Square,Vv):window.Square=Vv})();
//# debugId=b835aa90-9467-52dd-8dcd-6d069582112c
