-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstripe.min.js
14 lines (14 loc) · 35.3 KB
/
stripe.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"QVnC":[function(require,module,exports) {
var define;
var t,r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(F){u=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof g?r:g,i=Object.create(o.prototype),a=new G(n||[]);return i._invoke=function(t,r,e){var n=l;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return T()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=j(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:s,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(F){return{type:"throw",arg:F}}}t.wrap=h;var l="suspendedStart",s="suspendedYield",p="executing",y="completed",v={};function g(){}function d(){}function m(){}var w={};u(w,i,function(){return this});var L=Object.getPrototypeOf,x=L&&L(L(N([])));x&&x!==e&&n.call(x,i)&&(w=x);var b=m.prototype=g.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(r){u(t,r,function(t){return this._invoke(r,t)})})}function _(t,r){var e;this._invoke=function(o,i){function a(){return new r(function(e,a){!function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then(function(t){e("next",t,a,c)},function(t){e("throw",t,a,c)}):r.resolve(l).then(function(t){h.value=t,a(h)},function(t){return e("throw",t,a,c)})}c(u.arg)}(o,i,e,a)})}return e=e?e.then(a,a):a()}}function j(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,j(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:T}}function T(){return{value:r,done:!0}}return d.prototype=m,u(b,"constructor",m),u(m,"constructor",d),d.displayName=u(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},E(_.prototype),u(_.prototype,a,function(){return this}),t.AsyncIterator=_,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new _(h(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},E(b),u(b,c,"Generator"),u(b,i,function(){return this}),u(b,"toString",function(){return"[object Generator]"}),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}
},{}],"FOZT":[function(require,module,exports) {
"use strict";function e(t,r,n){var o=r.shift();r.length>0?(void 0===t[o]&&(t[o]={}),e(t[o],r,n)):t[o]=n}function t(e){return e.replace(/[-_]([a-z])/g,function(e){return e[1].toUpperCase()})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.camelCase=t,exports.deepSet=e;
},{}],"EX2r":[function(require,module,exports) {
var define;
var t;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MethodElement=void 0;var e=require("./utils");function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach(function(e){o(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(){"use strict";a=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(P){l=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new S(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return L()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=x(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=d(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),o}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(P){return{type:"throw",arg:P}}}t.wrap=u;var f={};function h(){}function p(){}function m(){}var y={};l(y,o,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(O([])));g&&g!==e&&n.call(g,o)&&(y=g);var b=m.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function _(t,e){var i;this._invoke=function(o,a){function s(){return new e(function(i,s){!function i(o,a,s,c){var l=d(t[o],t,a);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==r(f)&&n.call(f,"__await")?e.resolve(f.__await).then(function(t){i("next",t,s,c)},function(t){i("throw",t,s,c)}):e.resolve(f).then(function(t){u.value=t,s(u)},function(t){return i("throw",t,s,c)})}c(l.arg)}(o,a,i,s)})}return i=i?i.then(s,s):s()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=d(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=m,l(b,"constructor",m),l(m,"constructor",p),p.displayName=l(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,l(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(_.prototype),l(_.prototype,s,function(){return this}),t.AsyncIterator=_,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new _(u(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(b),l(b,c,"Generator"),l(b,o,function(){return this}),l(b,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=O,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function s(t,e,r,n,i,o,a){try{var s=t[o](a),c=s.value}catch(l){return void r(l)}s.done?e(c):Promise.resolve(c).then(n,i)}function c(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(t){s(o,n,i,a,c,"next",t)}function c(t){s(o,n,i,a,c,"throw",t)}a(void 0)})}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var f=jQuery,h=function(){function t(e,r){l(this,t),this.$element=e,this.settings=r,this.form_id=this.$element.closest("form").attr("id"),this.errorHandler=this.clientsideValidationEnabled()?this.clientsideValidationErrorHandler:this.fallbackErrorHandler,this.waitForLibrariesThenInit(),this.intent=null}return d(t,[{key:"waitForLibrariesThenInit",value:function(){var t=this;"undefined"!=typeof Stripe?(this.stripe=Stripe(this.settings.public_key,{locale:document.documentElement.lang}),this.initElements()):window.setTimeout(function(){t.waitForLibrariesThenInit()},100)}},{key:"getStyles",value:function(){for(var t=f('\n <div class="form-item form-type-stripe-payment-field">\n <input type="text" class="default" />\n </div>\n <div class="form-item form-type-stripe-payment-field">\n <input type="text" class="error invalid" />\n </div>').hide().appendTo(this.$element),r={},n=window.getComputedStyle(t.find("input.default").get(0)),i=0,o=["color","font-family","font-size","font-smoothing","font-style","font-variant","font-weight","line-height","letter-spacing","text-align","text-decoration","text-shadow","text-transform"];i<o.length;i++){var a=o[i],s=(0,e.camelCase)(a);(0,e.deepSet)(r,["base",s],n.getPropertyValue(a))}return n=window.getComputedStyle(t.find("input.error").get(0)),(0,e.deepSet)(r,["invalid","color"],n.getPropertyValue("color")),t.remove(),r}},{key:"getFontSrc",value:function(){return this.settings.font_src.map(function(t){return"string"==typeof t?{cssSrc:t}:t})}},{key:"initElements",value:function(){var t=this;this.stripeElements=this.stripe.elements({fonts:this.getFontSrc()});var e={style:this.getStyles(),classes:{invalid:"invalid",complete:"valid",focus:"focus"}};this.$element.find("[data-stripe-element]").each(function(r,n){var i=n.dataset.stripeElement;if(e.placeholder="cardExpiry"===i?Drupal.t("MM / YY"):"","iban"===i){e.supportedCountries=["SEPA"];var o=t.$element.find('[data-stripe="billing_details.address.country"]');e.placeholderCountry=o.val()||"DE"}var a=t.stripeElements.create(i,e);if(a.mount(n),t.clientsideValidationEnabled()){var s=Drupal.myClientsideValidation.validators[t.form_id],c=f("#clientsidevalidation-"+t.form_id+"-errors");a.on("change",function(e){if(e.error&&t.errorHandler(e.error,f(n)),e.complete){var r=s.errorsFor(n);s.addWrapper(r).remove(),c.length&&!c.find(s.settings.errorElement).length&&c.hide()}})}})}},{key:"setStripeId",value:function(t){this.$element.find('[name$="[stripe_id]"]').val(t)}},{key:"paymentMethodData",value:function(){var t={};return this.$element.find("[data-stripe]").each(function(r,n){var i=n.dataset.stripe.split("."),o=f(n).val();o&&(0,e.deepSet)(t,i,o)}),t.card=this.stripeElements.getElement("cardNumber"),t.sepa_debit=this.stripeElements.getElement("iban"),t}},{key:"fetchIntent",value:function(){var t=this.$element.closest("form").get(0),e=new FormData(t);return e.append("form_build_id",t.form_build_id.value),this.paymentMethod&&e.append("stripe_pm",this.paymentMethod.id),f.ajax({type:"POST",url:this.settings.intent_callback_url,data:e,processData:!1,contentType:!1})}},{key:"intentData",value:function(){var t=c(a().mark(function t(){var r,n,i;return a().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.intent){t.next=7;break}return t.next=3,this.fetchIntent();case 3:if(!(r=t.sent).error){t.next=6;break}return t.abrupt("return",r);case 6:this.intent=r;case 7:return n=(0,e.camelCase)(this.intent.type),i=this.intent.methods.includes("sepa_debit")?"setupIntent"===n?"confirmSepaDebitSetup":"confirmSepaDebitPayment":"setupIntent"===n?"confirmCardSetup":"confirmCardPayment",this.intent.form_build_id&&this.$element.closest("form").find("[name=form_build_id]").val(this.intent.form_build_id.new),t.abrupt("return",{name:n,handler:this.stripe[i],secret:this.intent.client_secret,needsConfirmation:this.intent.needs_confirmation});case 11:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"validate",value:function(){var t=c(a().mark(function t(e,r){var n,o,s,c;return a().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.resetValidation(),this.intent||this.paymentMethod||!this.settings.create_payment_method){t.next=10;break}return t.next=4,this.stripe.createPaymentMethod(i({type:"card"},this.paymentMethodData()));case 4:if(!(n=t.sent).error){t.next=9;break}return this.errorHandler(n.error),e.error(),t.abrupt("return");case 9:this.paymentMethod=n.paymentMethod;case 10:return t.next=12,this.intentData();case 12:if(!(o=t.sent).error){t.next=17;break}return this.errorHandler(o.error),e.error(),t.abrupt("return");case 17:if(o.needsConfirmation){t.next=22;break}return this.setStripeId("seti_0000"),r.showSuccess(Drupal.t("Payment successful!")),e.ready(),t.abrupt("return");case 22:return s=this.paymentMethod?{}:{payment_method:this.paymentMethodData()},t.next=25,o.handler(o.secret,s);case 25:(c=t.sent).error?(this.errorHandler(c.error),e.error()):(this.setStripeId(c[o.name].id),r.showSuccess(Drupal.t("Payment successful!")),e.ready());case 27:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"clientsideValidationErrorHandler",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=Drupal.myClientsideValidation.validators[this.form_id];if(null===e)switch(t.code){case"incorrect_number":case"invalid_number":case"incomplete_number":e=this.$element.find('[data-stripe-element="cardNumber"]');break;case"incorrect_cvc":case"invalid_cvc":case"incomplete_cvc":e=this.$element.find('[data-stripe-element="cardCvc"]');break;case"invalid_expiry_month":case"invalid_expiry_year":case"invalid_expiry_year_past":case"incomplete_expiry":case"expired_card":e=this.$element.find('[data-stripe-element="cardExpiry"]');break;case"invalid_bank_account_iban":case"invalid_iban_country_code":case"invalid_iban_start":case"invalid_iban":case"incomplete_iban":e=this.$element.find('[data-stripe-element="iban"]')}if(e&&e.attr("name")){var n={};n[e.attr("name")]=t.message,r.currentElements.push(e),r.showErrors(n)}else{var i=Drupal.settings.clientsideValidation.forms[this.form_id].general,o=f("<".concat(i.errorElement,' class="').concat(i.errorClass,'">')).text(t.message),a=f("#clientsidevalidation-"+this.form_id+"-errors");if(a.length){var s=a.find("ul");o.wrap("<".concat(i.wrapper,">")).parent().addClass("stripe-error").appendTo(s),s.show(),a.show()}else o.addClass("stripe-error").insertBefore(this.$element.closest(".form-item"))}}},{key:"fallbackErrorHandler",value:function(t){f('<div class="messages error">').text(t.message).addClass("stripe-error").insertBefore(this.$element.closest("form"))}},{key:"resetValidation",value:function(){if(f(".mo-dialog-wrapper").addClass("visible"),f(".stripe-error").remove(),this.clientsideValidationEnabled()){var t=Drupal.myClientsideValidation.validators[this.form_id];t.prepareForm(),t.hideErrors()}}},{key:"clientsideValidationEnabled",value:function(){return void 0!==Drupal.clientsideValidation&&void 0!==Drupal.myClientsideValidation.validators[this.form_id]&&void 0!==Drupal.settings.clientsideValidation.forms[this.form_id]}}]),t}();exports.MethodElement=h;
},{"./utils":"FOZT"}],"z2AR":[function(require,module,exports) {
var define;
var t;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MethodButton=void 0;var e=require("./method-element"),r=require("./utils");function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){"use strict";o=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(P){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,i=Object.create(o.prototype),a=new L(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=_(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(P){return{type:"throw",arg:P}}}t.wrap=f;var h={};function p(){}function y(){}function d(){}var m={};s(m,a,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(O([])));g&&g!==e&&r.call(g,a)&&(m=g);var b=d.prototype=p.prototype=Object.create(m);function w(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function x(t,e){var o;this._invoke=function(i,a){function c(){return new e(function(o,c){!function o(i,a,c,u){var s=l(t[i],t,a);if("throw"!==s.type){var f=s.arg,h=f.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then(function(t){o("next",t,c,u)},function(t){o("throw",t,c,u)}):e.resolve(h).then(function(t){f.value=t,c(f)},function(t){return o("throw",t,c,u)})}u(s.arg)}(i,a,o,c)})}return o=o?o.then(c,c):c()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return y.prototype=d,s(b,"constructor",d),s(d,"constructor",y),y.displayName=s(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,c,function(){return this}),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(b),s(b,u,"Generator"),s(b,a,function(){return this}),s(b,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=O,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(s){return void r(s)}c.done?e(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)})}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t){var e=d();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return p(this,r)}}function p(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var v=jQuery,g=function(t){f(i,e.MethodElement);var n=h(i);function i(){return c(this,i),n.apply(this,arguments)}return s(i,[{key:"hidePaymethodSelectRadio",value:function(){var t=this.$element.data("pmid"),e=this.$element.closest("form").find('[name*="[paymethod_select]"][value='.concat(t,"]"));if(e.length){var r=e.siblings('label[for="'.concat(e.attr("id"),'"]'));this.$paymethodRadio=e.add(r).hide(),e.parent().closest(".paymethod-select-radios").append(v(".stripe-payment-request-button",this.$element))}}},{key:"selectRadio",value:function(){this.$paymethodRadio&&this.$paymethodRadio.filter("input").prop("checked",!0).trigger("change")}},{key:"submitForm",value:function(){this.$element.closest("form").find('[type="submit"]:not([formnovalidate])').first().click()}},{key:"getStyles",value:function(){var t="64px";this.$paymethodRadio&&(t=this.$paymethodRadio.filter("label").outerHeight()+"px");return{paymentRequestButton:{type:this.settings.button.type,theme:this.settings.button.style,height:t}}}},{key:"initElements",value:function(){var t=this;this.hidePaymethodSelectRadio(),this.stripeElements=this.stripe.elements();var e=this.stripe.paymentRequest(this.settings.transaction),r={paymentRequest:e,style:this.getStyles()},n=this.stripeElements.create("paymentRequestButton",r);e.canMakePayment().then(function(r){r?(n.mount(".stripe-payment-request-button"),e.on("paymentmethod",t.paymentHandler.bind(t))):t.$element.append("<p>".concat(Drupal.t("This browser does not support Payment Requests or no payment method is available."),"</p>"))})}},{key:"paymentHandler",value:function(){var t=a(o().mark(function t(e){var r,n,i,a,c;return o().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.resetValidation(),this.selectRadio(),t.next=4,this.intentData();case 4:return r=t.sent,t.next=7,r.handler(r.secret,{payment_method:e.paymentMethod.id},{handleActions:!1});case 7:if(!(n=t.sent).error){t.next=13;break}e.complete("fail"),this.errorHandler(n.error),t.next=25;break;case 13:if(i=n[r.name],this.setStripeId(i.id),e.complete("success"),"requires_action"!==i.status){t.next=24;break}return t.next=19,r.handler(r.secret);case 19:a=t.sent,(c=a.error)?this.errorHandler(c):this.submitForm(),t.next=25;break;case 24:this.submitForm();case 25:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"intentData",value:function(){var t=a(o().mark(function t(){var e,n;return o().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.intent){t.next=4;break}return t.next=3,this.fetchIntent();case 3:this.intent=t.sent;case 4:return e=(0,r.camelCase)(this.intent.type),n="setupIntent"===e?"confirmCardSetup":"confirmCardPayment",this.intent.form_build_id&&this.$element.closest("form").find("[name=form_build_id]").val(this.intent.form_build_id.new),t.abrupt("return",{name:e,handler:this.stripe[n],secret:this.intent.client_secret});case 8:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"validate",value:function(){var t=a(o().mark(function t(e){return o().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.ready();case 1:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()}]),i}();exports.MethodButton=g;
},{"./method-element":"EX2r","./utils":"FOZT"}],"epB2":[function(require,module,exports) {
"use strict";var e=a(require("regenerator-runtime")),t=require("./method-element"),r=require("./method-button");function a(e){return e&&e.__esModule?e:{default:e}}var n=jQuery;Drupal.behaviors.stripe_payment={},Drupal.behaviors.stripe_payment.attach=function(e,a){Drupal.payment_handler||(Drupal.payment_handler={}),n('input[name$="[stripe_id]"]',e).each(function(){if(document.body.contains(this)){var e=n(this).closest(".payment-method-form"),i=e.attr("data-pmid"),u=a.stripe_payment["pmid_"+i],o=new(u.button?r.MethodButton:t.MethodElement)(e,u);Drupal.payment_handler[i]=function(e,t,r,a){o.validate(r,a)}}})};
},{"regenerator-runtime":"QVnC","./method-element":"EX2r","./method-button":"z2AR"}]},{},["epB2"], null)