@bigcommerce/checkout-sdk 1.898.4 → 1.898.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see paypal-commerce.js.LICENSE.txt */
2
- (()=>{var t={35:(t,e,n)=>{t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Function]",s="[object Object]",u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[o]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[a]=l["[object Map]"]=l["[object Number]"]=l[s]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var d,p,h,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,v=f||y||Function("return this")(),m=e&&!e.nodeType&&e,g=m&&t&&!t.nodeType&&t,b=g&&g.exports===m,w=b&&f.process,S=function(){try{return g&&g.require&&g.require("util").types||w&&w.binding&&w.binding("util")}catch(t){}}(),_=S&&S.isTypedArray,I=Array.prototype,P=Function.prototype,C=Object.prototype,O=v["__core-js_shared__"],A=P.toString,k=C.hasOwnProperty,E=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",j=C.toString,x=A.call(Object),T=RegExp("^"+A.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=b?v.Buffer:void 0,F=v.Symbol,B=v.Uint8Array,N=(z&&z.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(t){return p(h(t))}),D=Object.create,M=C.propertyIsEnumerable,U=I.splice,R=F?F.toStringTag:void 0,L=function(){try{var t=st(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),V=z?z.isBuffer:void 0,q=Math.max,$=Date.now,H=st(v,"Map"),W=st(Object,"create"),G=function(){function t(){}return function(e){if(!bt(e))return{};if(D)return D(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Y(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function K(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function J(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function X(t){var e=this.__data__=new K(t);this.size=e.size}function Z(t,e,n){(void 0!==n&&!pt(t[e],n)||void 0===n&&!(e in t))&&et(t,e,n)}function Q(t,e,n){var r=t[e];k.call(t,e)&&pt(r,n)&&(void 0!==n||e in t)||et(t,e,n)}function tt(t,e){for(var n=t.length;n--;)if(pt(t[n][0],e))return n;return-1}function et(t,e,n){"__proto__"==e&&L?L(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}Y.prototype.clear=function(){this.__data__=W?W(null):{},this.size=0},Y.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Y.prototype.get=function(t){var e=this.__data__;if(W){var n=e[t];return n===r?void 0:n}return k.call(e,t)?e[t]:void 0},Y.prototype.has=function(t){var e=this.__data__;return W?void 0!==e[t]:k.call(e,t)},Y.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=W&&void 0===e?r:e,this},K.prototype.clear=function(){this.__data__=[],this.size=0},K.prototype.delete=function(t){var e=this.__data__,n=tt(e,t);return!(n<0||(n==e.length-1?e.pop():U.call(e,n,1),--this.size,0))},K.prototype.get=function(t){var e=this.__data__,n=tt(e,t);return n<0?void 0:e[n][1]},K.prototype.has=function(t){return tt(this.__data__,t)>-1},K.prototype.set=function(t,e){var n=this.__data__,r=tt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new Y,map:new(H||K),string:new Y}},J.prototype.delete=function(t){var e=at(this,t).delete(t);return this.size-=e?1:0,e},J.prototype.get=function(t){return at(this,t).get(t)},J.prototype.has=function(t){return at(this,t).has(t)},J.prototype.set=function(t,e){var n=at(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},X.prototype.clear=function(){this.__data__=new K,this.size=0},X.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},X.prototype.get=function(t){return this.__data__.get(t)},X.prototype.has=function(t){return this.__data__.has(t)},X.prototype.set=function(t,e){var n=this.__data__;if(n instanceof K){var r=n.__data__;if(!H||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(t,e),this.size=n.size,this};function nt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":R&&R in Object(t)?function(t){var e=k.call(t,R),n=t[R];try{t[R]=void 0;var r=!0}catch(t){}var i=j.call(t);return r&&(e?t[R]=n:delete t[R]),i}(t):function(t){return j.call(t)}(t)}function rt(t){return wt(t)&&nt(t)==o}function it(t,e,n,r,i){t!==e&&function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var s=o[++r];if(!1===e(i[s],s,i))break}}(e,function(o,a){if(i||(i=new X),bt(o))!function(t,e,n,r,i,o,a){var u=lt(t,n),c=lt(e,n),l=a.get(c);if(l)Z(t,n,l);else{var d,p,h,f,y,v=o?o(u,c,n+"",t,e,a):void 0,m=void 0===v;if(m){var g=ft(c),b=!g&&vt(c),w=!g&&!b&&St(c);v=c,g||b||w?ft(u)?v=u:wt(y=u)&&yt(y)?v=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(u):b?(m=!1,v=function(t){return t.slice()}(c)):w?(m=!1,f=new(h=(d=c).buffer).constructor(h.byteLength),new B(f).set(new B(h)),p=f,v=new d.constructor(p,d.byteOffset,d.length)):v=[]:function(t){if(!wt(t)||nt(t)!=s)return!1;var e=N(t);if(null===e)return!0;var n=k.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==x}(c)||ht(c)?(v=u,ht(u)?v=function(t){return function(t,e,n){var r=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var a=e[i],s=void 0;void 0===s&&(s=t[a]),r?et(n,a,s):Q(n,a,s)}return n}(t,_t(t))}(u):bt(u)&&!mt(u)||(v=function(t){return"function"!=typeof t.constructor||ct(t)?{}:G(N(t))}(c))):m=!1}m&&(a.set(c,v),i(v,c,r,o,a),a.delete(c)),Z(t,n,v)}}(t,e,a,n,it,r,i);else{var u=r?r(lt(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),Z(t,a,u)}},_t)}var ot=L?function(t,e){return L(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Ct;function at(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function st(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!bt(t)||function(t){return!!E&&E in t}(t))&&(mt(t)?T:u).test(function(t){if(null!=t){try{return A.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function ut(t,e){var n=typeof t;return!!(e=null==e?i:e)&&("number"==n||"symbol"!=n&&c.test(t))&&t>-1&&t%1==0&&t<e}function ct(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)}function lt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var dt=function(t){var e=0,n=0;return function(){var r=$(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ot);function pt(t,e){return t===e||t!=t&&e!=e}var ht=rt(function(){return arguments}())?rt:function(t){return wt(t)&&k.call(t,"callee")&&!M.call(t,"callee")},ft=Array.isArray;function yt(t){return null!=t&&gt(t.length)&&!mt(t)}var vt=V||function(){return!1};function mt(t){if(!bt(t))return!1;var e=nt(t);return e==a||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}function bt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function wt(t){return null!=t&&"object"==typeof t}var St=_?function(t){return function(e){return t(e)}}(_):function(t){return wt(t)&&gt(t.length)&&!!l[nt(t)]};function _t(t){return yt(t)?function(t,e){var n=ft(t),r=!n&&ht(t),i=!n&&!r&&vt(t),o=!n&&!r&&!i&&St(t),a=n||r||i||o,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=s.length;for(var c in t)!e&&!k.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ut(c,u))||s.push(c);return s}(t,!0):function(t){if(!bt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=ct(t),n=[];for(var r in t)("constructor"!=r||!e&&k.call(t,r))&&n.push(r);return n}(t)}var It,Pt=(It=function(t,e,n){it(t,e,n)},function(t,e){return dt(function(t,e,n){return e=q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=q(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,s)}}(t,e,Ct),t+"")}(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=It.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(t,e,n){if(!bt(n))return!1;var r=typeof e;return!!("number"==r?yt(n)&&ut(e,n.length):"string"==r&&e in n)&&pt(n[e],t)}(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var a=e[n];a&&It(t,a,n)}return t}));function Ct(t){return t}t.exports=Pt},168:t=>{var e;e=function(){function t(){for(var t=0,e={};t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}function e(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(e,n,o){if("undefined"!=typeof document){"number"==typeof(o=t({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var a=JSON.stringify(n);/^[\{\[]/.test(a)&&(n=a)}catch(t){}n=r.write?r.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var u in o)o[u]&&(s+="; "+u,!0!==o[u]&&(s+="="+o[u].split(";")[0]));return document.cookie=e+"="+n+s}}function a(t,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],a=0;a<o.length;a++){var s=o[a].split("="),u=s.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=e(s[0]);if(u=(r.read||r)(u,c)||e(u),n)try{u=JSON.parse(u)}catch(t){}if(i[c]=u,t===c)break}catch(t){}}return t?i[t]:i}}return i.set=o,i.get=function(t){return a(t,!1)},i.getJSON=function(t){return a(t,!0)},i.remove=function(e,n){o(e,"",t(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}(function(){})},"function"==typeof define&&define.amd&&define(e),t.exports=e()},282:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(9722);e.default=function(){return r||(r=i.default()),r}},315:(t,e,n)=>{"use strict";n(4886).default;var r=n(471);e.Hb=r.default;var i=n(5895);e.vQ=i.default,n(7995).default,n(9722).default,n(282).default},321:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(168),i=n(1675),o=n(5861),a=n(4670);function s(t){return new a.A(new o.A,new i.A,r,t)}},471:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(4886);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},710:(t,e,n)=>{"use strict";function r(t){return"object"!=typeof t||null===t?t:Object.keys(t).filter(function(e){return void 0!==t[e]}).map(function(e){var n=t[e];return"string"==typeof n?e+"="+encodeURIComponent(n):e+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}n.d(e,{A:()=>r})},803:t=>{"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}},1675:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(4321),i=n(710),o=/application\/(\w+\+)?json/,a=/application\/x-www-form-urlencoded/;const s=function(){function t(){}return t.prototype.toRequestBody=function(t){var e=t.headers?this._getHeader(t.headers,"Content-Type"):"";if(t.body){if(o.test(e))return JSON.stringify(t.body);if(a.test(e))return(0,i.A)(t.body)}return t.body},t.prototype.toResponse=function(t){var e=this._parseResponseHeaders(t.getAllResponseHeaders());return{body:this._parseResponseBody("response"in t?t.response:t.responseText,e),headers:e,status:t.status,statusText:t.statusText}},t.prototype._parseResponseBody=function(t,e){var n=this._getHeader(e,"Content-Type");return t&&o.test(n)?JSON.parse(t):t},t.prototype._parseResponseHeaders=function(t){return(t?t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(t,e){var n,i=e.split(":"),o=(i.shift()||"").trim();return o?(0,r.Cl)((0,r.Cl)({},t),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):t},{})},t.prototype._getHeader=function(t,e){return t&&e&&(t[e]||t[e.toLowerCase()])||""},t}()},1915:t=>{"use strict";var e="%[a-f0-9]{2}",n=new RegExp("("+e+")|([^%]+?)","gi"),r=new RegExp("("+e+")+","gi");function i(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function o(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(n)||[],r=1;r<e.length;r++)e=(t=i(e,r).join("")).match(n)||[];return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var i=o(n[0]);i!==n[0]&&(e[n[0]]=i)}n=r.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),s=0;s<a.length;s++){var u=a[s];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},2024:(t,e,n)=>{"use strict";n.d(e,{A:()=>r});const r=function(){function t(t){var e=this;this._delay=t,this._resolve=function(){},this._promise=new Promise(function(t){e._resolve=t})}return t.prototype.onComplete=function(t){this._promise.then(t)},t.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},t.prototype.start=function(){var t=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return t.complete()},this._delay))},t}()},4043:(t,e,n)=>{"use strict";n.r(e),n.d(e,{RequestSender:()=>o.A,Timeout:()=>a.A,createRequestSender:()=>r.A,createTimeout:()=>i.A});var r=n(321),i=n(6889),o=n(4670),a=n(2024)},4321:(t,e,n)=>{"use strict";n.d(e,{Cl:()=>r});var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)}},4325:(t,e,n)=>{"use strict";n.d(e,{g:()=>i});var r=n(5889),i=function(){function t(){this._cache={}}return t.prototype.read=function(t,e){var n=this.getKey(t,e.params);return this._cache[n]||null},t.prototype.write=function(t,e,n){var r=this.getKey(t,e.params);this._cache[r]=n},t.prototype.getKey=function(t,e){return void 0===e&&(e={}),0===Object.keys(e).length?t:t+"?"+r.As(e)},t}()},4475:t=>{"use strict";var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var o,a,s=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in o=Object(arguments[u]))n.call(o,c)&&(s[c]=o[c]);if(e){a=e(o);for(var l=0;l<a.length;l++)r.call(o,a[l])&&(s[a[l]]=o[a[l]])}}return s}},4670:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),u=n(2024);const c=function(){function t(t,e,n,r){void 0===r&&(r={}),this._requestFactory=t,this._payloadTransformer=e,this._cookie=n,this._options=r,this._cache=this._options.cache||new a.g}return t.prototype.sendRequest=function(t,e){var n=this,r=this._mergeDefaultOptions(t,e),i=this._getCachedRequest(t,r);if(i)return Promise.resolve(i);var o=this._requestFactory.createRequest(this._prependHost(t),r);return new Promise(function(e,i){var a=function(){var a=n._payloadTransformer.toResponse(o);a.status>=200&&a.status<300?(n._cacheRequest(t,r,a),e(a)):i(a)};o.onload=a,o.onerror=a,o.onabort=a,o.ontimeout=a,r.timeout instanceof u.A&&(r.timeout.onComplete(function(){return o.abort()}),r.timeout.start()),(0,s.A)(r.timeout)&&r.timeout.then(function(){return o.abort()}),o.send(n._payloadTransformer.toRequestBody(r))})},t.prototype.get=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"GET"}))},t.prototype.post=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"POST"}))},t.prototype.put=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PUT"}))},t.prototype.patch=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PATCH"}))},t.prototype.delete=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"DELETE"}))},t.prototype._mergeDefaultOptions=function(t,e){var n={credentials:!0,encodeParams:!0,headers:{Accept:"application/json, text/plain, */*"},method:"GET"},r=this._cookie.get("XSRF-TOKEN");return r&&n.headers&&!this._isAssetRequest(t,e)&&this._isLocalRequest(t)&&(n.headers["X-XSRF-TOKEN"]=r),e&&e.body&&n.headers&&(n.headers["Content-Type"]="application/json"),o()({},n,e)},t.prototype._prependHost=function(t){return!this._options.host||/^https?:\/\//.test(t)?t:this._options.host.replace(/\/$/,"")+"/"+t.replace(/^\//,"")},t.prototype._shouldCacheRequest=function(t){return"GET"===(t.method||"GET").toUpperCase()&&Boolean(t.cache)},t.prototype._getCachedRequest=function(t,e){return this._shouldCacheRequest(e)?this._cache.read(t,e):null},t.prototype._cacheRequest=function(t,e,n){this._shouldCacheRequest(e)&&this._cache.write(t,e,n)},t.prototype._isAssetRequest=function(t,e){return(!e||!e.method||"GET"===e.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(t.split("?")[0])},t.prototype._isLocalRequest=function(t){return!!t.match(new RegExp("^(https?:)?//"+window.location.hostname))||!t.match(new RegExp("^(https?:)?//"))},t}()},4843:(t,e,n)=>{"use strict";function r(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}n.d(e,{A:()=>r})},4886:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._scripts={},this._preloadedScripts={}}return t.prototype.loadScript=function(t,e){var n=this;return this._scripts[t]||(this._scripts[t]=new Promise(function(r,i){var o=document.createElement("script"),a=e||{},s=a.async,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onreadystatechange=function(){return r()},o.onerror=function(e){delete n._scripts[t],i(e)},o.async=u,o.src=t,document.body.appendChild(o)})),this._scripts[t]},t.prototype.loadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadScript(t,e)})).then(function(){})},t.prototype.preloadScript=function(t,e){var n=this;return this._preloadedScripts[t]||(this._preloadedScripts[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o?"prefetch":"preload";if(n._browserSupport.canSupportRel(a)){var s=document.createElement("link");s.as="script",s.rel=a,s.href=t,s.onload=function(){r()},s.onerror=function(){delete n._preloadedScripts[t],i()},document.head.appendChild(s)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"application/javascript"}}).then(function(){return r()}).catch(i)})),this._preloadedScripts[t]},t.prototype.preloadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadScript(t,e)})).then(function(){})},t}();e.default=n},5470:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9783),i=function(){function t(t,e){this._formBuilder=t,this._options=e}return t.prototype.postForm=function(t,e,n,r){var i=this._formBuilder.build(this._prependHost(t),e,r);window.addEventListener("unload",function t(){window.removeEventListener("unload",t),n&&n()}),document.body.appendChild(i),i.submit()},t.prototype._prependHost=function(t){return this._options&&this._options.host&&!(0,r.isAbsoluteUrl)(t)?(0,r.joinPaths)(this._options.host,t):t},t}();e.default=i},5477:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.canSupportRel=function(t){var e=document.createElement("link");return!!(e.relList&&e.relList.supports&&e.relList.supports(t))},t}();e.default=n},5861:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(5889);const i=function(){function t(){}return t.prototype.createRequest=function(t,e){var n=new XMLHttpRequest;return this._configureRequest(n,t,e),n},t.prototype._configureRequest=function(t,e,n){void 0===n&&(n={}),t.open(n.method||"GET",this._formatUrl(e,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(t,n.headers),"boolean"==typeof n.credentials&&(t.withCredentials=n.credentials),"number"==typeof n.timeout&&(t.timeout=n.timeout)},t.prototype._configureRequestHeaders=function(t,e){Object.keys(e).filter(function(t){return null!==e[t]}).forEach(function(n){t.setRequestHeader(n,e[n])})},t.prototype._formatUrl=function(t,e,n){return void 0===n&&(n=!0),e&&0!==Object.keys(e).length?t+"?"+r.As(e,{encode:n}):t},t}()},5889:(t,e,n)=>{"use strict";var r=n(803),i=n(4475);n(1915);function o(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}e.As=function(t,e){!1===(e=i({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=function(){});var n=function(t){switch(t.arrayFormat){case"index":return function(e,n,r){return null===n?[o(e,t),"[",r,"]"].join(""):[o(e,t),"[",o(r,t),"]=",o(n,t)].join("")};case"bracket":return function(e,n){return null===n?o(e,t):[o(e,t),"[]=",o(n,t)].join("")};default:return function(e,n){return null===n?o(e,t):[o(e,t),"=",o(n,t)].join("")}}}(e);return t?Object.keys(t).sort(e.sort).map(function(r){var i=t[r];if(void 0===i)return"";if(null===i)return o(r,e);if(Array.isArray(i)){var a=[];return i.slice().forEach(function(t){void 0!==t&&a.push(n(r,t,a.length))}),a.join("&")}return o(r,e)+"="+o(i,e)}).filter(function(t){return t.length>0}).join("&"):""}},5895:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(471);e.default=function(){return r||(r=i.default()),r}},6889:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(2024);function i(t){return new r.A(t)}},7995:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._stylesheets={},this._preloadedStylesheets={}}return t.prototype.loadStylesheet=function(t,e){var n=this;return this._stylesheets[t]||(this._stylesheets[t]=new Promise(function(r,i){var o=document.createElement("link"),a=e||{},s=a.prepend,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onerror=function(e){delete n._stylesheets[t],i(e)},o.rel="stylesheet",o.href=t,u&&document.head.children[0]?document.head.insertBefore(o,document.head.children[0]):document.head.appendChild(o)})),this._stylesheets[t]},t.prototype.loadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadStylesheet(t,e)})).then(function(){})},t.prototype.preloadStylesheet=function(t,e){var n=this;return this._preloadedStylesheets[t]||(this._preloadedStylesheets[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o,s=a?"prefetch":"preload";if(n._browserSupport.canSupportRel(s)){var u=document.createElement("link");u.as="style",u.rel=a?"prefetch":"preload",u.href=t,u.onload=function(){r()},u.onerror=function(e){delete n._preloadedStylesheets[t],i(e)},document.head.appendChild(u)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"text/css"}}).then(function(){return r()}).catch(i)})),this._preloadedStylesheets[t]},t.prototype.preloadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadStylesheet(t,e)})).then(function(){})},t}();e.default=n},8686:(t,e,n)=>{"use strict";e.createFormPoster=void 0;var r=n(9165);Object.defineProperty(e,"createFormPoster",{enumerable:!0,get:function(){return r.default}});n(5470)},9165:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9828),i=n(5470);e.default=function(t){var e=new r.default;return new i.default(e,t)}},9440:function(t,e,n){t=n.nmd(t),function(){var r,i="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,u=128,c=1/0,l=9007199254740991,d=NaN,p=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",v="[object Boolean]",m="[object Date]",g="[object Error]",b="[object Function]",w="[object GeneratorFunction]",S="[object Map]",_="[object Number]",I="[object Object]",P="[object Promise]",C="[object RegExp]",O="[object Set]",A="[object String]",k="[object Symbol]",E="[object WeakMap]",j="[object ArrayBuffer]",x="[object DataView]",T="[object Float32Array]",z="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",N="[object Int32Array]",D="[object Uint8Array]",M="[object Uint8ClampedArray]",U="[object Uint16Array]",R="[object Uint32Array]",L=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,W=RegExp($.source),G=RegExp(H.source),Y=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,et=RegExp(tt.source),nt=/^\s+/,rt=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ot=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,vt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,gt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_t="\\u2700-\\u27bf",It="a-z\\xdf-\\xf6\\xf8-\\xff",Pt="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="["+wt+"]",kt="["+Ot+"]",Et="["+St+"]",jt="\\d+",xt="["+_t+"]",Tt="["+It+"]",zt="[^"+wt+Ot+jt+_t+It+Pt+"]",Ft="\\ud83c[\\udffb-\\udfff]",Bt="[^"+wt+"]",Nt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="["+Pt+"]",Ut="\\u200d",Rt="(?:"+Tt+"|"+zt+")",Lt="(?:"+Mt+"|"+zt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+Et+"|"+Ft+")?",Ht="["+Ct+"]?",Wt=Ht+$t+"(?:"+Ut+"(?:"+[Bt,Nt,Dt].join("|")+")"+Ht+$t+")*",Gt="(?:"+[xt,Nt,Dt].join("|")+")"+Wt,Yt="(?:"+[Bt+Et+"?",Et,Nt,Dt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Xt=RegExp(Ft+"(?="+Ft+")|"+Yt+Wt,"g"),Zt=RegExp([Mt+"?"+Tt+"+"+Vt+"(?="+[kt,Mt,"$"].join("|")+")",Lt+"+"+qt+"(?="+[kt,Mt+Rt,"$"].join("|")+")",Mt+"?"+Rt+"+"+Vt,Mt+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",jt,Gt].join("|"),"g"),Qt=RegExp("["+Ut+wt+St+Ct+"]"),te=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ee=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ne=-1,re={};re[T]=re[z]=re[F]=re[B]=re[N]=re[D]=re[M]=re[U]=re[R]=!0,re[f]=re[y]=re[j]=re[v]=re[x]=re[m]=re[g]=re[b]=re[S]=re[_]=re[I]=re[C]=re[O]=re[A]=re[E]=!1;var ie={};ie[f]=ie[y]=ie[j]=ie[x]=ie[v]=ie[m]=ie[T]=ie[z]=ie[F]=ie[B]=ie[N]=ie[S]=ie[_]=ie[I]=ie[C]=ie[O]=ie[A]=ie[k]=ie[D]=ie[M]=ie[U]=ie[R]=!0,ie[g]=ie[b]=ie[E]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,se=parseInt,ue="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ce="object"==typeof self&&self&&self.Object===Object&&self,le=ue||ce||Function("return this")(),de=e&&!e.nodeType&&e,pe=de&&t&&!t.nodeType&&t,he=pe&&pe.exports===de,fe=he&&ue.process,ye=function(){try{return pe&&pe.require&&pe.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),ve=ye&&ye.isArrayBuffer,me=ye&&ye.isDate,ge=ye&&ye.isMap,be=ye&&ye.isRegExp,we=ye&&ye.isSet,Se=ye&&ye.isTypedArray;function _e(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ie(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function Pe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ae(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function ke(t,e){return!(null==t||!t.length)&&Me(t,e,0)>-1}function Ee(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function je(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function xe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Te(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ze(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Fe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Ve("length");function Ne(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function De(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Me(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):De(t,Re,n)}function Ue(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function Re(t){return t!=t}function Le(t,e){var n=null==t?0:t.length;return n?He(t,e)/n:d}function Ve(t){return function(e){return null==e?r:e[t]}}function qe(t){return function(e){return null==t?r:t[e]}}function $e(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function He(t,e){for(var n,i=-1,o=t.length;++i<o;){var a=e(t[i]);a!==r&&(n=n===r?a:n+a)}return n}function We(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ge(t){return t?t.slice(0,dn(t)+1).replace(nt,""):t}function Ye(t){return function(e){return t(e)}}function Ke(t,e){return je(e,function(e){return t[e]})}function Je(t,e){return t.has(e)}function Xe(t,e){for(var n=-1,r=t.length;++n<r&&Me(e,t[n],0)>-1;);return n}function Ze(t,e){for(var n=t.length;n--&&Me(e,t[n],0)>-1;);return n}var Qe=qe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=qe({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function en(t){return"\\"+oe[t]}function nn(t){return Qt.test(t)}function rn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function on(t,e){return function(n){return t(e(n))}}function an(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function sn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function un(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function cn(t){return nn(t)?function(t){for(var e=Xt.lastIndex=0;Xt.test(t);)++e;return e}(t):Be(t)}function ln(t){return nn(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.split("")}(t)}function dn(t){for(var e=t.length;e--&&rt.test(t.charAt(e)););return e}var pn=qe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function t(e){var n,rt=(e=null==e?le:hn.defaults(le.Object(),e,hn.pick(le,ee))).Array,wt=e.Date,St=e.Error,_t=e.Function,It=e.Math,Pt=e.Object,Ct=e.RegExp,Ot=e.String,At=e.TypeError,kt=rt.prototype,Et=_t.prototype,jt=Pt.prototype,xt=e["__core-js_shared__"],Tt=Et.toString,zt=jt.hasOwnProperty,Ft=0,Bt=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Nt=jt.toString,Dt=Tt.call(Pt),Mt=le._,Ut=Ct("^"+Tt.call(zt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rt=he?e.Buffer:r,Lt=e.Symbol,Vt=e.Uint8Array,qt=Rt?Rt.allocUnsafe:r,$t=on(Pt.getPrototypeOf,Pt),Ht=Pt.create,Wt=jt.propertyIsEnumerable,Gt=kt.splice,Yt=Lt?Lt.isConcatSpreadable:r,Xt=Lt?Lt.iterator:r,Qt=Lt?Lt.toStringTag:r,oe=function(){try{var t=uo(Pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ce=wt&&wt.now!==le.Date.now&&wt.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,pe=It.ceil,fe=It.floor,ye=Pt.getOwnPropertySymbols,Be=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,yn=on(Pt.keys,Pt),vn=It.max,mn=It.min,gn=wt.now,bn=e.parseInt,wn=It.random,Sn=kt.reverse,_n=uo(e,"DataView"),In=uo(e,"Map"),Pn=uo(e,"Promise"),Cn=uo(e,"Set"),On=uo(e,"WeakMap"),An=uo(Pt,"create"),kn=On&&new On,En={},jn=Do(_n),xn=Do(In),Tn=Do(Pn),zn=Do(Cn),Fn=Do(On),Bn=Lt?Lt.prototype:r,Nn=Bn?Bn.valueOf:r,Dn=Bn?Bn.toString:r;function Mn(t){if(ts(t)&&!qa(t)&&!(t instanceof Vn)){if(t instanceof Ln)return t;if(zt.call(t,"__wrapped__"))return Mo(t)}return new Ln(t)}var Un=function(){function t(){}return function(e){if(!Qa(e))return{};if(Ht)return Ht(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function Rn(){}function Ln(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function Vn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Hn;++e<n;)this.add(t[e])}function Gn(t){var e=this.__data__=new $n(t);this.size=e.size}function Yn(t,e){var n=qa(t),r=!n&&Va(t),i=!n&&!r&&Ga(t),o=!n&&!r&&!i&&us(t),a=n||r||i||o,s=a?We(t.length,Ot):[],u=s.length;for(var c in t)!e&&!zt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||vo(c,u))||s.push(c);return s}function Kn(t){var e=t.length;return e?t[Hr(0,e-1)]:r}function Jn(t,e){return To(Oi(t),or(e,0,t.length))}function Xn(t){return To(Oi(t))}function Zn(t,e,n){(n!==r&&!Ua(t[e],n)||n===r&&!(e in t))&&rr(t,e,n)}function Qn(t,e,n){var i=t[e];zt.call(t,e)&&Ua(i,n)&&(n!==r||e in t)||rr(t,e,n)}function tr(t,e){for(var n=t.length;n--;)if(Ua(t[n][0],e))return n;return-1}function er(t,e,n,r){return lr(t,function(t,i,o){e(r,t,n(t),o)}),r}function nr(t,e){return t&&Ai(e,js(e),t)}function rr(t,e,n){"__proto__"==e&&oe?oe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ir(t,e){for(var n=-1,i=e.length,o=rt(i),a=null==t;++n<i;)o[n]=a?r:Cs(t,e[n]);return o}function or(t,e,n){return t==t&&(n!==r&&(t=t<=n?t:n),e!==r&&(t=t>=e?t:e)),t}function ar(t,e,n,i,o,a){var s,u=1&e,c=2&e,l=4&e;if(n&&(s=o?n(t,i,o,a):n(t)),s!==r)return s;if(!Qa(t))return t;var d=qa(t);if(d){if(s=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&zt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!u)return Oi(t,s)}else{var p=po(t),h=p==b||p==w;if(Ga(t))return wi(t,u);if(p==I||p==f||h&&!o){if(s=c||h?{}:fo(t),!u)return c?function(t,e){return Ai(t,lo(t),e)}(t,function(t,e){return t&&Ai(e,xs(e),t)}(s,t)):function(t,e){return Ai(t,co(t),e)}(t,nr(s,t))}else{if(!ie[p])return o?t:{};s=function(t,e,n){var r,i=t.constructor;switch(e){case j:return Si(t);case v:case m:return new i(+t);case x:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case T:case z:case F:case B:case N:case D:case M:case U:case R:return _i(t,n);case S:return new i;case _:case A:return new i(t);case C:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new i;case k:return r=t,Nn?Pt(Nn.call(r)):{}}}(t,p,u)}}a||(a=new Gn);var y=a.get(t);if(y)return y;a.set(t,s),os(t)?t.forEach(function(r){s.add(ar(r,e,n,r,t,a))}):es(t)&&t.forEach(function(r,i){s.set(i,ar(r,e,n,i,t,a))});var g=d?r:(l?c?eo:to:c?xs:js)(t);return Pe(g||t,function(r,i){g&&(r=t[i=r]),Qn(s,i,ar(r,e,n,i,t,a))}),s}function sr(t,e,n){var i=n.length;if(null==t)return!i;for(t=Pt(t);i--;){var o=n[i],a=e[o],s=t[o];if(s===r&&!(o in t)||!a(s))return!1}return!0}function ur(t,e,n){if("function"!=typeof t)throw new At(i);return ko(function(){t.apply(r,n)},e)}function cr(t,e,n,r){var i=-1,o=ke,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=je(e,Ye(n))),r?(o=Ee,a=!1):e.length>=200&&(o=Je,a=!1,e=new Wn(e));t:for(;++i<s;){var l=t[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var p=c;p--;)if(e[p]===d)continue t;u.push(l)}else o(e,d,r)||u.push(l)}return u}Mn.templateSettings={escape:Y,evaluate:K,interpolate:J,variable:"",imports:{_:Mn}},Mn.prototype=Rn.prototype,Mn.prototype.constructor=Mn,Ln.prototype=Un(Rn.prototype),Ln.prototype.constructor=Ln,Vn.prototype=Un(Rn.prototype),Vn.prototype.constructor=Vn,qn.prototype.clear=function(){this.__data__=An?An(null):{},this.size=0},qn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},qn.prototype.get=function(t){var e=this.__data__;if(An){var n=e[t];return n===o?r:n}return zt.call(e,t)?e[t]:r},qn.prototype.has=function(t){var e=this.__data__;return An?e[t]!==r:zt.call(e,t)},qn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=An&&e===r?o:e,this},$n.prototype.clear=function(){this.__data__=[],this.size=0},$n.prototype.delete=function(t){var e=this.__data__,n=tr(e,t);return!(n<0||(n==e.length-1?e.pop():Gt.call(e,n,1),--this.size,0))},$n.prototype.get=function(t){var e=this.__data__,n=tr(e,t);return n<0?r:e[n][1]},$n.prototype.has=function(t){return tr(this.__data__,t)>-1},$n.prototype.set=function(t,e){var n=this.__data__,r=tr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(In||$n),string:new qn}},Hn.prototype.delete=function(t){var e=ao(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return ao(this,t).get(t)},Hn.prototype.has=function(t){return ao(this,t).has(t)},Hn.prototype.set=function(t,e){var n=ao(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(t){return this.__data__.set(t,o),this},Wn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.clear=function(){this.__data__=new $n,this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Gn.prototype.get=function(t){return this.__data__.get(t)},Gn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var lr=ji(gr),dr=ji(br,!0);function pr(t,e){var n=!0;return lr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function hr(t,e,n){for(var i=-1,o=t.length;++i<o;){var a=t[i],s=e(a);if(null!=s&&(u===r?s==s&&!ss(s):n(s,u)))var u=s,c=a}return c}function fr(t,e){var n=[];return lr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=yo),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?yr(s,e-1,n,r,i):xe(i,s):r||(i[i.length]=s)}return i}var vr=xi(),mr=xi(!0);function gr(t,e){return t&&vr(t,e,js)}function br(t,e){return t&&mr(t,e,js)}function wr(t,e){return Ae(e,function(e){return Ja(t[e])})}function Sr(t,e){for(var n=0,i=(e=vi(e,t)).length;null!=t&&n<i;)t=t[No(e[n++])];return n&&n==i?t:r}function _r(t,e,n){var r=e(t);return qa(t)?r:xe(r,n(t))}function Ir(t){return null==t?t===r?"[object Undefined]":"[object Null]":Qt&&Qt in Pt(t)?function(t){var e=zt.call(t,Qt),n=t[Qt];try{t[Qt]=r;var i=!0}catch(t){}var o=Nt.call(t);return i&&(e?t[Qt]=n:delete t[Qt]),o}(t):function(t){return Nt.call(t)}(t)}function Pr(t,e){return t>e}function Cr(t,e){return null!=t&&zt.call(t,e)}function Or(t,e){return null!=t&&e in Pt(t)}function Ar(t,e,n){for(var i=n?Ee:ke,o=t[0].length,a=t.length,s=a,u=rt(a),c=1/0,l=[];s--;){var d=t[s];s&&e&&(d=je(d,Ye(e))),c=mn(d.length,c),u[s]=!n&&(e||o>=120&&d.length>=120)?new Wn(s&&d):r}d=t[0];var p=-1,h=u[0];t:for(;++p<o&&l.length<c;){var f=d[p],y=e?e(f):f;if(f=n||0!==f?f:0,!(h?Je(h,y):i(l,y,n))){for(s=a;--s;){var v=u[s];if(!(v?Je(v,y):i(t[s],y,n)))continue t}h&&h.push(y),l.push(f)}}return l}function kr(t,e,n){var i=null==(t=Co(t,e=vi(e,t)))?t:t[No(Ko(e))];return null==i?r:_e(i,t,n)}function Er(t){return ts(t)&&Ir(t)==f}function jr(t,e,n,i,o){return t===e||(null==t||null==e||!ts(t)&&!ts(e)?t!=t&&e!=e:function(t,e,n,i,o,a){var s=qa(t),u=qa(e),c=s?y:po(t),l=u?y:po(e),d=(c=c==f?I:c)==I,p=(l=l==f?I:l)==I,h=c==l;if(h&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Gn),s||us(t)?Zi(t,e,n,i,o,a):function(t,e,n,r,i,o,a){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case j:return!(t.byteLength!=e.byteLength||!o(new Vt(t),new Vt(e)));case v:case m:case _:return Ua(+t,+e);case g:return t.name==e.name&&t.message==e.message;case C:case A:return t==e+"";case S:var s=rn;case O:var u=1&r;if(s||(s=sn),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var l=Zi(s(t),s(e),r,i,o,a);return a.delete(t),l;case k:if(Nn)return Nn.call(t)==Nn.call(e)}return!1}(t,e,c,n,i,o,a);if(!(1&n)){var b=d&&zt.call(t,"__wrapped__"),w=p&&zt.call(e,"__wrapped__");if(b||w){var P=b?t.value():t,E=w?e.value():e;return a||(a=new Gn),o(P,E,n,i,a)}}return!!h&&(a||(a=new Gn),function(t,e,n,i,o,a){var s=1&n,u=to(t),c=u.length;if(c!=to(e).length&&!s)return!1;for(var l=c;l--;){var d=u[l];if(!(s?d in e:zt.call(e,d)))return!1}var p=a.get(t),h=a.get(e);if(p&&h)return p==e&&h==t;var f=!0;a.set(t,e),a.set(e,t);for(var y=s;++l<c;){var v=t[d=u[l]],m=e[d];if(i)var g=s?i(m,v,d,e,t,a):i(v,m,d,t,e,a);if(!(g===r?v===m||o(v,m,n,i,a):g)){f=!1;break}y||(y="constructor"==d)}if(f&&!y){var b=t.constructor,w=e.constructor;b==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(f=!1)}return a.delete(t),a.delete(e),f}(t,e,n,i,o,a))}(t,e,n,i,jr,o))}function xr(t,e,n,i){var o=n.length,a=o,s=!i;if(null==t)return!a;for(t=Pt(t);o--;){var u=n[o];if(s&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=n[o])[0],l=t[c],d=u[1];if(s&&u[2]){if(l===r&&!(c in t))return!1}else{var p=new Gn;if(i)var h=i(l,d,c,t,e,p);if(!(h===r?jr(d,l,3,i,p):h))return!1}}return!0}function Tr(t){return!(!Qa(t)||(e=t,Bt&&Bt in e))&&(Ja(t)?Ut:ft).test(Do(t));var e}function zr(t){return"function"==typeof t?t:null==t?nu:"object"==typeof t?qa(t)?Mr(t[0],t[1]):Dr(t):du(t)}function Fr(t){if(!So(t))return yn(t);var e=[];for(var n in Pt(t))zt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Br(t,e){return t<e}function Nr(t,e){var n=-1,r=Ha(t)?rt(t.length):[];return lr(t,function(t,i,o){r[++n]=e(t,i,o)}),r}function Dr(t){var e=so(t);return 1==e.length&&e[0][2]?Io(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Mr(t,e){return go(t)&&_o(e)?Io(No(t),e):function(n){var i=Cs(n,t);return i===r&&i===e?Os(n,t):jr(e,i,3)}}function Ur(t,e,n,i,o){t!==e&&vr(e,function(a,s){if(o||(o=new Gn),Qa(a))!function(t,e,n,i,o,a,s){var u=Oo(t,n),c=Oo(e,n),l=s.get(c);if(l)Zn(t,n,l);else{var d=a?a(u,c,n+"",t,e,s):r,p=d===r;if(p){var h=qa(c),f=!h&&Ga(c),y=!h&&!f&&us(c);d=c,h||f||y?qa(u)?d=u:Wa(u)?d=Oi(u):f?(p=!1,d=wi(c,!0)):y?(p=!1,d=_i(c,!0)):d=[]:rs(c)||Va(c)?(d=u,Va(u)?d=vs(u):Qa(u)&&!Ja(u)||(d=fo(c))):p=!1}p&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Zn(t,n,d)}}(t,e,s,n,Ur,i,o);else{var u=i?i(Oo(t,s),a,s+"",t,e,o):r;u===r&&(u=a),Zn(t,s,u)}},xs)}function Rr(t,e){var n=t.length;if(n)return vo(e+=e<0?n:0,n)?t[e]:r}function Lr(t,e,n){e=e.length?je(e,function(t){return qa(t)?function(e){return Sr(e,1===t.length?t[0]:t)}:t}):[nu];var r=-1;e=je(e,Ye(oo()));var i=Nr(t,function(t,n,i){var o=je(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t){var e=t.length;for(t.sort(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r<a;){var u=Ii(i[r],o[r]);if(u)return r>=s?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)});e--;)t[e]=t[e].value;return t}(i)}function Vr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],s=Sr(t,a);n(s,a)&&Jr(o,vi(a,t),s)}return o}function qr(t,e,n,r){var i=r?Ue:Me,o=-1,a=e.length,s=t;for(t===e&&(e=Oi(e)),n&&(s=je(t,Ye(n)));++o<a;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(s,l,u,r))>-1;)s!==t&&Gt.call(s,u,1),Gt.call(t,u,1);return t}function $r(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;vo(i)?Gt.call(t,i,1):ui(t,i)}}return t}function Hr(t,e){return t+fe(wn()*(e-t+1))}function Wr(t,e){var n="";if(!t||e<1||e>l)return n;do{e%2&&(n+=t),(e=fe(e/2))&&(t+=t)}while(e);return n}function Gr(t,e){return Eo(Po(t,e,nu),t+"")}function Yr(t){return Kn(Us(t))}function Kr(t,e){var n=Us(t);return To(n,or(e,0,n.length))}function Jr(t,e,n,i){if(!Qa(t))return t;for(var o=-1,a=(e=vi(e,t)).length,s=a-1,u=t;null!=u&&++o<a;){var c=No(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=s){var d=u[c];(l=i?i(d,c,u):r)===r&&(l=Qa(d)?d:vo(e[o+1])?[]:{})}Qn(u,c,l),u=u[c]}return t}var Xr=kn?function(t,e){return kn.set(t,e),t}:nu,Zr=oe?function(t,e){return oe(t,"toString",{configurable:!0,enumerable:!1,value:Qs(e),writable:!0})}:nu;function Qr(t){return To(Us(t))}function ti(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=rt(i);++r<i;)o[r]=t[r+e];return o}function ei(t,e){var n;return lr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function ni(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!ss(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return ri(t,e,nu,n)}function ri(t,e,n,i){var o=0,a=null==t?0:t.length;if(0===a)return 0;for(var s=(e=n(e))!=e,u=null===e,c=ss(e),l=e===r;o<a;){var d=fe((o+a)/2),p=n(t[d]),h=p!==r,f=null===p,y=p==p,v=ss(p);if(s)var m=i||y;else m=l?y&&(i||h):u?y&&h&&(i||!f):c?y&&h&&!f&&(i||!v):!f&&!v&&(i?p<=e:p<e);m?o=d+1:a=d}return mn(a,4294967294)}function ii(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Ua(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function oi(t){return"number"==typeof t?t:ss(t)?d:+t}function ai(t){if("string"==typeof t)return t;if(qa(t))return je(t,ai)+"";if(ss(t))return Dn?Dn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function si(t,e,n){var r=-1,i=ke,o=t.length,a=!0,s=[],u=s;if(n)a=!1,i=Ee;else if(o>=200){var c=e?null:Wi(t);if(c)return sn(c);a=!1,i=Je,u=new Wn}else u=e?[]:s;t:for(;++r<o;){var l=t[r],d=e?e(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var p=u.length;p--;)if(u[p]===d)continue t;e&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s}function ui(t,e){return null==(t=Co(t,e=vi(e,t)))||delete t[No(Ko(e))]}function ci(t,e,n,r){return Jr(t,e,n(Sr(t,e)),r)}function li(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ti(t,r?0:o,r?o+1:i):ti(t,r?o+1:0,r?i:o)}function di(t,e){var n=t;return n instanceof Vn&&(n=n.value()),Te(e,function(t,e){return e.func.apply(e.thisArg,xe([t],e.args))},n)}function pi(t,e,n){var r=t.length;if(r<2)return r?si(t[0]):[];for(var i=-1,o=rt(r);++i<r;)for(var a=t[i],s=-1;++s<r;)s!=i&&(o[i]=cr(o[i]||a,t[s],e,n));return si(yr(o,1),e,n)}function hi(t,e,n){for(var i=-1,o=t.length,a=e.length,s={};++i<o;){var u=i<a?e[i]:r;n(s,t[i],u)}return s}function fi(t){return Wa(t)?t:[]}function yi(t){return"function"==typeof t?t:nu}function vi(t,e){return qa(t)?t:go(t,e)?[t]:Bo(ms(t))}var mi=Gr;function gi(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ti(t,e,n)}var bi=ue||function(t){return le.clearTimeout(t)};function wi(t,e){if(e)return t.slice();var n=t.length,r=qt?qt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function _i(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ii(t,e){if(t!==e){var n=t!==r,i=null===t,o=t==t,a=ss(t),s=e!==r,u=null===e,c=e==e,l=ss(e);if(!u&&!l&&!a&&t>e||a&&s&&c&&!u&&!l||i&&s&&c||!n&&c||!o)return 1;if(!i&&!a&&!l&&t<e||l&&n&&o&&!i&&!a||u&&n&&o||!s&&o||!c)return-1}return 0}function Pi(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=vn(o-a,0),l=rt(u+c),d=!r;++s<u;)l[s]=e[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=t[i]);for(;c--;)l[s++]=t[i++];return l}function Ci(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,c=e.length,l=vn(o-s,0),d=rt(l+c),p=!r;++i<l;)d[i]=t[i];for(var h=i;++u<c;)d[h+u]=e[u];for(;++a<s;)(p||i<o)&&(d[h+n[a]]=t[i++]);return d}function Oi(t,e){var n=-1,r=t.length;for(e||(e=rt(r));++n<r;)e[n]=t[n];return e}function Ai(t,e,n,i){var o=!n;n||(n={});for(var a=-1,s=e.length;++a<s;){var u=e[a],c=i?i(n[u],t[u],u,n,t):r;c===r&&(c=t[u]),o?rr(n,u,c):Qn(n,u,c)}return n}function ki(t,e){return function(n,r){var i=qa(n)?Ie:er,o=e?e():{};return i(n,t,oo(r,2),o)}}function Ei(t){return Gr(function(e,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=t.length>3&&"function"==typeof a?(o--,a):r,s&&mo(n[0],n[1],s)&&(a=o<3?r:a,o=1),e=Pt(e);++i<o;){var u=n[i];u&&t(e,u,i,a)}return e})}function ji(t,e){return function(n,r){if(null==n)return n;if(!Ha(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=Pt(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function xi(t){return function(e,n,r){for(var i=-1,o=Pt(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}function Ti(t){return function(e){var n=nn(e=ms(e))?ln(e):r,i=n?n[0]:e.charAt(0),o=n?gi(n,1).join(""):e.slice(1);return i[t]()+o}}function zi(t){return function(e){return Te(Js(Vs(e).replace(Kt,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Un(t.prototype),r=t.apply(n,e);return Qa(r)?r:n}}function Bi(t){return function(e,n,i){var o=Pt(e);if(!Ha(e)){var a=oo(n,3);e=js(e),n=function(t){return a(o[t],t,o)}}var s=t(e,n,i);return s>-1?o[a?e[s]:s]:r}}function Ni(t){return Qi(function(e){var n=e.length,o=n,a=Ln.prototype.thru;for(t&&e.reverse();o--;){var s=e[o];if("function"!=typeof s)throw new At(i);if(a&&!u&&"wrapper"==ro(s))var u=new Ln([],!0)}for(o=u?o:n;++o<n;){var c=ro(s=e[o]),l="wrapper"==c?no(s):r;u=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ro(l[0])].apply(u,l[3]):1==s.length&&bo(s)?u[c]():u.thru(s)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&qa(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function Di(t,e,n,i,o,a,s,c,l,d){var p=e&u,h=1&e,f=2&e,y=24&e,v=512&e,m=f?r:Fi(t);return function u(){for(var g=arguments.length,b=rt(g),w=g;w--;)b[w]=arguments[w];if(y)var S=io(u),_=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,S);if(i&&(b=Pi(b,i,o,y)),a&&(b=Ci(b,a,s,y)),g-=_,y&&g<d){var I=an(b,S);return $i(t,e,Di,u.placeholder,n,b,I,c,l,d-g)}var P=h?n:this,C=f?P[t]:t;return g=b.length,c?b=function(t,e){for(var n=t.length,i=mn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=vo(a,n)?o[a]:r}return t}(b,c):v&&g>1&&b.reverse(),p&&l<g&&(b.length=l),this&&this!==le&&this instanceof u&&(C=m||Fi(C)),C.apply(P,b)}}function Mi(t,e){return function(n,r){return function(t,e,n,r){return gr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Ui(t,e){return function(n,i){var o;if(n===r&&i===r)return e;if(n!==r&&(o=n),i!==r){if(o===r)return i;"string"==typeof n||"string"==typeof i?(n=ai(n),i=ai(i)):(n=oi(n),i=oi(i)),o=t(n,i)}return o}}function Ri(t){return Qi(function(e){return e=je(e,Ye(oo())),Gr(function(n){var r=this;return t(e,function(t){return _e(t,r,n)})})})}function Li(t,e){var n=(e=e===r?" ":ai(e)).length;if(n<2)return n?Wr(e,t):e;var i=Wr(e,pe(t/cn(e)));return nn(e)?gi(ln(i),0,t).join(""):i.slice(0,t)}function Vi(t){return function(e,n,i){return i&&"number"!=typeof i&&mo(e,n,i)&&(n=i=r),e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n,r){for(var i=-1,o=vn(pe((e-t)/(n||1)),0),a=rt(o);o--;)a[r?o:++i]=t,t+=n;return a}(e,n,i=i===r?e<n?1:-1:ps(i),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ys(e),n=ys(n)),t(e,n)}}function $i(t,e,n,i,o,a,u,c,l,d){var p=8&e;e|=p?s:64,4&(e&=~(p?64:s))||(e&=-4);var h=[t,e,o,p?a:r,p?u:r,p?r:a,p?r:u,c,l,d],f=n.apply(r,h);return bo(t)&&Ao(f,h),f.placeholder=i,jo(f,t,e)}function Hi(t){var e=It[t];return function(t,n){if(t=ys(t),(n=null==n?0:mn(hs(n),292))&&qe(t)){var r=(ms(t)+"e").split("e");return+((r=(ms(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Wi=Cn&&1/sn(new Cn([,-0]))[1]==c?function(t){return new Cn(t)}:su;function Gi(t){return function(e){var n=po(e);return n==S?rn(e):n==O?un(e):function(t,e){return je(e,function(e){return[e,t[e]]})}(e,t(e))}}function Yi(t,e,n,o,c,l,d,p){var h=2&e;if(!h&&"function"!=typeof t)throw new At(i);var f=o?o.length:0;if(f||(e&=-97,o=c=r),d=d===r?d:vn(hs(d),0),p=p===r?p:hs(p),f-=c?c.length:0,64&e){var y=o,v=c;o=c=r}var m=h?r:no(t),g=[t,e,n,o,c,y,v,l,d,p];if(m&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==u&&8==n||r==u&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var l=t[3];t[3]=l?Pi(l,c,e[4]):c,t[4]=l?an(t[3],a):e[4]}(c=e[5])&&(l=t[5],t[5]=l?Ci(l,c,e[6]):c,t[6]=l?an(t[5],a):e[6]),(c=e[7])&&(t[7]=c),r&u&&(t[8]=null==t[8]?e[8]:mn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(g,m),t=g[0],e=g[1],n=g[2],o=g[3],c=g[4],!(p=g[9]=g[9]===r?h?0:t.length:vn(g[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Fi(t);return function o(){for(var a=arguments.length,s=rt(a),u=a,c=io(o);u--;)s[u]=arguments[u];var l=a<3&&s[0]!==c&&s[a-1]!==c?[]:an(s,c);return(a-=l.length)<n?$i(t,e,Di,o.placeholder,r,s,l,r,r,n-a):_e(this&&this!==le&&this instanceof o?i:t,this,s)}}(t,e,p):e!=s&&33!=e||c.length?Di.apply(r,g):function(t,e,n,r){var i=1&e,o=Fi(t);return function e(){for(var a=-1,s=arguments.length,u=-1,c=r.length,l=rt(c+s),d=this&&this!==le&&this instanceof e?o:t;++u<c;)l[u]=r[u];for(;s--;)l[u++]=arguments[++a];return _e(d,i?n:this,l)}}(t,e,n,o);else var b=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==le&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return jo((m?Xr:Ao)(b,g),t,e)}function Ki(t,e,n,i){return t===r||Ua(t,jt[n])&&!zt.call(i,n)?e:t}function Ji(t,e,n,i,o,a){return Qa(t)&&Qa(e)&&(a.set(e,t),Ur(t,e,r,Ji,a),a.delete(e)),t}function Xi(t){return rs(t)?r:t}function Zi(t,e,n,i,o,a){var s=1&n,u=t.length,c=e.length;if(u!=c&&!(s&&c>u))return!1;var l=a.get(t),d=a.get(e);if(l&&d)return l==e&&d==t;var p=-1,h=!0,f=2&n?new Wn:r;for(a.set(t,e),a.set(e,t);++p<u;){var y=t[p],v=e[p];if(i)var m=s?i(v,y,p,e,t,a):i(y,v,p,t,e,a);if(m!==r){if(m)continue;h=!1;break}if(f){if(!Fe(e,function(t,e){if(!Je(f,e)&&(y===t||o(y,t,n,i,a)))return f.push(e)})){h=!1;break}}else if(y!==v&&!o(y,v,n,i,a)){h=!1;break}}return a.delete(t),a.delete(e),h}function Qi(t){return Eo(Po(t,r,$o),t+"")}function to(t){return _r(t,js,co)}function eo(t){return _r(t,xs,lo)}var no=kn?function(t){return kn.get(t)}:su;function ro(t){for(var e=t.name+"",n=En[e],r=zt.call(En,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function io(t){return(zt.call(Mn,"placeholder")?Mn:t).placeholder}function oo(){var t=Mn.iteratee||ru;return t=t===ru?zr:t,arguments.length?t(arguments[0],arguments[1]):t}function ao(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function so(t){for(var e=js(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,_o(i)]}return e}function uo(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return Tr(n)?n:r}var co=ye?function(t){return null==t?[]:(t=Pt(t),Ae(ye(t),function(e){return Wt.call(t,e)}))}:fu,lo=ye?function(t){for(var e=[];t;)xe(e,co(t)),t=$t(t);return e}:fu,po=Ir;function ho(t,e,n){for(var r=-1,i=(e=vi(e,t)).length,o=!1;++r<i;){var a=No(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Za(i)&&vo(a,i)&&(qa(t)||Va(t))}function fo(t){return"function"!=typeof t.constructor||So(t)?{}:Un($t(t))}function yo(t){return qa(t)||Va(t)||!!(Yt&&t&&t[Yt])}function vo(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&vt.test(t))&&t>-1&&t%1==0&&t<e}function mo(t,e,n){if(!Qa(n))return!1;var r=typeof e;return!!("number"==r?Ha(n)&&vo(e,n.length):"string"==r&&e in n)&&Ua(n[e],t)}function go(t,e){if(qa(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ss(t))||Z.test(t)||!X.test(t)||null!=e&&t in Pt(e)}function bo(t){var e=ro(t),n=Mn[e];if("function"!=typeof n||!(e in Vn.prototype))return!1;if(t===n)return!0;var r=no(n);return!!r&&t===r[0]}(_n&&po(new _n(new ArrayBuffer(1)))!=x||In&&po(new In)!=S||Pn&&po(Pn.resolve())!=P||Cn&&po(new Cn)!=O||On&&po(new On)!=E)&&(po=function(t){var e=Ir(t),n=e==I?t.constructor:r,i=n?Do(n):"";if(i)switch(i){case jn:return x;case xn:return S;case Tn:return P;case zn:return O;case Fn:return E}return e});var wo=xt?Ja:yu;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function _o(t){return t==t&&!Qa(t)}function Io(t,e){return function(n){return null!=n&&n[t]===e&&(e!==r||t in Pt(n))}}function Po(t,e,n){return e=vn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=vn(r.length-e,0),a=rt(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=rt(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),_e(t,this,s)}}function Co(t,e){return e.length<2?t:Sr(t,ti(e,0,-1))}function Oo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ao=xo(Xr),ko=de||function(t,e){return le.setTimeout(t,e)},Eo=xo(Zr);function jo(t,e,n){var r=e+"";return Eo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Pe(h,function(n){var r="_."+n[0];e&n[1]&&!ke(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ot);return e?e[1].split(at):[]}(r),n)))}function xo(t){var e=0,n=0;return function(){var i=gn(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function To(t,e){var n=-1,i=t.length,o=i-1;for(e=e===r?i:e;++n<e;){var a=Hr(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var zo,Fo,Bo=(zo=za(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Q,function(t,n,r,i){e.push(r?i.replace(ct,"$1"):n||t)}),e},function(t){return 500===Fo.size&&Fo.clear(),t}),Fo=zo.cache,zo);function No(t){if("string"==typeof t||ss(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Do(t){if(null!=t){try{return Tt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Mo(t){if(t instanceof Vn)return t.clone();var e=new Ln(t.__wrapped__,t.__chain__);return e.__actions__=Oi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Uo=Gr(function(t,e){return Wa(t)?cr(t,yr(e,1,Wa,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,yr(e,1,Wa,!0),oo(n,2)):[]}),Lo=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,yr(e,1,Wa,!0),r,n):[]});function Vo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=vn(r+i,0)),De(t,oo(e,3),i)}function qo(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return n!==r&&(o=hs(n),o=n<0?vn(i+o,0):mn(o,i-1)),De(t,oo(e,3),o,!0)}function $o(t){return null!=t&&t.length?yr(t,1):[]}function Ho(t){return t&&t.length?t[0]:r}var Wo=Gr(function(t){var e=je(t,fi);return e.length&&e[0]===t[0]?Ar(e):[]}),Go=Gr(function(t){var e=Ko(t),n=je(t,fi);return e===Ko(n)?e=r:n.pop(),n.length&&n[0]===t[0]?Ar(n,oo(e,2)):[]}),Yo=Gr(function(t){var e=Ko(t),n=je(t,fi);return(e="function"==typeof e?e:r)&&n.pop(),n.length&&n[0]===t[0]?Ar(n,r,e):[]});function Ko(t){var e=null==t?0:t.length;return e?t[e-1]:r}var Jo=Gr(Xo);function Xo(t,e){return t&&t.length&&e&&e.length?qr(t,e):t}var Zo=Qi(function(t,e){var n=null==t?0:t.length,r=ir(t,e);return $r(t,je(e,function(t){return vo(t,n)?+t:t}).sort(Ii)),r});function Qo(t){return null==t?t:Sn.call(t)}var ta=Gr(function(t){return si(yr(t,1,Wa,!0))}),ea=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),si(yr(t,1,Wa,!0),oo(e,2))}),na=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,si(yr(t,1,Wa,!0),r,e)});function ra(t){if(!t||!t.length)return[];var e=0;return t=Ae(t,function(t){if(Wa(t))return e=vn(t.length,e),!0}),We(e,function(e){return je(t,Ve(e))})}function ia(t,e){if(!t||!t.length)return[];var n=ra(t);return null==e?n:je(n,function(t){return _e(e,r,t)})}var oa=Gr(function(t,e){return Wa(t)?cr(t,e):[]}),aa=Gr(function(t){return pi(Ae(t,Wa))}),sa=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),pi(Ae(t,Wa),oo(e,2))}),ua=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,pi(Ae(t,Wa),r,e)}),ca=Gr(ra),la=Gr(function(t){var e=t.length,n=e>1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,ia(t,n)});function da(t){var e=Mn(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var ha=Qi(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return ir(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Vn&&vo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(r),t})):this.thru(o)}),fa=ki(function(t,e,n){zt.call(t,n)?++t[n]:rr(t,n,1)}),ya=Bi(Vo),va=Bi(qo);function ma(t,e){return(qa(t)?Pe:lr)(t,oo(e,3))}function ga(t,e){return(qa(t)?Ce:dr)(t,oo(e,3))}var ba=ki(function(t,e,n){zt.call(t,n)?t[n].push(e):rr(t,n,[e])}),wa=Gr(function(t,e,n){var r=-1,i="function"==typeof e,o=Ha(t)?rt(t.length):[];return lr(t,function(t){o[++r]=i?_e(e,t,n):kr(t,e,n)}),o}),Sa=ki(function(t,e,n){rr(t,n,e)});function _a(t,e){return(qa(t)?je:Nr)(t,oo(e,3))}var Ia=ki(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),Pa=Gr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&mo(t,e[0],e[1])?e=[]:n>2&&mo(e[0],e[1],e[2])&&(e=[e[0]]),Lr(t,yr(e,1),[])}),Ca=ce||function(){return le.Date.now()};function Oa(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Yi(t,u,r,r,r,r,e)}function Aa(t,e){var n;if("function"!=typeof e)throw new At(i);return t=hs(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=r),n}}var ka=Gr(function(t,e,n){var r=1;if(n.length){var i=an(n,io(ka));r|=s}return Yi(t,r,e,n,i)}),Ea=Gr(function(t,e,n){var r=3;if(n.length){var i=an(n,io(Ea));r|=s}return Yi(e,r,t,n,i)});function ja(t,e,n){var o,a,s,u,c,l,d=0,p=!1,h=!1,f=!0;if("function"!=typeof t)throw new At(i);function y(e){var n=o,i=a;return o=a=r,d=e,u=t.apply(i,n)}function v(t){var n=t-l;return l===r||n>=e||n<0||h&&t-d>=s}function m(){var t=Ca();if(v(t))return g(t);c=ko(m,function(t){var n=e-(t-l);return h?mn(n,s-(t-d)):n}(t))}function g(t){return c=r,f&&o?y(t):(o=a=r,u)}function b(){var t=Ca(),n=v(t);if(o=arguments,a=this,l=t,n){if(c===r)return function(t){return d=t,c=ko(m,e),p?y(t):u}(l);if(h)return bi(c),c=ko(m,e),y(l)}return c===r&&(c=ko(m,e)),u}return e=ys(e)||0,Qa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?vn(ys(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){c!==r&&bi(c),d=0,o=l=a=c=r},b.flush=function(){return c===r?u:g(Ca())},b}var xa=Gr(function(t,e){return ur(t,1,e)}),Ta=Gr(function(t,e,n){return ur(t,ys(e)||0,n)});function za(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new At(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Hn),n}function Fa(t){if("function"!=typeof t)throw new At(i);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}za.Cache=Hn;var Ba=mi(function(t,e){var n=(e=1==e.length&&qa(e[0])?je(e[0],Ye(oo())):je(yr(e,1),Ye(oo()))).length;return Gr(function(r){for(var i=-1,o=mn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return _e(t,this,r)})}),Na=Gr(function(t,e){var n=an(e,io(Na));return Yi(t,s,r,e,n)}),Da=Gr(function(t,e){var n=an(e,io(Da));return Yi(t,64,r,e,n)}),Ma=Qi(function(t,e){return Yi(t,256,r,r,r,e)});function Ua(t,e){return t===e||t!=t&&e!=e}var Ra=qi(Pr),La=qi(function(t,e){return t>=e}),Va=Er(function(){return arguments}())?Er:function(t){return ts(t)&&zt.call(t,"callee")&&!Wt.call(t,"callee")},qa=rt.isArray,$a=ve?Ye(ve):function(t){return ts(t)&&Ir(t)==j};function Ha(t){return null!=t&&Za(t.length)&&!Ja(t)}function Wa(t){return ts(t)&&Ha(t)}var Ga=Be||yu,Ya=me?Ye(me):function(t){return ts(t)&&Ir(t)==m};function Ka(t){if(!ts(t))return!1;var e=Ir(t);return e==g||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!rs(t)}function Ja(t){if(!Qa(t))return!1;var e=Ir(t);return e==b||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Xa(t){return"number"==typeof t&&t==hs(t)}function Za(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function Qa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ts(t){return null!=t&&"object"==typeof t}var es=ge?Ye(ge):function(t){return ts(t)&&po(t)==S};function ns(t){return"number"==typeof t||ts(t)&&Ir(t)==_}function rs(t){if(!ts(t)||Ir(t)!=I)return!1;var e=$t(t);if(null===e)return!0;var n=zt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Tt.call(n)==Dt}var is=be?Ye(be):function(t){return ts(t)&&Ir(t)==C},os=we?Ye(we):function(t){return ts(t)&&po(t)==O};function as(t){return"string"==typeof t||!qa(t)&&ts(t)&&Ir(t)==A}function ss(t){return"symbol"==typeof t||ts(t)&&Ir(t)==k}var us=Se?Ye(Se):function(t){return ts(t)&&Za(t.length)&&!!re[Ir(t)]},cs=qi(Br),ls=qi(function(t,e){return t<=e});function ds(t){if(!t)return[];if(Ha(t))return as(t)?ln(t):Oi(t);if(Xt&&t[Xt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Xt]());var e=po(t);return(e==S?rn:e==O?sn:Us)(t)}function ps(t){return t?(t=ys(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function hs(t){var e=ps(t),n=e%1;return e==e?n?e-n:e:0}function fs(t){return t?or(hs(t),0,p):0}function ys(t){if("number"==typeof t)return t;if(ss(t))return d;if(Qa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Qa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ge(t);var n=ht.test(t);return n||yt.test(t)?se(t.slice(2),n?2:8):pt.test(t)?d:+t}function vs(t){return Ai(t,xs(t))}function ms(t){return null==t?"":ai(t)}var gs=Ei(function(t,e){if(So(e)||Ha(e))Ai(e,js(e),t);else for(var n in e)zt.call(e,n)&&Qn(t,n,e[n])}),bs=Ei(function(t,e){Ai(e,xs(e),t)}),ws=Ei(function(t,e,n,r){Ai(e,xs(e),t,r)}),Ss=Ei(function(t,e,n,r){Ai(e,js(e),t,r)}),_s=Qi(ir),Is=Gr(function(t,e){t=Pt(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&mo(e[0],e[1],o)&&(i=1);++n<i;)for(var a=e[n],s=xs(a),u=-1,c=s.length;++u<c;){var l=s[u],d=t[l];(d===r||Ua(d,jt[l])&&!zt.call(t,l))&&(t[l]=a[l])}return t}),Ps=Gr(function(t){return t.push(r,Ji),_e(zs,r,t)});function Cs(t,e,n){var i=null==t?r:Sr(t,e);return i===r?n:i}function Os(t,e){return null!=t&&ho(t,e,Or)}var As=Mi(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Nt.call(e)),t[e]=n},Qs(nu)),ks=Mi(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Nt.call(e)),zt.call(t,e)?t[e].push(n):t[e]=[n]},oo),Es=Gr(kr);function js(t){return Ha(t)?Yn(t):Fr(t)}function xs(t){return Ha(t)?Yn(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var n in Pt(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&zt.call(t,r))&&n.push(r);return n}(t)}var Ts=Ei(function(t,e,n){Ur(t,e,n)}),zs=Ei(function(t,e,n,r){Ur(t,e,n,r)}),Fs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=vi(e,t),r||(r=e.length>1),e}),Ai(t,eo(t),n),r&&(n=ar(n,7,Xi));for(var i=e.length;i--;)ui(n,e[i]);return n}),Bs=Qi(function(t,e){return null==t?{}:function(t,e){return Vr(t,e,function(e,n){return Os(t,n)})}(t,e)});function Ns(t,e){if(null==t)return{};var n=je(eo(t),function(t){return[t]});return e=oo(e),Vr(t,n,function(t,n){return e(t,n[0])})}var Ds=Gi(js),Ms=Gi(xs);function Us(t){return null==t?[]:Ke(t,js(t))}var Rs=zi(function(t,e,n){return e=e.toLowerCase(),t+(n?Ls(e):e)});function Ls(t){return Ks(ms(t).toLowerCase())}function Vs(t){return(t=ms(t))&&t.replace(mt,Qe).replace(Jt,"")}var qs=zi(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),$s=zi(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Hs=Ti("toLowerCase"),Ws=zi(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),Gs=zi(function(t,e,n){return t+(n?" ":"")+Ks(e)}),Ys=zi(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Ks=Ti("toUpperCase");function Js(t,e,n){return t=ms(t),(e=n?r:e)===r?function(t){return te.test(t)}(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.match(st)||[]}(t):t.match(e)||[]}var Xs=Gr(function(t,e){try{return _e(t,r,e)}catch(t){return Ka(t)?t:new St(t)}}),Zs=Qi(function(t,e){return Pe(e,function(e){e=No(e),rr(t,e,ka(t[e],t))}),t});function Qs(t){return function(){return t}}var tu=Ni(),eu=Ni(!0);function nu(t){return t}function ru(t){return zr("function"==typeof t?t:ar(t,1))}var iu=Gr(function(t,e){return function(n){return kr(n,t,e)}}),ou=Gr(function(t,e){return function(n){return kr(t,n,e)}});function au(t,e,n){var r=js(e),i=wr(e,r);null!=n||Qa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=wr(e,js(e)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(t);return Pe(i,function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,xe([this.value()],arguments))})}),t}function su(){}var uu=Ri(je),cu=Ri(Oe),lu=Ri(Fe);function du(t){return go(t)?Ve(No(t)):function(t){return function(e){return Sr(e,t)}}(t)}var pu=Vi(),hu=Vi(!0);function fu(){return[]}function yu(){return!1}var vu,mu=Ui(function(t,e){return t+e},0),gu=Hi("ceil"),bu=Ui(function(t,e){return t/e},1),wu=Hi("floor"),Su=Ui(function(t,e){return t*e},1),_u=Hi("round"),Iu=Ui(function(t,e){return t-e},0);return Mn.after=function(t,e){if("function"!=typeof e)throw new At(i);return t=hs(t),function(){if(--t<1)return e.apply(this,arguments)}},Mn.ary=Oa,Mn.assign=gs,Mn.assignIn=bs,Mn.assignInWith=ws,Mn.assignWith=Ss,Mn.at=_s,Mn.before=Aa,Mn.bind=ka,Mn.bindAll=Zs,Mn.bindKey=Ea,Mn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Mn.chain=da,Mn.chunk=function(t,e,n){e=(n?mo(t,e,n):e===r)?1:vn(hs(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=rt(pe(i/e));o<i;)s[a++]=ti(t,o,o+=e);return s},Mn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Mn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=rt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return xe(qa(n)?Oi(n):[n],yr(e,1))},Mn.cond=function(t){var e=null==t?0:t.length,n=oo();return t=e?je(t,function(t){if("function"!=typeof t[1])throw new At(i);return[n(t[0]),t[1]]}):[],Gr(function(n){for(var r=-1;++r<e;){var i=t[r];if(_e(i[0],this,n))return _e(i[1],this,n)}})},Mn.conforms=function(t){return function(t){var e=js(t);return function(n){return sr(n,t,e)}}(ar(t,1))},Mn.constant=Qs,Mn.countBy=fa,Mn.create=function(t,e){var n=Un(t);return null==e?n:nr(n,e)},Mn.curry=function t(e,n,i){var o=Yi(e,8,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Mn.curryRight=function t(e,n,i){var o=Yi(e,16,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Mn.debounce=ja,Mn.defaults=Is,Mn.defaultsDeep=Ps,Mn.defer=xa,Mn.delay=Ta,Mn.difference=Uo,Mn.differenceBy=Ro,Mn.differenceWith=Lo,Mn.drop=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=n||e===r?1:hs(e))<0?0:e,i):[]},Mn.dropRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,0,(e=i-(e=n||e===r?1:hs(e)))<0?0:e):[]},Mn.dropRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0,!0):[]},Mn.dropWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0):[]},Mn.fill=function(t,e,n,i){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&mo(t,e,n)&&(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=hs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:hs(i))<0&&(i+=o),i=n>i?0:fs(i);n<i;)t[n++]=e;return t}(t,e,n,i)):[]},Mn.filter=function(t,e){return(qa(t)?Ae:fr)(t,oo(e,3))},Mn.flatMap=function(t,e){return yr(_a(t,e),1)},Mn.flatMapDeep=function(t,e){return yr(_a(t,e),c)},Mn.flatMapDepth=function(t,e,n){return n=n===r?1:hs(n),yr(_a(t,e),n)},Mn.flatten=$o,Mn.flattenDeep=function(t){return null!=t&&t.length?yr(t,c):[]},Mn.flattenDepth=function(t,e){return null!=t&&t.length?yr(t,e=e===r?1:hs(e)):[]},Mn.flip=function(t){return Yi(t,512)},Mn.flow=tu,Mn.flowRight=eu,Mn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Mn.functions=function(t){return null==t?[]:wr(t,js(t))},Mn.functionsIn=function(t){return null==t?[]:wr(t,xs(t))},Mn.groupBy=ba,Mn.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Mn.intersection=Wo,Mn.intersectionBy=Go,Mn.intersectionWith=Yo,Mn.invert=As,Mn.invertBy=ks,Mn.invokeMap=wa,Mn.iteratee=ru,Mn.keyBy=Sa,Mn.keys=js,Mn.keysIn=xs,Mn.map=_a,Mn.mapKeys=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,e(t,r,i),t)}),n},Mn.mapValues=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,r,e(t,r,i))}),n},Mn.matches=function(t){return Dr(ar(t,1))},Mn.matchesProperty=function(t,e){return Mr(t,ar(e,1))},Mn.memoize=za,Mn.merge=Ts,Mn.mergeWith=zs,Mn.method=iu,Mn.methodOf=ou,Mn.mixin=au,Mn.negate=Fa,Mn.nthArg=function(t){return t=hs(t),Gr(function(e){return Rr(e,t)})},Mn.omit=Fs,Mn.omitBy=function(t,e){return Ns(t,Fa(oo(e)))},Mn.once=function(t){return Aa(2,t)},Mn.orderBy=function(t,e,n,i){return null==t?[]:(qa(e)||(e=null==e?[]:[e]),qa(n=i?r:n)||(n=null==n?[]:[n]),Lr(t,e,n))},Mn.over=uu,Mn.overArgs=Ba,Mn.overEvery=cu,Mn.overSome=lu,Mn.partial=Na,Mn.partialRight=Da,Mn.partition=Ia,Mn.pick=Bs,Mn.pickBy=Ns,Mn.property=du,Mn.propertyOf=function(t){return function(e){return null==t?r:Sr(t,e)}},Mn.pull=Jo,Mn.pullAll=Xo,Mn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,oo(n,2)):t},Mn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,r,n):t},Mn.pullAt=Zo,Mn.range=pu,Mn.rangeRight=hu,Mn.rearg=Ma,Mn.reject=function(t,e){return(qa(t)?Ae:fr)(t,Fa(oo(e,3)))},Mn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=oo(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return $r(t,i),n},Mn.rest=function(t,e){if("function"!=typeof t)throw new At(i);return Gr(t,e=e===r?e:hs(e))},Mn.reverse=Qo,Mn.sampleSize=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),(qa(t)?Jn:Kr)(t,e)},Mn.set=function(t,e,n){return null==t?t:Jr(t,e,n)},Mn.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:Jr(t,e,n,i)},Mn.shuffle=function(t){return(qa(t)?Xn:Qr)(t)},Mn.slice=function(t,e,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&mo(t,e,n)?(e=0,n=i):(e=null==e?0:hs(e),n=n===r?i:hs(n)),ti(t,e,n)):[]},Mn.sortBy=Pa,Mn.sortedUniq=function(t){return t&&t.length?ii(t):[]},Mn.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Mn.split=function(t,e,n){return n&&"number"!=typeof n&&mo(t,e,n)&&(e=n=r),(n=n===r?p:n>>>0)?(t=ms(t))&&("string"==typeof e||null!=e&&!is(e))&&!(e=ai(e))&&nn(t)?gi(ln(t),0,n):t.split(e,n):[]},Mn.spread=function(t,e){if("function"!=typeof t)throw new At(i);return e=null==e?0:vn(hs(e),0),Gr(function(n){var r=n[e],i=gi(n,0,e);return r&&xe(i,r),_e(t,this,i)})},Mn.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Mn.take=function(t,e,n){return t&&t.length?ti(t,0,(e=n||e===r?1:hs(e))<0?0:e):[]},Mn.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=i-(e=n||e===r?1:hs(e)))<0?0:e,i):[]},Mn.takeRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!1,!0):[]},Mn.takeWhile=function(t,e){return t&&t.length?li(t,oo(e,3)):[]},Mn.tap=function(t,e){return e(t),t},Mn.throttle=function(t,e,n){var r=!0,o=!0;if("function"!=typeof t)throw new At(i);return Qa(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ja(t,e,{leading:r,maxWait:e,trailing:o})},Mn.thru=pa,Mn.toArray=ds,Mn.toPairs=Ds,Mn.toPairsIn=Ms,Mn.toPath=function(t){return qa(t)?je(t,No):ss(t)?[t]:Oi(Bo(ms(t)))},Mn.toPlainObject=vs,Mn.transform=function(t,e,n){var r=qa(t),i=r||Ga(t)||us(t);if(e=oo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Qa(t)&&Ja(o)?Un($t(t)):{}}return(i?Pe:gr)(t,function(t,r,i){return e(n,t,r,i)}),n},Mn.unary=function(t){return Oa(t,1)},Mn.union=ta,Mn.unionBy=ea,Mn.unionWith=na,Mn.uniq=function(t){return t&&t.length?si(t):[]},Mn.uniqBy=function(t,e){return t&&t.length?si(t,oo(e,2)):[]},Mn.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?si(t,r,e):[]},Mn.unset=function(t,e){return null==t||ui(t,e)},Mn.unzip=ra,Mn.unzipWith=ia,Mn.update=function(t,e,n){return null==t?t:ci(t,e,yi(n))},Mn.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ci(t,e,yi(n),i)},Mn.values=Us,Mn.valuesIn=function(t){return null==t?[]:Ke(t,xs(t))},Mn.without=oa,Mn.words=Js,Mn.wrap=function(t,e){return Na(yi(e),t)},Mn.xor=aa,Mn.xorBy=sa,Mn.xorWith=ua,Mn.zip=ca,Mn.zipObject=function(t,e){return hi(t||[],e||[],Qn)},Mn.zipObjectDeep=function(t,e){return hi(t||[],e||[],Jr)},Mn.zipWith=la,Mn.entries=Ds,Mn.entriesIn=Ms,Mn.extend=bs,Mn.extendWith=ws,au(Mn,Mn),Mn.add=mu,Mn.attempt=Xs,Mn.camelCase=Rs,Mn.capitalize=Ls,Mn.ceil=gu,Mn.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ys(n))==n?n:0),e!==r&&(e=(e=ys(e))==e?e:0),or(ys(t),e,n)},Mn.clone=function(t){return ar(t,4)},Mn.cloneDeep=function(t){return ar(t,5)},Mn.cloneDeepWith=function(t,e){return ar(t,5,e="function"==typeof e?e:r)},Mn.cloneWith=function(t,e){return ar(t,4,e="function"==typeof e?e:r)},Mn.conformsTo=function(t,e){return null==e||sr(t,e,js(e))},Mn.deburr=Vs,Mn.defaultTo=function(t,e){return null==t||t!=t?e:t},Mn.divide=bu,Mn.endsWith=function(t,e,n){t=ms(t),e=ai(e);var i=t.length,o=n=n===r?i:or(hs(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Mn.eq=Ua,Mn.escape=function(t){return(t=ms(t))&&G.test(t)?t.replace(H,tn):t},Mn.escapeRegExp=function(t){return(t=ms(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Mn.every=function(t,e,n){var i=qa(t)?Oe:pr;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Mn.find=ya,Mn.findIndex=Vo,Mn.findKey=function(t,e){return Ne(t,oo(e,3),gr)},Mn.findLast=va,Mn.findLastIndex=qo,Mn.findLastKey=function(t,e){return Ne(t,oo(e,3),br)},Mn.floor=wu,Mn.forEach=ma,Mn.forEachRight=ga,Mn.forIn=function(t,e){return null==t?t:vr(t,oo(e,3),xs)},Mn.forInRight=function(t,e){return null==t?t:mr(t,oo(e,3),xs)},Mn.forOwn=function(t,e){return t&&gr(t,oo(e,3))},Mn.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Mn.get=Cs,Mn.gt=Ra,Mn.gte=La,Mn.has=function(t,e){return null!=t&&ho(t,e,Cr)},Mn.hasIn=Os,Mn.head=Ho,Mn.identity=nu,Mn.includes=function(t,e,n,r){t=Ha(t)?t:Us(t),n=n&&!r?hs(n):0;var i=t.length;return n<0&&(n=vn(i+n,0)),as(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Me(t,e,n)>-1},Mn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=vn(r+i,0)),Me(t,e,i)},Mn.inRange=function(t,e,n){return e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n){return t>=mn(e,n)&&t<vn(e,n)}(t=ys(t),e,n)},Mn.invoke=Es,Mn.isArguments=Va,Mn.isArray=qa,Mn.isArrayBuffer=$a,Mn.isArrayLike=Ha,Mn.isArrayLikeObject=Wa,Mn.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Ir(t)==v},Mn.isBuffer=Ga,Mn.isDate=Ya,Mn.isElement=function(t){return ts(t)&&1===t.nodeType&&!rs(t)},Mn.isEmpty=function(t){if(null==t)return!0;if(Ha(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||us(t)||Va(t)))return!t.length;var e=po(t);if(e==S||e==O)return!t.size;if(So(t))return!Fr(t).length;for(var n in t)if(zt.call(t,n))return!1;return!0},Mn.isEqual=function(t,e){return jr(t,e)},Mn.isEqualWith=function(t,e,n){var i=(n="function"==typeof n?n:r)?n(t,e):r;return i===r?jr(t,e,r,n):!!i},Mn.isError=Ka,Mn.isFinite=function(t){return"number"==typeof t&&qe(t)},Mn.isFunction=Ja,Mn.isInteger=Xa,Mn.isLength=Za,Mn.isMap=es,Mn.isMatch=function(t,e){return t===e||xr(t,e,so(e))},Mn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,xr(t,e,so(e),n)},Mn.isNaN=function(t){return ns(t)&&t!=+t},Mn.isNative=function(t){if(wo(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(t)},Mn.isNil=function(t){return null==t},Mn.isNull=function(t){return null===t},Mn.isNumber=ns,Mn.isObject=Qa,Mn.isObjectLike=ts,Mn.isPlainObject=rs,Mn.isRegExp=is,Mn.isSafeInteger=function(t){return Xa(t)&&t>=-9007199254740991&&t<=l},Mn.isSet=os,Mn.isString=as,Mn.isSymbol=ss,Mn.isTypedArray=us,Mn.isUndefined=function(t){return t===r},Mn.isWeakMap=function(t){return ts(t)&&po(t)==E},Mn.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Ir(t)},Mn.join=function(t,e){return null==t?"":fn.call(t,e)},Mn.kebabCase=qs,Mn.last=Ko,Mn.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=hs(n))<0?vn(i+o,0):mn(o,i-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):De(t,Re,o,!0)},Mn.lowerCase=$s,Mn.lowerFirst=Hs,Mn.lt=cs,Mn.lte=ls,Mn.max=function(t){return t&&t.length?hr(t,nu,Pr):r},Mn.maxBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Pr):r},Mn.mean=function(t){return Le(t,nu)},Mn.meanBy=function(t,e){return Le(t,oo(e,2))},Mn.min=function(t){return t&&t.length?hr(t,nu,Br):r},Mn.minBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Br):r},Mn.stubArray=fu,Mn.stubFalse=yu,Mn.stubObject=function(){return{}},Mn.stubString=function(){return""},Mn.stubTrue=function(){return!0},Mn.multiply=Su,Mn.nth=function(t,e){return t&&t.length?Rr(t,hs(e)):r},Mn.noConflict=function(){return le._===this&&(le._=Mt),this},Mn.noop=su,Mn.now=Ca,Mn.pad=function(t,e,n){t=ms(t);var r=(e=hs(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(pe(i),n)},Mn.padEnd=function(t,e,n){t=ms(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?t+Li(e-r,n):t},Mn.padStart=function(t,e,n){t=ms(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?Li(e-r,n)+t:t},Mn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(ms(t).replace(nt,""),e||0)},Mn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&mo(t,e,n)&&(e=n=r),n===r&&("boolean"==typeof e?(n=e,e=r):"boolean"==typeof t&&(n=t,t=r)),t===r&&e===r?(t=0,e=1):(t=ps(t),e===r?(e=t,t=0):e=ps(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=wn();return mn(t+o*(e-t+ae("1e-"+((o+"").length-1))),e)}return Hr(t,e)},Mn.reduce=function(t,e,n){var r=qa(t)?Te:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,lr)},Mn.reduceRight=function(t,e,n){var r=qa(t)?ze:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,dr)},Mn.repeat=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),Wr(ms(t),e)},Mn.replace=function(){var t=arguments,e=ms(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Mn.result=function(t,e,n){var i=-1,o=(e=vi(e,t)).length;for(o||(o=1,t=r);++i<o;){var a=null==t?r:t[No(e[i])];a===r&&(i=o,a=n),t=Ja(a)?a.call(t):a}return t},Mn.round=_u,Mn.runInContext=t,Mn.sample=function(t){return(qa(t)?Kn:Yr)(t)},Mn.size=function(t){if(null==t)return 0;if(Ha(t))return as(t)?cn(t):t.length;var e=po(t);return e==S||e==O?t.size:Fr(t).length},Mn.snakeCase=Ws,Mn.some=function(t,e,n){var i=qa(t)?Fe:ei;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Mn.sortedIndex=function(t,e){return ni(t,e)},Mn.sortedIndexBy=function(t,e,n){return ri(t,e,oo(n,2))},Mn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=ni(t,e);if(r<n&&Ua(t[r],e))return r}return-1},Mn.sortedLastIndex=function(t,e){return ni(t,e,!0)},Mn.sortedLastIndexBy=function(t,e,n){return ri(t,e,oo(n,2),!0)},Mn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ni(t,e,!0)-1;if(Ua(t[n],e))return n}return-1},Mn.startCase=Gs,Mn.startsWith=function(t,e,n){return t=ms(t),n=null==n?0:or(hs(n),0,t.length),e=ai(e),t.slice(n,n+e.length)==e},Mn.subtract=Iu,Mn.sum=function(t){return t&&t.length?He(t,nu):0},Mn.sumBy=function(t,e){return t&&t.length?He(t,oo(e,2)):0},Mn.template=function(t,e,n){var i=Mn.templateSettings;n&&mo(t,e,n)&&(e=r),t=ms(t),e=ws({},e,i,Ki);var o,a,s=ws({},e.imports,i.imports,Ki),u=js(s),c=Ke(s,u),l=0,d=e.interpolate||gt,p="__p += '",h=Ct((e.escape||gt).source+"|"+d.source+"|"+(d===J?lt:gt).source+"|"+(e.evaluate||gt).source+"|$","g"),f="//# sourceURL="+(zt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(h,function(e,n,r,i,s,u){return r||(r=i),p+=t.slice(l,u).replace(bt,en),n&&(o=!0,p+="' +\n__e("+n+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),p+="';\n";var y=zt.call(e,"variable")&&e.variable;if(y){if(ut.test(y))throw new St("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(a?p.replace(L,""):p).replace(V,"$1").replace(q,"$1;"),p="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var v=Xs(function(){return _t(u,f+"return "+p).apply(r,c)});if(v.source=p,Ka(v))throw v;return v},Mn.times=function(t,e){if((t=hs(t))<1||t>l)return[];var n=p,r=mn(t,p);e=oo(e),t-=p;for(var i=We(r,e);++n<t;)e(n);return i},Mn.toFinite=ps,Mn.toInteger=hs,Mn.toLength=fs,Mn.toLower=function(t){return ms(t).toLowerCase()},Mn.toNumber=ys,Mn.toSafeInteger=function(t){return t?or(hs(t),-9007199254740991,l):0===t?t:0},Mn.toString=ms,Mn.toUpper=function(t){return ms(t).toUpperCase()},Mn.trim=function(t,e,n){if((t=ms(t))&&(n||e===r))return Ge(t);if(!t||!(e=ai(e)))return t;var i=ln(t),o=ln(e);return gi(i,Xe(i,o),Ze(i,o)+1).join("")},Mn.trimEnd=function(t,e,n){if((t=ms(t))&&(n||e===r))return t.slice(0,dn(t)+1);if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,0,Ze(i,ln(e))+1).join("")},Mn.trimStart=function(t,e,n){if((t=ms(t))&&(n||e===r))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,Xe(i,ln(e))).join("")},Mn.truncate=function(t,e){var n=30,i="...";if(Qa(e)){var o="separator"in e?e.separator:o;n="length"in e?hs(e.length):n,i="omission"in e?ai(e.omission):i}var a=(t=ms(t)).length;if(nn(t)){var s=ln(t);a=s.length}if(n>=a)return t;var u=n-cn(i);if(u<1)return i;var c=s?gi(s,0,u).join(""):t.slice(0,u);if(o===r)return c+i;if(s&&(u+=c.length-u),is(o)){if(t.slice(u).search(o)){var l,d=c;for(o.global||(o=Ct(o.source,ms(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var p=l.index;c=c.slice(0,p===r?u:p)}}else if(t.indexOf(ai(o),u)!=u){var h=c.lastIndexOf(o);h>-1&&(c=c.slice(0,h))}return c+i},Mn.unescape=function(t){return(t=ms(t))&&W.test(t)?t.replace($,pn):t},Mn.uniqueId=function(t){var e=++Ft;return ms(t)+e},Mn.upperCase=Ys,Mn.upperFirst=Ks,Mn.each=ma,Mn.eachRight=ga,Mn.first=Ho,au(Mn,(vu={},gr(Mn,function(t,e){zt.call(Mn.prototype,e)||(vu[e]=t)}),vu),{chain:!1}),Mn.VERSION="4.17.21",Pe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Mn[t].placeholder=Mn}),Pe(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:vn(hs(n),0);var i=this.__filtered__&&!e?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=mn(n,i.__takeCount__):i.__views__.push({size:mn(n,p),type:t+(i.__dir__<0?"Right":"")}),i},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Pe(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;Vn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:oo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Pe(["head","last"],function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}}),Pe(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");Vn.prototype[t]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(nu)},Vn.prototype.find=function(t){return this.filter(t).head()},Vn.prototype.findLast=function(t){return this.reverse().find(t)},Vn.prototype.invokeMap=Gr(function(t,e){return"function"==typeof t?new Vn(this):this.map(function(n){return kr(n,t,e)})}),Vn.prototype.reject=function(t){return this.filter(Fa(oo(t)))},Vn.prototype.slice=function(t,e){t=hs(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Vn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=hs(e))<0?n.dropRight(-e):n.take(e-t)),n)},Vn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Vn.prototype.toArray=function(){return this.take(p)},gr(Vn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Mn[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(Mn.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,u=e instanceof Vn,c=s[0],l=u||qa(e),d=function(t){var e=o.apply(Mn,xe([t],s));return i&&p?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=u&&!h;if(!a&&l){e=y?e:new Vn(this);var v=t.apply(e,s);return v.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(v,p)}return f&&y?t.apply(this,s):(v=this.thru(d),f?i?v.value()[0]:v.value():v)})}),Pe(["pop","push","shift","sort","splice","unshift"],function(t){var e=kt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Mn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(qa(i)?i:[],t)}return this[n](function(n){return e.apply(qa(n)?n:[],t)})}}),gr(Vn.prototype,function(t,e){var n=Mn[e];if(n){var r=n.name+"";zt.call(En,r)||(En[r]=[]),En[r].push({name:e,func:n})}}),En[Di(r,2).name]=[{name:"wrapper",func:r}],Vn.prototype.clone=function(){var t=new Vn(this.__wrapped__);return t.__actions__=Oi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Oi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Oi(this.__views__),t},Vn.prototype.reverse=function(){if(this.__filtered__){var t=new Vn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Vn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=qa(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=mn(e,t+a);break;case"takeRight":t=vn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,d=l.length,p=0,h=mn(u,this.__takeCount__);if(!n||!r&&i==u&&h==u)return di(t,this.__actions__);var f=[];t:for(;u--&&p<h;){for(var y=-1,v=t[c+=e];++y<d;){var m=l[y],g=m.iteratee,b=m.type,w=g(v);if(2==b)v=w;else if(!w){if(1==b)continue t;break t}}f[p++]=v}return f},Mn.prototype.at=ha,Mn.prototype.chain=function(){return da(this)},Mn.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Mn.prototype.next=function(){this.__values__===r&&(this.__values__=ds(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Mn.prototype.plant=function(t){for(var e,n=this;n instanceof Rn;){var i=Mo(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Mn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Vn){var e=t;return this.__actions__.length&&(e=new Vn(this)),(e=e.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:r}),new Ln(e,this.__chain__)}return this.thru(Qo)},Mn.prototype.toJSON=Mn.prototype.valueOf=Mn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Mn.prototype.first=Mn.prototype.head,Xt&&(Mn.prototype[Xt]=function(){return this}),Mn}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(le._=hn,define(function(){return hn})):pe?((pe.exports=hn)._=hn,de._=hn):le._=hn}.call(this)},9722:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(7995);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},9783:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.joinPaths=e.isAbsoluteUrl=void 0,e.isAbsoluteUrl=function(t){return/^https?:\/\//.test(t)},e.joinPaths=function(t,e){return"".concat((n=t,n.replace(/\/$/,"")),"/").concat(function(t){return t.replace(/^\//,"")}(e));var n}},9828:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.build=function(t,e,n){var r=this,i=document.createElement("form");return i.style.display="none",i.setAttribute("action",t),i.setAttribute("method","POST"),i.setAttribute("target",n||"_top"),Object.keys(e).forEach(function(t){var n=e[t];i.appendChild(r._createInput(n,t))}),i},t.prototype._createInput=function(t,e){var n=document.createElement("input");return n.setAttribute("name",e),n.setAttribute("type","hidden"),n.setAttribute("value",t),n},t}();e.default=n}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};(()=>{"use strict";n.r(r),n.d(r,{createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>It,createPayPalCommerceButtonStrategy:()=>le,createPayPalCommerceCreditButtonStrategy:()=>he,createPayPalCommerceCreditCardsPaymentStrategy:()=>Ut,createPayPalCommerceCreditCustomerStrategy:()=>ne,createPayPalCommerceCreditPaymentStrategy:()=>et,createPayPalCommerceCustomerStrategy:()=>Qt,createPayPalCommerceFastlaneCustomerStrategy:()=>ue,createPayPalCommerceFastlanePaymentStrategy:()=>Yt,createPayPalCommercePaymentStrategy:()=>X,createPayPalCommerceRatePayPaymentStrategy:()=>Vt,createPayPalCommerceVenmoButtonStrategy:()=>ve,createPayPalCommerceVenmoCustomerStrategy:()=>oe,createPayPalCommerceVenmoPaymentStrategy:()=>gt});var t=n(315);function e(t,e){return Object.assign(t,{resolveIds:e})}var i,o=n(8686),a=n(4043);class s extends Error{constructor(t){var e;super(t||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",e=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class u extends s{constructor(t){super(t||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}!function(t){t[t.MissingBillingAddress=0]="MissingBillingAddress",t[t.MissingCart=1]="MissingCart",t[t.MissingCheckout=2]="MissingCheckout",t[t.MissingConsignments=3]="MissingConsignments",t[t.MissingCustomer=4]="MissingCustomer",t[t.MissingCheckoutConfig=5]="MissingCheckoutConfig",t[t.MissingOrder=6]="MissingOrder",t[t.MissingOrderConfig=7]="MissingOrderConfig",t[t.MissingOrderId=8]="MissingOrderId",t[t.MissingPayment=9]="MissingPayment",t[t.MissingPaymentId=10]="MissingPaymentId",t[t.MissingPaymentInstrument=11]="MissingPaymentInstrument",t[t.MissingPaymentMethod=12]="MissingPaymentMethod",t[t.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",t[t.MissingPaymentStatus=14]="MissingPaymentStatus",t[t.MissingPaymentToken=15]="MissingPaymentToken",t[t.MissingShippingAddress=16]="MissingShippingAddress"}(i||(i={}));class c extends s{constructor(t){super(function(t){switch(t){case i.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case i.MissingCart:return"Unable to proceed because cart data is unavailable.";case i.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case i.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case i.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case i.MissingCheckoutConfig:case i.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case i.MissingOrder:return"Unable to proceed because order data is unavailable.";case i.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case i.MissingPayment:return"Unable to proceed because payment data is unavailable.";case i.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case i.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case i.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(t)),this.subtype=t,this.name="MissingDataError",this.type="missing_data"}}var l=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class d{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return l(this,void 0,void 0,function*(){if(!this.window.paypal||r){const r=this.getPayPalSdkScriptConfigOrThrow(t,e,n);if(yield this.loadPayPalSdk(r),!this.window.paypal)throw new u}return this.window.paypal})}getPayPalFastlaneSdk(t,e,n){return l(this,void 0,void 0,function*(){if(!this.window.paypalFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(t,e,n);if(yield this.loadPayPalSdk(r),!this.window.paypalFastlaneSdk)throw new u}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return l(this,void 0,void 0,function*(){if(!this.window.paypalGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalGooglePay)throw new u;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return l(this,void 0,void 0,function*(){if(!this.window.paypalApms){const n=this.getPayPalApmSdkConfiguration(t,e);if(yield this.loadPayPalSdk(n),!this.window.paypalApms)throw new u}return this.window.paypalApms})}getPayPalMessages(t,e){return l(this,void 0,void 0,function*(){if(!this.window.paypalMessages){const n=this.getPayPalSdkMessagesConfiguration(t,e);yield this.loadPayPalSdk(n)}if(!this.window.paypalMessages)throw new u;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return l(this,void 0,void 0,function*(){const n=this.transformConfig(t),r=this.transformConfig(e),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalSdkScriptConfigOrThrow(t,e,n=!0){const{id:r,clientToken:o,initializationData:a}=t;if(!a||!a.clientId)throw new c(i.MissingPaymentMethod);const{intent:s,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:v,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:g=[],isGooglePayEnabled:b}=a,w=f||n,S="paypalcommercecreditcards"===r||"bigcommerce_payments_creditcards"===r,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=n?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!g.includes(t))],k=[..._,...I,...P,...g];return{options:Object.assign({"client-id":u,"merchant-id":l,"enable-funding":k.length>0?k:void 0,"disable-funding":A.length>0?A:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...C,...O],currency:e,intent:s},v&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}getPayPalFastlaneSdkConfiguration(t,e,n){const{clientToken:r,initializationData:o}=t;if(!o||!o.clientId)throw new c(i.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:u,attributionId:l}=o;return{options:{"client-id":s,"merchant-id":u,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:e,intent:a},attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":r}}}getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n=!0){const{clientToken:r,initializationData:o}=t;if(!o||!o.clientId)throw new c(i.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||n;return{options:Object.assign({"client-id":s,"merchant-id":u,commit:f,components:["googlepay"],currency:e,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":r,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new c(i.MissingPaymentMethod);const{intent:r,clientId:o,merchantId:a,buyerCountry:s,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=n,h=p,f=d.filter(t=>!p.includes(t));return{options:Object.assign({"client-id":o,"merchant-id":a,"enable-funding":h.length>0?h:void 0,"disable-funding":f.length>0?f:void 0,commit:!0,components:["buttons","payment-fields"],currency:e,intent:r},l&&{"buyer-country":s}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new c(i.MissingPaymentMethod);const{clientId:r,merchantId:o,attributionId:a,isDeveloperModeApplicable:s,buyerCountry:u}=n;return{options:Object.assign({"client-id":r,"merchant-id":o,components:["messages"],currency:e},s&&{"buyer-country":u}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":a}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}function p(){return new d((0,t.Hb)())}var h=n(9440);class f extends s{constructor(t){super(t||"An unexpected error has occurred during buy now cart creation process. Please try again later."),this.name="BuyNowCartCreationError",this.type="buy_now_cart_creation_error"}}const y={body:{},headers:{},status:0};class v extends s{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||y;super(e||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}var m,g,b,w,S,_,I,P,C,O,A;!function(t){t.BuyNow="BUY_NOW"}(m||(m={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(g||(g={})),function(t){t.Always="SCA_ALWAYS"}(b||(b={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(w||(w={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(S||(S={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(_||(_={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(I||(I={})),function(t){t.pill="pill",t.rect="rect"}(P||(P={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(C||(C={})),function(t){t.OXXO="oxxo"}(O||(O={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(A||(A={}));var k=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class E{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalRequestSender=n,this.paypalSdkLoader=r}loadPayPalSdk(t,e,n,r){return k(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=e||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(t);return this.paypalSdk=yield this.paypalSdkLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new u;return this.paypalSdk}createBuyNowCartOrThrow(t){return k(this,void 0,void 0,function*(){const e=t.getBuyNowCartRequestBody();if(!e)throw new c(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(e)}catch(t){throw new f}})}createOrder(t,e){return k(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return k(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(t,e,n){return k(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState(),i=r.getCartOrThrow(),o=r.getConsignmentsOrThrow()[0];try{yield this.paypalRequestSender.updateOrder(t,Object.assign(Object.assign({availableShippingOptions:o.availableShippingOptions,cartId:i.id,selectedShippingOption:o.selectedShippingOption},e?{methodId:e}:{}),n?{orderId:n}:{}))}catch(t){throw new v}})}getOrderStatus(t,e){return k(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(t,e){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!e)throw new c(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:e},n.source===m.BuyNow&&{cart_id:n.id}))}submitPayment(t,e,n){return k(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:t,paypal_account:{order_id:e}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:t,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(t){const e=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=e.availableShippingOptions||[],r=n.find(t=>t.isRecommended),i=(t?n.find(e=>e.id===t):n.find(t=>{if(e.selectedShippingOption){const n=e.selectedShippingOption.id;return t.id===n}return!1}))||r||n[0];if(!i)throw new Error("Your order can't be shipped to this address");return i}getAddress(t){return{firstName:(null==t?void 0:t.firstName)||"",lastName:(null==t?void 0:t.lastName)||"",email:(null==t?void 0:t.email)||"",phone:(null==t?void 0:t.phone)||"",company:"",address1:(null==t?void 0:t.address1)||"",address2:(null==t?void 0:t.address2)||"",city:(null==t?void 0:t.city)||"",countryCode:(null==t?void 0:t.countryCode)||"",postalCode:(null==t?void 0:t.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==t?void 0:t.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:t}){var e,n;return this.getAddress({firstName:t.name.given_name,lastName:t.name.surname,email:t.email_address,address1:t.address.address_line_1,address2:t.address.address_line_2,city:t.address.admin_area_2,countryCode:t.address.country_code,postalCode:t.address.postal_code,stateOrProvinceCode:t.address.admin_area_1,phone:null===(n=null===(e=t.phone)||void 0===e?void 0:e.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(t){const{payer:e,purchase_units:n}=t,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:e.email_address,address1:r.address_line_1,address2:r.address_line_2,city:r.admin_area_2,countryCode:r.country_code,postalCode:r.postal_code,stateOrProvinceCode:r.admin_area_1})}getValidButtonStyle(t={}){const{color:e,height:n,label:r,shape:i}=t,o={color:e&&I[e]?e:void 0,height:this.getValidHeight(n),label:r&&_[r]?r:void 0,shape:i&&P[i]?i:void 0};return(0,h.omitBy)(o,h.isNil)}getValidHeight(t){return t&&"number"==typeof t?t>55?55:t<25?25:t:40}removeElement(t){const e=t&&document.getElementById(t);e&&(e.style.display="none")}}const j="This API endpoint is for internal use only and may change in the future";var x;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(x||(x={}));const T=x,z={"X-Checkout-SDK-Version":"1.898.4"};var F=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class B{constructor(t){this.requestSender=t}createOrder(t,e){return F(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t,e){return F(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.put(n,{headers:i,body:r})).body})}getOrderStatus(t,e){return F(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}const N=t=>{const{getHost:e}=t.getState();return new E((0,o.createFormPoster)(),t,new B((0,a.createRequestSender)({host:e()})),p())},D={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"},M={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},U="embedded-checkout-loading-indicator-rotation";class R{constructor(t){this.styles=Object.assign(Object.assign({},M),t&&t.styles),this.containerStyles=Object.assign({},t&&t.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(t){if(t){const e=document.getElementById(t);if(!e)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");e.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const t=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",t)};this.container.addEventListener("transitionend",t),this.container.style.opacity="0"}buildContainer(){const t=document.createElement("div");return t.style.display="block",t.style.bottom="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.position="absolute",t.style.right="0",t.style.top="0",t.style.transition="all 250ms ease-out",t.style.opacity="0",this.setStyleAttribute(t,this.containerStyles),t}buildIndicator(){const t=document.createElement("div");return t.style.display="block",t.style.width=`${this.styles.size}px`,t.style.height=`${this.styles.size}px`,t.style.borderRadius=`${this.styles.size}px`,t.style.border="solid 1px",t.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,t.style.margin="0 auto",t.style.position="absolute",t.style.left="0",t.style.right="0",t.style.top="50%",t.style.transform="translateY(-50%) rotate(0deg)",t.style.transformStyle="preserve-3d",t.style.animation=`${U} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,t}setStyleAttribute(t,e){Object.keys(e).forEach(n=>{t.style.setProperty(n,e[n])})}defineAnimation(){var t;if(document.getElementById(U))return;const e=document.createElement("style");e.id=U,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${U} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}class L extends s{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class V extends L{constructor(t){let e="Unable to submit payment for the order because the payload is invalid.";t&&(e=`${e} Make sure the following fields are provided correctly: ${t.join(", ")}.`),super(e),this.name="PaymentArgumentInvalidError"}}class q extends v{constructor(t){super(t,{message:"There is a problem processing your payment. Please try again later."}),this.name="PaymentMethodInvalidError",this.type="payment_method_invalid"}}class $ extends s{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function H(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function W(t){return Boolean(t.instrumentId)}const G=function({styles:t}){const e={};return t.color&&(e.color=t.color),t.layout&&(e.layout=t.layout),(t["logo-type"]||t["logo-position"])&&(e.logo={},t["logo-type"]&&(e.logo.type=t["logo-type"]),t["logo-position"]&&(e.logo.position=t["logo-position"])),t.ratio&&(e.ratio=t.ratio),(t["text-color"]||t["text-size"])&&(e.text={},t["text-color"]&&(e.text.color=t["text-color"]),t["text-size"]&&(e.text.size=+t["text-size"])),e};function Y(t){return"object"==typeof t&&null!==t&&"bigpayToken"in t&&"defaultInstrument"in t&&"provider"in t&&"trustedShippingAddress"in t&&"method"in t&&"type"in t}var K=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class J{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.payPalSdkScriptLoader=n,this.loadingIndicator=r}initialize(t){var e;return K(this,void 0,void 0,function*(){const{methodId:n,paypalcommerce:r}=t||{};if(this.paypalcommerce=r,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(n);const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n),{container:a,bannerContainerId:s}=r,{orderId:u,paypalBNPLConfiguration:c=[],isPayPalCreditAvailable:l}=o.initializationData||{};if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const t=null==c?void 0:c.find(({id:t})=>"checkout"===t);if(l||!(null==t?void 0:t.status))return;const e=yield this.payPalSdkScriptLoader.getPayPalMessages(o,i.getCartOrThrow().currency.code);return e&&"function"==typeof(null==e?void 0:e.Messages)?this.renderMessages(e,s,t):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}u?this.orderId=null===(e=o.initializationData)||void 0===e?void 0:e.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalIntegrationService.loadPayPalSdk(n),r.onInit&&"function"==typeof r.onInit&&r.onInit(()=>this.renderButton(n,r)),(void 0===r.shouldRenderPayPalButtonOnInitialization||r.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(n,r))})}execute(t,e){var n,r;return K(this,void 0,void 0,function*(){const{payment:i}=t,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{onError:a}=this.paypalcommerce||{};if(!i)throw new V(["payment"]);const{methodId:s,paymentData:u}=i;if(this.isPayPalVaultedInstrumentPaymentData(u)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new q;const c=this.isPayPalVaultedInstrumentPaymentData(u)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,u):this.preparePaymentPayload(s,this.orderId,u);try{yield this.paymentIntegrationService.submitOrder(o,e),yield this.paymentIntegrationService.submitPayment(c)}catch(t){if(function(t){var e;return(t=>"object"==typeof t&&null!==t&&"body"in t)(t)&&"offsite_redirect"===(null===(e=t.body.additional_action_required)||void 0===e?void 0:e.type)}(t)){const e=null===(r=null===(n=t.body.additional_action_required)||void 0===n?void 0:n.data)||void 0===r?void 0:r.redirect_url;return new Promise(()=>window.location.replace(e))}return this.isProviderError(t)&&(yield this.paypalIntegrationService.loadPayPalSdk(i.methodId),yield new Promise((t,e)=>{var n;this.paypalcommerce&&(null===(n=this.paypalButton)||void 0===n||n.close(),this.renderButton(i.methodId,this.paypalcommerce),this.handleError(new Error("INSTRUMENT_DECLINED"),a)),e()})),this.handleError(t,a),Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}prepareVaultedInstrumentPaymentPayload(t,e,n){const{instrumentId:r,shouldSetAsDefaultInstrument:i}=n,o=!this.isTrustedVaultingFlow(n);return o?{methodId:t,paymentData:{shouldSaveInstrument:o,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}:{methodId:t,paymentData:{instrumentId:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e},bigpay_token:{token:r}}}}}preparePaymentPayload(t,e,n){const{shouldSaveInstrument:r=!1,shouldSetAsDefaultInstrument:i=!1}=H(n)?n:{};return{methodId:t,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}}renderButton(t,e){var n,r,i,o;const a=this.paypalIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:u}=s.initializationData||{},{checkoutPaymentButtonStyles:c}=u||{},{container:l,onError:d,onRenderButton:p,onValidate:h,submitForm:f}=e;if(!l)throw new L('Unable to initialize payment because "container" argument is not provided.');const y=this.getSmartButtonContainerId(l);if(!document.getElementById(y))throw new L(`Unable to initialize payment because element with id ${y} does not exist.`);const v=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(c),createOrder:()=>this.createOrder(),onClick:(t,e)=>this.handleClick(e,h),onApprove:t=>this.handleApprove(t,f),onError:t=>this.handleError(t,d),onCancel:()=>this.toggleLoadingIndicator(!1)});this.paypalButton=a.Buttons(v),this.paypalButton.isEligible()&&(p&&"function"==typeof p&&p(),(null===(r=(n=this.paypalButton).hasReturned)||void 0===r?void 0:r.call(n))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(o=(i=this.paypalButton).resume)||void 0===o||o.call(i):this.paypalButton.render(l))}handleClick(t,e){return K(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return null==e?void 0:e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,null==e||e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createOrder(){return K(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.paypalIntegrationService.createOrder("paypalcommercecheckout",{shouldSaveInstrument:(null==t?void 0:t.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:t}=this.paypalcommerce||{};return"function"==typeof t?t():void 0}isTrustedVaultingFlow(t){if(t&&W(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>Y(e)&&e.bigpayToken===t.instrumentId);return!(Y(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&W(t)&&H(t)}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:G(n)};t.Messages(r).render(`#${e}`)}isProviderError(t){var e,n,r;return!!function(t){return"object"==typeof t&&null!==t&&"errors"in t}(t)&&"INSTRUMENT_DECLINED"===(null===(r=null===(n=((null===(e=null==t?void 0:t.errors)||void 0===e?void 0:e.filter(t=>t.provider_error))||[])[0])||void 0===n?void 0:n.provider_error)||void 0===r?void 0:r.code)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}getSmartButtonContainerId(t){var e;return null!==(e=t.split("#")[1])&&void 0!==e?e:t}}const X=e(e=>new J(e,N(e),new d((0,t.vQ)()),new R({containerStyles:D})),[{id:"paypalcommerce"}]);class Z extends s{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var Q=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class tt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.loadingIndicator=n,this.payPalSdkScriptLoader=r}initialize(t){return Q(this,void 0,void 0,function*(){const{methodId:e,paypalcommerce:n,paypalcommercecredit:r}=t||{},i=r||n;if(!e)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(e);const o=this.paymentIntegrationService.getState(),a=o.getPaymentMethodOrThrow(e),{paypalBNPLConfiguration:s=[],orderId:u}=a.initializationData||{},{bannerContainerId:c,container:l}=i;if(void 0!==c){if(!document.getElementById(c))return void console.error("Unable to create banner without valid banner container ID.");const t=s&&s.find(({id:t})=>"checkout"===t);if(!(null==t?void 0:t.status))return;const e=yield this.payPalSdkScriptLoader.getPayPalMessages(a,o.getCartOrThrow().currency.code);return this.renderMessages(e,c,t)}u?this.orderId=u:(yield this.paypalIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==l?void 0:l.split("#")[1],this.renderButton(e,i))})}execute(t,e){return Q(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){if(!(null==e?void 0:e.container))throw new L('Unable to initialize payment because "container" argument is not provided.');const n=this.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let p=!1;d.forEach(t=>{if(p)return;const e={fundingSource:t,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecreditcheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(e),this.paypalButton.isEligible()||t!==n.FUNDING.PAYLATER){if(!this.paypalButton.isEligible()&&t===n.FUNDING.CREDIT)throw new Z(`PayPal ${t} is not available for your region. Please use PayPal Checkout instead.`);u&&"function"==typeof u&&u(),this.paypalButton.render(a),p=!0}})}handleClick(t,e){return Q(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;if(e&&"function"==typeof e)return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e&&"function"==typeof e&&e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:G(n)};t.Messages(r).render(`#${e}`)}}const et=e(t=>new tt(t,N(t),new R({containerStyles:D}),p()),[{id:"paypalcommercecredit"}]);var nt,rt,it,ot,at,st,ut;!function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(nt||(nt={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(rt||(rt={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(it||(it={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(ot||(ot={})),function(t){t.pill="pill",t.rect="rect"}(at||(at={})),function(t){t.OXXO="oxxo",t.IDEAL="ideal"}(st||(st={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(ut||(ut={}));var ct=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class lt{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(t,e,n,r){return ct(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=e||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(t);return this.paypalSdk=yield this.paypalCommerceScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new u;return this.paypalSdk}createBuyNowCartOrThrow(t){return ct(this,void 0,void 0,function*(){const e=t.getBuyNowCartRequestBody();if(!e)throw new c(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(e)}catch(t){throw new f}})}createOrder(t,e){return ct(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return ct(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return ct(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getConsignmentsOrThrow()[0];try{yield this.paypalCommerceRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:e.id,selectedShippingOption:n.selectedShippingOption})}catch(t){throw new v}})}getOrderStatus(t,e){return ct(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(t,e){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!e)throw new c(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:e},n.source===m.BuyNow&&{cart_id:n.id}))}submitPayment(t,e,n){return ct(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:t,paypal_account:{order_id:e}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:t,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(t){const e=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=e.availableShippingOptions||[],r=n.find(t=>t.isRecommended),i=(t?n.find(e=>e.id===t):n.find(t=>{var n;return t.id===(null===(n=e.selectedShippingOption)||void 0===n?void 0:n.id)}))||r||n[0];if(!i)throw new Error("Your order can't be shipped to this address");return i}getAddress(t){return{firstName:(null==t?void 0:t.firstName)||"",lastName:(null==t?void 0:t.lastName)||"",email:(null==t?void 0:t.email)||"",phone:(null==t?void 0:t.phone)||"",company:"",address1:(null==t?void 0:t.address1)||"",address2:(null==t?void 0:t.address2)||"",city:(null==t?void 0:t.city)||"",countryCode:(null==t?void 0:t.countryCode)||"",postalCode:(null==t?void 0:t.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==t?void 0:t.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:t}){var e,n;return this.getAddress({firstName:t.name.given_name,lastName:t.name.surname,email:t.email_address,address1:t.address.address_line_1,address2:t.address.address_line_2,city:t.address.admin_area_2,countryCode:t.address.country_code,postalCode:t.address.postal_code,stateOrProvinceCode:t.address.admin_area_1,phone:null===(n=null===(e=t.phone)||void 0===e?void 0:e.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(t){const{payer:e,purchase_units:n}=t,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:e.email_address,address1:r.address_line_1,address2:r.address_line_2,city:r.admin_area_2,countryCode:r.country_code,postalCode:r.postal_code,stateOrProvinceCode:r.admin_area_1})}getValidButtonStyle(t){const{color:e,height:n,label:r,shape:i}=t||{},o={color:e&&ot[e]?e:void 0,height:this.getValidHeight(n),label:r&&it[r]?r:void 0,shape:i&&at[i]?i:void 0};return(0,h.omitBy)(o,h.isNil)}getValidHeight(t){return t&&"number"==typeof t?t>55?55:t<25?25:t:40}removeElement(t){const e=t&&document.getElementById(t);e&&(e.style.display="none")}}var dt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class pt{constructor(t){this.requestSender=t}createOrder(t,e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return dt(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:e})).body})}getOrderStatus(t="paypalcommerce",e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}var ht=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ft{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return ht(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(t,e,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(t,e=!1){return ht(this,void 0,void 0,function*(){if(!this.window.paypal||e){const e=this.transformConfig(t.options),n=this.transformConfig(t.attributes),r=`https://www.paypal.com/sdk/js?${new URLSearchParams(e).toString()}`;yield this.scriptLoader.loadScript(r,{async:!0,attributes:n})}if(!this.window.paypal)throw new u;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(t,e,n=!0){const{id:r,clientToken:o,initializationData:a}=t;if(!(null==a?void 0:a.clientId))throw new c(i.MissingPaymentMethod);const{intent:s,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:v,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:g=[],isGooglePayEnabled:b}=a,w=f||n,S="paypalcommercecreditcards"===r,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=n?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!g.includes(t))],k=[..._,...I,...P,...g];return{options:Object.assign({"client-id":u,"merchant-id":l,"enable-funding":k.length>0?k:void 0,"disable-funding":A.length>0?A:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...C,...O],currency:e,intent:s},v&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}const yt=e=>{const{getHost:n}=e.getState();return new lt((0,o.createFormPoster)(),e,new pt((0,a.createRequestSender)({host:n()})),new ft((0,t.vQ)()))};var vt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class mt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return vt(this,void 0,void 0,function*(){const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=t||{},a=o||i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new L('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(e=s.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=s.initializationData)||void 0===n?void 0:n.orderId:(yield this.paypalCommerceIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=a.container.split("#")[1],this.renderButton(r,a))})}execute(t,e){return vt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){const n=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d={fundingSource:n.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(d),!this.paypalButton.isEligible())throw new Z("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");u&&"function"==typeof u&&u(),this.paypalButton.render(a)}handleClick(t,e){return vt(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e(),this.toggleLoadingIndicator(!1)}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const gt=e(t=>new mt(t,yt(t),new R({styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]),bt={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class wt extends v{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var St=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class _t{constructor(t,e,n,r,i=3e3,o=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalSdkScriptLoader=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=h.noop,this.isOrderApprovedProcessing=!1}initialize(t){return St(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerce:r,paypalcommercealternativemethods:i}=t,o=i||r;if(this.paypalcommercealternativemethods=i,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new L('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,e),{orderId:u,shouldRenderFields:c}=s.initializationData||{},l=a.getStoreConfigOrThrow().checkoutSettings.features;this.isOrderApprovedProcessing=function(t,e,n=!0){var r;return null!==(r=t["PAYPAL-5431.order_approved_processing"])&&void 0!==r?r:n}(l,0,!1),u?this.orderId=u:(this.paypalApms=yield this.paypalSdkScriptLoader.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,e,o),c&&this.renderFields(n,o))})}execute(t,e){return St(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new q;this.isOrderApprovedProcessing||"ideal"!==i||(yield new Promise((t,e)=>{this.initializePollingMechanism(i,t,e,o)})),this.isNonInstantPaymentMethod(i)&&(i!==st.IDEAL||this.isOrderApprovedProcessing)||(yield this.paymentIntegrationService.submitOrder(r,e)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,this.isOrderApprovedProcessing||this.resetPollingMechanism(),null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}initializePollingMechanism(t,e,n,r){return St(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceIntegrationService.getOrderStatus(null!=r?r:"paypalcommerce"),o=i===ut.Approved,a=i===ut.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommercealternativemethods:this.paypalcommercealternativemethods}),this.handleError(new wt)}catch(t){n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}reinitializeStrategy(t){return St(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}handleError(t){const{onError:e}=this.paypalcommercealternativemethods||{};this.isOrderApprovedProcessing||this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderButton(t,e,n){const r=this.getPaypalAmpsSdkOrThrow(),i=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t,e),{buttonStyle:o}=i.initializationData||{},{container:a,onError:s,onRenderButton:u,submitForm:c}=n,l={fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),onInit:(t,e)=>n.onInitButton(e),createOrder:()=>this.onCreateOrder(t,e,n),onApprove:t=>this.handleApprove(t,c),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deinitializePollingMechanism()},onError:t=>{this.deinitializePollingMechanism(),this.handleFailure(t,s)},onClick:(t,e)=>St(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.paypalButton=r.Buttons(l),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}onCreateOrder(t,e,n){var r;return St(this,void 0,void 0,function*(){const{onValidate:i}=n;yield i(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),h.noop);const o=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(t)&&(t===st.IDEAL&&this.isOrderApprovedProcessing||t===st.OXXO)){const n={useStoreCredit:!1},i={params:{methodId:t,gatewayId:e}};if(yield this.paymentIntegrationService.submitOrder(n,i),t===st.IDEAL){const e=this.paymentIntegrationService.getState(),n=null===(r=e.getOrder())||void 0===r?void 0:r.orderId;yield this.paypalCommerceIntegrationService.updateOrder("paypalcommercealternativemethods",t,n)}yield this.paypalCommerceIntegrationService.submitPayment(t,o,e)}return o})}handleApprove({orderID:t},e){this.orderId=t,e()}handleFailure(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderFields(t,e){const n=this.getPaypalAmpsSdkOrThrow(),r=this.paymentIntegrationService.getState(),{firstName:i,lastName:o,email:a}=r.getBillingAddressOrThrow(),{apmFieldsContainer:s,apmFieldsStyles:u}=e;if(!s)throw new L('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const c=document.querySelector(s);c&&(c.innerHTML="");const l={fundingSource:t,style:u||{},fields:{name:{value:`${i} ${o}`},email:{value:a}}};n.PaymentFields(l).render(s)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isNonInstantPaymentMethod(t){return t.toUpperCase()in st}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new u;return this.paypalApms}}const It=e(t=>new _t(t,N(t),p(),new R({containerStyles:bt})),[{gateway:"paypalcommercealternativemethods"}]);var Pt;!function(t){t.CVV="cvv",t.PAN="pan"}(Pt||(Pt={}));class Ct{static get(t){const e=`${encodeURIComponent(`${t}`)}=`,n=document.cookie;let r=null;const i=n.indexOf(e);if(i>-1){let t=n.indexOf(";",i);-1===t&&(t=n.length),r=decodeURIComponent(n.substring(i+e.length,t))}return r}static set(t,e,n={secure:!0}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;const{expires:i,path:o,domain:a,secure:s}=n;if(i)r+=`; expires=${i.toUTCString()}`;else{const t=new Date,e=60;t.setTime(t.getTime()+60*e*1e3),r+=`; expires=${t.toUTCString()}`}o&&(r+=`; path=${o}`),a&&(r+=`; domain=${a}`),s&&(r+="; secure"),document.cookie=r}static remove(t,e){Ct.set(t,"",Object.assign({expires:new Date(0)},e))}}var Ot,At=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class kt{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return At(this,void 0,void 0,function*(){if(e&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.paypalFastlane){const e={root:{backgroundColorPrimary:"transparent"}};this.window.paypalFastlane=yield t.Fastlane({styles:n||e})}return this.window.paypalFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.paypalFastlane)throw new u;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return At(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return At(this,void 0,void 0,function*(){return t?this.getPayPalFastlaneOrThrow().identity.triggerAuthenticationFlow(t):{}})}updateStorageSessionId(t){const e=new Date;e.setDate(e.getDate()+14);const n={expires:e,secure:!0};Ct.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){Ct.remove("bc-fastlane-sessionId")}getStorageSessionId(){return Ct.get("bc-fastlane-sessionId")||""}mapPayPalFastlaneProfileToBcCustomerData(t,e){var n,r,i;const{authenticationState:o,profileData:a}=e,s=null===(i=null===(r=null===(n=null==a?void 0:a.card)||void 0===n?void 0:n.paymentSource)||void 0===r?void 0:r.card)||void 0===i?void 0:i.billingAddress,u=null==a?void 0:a.shippingAddress,c=null==a?void 0:a.name,l=null==a?void 0:a.card,d=u?this.mapPayPalToBcAddress(u.address,u.name,u.phoneNumber):void 0,p=s&&c?this.mapPayPalToBcAddress(s,c,null==u?void 0:u.phoneNumber):void 0,h=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,p]);return{authenticationState:o||C.UNRECOGNIZED,addresses:f,billingAddress:p,shippingAddress:d,instruments:h}}mapPayPalToBcInstrument(t,e){const{id:n,paymentSource:r}=e,{brand:i,expiry:o,lastDigits:a}=r.card,[s,u]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:u,expiryYear:s,iin:"",last4:a,method:t,provider:t,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:Pt.PAN,type:"card"}]}mapBcToPayPalAddress(t){return{company:(null==t?void 0:t.company)||"",addressLine1:(null==t?void 0:t.address1)||"",addressLine2:(null==t?void 0:t.address2)||"",adminArea1:(null==t?void 0:t.stateOrProvinceCode)||(null==t?void 0:t.stateOrProvince)||"",adminArea2:(null==t?void 0:t.city)||"",postalCode:(null==t?void 0:t.postalCode)||"",countryCode:(null==t?void 0:t.countryCode)||""}}mapPayPalToBcAddress(t,e,n,r){const[i,o]=e.fullName.split(" "),a=(null==n?void 0:n.nationalNumber)||"",s=(null==n?void 0:n.countryCode)||"";return{id:Date.now(),type:"paypal-address",firstName:e.firstName||i||"",lastName:e.lastName||o||"",company:t.company||"",address1:t.addressLine1,address2:t.addressLine2||"",city:t.adminArea2,stateOrProvince:t.adminArea1,stateOrProvinceCode:t.adminArea1,country:t.countryCode||"",countryCode:t.countryCode||"",postalCode:t.postalCode,phone:s+a,customFields:r||[]}}filterAddresses(t){return t.reduce((t,e)=>e?t.some(t=>this.isEqualAddresses(t,e))?t:[...t,e]:t,[])}isEqualAddresses(t,e){return(0,h.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,h.omit)(t,["id","phone"])}}function Et(){return new kt}!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(Ot||(Ot={}));const jt=Ot;function xt(t){return jt.CardNumber in t&&jt.CardName in t&&jt.CardExpiry in t}function Tt(t){return jt.CardNumberVerification in t&&jt.CardCodeVerification in t&&jt.CardExpiryVerification in t}class zt extends s{constructor(t){super(t||"Unable to proceed because the client library of a payment method has thrown an unexpected error."),this.name="PaymentMethodFailedError",this.type="payment_method_client_invalid"}}var Ft;!function(t){t[t.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",t[t.CustomerNotInitialized=1]="CustomerNotInitialized",t[t.PaymentNotInitialized=2]="PaymentNotInitialized",t[t.ShippingNotInitialized=3]="ShippingNotInitialized",t[t.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(Ft||(Ft={}));class Bt extends s{constructor(t){super(function(t){switch(t){case Ft.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Ft.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Ft.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Ft.SpamProtectionNotInitialized:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(t)),this.subtype=t,this.name="NotInitializedError",this.type="not_initialized"}}class Nt extends s{constructor(t,e){super(e||"Unable to proceed because the payment form contains invalid data."),this.details=t,this.name="PaymentInvalidFormError",this.type="payment_invalid_form"}}var Dt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Mt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){return Dt(this,void 0,void 0,function*(){const{methodId:e,paypalcommercecreditcards:n,paypalcommerce:r}=t,i=n||r,{form:o,onCreditCardFieldsRenderingError:a,onLoadComplete:s}=i||{};if(!e)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new L('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=xt(o.fields),this.isCreditCardVaultedForm=Tt(o.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(e),yield this.paypalIntegrationService.loadPayPalSdk(e,void 0,!0,!0),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(o,a)),null==s||s(),this.shouldInitializePayPalFastlane(e)&&(yield this.initializePayPalFastlaneOrThrow(e))})}execute(t,e){return Dt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new V(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:t}=yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams());this.returnedOrderId=t}const a=this.preparePaymentPayload(i,o,this.returnedOrderId,this.returnedVaultedToken);yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment(a)})}finalize(){return Promise.reject(new $)}deinitialize(){var t,e,n,r;return Dt(this,void 0,void 0,function*(){return yield null===(t=this.cvvField)||void 0===t?void 0:t.close(),yield null===(e=this.expiryField)||void 0===e?void 0:e.close(),yield null===(n=this.numberField)||void 0===n?void 0:n.close(),yield null===(r=this.nameField)||void 0===r?void 0:r.close(),Promise.resolve()})}preparePaymentPayload(t,e,n,r){const{shouldSaveInstrument:i=!1,shouldSetAsDefaultInstrument:o=!1}=H(e)?e:{},a=e&&W(e)?e.instrumentId:void 0,s=(0,h.omitBy)({verification_nonce:r,token:a},h.isNil);return{methodId:t,paymentData:{shouldSaveInstrument:i,shouldSetAsDefaultInstrument:o,instrumentId:a,formattedPayload:Object.assign(Object.assign({},r||a?{bigpay_token:s}:{}),n?{card_with_order:{order_id:n}}:{})}}}initializeFields(t,e){return Dt(this,void 0,void 0,function*(){const{fields:n,styles:r}=t,i=this.paypalIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:t,vaultSetupToken:e,liabilityShift:n})=>{if(n===nt.No||n===nt.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new zt},inputEvents:{onChange:e=>this.onChangeHandler(t,e),onFocus:e=>this.onFocusHandler(t,e),onBlur:e=>this.onBlurHandler(t,e),onInputSubmitRequest:e=>this.onInputSubmitRequest(t,e)}},o);if(this.cardFields=yield i.CardFields(a),!this.cardFields.isEligible())throw new Bt(Ft.PaymentNotInitialized);try{this.stylizeInputContainers(n),xt(n)&&(yield this.renderFields(n)),Tt(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return Tt(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Dt(this,void 0,void 0,function*(){const{setupToken:t}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return t})}}createOrderCallback(){return{createOrder:()=>Dt(this,void 0,void 0,function*(){const{orderId:t}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams()))||{};return t})}}handleApprove({orderID:t,vaultSetupToken:e}){t&&(this.returnedOrderId=t),e&&(this.returnedVaultedToken=e)}renderFields(t){var e,n,r,i;return Dt(this,void 0,void 0,function*(){const o=this.getCardFieldsOrThrow();(null===(e=t.cardCode)||void 0===e?void 0:e.containerId)&&(this.cvvField=o.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCode.containerId}`)),(null===(n=t.cardExpiry)||void 0===n?void 0:n.containerId)&&(this.expiryField=o.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiry.containerId}`)),(null===(r=t.cardName)||void 0===r?void 0:r.containerId)&&(this.nameField=o.NameField({placeholder:""}),yield this.nameField.render(`#${t.cardName.containerId}`)),(null===(i=t.cardNumber)||void 0===i?void 0:i.containerId)&&(this.numberField=o.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumber.containerId}`))})}renderVaultedFields(t){var e,n,r;return Dt(this,void 0,void 0,function*(){const i=this.getCardFieldsOrThrow();(null===(e=t.cardCodeVerification)||void 0===e?void 0:e.containerId)&&(this.cvvField=i.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCodeVerification.containerId}`)),(null===(n=t.cardExpiryVerification)||void 0===n?void 0:n.containerId)&&(this.expiryField=i.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiryVerification.containerId}`)),(null===(r=t.cardNumberVerification)||void 0===r?void 0:r.containerId)&&(this.numberField=i.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumberVerification.containerId}`))})}getInstrumentParams(){if(!this.executionPaymentData)return{};if(H(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if(W(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Dt(this,void 0,void 0,function*(){const t=this.getCardFieldsOrThrow(),e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),n={billingAddress:{company:e.company,addressLine1:e.address1,addressLine2:e.address2,adminArea1:e.stateOrProvinceCode,adminArea2:e.city,postalCode:e.postalCode,countryCode:e.countryCode}};try{this.isCreditCardVaultedForm?yield t.submit():yield t.submit(n)}catch(t){throw new zt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Dt(this,void 0,void 0,function*(){const n=this.getCardFieldsOrThrow(),r=yield n.getState().then(t=>t),i=this.getValidityData(r);if(!i.isValid)throw null===(e=null===(t=this.hostedFormOptions)||void 0===t?void 0:t.onValidate)||void 0===e||e.call(t,i),new Nt(this.mapValidationErrors(i.errors))})}getValidityData({fields:t}){const e=Object.assign({},t);delete e.cardNameField;const n=Object.keys(e);return{isValid:n.every(t=>{var n;return null===(n=e[t])||void 0===n?void 0:n.isValid}),errors:n.reduce((t,n)=>{var r;const i=this.mapFieldType(n);return Object.assign(Object.assign({},t),{[i]:(null===(r=e[n])||void 0===r?void 0:r.isValid)?void 0:[this.getInvalidErrorByFieldType(i)]})},{})}}getInvalidErrorByFieldType(t){switch(t){case jt.CardCode:case jt.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case jt.CardNumber:case jt.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case jt.CardExpiry:case jt.CardExpiryVerification:return{fieldType:t,message:"Invalid card expiry",type:"invalid_card_expiry"};default:return{fieldType:t,message:"Invalid field",type:"invalid"}}}mapValidationErrors(t={}){const e={};return Object.keys(t).forEach(n=>{var r,i;e[n]=[{message:(null===(i=null===(r=t[n])||void 0===r?void 0:r[0])||void 0===i?void 0:i.message)||"",type:n}]}),e}mapFieldType(t){switch(t){case"name":return jt.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?jt.CardNumber:jt.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?jt.CardExpiry:jt.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?jt.CardCode:jt.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new Bt(Ft.PaymentNotInitialized);return this.cardFields}getInputStyles(t){var e,n,r;const i={"font-size":(null===(e=null==t?void 0:t.default)||void 0===e?void 0:e.fontSize)||"1rem","font-family":(null===(n=null==t?void 0:t.default)||void 0===n?void 0:n.fontFamily)||"Montserrat, Arial, Helvetica, sans-serif","font-weight":(null===(r=null==t?void 0:t.default)||void 0===r?void 0:r.fontWeight)||"400",outline:"none",padding:"9px 13px"},o=Object.assign(Object.assign({},i),{color:"#333333"});return{input:o,".invalid":Object.assign(Object.assign({},i),{color:"red"}),".valid":o,":focus":o}}stylizeInputContainers(t){Object.values(t||{}).forEach(t=>{const e=document.getElementById(`${(null==t?void 0:t.containerId)||""}`);e&&(e.style.padding="0px",e.style.boxShadow="none",e.style.border="none",e.style.background="transparent",e.style.marginBottom="10px",e.style.marginLeft="-5px")})}hasUndefinedValues(){return!this.hostedFormOptions||Object.values(this.hostedFormOptions.fields).some(t=>void 0===t)}onChangeHandler(t,e){var n;null===(n=null==t?void 0:t.onValidate)||void 0===n||n.call(t,this.getValidityData(e))}onFocusHandler(t,e){var n;null===(n=null==t?void 0:t.onFocus)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onBlurHandler(t,e){var n;null===(n=null==t?void 0:t.onBlur)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onInputSubmitRequest(t,e){var n;null===(n=null==t?void 0:t.onEnter)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}shouldInitializePayPalFastlane(t){var e,n;const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),o=r.getPaymentProviderCustomer(),a=(s=o)&&("authenticationState"in s||"addresses"in s||"instruments"in s)?o:{};var s;return(null===(e=null==i?void 0:i.initializationData)||void 0===e?void 0:e.isAcceleratedCheckoutEnabled)&&(null===(n=null==i?void 0:i.initializationData)||void 0===n?void 0:n.isPayPalCommerceAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(t){return Dt(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getPaymentMethodOrThrow(t),{initializationData:i}=r;if(!(null==i?void 0:i.connectClientToken))return;const o=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(r,n.currency.code,n.id);yield this.paypalFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(t){}})}}const Ut=e(t=>new Mt(t,N(t),p(),Et()),[{id:"paypalcommercecreditcards"}]);var Rt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Lt{constructor(t,e,n,r=3e3,i=3e5){this.paymentIntegrationService=t,this.paypalCommerceService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=h.noop}initialize(t){return Rt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerceratepay:r}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new L('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new L('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,e),{merchantId:u}=s.initializationData||{};if(!u)throw new L("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceService.loadPayPalSdk(n),this.createFraudNetScript(u,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return Rt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{getFieldsValues:i}=this.paypalcommerceratepay||{};if(!n)throw new V(["payment"]);if(!i||"function"!=typeof i)throw new L('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.paypalCommerceService.createOrder("paypalcommercealternativemethodscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),u={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:n.methodId,rate_pay:{birth_date:this.normalizeDate(o),phone:{national_number:a,country_code:s.split("+")[1]}},paypal_account:{order_id:t}}};return yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment({methodId:n.methodId,paymentData:u}),yield new Promise((t,e)=>{this.initializePollingMechanism(n.methodId,t,e,n.gatewayId)})}catch(t){return this.handleError(t),new Promise((t,e)=>e())}})}finalize(){return Promise.reject(new $)}deinitialize(){const{legalTextContainer:t}=this.paypalcommerceratepay||{},e=document.querySelectorAll('[data-id="fraudnetScript"]')[0],n=document.querySelectorAll('[data-id="fraudnetConfig"]')[0];if(this.deinitializePollingMechanism(),e.remove(),n.remove(),t){const e=document.getElementById(t);null==e||e.remove()}return Promise.resolve()}normalizeDate(t){const e=this.formatDate(t.getDate()),n=this.formatDate(t.getMonth()+1);return`${t.getFullYear()}-${n}-${e}`}formatDate(t){return`${t<10?0:""}${t}`}renderLegalText(t,e){const n=t,r=e.split("#")[1],i=document.getElementById(r),o=null==i?void 0:i.parentNode,a=document.createElement("div");a.style.marginBottom="20px",a.setAttribute("id",n),null==o||o.prepend(a);const s=this.paypalCommerceService.getPayPalSdkOrThrow(),u=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new L('Unable to initialize payment because "legalTextContainerElement" argument is not found.');u.render(`#${n}`)}handleError(t){const{onError:e}=this.paypalcommerceratepay||{};this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createFraudNetScript(t,e,n){const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e,n),{testMode:i}=r.config,o=document.createElement("script");o.setAttribute("type","application/json"),o.setAttribute("fncls","fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99"),o.setAttribute("data-id","fraudnetScript"),this.guid=this.generateGUID();const a={f:this.guid,s:`${t}_checkout-page`,sandbox:i};o.innerHTML=JSON.stringify(a),document.body.appendChild(o)}generateGUID(){let t="";for(let e=0;e<32;e+=1)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(62*Math.random())];return t}loadFraudnetConfig(){const t=document.createElement("script");t.setAttribute("data-id","fraudnetConfig"),t.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(t)}reinitializeStrategy(t){return Rt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return Rt(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceService.getOrderStatus("paypalcommercealternativemethods",{params:{useMetadata:!0}}),o=i===A.PollingStop,a=i===A.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommerceratepay:this.paypalcommerceratepay}),this.handleError(new wt)}catch(t){this.handleError(t),n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const Vt=e(t=>new Lt(t,N(t),new R({containerStyles:Object.assign(Object.assign({},D),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);function qt(t){return"string"!=typeof t}function $t(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,h.omitBy)(t.root,qt),o=(0,h.omitBy)(t.input,qt),a=(0,h.omitBy)(t.toggle,qt),s=(0,h.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,qt),u=(0,h.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,qt),c=t.branding;return Object.keys(i).length&&(r.root=i),Object.keys(o).length&&(r.input=o),Object.keys(a).length&&(r.toggle=a),Object.keys(s).length&&(r.text={},r.text.body=s),Object.keys(u).length&&(r.text=Object.assign({},r.text),r.text.caption=u),c&&(r.branding=c),r}(function(t,e){var n,r,i,o,a,s,u,c,l,d,p,h,f,y,v,m,g,b,w,S,_,I;return{root:{backgroundColorPrimary:(null==t?void 0:t.fastlaneRootSettingsBackgroundColor)||(null===(n=null==e?void 0:e.root)||void 0===n?void 0:n.backgroundColorPrimary),errorColor:(null==t?void 0:t.fastlaneRootSettingsErrorColor)||(null===(r=null==e?void 0:e.root)||void 0===r?void 0:r.errorColor),fontFamily:(null==t?void 0:t.fastlaneRootSettingsFontFamily)||(null===(i=null==e?void 0:e.root)||void 0===i?void 0:i.fontFamily),fontSizeBase:(null==t?void 0:t.fastlaneRootSettingsFontSize)||(null===(o=null==e?void 0:e.root)||void 0===o?void 0:o.fontSizeBase),padding:(null==t?void 0:t.fastlaneRootSettingsPadding)||(null===(a=null==e?void 0:e.root)||void 0===a?void 0:a.padding),primaryColor:(null==t?void 0:t.fastlaneRootSettingsPrimaryColor)||(null===(s=null==e?void 0:e.root)||void 0===s?void 0:s.primaryColor)},input:{borderRadius:(null==t?void 0:t.fastlaneInputSettingsBorderRadius)||(null===(u=null==e?void 0:e.input)||void 0===u?void 0:u.borderRadius),borderColor:(null==t?void 0:t.fastlaneInputSettingsBorderColor)||(null===(c=null==e?void 0:e.input)||void 0===c?void 0:c.borderColor),focusBorderColor:(null==t?void 0:t.fastlaneInputSettingsFocusBorderBase)||(null===(l=null==e?void 0:e.input)||void 0===l?void 0:l.focusBorderColor),backgroundColor:(null==t?void 0:t.fastlaneInputSettingsBackgroundColor)||(null===(d=null==e?void 0:e.input)||void 0===d?void 0:d.backgroundColor),borderWidth:(null==t?void 0:t.fastlaneInputSettingsBorderWidth)||(null===(p=null==e?void 0:e.input)||void 0===p?void 0:p.borderWidth),textColorBase:(null==t?void 0:t.fastlaneInputSettingsTextColorBase)||(null===(h=null==e?void 0:e.input)||void 0===h?void 0:h.textColorBase)},toggle:{colorPrimary:(null==t?void 0:t.fastlaneToggleSettingsColorPrimary)||(null===(f=null==e?void 0:e.toggle)||void 0===f?void 0:f.colorPrimary),colorSecondary:(null==t?void 0:t.fastlaneToggleSettingsColorSecondary)||(null===(y=null==e?void 0:e.toggle)||void 0===y?void 0:y.colorSecondary)},text:{body:{color:(null==t?void 0:t.fastlaneTextBodySettingsColor)||(null===(m=null===(v=null==e?void 0:e.text)||void 0===v?void 0:v.body)||void 0===m?void 0:m.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(g=null==e?void 0:e.text)||void 0===g?void 0:g.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==t?void 0:t.fastlaneTextCaptionSettingsColor)||(null===(S=null===(w=null==e?void 0:e.text)||void 0===w?void 0:w.caption)||void 0===S?void 0:S.color),fontSize:(null==t?void 0:t.fastlaneTextCaptionSettingsFontSize)||(null===(I=null===(_=null==e?void 0:e.text)||void 0===_?void 0:_.caption)||void 0===I?void 0:I.fontSize)}},branding:(null==t?void 0:t.fastlaneBrandingSettings)||(null==e?void 0:e.branding)}}(t,e))}function Ht(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}var Wt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Gt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceRequestSender=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){var e,n;return Wt(this,void 0,void 0,function*(){const{methodId:r,paypalcommercefastlane:i}=t;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new L('Unable to initialize payment because "options.paypalcommercefastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new L('Unable to initialize payment because "options.paypalcommercefastlane.onChange" argument is not provided or it is not a function.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState(),a=o.getCartOrThrow(),s=o.getPaymentMethodOrThrow(r),{isDeveloperModeApplicable:u,isFastlaneStylingEnabled:c}=s.initializationData||{};this.threeDSVerificationMethod=null===(e=s.initializationData)||void 0===e?void 0:e.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=$t(c?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.paypalFastlaneUtils.initializePayPalFastlane(this.paypalFastlaneSdk,!!u,l),this.shouldRunAuthenticationFlow()&&(yield this.runPayPalAuthenticationFlowOrThrow(r)),yield this.initializePayPalPaymentComponent(),i.onInit(t=>this.renderPayPalPaymentComponent(t)),i.onChange(()=>this.handlePayPalStoredInstrumentChange(r))})}execute(t,e){return Wt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&W(i);try{yield this.paymentIntegrationService.submitOrder(r,e);const t=a?yield this.prepareVaultedInstrumentPaymentPayload(o,i):yield this.preparePaymentPayload(o,i);yield this.paymentIntegrationService.submitPayment(t),this.paypalFastlaneUtils.removeStorageSessionId()}catch(t){if(function(t){return"object"==typeof t&&null!==t&&"message"in t&&"response"in t&&"body"in t.response&&"name"in t.response.body}(t)&&"INVALID_REQUEST"===t.response.body.name){const t={translationKey:"payment.errors.invalid_request_error"};return this.handleError(t),Promise.reject()}if(t instanceof Error&&"FastlaneError"!==t.name)throw t;return Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){return Wt(this,void 0,void 0,function*(){return Promise.resolve()})}shouldRunAuthenticationFlow(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getCustomerOrThrow(),r=t.getPaymentProviderCustomer(),i=Ht(r)?r:{},o=this.paypalFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===C.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return Wt(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:u,addresses:c,instruments:l}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:u,addresses:c,instruments:l}),s.authenticationState===C.CANCELED?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return Wt(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),e=t.phone,n=`${t.firstName} ${t.lastName}`.trim(),r=this.paypalFastlaneUtils.getPayPalFastlaneOrThrow(),i={fields:Object.assign({cardholderName:{prefill:n,enabled:!0}},e&&{phoneNumber:{prefill:e}})};this.paypalComponentMethods=yield r.FastlaneCardComponent(i)})}renderPayPalPaymentComponent(t){const e=this.getPayPalComponentMethodsOrThrow();if(!t)throw new L('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new u;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return Wt(this,void 0,void 0,function*(){const{instrumentId:n}=e,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).config.is3dsEnabled?yield this.get3DSNonce(n):n;return yield this.createOrder(r),{methodId:t,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:r}}}}})}preparePaymentPayload(t,e){return Wt(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getBillingAddressOrThrow(),i=n.getPaymentMethodOrThrow(t),o=`${r.firstName} ${r.lastName}`.trim(),{getPaymentToken:a}=this.getPayPalComponentMethodsOrThrow(),{id:s}=yield a({name:{fullName:o},billingAddress:this.paypalFastlaneUtils.mapBcToPayPalAddress(r)}),u=i.config.is3dsEnabled?yield this.get3DSNonce(s):s;yield this.createOrder(u);const{shouldSaveInstrument:c=!1,shouldSetAsDefaultInstrument:l=!1}=H(e)?e:{};return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:c,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:u}}})}})}createOrder(t){return Wt(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.paypalCommerceRequestSender.createOrder(this.methodId,{cartId:e,fastlaneToken:t});this.orderId=n}})}get3DSNonce(t){var e;return Wt(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,a=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!a)throw new u;const s={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:t,threeDSRequested:this.threeDSVerificationMethod===b.Always,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}},c=yield a.isEligible(s);if(this.threeDSVerificationMethod===b.Always&&!c)throw new q;if(c){const{liabilityShift:t,authenticationState:e,nonce:n}=yield a.show();if(t===nt.No||t===nt.Unknown||e===w.Errored||e===w.Cancelled)throw new q;if(e===w.Succeeded&&[nt.Yes,nt.Possible].includes(t))return n}return t})}handlePayPalStoredInstrumentChange(t){return Wt(this,void 0,void 0,function*(){const e=this.paypalFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield e.profile.showCardSelector();if(n){const e=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=Ht(e)?e:{},i=this.paypalFastlaneUtils.mapPayPalToBcInstrument(t,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}handleError(t){var e;(null===(e=this.paypalcommercefastlane)||void 0===e?void 0:e.onError)&&"function"==typeof this.paypalcommercefastlane.onError&&this.paypalcommercefastlane.onError(t)}}const Yt=e(t=>{const{getHost:e}=t.getState();return new Gt(t,new pt((0,a.createRequestSender)({host:e()})),p(),Et())},[{id:"paypalcommerceacceleratedcheckout"}]);var Kt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};const Jt=class{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}createPayPalButton(t,e,n,r){const{style:i,fundingSource:o,isAppSwitchEnabled:a,isHostedCheckoutEnabled:s,onClick:u,onCancel:c,onPaymentComplete:l,onError:d}=n;this.onError=d;const p=this.paypalIntegrationService.getPayPalSdkOrThrow();if(!Object.values(p.FUNDING).includes(o))throw new L('Unable to initialize PayPal button because "fundingSource" argument is not valid funding source.');const h=Object.assign(Object.assign({},!a&&{onShippingAddressChange:e=>this.onShippingAddressChange(e,t),onShippingOptionsChange:e=>this.onShippingOptionsChange(e,t)}),{onApprove:(n,r)=>this.onHostedCheckoutApprove(n,r,e,t,l)});return p.Buttons(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({fundingSource:o,style:this.paypalIntegrationService.getValidButtonStyle(i)},a&&{appSwitchWhenAvailable:!0}),{createOrder:()=>Kt(this,void 0,void 0,function*(){if(r){const t=yield this.paypalIntegrationService.createBuyNowCartOrThrow(r);yield this.paymentIntegrationService.loadCheckout(t.id)}return this.paypalIntegrationService.createOrder(t)}),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)}),u?{onClick:u}:{}),c?{onCancel:c}:{}),s&&h))}onHostedCheckoutApprove(t,e,n,r,o){return Kt(this,void 0,void 0,function*(){if(!t.orderID)throw new c(i.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield e.order.get();try{const e=this.paypalIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),a.lineItems.physicalItems.length>0){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalIntegrationService.updateOrder(r)}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,t.orderID),o&&"function"==typeof o&&o()}catch(t){this.handleError(t)}})}onShippingAddressChange(t,e){return Kt(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(n),yield this.paymentIntegrationService.updateShippingAddress(n);const t=this.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalIntegrationService.updateOrder(e)}catch(t){this.handleError(t)}})}onShippingOptionsChange(t,e){return Kt(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(n.id),yield this.paypalIntegrationService.updateOrder(e)}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}};var Xt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Zt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalButtonCreationService=n}initialize(t){return Xt(this,void 0,void 0,function*(){const{paypalcommerce:e,methodId:n}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!e.container)throw new L('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new L('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return Xt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(t,e),Promise.resolve()})}signOut(t){return Xt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signOutCustomer(t),Promise.resolve()})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){var n,r;const{container:i,onClick:o,onComplete:a,onError:s}=e,u=this.paypalIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:l,paymentButtonStyles:d,isAppSwitchEnabled:p}=c.initializationData||{},{checkoutTopButtonStyles:h}=d||{},f=Object.assign(Object.assign(Object.assign({fundingSource:u.FUNDING.PAYPAL,isAppSwitchEnabled:p,isHostedCheckoutEnabled:l,style:Object.assign(Object.assign({},h),{height:40})},o&&{onClick:()=>o()}),l&&a&&{onPaymentComplete:()=>a()}),{onError:s}),y=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",t,f);y.isEligible()?(null===(n=y.hasReturned)||void 0===n?void 0:n.call(y))&&p?null===(r=y.resume)||void 0===r||r.call(y):y.render(`#${i}`):this.paypalIntegrationService.removeElement(i)}}const Qt=e(t=>{const e=N(t),n=new Jt(t,e);return new Zt(t,e,n)},[{id:"paypalcommerce"}]);var te=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ee{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=h.noop}initialize(t){return te(this,void 0,void 0,function*(){const{paypalcommercecredit:e,methodId:n}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!e.container)throw new L('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new L('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=e.onError||h.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return te(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return te(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onComplete:r,onClick:i}=e,o=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u,isAppSwitchEnabled:c}=a.initializationData||{},{checkoutTopButtonStyles:l}=u||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!c&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,r)}),h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let f=!1;h.forEach(t=>{if(!f){const e=Object.assign(Object.assign({fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},l),{height:40}))},d),s&&p),r=o.Buttons(e);r.isEligible()&&(r.render(`#${n}`),f=!0)}}),f||this.paypalCommerceIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,e,n,r){return te(this,void 0,void 0,function*(){if(!t.orderID)throw new c(i.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield e.order.get();try{const e=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalCommerceIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return te(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return te(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const ne=e(t=>new ee(t,yt(t)),[{id:"paypalcommercecredit"}]);var re=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ie{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return re(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,methodId:n}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!e.container)throw new L('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new L('Unable to initialize payment because "options.paypalcommercevenmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return re(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return re(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onClick:r}=e,i=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},u=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:40})),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),c=i.Buttons(u);c.isEligible()?c.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const oe=e(t=>new ie(t,yt(t)),[{id:"paypalcommercevenmo"}]);var ae=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class se{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalSdkScriptLoader=e,this.paypalFastlaneUtils=n}initialize(t){var e;return ae(this,void 0,void 0,function*(){const{methodId:n,paypalcommercefastlane:r}=t;if(!n)throw new L('Unable to proceed because "methodId" argument is not provided.');try{yield this.paymentIntegrationService.loadPaymentMethod(n);const t=this.paymentIntegrationService.getState(),i=t.getCartOrThrow(),o=t.getPaymentMethodOrThrow(n),a=!!(null===(e=o.initializationData)||void 0===e?void 0:e.isDeveloperModeApplicable),s=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.paypalFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(t){}return Promise.resolve()})}deinitialize(){return ae(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(t,e){return ae(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e),yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:void 0,addresses:void 0,instruments:void 0}),this.paypalFastlaneUtils.removeStorageSessionId()})}signOut(t){return ae(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){return ae(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new L('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new L('Unable to proceed because "continueWithCheckoutCallback" argument is not provided and it must be a function.');if(this.paymentIntegrationService.getState().getCustomerOrThrow().isGuest){e&&"function"==typeof e&&e();try{yield this.runPayPalAuthenticationFlowOrThrow(r)}catch(t){}}n()})}runPayPalAuthenticationFlowOrThrow(t){return ae(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow().id,r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),u=s.authenticationState===C.CANCELED;yield this.updateCustomerDataState(t,s),u?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return ae(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:u}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,e);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:u}),a&&(yield this.paymentIntegrationService.updateBillingAddress(a)),s&&r.lineItems.physicalItems.length>0){const e=yield this.paymentIntegrationService.updateShippingAddress(s),r=e.getPaymentMethodOrThrow(t),{isFastlaneShippingOptionAutoSelectEnabled:i}=r.initializationData||{},o=e.getConsignments()||[],a=(null===(n=o[0])||void 0===n?void 0:n.availableShippingOptions)||[],u=a[0],c=a.find(t=>t.isRecommended);if((c||u)&&i){const t=(null==c?void 0:c.id)||u.id;yield this.paymentIntegrationService.selectShippingOption(t)}}})}getFastlaneStyles(t,e){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return $t(i?r:{},null==e?void 0:e.styles)}}const ue=e(t=>new se(t,p(),Et()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);class ce{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalButtonCreationService=n}initialize(t){var e,n,r,i,o;return n=this,r=void 0,o=function*(){const{paypalcommerce:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new L('Unable to initialize payment because "options.paypalcommerce.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(e=n.buyNowInitializeOptions)||void 0===e?void 0:e.getBuyNowCartRequestBody))throw new L('Unable to initialize payment because "options.paypalcommerce.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');o||(yield this.paymentIntegrationService.loadDefaultCheckout());const a=o?n.currencyCode:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n)},new((i=void 0)||(i=Promise))(function(t,e){function a(t){try{u(o.next(t))}catch(t){e(t)}}function s(t){try{u(o.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i(function(t){t(n)})).then(a,s)}u((o=o.apply(n,r||[])).next())})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){var r,i;const{buyNowInitializeOptions:o,style:a,onComplete:s,onEligibilityFailure:u}=n,c=this.paypalIntegrationService.getPayPalSdkOrThrow(),l=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:d,isAppSwitchEnabled:p}=l.initializationData||{},h={onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},f=Object.assign(Object.assign({fundingSource:c.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(a),isAppSwitchEnabled:p,isHostedCheckoutEnabled:d},o&&h),d&&s&&{onPaymentComplete:()=>s()}),y=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",e,f,o);y.isEligible()?(null===(r=y.hasReturned)||void 0===r?void 0:r.call(y))&&p?null===(i=y.resume)||void 0===i||i.call(y):y.render(`#${t}`):u&&"function"==typeof u?u():this.paypalIntegrationService.removeElement(t)}}const le=e(t=>{const e=N(t),n=new Jt(t,e);return new ce(t,e,n)},[{id:"paypalcommerce"}]);var de=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class pe{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}initialize(t){return de(this,void 0,void 0,function*(){const{paypalcommercecredit:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(a&&!o)throw new L('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new L('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=this.paymentIntegrationService.getState(),u=a?o:s.getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(r,u,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c,isAppSwitchEnabled:l}=u.initializationData||{},d={createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)},p={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h=Object.assign(Object.assign({},!l&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)}),f=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let y=!1;f.forEach(e=>{if(!y){const n=Object.assign(Object.assign(Object.assign({fundingSource:e,style:this.paypalIntegrationService.getValidButtonStyle(i)},d),r&&p),c&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${t}`),y=!0):a&&"function"==typeof a&&a()}}),y||this.paypalIntegrationService.removeElement(t)}handleClick(t){return de(this,void 0,void 0,function*(){if(t){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(t,e,n,r){return de(this,void 0,void 0,function*(){if(!t.orderID)throw new c(i.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield e.order.get();try{const e=this.paypalIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return de(this,void 0,void 0,function*(){const e=this.paypalIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t){return de(this,void 0,void 0,function*(){const e=this.paypalIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}}const he=e(t=>new pe(t,N(t)),[{id:"paypalcommercecredit"}]);var fe=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ye{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return fe(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new L('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new L('Unable to initialize payment because "options.paypalcommercevenmo.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=a?o:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,s,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,u={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},u),r&&c),d=a.Buttons(l);d.isEligible()?d.render(`#${t}`):o&&"function"==typeof o?o():this.paypalCommerceIntegrationService.removeElement(t)}getValidVenmoButtonStyles(t){const e=this.paypalCommerceIntegrationService.getValidButtonStyle(t);return e.color===ot.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return fe(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const ve=e(t=>new ye(t,yt(t)),[{id:"paypalcommercevenmo"}])})(),module.exports=r})();
2
+ (()=>{var t={35:(t,e,n)=>{t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Function]",s="[object Object]",u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[o]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[a]=l["[object Map]"]=l["[object Number]"]=l[s]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var d,p,h,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,v=f||y||Function("return this")(),m=e&&!e.nodeType&&e,g=m&&t&&!t.nodeType&&t,b=g&&g.exports===m,w=b&&f.process,S=function(){try{return g&&g.require&&g.require("util").types||w&&w.binding&&w.binding("util")}catch(t){}}(),_=S&&S.isTypedArray,I=Array.prototype,P=Function.prototype,C=Object.prototype,O=v["__core-js_shared__"],A=P.toString,k=C.hasOwnProperty,E=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",j=C.toString,x=A.call(Object),T=RegExp("^"+A.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=b?v.Buffer:void 0,F=v.Symbol,B=v.Uint8Array,N=(z&&z.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(t){return p(h(t))}),D=Object.create,M=C.propertyIsEnumerable,U=I.splice,R=F?F.toStringTag:void 0,L=function(){try{var t=st(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),V=z?z.isBuffer:void 0,q=Math.max,$=Date.now,H=st(v,"Map"),W=st(Object,"create"),G=function(){function t(){}return function(e){if(!bt(e))return{};if(D)return D(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Y(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function K(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function J(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function X(t){var e=this.__data__=new K(t);this.size=e.size}function Z(t,e,n){(void 0!==n&&!pt(t[e],n)||void 0===n&&!(e in t))&&et(t,e,n)}function Q(t,e,n){var r=t[e];k.call(t,e)&&pt(r,n)&&(void 0!==n||e in t)||et(t,e,n)}function tt(t,e){for(var n=t.length;n--;)if(pt(t[n][0],e))return n;return-1}function et(t,e,n){"__proto__"==e&&L?L(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}Y.prototype.clear=function(){this.__data__=W?W(null):{},this.size=0},Y.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Y.prototype.get=function(t){var e=this.__data__;if(W){var n=e[t];return n===r?void 0:n}return k.call(e,t)?e[t]:void 0},Y.prototype.has=function(t){var e=this.__data__;return W?void 0!==e[t]:k.call(e,t)},Y.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=W&&void 0===e?r:e,this},K.prototype.clear=function(){this.__data__=[],this.size=0},K.prototype.delete=function(t){var e=this.__data__,n=tt(e,t);return!(n<0||(n==e.length-1?e.pop():U.call(e,n,1),--this.size,0))},K.prototype.get=function(t){var e=this.__data__,n=tt(e,t);return n<0?void 0:e[n][1]},K.prototype.has=function(t){return tt(this.__data__,t)>-1},K.prototype.set=function(t,e){var n=this.__data__,r=tt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new Y,map:new(H||K),string:new Y}},J.prototype.delete=function(t){var e=at(this,t).delete(t);return this.size-=e?1:0,e},J.prototype.get=function(t){return at(this,t).get(t)},J.prototype.has=function(t){return at(this,t).has(t)},J.prototype.set=function(t,e){var n=at(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},X.prototype.clear=function(){this.__data__=new K,this.size=0},X.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},X.prototype.get=function(t){return this.__data__.get(t)},X.prototype.has=function(t){return this.__data__.has(t)},X.prototype.set=function(t,e){var n=this.__data__;if(n instanceof K){var r=n.__data__;if(!H||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(t,e),this.size=n.size,this};function nt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":R&&R in Object(t)?function(t){var e=k.call(t,R),n=t[R];try{t[R]=void 0;var r=!0}catch(t){}var i=j.call(t);return r&&(e?t[R]=n:delete t[R]),i}(t):function(t){return j.call(t)}(t)}function rt(t){return wt(t)&&nt(t)==o}function it(t,e,n,r,i){t!==e&&function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var s=o[++r];if(!1===e(i[s],s,i))break}}(e,function(o,a){if(i||(i=new X),bt(o))!function(t,e,n,r,i,o,a){var u=lt(t,n),c=lt(e,n),l=a.get(c);if(l)Z(t,n,l);else{var d,p,h,f,y,v=o?o(u,c,n+"",t,e,a):void 0,m=void 0===v;if(m){var g=ft(c),b=!g&&vt(c),w=!g&&!b&&St(c);v=c,g||b||w?ft(u)?v=u:wt(y=u)&&yt(y)?v=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(u):b?(m=!1,v=function(t){return t.slice()}(c)):w?(m=!1,f=new(h=(d=c).buffer).constructor(h.byteLength),new B(f).set(new B(h)),p=f,v=new d.constructor(p,d.byteOffset,d.length)):v=[]:function(t){if(!wt(t)||nt(t)!=s)return!1;var e=N(t);if(null===e)return!0;var n=k.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==x}(c)||ht(c)?(v=u,ht(u)?v=function(t){return function(t,e,n){var r=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var a=e[i],s=void 0;void 0===s&&(s=t[a]),r?et(n,a,s):Q(n,a,s)}return n}(t,_t(t))}(u):bt(u)&&!mt(u)||(v=function(t){return"function"!=typeof t.constructor||ct(t)?{}:G(N(t))}(c))):m=!1}m&&(a.set(c,v),i(v,c,r,o,a),a.delete(c)),Z(t,n,v)}}(t,e,a,n,it,r,i);else{var u=r?r(lt(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),Z(t,a,u)}},_t)}var ot=L?function(t,e){return L(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Ct;function at(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function st(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!bt(t)||function(t){return!!E&&E in t}(t))&&(mt(t)?T:u).test(function(t){if(null!=t){try{return A.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function ut(t,e){var n=typeof t;return!!(e=null==e?i:e)&&("number"==n||"symbol"!=n&&c.test(t))&&t>-1&&t%1==0&&t<e}function ct(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)}function lt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var dt=function(t){var e=0,n=0;return function(){var r=$(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ot);function pt(t,e){return t===e||t!=t&&e!=e}var ht=rt(function(){return arguments}())?rt:function(t){return wt(t)&&k.call(t,"callee")&&!M.call(t,"callee")},ft=Array.isArray;function yt(t){return null!=t&&gt(t.length)&&!mt(t)}var vt=V||function(){return!1};function mt(t){if(!bt(t))return!1;var e=nt(t);return e==a||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}function bt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function wt(t){return null!=t&&"object"==typeof t}var St=_?function(t){return function(e){return t(e)}}(_):function(t){return wt(t)&&gt(t.length)&&!!l[nt(t)]};function _t(t){return yt(t)?function(t,e){var n=ft(t),r=!n&&ht(t),i=!n&&!r&&vt(t),o=!n&&!r&&!i&&St(t),a=n||r||i||o,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=s.length;for(var c in t)!e&&!k.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ut(c,u))||s.push(c);return s}(t,!0):function(t){if(!bt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=ct(t),n=[];for(var r in t)("constructor"!=r||!e&&k.call(t,r))&&n.push(r);return n}(t)}var It,Pt=(It=function(t,e,n){it(t,e,n)},function(t,e){return dt(function(t,e,n){return e=q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=q(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,s)}}(t,e,Ct),t+"")}(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=It.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(t,e,n){if(!bt(n))return!1;var r=typeof e;return!!("number"==r?yt(n)&&ut(e,n.length):"string"==r&&e in n)&&pt(n[e],t)}(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var a=e[n];a&&It(t,a,n)}return t}));function Ct(t){return t}t.exports=Pt},168:t=>{var e;e=function(){function t(){for(var t=0,e={};t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}function e(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(e,n,o){if("undefined"!=typeof document){"number"==typeof(o=t({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var a=JSON.stringify(n);/^[\{\[]/.test(a)&&(n=a)}catch(t){}n=r.write?r.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var u in o)o[u]&&(s+="; "+u,!0!==o[u]&&(s+="="+o[u].split(";")[0]));return document.cookie=e+"="+n+s}}function a(t,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],a=0;a<o.length;a++){var s=o[a].split("="),u=s.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=e(s[0]);if(u=(r.read||r)(u,c)||e(u),n)try{u=JSON.parse(u)}catch(t){}if(i[c]=u,t===c)break}catch(t){}}return t?i[t]:i}}return i.set=o,i.get=function(t){return a(t,!1)},i.getJSON=function(t){return a(t,!0)},i.remove=function(e,n){o(e,"",t(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}(function(){})},"function"==typeof define&&define.amd&&define(e),t.exports=e()},282:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(9722);e.default=function(){return r||(r=i.default()),r}},315:(t,e,n)=>{"use strict";n(4886).default;var r=n(471);e.Hb=r.default;var i=n(5895);e.vQ=i.default,n(7995).default,n(9722).default,n(282).default},321:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(168),i=n(1675),o=n(5861),a=n(4670);function s(t){return new a.A(new o.A,new i.A,r,t)}},471:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(4886);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},710:(t,e,n)=>{"use strict";function r(t){return"object"!=typeof t||null===t?t:Object.keys(t).filter(function(e){return void 0!==t[e]}).map(function(e){var n=t[e];return"string"==typeof n?e+"="+encodeURIComponent(n):e+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}n.d(e,{A:()=>r})},803:t=>{"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}},1675:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(4321),i=n(710),o=/application\/(\w+\+)?json/,a=/application\/x-www-form-urlencoded/;const s=function(){function t(){}return t.prototype.toRequestBody=function(t){var e=t.headers?this._getHeader(t.headers,"Content-Type"):"";if(t.body){if(o.test(e))return JSON.stringify(t.body);if(a.test(e))return(0,i.A)(t.body)}return t.body},t.prototype.toResponse=function(t){var e=this._parseResponseHeaders(t.getAllResponseHeaders());return{body:this._parseResponseBody("response"in t?t.response:t.responseText,e),headers:e,status:t.status,statusText:t.statusText}},t.prototype._parseResponseBody=function(t,e){var n=this._getHeader(e,"Content-Type");return t&&o.test(n)?JSON.parse(t):t},t.prototype._parseResponseHeaders=function(t){return(t?t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(t,e){var n,i=e.split(":"),o=(i.shift()||"").trim();return o?(0,r.Cl)((0,r.Cl)({},t),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):t},{})},t.prototype._getHeader=function(t,e){return t&&e&&(t[e]||t[e.toLowerCase()])||""},t}()},1915:t=>{"use strict";var e="%[a-f0-9]{2}",n=new RegExp("("+e+")|([^%]+?)","gi"),r=new RegExp("("+e+")+","gi");function i(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function o(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(n)||[],r=1;r<e.length;r++)e=(t=i(e,r).join("")).match(n)||[];return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var i=o(n[0]);i!==n[0]&&(e[n[0]]=i)}n=r.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),s=0;s<a.length;s++){var u=a[s];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},2024:(t,e,n)=>{"use strict";n.d(e,{A:()=>r});const r=function(){function t(t){var e=this;this._delay=t,this._resolve=function(){},this._promise=new Promise(function(t){e._resolve=t})}return t.prototype.onComplete=function(t){this._promise.then(t)},t.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},t.prototype.start=function(){var t=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return t.complete()},this._delay))},t}()},4043:(t,e,n)=>{"use strict";n.r(e),n.d(e,{RequestSender:()=>o.A,Timeout:()=>a.A,createRequestSender:()=>r.A,createTimeout:()=>i.A});var r=n(321),i=n(6889),o=n(4670),a=n(2024)},4321:(t,e,n)=>{"use strict";n.d(e,{Cl:()=>r});var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)}},4325:(t,e,n)=>{"use strict";n.d(e,{g:()=>i});var r=n(5889),i=function(){function t(){this._cache={}}return t.prototype.read=function(t,e){var n=this.getKey(t,e.params);return this._cache[n]||null},t.prototype.write=function(t,e,n){var r=this.getKey(t,e.params);this._cache[r]=n},t.prototype.getKey=function(t,e){return void 0===e&&(e={}),0===Object.keys(e).length?t:t+"?"+r.As(e)},t}()},4475:t=>{"use strict";var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var o,a,s=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in o=Object(arguments[u]))n.call(o,c)&&(s[c]=o[c]);if(e){a=e(o);for(var l=0;l<a.length;l++)r.call(o,a[l])&&(s[a[l]]=o[a[l]])}}return s}},4670:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),u=n(2024);const c=function(){function t(t,e,n,r){void 0===r&&(r={}),this._requestFactory=t,this._payloadTransformer=e,this._cookie=n,this._options=r,this._cache=this._options.cache||new a.g}return t.prototype.sendRequest=function(t,e){var n=this,r=this._mergeDefaultOptions(t,e),i=this._getCachedRequest(t,r);if(i)return Promise.resolve(i);var o=this._requestFactory.createRequest(this._prependHost(t),r);return new Promise(function(e,i){var a=function(){var a=n._payloadTransformer.toResponse(o);a.status>=200&&a.status<300?(n._cacheRequest(t,r,a),e(a)):i(a)};o.onload=a,o.onerror=a,o.onabort=a,o.ontimeout=a,r.timeout instanceof u.A&&(r.timeout.onComplete(function(){return o.abort()}),r.timeout.start()),(0,s.A)(r.timeout)&&r.timeout.then(function(){return o.abort()}),o.send(n._payloadTransformer.toRequestBody(r))})},t.prototype.get=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"GET"}))},t.prototype.post=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"POST"}))},t.prototype.put=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PUT"}))},t.prototype.patch=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PATCH"}))},t.prototype.delete=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"DELETE"}))},t.prototype._mergeDefaultOptions=function(t,e){var n={credentials:!0,encodeParams:!0,headers:{Accept:"application/json, text/plain, */*"},method:"GET"},r=this._cookie.get("XSRF-TOKEN");return r&&n.headers&&!this._isAssetRequest(t,e)&&this._isLocalRequest(t)&&(n.headers["X-XSRF-TOKEN"]=r),e&&e.body&&n.headers&&(n.headers["Content-Type"]="application/json"),o()({},n,e)},t.prototype._prependHost=function(t){return!this._options.host||/^https?:\/\//.test(t)?t:this._options.host.replace(/\/$/,"")+"/"+t.replace(/^\//,"")},t.prototype._shouldCacheRequest=function(t){return"GET"===(t.method||"GET").toUpperCase()&&Boolean(t.cache)},t.prototype._getCachedRequest=function(t,e){return this._shouldCacheRequest(e)?this._cache.read(t,e):null},t.prototype._cacheRequest=function(t,e,n){this._shouldCacheRequest(e)&&this._cache.write(t,e,n)},t.prototype._isAssetRequest=function(t,e){return(!e||!e.method||"GET"===e.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(t.split("?")[0])},t.prototype._isLocalRequest=function(t){return!!t.match(new RegExp("^(https?:)?//"+window.location.hostname))||!t.match(new RegExp("^(https?:)?//"))},t}()},4843:(t,e,n)=>{"use strict";function r(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}n.d(e,{A:()=>r})},4886:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._scripts={},this._preloadedScripts={}}return t.prototype.loadScript=function(t,e){var n=this;return this._scripts[t]||(this._scripts[t]=new Promise(function(r,i){var o=document.createElement("script"),a=e||{},s=a.async,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onreadystatechange=function(){return r()},o.onerror=function(e){delete n._scripts[t],i(e)},o.async=u,o.src=t,document.body.appendChild(o)})),this._scripts[t]},t.prototype.loadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadScript(t,e)})).then(function(){})},t.prototype.preloadScript=function(t,e){var n=this;return this._preloadedScripts[t]||(this._preloadedScripts[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o?"prefetch":"preload";if(n._browserSupport.canSupportRel(a)){var s=document.createElement("link");s.as="script",s.rel=a,s.href=t,s.onload=function(){r()},s.onerror=function(){delete n._preloadedScripts[t],i()},document.head.appendChild(s)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"application/javascript"}}).then(function(){return r()}).catch(i)})),this._preloadedScripts[t]},t.prototype.preloadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadScript(t,e)})).then(function(){})},t}();e.default=n},5470:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9783),i=function(){function t(t,e){this._formBuilder=t,this._options=e}return t.prototype.postForm=function(t,e,n,r){var i=this._formBuilder.build(this._prependHost(t),e,r);window.addEventListener("unload",function t(){window.removeEventListener("unload",t),n&&n()}),document.body.appendChild(i),i.submit()},t.prototype._prependHost=function(t){return this._options&&this._options.host&&!(0,r.isAbsoluteUrl)(t)?(0,r.joinPaths)(this._options.host,t):t},t}();e.default=i},5477:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.canSupportRel=function(t){var e=document.createElement("link");return!!(e.relList&&e.relList.supports&&e.relList.supports(t))},t}();e.default=n},5861:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(5889);const i=function(){function t(){}return t.prototype.createRequest=function(t,e){var n=new XMLHttpRequest;return this._configureRequest(n,t,e),n},t.prototype._configureRequest=function(t,e,n){void 0===n&&(n={}),t.open(n.method||"GET",this._formatUrl(e,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(t,n.headers),"boolean"==typeof n.credentials&&(t.withCredentials=n.credentials),"number"==typeof n.timeout&&(t.timeout=n.timeout)},t.prototype._configureRequestHeaders=function(t,e){Object.keys(e).filter(function(t){return null!==e[t]}).forEach(function(n){t.setRequestHeader(n,e[n])})},t.prototype._formatUrl=function(t,e,n){return void 0===n&&(n=!0),e&&0!==Object.keys(e).length?t+"?"+r.As(e,{encode:n}):t},t}()},5889:(t,e,n)=>{"use strict";var r=n(803),i=n(4475);n(1915);function o(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}e.As=function(t,e){!1===(e=i({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=function(){});var n=function(t){switch(t.arrayFormat){case"index":return function(e,n,r){return null===n?[o(e,t),"[",r,"]"].join(""):[o(e,t),"[",o(r,t),"]=",o(n,t)].join("")};case"bracket":return function(e,n){return null===n?o(e,t):[o(e,t),"[]=",o(n,t)].join("")};default:return function(e,n){return null===n?o(e,t):[o(e,t),"=",o(n,t)].join("")}}}(e);return t?Object.keys(t).sort(e.sort).map(function(r){var i=t[r];if(void 0===i)return"";if(null===i)return o(r,e);if(Array.isArray(i)){var a=[];return i.slice().forEach(function(t){void 0!==t&&a.push(n(r,t,a.length))}),a.join("&")}return o(r,e)+"="+o(i,e)}).filter(function(t){return t.length>0}).join("&"):""}},5895:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(471);e.default=function(){return r||(r=i.default()),r}},6889:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(2024);function i(t){return new r.A(t)}},7995:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._stylesheets={},this._preloadedStylesheets={}}return t.prototype.loadStylesheet=function(t,e){var n=this;return this._stylesheets[t]||(this._stylesheets[t]=new Promise(function(r,i){var o=document.createElement("link"),a=e||{},s=a.prepend,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onerror=function(e){delete n._stylesheets[t],i(e)},o.rel="stylesheet",o.href=t,u&&document.head.children[0]?document.head.insertBefore(o,document.head.children[0]):document.head.appendChild(o)})),this._stylesheets[t]},t.prototype.loadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadStylesheet(t,e)})).then(function(){})},t.prototype.preloadStylesheet=function(t,e){var n=this;return this._preloadedStylesheets[t]||(this._preloadedStylesheets[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o,s=a?"prefetch":"preload";if(n._browserSupport.canSupportRel(s)){var u=document.createElement("link");u.as="style",u.rel=a?"prefetch":"preload",u.href=t,u.onload=function(){r()},u.onerror=function(e){delete n._preloadedStylesheets[t],i(e)},document.head.appendChild(u)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"text/css"}}).then(function(){return r()}).catch(i)})),this._preloadedStylesheets[t]},t.prototype.preloadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadStylesheet(t,e)})).then(function(){})},t}();e.default=n},8686:(t,e,n)=>{"use strict";e.createFormPoster=void 0;var r=n(9165);Object.defineProperty(e,"createFormPoster",{enumerable:!0,get:function(){return r.default}});n(5470)},9165:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9828),i=n(5470);e.default=function(t){var e=new r.default;return new i.default(e,t)}},9440:function(t,e,n){t=n.nmd(t),function(){var r,i="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,u=128,c=1/0,l=9007199254740991,d=NaN,p=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",v="[object Boolean]",m="[object Date]",g="[object Error]",b="[object Function]",w="[object GeneratorFunction]",S="[object Map]",_="[object Number]",I="[object Object]",P="[object Promise]",C="[object RegExp]",O="[object Set]",A="[object String]",k="[object Symbol]",E="[object WeakMap]",j="[object ArrayBuffer]",x="[object DataView]",T="[object Float32Array]",z="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",N="[object Int32Array]",D="[object Uint8Array]",M="[object Uint8ClampedArray]",U="[object Uint16Array]",R="[object Uint32Array]",L=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,W=RegExp($.source),G=RegExp(H.source),Y=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,et=RegExp(tt.source),nt=/^\s+/,rt=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ot=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,vt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,gt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_t="\\u2700-\\u27bf",It="a-z\\xdf-\\xf6\\xf8-\\xff",Pt="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="["+wt+"]",kt="["+Ot+"]",Et="["+St+"]",jt="\\d+",xt="["+_t+"]",Tt="["+It+"]",zt="[^"+wt+Ot+jt+_t+It+Pt+"]",Ft="\\ud83c[\\udffb-\\udfff]",Bt="[^"+wt+"]",Nt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="["+Pt+"]",Ut="\\u200d",Rt="(?:"+Tt+"|"+zt+")",Lt="(?:"+Mt+"|"+zt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+Et+"|"+Ft+")?",Ht="["+Ct+"]?",Wt=Ht+$t+"(?:"+Ut+"(?:"+[Bt,Nt,Dt].join("|")+")"+Ht+$t+")*",Gt="(?:"+[xt,Nt,Dt].join("|")+")"+Wt,Yt="(?:"+[Bt+Et+"?",Et,Nt,Dt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Xt=RegExp(Ft+"(?="+Ft+")|"+Yt+Wt,"g"),Zt=RegExp([Mt+"?"+Tt+"+"+Vt+"(?="+[kt,Mt,"$"].join("|")+")",Lt+"+"+qt+"(?="+[kt,Mt+Rt,"$"].join("|")+")",Mt+"?"+Rt+"+"+Vt,Mt+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",jt,Gt].join("|"),"g"),Qt=RegExp("["+Ut+wt+St+Ct+"]"),te=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ee=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ne=-1,re={};re[T]=re[z]=re[F]=re[B]=re[N]=re[D]=re[M]=re[U]=re[R]=!0,re[f]=re[y]=re[j]=re[v]=re[x]=re[m]=re[g]=re[b]=re[S]=re[_]=re[I]=re[C]=re[O]=re[A]=re[E]=!1;var ie={};ie[f]=ie[y]=ie[j]=ie[x]=ie[v]=ie[m]=ie[T]=ie[z]=ie[F]=ie[B]=ie[N]=ie[S]=ie[_]=ie[I]=ie[C]=ie[O]=ie[A]=ie[k]=ie[D]=ie[M]=ie[U]=ie[R]=!0,ie[g]=ie[b]=ie[E]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,se=parseInt,ue="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ce="object"==typeof self&&self&&self.Object===Object&&self,le=ue||ce||Function("return this")(),de=e&&!e.nodeType&&e,pe=de&&t&&!t.nodeType&&t,he=pe&&pe.exports===de,fe=he&&ue.process,ye=function(){try{return pe&&pe.require&&pe.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),ve=ye&&ye.isArrayBuffer,me=ye&&ye.isDate,ge=ye&&ye.isMap,be=ye&&ye.isRegExp,we=ye&&ye.isSet,Se=ye&&ye.isTypedArray;function _e(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ie(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function Pe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ae(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function ke(t,e){return!(null==t||!t.length)&&Me(t,e,0)>-1}function Ee(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function je(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function xe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Te(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ze(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Fe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Ve("length");function Ne(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function De(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Me(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):De(t,Re,n)}function Ue(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function Re(t){return t!=t}function Le(t,e){var n=null==t?0:t.length;return n?He(t,e)/n:d}function Ve(t){return function(e){return null==e?r:e[t]}}function qe(t){return function(e){return null==t?r:t[e]}}function $e(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function He(t,e){for(var n,i=-1,o=t.length;++i<o;){var a=e(t[i]);a!==r&&(n=n===r?a:n+a)}return n}function We(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ge(t){return t?t.slice(0,dn(t)+1).replace(nt,""):t}function Ye(t){return function(e){return t(e)}}function Ke(t,e){return je(e,function(e){return t[e]})}function Je(t,e){return t.has(e)}function Xe(t,e){for(var n=-1,r=t.length;++n<r&&Me(e,t[n],0)>-1;);return n}function Ze(t,e){for(var n=t.length;n--&&Me(e,t[n],0)>-1;);return n}var Qe=qe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=qe({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function en(t){return"\\"+oe[t]}function nn(t){return Qt.test(t)}function rn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function on(t,e){return function(n){return t(e(n))}}function an(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function sn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function un(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function cn(t){return nn(t)?function(t){for(var e=Xt.lastIndex=0;Xt.test(t);)++e;return e}(t):Be(t)}function ln(t){return nn(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.split("")}(t)}function dn(t){for(var e=t.length;e--&&rt.test(t.charAt(e)););return e}var pn=qe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function t(e){var n,rt=(e=null==e?le:hn.defaults(le.Object(),e,hn.pick(le,ee))).Array,wt=e.Date,St=e.Error,_t=e.Function,It=e.Math,Pt=e.Object,Ct=e.RegExp,Ot=e.String,At=e.TypeError,kt=rt.prototype,Et=_t.prototype,jt=Pt.prototype,xt=e["__core-js_shared__"],Tt=Et.toString,zt=jt.hasOwnProperty,Ft=0,Bt=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Nt=jt.toString,Dt=Tt.call(Pt),Mt=le._,Ut=Ct("^"+Tt.call(zt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rt=he?e.Buffer:r,Lt=e.Symbol,Vt=e.Uint8Array,qt=Rt?Rt.allocUnsafe:r,$t=on(Pt.getPrototypeOf,Pt),Ht=Pt.create,Wt=jt.propertyIsEnumerable,Gt=kt.splice,Yt=Lt?Lt.isConcatSpreadable:r,Xt=Lt?Lt.iterator:r,Qt=Lt?Lt.toStringTag:r,oe=function(){try{var t=uo(Pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ce=wt&&wt.now!==le.Date.now&&wt.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,pe=It.ceil,fe=It.floor,ye=Pt.getOwnPropertySymbols,Be=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,yn=on(Pt.keys,Pt),vn=It.max,mn=It.min,gn=wt.now,bn=e.parseInt,wn=It.random,Sn=kt.reverse,_n=uo(e,"DataView"),In=uo(e,"Map"),Pn=uo(e,"Promise"),Cn=uo(e,"Set"),On=uo(e,"WeakMap"),An=uo(Pt,"create"),kn=On&&new On,En={},jn=Do(_n),xn=Do(In),Tn=Do(Pn),zn=Do(Cn),Fn=Do(On),Bn=Lt?Lt.prototype:r,Nn=Bn?Bn.valueOf:r,Dn=Bn?Bn.toString:r;function Mn(t){if(ts(t)&&!qa(t)&&!(t instanceof Vn)){if(t instanceof Ln)return t;if(zt.call(t,"__wrapped__"))return Mo(t)}return new Ln(t)}var Un=function(){function t(){}return function(e){if(!Qa(e))return{};if(Ht)return Ht(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function Rn(){}function Ln(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function Vn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Hn;++e<n;)this.add(t[e])}function Gn(t){var e=this.__data__=new $n(t);this.size=e.size}function Yn(t,e){var n=qa(t),r=!n&&Va(t),i=!n&&!r&&Ga(t),o=!n&&!r&&!i&&us(t),a=n||r||i||o,s=a?We(t.length,Ot):[],u=s.length;for(var c in t)!e&&!zt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||vo(c,u))||s.push(c);return s}function Kn(t){var e=t.length;return e?t[Hr(0,e-1)]:r}function Jn(t,e){return To(Oi(t),or(e,0,t.length))}function Xn(t){return To(Oi(t))}function Zn(t,e,n){(n!==r&&!Ua(t[e],n)||n===r&&!(e in t))&&rr(t,e,n)}function Qn(t,e,n){var i=t[e];zt.call(t,e)&&Ua(i,n)&&(n!==r||e in t)||rr(t,e,n)}function tr(t,e){for(var n=t.length;n--;)if(Ua(t[n][0],e))return n;return-1}function er(t,e,n,r){return lr(t,function(t,i,o){e(r,t,n(t),o)}),r}function nr(t,e){return t&&Ai(e,js(e),t)}function rr(t,e,n){"__proto__"==e&&oe?oe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ir(t,e){for(var n=-1,i=e.length,o=rt(i),a=null==t;++n<i;)o[n]=a?r:Cs(t,e[n]);return o}function or(t,e,n){return t==t&&(n!==r&&(t=t<=n?t:n),e!==r&&(t=t>=e?t:e)),t}function ar(t,e,n,i,o,a){var s,u=1&e,c=2&e,l=4&e;if(n&&(s=o?n(t,i,o,a):n(t)),s!==r)return s;if(!Qa(t))return t;var d=qa(t);if(d){if(s=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&zt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!u)return Oi(t,s)}else{var p=po(t),h=p==b||p==w;if(Ga(t))return wi(t,u);if(p==I||p==f||h&&!o){if(s=c||h?{}:fo(t),!u)return c?function(t,e){return Ai(t,lo(t),e)}(t,function(t,e){return t&&Ai(e,xs(e),t)}(s,t)):function(t,e){return Ai(t,co(t),e)}(t,nr(s,t))}else{if(!ie[p])return o?t:{};s=function(t,e,n){var r,i=t.constructor;switch(e){case j:return Si(t);case v:case m:return new i(+t);case x:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case T:case z:case F:case B:case N:case D:case M:case U:case R:return _i(t,n);case S:return new i;case _:case A:return new i(t);case C:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new i;case k:return r=t,Nn?Pt(Nn.call(r)):{}}}(t,p,u)}}a||(a=new Gn);var y=a.get(t);if(y)return y;a.set(t,s),os(t)?t.forEach(function(r){s.add(ar(r,e,n,r,t,a))}):es(t)&&t.forEach(function(r,i){s.set(i,ar(r,e,n,i,t,a))});var g=d?r:(l?c?eo:to:c?xs:js)(t);return Pe(g||t,function(r,i){g&&(r=t[i=r]),Qn(s,i,ar(r,e,n,i,t,a))}),s}function sr(t,e,n){var i=n.length;if(null==t)return!i;for(t=Pt(t);i--;){var o=n[i],a=e[o],s=t[o];if(s===r&&!(o in t)||!a(s))return!1}return!0}function ur(t,e,n){if("function"!=typeof t)throw new At(i);return ko(function(){t.apply(r,n)},e)}function cr(t,e,n,r){var i=-1,o=ke,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=je(e,Ye(n))),r?(o=Ee,a=!1):e.length>=200&&(o=Je,a=!1,e=new Wn(e));t:for(;++i<s;){var l=t[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var p=c;p--;)if(e[p]===d)continue t;u.push(l)}else o(e,d,r)||u.push(l)}return u}Mn.templateSettings={escape:Y,evaluate:K,interpolate:J,variable:"",imports:{_:Mn}},Mn.prototype=Rn.prototype,Mn.prototype.constructor=Mn,Ln.prototype=Un(Rn.prototype),Ln.prototype.constructor=Ln,Vn.prototype=Un(Rn.prototype),Vn.prototype.constructor=Vn,qn.prototype.clear=function(){this.__data__=An?An(null):{},this.size=0},qn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},qn.prototype.get=function(t){var e=this.__data__;if(An){var n=e[t];return n===o?r:n}return zt.call(e,t)?e[t]:r},qn.prototype.has=function(t){var e=this.__data__;return An?e[t]!==r:zt.call(e,t)},qn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=An&&e===r?o:e,this},$n.prototype.clear=function(){this.__data__=[],this.size=0},$n.prototype.delete=function(t){var e=this.__data__,n=tr(e,t);return!(n<0||(n==e.length-1?e.pop():Gt.call(e,n,1),--this.size,0))},$n.prototype.get=function(t){var e=this.__data__,n=tr(e,t);return n<0?r:e[n][1]},$n.prototype.has=function(t){return tr(this.__data__,t)>-1},$n.prototype.set=function(t,e){var n=this.__data__,r=tr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(In||$n),string:new qn}},Hn.prototype.delete=function(t){var e=ao(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return ao(this,t).get(t)},Hn.prototype.has=function(t){return ao(this,t).has(t)},Hn.prototype.set=function(t,e){var n=ao(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(t){return this.__data__.set(t,o),this},Wn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.clear=function(){this.__data__=new $n,this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Gn.prototype.get=function(t){return this.__data__.get(t)},Gn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var lr=ji(gr),dr=ji(br,!0);function pr(t,e){var n=!0;return lr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function hr(t,e,n){for(var i=-1,o=t.length;++i<o;){var a=t[i],s=e(a);if(null!=s&&(u===r?s==s&&!ss(s):n(s,u)))var u=s,c=a}return c}function fr(t,e){var n=[];return lr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=yo),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?yr(s,e-1,n,r,i):xe(i,s):r||(i[i.length]=s)}return i}var vr=xi(),mr=xi(!0);function gr(t,e){return t&&vr(t,e,js)}function br(t,e){return t&&mr(t,e,js)}function wr(t,e){return Ae(e,function(e){return Ja(t[e])})}function Sr(t,e){for(var n=0,i=(e=vi(e,t)).length;null!=t&&n<i;)t=t[No(e[n++])];return n&&n==i?t:r}function _r(t,e,n){var r=e(t);return qa(t)?r:xe(r,n(t))}function Ir(t){return null==t?t===r?"[object Undefined]":"[object Null]":Qt&&Qt in Pt(t)?function(t){var e=zt.call(t,Qt),n=t[Qt];try{t[Qt]=r;var i=!0}catch(t){}var o=Nt.call(t);return i&&(e?t[Qt]=n:delete t[Qt]),o}(t):function(t){return Nt.call(t)}(t)}function Pr(t,e){return t>e}function Cr(t,e){return null!=t&&zt.call(t,e)}function Or(t,e){return null!=t&&e in Pt(t)}function Ar(t,e,n){for(var i=n?Ee:ke,o=t[0].length,a=t.length,s=a,u=rt(a),c=1/0,l=[];s--;){var d=t[s];s&&e&&(d=je(d,Ye(e))),c=mn(d.length,c),u[s]=!n&&(e||o>=120&&d.length>=120)?new Wn(s&&d):r}d=t[0];var p=-1,h=u[0];t:for(;++p<o&&l.length<c;){var f=d[p],y=e?e(f):f;if(f=n||0!==f?f:0,!(h?Je(h,y):i(l,y,n))){for(s=a;--s;){var v=u[s];if(!(v?Je(v,y):i(t[s],y,n)))continue t}h&&h.push(y),l.push(f)}}return l}function kr(t,e,n){var i=null==(t=Co(t,e=vi(e,t)))?t:t[No(Ko(e))];return null==i?r:_e(i,t,n)}function Er(t){return ts(t)&&Ir(t)==f}function jr(t,e,n,i,o){return t===e||(null==t||null==e||!ts(t)&&!ts(e)?t!=t&&e!=e:function(t,e,n,i,o,a){var s=qa(t),u=qa(e),c=s?y:po(t),l=u?y:po(e),d=(c=c==f?I:c)==I,p=(l=l==f?I:l)==I,h=c==l;if(h&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Gn),s||us(t)?Zi(t,e,n,i,o,a):function(t,e,n,r,i,o,a){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case j:return!(t.byteLength!=e.byteLength||!o(new Vt(t),new Vt(e)));case v:case m:case _:return Ua(+t,+e);case g:return t.name==e.name&&t.message==e.message;case C:case A:return t==e+"";case S:var s=rn;case O:var u=1&r;if(s||(s=sn),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var l=Zi(s(t),s(e),r,i,o,a);return a.delete(t),l;case k:if(Nn)return Nn.call(t)==Nn.call(e)}return!1}(t,e,c,n,i,o,a);if(!(1&n)){var b=d&&zt.call(t,"__wrapped__"),w=p&&zt.call(e,"__wrapped__");if(b||w){var P=b?t.value():t,E=w?e.value():e;return a||(a=new Gn),o(P,E,n,i,a)}}return!!h&&(a||(a=new Gn),function(t,e,n,i,o,a){var s=1&n,u=to(t),c=u.length;if(c!=to(e).length&&!s)return!1;for(var l=c;l--;){var d=u[l];if(!(s?d in e:zt.call(e,d)))return!1}var p=a.get(t),h=a.get(e);if(p&&h)return p==e&&h==t;var f=!0;a.set(t,e),a.set(e,t);for(var y=s;++l<c;){var v=t[d=u[l]],m=e[d];if(i)var g=s?i(m,v,d,e,t,a):i(v,m,d,t,e,a);if(!(g===r?v===m||o(v,m,n,i,a):g)){f=!1;break}y||(y="constructor"==d)}if(f&&!y){var b=t.constructor,w=e.constructor;b==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(f=!1)}return a.delete(t),a.delete(e),f}(t,e,n,i,o,a))}(t,e,n,i,jr,o))}function xr(t,e,n,i){var o=n.length,a=o,s=!i;if(null==t)return!a;for(t=Pt(t);o--;){var u=n[o];if(s&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=n[o])[0],l=t[c],d=u[1];if(s&&u[2]){if(l===r&&!(c in t))return!1}else{var p=new Gn;if(i)var h=i(l,d,c,t,e,p);if(!(h===r?jr(d,l,3,i,p):h))return!1}}return!0}function Tr(t){return!(!Qa(t)||(e=t,Bt&&Bt in e))&&(Ja(t)?Ut:ft).test(Do(t));var e}function zr(t){return"function"==typeof t?t:null==t?nu:"object"==typeof t?qa(t)?Mr(t[0],t[1]):Dr(t):du(t)}function Fr(t){if(!So(t))return yn(t);var e=[];for(var n in Pt(t))zt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Br(t,e){return t<e}function Nr(t,e){var n=-1,r=Ha(t)?rt(t.length):[];return lr(t,function(t,i,o){r[++n]=e(t,i,o)}),r}function Dr(t){var e=so(t);return 1==e.length&&e[0][2]?Io(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Mr(t,e){return go(t)&&_o(e)?Io(No(t),e):function(n){var i=Cs(n,t);return i===r&&i===e?Os(n,t):jr(e,i,3)}}function Ur(t,e,n,i,o){t!==e&&vr(e,function(a,s){if(o||(o=new Gn),Qa(a))!function(t,e,n,i,o,a,s){var u=Oo(t,n),c=Oo(e,n),l=s.get(c);if(l)Zn(t,n,l);else{var d=a?a(u,c,n+"",t,e,s):r,p=d===r;if(p){var h=qa(c),f=!h&&Ga(c),y=!h&&!f&&us(c);d=c,h||f||y?qa(u)?d=u:Wa(u)?d=Oi(u):f?(p=!1,d=wi(c,!0)):y?(p=!1,d=_i(c,!0)):d=[]:rs(c)||Va(c)?(d=u,Va(u)?d=vs(u):Qa(u)&&!Ja(u)||(d=fo(c))):p=!1}p&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Zn(t,n,d)}}(t,e,s,n,Ur,i,o);else{var u=i?i(Oo(t,s),a,s+"",t,e,o):r;u===r&&(u=a),Zn(t,s,u)}},xs)}function Rr(t,e){var n=t.length;if(n)return vo(e+=e<0?n:0,n)?t[e]:r}function Lr(t,e,n){e=e.length?je(e,function(t){return qa(t)?function(e){return Sr(e,1===t.length?t[0]:t)}:t}):[nu];var r=-1;e=je(e,Ye(oo()));var i=Nr(t,function(t,n,i){var o=je(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t){var e=t.length;for(t.sort(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r<a;){var u=Ii(i[r],o[r]);if(u)return r>=s?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)});e--;)t[e]=t[e].value;return t}(i)}function Vr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],s=Sr(t,a);n(s,a)&&Jr(o,vi(a,t),s)}return o}function qr(t,e,n,r){var i=r?Ue:Me,o=-1,a=e.length,s=t;for(t===e&&(e=Oi(e)),n&&(s=je(t,Ye(n)));++o<a;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(s,l,u,r))>-1;)s!==t&&Gt.call(s,u,1),Gt.call(t,u,1);return t}function $r(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;vo(i)?Gt.call(t,i,1):ui(t,i)}}return t}function Hr(t,e){return t+fe(wn()*(e-t+1))}function Wr(t,e){var n="";if(!t||e<1||e>l)return n;do{e%2&&(n+=t),(e=fe(e/2))&&(t+=t)}while(e);return n}function Gr(t,e){return Eo(Po(t,e,nu),t+"")}function Yr(t){return Kn(Us(t))}function Kr(t,e){var n=Us(t);return To(n,or(e,0,n.length))}function Jr(t,e,n,i){if(!Qa(t))return t;for(var o=-1,a=(e=vi(e,t)).length,s=a-1,u=t;null!=u&&++o<a;){var c=No(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=s){var d=u[c];(l=i?i(d,c,u):r)===r&&(l=Qa(d)?d:vo(e[o+1])?[]:{})}Qn(u,c,l),u=u[c]}return t}var Xr=kn?function(t,e){return kn.set(t,e),t}:nu,Zr=oe?function(t,e){return oe(t,"toString",{configurable:!0,enumerable:!1,value:Qs(e),writable:!0})}:nu;function Qr(t){return To(Us(t))}function ti(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=rt(i);++r<i;)o[r]=t[r+e];return o}function ei(t,e){var n;return lr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function ni(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!ss(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return ri(t,e,nu,n)}function ri(t,e,n,i){var o=0,a=null==t?0:t.length;if(0===a)return 0;for(var s=(e=n(e))!=e,u=null===e,c=ss(e),l=e===r;o<a;){var d=fe((o+a)/2),p=n(t[d]),h=p!==r,f=null===p,y=p==p,v=ss(p);if(s)var m=i||y;else m=l?y&&(i||h):u?y&&h&&(i||!f):c?y&&h&&!f&&(i||!v):!f&&!v&&(i?p<=e:p<e);m?o=d+1:a=d}return mn(a,4294967294)}function ii(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Ua(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function oi(t){return"number"==typeof t?t:ss(t)?d:+t}function ai(t){if("string"==typeof t)return t;if(qa(t))return je(t,ai)+"";if(ss(t))return Dn?Dn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function si(t,e,n){var r=-1,i=ke,o=t.length,a=!0,s=[],u=s;if(n)a=!1,i=Ee;else if(o>=200){var c=e?null:Wi(t);if(c)return sn(c);a=!1,i=Je,u=new Wn}else u=e?[]:s;t:for(;++r<o;){var l=t[r],d=e?e(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var p=u.length;p--;)if(u[p]===d)continue t;e&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s}function ui(t,e){return null==(t=Co(t,e=vi(e,t)))||delete t[No(Ko(e))]}function ci(t,e,n,r){return Jr(t,e,n(Sr(t,e)),r)}function li(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ti(t,r?0:o,r?o+1:i):ti(t,r?o+1:0,r?i:o)}function di(t,e){var n=t;return n instanceof Vn&&(n=n.value()),Te(e,function(t,e){return e.func.apply(e.thisArg,xe([t],e.args))},n)}function pi(t,e,n){var r=t.length;if(r<2)return r?si(t[0]):[];for(var i=-1,o=rt(r);++i<r;)for(var a=t[i],s=-1;++s<r;)s!=i&&(o[i]=cr(o[i]||a,t[s],e,n));return si(yr(o,1),e,n)}function hi(t,e,n){for(var i=-1,o=t.length,a=e.length,s={};++i<o;){var u=i<a?e[i]:r;n(s,t[i],u)}return s}function fi(t){return Wa(t)?t:[]}function yi(t){return"function"==typeof t?t:nu}function vi(t,e){return qa(t)?t:go(t,e)?[t]:Bo(ms(t))}var mi=Gr;function gi(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ti(t,e,n)}var bi=ue||function(t){return le.clearTimeout(t)};function wi(t,e){if(e)return t.slice();var n=t.length,r=qt?qt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function _i(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ii(t,e){if(t!==e){var n=t!==r,i=null===t,o=t==t,a=ss(t),s=e!==r,u=null===e,c=e==e,l=ss(e);if(!u&&!l&&!a&&t>e||a&&s&&c&&!u&&!l||i&&s&&c||!n&&c||!o)return 1;if(!i&&!a&&!l&&t<e||l&&n&&o&&!i&&!a||u&&n&&o||!s&&o||!c)return-1}return 0}function Pi(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=vn(o-a,0),l=rt(u+c),d=!r;++s<u;)l[s]=e[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=t[i]);for(;c--;)l[s++]=t[i++];return l}function Ci(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,c=e.length,l=vn(o-s,0),d=rt(l+c),p=!r;++i<l;)d[i]=t[i];for(var h=i;++u<c;)d[h+u]=e[u];for(;++a<s;)(p||i<o)&&(d[h+n[a]]=t[i++]);return d}function Oi(t,e){var n=-1,r=t.length;for(e||(e=rt(r));++n<r;)e[n]=t[n];return e}function Ai(t,e,n,i){var o=!n;n||(n={});for(var a=-1,s=e.length;++a<s;){var u=e[a],c=i?i(n[u],t[u],u,n,t):r;c===r&&(c=t[u]),o?rr(n,u,c):Qn(n,u,c)}return n}function ki(t,e){return function(n,r){var i=qa(n)?Ie:er,o=e?e():{};return i(n,t,oo(r,2),o)}}function Ei(t){return Gr(function(e,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=t.length>3&&"function"==typeof a?(o--,a):r,s&&mo(n[0],n[1],s)&&(a=o<3?r:a,o=1),e=Pt(e);++i<o;){var u=n[i];u&&t(e,u,i,a)}return e})}function ji(t,e){return function(n,r){if(null==n)return n;if(!Ha(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=Pt(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function xi(t){return function(e,n,r){for(var i=-1,o=Pt(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}function Ti(t){return function(e){var n=nn(e=ms(e))?ln(e):r,i=n?n[0]:e.charAt(0),o=n?gi(n,1).join(""):e.slice(1);return i[t]()+o}}function zi(t){return function(e){return Te(Js(Vs(e).replace(Kt,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Un(t.prototype),r=t.apply(n,e);return Qa(r)?r:n}}function Bi(t){return function(e,n,i){var o=Pt(e);if(!Ha(e)){var a=oo(n,3);e=js(e),n=function(t){return a(o[t],t,o)}}var s=t(e,n,i);return s>-1?o[a?e[s]:s]:r}}function Ni(t){return Qi(function(e){var n=e.length,o=n,a=Ln.prototype.thru;for(t&&e.reverse();o--;){var s=e[o];if("function"!=typeof s)throw new At(i);if(a&&!u&&"wrapper"==ro(s))var u=new Ln([],!0)}for(o=u?o:n;++o<n;){var c=ro(s=e[o]),l="wrapper"==c?no(s):r;u=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ro(l[0])].apply(u,l[3]):1==s.length&&bo(s)?u[c]():u.thru(s)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&qa(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function Di(t,e,n,i,o,a,s,c,l,d){var p=e&u,h=1&e,f=2&e,y=24&e,v=512&e,m=f?r:Fi(t);return function u(){for(var g=arguments.length,b=rt(g),w=g;w--;)b[w]=arguments[w];if(y)var S=io(u),_=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,S);if(i&&(b=Pi(b,i,o,y)),a&&(b=Ci(b,a,s,y)),g-=_,y&&g<d){var I=an(b,S);return $i(t,e,Di,u.placeholder,n,b,I,c,l,d-g)}var P=h?n:this,C=f?P[t]:t;return g=b.length,c?b=function(t,e){for(var n=t.length,i=mn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=vo(a,n)?o[a]:r}return t}(b,c):v&&g>1&&b.reverse(),p&&l<g&&(b.length=l),this&&this!==le&&this instanceof u&&(C=m||Fi(C)),C.apply(P,b)}}function Mi(t,e){return function(n,r){return function(t,e,n,r){return gr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Ui(t,e){return function(n,i){var o;if(n===r&&i===r)return e;if(n!==r&&(o=n),i!==r){if(o===r)return i;"string"==typeof n||"string"==typeof i?(n=ai(n),i=ai(i)):(n=oi(n),i=oi(i)),o=t(n,i)}return o}}function Ri(t){return Qi(function(e){return e=je(e,Ye(oo())),Gr(function(n){var r=this;return t(e,function(t){return _e(t,r,n)})})})}function Li(t,e){var n=(e=e===r?" ":ai(e)).length;if(n<2)return n?Wr(e,t):e;var i=Wr(e,pe(t/cn(e)));return nn(e)?gi(ln(i),0,t).join(""):i.slice(0,t)}function Vi(t){return function(e,n,i){return i&&"number"!=typeof i&&mo(e,n,i)&&(n=i=r),e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n,r){for(var i=-1,o=vn(pe((e-t)/(n||1)),0),a=rt(o);o--;)a[r?o:++i]=t,t+=n;return a}(e,n,i=i===r?e<n?1:-1:ps(i),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ys(e),n=ys(n)),t(e,n)}}function $i(t,e,n,i,o,a,u,c,l,d){var p=8&e;e|=p?s:64,4&(e&=~(p?64:s))||(e&=-4);var h=[t,e,o,p?a:r,p?u:r,p?r:a,p?r:u,c,l,d],f=n.apply(r,h);return bo(t)&&Ao(f,h),f.placeholder=i,jo(f,t,e)}function Hi(t){var e=It[t];return function(t,n){if(t=ys(t),(n=null==n?0:mn(hs(n),292))&&qe(t)){var r=(ms(t)+"e").split("e");return+((r=(ms(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Wi=Cn&&1/sn(new Cn([,-0]))[1]==c?function(t){return new Cn(t)}:su;function Gi(t){return function(e){var n=po(e);return n==S?rn(e):n==O?un(e):function(t,e){return je(e,function(e){return[e,t[e]]})}(e,t(e))}}function Yi(t,e,n,o,c,l,d,p){var h=2&e;if(!h&&"function"!=typeof t)throw new At(i);var f=o?o.length:0;if(f||(e&=-97,o=c=r),d=d===r?d:vn(hs(d),0),p=p===r?p:hs(p),f-=c?c.length:0,64&e){var y=o,v=c;o=c=r}var m=h?r:no(t),g=[t,e,n,o,c,y,v,l,d,p];if(m&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==u&&8==n||r==u&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var l=t[3];t[3]=l?Pi(l,c,e[4]):c,t[4]=l?an(t[3],a):e[4]}(c=e[5])&&(l=t[5],t[5]=l?Ci(l,c,e[6]):c,t[6]=l?an(t[5],a):e[6]),(c=e[7])&&(t[7]=c),r&u&&(t[8]=null==t[8]?e[8]:mn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(g,m),t=g[0],e=g[1],n=g[2],o=g[3],c=g[4],!(p=g[9]=g[9]===r?h?0:t.length:vn(g[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Fi(t);return function o(){for(var a=arguments.length,s=rt(a),u=a,c=io(o);u--;)s[u]=arguments[u];var l=a<3&&s[0]!==c&&s[a-1]!==c?[]:an(s,c);return(a-=l.length)<n?$i(t,e,Di,o.placeholder,r,s,l,r,r,n-a):_e(this&&this!==le&&this instanceof o?i:t,this,s)}}(t,e,p):e!=s&&33!=e||c.length?Di.apply(r,g):function(t,e,n,r){var i=1&e,o=Fi(t);return function e(){for(var a=-1,s=arguments.length,u=-1,c=r.length,l=rt(c+s),d=this&&this!==le&&this instanceof e?o:t;++u<c;)l[u]=r[u];for(;s--;)l[u++]=arguments[++a];return _e(d,i?n:this,l)}}(t,e,n,o);else var b=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==le&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return jo((m?Xr:Ao)(b,g),t,e)}function Ki(t,e,n,i){return t===r||Ua(t,jt[n])&&!zt.call(i,n)?e:t}function Ji(t,e,n,i,o,a){return Qa(t)&&Qa(e)&&(a.set(e,t),Ur(t,e,r,Ji,a),a.delete(e)),t}function Xi(t){return rs(t)?r:t}function Zi(t,e,n,i,o,a){var s=1&n,u=t.length,c=e.length;if(u!=c&&!(s&&c>u))return!1;var l=a.get(t),d=a.get(e);if(l&&d)return l==e&&d==t;var p=-1,h=!0,f=2&n?new Wn:r;for(a.set(t,e),a.set(e,t);++p<u;){var y=t[p],v=e[p];if(i)var m=s?i(v,y,p,e,t,a):i(y,v,p,t,e,a);if(m!==r){if(m)continue;h=!1;break}if(f){if(!Fe(e,function(t,e){if(!Je(f,e)&&(y===t||o(y,t,n,i,a)))return f.push(e)})){h=!1;break}}else if(y!==v&&!o(y,v,n,i,a)){h=!1;break}}return a.delete(t),a.delete(e),h}function Qi(t){return Eo(Po(t,r,$o),t+"")}function to(t){return _r(t,js,co)}function eo(t){return _r(t,xs,lo)}var no=kn?function(t){return kn.get(t)}:su;function ro(t){for(var e=t.name+"",n=En[e],r=zt.call(En,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function io(t){return(zt.call(Mn,"placeholder")?Mn:t).placeholder}function oo(){var t=Mn.iteratee||ru;return t=t===ru?zr:t,arguments.length?t(arguments[0],arguments[1]):t}function ao(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function so(t){for(var e=js(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,_o(i)]}return e}function uo(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return Tr(n)?n:r}var co=ye?function(t){return null==t?[]:(t=Pt(t),Ae(ye(t),function(e){return Wt.call(t,e)}))}:fu,lo=ye?function(t){for(var e=[];t;)xe(e,co(t)),t=$t(t);return e}:fu,po=Ir;function ho(t,e,n){for(var r=-1,i=(e=vi(e,t)).length,o=!1;++r<i;){var a=No(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Za(i)&&vo(a,i)&&(qa(t)||Va(t))}function fo(t){return"function"!=typeof t.constructor||So(t)?{}:Un($t(t))}function yo(t){return qa(t)||Va(t)||!!(Yt&&t&&t[Yt])}function vo(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&vt.test(t))&&t>-1&&t%1==0&&t<e}function mo(t,e,n){if(!Qa(n))return!1;var r=typeof e;return!!("number"==r?Ha(n)&&vo(e,n.length):"string"==r&&e in n)&&Ua(n[e],t)}function go(t,e){if(qa(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ss(t))||Z.test(t)||!X.test(t)||null!=e&&t in Pt(e)}function bo(t){var e=ro(t),n=Mn[e];if("function"!=typeof n||!(e in Vn.prototype))return!1;if(t===n)return!0;var r=no(n);return!!r&&t===r[0]}(_n&&po(new _n(new ArrayBuffer(1)))!=x||In&&po(new In)!=S||Pn&&po(Pn.resolve())!=P||Cn&&po(new Cn)!=O||On&&po(new On)!=E)&&(po=function(t){var e=Ir(t),n=e==I?t.constructor:r,i=n?Do(n):"";if(i)switch(i){case jn:return x;case xn:return S;case Tn:return P;case zn:return O;case Fn:return E}return e});var wo=xt?Ja:yu;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function _o(t){return t==t&&!Qa(t)}function Io(t,e){return function(n){return null!=n&&n[t]===e&&(e!==r||t in Pt(n))}}function Po(t,e,n){return e=vn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=vn(r.length-e,0),a=rt(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=rt(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),_e(t,this,s)}}function Co(t,e){return e.length<2?t:Sr(t,ti(e,0,-1))}function Oo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ao=xo(Xr),ko=de||function(t,e){return le.setTimeout(t,e)},Eo=xo(Zr);function jo(t,e,n){var r=e+"";return Eo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Pe(h,function(n){var r="_."+n[0];e&n[1]&&!ke(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ot);return e?e[1].split(at):[]}(r),n)))}function xo(t){var e=0,n=0;return function(){var i=gn(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function To(t,e){var n=-1,i=t.length,o=i-1;for(e=e===r?i:e;++n<e;){var a=Hr(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var zo,Fo,Bo=(zo=za(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Q,function(t,n,r,i){e.push(r?i.replace(ct,"$1"):n||t)}),e},function(t){return 500===Fo.size&&Fo.clear(),t}),Fo=zo.cache,zo);function No(t){if("string"==typeof t||ss(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Do(t){if(null!=t){try{return Tt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Mo(t){if(t instanceof Vn)return t.clone();var e=new Ln(t.__wrapped__,t.__chain__);return e.__actions__=Oi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Uo=Gr(function(t,e){return Wa(t)?cr(t,yr(e,1,Wa,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,yr(e,1,Wa,!0),oo(n,2)):[]}),Lo=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,yr(e,1,Wa,!0),r,n):[]});function Vo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=vn(r+i,0)),De(t,oo(e,3),i)}function qo(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return n!==r&&(o=hs(n),o=n<0?vn(i+o,0):mn(o,i-1)),De(t,oo(e,3),o,!0)}function $o(t){return null!=t&&t.length?yr(t,1):[]}function Ho(t){return t&&t.length?t[0]:r}var Wo=Gr(function(t){var e=je(t,fi);return e.length&&e[0]===t[0]?Ar(e):[]}),Go=Gr(function(t){var e=Ko(t),n=je(t,fi);return e===Ko(n)?e=r:n.pop(),n.length&&n[0]===t[0]?Ar(n,oo(e,2)):[]}),Yo=Gr(function(t){var e=Ko(t),n=je(t,fi);return(e="function"==typeof e?e:r)&&n.pop(),n.length&&n[0]===t[0]?Ar(n,r,e):[]});function Ko(t){var e=null==t?0:t.length;return e?t[e-1]:r}var Jo=Gr(Xo);function Xo(t,e){return t&&t.length&&e&&e.length?qr(t,e):t}var Zo=Qi(function(t,e){var n=null==t?0:t.length,r=ir(t,e);return $r(t,je(e,function(t){return vo(t,n)?+t:t}).sort(Ii)),r});function Qo(t){return null==t?t:Sn.call(t)}var ta=Gr(function(t){return si(yr(t,1,Wa,!0))}),ea=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),si(yr(t,1,Wa,!0),oo(e,2))}),na=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,si(yr(t,1,Wa,!0),r,e)});function ra(t){if(!t||!t.length)return[];var e=0;return t=Ae(t,function(t){if(Wa(t))return e=vn(t.length,e),!0}),We(e,function(e){return je(t,Ve(e))})}function ia(t,e){if(!t||!t.length)return[];var n=ra(t);return null==e?n:je(n,function(t){return _e(e,r,t)})}var oa=Gr(function(t,e){return Wa(t)?cr(t,e):[]}),aa=Gr(function(t){return pi(Ae(t,Wa))}),sa=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),pi(Ae(t,Wa),oo(e,2))}),ua=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,pi(Ae(t,Wa),r,e)}),ca=Gr(ra),la=Gr(function(t){var e=t.length,n=e>1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,ia(t,n)});function da(t){var e=Mn(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var ha=Qi(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return ir(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Vn&&vo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(r),t})):this.thru(o)}),fa=ki(function(t,e,n){zt.call(t,n)?++t[n]:rr(t,n,1)}),ya=Bi(Vo),va=Bi(qo);function ma(t,e){return(qa(t)?Pe:lr)(t,oo(e,3))}function ga(t,e){return(qa(t)?Ce:dr)(t,oo(e,3))}var ba=ki(function(t,e,n){zt.call(t,n)?t[n].push(e):rr(t,n,[e])}),wa=Gr(function(t,e,n){var r=-1,i="function"==typeof e,o=Ha(t)?rt(t.length):[];return lr(t,function(t){o[++r]=i?_e(e,t,n):kr(t,e,n)}),o}),Sa=ki(function(t,e,n){rr(t,n,e)});function _a(t,e){return(qa(t)?je:Nr)(t,oo(e,3))}var Ia=ki(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),Pa=Gr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&mo(t,e[0],e[1])?e=[]:n>2&&mo(e[0],e[1],e[2])&&(e=[e[0]]),Lr(t,yr(e,1),[])}),Ca=ce||function(){return le.Date.now()};function Oa(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Yi(t,u,r,r,r,r,e)}function Aa(t,e){var n;if("function"!=typeof e)throw new At(i);return t=hs(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=r),n}}var ka=Gr(function(t,e,n){var r=1;if(n.length){var i=an(n,io(ka));r|=s}return Yi(t,r,e,n,i)}),Ea=Gr(function(t,e,n){var r=3;if(n.length){var i=an(n,io(Ea));r|=s}return Yi(e,r,t,n,i)});function ja(t,e,n){var o,a,s,u,c,l,d=0,p=!1,h=!1,f=!0;if("function"!=typeof t)throw new At(i);function y(e){var n=o,i=a;return o=a=r,d=e,u=t.apply(i,n)}function v(t){var n=t-l;return l===r||n>=e||n<0||h&&t-d>=s}function m(){var t=Ca();if(v(t))return g(t);c=ko(m,function(t){var n=e-(t-l);return h?mn(n,s-(t-d)):n}(t))}function g(t){return c=r,f&&o?y(t):(o=a=r,u)}function b(){var t=Ca(),n=v(t);if(o=arguments,a=this,l=t,n){if(c===r)return function(t){return d=t,c=ko(m,e),p?y(t):u}(l);if(h)return bi(c),c=ko(m,e),y(l)}return c===r&&(c=ko(m,e)),u}return e=ys(e)||0,Qa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?vn(ys(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){c!==r&&bi(c),d=0,o=l=a=c=r},b.flush=function(){return c===r?u:g(Ca())},b}var xa=Gr(function(t,e){return ur(t,1,e)}),Ta=Gr(function(t,e,n){return ur(t,ys(e)||0,n)});function za(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new At(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Hn),n}function Fa(t){if("function"!=typeof t)throw new At(i);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}za.Cache=Hn;var Ba=mi(function(t,e){var n=(e=1==e.length&&qa(e[0])?je(e[0],Ye(oo())):je(yr(e,1),Ye(oo()))).length;return Gr(function(r){for(var i=-1,o=mn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return _e(t,this,r)})}),Na=Gr(function(t,e){var n=an(e,io(Na));return Yi(t,s,r,e,n)}),Da=Gr(function(t,e){var n=an(e,io(Da));return Yi(t,64,r,e,n)}),Ma=Qi(function(t,e){return Yi(t,256,r,r,r,e)});function Ua(t,e){return t===e||t!=t&&e!=e}var Ra=qi(Pr),La=qi(function(t,e){return t>=e}),Va=Er(function(){return arguments}())?Er:function(t){return ts(t)&&zt.call(t,"callee")&&!Wt.call(t,"callee")},qa=rt.isArray,$a=ve?Ye(ve):function(t){return ts(t)&&Ir(t)==j};function Ha(t){return null!=t&&Za(t.length)&&!Ja(t)}function Wa(t){return ts(t)&&Ha(t)}var Ga=Be||yu,Ya=me?Ye(me):function(t){return ts(t)&&Ir(t)==m};function Ka(t){if(!ts(t))return!1;var e=Ir(t);return e==g||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!rs(t)}function Ja(t){if(!Qa(t))return!1;var e=Ir(t);return e==b||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Xa(t){return"number"==typeof t&&t==hs(t)}function Za(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function Qa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ts(t){return null!=t&&"object"==typeof t}var es=ge?Ye(ge):function(t){return ts(t)&&po(t)==S};function ns(t){return"number"==typeof t||ts(t)&&Ir(t)==_}function rs(t){if(!ts(t)||Ir(t)!=I)return!1;var e=$t(t);if(null===e)return!0;var n=zt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Tt.call(n)==Dt}var is=be?Ye(be):function(t){return ts(t)&&Ir(t)==C},os=we?Ye(we):function(t){return ts(t)&&po(t)==O};function as(t){return"string"==typeof t||!qa(t)&&ts(t)&&Ir(t)==A}function ss(t){return"symbol"==typeof t||ts(t)&&Ir(t)==k}var us=Se?Ye(Se):function(t){return ts(t)&&Za(t.length)&&!!re[Ir(t)]},cs=qi(Br),ls=qi(function(t,e){return t<=e});function ds(t){if(!t)return[];if(Ha(t))return as(t)?ln(t):Oi(t);if(Xt&&t[Xt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Xt]());var e=po(t);return(e==S?rn:e==O?sn:Us)(t)}function ps(t){return t?(t=ys(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function hs(t){var e=ps(t),n=e%1;return e==e?n?e-n:e:0}function fs(t){return t?or(hs(t),0,p):0}function ys(t){if("number"==typeof t)return t;if(ss(t))return d;if(Qa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Qa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ge(t);var n=ht.test(t);return n||yt.test(t)?se(t.slice(2),n?2:8):pt.test(t)?d:+t}function vs(t){return Ai(t,xs(t))}function ms(t){return null==t?"":ai(t)}var gs=Ei(function(t,e){if(So(e)||Ha(e))Ai(e,js(e),t);else for(var n in e)zt.call(e,n)&&Qn(t,n,e[n])}),bs=Ei(function(t,e){Ai(e,xs(e),t)}),ws=Ei(function(t,e,n,r){Ai(e,xs(e),t,r)}),Ss=Ei(function(t,e,n,r){Ai(e,js(e),t,r)}),_s=Qi(ir),Is=Gr(function(t,e){t=Pt(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&mo(e[0],e[1],o)&&(i=1);++n<i;)for(var a=e[n],s=xs(a),u=-1,c=s.length;++u<c;){var l=s[u],d=t[l];(d===r||Ua(d,jt[l])&&!zt.call(t,l))&&(t[l]=a[l])}return t}),Ps=Gr(function(t){return t.push(r,Ji),_e(zs,r,t)});function Cs(t,e,n){var i=null==t?r:Sr(t,e);return i===r?n:i}function Os(t,e){return null!=t&&ho(t,e,Or)}var As=Mi(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Nt.call(e)),t[e]=n},Qs(nu)),ks=Mi(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Nt.call(e)),zt.call(t,e)?t[e].push(n):t[e]=[n]},oo),Es=Gr(kr);function js(t){return Ha(t)?Yn(t):Fr(t)}function xs(t){return Ha(t)?Yn(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var n in Pt(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&zt.call(t,r))&&n.push(r);return n}(t)}var Ts=Ei(function(t,e,n){Ur(t,e,n)}),zs=Ei(function(t,e,n,r){Ur(t,e,n,r)}),Fs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=vi(e,t),r||(r=e.length>1),e}),Ai(t,eo(t),n),r&&(n=ar(n,7,Xi));for(var i=e.length;i--;)ui(n,e[i]);return n}),Bs=Qi(function(t,e){return null==t?{}:function(t,e){return Vr(t,e,function(e,n){return Os(t,n)})}(t,e)});function Ns(t,e){if(null==t)return{};var n=je(eo(t),function(t){return[t]});return e=oo(e),Vr(t,n,function(t,n){return e(t,n[0])})}var Ds=Gi(js),Ms=Gi(xs);function Us(t){return null==t?[]:Ke(t,js(t))}var Rs=zi(function(t,e,n){return e=e.toLowerCase(),t+(n?Ls(e):e)});function Ls(t){return Ks(ms(t).toLowerCase())}function Vs(t){return(t=ms(t))&&t.replace(mt,Qe).replace(Jt,"")}var qs=zi(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),$s=zi(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Hs=Ti("toLowerCase"),Ws=zi(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),Gs=zi(function(t,e,n){return t+(n?" ":"")+Ks(e)}),Ys=zi(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Ks=Ti("toUpperCase");function Js(t,e,n){return t=ms(t),(e=n?r:e)===r?function(t){return te.test(t)}(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.match(st)||[]}(t):t.match(e)||[]}var Xs=Gr(function(t,e){try{return _e(t,r,e)}catch(t){return Ka(t)?t:new St(t)}}),Zs=Qi(function(t,e){return Pe(e,function(e){e=No(e),rr(t,e,ka(t[e],t))}),t});function Qs(t){return function(){return t}}var tu=Ni(),eu=Ni(!0);function nu(t){return t}function ru(t){return zr("function"==typeof t?t:ar(t,1))}var iu=Gr(function(t,e){return function(n){return kr(n,t,e)}}),ou=Gr(function(t,e){return function(n){return kr(t,n,e)}});function au(t,e,n){var r=js(e),i=wr(e,r);null!=n||Qa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=wr(e,js(e)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(t);return Pe(i,function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,xe([this.value()],arguments))})}),t}function su(){}var uu=Ri(je),cu=Ri(Oe),lu=Ri(Fe);function du(t){return go(t)?Ve(No(t)):function(t){return function(e){return Sr(e,t)}}(t)}var pu=Vi(),hu=Vi(!0);function fu(){return[]}function yu(){return!1}var vu,mu=Ui(function(t,e){return t+e},0),gu=Hi("ceil"),bu=Ui(function(t,e){return t/e},1),wu=Hi("floor"),Su=Ui(function(t,e){return t*e},1),_u=Hi("round"),Iu=Ui(function(t,e){return t-e},0);return Mn.after=function(t,e){if("function"!=typeof e)throw new At(i);return t=hs(t),function(){if(--t<1)return e.apply(this,arguments)}},Mn.ary=Oa,Mn.assign=gs,Mn.assignIn=bs,Mn.assignInWith=ws,Mn.assignWith=Ss,Mn.at=_s,Mn.before=Aa,Mn.bind=ka,Mn.bindAll=Zs,Mn.bindKey=Ea,Mn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Mn.chain=da,Mn.chunk=function(t,e,n){e=(n?mo(t,e,n):e===r)?1:vn(hs(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=rt(pe(i/e));o<i;)s[a++]=ti(t,o,o+=e);return s},Mn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Mn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=rt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return xe(qa(n)?Oi(n):[n],yr(e,1))},Mn.cond=function(t){var e=null==t?0:t.length,n=oo();return t=e?je(t,function(t){if("function"!=typeof t[1])throw new At(i);return[n(t[0]),t[1]]}):[],Gr(function(n){for(var r=-1;++r<e;){var i=t[r];if(_e(i[0],this,n))return _e(i[1],this,n)}})},Mn.conforms=function(t){return function(t){var e=js(t);return function(n){return sr(n,t,e)}}(ar(t,1))},Mn.constant=Qs,Mn.countBy=fa,Mn.create=function(t,e){var n=Un(t);return null==e?n:nr(n,e)},Mn.curry=function t(e,n,i){var o=Yi(e,8,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Mn.curryRight=function t(e,n,i){var o=Yi(e,16,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Mn.debounce=ja,Mn.defaults=Is,Mn.defaultsDeep=Ps,Mn.defer=xa,Mn.delay=Ta,Mn.difference=Uo,Mn.differenceBy=Ro,Mn.differenceWith=Lo,Mn.drop=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=n||e===r?1:hs(e))<0?0:e,i):[]},Mn.dropRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,0,(e=i-(e=n||e===r?1:hs(e)))<0?0:e):[]},Mn.dropRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0,!0):[]},Mn.dropWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0):[]},Mn.fill=function(t,e,n,i){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&mo(t,e,n)&&(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=hs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:hs(i))<0&&(i+=o),i=n>i?0:fs(i);n<i;)t[n++]=e;return t}(t,e,n,i)):[]},Mn.filter=function(t,e){return(qa(t)?Ae:fr)(t,oo(e,3))},Mn.flatMap=function(t,e){return yr(_a(t,e),1)},Mn.flatMapDeep=function(t,e){return yr(_a(t,e),c)},Mn.flatMapDepth=function(t,e,n){return n=n===r?1:hs(n),yr(_a(t,e),n)},Mn.flatten=$o,Mn.flattenDeep=function(t){return null!=t&&t.length?yr(t,c):[]},Mn.flattenDepth=function(t,e){return null!=t&&t.length?yr(t,e=e===r?1:hs(e)):[]},Mn.flip=function(t){return Yi(t,512)},Mn.flow=tu,Mn.flowRight=eu,Mn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Mn.functions=function(t){return null==t?[]:wr(t,js(t))},Mn.functionsIn=function(t){return null==t?[]:wr(t,xs(t))},Mn.groupBy=ba,Mn.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Mn.intersection=Wo,Mn.intersectionBy=Go,Mn.intersectionWith=Yo,Mn.invert=As,Mn.invertBy=ks,Mn.invokeMap=wa,Mn.iteratee=ru,Mn.keyBy=Sa,Mn.keys=js,Mn.keysIn=xs,Mn.map=_a,Mn.mapKeys=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,e(t,r,i),t)}),n},Mn.mapValues=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,r,e(t,r,i))}),n},Mn.matches=function(t){return Dr(ar(t,1))},Mn.matchesProperty=function(t,e){return Mr(t,ar(e,1))},Mn.memoize=za,Mn.merge=Ts,Mn.mergeWith=zs,Mn.method=iu,Mn.methodOf=ou,Mn.mixin=au,Mn.negate=Fa,Mn.nthArg=function(t){return t=hs(t),Gr(function(e){return Rr(e,t)})},Mn.omit=Fs,Mn.omitBy=function(t,e){return Ns(t,Fa(oo(e)))},Mn.once=function(t){return Aa(2,t)},Mn.orderBy=function(t,e,n,i){return null==t?[]:(qa(e)||(e=null==e?[]:[e]),qa(n=i?r:n)||(n=null==n?[]:[n]),Lr(t,e,n))},Mn.over=uu,Mn.overArgs=Ba,Mn.overEvery=cu,Mn.overSome=lu,Mn.partial=Na,Mn.partialRight=Da,Mn.partition=Ia,Mn.pick=Bs,Mn.pickBy=Ns,Mn.property=du,Mn.propertyOf=function(t){return function(e){return null==t?r:Sr(t,e)}},Mn.pull=Jo,Mn.pullAll=Xo,Mn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,oo(n,2)):t},Mn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,r,n):t},Mn.pullAt=Zo,Mn.range=pu,Mn.rangeRight=hu,Mn.rearg=Ma,Mn.reject=function(t,e){return(qa(t)?Ae:fr)(t,Fa(oo(e,3)))},Mn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=oo(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return $r(t,i),n},Mn.rest=function(t,e){if("function"!=typeof t)throw new At(i);return Gr(t,e=e===r?e:hs(e))},Mn.reverse=Qo,Mn.sampleSize=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),(qa(t)?Jn:Kr)(t,e)},Mn.set=function(t,e,n){return null==t?t:Jr(t,e,n)},Mn.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:Jr(t,e,n,i)},Mn.shuffle=function(t){return(qa(t)?Xn:Qr)(t)},Mn.slice=function(t,e,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&mo(t,e,n)?(e=0,n=i):(e=null==e?0:hs(e),n=n===r?i:hs(n)),ti(t,e,n)):[]},Mn.sortBy=Pa,Mn.sortedUniq=function(t){return t&&t.length?ii(t):[]},Mn.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Mn.split=function(t,e,n){return n&&"number"!=typeof n&&mo(t,e,n)&&(e=n=r),(n=n===r?p:n>>>0)?(t=ms(t))&&("string"==typeof e||null!=e&&!is(e))&&!(e=ai(e))&&nn(t)?gi(ln(t),0,n):t.split(e,n):[]},Mn.spread=function(t,e){if("function"!=typeof t)throw new At(i);return e=null==e?0:vn(hs(e),0),Gr(function(n){var r=n[e],i=gi(n,0,e);return r&&xe(i,r),_e(t,this,i)})},Mn.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Mn.take=function(t,e,n){return t&&t.length?ti(t,0,(e=n||e===r?1:hs(e))<0?0:e):[]},Mn.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=i-(e=n||e===r?1:hs(e)))<0?0:e,i):[]},Mn.takeRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!1,!0):[]},Mn.takeWhile=function(t,e){return t&&t.length?li(t,oo(e,3)):[]},Mn.tap=function(t,e){return e(t),t},Mn.throttle=function(t,e,n){var r=!0,o=!0;if("function"!=typeof t)throw new At(i);return Qa(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ja(t,e,{leading:r,maxWait:e,trailing:o})},Mn.thru=pa,Mn.toArray=ds,Mn.toPairs=Ds,Mn.toPairsIn=Ms,Mn.toPath=function(t){return qa(t)?je(t,No):ss(t)?[t]:Oi(Bo(ms(t)))},Mn.toPlainObject=vs,Mn.transform=function(t,e,n){var r=qa(t),i=r||Ga(t)||us(t);if(e=oo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Qa(t)&&Ja(o)?Un($t(t)):{}}return(i?Pe:gr)(t,function(t,r,i){return e(n,t,r,i)}),n},Mn.unary=function(t){return Oa(t,1)},Mn.union=ta,Mn.unionBy=ea,Mn.unionWith=na,Mn.uniq=function(t){return t&&t.length?si(t):[]},Mn.uniqBy=function(t,e){return t&&t.length?si(t,oo(e,2)):[]},Mn.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?si(t,r,e):[]},Mn.unset=function(t,e){return null==t||ui(t,e)},Mn.unzip=ra,Mn.unzipWith=ia,Mn.update=function(t,e,n){return null==t?t:ci(t,e,yi(n))},Mn.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ci(t,e,yi(n),i)},Mn.values=Us,Mn.valuesIn=function(t){return null==t?[]:Ke(t,xs(t))},Mn.without=oa,Mn.words=Js,Mn.wrap=function(t,e){return Na(yi(e),t)},Mn.xor=aa,Mn.xorBy=sa,Mn.xorWith=ua,Mn.zip=ca,Mn.zipObject=function(t,e){return hi(t||[],e||[],Qn)},Mn.zipObjectDeep=function(t,e){return hi(t||[],e||[],Jr)},Mn.zipWith=la,Mn.entries=Ds,Mn.entriesIn=Ms,Mn.extend=bs,Mn.extendWith=ws,au(Mn,Mn),Mn.add=mu,Mn.attempt=Xs,Mn.camelCase=Rs,Mn.capitalize=Ls,Mn.ceil=gu,Mn.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ys(n))==n?n:0),e!==r&&(e=(e=ys(e))==e?e:0),or(ys(t),e,n)},Mn.clone=function(t){return ar(t,4)},Mn.cloneDeep=function(t){return ar(t,5)},Mn.cloneDeepWith=function(t,e){return ar(t,5,e="function"==typeof e?e:r)},Mn.cloneWith=function(t,e){return ar(t,4,e="function"==typeof e?e:r)},Mn.conformsTo=function(t,e){return null==e||sr(t,e,js(e))},Mn.deburr=Vs,Mn.defaultTo=function(t,e){return null==t||t!=t?e:t},Mn.divide=bu,Mn.endsWith=function(t,e,n){t=ms(t),e=ai(e);var i=t.length,o=n=n===r?i:or(hs(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Mn.eq=Ua,Mn.escape=function(t){return(t=ms(t))&&G.test(t)?t.replace(H,tn):t},Mn.escapeRegExp=function(t){return(t=ms(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Mn.every=function(t,e,n){var i=qa(t)?Oe:pr;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Mn.find=ya,Mn.findIndex=Vo,Mn.findKey=function(t,e){return Ne(t,oo(e,3),gr)},Mn.findLast=va,Mn.findLastIndex=qo,Mn.findLastKey=function(t,e){return Ne(t,oo(e,3),br)},Mn.floor=wu,Mn.forEach=ma,Mn.forEachRight=ga,Mn.forIn=function(t,e){return null==t?t:vr(t,oo(e,3),xs)},Mn.forInRight=function(t,e){return null==t?t:mr(t,oo(e,3),xs)},Mn.forOwn=function(t,e){return t&&gr(t,oo(e,3))},Mn.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Mn.get=Cs,Mn.gt=Ra,Mn.gte=La,Mn.has=function(t,e){return null!=t&&ho(t,e,Cr)},Mn.hasIn=Os,Mn.head=Ho,Mn.identity=nu,Mn.includes=function(t,e,n,r){t=Ha(t)?t:Us(t),n=n&&!r?hs(n):0;var i=t.length;return n<0&&(n=vn(i+n,0)),as(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Me(t,e,n)>-1},Mn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=vn(r+i,0)),Me(t,e,i)},Mn.inRange=function(t,e,n){return e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n){return t>=mn(e,n)&&t<vn(e,n)}(t=ys(t),e,n)},Mn.invoke=Es,Mn.isArguments=Va,Mn.isArray=qa,Mn.isArrayBuffer=$a,Mn.isArrayLike=Ha,Mn.isArrayLikeObject=Wa,Mn.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Ir(t)==v},Mn.isBuffer=Ga,Mn.isDate=Ya,Mn.isElement=function(t){return ts(t)&&1===t.nodeType&&!rs(t)},Mn.isEmpty=function(t){if(null==t)return!0;if(Ha(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||us(t)||Va(t)))return!t.length;var e=po(t);if(e==S||e==O)return!t.size;if(So(t))return!Fr(t).length;for(var n in t)if(zt.call(t,n))return!1;return!0},Mn.isEqual=function(t,e){return jr(t,e)},Mn.isEqualWith=function(t,e,n){var i=(n="function"==typeof n?n:r)?n(t,e):r;return i===r?jr(t,e,r,n):!!i},Mn.isError=Ka,Mn.isFinite=function(t){return"number"==typeof t&&qe(t)},Mn.isFunction=Ja,Mn.isInteger=Xa,Mn.isLength=Za,Mn.isMap=es,Mn.isMatch=function(t,e){return t===e||xr(t,e,so(e))},Mn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,xr(t,e,so(e),n)},Mn.isNaN=function(t){return ns(t)&&t!=+t},Mn.isNative=function(t){if(wo(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(t)},Mn.isNil=function(t){return null==t},Mn.isNull=function(t){return null===t},Mn.isNumber=ns,Mn.isObject=Qa,Mn.isObjectLike=ts,Mn.isPlainObject=rs,Mn.isRegExp=is,Mn.isSafeInteger=function(t){return Xa(t)&&t>=-9007199254740991&&t<=l},Mn.isSet=os,Mn.isString=as,Mn.isSymbol=ss,Mn.isTypedArray=us,Mn.isUndefined=function(t){return t===r},Mn.isWeakMap=function(t){return ts(t)&&po(t)==E},Mn.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Ir(t)},Mn.join=function(t,e){return null==t?"":fn.call(t,e)},Mn.kebabCase=qs,Mn.last=Ko,Mn.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=hs(n))<0?vn(i+o,0):mn(o,i-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):De(t,Re,o,!0)},Mn.lowerCase=$s,Mn.lowerFirst=Hs,Mn.lt=cs,Mn.lte=ls,Mn.max=function(t){return t&&t.length?hr(t,nu,Pr):r},Mn.maxBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Pr):r},Mn.mean=function(t){return Le(t,nu)},Mn.meanBy=function(t,e){return Le(t,oo(e,2))},Mn.min=function(t){return t&&t.length?hr(t,nu,Br):r},Mn.minBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Br):r},Mn.stubArray=fu,Mn.stubFalse=yu,Mn.stubObject=function(){return{}},Mn.stubString=function(){return""},Mn.stubTrue=function(){return!0},Mn.multiply=Su,Mn.nth=function(t,e){return t&&t.length?Rr(t,hs(e)):r},Mn.noConflict=function(){return le._===this&&(le._=Mt),this},Mn.noop=su,Mn.now=Ca,Mn.pad=function(t,e,n){t=ms(t);var r=(e=hs(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(pe(i),n)},Mn.padEnd=function(t,e,n){t=ms(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?t+Li(e-r,n):t},Mn.padStart=function(t,e,n){t=ms(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?Li(e-r,n)+t:t},Mn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(ms(t).replace(nt,""),e||0)},Mn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&mo(t,e,n)&&(e=n=r),n===r&&("boolean"==typeof e?(n=e,e=r):"boolean"==typeof t&&(n=t,t=r)),t===r&&e===r?(t=0,e=1):(t=ps(t),e===r?(e=t,t=0):e=ps(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=wn();return mn(t+o*(e-t+ae("1e-"+((o+"").length-1))),e)}return Hr(t,e)},Mn.reduce=function(t,e,n){var r=qa(t)?Te:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,lr)},Mn.reduceRight=function(t,e,n){var r=qa(t)?ze:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,dr)},Mn.repeat=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),Wr(ms(t),e)},Mn.replace=function(){var t=arguments,e=ms(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Mn.result=function(t,e,n){var i=-1,o=(e=vi(e,t)).length;for(o||(o=1,t=r);++i<o;){var a=null==t?r:t[No(e[i])];a===r&&(i=o,a=n),t=Ja(a)?a.call(t):a}return t},Mn.round=_u,Mn.runInContext=t,Mn.sample=function(t){return(qa(t)?Kn:Yr)(t)},Mn.size=function(t){if(null==t)return 0;if(Ha(t))return as(t)?cn(t):t.length;var e=po(t);return e==S||e==O?t.size:Fr(t).length},Mn.snakeCase=Ws,Mn.some=function(t,e,n){var i=qa(t)?Fe:ei;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Mn.sortedIndex=function(t,e){return ni(t,e)},Mn.sortedIndexBy=function(t,e,n){return ri(t,e,oo(n,2))},Mn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=ni(t,e);if(r<n&&Ua(t[r],e))return r}return-1},Mn.sortedLastIndex=function(t,e){return ni(t,e,!0)},Mn.sortedLastIndexBy=function(t,e,n){return ri(t,e,oo(n,2),!0)},Mn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ni(t,e,!0)-1;if(Ua(t[n],e))return n}return-1},Mn.startCase=Gs,Mn.startsWith=function(t,e,n){return t=ms(t),n=null==n?0:or(hs(n),0,t.length),e=ai(e),t.slice(n,n+e.length)==e},Mn.subtract=Iu,Mn.sum=function(t){return t&&t.length?He(t,nu):0},Mn.sumBy=function(t,e){return t&&t.length?He(t,oo(e,2)):0},Mn.template=function(t,e,n){var i=Mn.templateSettings;n&&mo(t,e,n)&&(e=r),t=ms(t),e=ws({},e,i,Ki);var o,a,s=ws({},e.imports,i.imports,Ki),u=js(s),c=Ke(s,u),l=0,d=e.interpolate||gt,p="__p += '",h=Ct((e.escape||gt).source+"|"+d.source+"|"+(d===J?lt:gt).source+"|"+(e.evaluate||gt).source+"|$","g"),f="//# sourceURL="+(zt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(h,function(e,n,r,i,s,u){return r||(r=i),p+=t.slice(l,u).replace(bt,en),n&&(o=!0,p+="' +\n__e("+n+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),p+="';\n";var y=zt.call(e,"variable")&&e.variable;if(y){if(ut.test(y))throw new St("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(a?p.replace(L,""):p).replace(V,"$1").replace(q,"$1;"),p="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var v=Xs(function(){return _t(u,f+"return "+p).apply(r,c)});if(v.source=p,Ka(v))throw v;return v},Mn.times=function(t,e){if((t=hs(t))<1||t>l)return[];var n=p,r=mn(t,p);e=oo(e),t-=p;for(var i=We(r,e);++n<t;)e(n);return i},Mn.toFinite=ps,Mn.toInteger=hs,Mn.toLength=fs,Mn.toLower=function(t){return ms(t).toLowerCase()},Mn.toNumber=ys,Mn.toSafeInteger=function(t){return t?or(hs(t),-9007199254740991,l):0===t?t:0},Mn.toString=ms,Mn.toUpper=function(t){return ms(t).toUpperCase()},Mn.trim=function(t,e,n){if((t=ms(t))&&(n||e===r))return Ge(t);if(!t||!(e=ai(e)))return t;var i=ln(t),o=ln(e);return gi(i,Xe(i,o),Ze(i,o)+1).join("")},Mn.trimEnd=function(t,e,n){if((t=ms(t))&&(n||e===r))return t.slice(0,dn(t)+1);if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,0,Ze(i,ln(e))+1).join("")},Mn.trimStart=function(t,e,n){if((t=ms(t))&&(n||e===r))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,Xe(i,ln(e))).join("")},Mn.truncate=function(t,e){var n=30,i="...";if(Qa(e)){var o="separator"in e?e.separator:o;n="length"in e?hs(e.length):n,i="omission"in e?ai(e.omission):i}var a=(t=ms(t)).length;if(nn(t)){var s=ln(t);a=s.length}if(n>=a)return t;var u=n-cn(i);if(u<1)return i;var c=s?gi(s,0,u).join(""):t.slice(0,u);if(o===r)return c+i;if(s&&(u+=c.length-u),is(o)){if(t.slice(u).search(o)){var l,d=c;for(o.global||(o=Ct(o.source,ms(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var p=l.index;c=c.slice(0,p===r?u:p)}}else if(t.indexOf(ai(o),u)!=u){var h=c.lastIndexOf(o);h>-1&&(c=c.slice(0,h))}return c+i},Mn.unescape=function(t){return(t=ms(t))&&W.test(t)?t.replace($,pn):t},Mn.uniqueId=function(t){var e=++Ft;return ms(t)+e},Mn.upperCase=Ys,Mn.upperFirst=Ks,Mn.each=ma,Mn.eachRight=ga,Mn.first=Ho,au(Mn,(vu={},gr(Mn,function(t,e){zt.call(Mn.prototype,e)||(vu[e]=t)}),vu),{chain:!1}),Mn.VERSION="4.17.21",Pe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Mn[t].placeholder=Mn}),Pe(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:vn(hs(n),0);var i=this.__filtered__&&!e?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=mn(n,i.__takeCount__):i.__views__.push({size:mn(n,p),type:t+(i.__dir__<0?"Right":"")}),i},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Pe(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;Vn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:oo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Pe(["head","last"],function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}}),Pe(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");Vn.prototype[t]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(nu)},Vn.prototype.find=function(t){return this.filter(t).head()},Vn.prototype.findLast=function(t){return this.reverse().find(t)},Vn.prototype.invokeMap=Gr(function(t,e){return"function"==typeof t?new Vn(this):this.map(function(n){return kr(n,t,e)})}),Vn.prototype.reject=function(t){return this.filter(Fa(oo(t)))},Vn.prototype.slice=function(t,e){t=hs(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Vn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=hs(e))<0?n.dropRight(-e):n.take(e-t)),n)},Vn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Vn.prototype.toArray=function(){return this.take(p)},gr(Vn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Mn[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(Mn.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,u=e instanceof Vn,c=s[0],l=u||qa(e),d=function(t){var e=o.apply(Mn,xe([t],s));return i&&p?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=u&&!h;if(!a&&l){e=y?e:new Vn(this);var v=t.apply(e,s);return v.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(v,p)}return f&&y?t.apply(this,s):(v=this.thru(d),f?i?v.value()[0]:v.value():v)})}),Pe(["pop","push","shift","sort","splice","unshift"],function(t){var e=kt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Mn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(qa(i)?i:[],t)}return this[n](function(n){return e.apply(qa(n)?n:[],t)})}}),gr(Vn.prototype,function(t,e){var n=Mn[e];if(n){var r=n.name+"";zt.call(En,r)||(En[r]=[]),En[r].push({name:e,func:n})}}),En[Di(r,2).name]=[{name:"wrapper",func:r}],Vn.prototype.clone=function(){var t=new Vn(this.__wrapped__);return t.__actions__=Oi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Oi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Oi(this.__views__),t},Vn.prototype.reverse=function(){if(this.__filtered__){var t=new Vn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Vn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=qa(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=mn(e,t+a);break;case"takeRight":t=vn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,d=l.length,p=0,h=mn(u,this.__takeCount__);if(!n||!r&&i==u&&h==u)return di(t,this.__actions__);var f=[];t:for(;u--&&p<h;){for(var y=-1,v=t[c+=e];++y<d;){var m=l[y],g=m.iteratee,b=m.type,w=g(v);if(2==b)v=w;else if(!w){if(1==b)continue t;break t}}f[p++]=v}return f},Mn.prototype.at=ha,Mn.prototype.chain=function(){return da(this)},Mn.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Mn.prototype.next=function(){this.__values__===r&&(this.__values__=ds(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Mn.prototype.plant=function(t){for(var e,n=this;n instanceof Rn;){var i=Mo(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Mn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Vn){var e=t;return this.__actions__.length&&(e=new Vn(this)),(e=e.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:r}),new Ln(e,this.__chain__)}return this.thru(Qo)},Mn.prototype.toJSON=Mn.prototype.valueOf=Mn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Mn.prototype.first=Mn.prototype.head,Xt&&(Mn.prototype[Xt]=function(){return this}),Mn}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(le._=hn,define(function(){return hn})):pe?((pe.exports=hn)._=hn,de._=hn):le._=hn}.call(this)},9722:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(7995);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},9783:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.joinPaths=e.isAbsoluteUrl=void 0,e.isAbsoluteUrl=function(t){return/^https?:\/\//.test(t)},e.joinPaths=function(t,e){return"".concat((n=t,n.replace(/\/$/,"")),"/").concat(function(t){return t.replace(/^\//,"")}(e));var n}},9828:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.build=function(t,e,n){var r=this,i=document.createElement("form");return i.style.display="none",i.setAttribute("action",t),i.setAttribute("method","POST"),i.setAttribute("target",n||"_top"),Object.keys(e).forEach(function(t){var n=e[t];i.appendChild(r._createInput(n,t))}),i},t.prototype._createInput=function(t,e){var n=document.createElement("input");return n.setAttribute("name",e),n.setAttribute("type","hidden"),n.setAttribute("value",t),n},t}();e.default=n}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};(()=>{"use strict";n.r(r),n.d(r,{createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>It,createPayPalCommerceButtonStrategy:()=>le,createPayPalCommerceCreditButtonStrategy:()=>he,createPayPalCommerceCreditCardsPaymentStrategy:()=>Ut,createPayPalCommerceCreditCustomerStrategy:()=>ne,createPayPalCommerceCreditPaymentStrategy:()=>et,createPayPalCommerceCustomerStrategy:()=>Qt,createPayPalCommerceFastlaneCustomerStrategy:()=>ue,createPayPalCommerceFastlanePaymentStrategy:()=>Yt,createPayPalCommercePaymentStrategy:()=>X,createPayPalCommerceRatePayPaymentStrategy:()=>Vt,createPayPalCommerceVenmoButtonStrategy:()=>ve,createPayPalCommerceVenmoCustomerStrategy:()=>oe,createPayPalCommerceVenmoPaymentStrategy:()=>gt});var t=n(315);function e(t,e){return Object.assign(t,{resolveIds:e})}var i,o=n(8686),a=n(4043);class s extends Error{constructor(t){var e;super(t||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",e=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class u extends s{constructor(t){super(t||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}!function(t){t[t.MissingBillingAddress=0]="MissingBillingAddress",t[t.MissingCart=1]="MissingCart",t[t.MissingCheckout=2]="MissingCheckout",t[t.MissingConsignments=3]="MissingConsignments",t[t.MissingCustomer=4]="MissingCustomer",t[t.MissingCheckoutConfig=5]="MissingCheckoutConfig",t[t.MissingOrder=6]="MissingOrder",t[t.MissingOrderConfig=7]="MissingOrderConfig",t[t.MissingOrderId=8]="MissingOrderId",t[t.MissingPayment=9]="MissingPayment",t[t.MissingPaymentId=10]="MissingPaymentId",t[t.MissingPaymentInstrument=11]="MissingPaymentInstrument",t[t.MissingPaymentMethod=12]="MissingPaymentMethod",t[t.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",t[t.MissingPaymentStatus=14]="MissingPaymentStatus",t[t.MissingPaymentToken=15]="MissingPaymentToken",t[t.MissingShippingAddress=16]="MissingShippingAddress"}(i||(i={}));class c extends s{constructor(t){super(function(t){switch(t){case i.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case i.MissingCart:return"Unable to proceed because cart data is unavailable.";case i.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case i.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case i.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case i.MissingCheckoutConfig:case i.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case i.MissingOrder:return"Unable to proceed because order data is unavailable.";case i.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case i.MissingPayment:return"Unable to proceed because payment data is unavailable.";case i.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case i.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case i.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(t)),this.subtype=t,this.name="MissingDataError",this.type="missing_data"}}var l=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class d{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return l(this,void 0,void 0,function*(){if(!this.window.paypal||r){const r=this.getPayPalSdkScriptConfigOrThrow(t,e,n);if(yield this.loadPayPalSdk(r),!this.window.paypal)throw new u}return this.window.paypal})}getPayPalFastlaneSdk(t,e,n){return l(this,void 0,void 0,function*(){if(!this.window.paypalFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(t,e,n);if(yield this.loadPayPalSdk(r),!this.window.paypalFastlaneSdk)throw new u}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return l(this,void 0,void 0,function*(){if(!this.window.paypalGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalGooglePay)throw new u;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return l(this,void 0,void 0,function*(){if(!this.window.paypalApms){const n=this.getPayPalApmSdkConfiguration(t,e);if(yield this.loadPayPalSdk(n),!this.window.paypalApms)throw new u}return this.window.paypalApms})}getPayPalMessages(t,e){return l(this,void 0,void 0,function*(){if(!this.window.paypalMessages){const n=this.getPayPalSdkMessagesConfiguration(t,e);yield this.loadPayPalSdk(n)}if(!this.window.paypalMessages)throw new u;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return l(this,void 0,void 0,function*(){const n=this.transformConfig(t),r=this.transformConfig(e),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalSdkScriptConfigOrThrow(t,e,n=!0){const{id:r,clientToken:o,initializationData:a}=t;if(!a||!a.clientId)throw new c(i.MissingPaymentMethod);const{intent:s,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:v,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:g=[],isGooglePayEnabled:b}=a,w=f||n,S="paypalcommercecreditcards"===r||"bigcommerce_payments_creditcards"===r,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=n?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!g.includes(t))],k=[..._,...I,...P,...g];return{options:Object.assign({"client-id":u,"merchant-id":l,"enable-funding":k.length>0?k:void 0,"disable-funding":A.length>0?A:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...C,...O],currency:e,intent:s},v&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}getPayPalFastlaneSdkConfiguration(t,e,n){const{clientToken:r,initializationData:o}=t;if(!o||!o.clientId)throw new c(i.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:u,attributionId:l}=o;return{options:{"client-id":s,"merchant-id":u,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:e,intent:a},attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":r}}}getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n=!0){const{clientToken:r,initializationData:o}=t;if(!o||!o.clientId)throw new c(i.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||n;return{options:Object.assign({"client-id":s,"merchant-id":u,commit:f,components:["googlepay"],currency:e,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":r,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new c(i.MissingPaymentMethod);const{intent:r,clientId:o,merchantId:a,buyerCountry:s,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=n,h=p,f=d.filter(t=>!p.includes(t));return{options:Object.assign({"client-id":o,"merchant-id":a,"enable-funding":h.length>0?h:void 0,"disable-funding":f.length>0?f:void 0,commit:!0,components:["buttons","payment-fields"],currency:e,intent:r},l&&{"buyer-country":s}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new c(i.MissingPaymentMethod);const{clientId:r,merchantId:o,attributionId:a,isDeveloperModeApplicable:s,buyerCountry:u}=n;return{options:Object.assign({"client-id":r,"merchant-id":o,components:["messages"],currency:e},s&&{"buyer-country":u}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":a}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}function p(){return new d((0,t.Hb)())}var h=n(9440);class f extends s{constructor(t){super(t||"An unexpected error has occurred during buy now cart creation process. Please try again later."),this.name="BuyNowCartCreationError",this.type="buy_now_cart_creation_error"}}const y={body:{},headers:{},status:0};class v extends s{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||y;super(e||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}var m,g,b,w,S,_,I,P,C,O,A;!function(t){t.BuyNow="BUY_NOW"}(m||(m={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(g||(g={})),function(t){t.Always="SCA_ALWAYS"}(b||(b={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(w||(w={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(S||(S={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(_||(_={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(I||(I={})),function(t){t.pill="pill",t.rect="rect"}(P||(P={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(C||(C={})),function(t){t.OXXO="oxxo"}(O||(O={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(A||(A={}));var k=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class E{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalRequestSender=n,this.paypalSdkLoader=r}loadPayPalSdk(t,e,n,r){return k(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=e||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(t);return this.paypalSdk=yield this.paypalSdkLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new u;return this.paypalSdk}createBuyNowCartOrThrow(t){return k(this,void 0,void 0,function*(){const e=t.getBuyNowCartRequestBody();if(!e)throw new c(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(e)}catch(t){throw new f}})}createOrder(t,e){return k(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return k(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(t,e,n){return k(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState(),i=r.getCartOrThrow(),o=r.getConsignmentsOrThrow()[0];try{yield this.paypalRequestSender.updateOrder(t,Object.assign(Object.assign({availableShippingOptions:o.availableShippingOptions,cartId:i.id,selectedShippingOption:o.selectedShippingOption},e?{methodId:e}:{}),n?{orderId:n}:{}))}catch(t){throw new v}})}getOrderStatus(t,e){return k(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(t,e){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!e)throw new c(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:e},n.source===m.BuyNow&&{cart_id:n.id}))}submitPayment(t,e,n){return k(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:t,paypal_account:{order_id:e}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:t,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(t){const e=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=e.availableShippingOptions||[],r=n.find(t=>t.isRecommended),i=(t?n.find(e=>e.id===t):n.find(t=>{if(e.selectedShippingOption){const n=e.selectedShippingOption.id;return t.id===n}return!1}))||r||n[0];if(!i)throw new Error("Your order can't be shipped to this address");return i}getAddress(t){return{firstName:(null==t?void 0:t.firstName)||"",lastName:(null==t?void 0:t.lastName)||"",email:(null==t?void 0:t.email)||"",phone:(null==t?void 0:t.phone)||"",company:"",address1:(null==t?void 0:t.address1)||"",address2:(null==t?void 0:t.address2)||"",city:(null==t?void 0:t.city)||"",countryCode:(null==t?void 0:t.countryCode)||"",postalCode:(null==t?void 0:t.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==t?void 0:t.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:t}){var e,n;return this.getAddress({firstName:t.name.given_name,lastName:t.name.surname,email:t.email_address,address1:t.address.address_line_1,address2:t.address.address_line_2,city:t.address.admin_area_2,countryCode:t.address.country_code,postalCode:t.address.postal_code,stateOrProvinceCode:t.address.admin_area_1,phone:null===(n=null===(e=t.phone)||void 0===e?void 0:e.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(t){const{payer:e,purchase_units:n}=t,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:e.email_address,address1:r.address_line_1,address2:r.address_line_2,city:r.admin_area_2,countryCode:r.country_code,postalCode:r.postal_code,stateOrProvinceCode:r.admin_area_1})}getValidButtonStyle(t={}){const{color:e,height:n,label:r,shape:i}=t,o={color:e&&I[e]?e:void 0,height:this.getValidHeight(n),label:r&&_[r]?r:void 0,shape:i&&P[i]?i:void 0};return(0,h.omitBy)(o,h.isNil)}getValidHeight(t){return t&&"number"==typeof t?t>55?55:t<25?25:t:40}removeElement(t){const e=t&&document.getElementById(t);e&&(e.style.display="none")}}const j="This API endpoint is for internal use only and may change in the future";var x;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(x||(x={}));const T=x,z={"X-Checkout-SDK-Version":"1.898.5"};var F=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class B{constructor(t){this.requestSender=t}createOrder(t,e){return F(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t,e){return F(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.put(n,{headers:i,body:r})).body})}getOrderStatus(t,e){return F(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}const N=t=>{const{getHost:e}=t.getState();return new E((0,o.createFormPoster)(),t,new B((0,a.createRequestSender)({host:e()})),p())},D={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"},M={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},U="embedded-checkout-loading-indicator-rotation";class R{constructor(t){this.styles=Object.assign(Object.assign({},M),t&&t.styles),this.containerStyles=Object.assign({},t&&t.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(t){if(t){const e=document.getElementById(t);if(!e)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");e.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const t=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",t)};this.container.addEventListener("transitionend",t),this.container.style.opacity="0"}buildContainer(){const t=document.createElement("div");return t.style.display="block",t.style.bottom="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.position="absolute",t.style.right="0",t.style.top="0",t.style.transition="all 250ms ease-out",t.style.opacity="0",this.setStyleAttribute(t,this.containerStyles),t}buildIndicator(){const t=document.createElement("div");return t.style.display="block",t.style.width=`${this.styles.size}px`,t.style.height=`${this.styles.size}px`,t.style.borderRadius=`${this.styles.size}px`,t.style.border="solid 1px",t.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,t.style.margin="0 auto",t.style.position="absolute",t.style.left="0",t.style.right="0",t.style.top="50%",t.style.transform="translateY(-50%) rotate(0deg)",t.style.transformStyle="preserve-3d",t.style.animation=`${U} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,t}setStyleAttribute(t,e){Object.keys(e).forEach(n=>{t.style.setProperty(n,e[n])})}defineAnimation(){var t;if(document.getElementById(U))return;const e=document.createElement("style");e.id=U,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${U} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}class L extends s{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class V extends L{constructor(t){let e="Unable to submit payment for the order because the payload is invalid.";t&&(e=`${e} Make sure the following fields are provided correctly: ${t.join(", ")}.`),super(e),this.name="PaymentArgumentInvalidError"}}class q extends v{constructor(t){super(t,{message:"There is a problem processing your payment. Please try again later."}),this.name="PaymentMethodInvalidError",this.type="payment_method_invalid"}}class $ extends s{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function H(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function W(t){return Boolean(t.instrumentId)}const G=function({styles:t}){const e={};return t.color&&(e.color=t.color),t.layout&&(e.layout=t.layout),(t["logo-type"]||t["logo-position"])&&(e.logo={},t["logo-type"]&&(e.logo.type=t["logo-type"]),t["logo-position"]&&(e.logo.position=t["logo-position"])),t.ratio&&(e.ratio=t.ratio),(t["text-color"]||t["text-size"])&&(e.text={},t["text-color"]&&(e.text.color=t["text-color"]),t["text-size"]&&(e.text.size=+t["text-size"])),e};function Y(t){return"object"==typeof t&&null!==t&&"bigpayToken"in t&&"defaultInstrument"in t&&"provider"in t&&"trustedShippingAddress"in t&&"method"in t&&"type"in t}var K=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class J{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.payPalSdkScriptLoader=n,this.loadingIndicator=r}initialize(t){var e;return K(this,void 0,void 0,function*(){const{methodId:n,paypalcommerce:r}=t||{};if(this.paypalcommerce=r,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(n);const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n),{container:a,bannerContainerId:s}=r,{orderId:u,paypalBNPLConfiguration:c=[],isPayPalCreditAvailable:l}=o.initializationData||{};if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const t=null==c?void 0:c.find(({id:t})=>"checkout"===t);if(l||!(null==t?void 0:t.status))return;const e=yield this.payPalSdkScriptLoader.getPayPalMessages(o,i.getCartOrThrow().currency.code);return e&&"function"==typeof(null==e?void 0:e.Messages)?this.renderMessages(e,s,t):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}u?this.orderId=null===(e=o.initializationData)||void 0===e?void 0:e.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalIntegrationService.loadPayPalSdk(n),r.onInit&&"function"==typeof r.onInit&&r.onInit(()=>this.renderButton(n,r)),(void 0===r.shouldRenderPayPalButtonOnInitialization||r.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(n,r))})}execute(t,e){var n,r;return K(this,void 0,void 0,function*(){const{payment:i}=t,o=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{onError:a}=this.paypalcommerce||{};if(!i)throw new V(["payment"]);const{methodId:s,paymentData:u}=i;if(this.isPayPalVaultedInstrumentPaymentData(u)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new q;const c=this.isPayPalVaultedInstrumentPaymentData(u)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,u):this.preparePaymentPayload(s,this.orderId,u);try{yield this.paymentIntegrationService.submitOrder(o,e),yield this.paymentIntegrationService.submitPayment(c)}catch(t){if(function(t){var e;return(t=>"object"==typeof t&&null!==t&&"body"in t)(t)&&"offsite_redirect"===(null===(e=t.body.additional_action_required)||void 0===e?void 0:e.type)}(t)){const e=null===(r=null===(n=t.body.additional_action_required)||void 0===n?void 0:n.data)||void 0===r?void 0:r.redirect_url;return new Promise(()=>window.location.replace(e))}return this.isProviderError(t)&&(yield this.paypalIntegrationService.loadPayPalSdk(i.methodId),yield new Promise((t,e)=>{var n;this.paypalcommerce&&(null===(n=this.paypalButton)||void 0===n||n.close(),this.renderButton(i.methodId,this.paypalcommerce),this.handleError(new Error("INSTRUMENT_DECLINED"),a)),e()})),this.handleError(t,a),Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}prepareVaultedInstrumentPaymentPayload(t,e,n){const{instrumentId:r,shouldSetAsDefaultInstrument:i}=n,o=!this.isTrustedVaultingFlow(n);return o?{methodId:t,paymentData:{shouldSaveInstrument:o,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}:{methodId:t,paymentData:{instrumentId:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e},bigpay_token:{token:r}}}}}preparePaymentPayload(t,e,n){const{shouldSaveInstrument:r=!1,shouldSetAsDefaultInstrument:i=!1}=H(n)?n:{};return{methodId:t,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}}renderButton(t,e){var n,r,i,o;const a=this.paypalIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:u}=s.initializationData||{},{checkoutPaymentButtonStyles:c}=u||{},{container:l,onError:d,onRenderButton:p,onValidate:h,submitForm:f}=e;if(!l)throw new L('Unable to initialize payment because "container" argument is not provided.');const y=this.getSmartButtonContainerId(l);if(!document.getElementById(y))throw new L(`Unable to initialize payment because element with id ${y} does not exist.`);const v=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(c),createOrder:()=>this.createOrder(),onClick:(t,e)=>this.handleClick(e,h),onApprove:t=>this.handleApprove(t,f),onError:t=>this.handleError(t,d),onCancel:()=>this.toggleLoadingIndicator(!1)});this.paypalButton=a.Buttons(v),this.paypalButton.isEligible()&&(p&&"function"==typeof p&&p(),(null===(r=(n=this.paypalButton).hasReturned)||void 0===r?void 0:r.call(n))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(o=(i=this.paypalButton).resume)||void 0===o||o.call(i):this.paypalButton.render(l))}handleClick(t,e){return K(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return null==e?void 0:e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,null==e||e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createOrder(){return K(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.paypalIntegrationService.createOrder("paypalcommercecheckout",{shouldSaveInstrument:(null==t?void 0:t.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:t}=this.paypalcommerce||{};return"function"==typeof t?t():void 0}isTrustedVaultingFlow(t){if(t&&W(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>Y(e)&&e.bigpayToken===t.instrumentId);return!(Y(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&W(t)&&H(t)}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:G(n)};t.Messages(r).render(`#${e}`)}isProviderError(t){var e,n,r;return!!function(t){return"object"==typeof t&&null!==t&&"errors"in t}(t)&&"INSTRUMENT_DECLINED"===(null===(r=null===(n=((null===(e=null==t?void 0:t.errors)||void 0===e?void 0:e.filter(t=>t.provider_error))||[])[0])||void 0===n?void 0:n.provider_error)||void 0===r?void 0:r.code)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}getSmartButtonContainerId(t){var e;return null!==(e=t.split("#")[1])&&void 0!==e?e:t}}const X=e(e=>new J(e,N(e),new d((0,t.vQ)()),new R({containerStyles:D})),[{id:"paypalcommerce"}]);class Z extends s{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var Q=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class tt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.loadingIndicator=n,this.payPalSdkScriptLoader=r}initialize(t){return Q(this,void 0,void 0,function*(){const{methodId:e,paypalcommerce:n,paypalcommercecredit:r}=t||{},i=r||n;if(!e)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(e);const o=this.paymentIntegrationService.getState(),a=o.getPaymentMethodOrThrow(e),{paypalBNPLConfiguration:s=[],orderId:u}=a.initializationData||{},{bannerContainerId:c,container:l}=i;if(void 0!==c){if(!document.getElementById(c))return void console.error("Unable to create banner without valid banner container ID.");const t=s&&s.find(({id:t})=>"checkout"===t);if(!(null==t?void 0:t.status))return;const e=yield this.payPalSdkScriptLoader.getPayPalMessages(a,o.getCartOrThrow().currency.code);return this.renderMessages(e,c,t)}u?this.orderId=u:(yield this.paypalIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==l?void 0:l.split("#")[1],this.renderButton(e,i))})}execute(t,e){return Q(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){if(!(null==e?void 0:e.container))throw new L('Unable to initialize payment because "container" argument is not provided.');const n=this.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let p=!1;d.forEach(t=>{if(p)return;const e={fundingSource:t,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecreditcheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(e),this.paypalButton.isEligible()||t!==n.FUNDING.PAYLATER){if(!this.paypalButton.isEligible()&&t===n.FUNDING.CREDIT)throw new Z(`PayPal ${t} is not available for your region. Please use PayPal Checkout instead.`);u&&"function"==typeof u&&u(),this.paypalButton.render(a),p=!0}})}handleClick(t,e){return Q(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;if(e&&"function"==typeof e)return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e&&"function"==typeof e&&e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:G(n)};t.Messages(r).render(`#${e}`)}}const et=e(t=>new tt(t,N(t),new R({containerStyles:D}),p()),[{id:"paypalcommercecredit"}]);var nt,rt,it,ot,at,st,ut;!function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(nt||(nt={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(rt||(rt={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(it||(it={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(ot||(ot={})),function(t){t.pill="pill",t.rect="rect"}(at||(at={})),function(t){t.OXXO="oxxo",t.IDEAL="ideal"}(st||(st={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(ut||(ut={}));var ct=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class lt{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(t,e,n,r){return ct(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=e||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(t);return this.paypalSdk=yield this.paypalCommerceScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new u;return this.paypalSdk}createBuyNowCartOrThrow(t){return ct(this,void 0,void 0,function*(){const e=t.getBuyNowCartRequestBody();if(!e)throw new c(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(e)}catch(t){throw new f}})}createOrder(t,e){return ct(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return ct(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return ct(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getConsignmentsOrThrow()[0];try{yield this.paypalCommerceRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:e.id,selectedShippingOption:n.selectedShippingOption})}catch(t){throw new v}})}getOrderStatus(t,e){return ct(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(t,e){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!e)throw new c(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:e},n.source===m.BuyNow&&{cart_id:n.id}))}submitPayment(t,e,n){return ct(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:t,paypal_account:{order_id:e}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:t,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(t){const e=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=e.availableShippingOptions||[],r=n.find(t=>t.isRecommended),i=(t?n.find(e=>e.id===t):n.find(t=>{var n;return t.id===(null===(n=e.selectedShippingOption)||void 0===n?void 0:n.id)}))||r||n[0];if(!i)throw new Error("Your order can't be shipped to this address");return i}getAddress(t){return{firstName:(null==t?void 0:t.firstName)||"",lastName:(null==t?void 0:t.lastName)||"",email:(null==t?void 0:t.email)||"",phone:(null==t?void 0:t.phone)||"",company:"",address1:(null==t?void 0:t.address1)||"",address2:(null==t?void 0:t.address2)||"",city:(null==t?void 0:t.city)||"",countryCode:(null==t?void 0:t.countryCode)||"",postalCode:(null==t?void 0:t.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==t?void 0:t.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:t}){var e,n;return this.getAddress({firstName:t.name.given_name,lastName:t.name.surname,email:t.email_address,address1:t.address.address_line_1,address2:t.address.address_line_2,city:t.address.admin_area_2,countryCode:t.address.country_code,postalCode:t.address.postal_code,stateOrProvinceCode:t.address.admin_area_1,phone:null===(n=null===(e=t.phone)||void 0===e?void 0:e.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(t){const{payer:e,purchase_units:n}=t,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:e.email_address,address1:r.address_line_1,address2:r.address_line_2,city:r.admin_area_2,countryCode:r.country_code,postalCode:r.postal_code,stateOrProvinceCode:r.admin_area_1})}getValidButtonStyle(t){const{color:e,height:n,label:r,shape:i}=t||{},o={color:e&&ot[e]?e:void 0,height:this.getValidHeight(n),label:r&&it[r]?r:void 0,shape:i&&at[i]?i:void 0};return(0,h.omitBy)(o,h.isNil)}getValidHeight(t){return t&&"number"==typeof t?t>55?55:t<25?25:t:40}removeElement(t){const e=t&&document.getElementById(t);e&&(e.style.display="none")}}var dt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class pt{constructor(t){this.requestSender=t}createOrder(t,e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return dt(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:e})).body})}getOrderStatus(t="paypalcommerce",e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":j,"Content-Type":T.Json},z);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}var ht=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ft{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return ht(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(t,e,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(t,e=!1){return ht(this,void 0,void 0,function*(){if(!this.window.paypal||e){const e=this.transformConfig(t.options),n=this.transformConfig(t.attributes),r=`https://www.paypal.com/sdk/js?${new URLSearchParams(e).toString()}`;yield this.scriptLoader.loadScript(r,{async:!0,attributes:n})}if(!this.window.paypal)throw new u;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(t,e,n=!0){const{id:r,clientToken:o,initializationData:a}=t;if(!(null==a?void 0:a.clientId))throw new c(i.MissingPaymentMethod);const{intent:s,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:v,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:g=[],isGooglePayEnabled:b}=a,w=f||n,S="paypalcommercecreditcards"===r,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=n?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!g.includes(t))],k=[..._,...I,...P,...g];return{options:Object.assign({"client-id":u,"merchant-id":l,"enable-funding":k.length>0?k:void 0,"disable-funding":A.length>0?A:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...C,...O],currency:e,intent:s},v&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}const yt=e=>{const{getHost:n}=e.getState();return new lt((0,o.createFormPoster)(),e,new pt((0,a.createRequestSender)({host:n()})),new ft((0,t.vQ)()))};var vt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class mt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return vt(this,void 0,void 0,function*(){const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=t||{},a=o||i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new L('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(e=s.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=s.initializationData)||void 0===n?void 0:n.orderId:(yield this.paypalCommerceIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=a.container.split("#")[1],this.renderButton(r,a))})}execute(t,e){return vt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){const n=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d={fundingSource:n.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(d),!this.paypalButton.isEligible())throw new Z("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");u&&"function"==typeof u&&u(),this.paypalButton.render(a)}handleClick(t,e){return vt(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e(),this.toggleLoadingIndicator(!1)}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const gt=e(t=>new mt(t,yt(t),new R({styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]),bt={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class wt extends v{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var St=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class _t{constructor(t,e,n,r,i=3e3,o=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalSdkScriptLoader=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=h.noop,this.isOrderApprovedProcessing=!1}initialize(t){return St(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerce:r,paypalcommercealternativemethods:i}=t,o=i||r;if(this.paypalcommercealternativemethods=i,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new L('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,e),{orderId:u,shouldRenderFields:c}=s.initializationData||{},l=a.getStoreConfigOrThrow().checkoutSettings.features;this.isOrderApprovedProcessing=function(t,e,n=!0){var r;return null!==(r=t["PAYPAL-5431.order_approved_processing"])&&void 0!==r?r:n}(l,0,!1),u?this.orderId=u:(this.paypalApms=yield this.paypalSdkScriptLoader.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,e,o),c&&this.renderFields(n,o))})}execute(t,e){return St(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new q;this.isOrderApprovedProcessing||"ideal"!==i||(yield new Promise((t,e)=>{this.initializePollingMechanism(i,t,e,o)})),this.isNonInstantPaymentMethod(i)&&(i!==st.IDEAL||this.isOrderApprovedProcessing)||(yield this.paymentIntegrationService.submitOrder(r,e)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new $)}deinitialize(){var t;return this.orderId=void 0,this.isOrderApprovedProcessing||this.resetPollingMechanism(),null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}initializePollingMechanism(t,e,n,r){return St(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceIntegrationService.getOrderStatus(null!=r?r:"paypalcommerce"),o=i===ut.Approved,a=i===ut.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommercealternativemethods:this.paypalcommercealternativemethods}),this.handleError(new wt)}catch(t){n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}reinitializeStrategy(t){return St(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}handleError(t){const{onError:e}=this.paypalcommercealternativemethods||{};this.isOrderApprovedProcessing||this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderButton(t,e,n){const r=this.getPaypalAmpsSdkOrThrow(),i=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t,e),{buttonStyle:o}=i.initializationData||{},{container:a,onError:s,onRenderButton:u,submitForm:c}=n,l={fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),onInit:(t,e)=>n.onInitButton(e),createOrder:()=>this.onCreateOrder(t,e,n),onApprove:t=>this.handleApprove(t,c),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deinitializePollingMechanism()},onError:t=>{this.deinitializePollingMechanism(),this.handleFailure(t,s)},onClick:(t,e)=>St(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.paypalButton=r.Buttons(l),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}onCreateOrder(t,e,n){var r;return St(this,void 0,void 0,function*(){const{onValidate:i}=n;yield i(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),h.noop);const o=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(t)&&(t===st.IDEAL&&this.isOrderApprovedProcessing||t===st.OXXO)){const n={useStoreCredit:!1},i={params:{methodId:t,gatewayId:e}};if(yield this.paymentIntegrationService.submitOrder(n,i),t===st.IDEAL){const e=this.paymentIntegrationService.getState(),n=null===(r=e.getOrder())||void 0===r?void 0:r.orderId;yield this.paypalCommerceIntegrationService.updateOrder("paypalcommercealternativemethods",t,n)}yield this.paypalCommerceIntegrationService.submitPayment(t,o,e)}return o})}handleApprove({orderID:t},e){this.orderId=t,e()}handleFailure(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderFields(t,e){const n=this.getPaypalAmpsSdkOrThrow(),r=this.paymentIntegrationService.getState(),{firstName:i,lastName:o,email:a}=r.getBillingAddressOrThrow(),{apmFieldsContainer:s,apmFieldsStyles:u}=e;if(!s)throw new L('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const c=document.querySelector(s);c&&(c.innerHTML="");const l={fundingSource:t,style:u||{},fields:{name:{value:`${i} ${o}`},email:{value:a}}};n.PaymentFields(l).render(s)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isNonInstantPaymentMethod(t){return t.toUpperCase()in st}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new u;return this.paypalApms}}const It=e(t=>new _t(t,N(t),p(),new R({containerStyles:bt})),[{gateway:"paypalcommercealternativemethods"}]);var Pt;!function(t){t.CVV="cvv",t.PAN="pan"}(Pt||(Pt={}));class Ct{static get(t){const e=`${encodeURIComponent(`${t}`)}=`,n=document.cookie;let r=null;const i=n.indexOf(e);if(i>-1){let t=n.indexOf(";",i);-1===t&&(t=n.length),r=decodeURIComponent(n.substring(i+e.length,t))}return r}static set(t,e,n={secure:!0}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;const{expires:i,path:o,domain:a,secure:s}=n;if(i)r+=`; expires=${i.toUTCString()}`;else{const t=new Date,e=60;t.setTime(t.getTime()+60*e*1e3),r+=`; expires=${t.toUTCString()}`}o&&(r+=`; path=${o}`),a&&(r+=`; domain=${a}`),s&&(r+="; secure"),document.cookie=r}static remove(t,e){Ct.set(t,"",Object.assign({expires:new Date(0)},e))}}var Ot,At=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class kt{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return At(this,void 0,void 0,function*(){if(e&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.paypalFastlane){const e={root:{backgroundColorPrimary:"transparent"}};this.window.paypalFastlane=yield t.Fastlane({styles:n||e})}return this.window.paypalFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.paypalFastlane)throw new u;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return At(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return At(this,void 0,void 0,function*(){return t?this.getPayPalFastlaneOrThrow().identity.triggerAuthenticationFlow(t):{}})}updateStorageSessionId(t){const e=new Date;e.setDate(e.getDate()+14);const n={expires:e,secure:!0};Ct.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){Ct.remove("bc-fastlane-sessionId")}getStorageSessionId(){return Ct.get("bc-fastlane-sessionId")||""}mapPayPalFastlaneProfileToBcCustomerData(t,e){var n,r,i;const{authenticationState:o,profileData:a}=e,s=null===(i=null===(r=null===(n=null==a?void 0:a.card)||void 0===n?void 0:n.paymentSource)||void 0===r?void 0:r.card)||void 0===i?void 0:i.billingAddress,u=null==a?void 0:a.shippingAddress,c=null==a?void 0:a.name,l=null==a?void 0:a.card,d=u?this.mapPayPalToBcAddress(u.address,u.name,u.phoneNumber):void 0,p=s&&c?this.mapPayPalToBcAddress(s,c,null==u?void 0:u.phoneNumber):void 0,h=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,p]);return{authenticationState:o||C.UNRECOGNIZED,addresses:f,billingAddress:p,shippingAddress:d,instruments:h}}mapPayPalToBcInstrument(t,e){const{id:n,paymentSource:r}=e,{brand:i,expiry:o,lastDigits:a}=r.card,[s,u]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:u,expiryYear:s,iin:"",last4:a,method:t,provider:t,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:Pt.PAN,type:"card"}]}mapBcToPayPalAddress(t){return{company:(null==t?void 0:t.company)||"",addressLine1:(null==t?void 0:t.address1)||"",addressLine2:(null==t?void 0:t.address2)||"",adminArea1:(null==t?void 0:t.stateOrProvinceCode)||(null==t?void 0:t.stateOrProvince)||"",adminArea2:(null==t?void 0:t.city)||"",postalCode:(null==t?void 0:t.postalCode)||"",countryCode:(null==t?void 0:t.countryCode)||""}}mapPayPalToBcAddress(t,e,n,r){const[i,o]=e.fullName.split(" "),a=(null==n?void 0:n.nationalNumber)||"",s=(null==n?void 0:n.countryCode)||"";return{id:Date.now(),type:"paypal-address",firstName:e.firstName||i||"",lastName:e.lastName||o||"",company:t.company||"",address1:t.addressLine1,address2:t.addressLine2||"",city:t.adminArea2,stateOrProvince:t.adminArea1,stateOrProvinceCode:t.adminArea1,country:t.countryCode||"",countryCode:t.countryCode||"",postalCode:t.postalCode,phone:s+a,customFields:r||[]}}filterAddresses(t){return t.reduce((t,e)=>e?t.some(t=>this.isEqualAddresses(t,e))?t:[...t,e]:t,[])}isEqualAddresses(t,e){return(0,h.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,h.omit)(t,["id","phone"])}}function Et(){return new kt}!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(Ot||(Ot={}));const jt=Ot;function xt(t){return jt.CardNumber in t&&jt.CardName in t&&jt.CardExpiry in t}function Tt(t){return jt.CardNumberVerification in t&&jt.CardCodeVerification in t&&jt.CardExpiryVerification in t}class zt extends s{constructor(t){super(t||"Unable to proceed because the client library of a payment method has thrown an unexpected error."),this.name="PaymentMethodFailedError",this.type="payment_method_client_invalid"}}var Ft;!function(t){t[t.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",t[t.CustomerNotInitialized=1]="CustomerNotInitialized",t[t.PaymentNotInitialized=2]="PaymentNotInitialized",t[t.ShippingNotInitialized=3]="ShippingNotInitialized",t[t.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(Ft||(Ft={}));class Bt extends s{constructor(t){super(function(t){switch(t){case Ft.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Ft.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Ft.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Ft.SpamProtectionNotInitialized:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(t)),this.subtype=t,this.name="NotInitializedError",this.type="not_initialized"}}class Nt extends s{constructor(t,e){super(e||"Unable to proceed because the payment form contains invalid data."),this.details=t,this.name="PaymentInvalidFormError",this.type="payment_invalid_form"}}var Dt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Mt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){return Dt(this,void 0,void 0,function*(){const{methodId:e,paypalcommercecreditcards:n,paypalcommerce:r}=t,i=n||r,{form:o,onCreditCardFieldsRenderingError:a,onLoadComplete:s}=i||{};if(!e)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new L('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=xt(o.fields),this.isCreditCardVaultedForm=Tt(o.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(e),yield this.paypalIntegrationService.loadPayPalSdk(e,void 0,!0,!0),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(o,a)),null==s||s(),this.shouldInitializePayPalFastlane(e)&&(yield this.initializePayPalFastlaneOrThrow(e))})}execute(t,e){return Dt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new V(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:t}=yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams());this.returnedOrderId=t}const a=this.preparePaymentPayload(i,o,this.returnedOrderId,this.returnedVaultedToken);yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment(a)})}finalize(){return Promise.reject(new $)}deinitialize(){var t,e,n,r;return Dt(this,void 0,void 0,function*(){return yield null===(t=this.cvvField)||void 0===t?void 0:t.close(),yield null===(e=this.expiryField)||void 0===e?void 0:e.close(),yield null===(n=this.numberField)||void 0===n?void 0:n.close(),yield null===(r=this.nameField)||void 0===r?void 0:r.close(),Promise.resolve()})}preparePaymentPayload(t,e,n,r){const{shouldSaveInstrument:i=!1,shouldSetAsDefaultInstrument:o=!1}=H(e)?e:{},a=e&&W(e)?e.instrumentId:void 0,s=(0,h.omitBy)({verification_nonce:r,token:a},h.isNil);return{methodId:t,paymentData:{shouldSaveInstrument:i,shouldSetAsDefaultInstrument:o,instrumentId:a,formattedPayload:Object.assign(Object.assign({},r||a?{bigpay_token:s}:{}),n?{card_with_order:{order_id:n}}:{})}}}initializeFields(t,e){return Dt(this,void 0,void 0,function*(){const{fields:n,styles:r}=t,i=this.paypalIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:t,vaultSetupToken:e,liabilityShift:n})=>{if(n===nt.No||n===nt.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new zt},inputEvents:{onChange:e=>this.onChangeHandler(t,e),onFocus:e=>this.onFocusHandler(t,e),onBlur:e=>this.onBlurHandler(t,e),onInputSubmitRequest:e=>this.onInputSubmitRequest(t,e)}},o);if(this.cardFields=yield i.CardFields(a),!this.cardFields.isEligible())throw new Bt(Ft.PaymentNotInitialized);try{this.stylizeInputContainers(n),xt(n)&&(yield this.renderFields(n)),Tt(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return Tt(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Dt(this,void 0,void 0,function*(){const{setupToken:t}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return t})}}createOrderCallback(){return{createOrder:()=>Dt(this,void 0,void 0,function*(){const{orderId:t}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams()))||{};return t})}}handleApprove({orderID:t,vaultSetupToken:e}){t&&(this.returnedOrderId=t),e&&(this.returnedVaultedToken=e)}renderFields(t){var e,n,r,i;return Dt(this,void 0,void 0,function*(){const o=this.getCardFieldsOrThrow();(null===(e=t.cardCode)||void 0===e?void 0:e.containerId)&&(this.cvvField=o.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCode.containerId}`)),(null===(n=t.cardExpiry)||void 0===n?void 0:n.containerId)&&(this.expiryField=o.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiry.containerId}`)),(null===(r=t.cardName)||void 0===r?void 0:r.containerId)&&(this.nameField=o.NameField({placeholder:""}),yield this.nameField.render(`#${t.cardName.containerId}`)),(null===(i=t.cardNumber)||void 0===i?void 0:i.containerId)&&(this.numberField=o.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumber.containerId}`))})}renderVaultedFields(t){var e,n,r;return Dt(this,void 0,void 0,function*(){const i=this.getCardFieldsOrThrow();(null===(e=t.cardCodeVerification)||void 0===e?void 0:e.containerId)&&(this.cvvField=i.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCodeVerification.containerId}`)),(null===(n=t.cardExpiryVerification)||void 0===n?void 0:n.containerId)&&(this.expiryField=i.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiryVerification.containerId}`)),(null===(r=t.cardNumberVerification)||void 0===r?void 0:r.containerId)&&(this.numberField=i.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumberVerification.containerId}`))})}getInstrumentParams(){if(!this.executionPaymentData)return{};if(H(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if(W(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Dt(this,void 0,void 0,function*(){const t=this.getCardFieldsOrThrow(),e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),n={billingAddress:{company:e.company,addressLine1:e.address1,addressLine2:e.address2,adminArea1:e.stateOrProvinceCode,adminArea2:e.city,postalCode:e.postalCode,countryCode:e.countryCode}};try{this.isCreditCardVaultedForm?yield t.submit():yield t.submit(n)}catch(t){throw new zt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Dt(this,void 0,void 0,function*(){const n=this.getCardFieldsOrThrow(),r=yield n.getState().then(t=>t),i=this.getValidityData(r);if(!i.isValid)throw null===(e=null===(t=this.hostedFormOptions)||void 0===t?void 0:t.onValidate)||void 0===e||e.call(t,i),new Nt(this.mapValidationErrors(i.errors))})}getValidityData({fields:t}){const e=Object.assign({},t);delete e.cardNameField;const n=Object.keys(e);return{isValid:n.every(t=>{var n;return null===(n=e[t])||void 0===n?void 0:n.isValid}),errors:n.reduce((t,n)=>{var r;const i=this.mapFieldType(n);return Object.assign(Object.assign({},t),{[i]:(null===(r=e[n])||void 0===r?void 0:r.isValid)?void 0:[this.getInvalidErrorByFieldType(i)]})},{})}}getInvalidErrorByFieldType(t){switch(t){case jt.CardCode:case jt.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case jt.CardNumber:case jt.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case jt.CardExpiry:case jt.CardExpiryVerification:return{fieldType:t,message:"Invalid card expiry",type:"invalid_card_expiry"};default:return{fieldType:t,message:"Invalid field",type:"invalid"}}}mapValidationErrors(t={}){const e={};return Object.keys(t).forEach(n=>{var r,i;e[n]=[{message:(null===(i=null===(r=t[n])||void 0===r?void 0:r[0])||void 0===i?void 0:i.message)||"",type:n}]}),e}mapFieldType(t){switch(t){case"name":return jt.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?jt.CardNumber:jt.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?jt.CardExpiry:jt.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?jt.CardCode:jt.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new Bt(Ft.PaymentNotInitialized);return this.cardFields}getInputStyles(t){var e,n,r;const i={"font-size":(null===(e=null==t?void 0:t.default)||void 0===e?void 0:e.fontSize)||"1rem","font-family":(null===(n=null==t?void 0:t.default)||void 0===n?void 0:n.fontFamily)||"Montserrat, Arial, Helvetica, sans-serif","font-weight":(null===(r=null==t?void 0:t.default)||void 0===r?void 0:r.fontWeight)||"400",outline:"none",padding:"9px 13px"},o=Object.assign(Object.assign({},i),{color:"#333333"});return{input:o,".invalid":Object.assign(Object.assign({},i),{color:"red"}),".valid":o,":focus":o}}stylizeInputContainers(t){Object.values(t||{}).forEach(t=>{const e=document.getElementById(`${(null==t?void 0:t.containerId)||""}`);e&&(e.style.padding="0px",e.style.boxShadow="none",e.style.border="none",e.style.background="transparent",e.style.marginBottom="10px",e.style.marginLeft="-5px")})}hasUndefinedValues(){return!this.hostedFormOptions||Object.values(this.hostedFormOptions.fields).some(t=>void 0===t)}onChangeHandler(t,e){var n;null===(n=null==t?void 0:t.onValidate)||void 0===n||n.call(t,this.getValidityData(e))}onFocusHandler(t,e){var n;null===(n=null==t?void 0:t.onFocus)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onBlurHandler(t,e){var n;null===(n=null==t?void 0:t.onBlur)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onInputSubmitRequest(t,e){var n;null===(n=null==t?void 0:t.onEnter)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}shouldInitializePayPalFastlane(t){var e,n;const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),o=r.getPaymentProviderCustomer(),a=(s=o)&&("authenticationState"in s||"addresses"in s||"instruments"in s)?o:{};var s;return(null===(e=null==i?void 0:i.initializationData)||void 0===e?void 0:e.isAcceleratedCheckoutEnabled)&&(null===(n=null==i?void 0:i.initializationData)||void 0===n?void 0:n.isPayPalCommerceAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(t){return Dt(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getPaymentMethodOrThrow(t),{initializationData:i}=r;if(!(null==i?void 0:i.connectClientToken))return;const o=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(r,n.currency.code,n.id);yield this.paypalFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(t){}})}}const Ut=e(t=>new Mt(t,N(t),p(),Et()),[{id:"paypalcommercecreditcards"}]);var Rt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Lt{constructor(t,e,n,r=3e3,i=3e5){this.paymentIntegrationService=t,this.paypalCommerceService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=h.noop}initialize(t){return Rt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerceratepay:r}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new L('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new L('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,e),{merchantId:u}=s.initializationData||{};if(!u)throw new L("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceService.loadPayPalSdk(n),this.createFraudNetScript(u,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return Rt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{getFieldsValues:i}=this.paypalcommerceratepay||{};if(!n)throw new V(["payment"]);if(!i||"function"!=typeof i)throw new L('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.paypalCommerceService.createOrder("paypalcommercealternativemethodscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),u={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:n.methodId,rate_pay:{birth_date:this.normalizeDate(o),phone:{national_number:a,country_code:s.split("+")[1]}},paypal_account:{order_id:t}}};return yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment({methodId:n.methodId,paymentData:u}),yield new Promise((t,e)=>{this.initializePollingMechanism(n.methodId,t,e,n.gatewayId)})}catch(t){return this.handleError(t),new Promise((t,e)=>e())}})}finalize(){return Promise.reject(new $)}deinitialize(){const{legalTextContainer:t}=this.paypalcommerceratepay||{},e=document.querySelectorAll('[data-id="fraudnetScript"]')[0],n=document.querySelectorAll('[data-id="fraudnetConfig"]')[0];if(this.deinitializePollingMechanism(),e.remove(),n.remove(),t){const e=document.getElementById(t);null==e||e.remove()}return Promise.resolve()}normalizeDate(t){const e=this.formatDate(t.getDate()),n=this.formatDate(t.getMonth()+1);return`${t.getFullYear()}-${n}-${e}`}formatDate(t){return`${t<10?0:""}${t}`}renderLegalText(t,e){const n=t,r=e.split("#")[1],i=document.getElementById(r),o=null==i?void 0:i.parentNode,a=document.createElement("div");a.style.marginBottom="20px",a.setAttribute("id",n),null==o||o.prepend(a);const s=this.paypalCommerceService.getPayPalSdkOrThrow(),u=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new L('Unable to initialize payment because "legalTextContainerElement" argument is not found.');u.render(`#${n}`)}handleError(t){const{onError:e}=this.paypalcommerceratepay||{};this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createFraudNetScript(t,e,n){const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e,n),{testMode:i}=r.config,o=document.createElement("script");o.setAttribute("type","application/json"),o.setAttribute("fncls","fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99"),o.setAttribute("data-id","fraudnetScript"),this.guid=this.generateGUID();const a={f:this.guid,s:`${t}_checkout-page`,sandbox:i};o.innerHTML=JSON.stringify(a),document.body.appendChild(o)}generateGUID(){let t="";for(let e=0;e<32;e+=1)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(62*Math.random())];return t}loadFraudnetConfig(){const t=document.createElement("script");t.setAttribute("data-id","fraudnetConfig"),t.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(t)}reinitializeStrategy(t){return Rt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return Rt(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceService.getOrderStatus("paypalcommercealternativemethods",{params:{useMetadata:!0}}),o=i===A.PollingStop,a=i===A.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommerceratepay:this.paypalcommerceratepay}),this.handleError(new wt)}catch(t){this.handleError(t),n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const Vt=e(t=>new Lt(t,N(t),new R({containerStyles:Object.assign(Object.assign({},D),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);function qt(t){return"string"!=typeof t}function $t(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,h.omitBy)(t.root,qt),o=(0,h.omitBy)(t.input,qt),a=(0,h.omitBy)(t.toggle,qt),s=(0,h.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,qt),u=(0,h.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,qt),c=t.branding;return Object.keys(i).length&&(r.root=i),Object.keys(o).length&&(r.input=o),Object.keys(a).length&&(r.toggle=a),Object.keys(s).length&&(r.text={},r.text.body=s),Object.keys(u).length&&(r.text=Object.assign({},r.text),r.text.caption=u),c&&(r.branding=c),r}(function(t,e){var n,r,i,o,a,s,u,c,l,d,p,h,f,y,v,m,g,b,w,S,_,I;return{root:{backgroundColorPrimary:(null==t?void 0:t.fastlaneRootSettingsBackgroundColor)||(null===(n=null==e?void 0:e.root)||void 0===n?void 0:n.backgroundColorPrimary),errorColor:(null==t?void 0:t.fastlaneRootSettingsErrorColor)||(null===(r=null==e?void 0:e.root)||void 0===r?void 0:r.errorColor),fontFamily:(null==t?void 0:t.fastlaneRootSettingsFontFamily)||(null===(i=null==e?void 0:e.root)||void 0===i?void 0:i.fontFamily),fontSizeBase:(null==t?void 0:t.fastlaneRootSettingsFontSize)||(null===(o=null==e?void 0:e.root)||void 0===o?void 0:o.fontSizeBase),padding:(null==t?void 0:t.fastlaneRootSettingsPadding)||(null===(a=null==e?void 0:e.root)||void 0===a?void 0:a.padding),primaryColor:(null==t?void 0:t.fastlaneRootSettingsPrimaryColor)||(null===(s=null==e?void 0:e.root)||void 0===s?void 0:s.primaryColor)},input:{borderRadius:(null==t?void 0:t.fastlaneInputSettingsBorderRadius)||(null===(u=null==e?void 0:e.input)||void 0===u?void 0:u.borderRadius),borderColor:(null==t?void 0:t.fastlaneInputSettingsBorderColor)||(null===(c=null==e?void 0:e.input)||void 0===c?void 0:c.borderColor),focusBorderColor:(null==t?void 0:t.fastlaneInputSettingsFocusBorderBase)||(null===(l=null==e?void 0:e.input)||void 0===l?void 0:l.focusBorderColor),backgroundColor:(null==t?void 0:t.fastlaneInputSettingsBackgroundColor)||(null===(d=null==e?void 0:e.input)||void 0===d?void 0:d.backgroundColor),borderWidth:(null==t?void 0:t.fastlaneInputSettingsBorderWidth)||(null===(p=null==e?void 0:e.input)||void 0===p?void 0:p.borderWidth),textColorBase:(null==t?void 0:t.fastlaneInputSettingsTextColorBase)||(null===(h=null==e?void 0:e.input)||void 0===h?void 0:h.textColorBase)},toggle:{colorPrimary:(null==t?void 0:t.fastlaneToggleSettingsColorPrimary)||(null===(f=null==e?void 0:e.toggle)||void 0===f?void 0:f.colorPrimary),colorSecondary:(null==t?void 0:t.fastlaneToggleSettingsColorSecondary)||(null===(y=null==e?void 0:e.toggle)||void 0===y?void 0:y.colorSecondary)},text:{body:{color:(null==t?void 0:t.fastlaneTextBodySettingsColor)||(null===(m=null===(v=null==e?void 0:e.text)||void 0===v?void 0:v.body)||void 0===m?void 0:m.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(g=null==e?void 0:e.text)||void 0===g?void 0:g.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==t?void 0:t.fastlaneTextCaptionSettingsColor)||(null===(S=null===(w=null==e?void 0:e.text)||void 0===w?void 0:w.caption)||void 0===S?void 0:S.color),fontSize:(null==t?void 0:t.fastlaneTextCaptionSettingsFontSize)||(null===(I=null===(_=null==e?void 0:e.text)||void 0===_?void 0:_.caption)||void 0===I?void 0:I.fontSize)}},branding:(null==t?void 0:t.fastlaneBrandingSettings)||(null==e?void 0:e.branding)}}(t,e))}function Ht(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}var Wt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Gt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceRequestSender=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){var e,n;return Wt(this,void 0,void 0,function*(){const{methodId:r,paypalcommercefastlane:i}=t;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new L('Unable to initialize payment because "options.paypalcommercefastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new L('Unable to initialize payment because "options.paypalcommercefastlane.onChange" argument is not provided or it is not a function.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState(),a=o.getCartOrThrow(),s=o.getPaymentMethodOrThrow(r),{isDeveloperModeApplicable:u,isFastlaneStylingEnabled:c}=s.initializationData||{};this.threeDSVerificationMethod=null===(e=s.initializationData)||void 0===e?void 0:e.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=$t(c?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.paypalFastlaneUtils.initializePayPalFastlane(this.paypalFastlaneSdk,!!u,l),this.shouldRunAuthenticationFlow()&&(yield this.runPayPalAuthenticationFlowOrThrow(r)),yield this.initializePayPalPaymentComponent(),i.onInit(t=>this.renderPayPalPaymentComponent(t)),i.onChange(()=>this.handlePayPalStoredInstrumentChange(r))})}execute(t,e){return Wt(this,void 0,void 0,function*(){const{payment:n}=t,r=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new V(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&W(i);try{yield this.paymentIntegrationService.submitOrder(r,e);const t=a?yield this.prepareVaultedInstrumentPaymentPayload(o,i):yield this.preparePaymentPayload(o,i);yield this.paymentIntegrationService.submitPayment(t),this.paypalFastlaneUtils.removeStorageSessionId()}catch(t){if(function(t){return"object"==typeof t&&null!==t&&"message"in t&&"response"in t&&"body"in t.response&&"name"in t.response.body}(t)&&"INVALID_REQUEST"===t.response.body.name){const t={translationKey:"payment.errors.invalid_request_error"};return this.handleError(t),Promise.reject()}if(t instanceof Error&&"FastlaneError"!==t.name)throw t;return Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){return Wt(this,void 0,void 0,function*(){return Promise.resolve()})}shouldRunAuthenticationFlow(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getCustomerOrThrow(),r=t.getPaymentProviderCustomer(),i=Ht(r)?r:{},o=this.paypalFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===C.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return Wt(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:u,addresses:c,instruments:l}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:u,addresses:c,instruments:l}),s.authenticationState===C.CANCELED?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return Wt(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),e=t.phone,n=`${t.firstName} ${t.lastName}`.trim(),r=this.paypalFastlaneUtils.getPayPalFastlaneOrThrow(),i={fields:Object.assign({cardholderName:{prefill:n,enabled:!0}},e&&{phoneNumber:{prefill:e}})};this.paypalComponentMethods=yield r.FastlaneCardComponent(i)})}renderPayPalPaymentComponent(t){const e=this.getPayPalComponentMethodsOrThrow();if(!t)throw new L('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new u;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return Wt(this,void 0,void 0,function*(){const{instrumentId:n}=e,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).config.is3dsEnabled?yield this.get3DSNonce(n):n;return yield this.createOrder(r),{methodId:t,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:r}}}}})}preparePaymentPayload(t,e){return Wt(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getBillingAddressOrThrow(),i=n.getPaymentMethodOrThrow(t),o=`${r.firstName} ${r.lastName}`.trim(),{getPaymentToken:a}=this.getPayPalComponentMethodsOrThrow(),{id:s}=yield a({name:{fullName:o},billingAddress:this.paypalFastlaneUtils.mapBcToPayPalAddress(r)}),u=i.config.is3dsEnabled?yield this.get3DSNonce(s):s;yield this.createOrder(u);const{shouldSaveInstrument:c=!1,shouldSetAsDefaultInstrument:l=!1}=H(e)?e:{};return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:c,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:u}}})}})}createOrder(t){return Wt(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.paypalCommerceRequestSender.createOrder(this.methodId,{cartId:e,fastlaneToken:t});this.orderId=n}})}get3DSNonce(t){var e;return Wt(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,a=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!a)throw new u;const s={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:t,threeDSRequested:this.threeDSVerificationMethod===b.Always,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}},c=yield a.isEligible(s);if(this.threeDSVerificationMethod===b.Always&&!c)throw new q;if(c){const{liabilityShift:t,authenticationState:e,nonce:n}=yield a.show();if(t===nt.No||t===nt.Unknown||e===w.Errored||e===w.Cancelled)throw new q;if(e===w.Succeeded&&[nt.Yes,nt.Possible].includes(t))return n}return t})}handlePayPalStoredInstrumentChange(t){return Wt(this,void 0,void 0,function*(){const e=this.paypalFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield e.profile.showCardSelector();if(n){const e=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=Ht(e)?e:{},i=this.paypalFastlaneUtils.mapPayPalToBcInstrument(t,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}handleError(t){var e;(null===(e=this.paypalcommercefastlane)||void 0===e?void 0:e.onError)&&"function"==typeof this.paypalcommercefastlane.onError&&this.paypalcommercefastlane.onError(t)}}const Yt=e(t=>{const{getHost:e}=t.getState();return new Gt(t,new pt((0,a.createRequestSender)({host:e()})),p(),Et())},[{id:"paypalcommerceacceleratedcheckout"}]);var Kt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};const Jt=class{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}createPayPalButton(t,e,n,r){const{style:i,fundingSource:o,isAppSwitchEnabled:a,isHostedCheckoutEnabled:s,onClick:u,onCancel:c,onPaymentComplete:l,onError:d}=n;this.onError=d;const p=this.paypalIntegrationService.getPayPalSdkOrThrow();if(!Object.values(p.FUNDING).includes(o))throw new L('Unable to initialize PayPal button because "fundingSource" argument is not valid funding source.');const h=Object.assign(Object.assign({},!a&&{onShippingAddressChange:e=>this.onShippingAddressChange(e,t),onShippingOptionsChange:e=>this.onShippingOptionsChange(e,t)}),{onApprove:(n,r)=>this.onHostedCheckoutApprove(n,r,e,t,l)});return p.Buttons(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({fundingSource:o,style:this.paypalIntegrationService.getValidButtonStyle(i)},a&&{appSwitchWhenAvailable:!0}),{createOrder:()=>Kt(this,void 0,void 0,function*(){if(r){const t=yield this.paypalIntegrationService.createBuyNowCartOrThrow(r);yield this.paymentIntegrationService.loadCheckout(t.id)}return this.paypalIntegrationService.createOrder(t)}),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)}),u?{onClick:u}:{}),c?{onCancel:c}:{}),s&&h))}onHostedCheckoutApprove(t,e,n,r,o){return Kt(this,void 0,void 0,function*(){if(!t.orderID)throw new c(i.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield e.order.get();try{const e=this.paypalIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),a.lineItems.physicalItems.length>0){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalIntegrationService.updateOrder(r)}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,t.orderID),o&&"function"==typeof o&&o()}catch(t){this.handleError(t)}})}onShippingAddressChange(t,e){return Kt(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(n),yield this.paymentIntegrationService.updateShippingAddress(n);const t=this.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalIntegrationService.updateOrder(e)}catch(t){this.handleError(t)}})}onShippingOptionsChange(t,e){return Kt(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(n.id),yield this.paypalIntegrationService.updateOrder(e)}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}};var Xt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Zt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalButtonCreationService=n}initialize(t){return Xt(this,void 0,void 0,function*(){const{paypalcommerce:e,methodId:n}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!e.container)throw new L('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new L('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return Xt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(t,e),Promise.resolve()})}signOut(t){return Xt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signOutCustomer(t),Promise.resolve()})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){var n,r;const{container:i,onClick:o,onComplete:a,onError:s}=e,u=this.paypalIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:l,paymentButtonStyles:d,isAppSwitchEnabled:p}=c.initializationData||{},{checkoutTopButtonStyles:h}=d||{},f=Object.assign(Object.assign(Object.assign({fundingSource:u.FUNDING.PAYPAL,isAppSwitchEnabled:p,isHostedCheckoutEnabled:l,style:Object.assign(Object.assign({},h),{height:40})},o&&{onClick:()=>o()}),l&&a&&{onPaymentComplete:()=>a()}),{onError:s}),y=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",t,f);y.isEligible()?(null===(n=y.hasReturned)||void 0===n?void 0:n.call(y))&&p?null===(r=y.resume)||void 0===r||r.call(y):y.render(`#${i}`):this.paypalIntegrationService.removeElement(i)}}const Qt=e(t=>{const e=N(t),n=new Jt(t,e);return new Zt(t,e,n)},[{id:"paypalcommerce"}]);var te=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ee{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=h.noop}initialize(t){return te(this,void 0,void 0,function*(){const{paypalcommercecredit:e,methodId:n}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!e.container)throw new L('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new L('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=e.onError||h.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return te(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return te(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onComplete:r,onClick:i}=e,o=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u,isAppSwitchEnabled:c}=a.initializationData||{},{checkoutTopButtonStyles:l}=u||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!c&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,r)}),h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let f=!1;h.forEach(t=>{if(!f){const e=Object.assign(Object.assign({fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},l),{height:40}))},d),s&&p),r=o.Buttons(e);r.isEligible()&&(r.render(`#${n}`),f=!0)}}),f||this.paypalCommerceIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,e,n,r){return te(this,void 0,void 0,function*(){if(!t.orderID)throw new c(i.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield e.order.get();try{const e=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalCommerceIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return te(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return te(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const ne=e(t=>new ee(t,yt(t)),[{id:"paypalcommercecredit"}]);var re=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ie{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return re(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,methodId:n}=t;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!e.container)throw new L('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new L('Unable to initialize payment because "options.paypalcommercevenmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return re(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return re(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onClick:r}=e,i=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},u=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:40})),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),c=i.Buttons(u);c.isEligible()?c.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const oe=e(t=>new ie(t,yt(t)),[{id:"paypalcommercevenmo"}]);var ae=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class se{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalSdkScriptLoader=e,this.paypalFastlaneUtils=n}initialize(t){var e;return ae(this,void 0,void 0,function*(){const{methodId:n,paypalcommercefastlane:r}=t;if(!n)throw new L('Unable to proceed because "methodId" argument is not provided.');try{yield this.paymentIntegrationService.loadPaymentMethod(n);const t=this.paymentIntegrationService.getState(),i=t.getCartOrThrow(),o=t.getPaymentMethodOrThrow(n),a=!!(null===(e=o.initializationData)||void 0===e?void 0:e.isDeveloperModeApplicable),s=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.paypalFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(t){}return Promise.resolve()})}deinitialize(){return ae(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(t,e){return ae(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e),yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:void 0,addresses:void 0,instruments:void 0}),this.paypalFastlaneUtils.removeStorageSessionId()})}signOut(t){return ae(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){return ae(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new L('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new L('Unable to proceed because "continueWithCheckoutCallback" argument is not provided and it must be a function.');if(this.paymentIntegrationService.getState().getCustomerOrThrow().isGuest){e&&"function"==typeof e&&e();try{yield this.runPayPalAuthenticationFlowOrThrow(r)}catch(t){}}n()})}runPayPalAuthenticationFlowOrThrow(t){return ae(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow().id,r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),u=s.authenticationState===C.CANCELED;yield this.updateCustomerDataState(t,s),u?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return ae(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:u}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,e);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:u}),a&&(yield this.paymentIntegrationService.updateBillingAddress(a)),s&&r.lineItems.physicalItems.length>0){const e=yield this.paymentIntegrationService.updateShippingAddress(s),r=e.getPaymentMethodOrThrow(t),{isFastlaneShippingOptionAutoSelectEnabled:i}=r.initializationData||{},o=e.getConsignments()||[],a=(null===(n=o[0])||void 0===n?void 0:n.availableShippingOptions)||[],u=a[0],c=a.find(t=>t.isRecommended);if((c||u)&&i){const t=(null==c?void 0:c.id)||u.id;yield this.paymentIntegrationService.selectShippingOption(t)}}})}getFastlaneStyles(t,e){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return $t(i?r:{},null==e?void 0:e.styles)}}const ue=e(t=>new se(t,p(),Et()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);class ce{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalButtonCreationService=n}initialize(t){var e,n,r,i,o;return n=this,r=void 0,o=function*(){const{paypalcommerce:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new L('Unable to initialize payment because "options.paypalcommerce.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(e=n.buyNowInitializeOptions)||void 0===e?void 0:e.getBuyNowCartRequestBody))throw new L('Unable to initialize payment because "options.paypalcommerce.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');o||(yield this.paymentIntegrationService.loadDefaultCheckout());const a=o?n.currencyCode:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n)},new((i=void 0)||(i=Promise))(function(t,e){function a(t){try{u(o.next(t))}catch(t){e(t)}}function s(t){try{u(o.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i(function(t){t(n)})).then(a,s)}u((o=o.apply(n,r||[])).next())})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){var r,i;const{buyNowInitializeOptions:o,style:a,onComplete:s,onEligibilityFailure:u}=n,c=this.paypalIntegrationService.getPayPalSdkOrThrow(),l=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:d,isAppSwitchEnabled:p}=l.initializationData||{},h={onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},f=Object.assign(Object.assign({fundingSource:c.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(a),isAppSwitchEnabled:p,isHostedCheckoutEnabled:d},o&&h),d&&s&&{onPaymentComplete:()=>s()}),y=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",e,f,o);y.isEligible()?(null===(r=y.hasReturned)||void 0===r?void 0:r.call(y))&&p?null===(i=y.resume)||void 0===i||i.call(y):y.render(`#${t}`):u&&"function"==typeof u?u():this.paypalIntegrationService.removeElement(t)}}const le=e(t=>{const e=N(t),n=new Jt(t,e);return new ce(t,e,n)},[{id:"paypalcommerce"}]);var de=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class pe{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}initialize(t){return de(this,void 0,void 0,function*(){const{paypalcommercecredit:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(a&&!o)throw new L('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new L('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=this.paymentIntegrationService.getState(),u=a?o:s.getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(r,u,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c,isAppSwitchEnabled:l}=u.initializationData||{},d={createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)},p={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h=Object.assign(Object.assign({},!l&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)}),f=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let y=!1;f.forEach(e=>{if(!y){const n=Object.assign(Object.assign(Object.assign({fundingSource:e,style:this.paypalIntegrationService.getValidButtonStyle(i)},d),r&&p),c&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${t}`),y=!0):a&&"function"==typeof a&&a()}}),y||this.paypalIntegrationService.removeElement(t)}handleClick(t){return de(this,void 0,void 0,function*(){if(t){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(t,e,n,r){return de(this,void 0,void 0,function*(){if(!t.orderID)throw new c(i.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield e.order.get();try{const e=this.paypalIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return de(this,void 0,void 0,function*(){const e=this.paypalIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t){return de(this,void 0,void 0,function*(){const e=this.paypalIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}}const he=e(t=>new pe(t,N(t)),[{id:"paypalcommercecredit"}]);var fe=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ye{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return fe(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new L('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new L('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new L('Unable to initialize payment because "options.paypalcommercevenmo.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=a?o:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,s,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,u={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},u),r&&c),d=a.Buttons(l);d.isEligible()?d.render(`#${t}`):o&&"function"==typeof o?o():this.paypalCommerceIntegrationService.removeElement(t)}getValidVenmoButtonStyles(t){const e=this.paypalCommerceIntegrationService.getValidButtonStyle(t);return e.color===ot.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return fe(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const ve=e(t=>new ye(t,yt(t)),[{id:"paypalcommercevenmo"}])})(),module.exports=r})();
3
3
  //# sourceMappingURL=paypal-commerce.js.map