!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function x(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function Q(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function $(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function Z(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ue(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function le(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function pe(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function de(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function fe(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function _e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:"absurd";throw new Error(t)},Ae=n(2),Te=n.n(Ae),Ie=window.Promise?Promise:Te.a,Re=Ie,Ne=("function"==typeof Symbol&&Symbol.iterator,function(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:[]}},We=function(e){return{error:e,errorType:"full",type:"error"}},Ke=function(e,t,n){var r=new Pe(Ye(e,t,n));return We(r)},Ve=function(e,t,n){return{expected:e,actual:String(t),options:n,errorType:"mismatch",type:"error"}},Je=function(e){return function(t,n){return void 0===t?Ge(t):e(t,n)}},Qe=function(e,t){return function(n,r){var o=function(e){var t=e.options.path.join(".")||"value";return{error:t+" should be "+e.expected,actual:t+" as "+e.actual}},i=function(e,t,n){return We(new Pe("Invalid value for "+e+": "+t+". You specified "+n+"."))},a=e(n,r),c=t(n,r);if("error"===a.type&&"error"===c.type){if("mismatch"===a.errorType&&"mismatch"===c.errorType){var s=o(a),u=s.error,l=s.actual,p=o(c),d=p.error,f=p.actual;return i(r.label,u===d?u:u+" or "+d,l===f?l:l+" and "+f)}if("mismatch"===a.errorType){var h=o(a),_=h.error,m=h.actual;return i(r.label,_,m)}if("mismatch"===c.errorType){var y=o(c),v=y.error,b=y.actual;return i(r.label,v,b)}return We(a.error)}return"valid"===a.type?a:c}},$e=function(e,t){return function(n,r){var o=Ne(e,function(e){return e===n});if(void 0===o){var i=t?"a recognized string.":"one of the following strings: "+e.join(", ");return Ve(i,n,r)}return Ge(o)}},Ze=function(e){return function(t,n){return"string"==typeof t&&0===t.indexOf(e)?Ge(t):Ve("a string starting with "+e,t,n)}},Xe=function(){for(var e=arguments.length,t=Array(e),n=0;ne?Ge(t):Ve("a number greater than "+e,t,n)}},st=function(e){return function(t,n){return"number"==typeof t&&t===parseInt(t,10)&&(!e||t>=0)?Ge(t):Ve(e?"a positive amount in the currency's subunit":"an amount in the currency's subunit",t,n)}},ut=function(e,t){return st(!1)(e,t)},lt=function(e,t){return st(!0)(e,t)},pt=function(e,t){return e&&"object"===(void 0===e?"undefined":ze(e))?Ge(e):Ve("an object",e,t)},dt=function(e){return function(t,n){if(Array.isArray(t)){return t.map(function(t,r){return e(t,He({},n,{path:[].concat(c(n.path),[String(r)])}))}).reduce(function(e,t){return"error"===e.type?e:"error"===t.type?t:Ge([].concat(c(e.value),[t.value]),[].concat(c(e.warnings),c(t.warnings)))},Ge([]))}return Ve("array",t,n)}},ft=function(e){return function(t){return function(n,r){if(Array.isArray(n)){var o=t(n,r);if("valid"===o.type)for(var i={},a=0;a0&&void 0!==arguments[0]?arguments[0]:"";return t?(parseInt(t,10)^16*Math.random()>>parseInt(t,10)/4).toString(16):"00000000-0000-4000-8000-000000000000".replace(/[08]/g,e)},Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wt=function e(t,n){var r=[];return Object.keys(t).forEach(function(o){var i=t[o],a=n?n+"["+o+"]":o;if(i&&"object"===(void 0===i?"undefined":Gt(i))){var c=e(i,a);""!==c&&(r=[].concat(s(r),[c]))}else void 0!==i&&null!==i&&(r=[].concat(s(r),[a+"="+encodeURIComponent(String(i))]))}),r.join("&").replace(/%20/g,"+")},Kt=Wt,Vt=n(6),Jt=n.n(Vt),Qt=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),$t=function(e,t){var n={};t.forEach(function(e){var t=Qt(e,2),r=t[0],o=t[1];r.split(/\s+/).forEach(function(e){e&&(n[e]=n[e]||o)})}),e.className=Jt()(e.className,n)},Zt=function(e,t){e.style.cssText=Object.keys(t).map(function(e){return e+": "+t[e]+" !important;"}).join(" ")},Xt=function(e){try{return window.parent.frames[e]}catch(e){return null}},en=function(e){if(!document.body)throw new Pe("Stripe.js requires that your page has a element.");return e(document.body)},tn=Object.assign||function(e){for(var t=1;t1?n-1:0),o=1;o0},this._off=function(e,n){if(n){for(var r=t._callbacks[e],o=void 0,i=0;i element.");this.autoload&&(this.loaded=!0)}},{key:"_createIFrame",value:function(e){var n=vn(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_createIFrame",this).call(this,e);return n.setAttribute("aria-hidden","true"),n.setAttribute("allowpaymentrequest","true"),n.setAttribute("tabIndex","-1"),Zt(n,bn),n}}]),t}(mn),En=gn,wn=function(){function e(e,t){for(var n=0;n=0,r=e.getBoundingClientRect(),o=jn(e),i=r.width>0&&r.height>0&&o&&"hidden"!==o.getPropertyValue("visibility");return n&&i});return n[Ce(n,function(t){return t===e||e.contains(t)})+("previous"===t?-1:1)]},Dn=function(e){var t=[],n=je(document.querySelectorAll("*"),function(n){var r=n.getAttribute("tabindex")||"";e!==n&&(n.tabIndex=-1),t.push({element:n,tabIndex:r})});return Nn(function(){n.then(function(){return je(t,function(e){var t=e.element,n=e.tabIndex;""===n?t.removeAttribute("tabindex"):t.setAttribute("tabindex",n)})})})},xn=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};e._controllerFrame.send({action:"stripe-controller-report",payload:{event:t,data:n}})},this.warn=function(){for(var t=arguments.length,n=Array(t),r=0;r=0},Br=function(e){function t(){L(this,t);var e=D(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.name="NetworkError",e.type="network_error",e}return x(t,e),t}(Error),Ur=Br,Hr=Object.assign||function(e){for(var t=1;t4&&void 0!==arguments[4]?arguments[4]:Io,i=Math.max(Io,o);if(window.ApplePaySession){if(To()){if(n&&"https:"!==window.location.protocol)return window.console&&window.console.warn("To test Apple Pay, you must serve this page over HTTPS."),Re.resolve(!1);if(window.ApplePaySession.supportsVersion(i)){var a=t?[e,t]:[e],c="merchant."+a.join(".")+".stripe";return Ro(c).then(function(o){if(r("pr.apple_pay.can_make_payment_native_response",{available:o}),n&&!o&&window.console){var i=t?"or stripeAccount parameter ("+t+") ":"";window.console.warn("Either you do not have a card saved to your Wallet or the current domain ("+e+") "+i+"is not registered for Apple Pay. Visit https://dashboard.stripe.com/account/apple_pay to register this domain.")}return o})}return n&&window.console&&window.console.warn("This version of Safari does not support ApplePay JS version "+i+"."),Re.resolve(!1)}return Re.resolve(!1)}return Re.resolve(!1)},Co=["mastercard","visa"],Mo=["AT","AU","BE","CA","CH","DE","DK","EE","ES","FI","FR","GB","GR","HK","IE","IT","JP","LT","LU","LV","MX","NL","NO","NZ","PL","PT","SE","SG","US"],jo=function(e,t){var n="US"===e||t?["discover","diners","jcb"].concat(Co):Co;return-1!==Mo.indexOf(e)?["amex"].concat(B(n)):n},Lo=function(e,t){return jo(e,t).reduce(function(e,t){return"mastercard"===t?[].concat(B(e),["masterCard"]):"diners"===t?e:[].concat(B(e),[t])},[])},Do={bif:1,clp:1,djf:1,gnf:1,jpy:1,kmf:1,krw:1,mga:1,pyg:1,rwf:1,vnd:1,vuv:1,xaf:1,xof:1,xpf:1},xo=function(e){var t=Do[e.toLowerCase()]||100;return{unitSize:1/t,fractionDigits:Math.log(t)/Math.log(10)}},qo=function(e,t){var n=xo(t);return(e*n.unitSize).toFixed(n.fractionDigits)},Fo=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"1.2em",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Di,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"0",r=xi(n);if("string"==typeof e&&/^[0-9.]+px$/.test(e)){return parseFloat(e.toString().replace(/[^0-9.]/g,""))+r+"px"}var o=parseFloat(e.toString().replace(/[^0-9.]/g,"")),i=parseFloat(Di.replace(/[^0-9.]/g,"")),a=parseFloat(t.toString().replace(/[^0-9.]/g,"")),c=void 0;if("string"==typeof t&&/^(\d+|\d*\.\d+)px$/.test(t))c=a;else if("string"==typeof t&&/^(\d+|\d*\.\d+)em$/.test(t))c=a*i;else if("string"==typeof t&&/^(\d+|\d*\.\d+)%$/.test(t))c=a/100*i;else{if("string"!=typeof t||!/^[\d.]+$/.test(t)&&!/^\d*\.(px|em|%)$/.test(t))return"100%";c=i}var s=o*c+r,u=s+"px";return/^[0-9.]+px$/.test(u)?u:"100%"},Fi=qi,Bi=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1];if("paymentRequestButton"===this._componentName){var n=e.style&&e.style.paymentRequestButton||{},r=n.height,o="string"==typeof r?r:void 0;(t||o)&&(this._frame.updateStyle({height:o||this._lastHeight||"40px"}),this._lastHeight=o||this._lastHeight)}else{var i=e.style&&e.style.base||{},a=i.lineHeight,c=i.fontSize,s=i.padding,u="string"!=typeof a||isNaN(parseFloat(a))?void 0:a,l="string"==typeof c?c:void 0,p="string"==typeof s?s:void 0;if(l&&!Wi(l)&&this._controller.warn("The fontSize style you specified ("+l+") is not in px. We do not recommend using relative css units, as they will be calculated relative to our iframe's styles rather than your site's."),t||u||l){var d=-1===Ut.indexOf(this._componentName)?void 0:p||this._lastPadding,f=Fi(u||this._lastHeight,l||this._lastFontSize,d);this._frame.updateStyle({height:f}),this._lastFontSize=l||this._lastFontSize,this._lastHeight=u||this._lastHeight,this._lastPadding=d}}}},{key:"_createElement",value:function(e,t){var n=this,r=(e.classes,e.controller,e.paymentRequest,$(e,["classes","controller","paymentRequest"])),o=document.createElement("div");o.className="__PrivateStripeElement";var i=document.createElement("input");i.className="__PrivateStripeElement-input",i.setAttribute("aria-hidden","true"),i.setAttribute("aria-label"," "),i.setAttribute("autocomplete","false"),i.maxLength=1,i.disabled=!0,Zt(o,zi),Zt(i,Yi);var a=jn(document.body),c=!!a&&"rtl"===a.getPropertyValue("direction"),s=Er[t],u=Bi({},r,{rtl:c}),l=this._controller.createElementFrame(s,u);if(l._on("load",function(){i.disabled=!1}),i.addEventListener("focus",function(){l.focus()}),l.appendTo(o),Or[t]){var p=Or[t].secondary;this._secondaryFrame=this._createSecondFrame(s,p,Bi({},u,{primaryElementType:t})),this._secondaryFrame.appendTo(o),window.addEventListener("click",function(){return n._handleOutsideClick()})}if(o.appendChild(i),fr&&t!==Ct.paymentRequestButton){var d=document.createElement("input");d.className="__PrivateStripeElement-safariInput",d.setAttribute("aria-hidden","true"),d.setAttribute("tabindex","-1"),d.setAttribute("autocomplete","false"),d.maxLength=1,d.disabled=!0,Zt(d,Yi),o.appendChild(d)}this._component=o,this._frame=l,this._fakeInput=i}}]),t}(dn),Vi=function(){var e=this;this._paymentRequest=null,this.mount=cn(function(t){e._checkDestroyed();var n=void 0;if(!t)throw new Pe("Missing argument. Make sure to call mount() with a valid DOM element or selector.");if("string"==typeof t){var r=document.querySelectorAll(t);if(r.length>1&&e._controller.warn("The selector you specified ("+t+") applies to "+r.length+" DOM elements that are currently on the page.\nThe Stripe Element will be mounted to the first one."),!r.length)throw new Pe("The selector you specified ("+t+") applies to no DOM elements that are currently on the page.\nMake sure the element exists on the page before calling mount().");n=r[0]}else{if(!t.appendChild)throw new Pe("Invalid DOM element. Make sure to call mount() with a valid DOM element or selector.");n=t}if("INPUT"===n.nodeName)throw new Pe("Stripe Elements must be mounted in a DOM element that\ncan contain child nodes. `input` elements are not permitted to have child\nnodes. Try using a `div` element instead.");if(n.children.length&&e._controller.warn("This Element will be mounted to a DOM element that contains child nodes."),e._paymentRequest){if(!e._paymentRequest._canMakePaymentResolved)throw new Pe("For the paymentRequestButton Element, you must first check availability using paymentRequest.canMakePayment() before mounting the Element.");if(!e._paymentRequest._activeBackingLibraryName)throw new Pe("The paymentRequestButton Element is not available in the current environment.");e._mountToParent(n)}else e._mountToParent(n)}),this.update=cn(function(t){e._checkDestroyed();var n=gt(ji,t||{},"element.update()"),r=n.value;if(n.warnings.forEach(function(t){return e._controller.warn(t)}),r){var o=r.classes,i=$(r,["classes"]);o&&(e._removeClasses(),e._computeCustomClasses(o),e._updateClasses()),e._updateFrameHeight(r),Object.keys(i).length&&(e._frame.update(i),e._secondaryFrame&&e._secondaryFrame.update(i))}return e}),this.focus=cn(function(t){return e._checkDestroyed(),t&&t.preventDefault(),document.activeElement&&document.activeElement.blur&&document.activeElement.blur(),e._fakeInput.focus(),e}),this.blur=cn(function(){return e._checkDestroyed(),e._frame.blur(),e._fakeInput.blur(),e}),this.clear=cn(function(){return e._checkDestroyed(),e._frame.clear(),e}),this.unmount=cn(function(){e._checkDestroyed();var t=e._component.parentElement,n=e._label;return t&&(t.removeChild(e._component),t.removeEventListener("click",e.focus),e._removeClasses()),e._parent=null,n&&(n.removeEventListener("click",e.focus),e._label=null),e._secondaryFrame&&(e._secondaryFrame.unmount(),window.removeEventListener("click",e._handleOutsideClick)),e._fakeInput.disabled=!0,e._frame.unmount(),e}),this.destroy=cn(function(){return e._checkDestroyed(),e.unmount(),e._destroyed=!0,e._emitEvent("destroy"),e}),this._formSubmit=function(){for(var t=e._component.parentElement;t&&"FORM"!==t.nodeName;)t=t.parentElement;if(t){var n=document.createEvent("Event");n.initEvent("submit",!0,!0),t.dispatchEvent(n)}}},Ji=Ki,Qi=Object.assign||function(e){for(var t=1;t2e3,c=!!e._pendingFonts||a,s=new Ji(Qi({},i,{fonts:a?null:e._commonOptions.fonts,controller:e._controller,wait:c}));return e._elements=[].concat(oe(e._elements),[t]),s._on("destroy",function(){e._elements=e._elements.filter(function(e){return e!==t})}),a&&s._frame.send({action:"stripe-user-update",payload:{fonts:e._commonOptions.fonts}}),s})},ta=Xi,na=function(e,t,n,r,o,i){return new Ni({controller:e,authentication:t,mids:n,rawOptions:r,betas:o,queryStrategyOverride:i})},ra=na,oa={_componentName:rt,_frame:yt({id:rt})},ia=yt(oa),aa=function(e){var t=bt(ia,e,"");return"error"===t.type?null:t.value},ca={au_becs_debit:"au_becs_debit",bacs_debit:"bacs_debit",card:"card",ideal:"ideal",sepa_debit:"sepa_debit",three_d_secure:"three_d_secure",fpx:"fpx"},sa=(Se={},ie(Se,Ct.auBankAccount,ca.au_becs_debit),ie(Se,Ct.card,ca.card),ie(Se,Ct.cardNumber,ca.card),ie(Se,Ct.cardExpiry,ca.card),ie(Se,Ct.cardCvc,ca.card),ie(Se,Ct.postalCode,ca.card),ie(Se,Ct.iban,ca.sepa_debit),ie(Se,Ct.idealBank,ca.ideal),ie(Se,Ct.fpxBank,ca.fpx),Se),ua=function(e){return-1===Dt.indexOf(e)},la=function(e,t){return null!=t?t:ua(e)?null:sa[e]||null},pa=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};if(se(this,e),n.checkoutIds){var r=n.checkoutIds,o=r.muid,i=r.sid;this._muid=o,this._sid=i,this._doNotPersist=!0}else this._muid=this._getID(Ta.MERCHANT),this._sid=this._getID(Ta.SESSION),this._doNotPersist=!1;this._id=zt(Aa),this._controllerFrame=new kn(Ot.METRICS_CONTROLLER,this._id,{autoload:!0,queryString:this._buildFrameQueryString()}),this._guidPromise=new Re(function(e){t._establishMessageChannel(e)}),this._startIntervalCheck(),setTimeout(this._testLatency.bind(this),2e3+500*Math.random())}return Oa(e,[{key:"ids",value:function(){return{guid:this._guid||"NA",muid:this._muid||"NA",sid:this._sid||"NA"}}},{key:"idsPromise",value:function(){var e=this;return this._guidPromise.then(function(){return e.ids()})}},{key:"_establishMessageChannel",value:function(e){var t=this;window.addEventListener("message",function(n){var r=n.data;if("string"==typeof r)try{var o=JSON.parse(r),i=o.originatingScript,a=o.payload;"m"===i&&(t._guid=a,e(a))}catch(e){}})}},{key:"_startIntervalCheck",value:function(){var e=this,t=window.location.href;setInterval(function(){var n=window.location.href;n!==t&&(e.send({action:"ping",payload:{sid:e._getID(Ta.SESSION),muid:e._getID(Ta.MERCHANT),title:document.title,referrer:document.referrer,url:document.location.href}}),t=n)},5e3)}},{key:"report",value:function(e,t){try{this.send({action:"track",payload:{sid:this._getID(Ta.SESSION),muid:this._getID(Ta.MERCHANT),url:document.location.href,source:e,data:t}})}catch(e){}}},{key:"send",value:function(e){var t=Rt(Ot.METRICS_CONTROLLER);er(t)&&this._controllerFrame.send(e)}},{key:"_testLatency",value:function(){var e=this,t=[],n=new Date,r=function r(){try{var o=new Date;t.push(o-n),t.length>=10&&(e.report("mouse-timings-10",t),document.removeEventListener("mousemove",r)),n=o}catch(e){}};document.addEventListener("mousemove",r)}},{key:"_extractMetaReferrerPolicy",value:function(){var e=document.querySelector("meta[name=referrer]");return null!=e&&e instanceof HTMLMetaElement?e.content.toLowerCase():null}},{key:"_extractUrl",value:function(e){var t=document.location.href;switch(e){case"origin":case"strict-origin":case"origin-when-cross-origin":case"strict-origin-when-cross-origin":return document.location.origin;case"unsafe-url":return t.split("#")[0];default:return t}}},{key:"_buildFrameQueryString",value:function(){var e=this._extractMetaReferrerPolicy(),t=this._extractUrl(e),n={url:t,title:document.title,referrer:document.referrer,muid:this._muid,sid:this._sid,preview:tr(t)};return null!=e&&(n.metaReferrerPolicy=e),Object.keys(n).map(function(e){return null!=n[e]?e+"="+encodeURIComponent(n[e].toString()):null}).join("&")}},{key:"_getID",value:function(e){switch(e){case Ta.MERCHANT:if(this._doNotPersist)return this._muid;try{var t=Pa("__stripe_mid")||Yt();return ka({name:"__stripe_mid",value:t,domain:"."+document.location.hostname}),t}catch(e){return"NA"}case Ta.SESSION:if(this._doNotPersist)return this._sid;try{var n=Pa("__stripe_sid")||Yt();return ka({name:"__stripe_sid",value:n,domain:"."+document.location.hostname,expiresIn:18e5}),n}catch(e){return"NA"}default:throw new Error("Invalid ID type specified: "+e)}}}]),e}(),Ra=Ia,Na="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ca=function(e){if(!e||"object"!==(void 0===e?"undefined":Na(e)))return null;var t=e.type,n=ue(e,["type"]);return{type:"string"==typeof t?t:null,data:n}},Ma=function(e){switch(e.type){case"object":return{source:e.object};case"error":return{error:e.error};default:return Oe(e)}},ja={source:yt({id:Ze("src_"),client_secret:Ze("src_client_secret_")})},La=yt(ja),Da=function(e){switch(e.type){case"object":return{paymentMethod:e.object};case"error":return{error:e.error};default:return Oe(e)}},xa=function(e){return gt(Ea(null),e,"createPaymentMethod").value},qa=function(e,t,n,r,o){var i=aa(r),a=Ca(i?o:r),c=a||{type:null,data:{}},s=c.type,u=c.data;if(s&&n!==s)return Re.reject(new Pe("The type supplied in payment_method_data is not consistent."));if(i){var l=i._frame.id,p=i._componentName;return e.action.createPaymentMethodWithElement({frameId:l,elementName:p,type:n,paymentMethodData:u,mids:t}).then(Da)}return a?e.action.createPaymentMethodWithData({elementName:null,type:n,paymentMethodData:u,mids:t}).then(Da):Re.reject(new Pe("Please provide either an Element or PaymentMethod creation parameters to createPaymentMethod."))},Fa=function(e,t,n,r,o){if("string"==typeof n)return qa(e,t,n,r,o);try{var i=xa(n),a=i.element,c=i.type,s=i.data;if(a){var u=a._frame.id,l=a._componentName;return e.action.createPaymentMethodWithElement({frameId:u,elementName:l,type:c,paymentMethodData:s,mids:t}).then(Da)}return e.action.createPaymentMethodWithData({elementName:null,type:c,paymentMethodData:s,mids:t}).then(Da)}catch(e){return Re.reject(e)}},Ba=function(e){return"https://stripe.com/docs/stripe-js/reference#stripe-"+e.split(/(?=[A-Z])/).join("-").toLowerCase()},Ua=function(e,t){return gt(ba,e,"stripe."+t+" intent secret").value},Ha=function(e,t){return gt(wa,t,e).value},za=function(e,t,n){if("valid"===bt(ia,n,t).type)throw new Pe("Do not pass an Element to stripe."+t+"() directly.\nFor more information: "+Ba(t));var r=gt(Sa(e,t),n,t),o=r.value,i=o.source,a=o.paymentMethodData,c=o.paymentMethod,s=o.otherParams;if(null!=i&&(null!=a||null!=c))throw new Pe(t+": Expected either source or payment_method, but not both.");return a?a.element?{confirmMode:{tag:"paymentMethod-from-element",type:e,elementName:a.element._componentName,frameId:a.element._frame.id,data:a.data},otherParams:s}:{confirmMode:{tag:"paymentMethod-from-data",type:e,data:a.data},otherParams:s}:c?{confirmMode:{tag:"paymentMethod",paymentMethod:c},otherParams:s}:i?{confirmMode:{tag:"source",source:i},otherParams:s}:{confirmMode:{tag:"none"},otherParams:s}},Ya=function(e,t){var n={skipFingerprint:!1,sandboxFingerprintFrame:!1,sandboxChallengeFrame:!1};return-1!==e.indexOf("Y")&&(t.report("3ds2.optimization.Y"),n.skipFingerprint=!0),-1!==e.indexOf("k")&&(t.report("3ds2.optimization.k"),n.sandboxFingerprintFrame=!0),-1!==e.indexOf("5")&&(t.report("3ds2.optimization.5"),n.sandboxChallengeFrame=!0),n},Ga=function(e){return{american_express:"amex",visa:"visa",mastercard:"mastercard",discover:"discover"}[e]||"unknown"},Wa=function(e,t,n){if(!e)return null;if("use_stripe_sdk"===e.type){var r=e.use_stripe_sdk;switch(r.type){case"cardinal_3ds2_fingerprint":return{type:"cardinal-sdk-fingerprint",bin:r.stripe_js.bin,jwt:r.stripe_js.jwt,env:r.stripe_js.env};case"stripe_3ds2_fingerprint":return{type:"3ds2-fingerprint",threeDS2Source:r.three_d_secure_2_source,cardBrand:Ga(r.directory_server_name),transactionId:r.server_transaction_id,optimizations:Ya(r.three_ds_optimizations,n),methodUrl:r.three_ds_method_url};case"stripe_3ds2_challenge":return{type:"3ds2-challenge",threeDS2Source:r.stripe_js.three_d_secure_2_source,cardBrand:Ga(r.stripe_js.directory_server_name),transactionId:r.stripe_js.server_transaction_id,optimizations:Ya(r.stripe_js.three_ds_optimizations,n),acsTransactionId:r.stripe_js.acs_transaction_id,acsUrl:r.stripe_js.acs_url};case"three_d_secure_redirect":return{type:"3ds1-modal",url:r.stripe_js}}}if("redirect_to_url"===e.type){var o=e.redirect_to_url.url;switch(t){case ca.ideal:return{type:"ideal-redirect",redirectUrl:o};case ca.fpx:return{type:"fpx-redirect",redirectUrl:o}}}if("authorize_with_url"===e.type){var i=e.authorize_with_url.url;switch(t){case ca.card:return{type:"3ds1-modal",url:i};case ca.ideal:return{type:"ideal-redirect",redirectUrl:i}}}return null},Ka=function(e){switch(e.type){case"error":return{error:e.error};case"object":switch(e.object.object){case"payment_intent":return{paymentIntent:e.object};case"setup_intent":return{setupIntent:e.object};default:return Oe(e.object)}default:return Oe(e)}},Va=function(e,t,n,r){return t===jt.PAYMENT_INTENT?n.action.retrievePaymentIntent({hosted:!1,intentSecret:e,locale:r,asErrorIfNotSucceeded:!0}).then(Ka):n.action.retrieveSetupIntent({hosted:!1,intentSecret:e,locale:r,asErrorIfNotSucceeded:!0}).then(Ka)},Ja=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Qa=function(e,t,n){return e.createLightboxFrame(Ot.AUTHORIZE_WITH_URL,{url:t,locale:n})},$a=function(e,t,n,r,o){var i=Lr(),a=Date.now(),c=Qa(r,e,o);c.show(),r.report("authorize_with_url.loading",{viewport:i}),c._on("load",function(){r.report("authorize_with_url.loaded",{loadDuration:Date.now()-a}),c.fadeInBackdrop()});var s=function(e){return!(!e.code||!e.type)&&!(!e.payment_intent&&!e.setup_intent)};return c._on("challenge_complete",function(){c.fadeOutBackdrop()}),new Re(function(e,i){c._once("authorize_with_url_done",function(i){r.report("authorize_with_url.done",{shownDuration:Date.now()-a,success:!("error"in i)});var u=function(){return Re.all([Va(t,n,r,o),c.destroy()]).then(function(e){return Ja(e,1)[0]})};"fallback"===i.type?u().then(e):i.result.error&&!s(i.result.error)?u().then(e):c.destroy().then(function(){return e(i.result)})})})},Za=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Xa=Object.assign||function(e){for(var t=1;t1)throw new Pe("stripe.redirectToCheckout: Do not provide other parameters when providing sessionId. Specify all parameters on your server when creating the CheckoutSession.");if(!/^cs_/.test(i))throw new Pe("stripe.redirectToCheckout: Invalid value for sessionId. You specified '"+i+"'.");if("livemode"===t&&/^cs_test_/.test(i))throw new Pe("stripe.redirectToCheckout: the provided sessionId is for a test mode Checkout Session, whereas Stripe.js was initialized with a live mode publishable key.");if("testmode"===t&&/^cs_live_/.test(i))throw new Pe("stripe.redirectToCheckout: the provided sessionId is for a live mode Checkout Session, whereas Stripe.js was initialized with a test mode publishable key.");return{tag:"session",sessionId:i}}var a=(o.sessionId,o.sku,o.plan,o.items),c=o.successUrl,s=o.cancelUrl,u=de(o,["sessionId","sku","plan","items","successUrl","cancelUrl"]);if(!a)throw new Pe("stripe.redirectToCheckout: You must provide one of items or sessionId.");if(!c||!s)throw new Pe("stripe.redirectToCheckout: You must provide successUrl and cancelUrl.");return cs({tag:"no-session",items:a,successUrl:c,cancelUrl:s},u)},ds=function(e,t){var n=ps(e,t);if("no-session"===n.tag){var r=n.successUrl,o=n.cancelUrl;if(!wt(r))throw new Pe("stripe.redirectToCheckout: successUrl must start with either http:// or https://.");if(!wt(o))throw new Pe("stripe.redirectToCheckout: cancelUrl must start with either http:// or https://.");return n}return n},fs=function(e,t,n){if(n&&n.paymentMethodTypes){if(-1===t.indexOf("checkout_pm_types"))throw new Pe("Invalid stripe.redirectToCheckout parameter: paymentMethodTypes is not an accepted parameter.");if(e)throw new Pe("Invalid stripe.redirectToCheckout parameter: paymentMethodTypes is not an accepted parameter for "+e+". Please follow our migration guide to update to the final version of Checkout: https://stripe.com/docs/payments/checkout/migration-from-beta")}},hs=function(e,t){return"session"===t.tag||null==e||t.locale||-1===["auto"].concat(fe(as)).indexOf(e)?t:cs({},t,{locale:e})},_s=function(e,t,n){var r=Ne(rs,function(t){return Fr(e,t)});switch(fs(r,e,t),r){case"checkout_beta_2":return ls(t);case"checkout_beta_3":return ps(t,n);case"checkout_beta_4":default:return ds(t,n)}},ms=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unknown";return hs(t,_s(e,n,r))},ys=ms,vs=Object.assign||function(e){for(var t=1;tu){for(var t=0,n=a.length-s;t