UNPKG

@atlas-kitchen/adyen-web

Version:
1 lines 670 kB
"use strict";var e,t,n,r,o,i,a,s,l,c,u,d={},p=[],h=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function m(e,t){for(var n in t)e[n]=t[n];return e}function f(e){var t=e.parentNode;t&&t.removeChild(e)}function b(t,n,r){var o,i,a,s={};for(a in n)"key"==a?o=n[a]:"ref"==a?i=n[a]:s[a]=n[a];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(a in t.defaultProps)void 0===s[a]&&(s[a]=t.defaultProps[a]);return g(t,s,o,i,null)}function g(e,r,o,i,a){var s={type:e,props:r,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==a?++n:a,__i:-1,__u:0};return null==a&&null!=t.vnode&&t.vnode(s),s}function O(e){return e.children}function v(e,t){this.props=e,this.context=t}function P(e,t){if(null==t)return e.__?P(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?P(e):null}function w(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return w(e)}}function _(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!C.__r++||o!==t.debounceRendering)&&((o=t.debounceRendering)||i)(C)}function C(){var e,n,o,i,s,l,c,u;for(r.sort(a);e=r.shift();)e.__d&&(n=r.length,i=void 0,l=(s=(o=e).__v).__e,c=[],u=[],o.__P&&((i=m({},s)).__v=s.__v+1,t.vnode&&t.vnode(i),R(o.__P,i,s,o.__n,o.__P.namespaceURI,32&s.__u?[l]:null,c,null==l?P(s):l,!!(32&s.__u),u),i.__v=s.__v,i.__.__k[i.__i]=i,I(c,i,u),i.__e!=l&&w(i)),r.length>n&&r.sort(a));C.__r=0}function k(e,t,n,r,o,i,a,s,l,c,u){var h,y,m,f,b,g=r&&r.__k||p,O=t.length;for(n.__d=l,S(n,t,g),l=n.__d,h=0;h<O;h++)null!=(m=n.__k[h])&&"boolean"!=typeof m&&"function"!=typeof m&&(y=-1===m.__i?d:g[m.__i]||d,m.__i=h,R(e,m,y,o,i,a,s,l,c,u),f=m.__e,m.ref&&y.ref!=m.ref&&(y.ref&&T(y.ref,null,m),u.push(m.ref,m.__c||f,m)),null==b&&null!=f&&(b=f),65536&m.__u||y.__k===m.__k?(l&&"string"==typeof m.type&&!e.contains(l)&&(l=P(y)),l=j(m,l,e)):"function"==typeof m.type&&void 0!==m.__d?l=m.__d:f&&(l=f.nextSibling),m.__d=void 0,m.__u&=-196609);n.__d=l,n.__e=b}function S(e,t,n){var r,o,i,a,s,l=t.length,c=n.length,u=c,d=0;for(e.__k=[],r=0;r<l;r++)a=r+d,null!=(o=e.__k[r]=null==(o=t[r])||"boolean"==typeof o||"function"==typeof o?null:"string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?g(null,o,null,null,null):y(o)?g(O,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?g(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)?(o.__=e,o.__b=e.__b+1,s=D(o,n,a,u),o.__i=s,i=null,-1!==s&&(u--,(i=n[s])&&(i.__u|=131072)),null==i||null===i.__v?(-1==s&&d--,"function"!=typeof o.type&&(o.__u|=65536)):s!==a&&(s==a-1?d=s-a:s==a+1?d++:s>a?u>l-a?d+=s-a:d--:s<a&&d++,s!==r+d&&(o.__u|=65536))):(i=n[a])&&null==i.key&&i.__e&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=P(i)),F(i,i,!1),n[a]=null,u--);if(u)for(r=0;r<c;r++)null!=(i=n[r])&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=P(i)),F(i,i))}function j(e,t,n){var r,o;if("function"==typeof e.type){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=j(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function N(e,t){return t=t||[],null==e||"boolean"==typeof e||(y(e)?e.some((function(e){N(e,t)})):t.push(e)),t}function D(e,t,n,r){var o=e.key,i=e.type,a=n-1,s=n+1,l=t[n];if(null===l||l&&o==l.key&&i===l.type&&!(131072&l.__u))return n;if(r>(null==l||131072&l.__u?0:1))for(;a>=0||s<t.length;){if(a>=0){if((l=t[a])&&!(131072&l.__u)&&o==l.key&&i===l.type)return a;a--}if(s<t.length){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&i===l.type)return s;s++}}return-1}function E(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||h.test(t)?n:n+"px"}function x(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||E(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||E(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=s,e.addEventListener(t,i?c:l,i)):e.removeEventListener(t,i?c:l,i);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function A(e){return function(n){if(this.l){var r=this.l[n.type+e];if(null==n.t)n.t=s++;else if(n.t<r.u)return;return r(t.event?t.event(n):n)}}}function R(e,n,r,o,i,a,s,l,c,u){var d,p,h,f,b,g,P,w,_,C,S,j,N,D,E,x,A=n.type;if(void 0!==n.constructor)return null;128&r.__u&&(c=!!(32&r.__u),a=[l=n.__e=r.__e]),(d=t.__b)&&d(n);e:if("function"==typeof A)try{if(w=n.props,_="prototype"in A&&A.prototype.render,C=(d=A.contextType)&&o[d.__c],S=d?C?C.props.value:d.__:o,r.__c?P=(p=n.__c=r.__c).__=p.__E:(_?n.__c=p=new A(w,S):(n.__c=p=new v(w,S),p.constructor=A,p.render=B),C&&C.sub(p),p.props=w,p.state||(p.state={}),p.context=S,p.__n=o,h=p.__d=!0,p.__h=[],p._sb=[]),_&&null==p.__s&&(p.__s=p.state),_&&null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=m({},p.__s)),m(p.__s,A.getDerivedStateFromProps(w,p.__s))),f=p.props,b=p.state,p.__v=n,h)_&&null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),_&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(_&&null==A.getDerivedStateFromProps&&w!==f&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,S),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,S)||n.__v===r.__v)){for(n.__v!==r.__v&&(p.props=w,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.forEach((function(e){e&&(e.__=n)})),j=0;j<p._sb.length;j++)p.__h.push(p._sb[j]);p._sb=[],p.__h.length&&s.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,S),_&&null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(f,b,g)}))}if(p.context=S,p.props=w,p.__P=e,p.__e=!1,N=t.__r,D=0,_){for(p.state=p.__s,p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context),E=0;E<p._sb.length;E++)p.__h.push(p._sb[E]);p._sb=[]}else do{p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++D<25);p.state=p.__s,null!=p.getChildContext&&(o=m(m({},o),p.getChildContext())),_&&!h&&null!=p.getSnapshotBeforeUpdate&&(g=p.getSnapshotBeforeUpdate(f,b)),k(e,y(x=null!=d&&d.type===O&&null==d.key?d.props.children:d)?x:[x],n,r,o,i,a,s,l,c,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),P&&(p.__E=p.__=null)}catch(e){n.__v=null,c||null!=a?(n.__e=l,n.__u|=c?160:32,a[a.indexOf(l)]=null):(n.__e=r.__e,n.__k=r.__k),t.__e(e,n,r)}else null==a&&n.__v===r.__v?(n.__k=r.__k,n.__e=r.__e):n.__e=M(r.__e,n,r,o,i,a,s,c,u);(d=t.diffed)&&d(n)}function I(e,n,r){n.__d=void 0;for(var o=0;o<r.length;o++)T(r[o],r[++o],r[++o]);t.__c&&t.__c(n,e),e.some((function(n){try{e=n.__h,n.__h=[],e.some((function(e){e.call(n)}))}catch(e){t.__e(e,n.__v)}}))}function M(t,n,r,o,i,a,s,l,c){var u,p,h,m,b,g,O,v=r.props,w=n.props,_=n.type;if("svg"===_?i="http://www.w3.org/2000/svg":"math"===_?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=a)for(u=0;u<a.length;u++)if((b=a[u])&&"setAttribute"in b==!!_&&(_?b.localName===_:3===b.nodeType)){t=b,a[u]=null;break}if(null==t){if(null===_)return document.createTextNode(w);t=document.createElementNS(i,_,w.is&&w),a=null,l=!1}if(null===_)v===w||l&&t.data===w||(t.data=w);else{if(a=a&&e.call(t.childNodes),v=r.props||d,!l&&null!=a)for(v={},u=0;u<t.attributes.length;u++)v[(b=t.attributes[u]).name]=b.value;for(u in v)if(b=v[u],"children"==u);else if("dangerouslySetInnerHTML"==u)h=b;else if("key"!==u&&!(u in w)){if("value"==u&&"defaultValue"in w||"checked"==u&&"defaultChecked"in w)continue;x(t,u,null,b,i)}for(u in w)b=w[u],"children"==u?m=b:"dangerouslySetInnerHTML"==u?p=b:"value"==u?g=b:"checked"==u?O=b:"key"===u||l&&"function"!=typeof b||v[u]===b||x(t,u,b,v[u],i);if(p)l||h&&(p.__html===h.__html||p.__html===t.innerHTML)||(t.innerHTML=p.__html),n.__k=[];else if(h&&(t.innerHTML=""),k(t,y(m)?m:[m],n,r,o,"foreignObject"===_?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:r.__k&&P(r,0),l,c),null!=a)for(u=a.length;u--;)null!=a[u]&&f(a[u]);l||(u="value",void 0!==g&&(g!==t[u]||"progress"===_&&!g||"option"===_&&g!==v[u])&&x(t,u,g,v[u],i),u="checked",void 0!==O&&O!==t[u]&&x(t,u,O,v[u],i))}return t}function T(e,n,r){try{"function"==typeof e?e(n):e.current=n}catch(e){t.__e(e,r)}}function F(e,n,r){var o,i;if(t.unmount&&t.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||T(o,null,n)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){t.__e(e,n)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&F(o[i],n,r||"function"!=typeof e.type);r||null==e.__e||f(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function B(e,t,n){return this.constructor(e,n)}function L(n,r,o){var i,a,s;t.__&&t.__(n,r),i=!1?null:r.__k,a=[],s=[],R(r,n=r.__k=b(O,null,[n]),i||d,d,r.namespaceURI,i?null:r.firstChild?e.call(r.childNodes):null,a,i?i.__e:r.firstChild,false,s),I(a,n,s)}function V(e,t){var n={__c:t="__cC"+u++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,_(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}e=p.slice,t={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(t){e=t}throw e}},n=0,v.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=m({},this.state),"function"==typeof e&&(e=e(m({},n),this.props)),e&&m(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),_(this))},v.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_(this))},v.prototype.render=O,r=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0,s=0,l=A(!1),c=A(!0),u=0;var $,U,K,q,H=0,z=[],G=t,W=G.__b,Y=G.__r,Z=G.diffed,J=G.__c,Q=G.unmount,X=G.__;function ee(e,t){G.__h&&G.__h(U,e,H||t),H=0;var n=U.__H||(U.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function te(e){return H=1,ne(me,e)}function ne(e,t,n){var r=ee($++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):me(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=U,!U.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter((function(e){return!!e.__c}));if(o.every((function(e){return!e.__N})))return!i||i.call(this,e,t,n);var a=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}})),!(!a&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};U.u=!0;var i=U.shouldComponentUpdate,a=U.componentWillUpdate;U.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}a&&a.call(this,e,t,n)},U.shouldComponentUpdate=o}return r.__N||r.__}function re(e,t){var n=ee($++,3);!G.__s&&ye(n.__H,t)&&(n.__=e,n.i=t,U.__H.__h.push(n))}function oe(e,t){var n=ee($++,4);!G.__s&&ye(n.__H,t)&&(n.__=e,n.i=t,U.__h.push(n))}function ie(e){return H=5,ae((function(){return{current:e}}),[])}function ae(e,t){var n=ee($++,7);return ye(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function se(e,t){return H=8,ae((function(){return e}),t)}function le(e){var t=U.context[e.__c],n=ee($++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(U)),t.props.value):e.__}function ce(){for(var e;e=z.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(pe),e.__H.__h.forEach(he),e.__H.__h=[]}catch(t){e.__H.__h=[],G.__e(t,e.__v)}}G.__b=function(e){U=null,W&&W(e)},G.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),X&&X(e,t)},G.__r=function(e){Y&&Y(e),$=0;var t=(U=e.__c).__H;t&&(K===U?(t.__h=[],U.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.i=e.__N=void 0}))):(t.__h.forEach(pe),t.__h.forEach(he),t.__h=[],$=0)),K=U},G.diffed=function(e){Z&&Z(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==z.push(t)&&q===G.requestAnimationFrame||((q=G.requestAnimationFrame)||de)(ce)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.i=void 0}))),K=U=null},G.__c=function(e,t){t.some((function(e){try{e.__h.forEach(pe),e.__h=e.__h.filter((function(e){return!e.__||he(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],G.__e(n,e.__v)}})),J&&J(e,t)},G.unmount=function(e){Q&&Q(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{pe(e)}catch(e){t=e}})),n.__H=void 0,t&&G.__e(t,n.__v))};var ue="function"==typeof requestAnimationFrame;function de(e){var t,n=function(){clearTimeout(r),ue&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ue&&(t=requestAnimationFrame(n))}function pe(e){var t=U,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),U=t}function he(e){var t=U;e.__c=e.__(),U=t}function ye(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function me(e,t){return"function"==typeof t?t(e):t}const fe="encryptedCardNumber",be="encryptedExpiryDate",ge="encryptedExpiryMonth",Oe="encryptedExpiryYear",ve="encryptedSecurityCode",Pe="encryptedPassword",we="encryptedSecurityCode3digits",_e="encryptedSecurityCode4digits",Ce="giftcard",ke=["amex","mc","visa"],Se=[Ce],je=[fe,be,ge,Oe,ve,Pe],Ne=je,De=["bcmc"],Ee="required",xe="optional",Ae="hidden",Re=Ee,Ie=xe,Me=Ae,Te=Ee,Fe=xe,Be=Ae,Le="data-cse",Ve="data-info",$e="data-uid",Ue=["accel","pulse","star","nyce"],Ke={visa:"VISA",mc:"MasterCard",amex:"American Express",discover:"Discover",cup:"China Union Pay",jcb:"JCB",diners:"Diners Club",maestro:"Maestro",bcmc:"Bancontact card",bijcard:"de Bijenkorf Card"},qe={[fe]:"cardNumber",[be]:"expiryDate",[ve]:"securityCode",[ge]:"expiryMonth",[Oe]:"expiryYear",[Pe]:"password",[we]:"securityCodeThreeDigits",[_e]:"securityCodeFourDigits"},He=(e,t)=>t.split(".").reduce(((e,t)=>e&&e[t]?e[t]:void 0),e),ze="-ariaError",Ge="-ariaContext",We="focusField",Ye="notValidating:blurScenario",Ze="field.error.required",Je="field.error.invalid",Qe="invalid.format.expects",Xe="creditCard.holderName.invalid",et="creditCard.taxNumber.invalid",tt="boleto.socialSecurityNumber.invalid";var nt=function(e){return e.CC_NUM="cc.num",e.CC_DAT="cc.dat",e.CC_MTH="cc.mth",e.CC_YR="cc.yr",e.CC_CVC="cc.cvc",e.KCP_PWD="kcp.pwd",e}({}),rt=function(e){return e.ERROR_MSG_INCOMPLETE_FIELD="err.gen.9100",e.ERROR_MSG_INVALID_FIELD="err.gen.9101",e.ERROR_MSG_LUHN_CHECK_FAILED="cc.num.902",e.ERROR_MSG_EMPTY_PAN="cc.num.900",e.ERROR_MSG_UNSUPPORTED_CARD_ENTERED="cc.num.903",e.ERROR_MSG_INCORRECTLY_FILLED_PAN="cc.num.901",e.ERROR_MSG_CARD_TOO_OLD="cc.dat.912",e.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE="cc.dat.913",e.ERROR_MSG_CARD_EXPIRES_TOO_SOON="cc.dat.914",e.ERROR_MSG_EMPTY_DATE="cc.dat.910",e.ERROR_MSG_INCORRECTLY_FILLED__DATE="cc.dat.911",e.ERROR_MSG_EMPTY_YEAR="cc.yr.917",e.ERROR_MSG_INCORRECTLY_FILLED_YEAR="cc.yr.918",e.ERROR_MSG_EMPTY_MONTH="cc.mth.915",e.ERROR_MSG_EMPTY_CVC="cc.cvc.920",e.ERROR_MSG_INCORRECTLY_FILLED_CVC="cc.cvc.921",e.ERROR_MSG_EMPTY_KCP_PWD="kcp.pwd.940",e.ERROR_MSG_INCORRECTLY_FILLED_KCP_PWD="kcp.pwd.941",e}({});const ot={[fe]:"cc.num.900",[be]:"cc.dat.910",[ge]:"cc.mth.915",[Oe]:"cc.yr.917",[ve]:"cc.cvc.920",[Pe]:"kcp.pwd.940"},it=(e,t)=>(t===be?(e[ge]=!1,e[Oe]=!1):e[t]=!1,e),at=(e,t)=>(n,r)=>{let o=!0!==t.valid[r]?((e,t)=>1!==t||e!==ge&&e!==Oe?e:be)(r,e):null;return o=((e,t,n)=>{const{isFieldOfType:r,fieldIsValid:o}=n.reduce(((n,r)=>(n.isFieldOfType||(n.isFieldOfType=e===r,n.fieldIsValid=!t.errors[r]),n)),{isFieldOfType:!1,fieldIsValid:!1}),i=e===ve?"cvcPolicy":"expiryDatePolicy",a="cvcPolicy"===i?Ie:Fe,s="cvcPolicy"===i?Me:Be;return(t[i]===a||t[i]===s)&&o&&r?null:e})(o,t,[ve,be,ge,Oe]),o&&!n.includes(o)&&n.push(o),n};function st(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class lt{constructor(e){st(this,"callbacks",void 0),st(this,"config",void 0),st(this,"props",void 0),st(this,"state",void 0),st(this,"validateForm",void 0),st(this,"handleBrandFromBinLookup",void 0),st(this,"callbacksHandler",void 0),st(this,"configHandler",void 0),st(this,"createCardSecuredFields",void 0),st(this,"createNonCardSecuredFields",void 0),st(this,"createSecuredFields",void 0),st(this,"destroySecuredFields",void 0),st(this,"handleIOSTouchEvents",void 0),st(this,"destroyTouchendListener",void 0),st(this,"destroyTouchstartListener",void 0),st(this,"handleBinValue",void 0),st(this,"handleEncryption",void 0),st(this,"handleFocus",void 0),st(this,"handleIframeConfigFeedback",void 0),st(this,"handleValidation",void 0),st(this,"handleSFShiftTab",void 0),st(this,"handleShiftTab",void 0),st(this,"isConfigured",void 0),st(this,"postMessageToAllIframes",void 0),st(this,"processAutoComplete",void 0),st(this,"processBrand",void 0),st(this,"sendBrandToCardSF",void 0),st(this,"sendExpiryDatePolicyToSF",void 0),st(this,"setFocusOnFrame",void 0),st(this,"setupSecuredField",void 0),st(this,"touchendListener",void 0),st(this,"touchstartListener",void 0),st(this,"hasGenuineTouchEvents",void 0),st(this,"encryptedAttrName",void 0),st(this,"hasRedundantCVCField",void 0),st(this,"isSingleBrandedCard",void 0),st(this,"securityCode",void 0),this.props=e,this.state={},this.config={},this.callbacks={}}}function ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ut=Object.prototype.toString;function dt(e){return"object"==typeof e&&null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function pt(e){return null!=e}function ht(e){return!1!==e&&pt(e)}function yt(e){return!!e&&"object"==typeof e}function mt(e){return!ht(e)||(!(!("number"==typeof(t=e)||yt(t)&&"[object Number]"===ut.call(t))||0!==e&&!Number.isNaN(e))||(!(!dt(e)&&!function(e){return"string"==typeof e||yt(e)&&"[object String]"===ut.call(e)}(e)||0!==e.length)||!(!yt(e)||0!==Object.keys(e).length)));var t}function ft(e){return!mt(e)}function bt(...e){const t=dt(e[0])?e[0]:e;return{from:e=>t.map((t=>t in e?{[t]:e[t]}:{})).reduce(((e,t)=>function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ct(e,t,n[t])}))}return e}({},e,t)),{})}}function gt(...e){const t=dt(e[0])?e[0]:e;return{from:e=>{const n=Object.keys(e).filter((e=>!t.includes(e)));return bt(...n).from(e)}}}let Ot="undefined"!=typeof window&&window.console&&window.console.error&&window.console.error.bind(window.console);"undefined"!=typeof window&&window.console&&window.console.info&&window.console.info.bind(window.console);let vt="undefined"!=typeof window&&window.console&&window.console.log&&window.console.log.bind(window.console),Pt="undefined"!=typeof window&&window.console&&window.console.warn&&window.console.warn.bind(window.console);function wt(e){var t;this.config.cardGroupTypes=dt(t=e.cardGroupTypes)&&t.length?t:ke;const n=e.loadingContext;if(!n)return void Pt("WARNING Config :: no loadingContext has been specified!");var r,o;this.config.loadingContext="/"===(r=n).charAt(r.length-1)?n:`${n}/`,this.config.isCreditCardType=!1===Se.includes(e.type),this.config.iframeUIConfig=null!==(o=e.iframeUIConfig)&&void 0!==o?o:{},this.config.autoFocus=!(!1===e.autoFocus||"false"===e.autoFocus),this.config.showWarnings=!0===e.showWarnings||"true"===e.showWarnings,this.config.trimTrailingSeparator=!(!1===e.trimTrailingSeparator||"false"===e.trimTrailingSeparator),this.config.keypadFix=!(!1===e.keypadFix||"false"===e.keypadFix),this.config.legacyInputMode=e.legacyInputMode||null,this.config.minimumExpiryDate=e.minimumExpiryDate||null,this.config.sfLogAtStart=!0===window._b$dl;const i=this.config.isCreditCardType?"card":e.type,a=btoa(window.location.origin),s=`${i}${!!e.forceCompat||!("function"==typeof window.TextEncoder)?"Compat":""}`;this.config.iframeSrc=`${this.config.loadingContext}securedfields/${e.clientKey}/5.5.2/securedFields.html?type=${s}&d=${a}`}const _t=()=>{};function Ct(e={}){this.callbacks.onLoad=e.onLoad?e.onLoad:_t,this.callbacks.onConfigSuccess=e.onConfigSuccess?e.onConfigSuccess:_t,this.callbacks.onFieldValid=e.onFieldValid?e.onFieldValid:_t,this.callbacks.onAllValid=e.onAllValid?e.onAllValid:_t,this.callbacks.onBrand=e.onBrand?e.onBrand:_t,this.callbacks.onError=e.onError?e.onError:_t,this.callbacks.onFocus=e.onFocus?e.onFocus:_t,this.callbacks.onBinValue=e.onBinValue?e.onBinValue:_t,this.callbacks.onAutoComplete=e.onAutoComplete?e.onAutoComplete:_t,this.callbacks.onAdditionalSFConfig=e.onAdditionalSFConfig?e.onAdditionalSFConfig:_t,this.callbacks.onAdditionalSFRemoved=e.onAdditionalSFRemoved?e.onAdditionalSFRemoved:_t,this.callbacks.onTouchstartIOS=e.onTouchstartIOS?e.onTouchstartIOS:_t,this.callbacks.onKeyPressed=e.onKeyPressed?e.onKeyPressed:_t}const kt=({fieldType:e,encryptedFieldName:t,uuid:n,isValid:r,txVariant:o,rootNode:i})=>({fieldType:e,encryptedFieldName:t,uid:n,valid:r,type:o,rootNode:i});function St(e={},t){return Object.prototype.hasOwnProperty.call(e,t)}const jt=(e,t,n,r,o)=>{if(!St(e,"error"))return null;const i=t,a={rootNode:r,fieldType:e.fieldType,error:null,type:null},s=""!==e.error;return s||i.hasError?(a.error=s?e.error:"",a.type=n,i.hasError=s,i.errorType=a.error,o(a),a):null};function Nt(e){let t;const n=e.fieldType;if("card"===this.state.type&&St(e,"cvcPolicy")&&pt(e.cvcPolicy)&&St(this.state.securedFields,ve)&&(this.state.securedFields[ve].cvcPolicy=e.cvcPolicy),jt(e,this.state.securedFields[n],this.state.type,this.props.rootNode,this.callbacks.onError),this.state.securedFields[n].isEncrypted){t=(({fieldType:e,txVariant:t,rootNode:n})=>{const r=e===be,o=[],i=["encryptedExpiryMonth","encryptedExpiryYear"];let a,s,l,c;const u=r?2:1;for(a=0;a<u;a+=1){l=r?i[a]:e,s=`${t}-encrypted-${l}`,c=r?l:e;const u=kt({fieldType:e,encryptedFieldName:c,uuid:s,isValid:!1,txVariant:t,rootNode:n});o.push(u)}return o})({fieldType:n,txVariant:this.state.type,rootNode:this.props.rootNode}),n===fe&&(t[0].endDigits="");for(let e=0,n=t.length;e<n;e+=1)this.callbacks.onFieldValid(t[e]);this.state.securedFields[n].isEncrypted=!1}this.validateForm(),St(e,"brand")&&this.processBrand(e)}const Dt=(e,t,n)=>{if(t){const r=JSON.stringify(e);t.postMessage(r,n)}};function Et(e,t){var n;return(null===(n=e.securedFields[t])||void 0===n?void 0:n.iframeContentWindow)||null}function xt(e){const t=e.fieldType;let n,r;this.config.autoFocus&&("year"!==e.type&&t!==Oe||this.setFocusOnFrame(ve),t===ge&&this.setFocusOnFrame(Oe));const o=e[t];this.state.securedFields[t].isEncrypted=!0,jt({error:"",fieldType:t},this.state.securedFields[t],this.state.type,this.props.rootNode,this.callbacks.onError);const i=(({fieldType:e,txVariant:t,rootNode:n,encryptedObjArr:r})=>{let o,i,a,s,l;const c=[];for(o=0;o<r.length;o+=1){a=r[o],s=a.encryptedFieldName,i=`${t}-encrypted-${s}`,l=a.blob;const u=kt({fieldType:e,encryptedFieldName:s,uuid:i,isValid:!0,txVariant:t,rootNode:n});u.blob=l,c.push(u)}return c})({fieldType:t,txVariant:this.state.type,rootNode:this.props.rootNode,encryptedObjArr:o});if(t===ge&&St(this.state.securedFields,Oe)){const t={txVariant:this.state.type,code:e.code,blob:o[0].blob,fieldType:Oe,numKey:this.state.securedFields[Oe].numKey};Dt(t,Et(this.state,Oe),this.config.loadingContext)}for(t===fe&&ht(e.endDigits)&&(i[0].endDigits=e.endDigits),t===fe&&ht(e.issuerBin)&&(i[0].issuerBin=+e.issuerBin),t===be&&ht(e.expiryDate)&&(i[1].expiryDate=e.expiryDate),n=0,r=i.length;n<r;n+=1)this.callbacks.onFieldValid(i[n]);this.validateForm()}const At=(e,t)=>{let n=[];return e&&"function"==typeof e.querySelectorAll&&(n=[].slice.call(e.querySelectorAll(t))),n},Rt=(e,t)=>{if(e)return e.querySelector(t)},It=(e,t)=>{if(e)return e.getAttribute(t)};const Mt={__NO_BRAND:"noBrand",cards:[]};Mt.cards.push({cardType:"mc",startingRules:[51,52,53,54,55,22,23,24,25,26,27],permittedLengths:[16],pattern:/^(5[1-5][0-9]{0,14}|2[2-7][0-9]{0,14})$/,securityCode:"CVC"}),Mt.cards.push({cardType:"visadankort",startingRules:[4571],permittedLengths:[16],pattern:/^(4571)[0-9]{0,12}$/}),Mt.cards.push({cardType:"visa",startingRules:[4],permittedLengths:[13,16,19],pattern:/^4[0-9]{0,18}$/,securityCode:"CVV"}),Mt.cards.push({cardType:"amex",startingRules:[34,37],permittedLengths:[15],pattern:/^3[47][0-9]{0,13}$/,securityCode:"CID"}),Mt.cards.push({cardType:"diners",startingRules:[36],permittedLengths:[14,15,16,17,18,19],pattern:/^(36)[0-9]{0,12}$/}),Mt.cards.push({cardType:"maestrouk",startingRules:[6759],permittedLengths:[16,18,19],pattern:/^(6759)[0-9]{0,15}$/}),Mt.cards.push({cardType:"solo",startingRules:[6767],permittedLengths:[16,18,19],pattern:/^(6767)[0-9]{0,15}$/}),Mt.cards.push({cardType:"laser",startingRules:[6304,6706,677117,677120],permittedLengths:[16,17,18,19],pattern:/^(6304|6706|6709|6771)[0-9]{0,15}$/,cvcPolicy:"optional"}),Mt.cards.push({cardType:"discover",startingRules:[6011,644,645,646,647,648,649,65],permittedLengths:[16,17,18,19],pattern:/^(6011[0-9]{0,12}|(644|645|646|647|648|649)[0-9]{0,13}|65[0-9]{0,14})$/}),Mt.cards.push({cardType:"jcb",startingRules:[3528,3529,353,354,355,356,357,358],permittedLengths:[16,19],pattern:/^(352[8,9]{1}[0-9]{0,15}|35[4-8]{1}[0-9]{0,16})$/,securityCode:"CAV"}),Mt.cards.push({cardType:"bcmc",startingRules:[6703,479658,606005],permittedLengths:[16,17,18,19],pattern:/^((6703)[0-9]{0,15}|(479658|606005)[0-9]{0,13})$/,cvcPolicy:"hidden"}),Mt.cards.push({cardType:"bijcard",startingRules:[5100081],permittedLengths:[16],pattern:/^(5100081)[0-9]{0,9}$/}),Mt.cards.push({cardType:"dankort",startingRules:[5019],permittedLengths:[16],pattern:/^(5019)[0-9]{0,12}$/}),Mt.cards.push({cardType:"hipercard",startingRules:[606282],permittedLengths:[16],pattern:/^(606282)[0-9]{0,10}$/}),Mt.cards.push({cardType:"cup",startingRules:[62,81],permittedLengths:[14,15,16,17,18,19],pattern:/^(62|81)[0-9]{0,17}$/}),Mt.cards.push({cardType:"maestro",startingRules:[50,56,57,58,6],permittedLengths:[16,17,18,19],pattern:/^(5[0|6-8][0-9]{0,17}|6[0-9]{0,18})$/,cvcPolicy:"optional"}),Mt.cards.push({cardType:"elo",startingRules:[506699,50670,50671,50672,50673,50674,50675,50676,506770,506771,506772,506773,506774,506775,506776,506777,506778,401178,438935,451416,457631,457632,504175,627780,636297,636368],permittedLengths:[16],pattern:/^((((506699)|(506770)|(506771)|(506772)|(506773)|(506774)|(506775)|(506776)|(506777)|(506778)|(401178)|(438935)|(451416)|(457631)|(457632)|(504175)|(627780)|(636368)|(636297))[0-9]{0,10})|((50676)|(50675)|(50674)|(50673)|(50672)|(50671)|(50670))[0-9]{0,11})$/}),Mt.cards.push({cardType:"uatp",startingRules:[1],permittedLengths:[15],pattern:/^1[0-9]{0,14}$/,cvcPolicy:"optional"}),Mt.cards.push({cardType:"cartebancaire",startingRules:[4,5,6],permittedLengths:[16],pattern:/^[4-6][0-9]{0,15}$/}),Mt.cards.push({cardType:"visaalphabankbonus",startingRules:[450903],permittedLengths:[16],pattern:/^(450903)[0-9]{0,10}$/}),Mt.cards.push({cardType:"mcalphabankbonus",startingRules:[510099],permittedLengths:[16],pattern:/^(510099)[0-9]{0,10}$/}),Mt.cards.push({cardType:"hiper",startingRules:[637095,637568,637599,637609,637612],permittedLengths:[16],pattern:/^(637095|637568|637599|637609|637612)[0-9]{0,10}$/}),Mt.cards.push({cardType:"oasis",startingRules:[982616],permittedLengths:[16],pattern:/^(982616)[0-9]{0,10}$/,cvcPolicy:"optional"}),Mt.cards.push({cardType:"karenmillen",startingRules:[98261465],permittedLengths:[16],pattern:/^(98261465)[0-9]{0,8}$/,cvcPolicy:"optional"}),Mt.cards.push({cardType:"warehouse",startingRules:[982633],permittedLengths:[16],pattern:/^(982633)[0-9]{0,10}$/,cvcPolicy:"optional"}),Mt.cards.push({cardType:"mir",startingRules:[220],permittedLengths:[16,17,18,19],pattern:/^(220)[0-9]{0,16}$/}),Mt.cards.push({cardType:"codensa",startingRules:[590712],permittedLengths:[16],pattern:/^(590712)[0-9]{0,10}$/}),Mt.cards.push({cardType:"naranja",startingRules:[377798,377799,402917,402918,527571,527572,589562],permittedLengths:[16,17,18,19],pattern:/^(37|40|5[28])([279])\d*$/}),Mt.cards.push({cardType:"cabal",startingRules:[589657,600691,603522,6042,6043,636908],permittedLengths:[16,17,18,19],pattern:/^(58|6[03])([03469])\d*$/}),Mt.cards.push({cardType:"shopping",startingRules:[2799,589407,603488],permittedLengths:[16,17,18,19],pattern:/^(27|58|60)([39])\d*$/}),Mt.cards.push({cardType:"argencard",startingRules:[501],permittedLengths:[16,17,18,19],pattern:/^(50)(1)\d*$/}),Mt.cards.push({cardType:"troy",startingRules:[9792],permittedLengths:[16],pattern:/^(97)(9)\d*$/}),Mt.cards.push({cardType:"forbrugsforeningen",startingRules:[600722],permittedLengths:[16],pattern:/^(60)(0)\d*$/}),Mt.cards.push({cardType:"vpay",startingRules:[401,408,413,434,435,437,439,441,442,443,444,446,447,455,458,460,461,463,466,471,479,482,483,487],permittedLengths:[13,14,15,16,17,18,19],pattern:/^(40[1,8]|413|43[4,5]|44[1,2,3,4,6,7]|45[5,8]|46[0,1,3,6]|47[1,9]|48[2,3,7])[0-9]{0,16}$/}),Mt.cards.push({cardType:"rupay",startingRules:[508528],permittedLengths:[16],pattern:/^(100003|508(2|[5-9])|60(69|[7-8])|652(1[5-9]|[2-5][0-9]|8[5-9])|65300[3-4]|8172([0-1]|[3-5]|7|9)|817(3[3-8]|40[6-9]|410)|35380([0-2]|[5-6]|9))[0-9]{0,12}$/}),Mt.cards.push({cardType:"ticket",expiryDatePolicy:"hidden"});var Tt=e=>Mt.cards.filter((t=>t.cardType===e))[0],Ft=e=>{if(!e)throw new Error("Error: isGenericCardType: type param has not been specified");return"card"===e||"scheme"===e};Mt.__NO_BRAND,Mt.cards;const Bt=(e,t,n,r=!1)=>!(!e||"function"!=typeof e.addEventListener)&&(e.addEventListener(t,n,r),!0),Lt=(e,t,n,r=!1)=>!(!e||"function"!=typeof e.removeEventListener)&&(e.removeEventListener(t,n,r),!0);function Vt(e,t){const n=typeof e;return e&&t&&"object"===n&&n===typeof t?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every((n=>Vt(e[n],t[n]))):e===t}function $t(...e){const t=e,n=t.shift();return function(...e){return n.apply(this,t.concat(e))}}function Ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Kt{constructor(){Ut(this,"sfConfig",void 0),Ut(this,"loadingContext",void 0),Ut(this,"holderEl",void 0),Ut(this,"iframeRef",void 0),Ut(this,"loadToConfigTimeout",void 0),Ut(this,"_isValid",void 0),Ut(this,"_iframeContentWindow",void 0),Ut(this,"_numKey",void 0),Ut(this,"_isEncrypted",void 0),Ut(this,"_hasError",void 0),Ut(this,"_errorType",void 0),Ut(this,"_cvcPolicy",void 0),Ut(this,"_expiryDatePolicy",void 0),Ut(this,"_iframeOnLoadListener",void 0),Ut(this,"_postMessageListener",void 0),Ut(this,"onIframeLoadedCallback",void 0),Ut(this,"onConfigCallback",void 0),Ut(this,"onEncryptionCallback",void 0),Ut(this,"onValidationCallback",void 0),Ut(this,"onFocusCallback",void 0),Ut(this,"onBinValueCallback",void 0),Ut(this,"onTouchstartCallback",void 0),Ut(this,"onShiftTabCallback",void 0),Ut(this,"onAutoCompleteCallback",void 0),Ut(this,"onKeyPressedCallback",void 0),this.sfConfig={}}}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ht=(e,t,n)=>{const r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){qt(e,t,n[t])}))}return e}({},e),o=Gt(n);return r.error=((e,t)=>Object.values(rt).reduce(((n,r)=>(r.includes(t)&&(n[r]=e.get(r)),n)),{}))(t,o),r},zt=(e,t)=>{let n=e;for(const[r,o]of Object.entries(t))if(o===e){n=r;break}return null==n?void 0:n.toLowerCase().replace(/[_.\s]/g,"-")},Gt=e=>{let t;switch(e){case fe:t=nt.CC_NUM;break;case be:t=nt.CC_DAT;break;case ge:t=nt.CC_MTH;break;case Oe:t=nt.CC_YR;break;case ve:t=nt.CC_CVC;break;case Pe:t=nt.KCP_PWD}return t},Wt=({i18n:e,fieldTypeMappingFn:t,SRPanelRef:n},{errors:r,isValidating:o,layout:i,countrySpecificLabels:a})=>{const s=(({errors:e,i18n:t,layout:n,countrySpecificLabels:r,fieldTypeMappingFn:o})=>{const i=Object.entries(e).reduce(((i,[a,s])=>{if(s){const s=e[a],l="errorI18n"in s&&"rootNode"in s,c="object"==typeof s.errorMessage;let u,d;if(u=l?s.error:c?s.errorMessage.translationKey:s.errorMessage,l&&"errorI18n"in s)d=s.errorI18n+"";else{const e=o?o(a,t,r):"";if(c){const n=s.errorMessage.translationKey,r=s.errorMessage.translationObject.values.format;d=`${t.get(n,{values:{label:e,format:r}})}`}else d=t.get(s.errorMessage,{values:{label:e}})+""}i.push({field:a,errorMessage:d,errorCode:u}),n&&i.sort(((e,t)=>n.indexOf(e.field)-n.indexOf(t.field)))}return i}),[]);return i})({errors:r,i18n:e,fieldTypeMappingFn:t,countrySpecificLabels:a,layout:i});if(s.length){if(o){const e=s.map((e=>e.errorMessage));n.setMessages(e);const t=s.map((e=>e.field));return{currentErrorsSortedByLayout:s,action:We,fieldToFocus:t[0]}}return null==n||n.setMessages(null),{currentErrorsSortedByLayout:s,action:Ye}}return null==n||n.setMessages(null),{currentErrorsSortedByLayout:s,action:"none"}},Yt=(e,t)=>{if(!e)return null;return Object.entries(e).reduce(((e,[n,r])=>{if(r){e[`${t}${n}`]=r}return e}),{})};function Zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jt=(e,t,n,r)=>{const o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Zt(e,t,n[t])}))}return e}({},e),i={};switch(n){case"ach":case Ce:break;default:if(r===ve)i[we]=t.get("creditCard.securityCode.contextualText.3digits"),i[_e]=t.get("creditCard.securityCode.contextualText.4digits");else{const e=`creditCard.${qe[r]}.contextualText`,n=t.get(e);n!==e&&(i[r]=n)}}return Object.keys(i).length&&(o.contextualTexts=i),o};function Qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xt(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function en(e,t,n,r){const o=["ach","giftcard"].includes(e)?e:"creditCard",i=n.get(`${o}.${t}.aria.iframeTitle`),a=n.get(`${o}.${qe[t]}.label`),s=n.locale;let l=Ht({iframeTitle:i,label:a},n,t);return r&&(l=Jt(l,n,e,t)),Xt(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Qt(e,t,n[t])}))}return e}({},s&&{lang:s}),{[t]:l})}function tn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){tn(e,t,n[t])}))}return e}function rn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}class on extends Kt{init(e,t,n,r){const o=en(this.sfConfig.txVariant,this.sfConfig.fieldType,e,r);this.sfConfig.iframeUIConfig.ariaConfig=o,this.sfConfig.iframeUIConfig.placeholders=function(e,t,n){var r,o,i,a;return e===Ce?{[t]:null!==(r=n[qe[t]])&&void 0!==r?r:""}:t===ve?{[we]:null!==(o=n.securityCodeThreeDigits)&&void 0!==o?o:"",[_e]:null!==(i=n.securityCodeFourDigits)&&void 0!==i?i:""}:{[t]:null!==(a=n[qe[t]])&&void 0!==a?a:""}}(this.sfConfig.txVariant,this.sfConfig.fieldType,n);const i=function({src:e,title:t="iframe element",policy:n="origin"}){const r=document.createElement("iframe");r.setAttribute("src",e),r.classList.add("js-iframe"),""===t||0===t.trim().length||"none"===t?r.setAttribute("role","presentation"):r.setAttribute("title",t),r.setAttribute("allowtransparency","true"),r.setAttribute("referrerpolicy",n);const o=document.createTextNode("<p>Your browser does not support iframes.</p>");return r.appendChild(o),r}({src:t,title:o[this.sfConfig.fieldType].iframeTitle,policy:"origin"});this.holderEl.appendChild(i);const a=Rt(this.holderEl,".js-iframe");return a&&(this.iframeContentWindow=a.contentWindow,this.iframeOnLoadListener=this.iframeOnLoadListenerFn,Bt(a,"load",this.iframeOnLoadListener,!1)),this.iframeRef=a,this}iframeOnLoadListenerFn(){this.postMessageListener=this.postMessageListenerFn,Bt(window,"message",this.postMessageListener,!1);const e=rn(nn({},this.sfConfig),{numKey:this.numKey});window._b$dl&&console.log("### SecuredField:::: onIframeLoaded:: created configObj=",e),Dt(e,this.iframeContentWindow,this.loadingContext),this.onIframeLoadedCallback()}postMessageListenerFn(e){if(!((e,t,n)=>{const r=e.origin,o=t.indexOf("/checkoutshopper/");let i=o>-1?t.substring(0,o):t;const a=i.length-1;return"/"===i.charAt(a)&&(i=i.substring(0,a)),r===i||(n&&Pt("WARNING postMessageValidation: postMessage listener for iframe::origin mismatch!\n Received message with origin:",r,"but the only allowed origin for messages to CSF is",i,"### event.data=",e.data),!1)})(e,this.loadingContext,this.sfConfig.showWarnings))return;let t;try{t=JSON.parse(e.data)}catch(t){return(e=>e.data&&e.data.type&&"string"==typeof e.data.type&&e.data.type.indexOf("webpack")>-1)(e)?void(this.sfConfig.showWarnings&&vt("### SecuredField::postMessageListenerFn:: PARSE FAIL - WEBPACK")):(e=>e.data&&"string"==typeof e.data&&e.data.indexOf("cvox")>-1)(e)?void(this.sfConfig.showWarnings&&vt("### SecuredField::postMessageListenerFn:: PARSE FAIL - CHROMEVOX")):void(this.sfConfig.showWarnings&&vt("### SecuredField::postMessageListenerFn:: PARSE FAIL - UNKNOWN REASON: event.data=",e.data))}if(St(t,"action")&&St(t,"numKey"))if(this.numKey===t.numKey)switch(t.action){case"encryption":this.isValid=!0,this.onEncryptionCallback(t);break;case"config":window._b$dl&&console.log("### SecuredField::postMessageListenerFn:: configured - calling onConfigCallback",t.fieldType),this.onConfigCallback(t);break;case"focus":this.onFocusCallback(t);break;case"binValue":this.onBinValueCallback(t);break;case"touch":this.onTouchstartCallback(t);break;case"shifttab":this.onShiftTabCallback(t);break;case"autoComplete":this.onAutoCompleteCallback(t);break;case"enterKeyPressed":this.onKeyPressedCallback(t);break;default:this.isValid=!1,this.onValidationCallback(t)}else this.sfConfig.showWarnings&&Pt("WARNING SecuredField :: postMessage listener for iframe :: data mismatch! (Probably a message from an unrelated securedField)");else this.sfConfig.showWarnings&&Pt("WARNING SecuredField :: postMessage listener for iframe :: data mismatch!")}destroy(){Lt(window,"message",this.postMessageListener,!1),Lt(this.iframeRef,"load",this.iframeOnLoadListener,!1),this.iframeContentWindow=null,(e=>{for(;e.firstChild;)e.removeChild(e.firstChild)})(this.holderEl)}isOptionalOrHidden(){if(this.sfConfig.fieldType===be||this.sfConfig.fieldType===ge||this.sfConfig.fieldType===Oe)switch(this.expiryDatePolicy){case Be:return!0;case Fe:return!this.hasError;default:return!1}if(this.sfConfig.fieldType===ve)switch(this.cvcPolicy){case Me:return!0;case Ie:return!this.hasError;default:return!1}return!1}onIframeLoaded(e){return this.onIframeLoadedCallback=e,this}onEncryption(e){return this.onEncryptionCallback=e,this}onValidation(e){return this.onValidationCallback=e,this}onConfig(e){return this.onConfigCallback=e,this}onFocus(e){return this.onFocusCallback=e,this}onBinValue(e){return this.onBinValueCallback=e,this}onTouchstart(e){return this.onTouchstartCallback=e,this}onShiftTab(e){return this.onShiftTabCallback=e,this}onAutoComplete(e){return this.onAutoCompleteCallback=e,this}onKeyPressed(e){return this.onKeyPressedCallback=e,this}get errorType(){return this._errorType}set errorType(e){this._errorType=e}get hasError(){return this._hasError}set hasError(e){this._hasError=e}get isValid(){if(this.sfConfig.fieldType===ve)switch(this.cvcPolicy){case Me:return!0;case Ie:return!this.hasError;default:return this._isValid}if(this.sfConfig.fieldType===be||this.sfConfig.fieldType===ge||this.sfConfig.fieldType===Oe)switch(this.expiryDatePolicy){case Be:return!0;case Fe:return!this.hasError;default:return this._isValid}return this._isValid}set isValid(e){this._isValid=e}get cvcPolicy(){return this._cvcPolicy}set cvcPolicy(e){this.sfConfig.fieldType===ve&&e!==this.cvcPolicy&&(this._cvcPolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get expiryDatePolicy(){return this._expiryDatePolicy}set expiryDatePolicy(e){this.sfConfig.fieldType!==be&&this.sfConfig.fieldType!==ge&&this.sfConfig.fieldType!==Oe||e!==this.expiryDatePolicy&&(this._expiryDatePolicy=e,this.hasError&&"isValidated"===this.errorType&&(this.hasError=!1))}get iframeContentWindow(){return this._iframeContentWindow}set iframeContentWindow(e){this._iframeContentWindow=e}get isEncrypted(){return this._isEncrypted}set isEncrypted(e){this._isEncrypted=e}get numKey(){return this._numKey}set numKey(e){this._numKey=e}get iframeOnLoadListener(){return this._iframeOnLoadListener}set iframeOnLoadListener(e){this._iframeOnLoadListener=e.bind(this)}get postMessageListener(){return this._postMessageListener}set postMessageListener(e){this._postMessageListener=e.bind(this)}constructor(e,t){super();const n=gt(["loadingContext","holderEl","iframeSrc","showContextualElement","placeholders"]).from(e);this.sfConfig=rn(nn({},n),{iframeUIConfig:nn({},n.iframeUIConfig)});const{iframeSrc:r,placeholders:o,showContextualElement:i}=e;return this.loadingContext=e.loadingContext,this.holderEl=e.holderEl,this.isValid=!1,this.iframeContentWindow=null,this.numKey=function(){if(!window.crypto)return 4294967296*Math.random()|0;const e=new Uint32Array(1);return window.crypto.getRandomValues(e),e[0]}(),this.isEncrypted=!1,this.hasError=!1,this.errorType="",this.cvcPolicy=e.cvcPolicy,this.expiryDatePolicy=e.expiryDatePolicy,this.init(t,r,o,i)}}function an(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sn="NETWORK_ERROR",ln="IMPLEMENTATION_ERROR",cn="API_ERROR",un="ERROR",dn="SDK_ERROR";class pn extends Error{constructor(e,t,n){super(t),an(this,"cause",void 0),an(this,"options",void 0),this.name=pn.errorTypes[e],this.options=n||{},this.cause=this.options.cause}}function hn(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function yn(){this.encryptedAttrName=Le;const e=At(this.props.rootNode,`[${this.encryptedAttrName}]`).filter((e=>{const t=It(e,this.encryptedAttrName),n=Ne.includes(t);return n||console.warn(`WARNING: '${t}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),n})),t=Re,n=Te;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(e,t,n),e.length):(this.createNonCardSecuredFields(e),e.length)}async function mn(e){for(let t=0;t<e.length;t++){const n=e[t];await this.setupSecuredField(n).catch((e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}))}}async function fn(e,t,n){let r=this.state.type;if("card"===r&&1===this.config.cardGroupTypes.length&&(r=this.config.cardGroupTypes[0],this.state.type=r),this.isSingleBrandedCard="card"!==r,this.isSingleBrandedCard){const e=Tt(r);pt(e)?(t=e.cvcPolicy||Re,n=e.expiryDatePolicy||Te,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let r=0;r<e.length;r++){const o=e[r];window._b$dl&&console.log("\nAbout to set up securedField:",o),await this.setupSecuredField(o,t,n).catch((e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})),window._b$dl&&console.log("Finished setting up securedField:",o)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:r,cvcPolicy:t,expiryDatePolicy:n,cvcText:this.securityCode};setTimeout((()=>{this.callbacks.onBrand(e)}),0)}}function bn(e,t,n){return new Promise(((r,o)=>{const i=It(e,this.encryptedAttrName);i===Oe&&(this.state.hasSeparateDateFields=!0);const a={fieldType:i,extraFieldData:It(e,Ve),uid:It(e,$e),cvcPolicy:t,holderEl:e,expiryDatePolicy:n,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders},s=new on(a,this.props.i18n).onIframeLoaded((()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new pn("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(s.loadToConfigTimeout=setTimeout((()=>{o({type:a.fieldType,failReason:"sf took too long to config"})}),6e3),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}})).onConfig((e=>{this.handleIframeConfigFeedback(e),clearTimeout(s.loadToConfigTimeout),s.loadToConfigTimeout=null,r(e)})).onFocus((e=>{this.handleFocus(e)})).onBinValue((e=>{this.handleBinValue(e)})).onTouchstart((e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})})).onShiftTab((e=>{this.handleSFShiftTab(e.fieldType)})).onEncryption((e=>{this.handleEncryption(e)})).onValidation((e=>{this.handleValidation(e)})).onAutoComplete((e=>{this.processAutoComplete(e)})).onKeyPressed((e=>{const{numKey:t}=e,n=hn(e,["numKey"]);this.callbacks.onKeyPressed(n)}));this.state.securedFields[i]=s}))}an(pn,"errorTypes",{NETWORK_ERROR:sn,CANCEL:"CANCEL",IMPLEMENTATION_ERROR:ln,API_ERROR:cn,ERROR:un,SCRIPT_ERROR:"SCRIPT_ERROR",SDK_ERROR:dn});let gn="undefined"!=typeof navigator&&function(){const e=navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);if(e.indexOf("Trident/")>0){const t=e.indexOf("rv:");return parseInt(e.substring(t+3,e.indexOf(".",t)),10)}const n=e.indexOf("Edge/");return n>0&&parseInt(e.substring(n+5,e.indexOf(".",n)),10)}();var On={__IS_IE:gn,__IS_IOS:"undefined"!=typeof navigator&&/iphone|ipod|ipad/i.test(navigator.userAgent),__IS_FIREFOX:"undefined"!=typeof navigator&&/(firefox)/i.test(navigator.userAgent)};var vn={touchendListener:function(e){const t=e.target;if(t instanceof HTMLInputElement||HTMLTextAreaElement&&t instanceof HTMLTextAreaElement){const r=t.value;let o="selectionStart"in(n=t)?n.selectionStart:0,i=!1;o===r.length&&(o-=1,i=!0),t.value=r;try{t.setSelectionRange&&(t.focus(),t.setSelectionRange(o,o),i&&(o+=1,setTimeout((()=>{t.setSelectionRange(o,o)}),0)))}catch(e){}}else{if(this.config.keypadFix){const e=this.props.rootNode,t=document.createElement("input");t.style.width="1px",t.style.height="1px",t.style.opacity="0",t.style.fontSize="18px",e.appendChild(t),t.focus(),e.removeChild(t)}}var n;this.destroyTouchendListener(),this.state.registerFieldForIos=!1,this.postMessageToAllIframes({fieldType:"webInternalElement",fieldClick:!0})},touchstartListener:function(e){this.hasGenuineTouchEvents=!0;const t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLSpanElement){var n,r,o;this.postMessageToAllIframes({fieldType:"webInternalElement",checkoutTouchEvent:!0});const e=null!==(o=t.getAttribute("name"))&&void