!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactStripeElements=t(require("react")):e.ReactStripeElements=t(e.React)}(this,function(e){return 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={};return 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=5)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(6)()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);e.length>t;t++)n[t]=e[t];return n}return Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 u(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.elementContextTypes=t.injectContextTypes=void 0;var p=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(0),l=r(c),f=n(1),d=r(f),y=n(3),h=t.injectContextTypes={getRegisteredElements:d.default.func.isRequired},m=t.elementContextTypes={addElementsLoadListener:d.default.func.isRequired,registerElement:d.default.func.isRequired,unregisterElement:d.default.func.isRequired},v=function(e){function t(n,r){s(this,t);var o=a(this,e.call(this,n,r));return o.handleRegisterElement=function(e,t){o.setState(function(n){return{registeredElements:[].concat(i(n.registeredElements),[{type:e,element:t}])}})},o.handleUnregisterElement=function(e){o.setState(function(t){return{registeredElements:t.registeredElements.filter(function(t){return t.element!==e})}})},o.state={registeredElements:[]},o}return u(t,e),t.prototype.getChildContext=function(){var e=this;return{addElementsLoadListener:function(t){if(e._elements)return void t(e._elements);var n=e.props,r=o(n,["children"]);"sync"===e.context.tag?(e._elements=e.context.stripe.elements(r),t(e._elements)):e.context.addStripeLoadListener(function(n){e._elements?t(e._elements):(e._elements=n.elements(r),t(e._elements))})},registerElement:this.handleRegisterElement,unregisterElement:this.handleUnregisterElement,getRegisteredElements:function(){return e.state.registeredElements}}},t.prototype.render=function(){return l.default.Children.only(this.props.children)},t}(l.default.Component);v.childContextTypes=p({},h,m),v.contextTypes=y.providerContextTypes,v.defaultProps={children:null},t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.providerContextTypes=void 0;var u=n(0),p=r(u),c=n(1),l=r(c),f=t.providerContextTypes={tag:l.default.string.isRequired,stripe:l.default.object,addStripeLoadListener:l.default.func},d=function(e,t){window.Stripe.__cachedInstances=window.Stripe.__cachedInstances||{};var n="key="+e+" options="+JSON.stringify(t),r=window.Stripe.__cachedInstances[n]||window.Stripe(e,t);return window.Stripe.__cachedInstances[n]=r,r},y=function(e){if(e&&e.elements&&e.createSource&&e.createToken)return e;throw Error("Please pass a valid Stripe object to StripeProvider. You can obtain a Stripe object by calling 'Stripe(...)' with your publishable key.")},h=function(e){function t(n){i(this,t);var r=s(this,e.call(this,n));if(r.props.apiKey&&r.props.stripe)throw Error("Please pass either 'apiKey' or 'stripe' to StripeProvider, not both.");if(r.props.apiKey){if(!window.Stripe)throw Error("Please load Stripe.js (https://js.stripe.com/v3/) on this page to use react-stripe-elements. If Stripe.js isn't available yet (it's loading asynchronously, or you're using server-side rendering), see https://github.com/stripe/react-stripe-elements#advanced-integrations");var a=r.props,u=a.apiKey,p=o(a,["apiKey","children","stripe"]);r._meta={tag:"sync",stripe:d(u,p)}}else if(r.props.stripe)r._meta={tag:"sync",stripe:y(r.props.stripe)};else{if(null!==r.props.stripe)throw Error("Please pass either 'apiKey' or 'stripe' to StripeProvider. If you're using 'stripe' but don't have a Stripe instance yet, pass 'null' explicitly.");r._meta={tag:"async",stripe:null}}return r._didWarn=!1,r._didWakeUpListeners=!1,r._listeners=[],r}return a(t,e),t.prototype.getChildContext=function(){var e=this;return"sync"===this._meta.tag?{tag:"sync",stripe:this._meta.stripe}:{tag:"async",addStripeLoadListener:function(t){e._meta.stripe?t(e._meta.stripe):e._listeners.push(t)}}},t.prototype.componentWillReceiveProps=function(e){var t=this.props.apiKey&&e.apiKey&&this.props.apiKey!==e.apiKey,n=this.props.stripe&&e.stripe&&this.props.stripe!==e.stripe;if(!this._didWarn&&(t||n)&&window.console&&window.console.error)return this._didWarn=!0,void console.error("StripeProvider does not support changing the apiKey parameter.");if(!this._didWakeUpListeners&&e.stripe){this._didWakeUpListeners=!0;var r=y(e.stripe);this._meta.stripe=r,this._listeners.forEach(function(e){e(r)})}},t.prototype.render=function(){return p.default.Children.only(this.props.children)},t}(p.default.Component);h.propTypes={apiKey:l.default.string,stripe:l.default.object,children:l.default.node},h.childContextTypes=f,h.defaultProps={apiKey:void 0,stripe:void 0,children:null},t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(function(n){return t.hasOwnProperty(n)&&t[n]===e[n]})}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.PaymentRequestButtonElement=t.PostalCodeElement=t.CardCVCElement=t.CardExpiryElement=t.CardNumberElement=t.CardElement=t.Elements=t.injectStripe=t.StripeProvider=void 0;var o=n(3),i=r(o),s=n(10),a=r(s),u=n(2),p=r(u),c=n(11),l=r(c),f=n(12),d=r(f),y=(0,l.default)("card",{sourceType:"card"}),h=(0,l.default)("cardNumber",{sourceType:"card"}),m=(0,l.default)("cardExpiry"),v=(0,l.default)("cardCvc"),_=(0,l.default)("postalCode");t.StripeProvider=i.default,t.injectStripe=a.default,t.Elements=p.default,t.CardElement=y,t.CardNumberElement=h,t.CardExpiryElement=m,t.CardCVCElement=v,t.PostalCodeElement=_,t.PaymentRequestButtonElement=d.default},function(e,t,n){"use strict";var r=n(7),o=n(8),i=n(9);e.exports=function(){function e(e,t,n,r,s,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e,t,n,r,i,s,a,u){if(o(t),!e){var p;if(void 0===t)p=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,s,a,u],l=0;p=Error(t.replace(/%s/g,function(){return c[l++]})),p.name="Invariant Violation"}throw p.framesToPop=1,p}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 s(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)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u="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},p=n(0),c=function(e){return e&&e.__esModule?e:{default:e}}(p),l=n(2),f=n(3);t.default=function(e){var t,n,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=p.withRef,y=void 0!==d&&d;return n=t=function(t){function n(e,s){if(o(this,n),!s||!s.getRegisteredElements)throw Error("It looks like you are trying to inject Stripe context outside of an Elements context.\nPlease be sure the component that calls createSource or createToken is within an <Elements> component.");var a=i(this,t.call(this,e,s));return a.findElement=function(e){var t=a.context.getRegisteredElements(),n="auto"===e?t:t.filter(function(t){return t.type===e});if(1===n.length)return n[0].element;if(n.length>1)throw Error("You did not specify the type of Source or Token to create.\n        We could not infer which Element you want to use for this operation.");return null},a.requireElement=function(e){var t=a.findElement(e);if(t)return t;throw Error("You did not specify the type of Source or Token to create.\n        We could not infer which Element you want to use for this operation.")},a.wrappedCreateToken=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t&&"object"===(void 0===t?"undefined":u(t))){var o=t.type,i=r(t,["type"]),s="string"==typeof o?o:"auto",p=a.requireElement(s);return e.createToken(p,i)}if("string"==typeof t)return e.createToken(t,n);throw Error("Invalid options passed to createToken. Expected an object, got "+(void 0===t?"undefined":u(t))+".")}},a.wrappedCreateSource=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t&&"object"===(void 0===t?"undefined":u(t))){var n=t.type,o=r(t,["type"]),i="string"==typeof n?n:"auto",s=a.findElement(i);if(s)return e.createSource(s,o);if("auto"!==i)return e.createSource(t);throw Error("You did not specify the type of Source to create.\n          We also could not find any Elements in the current context.")}throw Error("Invalid options passed to createSource. Expected an object, got "+(void 0===t?"undefined":u(t))+".")}},a.state="sync"===a.context.tag?{stripe:a.stripeProps(a.context.stripe)}:{stripe:null},a}return s(n,t),n.prototype.componentDidMount=function(){var e=this;"async"===this.context.tag&&this.context.addStripeLoadListener(function(t){e.setState({stripe:e.stripeProps(t)})})},n.prototype.getWrappedInstance=function(){if(!y)throw Error("To access the wrapped instance, the `{withRef: true}` option must be set when calling `injectStripe()`");return this.wrappedInstance},n.prototype.stripeProps=function(e){return a({},e,{createToken:this.wrappedCreateToken(e),createSource:this.wrappedCreateSource(e)})},n.prototype.render=function(){var t=this;return c.default.createElement(e,a({},this.props,{stripe:this.state.stripe,ref:y?function(e){t.wrappedInstance=e}:null}))},n}(c.default.Component),t.contextTypes=a({},f.providerContextTypes,l.injectContextTypes),t.displayName="InjectStripe("+(e.displayName||e.name||"Component")+")",n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 s(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){var n={};for(var r in e)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var u=n(0),p=r(u),c=n(1),l=r(c),f=n(4),d=r(f),y=n(2),h=function(){},m=function(e){return a(e,["id","className","elementRef","onChange","onFocus","onBlur","onReady"])};t.default=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=t=function(t){function n(e,r){o(this,n);var s=i(this,t.call(this,e,r));s.handleRef=function(e){s._ref=e},s._element=null;var a=m(s.props);return s._options=a,s}return s(n,t),n.prototype.componentDidMount=function(){var t=this;this.context.addElementsLoadListener(function(n){var o=n.create(e,t._options);t._element=o,t._setupEventListeners(o),o.mount(t._ref),r.sourceType&&t.context.registerElement(r.sourceType,o)})},n.prototype.componentWillReceiveProps=function(e){var t=m(e);0===Object.keys(t).length||(0,d.default)(t,this._options)||(this._options=t,this._element&&this._element.update(t))},n.prototype.componentWillUnmount=function(){if(this._element){var e=this._element;e.destroy(),this.context.unregisterElement(e)}},n.prototype._setupEventListeners=function(e){var t=this;e.on("ready",function(){t.props.elementRef&&(window.console&&window.console.warn&&console.warn("'elementRef()' is deprecated and will be removed in a future version of react-stripe-elements. Please use 'onReady()' instead."),t.props.elementRef(t._element)),t.props.onReady(t._element)}),e.on("change",function(e){t.props.onChange(e)}),e.on("blur",function(){var e;return(e=t.props).onBlur.apply(e,arguments)}),e.on("focus",function(){var e;return(e=t.props).onFocus.apply(e,arguments)})},n.prototype.render=function(){return p.default.createElement("div",{id:this.props.id,className:this.props.className,ref:this.handleRef})},n}(p.default.Component),t.propTypes={id:l.default.string,className:l.default.string,elementRef:l.default.func,onChange:l.default.func,onBlur:l.default.func,onFocus:l.default.func,onReady:l.default.func},t.defaultProps={id:void 0,className:void 0,elementRef:void 0,onChange:h,onBlur:h,onFocus:h,onReady:h},t.contextTypes=y.elementContextTypes,n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 s(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){var n={};for(var r in e)0>t.indexOf(r)&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p=n(0),c=r(p),l=n(1),f=r(l),d=n(4),y=r(d),h=n(2),m=function(){},v=function(e){return a(e,["id","className","elementRef","onBlur","onClick","onFocus","onReady","paymentRequest"])},_=function(e){function t(n,r){o(this,t);var s=i(this,e.call(this,n,r));s.handleRef=function(e){s._ref=e};var a=v(n);return s._options=a,s}return s(t,e),t.prototype.componentDidMount=function(){var e=this;this.context.addElementsLoadListener(function(t){e._element=t.create("paymentRequestButton",u({paymentRequest:e.props.paymentRequest},e._options)),e._element.on("ready",function(){e.props.elementRef&&(window.console&&window.console.warn&&console.warn("'elementRef()' is deprecated and will be removed in a future version of react-stripe-elements. Please use 'onReady()' instead."),e.props.elementRef(e._element)),e.props.onReady(e._element)}),e._element.on("focus",function(){var t;return(t=e.props).onFocus.apply(t,arguments)}),e._element.on("click",function(){var t;return(t=e.props).onClick.apply(t,arguments)}),e._element.on("blur",function(){var t;return(t=e.props).onBlur.apply(t,arguments)}),e._element.mount(e._ref)})},t.prototype.componentWillReceiveProps=function(e){this.props.paymentRequest!==e.paymentRequest&&console.warn("Unsupported prop change: paymentRequest is not a customizable property.");var t=v(e);0===Object.keys(t).length||(0,y.default)(t,this._options)||(this._options=t,this._element.update(t))},t.prototype.componentWillUnmount=function(){this._element.destroy()},t.prototype.render=function(){return c.default.createElement("div",{id:this.props.id,className:this.props.className,ref:this.handleRef})},t}(c.default.Component);_.propTypes={id:f.default.string,className:f.default.string,elementRef:f.default.func,onBlur:f.default.func,onClick:f.default.func,onFocus:f.default.func,onReady:f.default.func,paymentRequest:f.default.shape({canMakePayment:f.default.func.isRequired,on:f.default.func.isRequired,show:f.default.func.isRequired}).isRequired},_.defaultProps={id:void 0,className:void 0,elementRef:void 0,onBlur:m,onClick:m,onFocus:m,onReady:m},_.contextTypes=h.elementContextTypes,t.default=_}])});