@bigcommerce/checkout-sdk 1.889.0 → 1.889.1
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.
- package/dist/cjs/checkout-button.js +1 -1
- package/dist/cjs/checkout-sdk-essential.js +1 -1
- package/dist/cjs/checkout-sdk.js +1 -1
- package/dist/cjs/hosted-form-v2-iframe-host.js +1 -1
- package/dist/cjs/integrations/amazon-pay.js +1 -1
- package/dist/cjs/integrations/bigcommerce-payments.js +1 -1
- package/dist/cjs/integrations/braintree.js +1 -1
- package/dist/cjs/integrations/google-pay.js +1 -1
- package/dist/cjs/integrations/klarna.js +1 -1
- package/dist/cjs/integrations/paypal-commerce.js +1 -1
- package/dist/cjs/integrations/paypal-express.js +1 -1
- package/dist/cjs/integrations/zip.js +1 -1
- package/dist/esm/checkout-button.js +1 -1
- package/dist/esm/checkout-sdk-essential.js +1 -1
- package/dist/esm/checkout-sdk.js +1 -1
- package/dist/esm/hosted-form-v2-iframe-host.js +1 -1
- package/dist/esm/integrations/amazon-pay.js +1 -1
- package/dist/esm/integrations/bigcommerce-payments.js +1 -1
- package/dist/esm/integrations/braintree.js +1 -1
- package/dist/esm/integrations/google-pay.js +1 -1
- package/dist/esm/integrations/klarna.js +1 -1
- package/dist/esm/integrations/paypal-commerce.js +1 -1
- package/dist/esm/integrations/paypal-express.js +1 -1
- package/dist/esm/integrations/zip.js +1 -1
- package/dist/types/checkout-sdk.d.ts +2 -0
- package/docs/interfaces/InventorySettings.md +14 -0
- package/package.json +1 -1
|
@@ -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]",c=/^\[object .+?Constructor\]$/,u=/^(?: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,g=f||y||Function("return this")(),m=e&&!e.nodeType&&e,v=m&&t&&!t.nodeType&&t,b=v&&v.exports===m,w=b&&f.process,S=function(){try{return v&&v.require&&v.require("util").types||w&&w.binding&&w.binding("util")}catch(t){}}(),_=S&&S.isTypedArray,I=Array.prototype,P=Function.prototype,C=Object.prototype,O=g["__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?g.Buffer:void 0,B=g.Symbol,F=g.Uint8Array,M=(z&&z.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(t){return p(h(t))}),D=Object.create,N=C.propertyIsEnumerable,U=I.splice,R=B?B.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(g,"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 c=lt(t,n),u=lt(e,n),l=a.get(u);if(l)Z(t,n,l);else{var d,p,h,f,y,g=o?o(c,u,n+"",t,e,a):void 0,m=void 0===g;if(m){var v=ft(u),b=!v&>(u),w=!v&&!b&&St(u);g=u,v||b||w?ft(c)?g=c:wt(y=c)&&yt(y)?g=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(c):b?(m=!1,g=function(t){return t.slice()}(u)):w?(m=!1,f=new(h=(d=u).buffer).constructor(h.byteLength),new F(f).set(new F(h)),p=f,g=new d.constructor(p,d.byteOffset,d.length)):g=[]:function(t){if(!wt(t)||nt(t)!=s)return!1;var e=M(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}(u)||ht(u)?(g=c,ht(c)?g=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))}(c):bt(c)&&!mt(c)||(g=function(t){return"function"!=typeof t.constructor||ut(t)?{}:G(M(t))}(u))):m=!1}m&&(a.set(u,g),i(g,u,r,o,a),a.delete(u)),Z(t,n,g)}}(t,e,a,n,it,r,i);else{var c=r?r(lt(t,a),o,a+"",t,e,i):void 0;void 0===c&&(c=o),Z(t,a,c)}},_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:c).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 ct(t,e){var n=typeof t;return!!(e=null==e?i:e)&&("number"==n||"symbol"!=n&&u.test(t))&&t>-1&&t%1==0&&t<e}function ut(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")&&!N.call(t,"callee")},ft=Array.isArray;function yt(t){return null!=t&&vt(t.length)&&!mt(t)}var gt=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 vt(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)&&vt(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&>(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):[],c=s.length;for(var u in t)!e&&!k.call(t,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ct(u,c))||s.push(u);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=ut(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)&&ct(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 c in o)o[c]&&(s+="; "+c,!0!==o[c]&&(s+="="+o[c].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("="),c=s.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=e(s[0]);if(c=(r.read||r)(c,u)||e(c),n)try{c=JSON.parse(c)}catch(t){}if(i[u]=c,t===u)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 c=a[s];t=t.replace(new RegExp(c,"g"),e[c])}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),c=1;c<arguments.length;c++){for(var u in o=Object(arguments[c]))n.call(o,u)&&(s[u]=o[u]);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:()=>u});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),c=n(2024);const u=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 c.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,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;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=c,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,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;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,c&&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 c=document.createElement("link");c.as="style",c.rel=a?"prefetch":"preload",c.href=t,c.onload=function(){r()},c.onerror=function(e){delete n._preloadedStylesheets[t],i(e)},document.head.appendChild(c)}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,c=128,u=1/0,l=9007199254740991,d=NaN,p=4294967295,h=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",g="[object Boolean]",m="[object Date]",v="[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]",B="[object Int8Array]",F="[object Int16Array]",M="[object Int32Array]",D="[object Uint8Array]",N="[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,ct=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,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+"]",Bt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+wt+"]",Mt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Nt="["+Pt+"]",Ut="\\u200d",Rt="(?:"+Tt+"|"+zt+")",Lt="(?:"+Nt+"|"+zt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+Et+"|"+Bt+")?",Ht="["+Ct+"]?",Wt=Ht+$t+"(?:"+Ut+"(?:"+[Ft,Mt,Dt].join("|")+")"+Ht+$t+")*",Gt="(?:"+[xt,Mt,Dt].join("|")+")"+Wt,Yt="(?:"+[Ft+Et+"?",Et,Mt,Dt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Xt=RegExp(Bt+"(?="+Bt+")|"+Yt+Wt,"g"),Zt=RegExp([Nt+"?"+Tt+"+"+Vt+"(?="+[kt,Nt,"$"].join("|")+")",Lt+"+"+qt+"(?="+[kt,Nt+Rt,"$"].join("|")+")",Nt+"?"+Rt+"+"+Vt,Nt+"+"+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[B]=re[F]=re[M]=re[D]=re[N]=re[U]=re[R]=!0,re[f]=re[y]=re[j]=re[g]=re[x]=re[m]=re[v]=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[g]=ie[m]=ie[T]=ie[z]=ie[B]=ie[F]=ie[M]=ie[S]=ie[_]=ie[I]=ie[C]=ie[O]=ie[A]=ie[k]=ie[D]=ie[N]=ie[U]=ie[R]=!0,ie[v]=ie[b]=ie[E]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,se=parseInt,ce="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ue="object"==typeof self&&self&&self.Object===Object&&self,le=ce||ue||Function("return this")(),de=e&&!e.nodeType&&e,pe=de&&t&&!t.nodeType&&t,he=pe&&pe.exports===de,fe=he&&ce.process,ye=function(){try{return pe&&pe.require&&pe.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),ge=ye&&ye.isArrayBuffer,me=ye&&ye.isDate,ve=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)&&Ne(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 Be(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 Fe=Ve("length");function Me(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 Ne(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&&Ne(e,t[n],0)>-1;);return n}function Ze(t,e){for(var n=t.length;n--&&Ne(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({"&":"&","<":"<",">":">",'"':""","'":"'"});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 cn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function un(t){return nn(t)?function(t){for(var e=Xt.lastIndex=0;Xt.test(t);)++e;return e}(t):Fe(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({"&":"&","<":"<",">":">",""":'"',"'":"'"}),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,Bt=0,Ft=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Mt=jt.toString,Dt=Tt.call(Pt),Nt=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=co(Pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ce=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ue=wt&&wt.now!==le.Date.now&&wt.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,pe=It.ceil,fe=It.floor,ye=Pt.getOwnPropertySymbols,Fe=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,yn=on(Pt.keys,Pt),gn=It.max,mn=It.min,vn=wt.now,bn=e.parseInt,wn=It.random,Sn=kt.reverse,_n=co(e,"DataView"),In=co(e,"Map"),Pn=co(e,"Promise"),Cn=co(e,"Set"),On=co(e,"WeakMap"),An=co(Pt,"create"),kn=On&&new On,En={},jn=Do(_n),xn=Do(In),Tn=Do(Pn),zn=Do(Cn),Bn=Do(On),Fn=Lt?Lt.prototype:r,Mn=Fn?Fn.valueOf:r,Dn=Fn?Fn.toString:r;function Nn(t){if(ts(t)&&!qa(t)&&!(t instanceof Vn)){if(t instanceof Ln)return t;if(zt.call(t,"__wrapped__"))return No(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&&cs(t),a=n||r||i||o,s=a?We(t.length,Ot):[],c=s.length;for(var u in t)!e&&!zt.call(t,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||go(u,c))||s.push(u);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,c=1&e,u=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),!c)return Oi(t,s)}else{var p=po(t),h=p==b||p==w;if(Ga(t))return wi(t,c);if(p==I||p==f||h&&!o){if(s=u||h?{}:fo(t),!c)return u?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,uo(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 g: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 B:case F:case M:case D:case N: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,Mn?Pt(Mn.call(r)):{}}}(t,p,c)}}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 v=d?r:(l?u?eo:to:u?xs:js)(t);return Pe(v||t,function(r,i){v&&(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 cr(t,e,n){if("function"!=typeof t)throw new At(i);return ko(function(){t.apply(r,n)},e)}function ur(t,e,n,r){var i=-1,o=ke,a=!0,s=t.length,c=[],u=e.length;if(!s)return c;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=u;p--;)if(e[p]===d)continue t;c.push(l)}else o(e,d,r)||c.push(l)}return c}Nn.templateSettings={escape:Y,evaluate:K,interpolate:J,variable:"",imports:{_:Nn}},Nn.prototype=Rn.prototype,Nn.prototype.constructor=Nn,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(vr),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&&(c===r?s==s&&!ss(s):n(s,c)))var c=s,u=a}return u}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 gr=xi(),mr=xi(!0);function vr(t,e){return t&&gr(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=gi(e,t)).length;null!=t&&n<i;)t=t[Mo(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=Mt.call(t);return i&&(e?t[Qt]=n:delete t[Qt]),o}(t):function(t){return Mt.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,c=rt(a),u=1/0,l=[];s--;){var d=t[s];s&&e&&(d=je(d,Ye(e))),u=mn(d.length,u),c[s]=!n&&(e||o>=120&&d.length>=120)?new Wn(s&&d):r}d=t[0];var p=-1,h=c[0];t:for(;++p<o&&l.length<u;){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 g=c[s];if(!(g?Je(g,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=gi(e,t)))?t:t[Mo(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),c=qa(e),u=s?y:po(t),l=c?y:po(e),d=(u=u==f?I:u)==I,p=(l=l==f?I:l)==I,h=u==l;if(h&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Gn),s||cs(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 g:case m:case _:return Ua(+t,+e);case v:return t.name==e.name&&t.message==e.message;case C:case A:return t==e+"";case S:var s=rn;case O:var c=1&r;if(s||(s=sn),t.size!=e.size&&!c)return!1;var u=a.get(t);if(u)return u==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(Mn)return Mn.call(t)==Mn.call(e)}return!1}(t,e,u,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,c=to(t),u=c.length;if(u!=to(e).length&&!s)return!1;for(var l=u;l--;){var d=c[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<u;){var g=t[d=c[l]],m=e[d];if(i)var v=s?i(m,g,d,e,t,a):i(g,m,d,t,e,a);if(!(v===r?g===m||o(g,m,n,i,a):v)){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 c=n[o];if(s&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<a;){var u=(c=n[o])[0],l=t[u],d=c[1];if(s&&c[2]){if(l===r&&!(u in t))return!1}else{var p=new Gn;if(i)var h=i(l,d,u,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,Ft&&Ft in e))&&(Ja(t)?Ut:ft).test(Do(t));var e}function zr(t){return"function"==typeof t?t:null==t?nc:"object"==typeof t?qa(t)?Nr(t[0],t[1]):Dr(t):dc(t)}function Br(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 Fr(t,e){return t<e}function Mr(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 Nr(t,e){return vo(t)&&_o(e)?Io(Mo(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&&gr(e,function(a,s){if(o||(o=new Gn),Qa(a))!function(t,e,n,i,o,a,s){var c=Oo(t,n),u=Oo(e,n),l=s.get(u);if(l)Zn(t,n,l);else{var d=a?a(c,u,n+"",t,e,s):r,p=d===r;if(p){var h=qa(u),f=!h&&Ga(u),y=!h&&!f&&cs(u);d=u,h||f||y?qa(c)?d=c:Wa(c)?d=Oi(c):f?(p=!1,d=wi(u,!0)):y?(p=!1,d=_i(u,!0)):d=[]:rs(u)||Va(u)?(d=c,Va(c)?d=gs(c):Qa(c)&&!Ja(c)||(d=fo(u))):p=!1}p&&(s.set(u,d),o(d,u,i,a,s),s.delete(u)),Zn(t,n,d)}}(t,e,s,n,Ur,i,o);else{var c=i?i(Oo(t,s),a,s+"",t,e,o):r;c===r&&(c=a),Zn(t,s,c)}},xs)}function Rr(t,e){var n=t.length;if(n)return go(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}):[nc];var r=-1;e=je(e,Ye(oo()));var i=Mr(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 c=Ii(i[r],o[r]);if(c)return r>=s?c:c*("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,gi(a,t),s)}return o}function qr(t,e,n,r){var i=r?Ue:Ne,o=-1,a=e.length,s=t;for(t===e&&(e=Oi(e)),n&&(s=je(t,Ye(n)));++o<a;)for(var c=0,u=e[o],l=n?n(u):u;(c=i(s,l,c,r))>-1;)s!==t&&Gt.call(s,c,1),Gt.call(t,c,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;go(i)?Gt.call(t,i,1):ci(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,nc),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=gi(e,t)).length,s=a-1,c=t;null!=c&&++o<a;){var u=Mo(e[o]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(o!=s){var d=c[u];(l=i?i(d,u,c):r)===r&&(l=Qa(d)?d:go(e[o+1])?[]:{})}Qn(c,u,l),c=c[u]}return t}var Xr=kn?function(t,e){return kn.set(t,e),t}:nc,Zr=oe?function(t,e){return oe(t,"toString",{configurable:!0,enumerable:!1,value:Qs(e),writable:!0})}:nc;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,nc,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,c=null===e,u=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,g=ss(p);if(s)var m=i||y;else m=l?y&&(i||h):c?y&&h&&(i||!f):u?y&&h&&!f&&(i||!g):!f&&!g&&(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,c)){var c=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=[],c=s;if(n)a=!1,i=Ee;else if(o>=200){var u=e?null:Wi(t);if(u)return sn(u);a=!1,i=Je,c=new Wn}else c=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=c.length;p--;)if(c[p]===d)continue t;e&&c.push(d),s.push(l)}else i(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ci(t,e){return null==(t=Co(t,e=gi(e,t)))||delete t[Mo(Ko(e))]}function ui(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]=ur(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 c=i<a?e[i]:r;n(s,t[i],c)}return s}function fi(t){return Wa(t)?t:[]}function yi(t){return"function"==typeof t?t:nc}function gi(t,e){return qa(t)?t:vo(t,e)?[t]:Fo(ms(t))}var mi=Gr;function vi(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ti(t,e,n)}var bi=ce||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,c=null===e,u=e==e,l=ss(e);if(!c&&!l&&!a&&t>e||a&&s&&u&&!c&&!l||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!l&&t<e||l&&n&&o&&!i&&!a||c&&n&&o||!s&&o||!u)return-1}return 0}function Pi(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,c=e.length,u=gn(o-a,0),l=rt(c+u),d=!r;++s<c;)l[s]=e[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=t[i]);for(;u--;)l[s++]=t[i++];return l}function Ci(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,c=-1,u=e.length,l=gn(o-s,0),d=rt(l+u),p=!r;++i<l;)d[i]=t[i];for(var h=i;++c<u;)d[h+c]=e[c];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 c=e[a],u=i?i(n[c],t[c],c,n,t):r;u===r&&(u=t[c]),o?rr(n,c,u):Qn(n,c,u)}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 c=n[i];c&&t(e,c,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 c=a[t?s:++i];if(!1===n(o[c],c,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?vi(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 Bi(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 Fi(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 Mi(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&&!c&&"wrapper"==ro(s))var c=new Ln([],!0)}for(o=c?o:n;++o<n;){var u=ro(s=e[o]),l="wrapper"==u?no(s):r;c=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ro(l[0])].apply(c,l[3]):1==s.length&&bo(s)?c[u]():c.thru(s)}return function(){var t=arguments,r=t[0];if(c&&1==t.length&&qa(r))return c.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,u,l,d){var p=e&c,h=1&e,f=2&e,y=24&e,g=512&e,m=f?r:Bi(t);return function c(){for(var v=arguments.length,b=rt(v),w=v;w--;)b[w]=arguments[w];if(y)var S=io(c),_=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)),v-=_,y&&v<d){var I=an(b,S);return $i(t,e,Di,c.placeholder,n,b,I,u,l,d-v)}var P=h?n:this,C=f?P[t]:t;return v=b.length,u?b=function(t,e){for(var n=t.length,i=mn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=go(a,n)?o[a]:r}return t}(b,u):g&&v>1&&b.reverse(),p&&l<v&&(b.length=l),this&&this!==le&&this instanceof c&&(C=m||Bi(C)),C.apply(P,b)}}function Ni(t,e){return function(n,r){return function(t,e,n,r){return vr(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/un(e)));return nn(e)?vi(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=gn(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,c,u,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?c:r,p?r:a,p?r:c,u,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]==u?function(t){return new Cn(t)}:sc;function Gi(t){return function(e){var n=po(e);return n==S?rn(e):n==O?cn(e):function(t,e){return je(e,function(e){return[e,t[e]]})}(e,t(e))}}function Yi(t,e,n,o,u,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=u=r),d=d===r?d:gn(hs(d),0),p=p===r?p:hs(p),f-=u?u.length:0,64&e){var y=o,g=u;o=u=r}var m=h?r:no(t),v=[t,e,n,o,u,y,g,l,d,p];if(m&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==c&&8==n||r==c&&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 u=e[3];if(u){var l=t[3];t[3]=l?Pi(l,u,e[4]):u,t[4]=l?an(t[3],a):e[4]}(u=e[5])&&(l=t[5],t[5]=l?Ci(l,u,e[6]):u,t[6]=l?an(t[5],a):e[6]),(u=e[7])&&(t[7]=u),r&c&&(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}(v,m),t=v[0],e=v[1],n=v[2],o=v[3],u=v[4],!(p=v[9]=v[9]===r?h?0:t.length:gn(v[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Bi(t);return function o(){for(var a=arguments.length,s=rt(a),c=a,u=io(o);c--;)s[c]=arguments[c];var l=a<3&&s[0]!==u&&s[a-1]!==u?[]:an(s,u);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||u.length?Di.apply(r,v):function(t,e,n,r){var i=1&e,o=Bi(t);return function e(){for(var a=-1,s=arguments.length,c=-1,u=r.length,l=rt(u+s),d=this&&this!==le&&this instanceof e?o:t;++c<u;)l[c]=r[c];for(;s--;)l[c++]=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=Bi(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,v),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,c=t.length,u=e.length;if(c!=u&&!(s&&u>c))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<c;){var y=t[p],g=e[p];if(i)var m=s?i(g,y,p,e,t,a):i(y,g,p,t,e,a);if(m!==r){if(m)continue;h=!1;break}if(f){if(!Be(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!==g&&!o(y,g,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,uo)}function eo(t){return _r(t,xs,lo)}var no=kn?function(t){return kn.get(t)}:sc;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(Nn,"placeholder")?Nn:t).placeholder}function oo(){var t=Nn.iteratee||rc;return t=t===rc?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 co(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return Tr(n)?n:r}var uo=ye?function(t){return null==t?[]:(t=Pt(t),Ae(ye(t),function(e){return Wt.call(t,e)}))}:fc,lo=ye?function(t){for(var e=[];t;)xe(e,uo(t)),t=$t(t);return e}:fc,po=Ir;function ho(t,e,n){for(var r=-1,i=(e=gi(e,t)).length,o=!1;++r<i;){var a=Mo(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)&&go(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 go(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&>.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)&&go(e,n.length):"string"==r&&e in n)&&Ua(n[e],t)}function vo(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=Nn[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 Bn:return E}return e});var wo=xt?Ja:yc;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=gn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=gn(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=vn(),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,Bo,Fo=(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(ut,"$1"):n||t)}),e},function(t){return 500===Bo.size&&Bo.clear(),t}),Bo=zo.cache,zo);function Mo(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 No(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)?ur(t,yr(e,1,Wa,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?ur(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)?ur(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=gn(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?gn(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 go(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=gn(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)?ur(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))}),ca=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,pi(Ae(t,Wa),r,e)}),ua=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=Nn(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&&go(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=Fi(Vo),ga=Fi(qo);function ma(t,e){return(qa(t)?Pe:lr)(t,oo(e,3))}function va(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:Mr)(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=ue||function(){return le.Date.now()};function Oa(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Yi(t,c,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,c,u,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,c=t.apply(i,n)}function g(t){var n=t-l;return l===r||n>=e||n<0||h&&t-d>=s}function m(){var t=Ca();if(g(t))return v(t);u=ko(m,function(t){var n=e-(t-l);return h?mn(n,s-(t-d)):n}(t))}function v(t){return u=r,f&&o?y(t):(o=a=r,c)}function b(){var t=Ca(),n=g(t);if(o=arguments,a=this,l=t,n){if(u===r)return function(t){return d=t,u=ko(m,e),p?y(t):c}(l);if(h)return bi(u),u=ko(m,e),y(l)}return u===r&&(u=ko(m,e)),c}return e=ys(e)||0,Qa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?gn(ys(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){u!==r&&bi(u),d=0,o=l=a=u=r},b.flush=function(){return u===r?c:v(Ca())},b}var xa=Gr(function(t,e){return cr(t,1,e)}),Ta=Gr(function(t,e,n){return cr(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 Ba(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 Fa=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)})}),Ma=Gr(function(t,e){var n=an(e,io(Ma));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)}),Na=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=ge?Ye(ge):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=Fe||yc,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==v||"[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=ve?Ye(ve):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 cs=Se?Ye(Se):function(t){return ts(t)&&Za(t.length)&&!!re[Ir(t)]},us=qi(Fr),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))===u||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 gs(t){return Ai(t,xs(t))}function ms(t){return null==t?"":ai(t)}var vs=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),c=-1,u=s.length;++c<u;){var l=s[c],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=Ni(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Mt.call(e)),t[e]=n},Qs(nc)),ks=Ni(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Mt.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):Br(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)}),Bs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=gi(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--;)ci(n,e[i]);return n}),Fs=Qi(function(t,e){return null==t?{}:function(t,e){return Vr(t,e,function(e,n){return Os(t,n)})}(t,e)});function Ms(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),Ns=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=Mo(e),rr(t,e,ka(t[e],t))}),t});function Qs(t){return function(){return t}}var tc=Mi(),ec=Mi(!0);function nc(t){return t}function rc(t){return zr("function"==typeof t?t:ar(t,1))}var ic=Gr(function(t,e){return function(n){return kr(n,t,e)}}),oc=Gr(function(t,e){return function(n){return kr(t,n,e)}});function ac(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 sc(){}var cc=Ri(je),uc=Ri(Oe),lc=Ri(Be);function dc(t){return vo(t)?Ve(Mo(t)):function(t){return function(e){return Sr(e,t)}}(t)}var pc=Vi(),hc=Vi(!0);function fc(){return[]}function yc(){return!1}var gc,mc=Ui(function(t,e){return t+e},0),vc=Hi("ceil"),bc=Ui(function(t,e){return t/e},1),wc=Hi("floor"),Sc=Ui(function(t,e){return t*e},1),_c=Hi("round"),Ic=Ui(function(t,e){return t-e},0);return Nn.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)}},Nn.ary=Oa,Nn.assign=vs,Nn.assignIn=bs,Nn.assignInWith=ws,Nn.assignWith=Ss,Nn.at=_s,Nn.before=Aa,Nn.bind=ka,Nn.bindAll=Zs,Nn.bindKey=Ea,Nn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Nn.chain=da,Nn.chunk=function(t,e,n){e=(n?mo(t,e,n):e===r)?1:gn(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},Nn.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},Nn.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))},Nn.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)}})},Nn.conforms=function(t){return function(t){var e=js(t);return function(n){return sr(n,t,e)}}(ar(t,1))},Nn.constant=Qs,Nn.countBy=fa,Nn.create=function(t,e){var n=Un(t);return null==e?n:nr(n,e)},Nn.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},Nn.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},Nn.debounce=ja,Nn.defaults=Is,Nn.defaultsDeep=Ps,Nn.defer=xa,Nn.delay=Ta,Nn.difference=Uo,Nn.differenceBy=Ro,Nn.differenceWith=Lo,Nn.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):[]},Nn.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):[]},Nn.dropRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0,!0):[]},Nn.dropWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0):[]},Nn.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)):[]},Nn.filter=function(t,e){return(qa(t)?Ae:fr)(t,oo(e,3))},Nn.flatMap=function(t,e){return yr(_a(t,e),1)},Nn.flatMapDeep=function(t,e){return yr(_a(t,e),u)},Nn.flatMapDepth=function(t,e,n){return n=n===r?1:hs(n),yr(_a(t,e),n)},Nn.flatten=$o,Nn.flattenDeep=function(t){return null!=t&&t.length?yr(t,u):[]},Nn.flattenDepth=function(t,e){return null!=t&&t.length?yr(t,e=e===r?1:hs(e)):[]},Nn.flip=function(t){return Yi(t,512)},Nn.flow=tc,Nn.flowRight=ec,Nn.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},Nn.functions=function(t){return null==t?[]:wr(t,js(t))},Nn.functionsIn=function(t){return null==t?[]:wr(t,xs(t))},Nn.groupBy=ba,Nn.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Nn.intersection=Wo,Nn.intersectionBy=Go,Nn.intersectionWith=Yo,Nn.invert=As,Nn.invertBy=ks,Nn.invokeMap=wa,Nn.iteratee=rc,Nn.keyBy=Sa,Nn.keys=js,Nn.keysIn=xs,Nn.map=_a,Nn.mapKeys=function(t,e){var n={};return e=oo(e,3),vr(t,function(t,r,i){rr(n,e(t,r,i),t)}),n},Nn.mapValues=function(t,e){var n={};return e=oo(e,3),vr(t,function(t,r,i){rr(n,r,e(t,r,i))}),n},Nn.matches=function(t){return Dr(ar(t,1))},Nn.matchesProperty=function(t,e){return Nr(t,ar(e,1))},Nn.memoize=za,Nn.merge=Ts,Nn.mergeWith=zs,Nn.method=ic,Nn.methodOf=oc,Nn.mixin=ac,Nn.negate=Ba,Nn.nthArg=function(t){return t=hs(t),Gr(function(e){return Rr(e,t)})},Nn.omit=Bs,Nn.omitBy=function(t,e){return Ms(t,Ba(oo(e)))},Nn.once=function(t){return Aa(2,t)},Nn.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))},Nn.over=cc,Nn.overArgs=Fa,Nn.overEvery=uc,Nn.overSome=lc,Nn.partial=Ma,Nn.partialRight=Da,Nn.partition=Ia,Nn.pick=Fs,Nn.pickBy=Ms,Nn.property=dc,Nn.propertyOf=function(t){return function(e){return null==t?r:Sr(t,e)}},Nn.pull=Jo,Nn.pullAll=Xo,Nn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,oo(n,2)):t},Nn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,r,n):t},Nn.pullAt=Zo,Nn.range=pc,Nn.rangeRight=hc,Nn.rearg=Na,Nn.reject=function(t,e){return(qa(t)?Ae:fr)(t,Ba(oo(e,3)))},Nn.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},Nn.rest=function(t,e){if("function"!=typeof t)throw new At(i);return Gr(t,e=e===r?e:hs(e))},Nn.reverse=Qo,Nn.sampleSize=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),(qa(t)?Jn:Kr)(t,e)},Nn.set=function(t,e,n){return null==t?t:Jr(t,e,n)},Nn.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:Jr(t,e,n,i)},Nn.shuffle=function(t){return(qa(t)?Xn:Qr)(t)},Nn.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)):[]},Nn.sortBy=Pa,Nn.sortedUniq=function(t){return t&&t.length?ii(t):[]},Nn.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Nn.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)?vi(ln(t),0,n):t.split(e,n):[]},Nn.spread=function(t,e){if("function"!=typeof t)throw new At(i);return e=null==e?0:gn(hs(e),0),Gr(function(n){var r=n[e],i=vi(n,0,e);return r&&xe(i,r),_e(t,this,i)})},Nn.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Nn.take=function(t,e,n){return t&&t.length?ti(t,0,(e=n||e===r?1:hs(e))<0?0:e):[]},Nn.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):[]},Nn.takeRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!1,!0):[]},Nn.takeWhile=function(t,e){return t&&t.length?li(t,oo(e,3)):[]},Nn.tap=function(t,e){return e(t),t},Nn.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})},Nn.thru=pa,Nn.toArray=ds,Nn.toPairs=Ds,Nn.toPairsIn=Ns,Nn.toPath=function(t){return qa(t)?je(t,Mo):ss(t)?[t]:Oi(Fo(ms(t)))},Nn.toPlainObject=gs,Nn.transform=function(t,e,n){var r=qa(t),i=r||Ga(t)||cs(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:vr)(t,function(t,r,i){return e(n,t,r,i)}),n},Nn.unary=function(t){return Oa(t,1)},Nn.union=ta,Nn.unionBy=ea,Nn.unionWith=na,Nn.uniq=function(t){return t&&t.length?si(t):[]},Nn.uniqBy=function(t,e){return t&&t.length?si(t,oo(e,2)):[]},Nn.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?si(t,r,e):[]},Nn.unset=function(t,e){return null==t||ci(t,e)},Nn.unzip=ra,Nn.unzipWith=ia,Nn.update=function(t,e,n){return null==t?t:ui(t,e,yi(n))},Nn.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ui(t,e,yi(n),i)},Nn.values=Us,Nn.valuesIn=function(t){return null==t?[]:Ke(t,xs(t))},Nn.without=oa,Nn.words=Js,Nn.wrap=function(t,e){return Ma(yi(e),t)},Nn.xor=aa,Nn.xorBy=sa,Nn.xorWith=ca,Nn.zip=ua,Nn.zipObject=function(t,e){return hi(t||[],e||[],Qn)},Nn.zipObjectDeep=function(t,e){return hi(t||[],e||[],Jr)},Nn.zipWith=la,Nn.entries=Ds,Nn.entriesIn=Ns,Nn.extend=bs,Nn.extendWith=ws,ac(Nn,Nn),Nn.add=mc,Nn.attempt=Xs,Nn.camelCase=Rs,Nn.capitalize=Ls,Nn.ceil=vc,Nn.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)},Nn.clone=function(t){return ar(t,4)},Nn.cloneDeep=function(t){return ar(t,5)},Nn.cloneDeepWith=function(t,e){return ar(t,5,e="function"==typeof e?e:r)},Nn.cloneWith=function(t,e){return ar(t,4,e="function"==typeof e?e:r)},Nn.conformsTo=function(t,e){return null==e||sr(t,e,js(e))},Nn.deburr=Vs,Nn.defaultTo=function(t,e){return null==t||t!=t?e:t},Nn.divide=bc,Nn.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},Nn.eq=Ua,Nn.escape=function(t){return(t=ms(t))&&G.test(t)?t.replace(H,tn):t},Nn.escapeRegExp=function(t){return(t=ms(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Nn.every=function(t,e,n){var i=qa(t)?Oe:pr;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Nn.find=ya,Nn.findIndex=Vo,Nn.findKey=function(t,e){return Me(t,oo(e,3),vr)},Nn.findLast=ga,Nn.findLastIndex=qo,Nn.findLastKey=function(t,e){return Me(t,oo(e,3),br)},Nn.floor=wc,Nn.forEach=ma,Nn.forEachRight=va,Nn.forIn=function(t,e){return null==t?t:gr(t,oo(e,3),xs)},Nn.forInRight=function(t,e){return null==t?t:mr(t,oo(e,3),xs)},Nn.forOwn=function(t,e){return t&&vr(t,oo(e,3))},Nn.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Nn.get=Cs,Nn.gt=Ra,Nn.gte=La,Nn.has=function(t,e){return null!=t&&ho(t,e,Cr)},Nn.hasIn=Os,Nn.head=Ho,Nn.identity=nc,Nn.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=gn(i+n,0)),as(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ne(t,e,n)>-1},Nn.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=gn(r+i,0)),Ne(t,e,i)},Nn.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<gn(e,n)}(t=ys(t),e,n)},Nn.invoke=Es,Nn.isArguments=Va,Nn.isArray=qa,Nn.isArrayBuffer=$a,Nn.isArrayLike=Ha,Nn.isArrayLikeObject=Wa,Nn.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Ir(t)==g},Nn.isBuffer=Ga,Nn.isDate=Ya,Nn.isElement=function(t){return ts(t)&&1===t.nodeType&&!rs(t)},Nn.isEmpty=function(t){if(null==t)return!0;if(Ha(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||cs(t)||Va(t)))return!t.length;var e=po(t);if(e==S||e==O)return!t.size;if(So(t))return!Br(t).length;for(var n in t)if(zt.call(t,n))return!1;return!0},Nn.isEqual=function(t,e){return jr(t,e)},Nn.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},Nn.isError=Ka,Nn.isFinite=function(t){return"number"==typeof t&&qe(t)},Nn.isFunction=Ja,Nn.isInteger=Xa,Nn.isLength=Za,Nn.isMap=es,Nn.isMatch=function(t,e){return t===e||xr(t,e,so(e))},Nn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,xr(t,e,so(e),n)},Nn.isNaN=function(t){return ns(t)&&t!=+t},Nn.isNative=function(t){if(wo(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(t)},Nn.isNil=function(t){return null==t},Nn.isNull=function(t){return null===t},Nn.isNumber=ns,Nn.isObject=Qa,Nn.isObjectLike=ts,Nn.isPlainObject=rs,Nn.isRegExp=is,Nn.isSafeInteger=function(t){return Xa(t)&&t>=-9007199254740991&&t<=l},Nn.isSet=os,Nn.isString=as,Nn.isSymbol=ss,Nn.isTypedArray=cs,Nn.isUndefined=function(t){return t===r},Nn.isWeakMap=function(t){return ts(t)&&po(t)==E},Nn.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Ir(t)},Nn.join=function(t,e){return null==t?"":fn.call(t,e)},Nn.kebabCase=qs,Nn.last=Ko,Nn.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?gn(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)},Nn.lowerCase=$s,Nn.lowerFirst=Hs,Nn.lt=us,Nn.lte=ls,Nn.max=function(t){return t&&t.length?hr(t,nc,Pr):r},Nn.maxBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Pr):r},Nn.mean=function(t){return Le(t,nc)},Nn.meanBy=function(t,e){return Le(t,oo(e,2))},Nn.min=function(t){return t&&t.length?hr(t,nc,Fr):r},Nn.minBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Fr):r},Nn.stubArray=fc,Nn.stubFalse=yc,Nn.stubObject=function(){return{}},Nn.stubString=function(){return""},Nn.stubTrue=function(){return!0},Nn.multiply=Sc,Nn.nth=function(t,e){return t&&t.length?Rr(t,hs(e)):r},Nn.noConflict=function(){return le._===this&&(le._=Nt),this},Nn.noop=sc,Nn.now=Ca,Nn.pad=function(t,e,n){t=ms(t);var r=(e=hs(e))?un(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(pe(i),n)},Nn.padEnd=function(t,e,n){t=ms(t);var r=(e=hs(e))?un(t):0;return e&&r<e?t+Li(e-r,n):t},Nn.padStart=function(t,e,n){t=ms(t);var r=(e=hs(e))?un(t):0;return e&&r<e?Li(e-r,n)+t:t},Nn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(ms(t).replace(nt,""),e||0)},Nn.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)},Nn.reduce=function(t,e,n){var r=qa(t)?Te:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,lr)},Nn.reduceRight=function(t,e,n){var r=qa(t)?ze:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,dr)},Nn.repeat=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),Wr(ms(t),e)},Nn.replace=function(){var t=arguments,e=ms(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Nn.result=function(t,e,n){var i=-1,o=(e=gi(e,t)).length;for(o||(o=1,t=r);++i<o;){var a=null==t?r:t[Mo(e[i])];a===r&&(i=o,a=n),t=Ja(a)?a.call(t):a}return t},Nn.round=_c,Nn.runInContext=t,Nn.sample=function(t){return(qa(t)?Kn:Yr)(t)},Nn.size=function(t){if(null==t)return 0;if(Ha(t))return as(t)?un(t):t.length;var e=po(t);return e==S||e==O?t.size:Br(t).length},Nn.snakeCase=Ws,Nn.some=function(t,e,n){var i=qa(t)?Be:ei;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Nn.sortedIndex=function(t,e){return ni(t,e)},Nn.sortedIndexBy=function(t,e,n){return ri(t,e,oo(n,2))},Nn.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},Nn.sortedLastIndex=function(t,e){return ni(t,e,!0)},Nn.sortedLastIndexBy=function(t,e,n){return ri(t,e,oo(n,2),!0)},Nn.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},Nn.startCase=Gs,Nn.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},Nn.subtract=Ic,Nn.sum=function(t){return t&&t.length?He(t,nc):0},Nn.sumBy=function(t,e){return t&&t.length?He(t,oo(e,2)):0},Nn.template=function(t,e,n){var i=Nn.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),c=js(s),u=Ke(s,c),l=0,d=e.interpolate||vt,p="__p += '",h=Ct((e.escape||vt).source+"|"+d.source+"|"+(d===J?lt:vt).source+"|"+(e.evaluate||vt).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,c){return r||(r=i),p+=t.slice(l,c).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=c+e.length,e}),p+="';\n";var y=zt.call(e,"variable")&&e.variable;if(y){if(ct.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 g=Xs(function(){return _t(c,f+"return "+p).apply(r,u)});if(g.source=p,Ka(g))throw g;return g},Nn.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},Nn.toFinite=ps,Nn.toInteger=hs,Nn.toLength=fs,Nn.toLower=function(t){return ms(t).toLowerCase()},Nn.toNumber=ys,Nn.toSafeInteger=function(t){return t?or(hs(t),-9007199254740991,l):0===t?t:0},Nn.toString=ms,Nn.toUpper=function(t){return ms(t).toUpperCase()},Nn.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 vi(i,Xe(i,o),Ze(i,o)+1).join("")},Nn.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 vi(i,0,Ze(i,ln(e))+1).join("")},Nn.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 vi(i,Xe(i,ln(e))).join("")},Nn.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 c=n-un(i);if(c<1)return i;var u=s?vi(s,0,c).join(""):t.slice(0,c);if(o===r)return u+i;if(s&&(c+=u.length-c),is(o)){if(t.slice(c).search(o)){var l,d=u;for(o.global||(o=Ct(o.source,ms(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var p=l.index;u=u.slice(0,p===r?c:p)}}else if(t.indexOf(ai(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+i},Nn.unescape=function(t){return(t=ms(t))&&W.test(t)?t.replace($,pn):t},Nn.uniqueId=function(t){var e=++Bt;return ms(t)+e},Nn.upperCase=Ys,Nn.upperFirst=Ks,Nn.each=ma,Nn.eachRight=va,Nn.first=Ho,ac(Nn,(gc={},vr(Nn,function(t,e){zt.call(Nn.prototype,e)||(gc[e]=t)}),gc),{chain:!1}),Nn.VERSION="4.17.21",Pe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Nn[t].placeholder=Nn}),Pe(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:gn(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(nc)},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(Ba(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)},vr(Vn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Nn[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(Nn.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,c=e instanceof Vn,u=s[0],l=c||qa(e),d=function(t){var e=o.apply(Nn,xe([t],s));return i&&p?e[0]:e};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=c&&!h;if(!a&&l){e=y?e:new Vn(this);var g=t.apply(e,s);return g.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(g,p)}return f&&y?t.apply(this,s):(g=this.thru(d),f?i?g.value()[0]:g.value():g)})}),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);Nn.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)})}}),vr(Vn.prototype,function(t,e){var n=Nn[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=gn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,p=0,h=mn(c,this.__takeCount__);if(!n||!r&&i==c&&h==c)return di(t,this.__actions__);var f=[];t:for(;c--&&p<h;){for(var y=-1,g=t[u+=e];++y<d;){var m=l[y],v=m.iteratee,b=m.type,w=v(g);if(2==b)g=w;else if(!w){if(1==b)continue t;break t}}f[p++]=g}return f},Nn.prototype.at=ha,Nn.prototype.chain=function(){return da(this)},Nn.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Nn.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__++]}},Nn.prototype.plant=function(t){for(var e,n=this;n instanceof Rn;){var i=No(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Nn.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)},Nn.prototype.toJSON=Nn.prototype.valueOf=Nn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Nn.prototype.first=Nn.prototype.head,Xt&&(Nn.prototype[Xt]=function(){return this}),Nn}();"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,{createPayPalCommerceAlternativeMethodsButtonStrategy:()=>Ie,createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>Ot,createPayPalCommerceButtonStrategy:()=>pe,createPayPalCommerceCreditButtonStrategy:()=>ye,createPayPalCommerceCreditCardsPaymentStrategy:()=>Vt,createPayPalCommerceCreditCustomerStrategy:()=>re,createPayPalCommerceCreditPaymentStrategy:()=>bt,createPayPalCommerceCustomerStrategy:()=>te,createPayPalCommerceFastlaneCustomerStrategy:()=>ue,createPayPalCommerceFastlanePaymentStrategy:()=>Xt,createPayPalCommercePaymentStrategy:()=>K,createPayPalCommerceRatePayPaymentStrategy:()=>Ht,createPayPalCommerceVenmoButtonStrategy:()=>ve,createPayPalCommerceVenmoCustomerStrategy:()=>ae,createPayPalCommerceVenmoPaymentStrategy:()=>_t});var t,e=n(315);function i(t,e){return Object.assign(t,{resolveIds:e})}class o 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 a extends o{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"}(t||(t={}));class s extends o{constructor(e){super(function(e){switch(e){case t.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case t.MissingCart:return"Unable to proceed because cart data is unavailable.";case t.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case t.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case t.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case t.MissingCheckoutConfig:case t.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case t.MissingOrder:return"Unable to proceed because order data is unavailable.";case t.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case t.MissingPayment:return"Unable to proceed because payment data is unavailable.";case t.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case t.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case t.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}var c=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class u{constructor(t){this.scriptLoader=t,this.window=window}getPayPalFastlaneSdk(t,e,n){return c(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 a}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return c(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 a;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return c(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 a}return this.window.paypalApms})}getPayPalMessages(t,e){return c(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 a;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return c(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})})}getPayPalFastlaneSdkConfiguration(e,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,attributionId:l}=o;return{options:{"client-id":c,"merchant-id":u,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:n,intent:a},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||r;return{options:Object.assign({"client-id":c,"merchant-id":u,commit:f,components:["googlepay"],currency:n,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:c,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=r,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:n,intent:i},l&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:c,buyerCountry:u}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},c&&{"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}}const l={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},d="embedded-checkout-loading-indicator-rotation";class p{constructor(t){this.styles=Object.assign(Object.assign({},l),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=`${d} 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(d))return;const e=document.createElement("style");e.id=d,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${d} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}var h=n(8686),f=n(4043),y=n(9440);class g extends o{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 m={body:{},headers:{},status:0};class v extends o{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||m;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 b,w,S,_,I,P,C,O;!function(t){t.BuyNow="BUY_NOW"}(b||(b={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(w||(w={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(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.OXXO="oxxo",t.IDEAL="ideal"}(C||(C={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(O||(O={}));var A=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class k{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(t,e,n,r){return A(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 a;return this.paypalSdk}createBuyNowCartOrThrow(e){return A(this,void 0,void 0,function*(){const n=e.getBuyNowCartRequestBody();if(!n)throw new s(t.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(t){throw new g}})}createOrder(t,e){return A(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 A(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 A(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 A(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(e,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new s(t.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:n},r.source===b.BuyNow&&{cart_id:r.id}))}submitPayment(t,e,n){return A(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&&I[e]?e:void 0,height:this.getValidHeight(n),label:r&&_[r]?r:void 0,shape:i&&P[i]?i:void 0};return(0,y.omitBy)(o,y.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 E="This API endpoint is for internal use only and may change in the future";var j;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(j||(j={}));const x=j,T={"X-Checkout-SDK-Version":"1.889.0"};var z=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class B{constructor(t){this.requestSender=t}createOrder(t,e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return z(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:e})).body})}getOrderStatus(t="paypalcommerce",e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}var F=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class M{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return F(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(t,e,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(t,e=!1){return F(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 a;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(e,n,r=!0){const{id:i,clientToken:o,initializationData:a}=e;if(!(null==a?void 0:a.clientId))throw new s(t.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=a,w=f||r,S="paypalcommercecreditcards"===i,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=r?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!v.includes(t))],k=[..._,...I,...P,...v];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:n,intent:c},g&&{"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 D=t=>{const{getHost:n}=t.getState();return new k((0,h.createFormPoster)(),t,new B((0,f.createRequestSender)({host:n()})),new M((0,e.vQ)()))},N={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class U extends o{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class R extends U{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 L 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 V extends o{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function q(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function $(t){return Boolean(t.instrumentId)}const H=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 W(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 G=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Y{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.loadingIndicator=r}initialize(t){var e;return G(this,void 0,void 0,function*(){const{methodId:n,paypalcommerce:r}=t||{};if(this.paypalcommerce=r,!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new U('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:c,paypalBNPLConfiguration:u=[],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==u?void 0:u.find(({id:t})=>"checkout"===t);if(l||!(null==t?void 0:t.status))return;const e=yield this.paypalCommerceSdk.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")}c?this.orderId=null===(e=o.initializationData)||void 0===e?void 0:e.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalCommerceIntegrationService.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 G(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 R(["payment"]);const{methodId:s,paymentData:c}=i;if(this.isPayPalVaultedInstrumentPaymentData(c)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new L;const u=this.isPayPalVaultedInstrumentPaymentData(c)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,c):this.preparePaymentPayload(s,this.orderId,c);try{yield this.paymentIntegrationService.submitOrder(o,e),yield this.paymentIntegrationService.submitPayment(u)}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.paypalCommerceIntegrationService.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 V)}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}=q(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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:c}=s.initializationData||{},{checkoutPaymentButtonStyles:u}=c||{},{container:l,onError:d,onRenderButton:p,onValidate:h,submitForm:f}=e;if(!l)throw new U('Unable to initialize payment because "container" argument is not provided.');const y=this.getSmartButtonContainerId(l);if(!document.getElementById(y))throw new U(`Unable to initialize payment because element with id ${y} does not exist.`);const g=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(u),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(g),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 G(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 G(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.paypalCommerceIntegrationService.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&&$(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>W(e)&&e.bigpayToken===t.instrumentId);return!(W(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&$(t)&&q(t)}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:H(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 K=i(t=>new Y(t,D(t),new u((0,e.vQ)()),new p({containerStyles:N})),[{id:"paypalcommerce"}]);var J,X,Z,Q,tt,et,nt,rt,it,ot,at=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class st{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return at(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 a}return this.window.paypal})}getPayPalFastlaneSdk(t,e,n){return at(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 a}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return at(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 a;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return at(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 a}return this.window.paypalApms})}getPayPalMessages(t,e){return at(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 a;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return at(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(e,n,r=!0){const{id:i,clientToken:o,initializationData:a}=e;if(!a||!a.clientId)throw new s(t.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=a,w=f||r,S="paypalcommercecreditcards"===i||"bigcommerce_payments_creditcards"===i,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=r?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!v.includes(t))],k=[..._,...I,...P,...v];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:n,intent:c},g&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}getPayPalFastlaneSdkConfiguration(e,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,attributionId:l}=o;return{options:{"client-id":c,"merchant-id":u,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:n,intent:a},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||r;return{options:Object.assign({"client-id":c,"merchant-id":u,commit:f,components:["googlepay"],currency:n,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:c,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=r,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:n,intent:i},l&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:c,buyerCountry:u}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},c&&{"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 ct(){return new st((0,e.Hb)())}!function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(J||(J={})),function(t){t.Always="SCA_ALWAYS"}(X||(X={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(Z||(Z={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(Q||(Q={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(tt||(tt={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(et||(et={})),function(t){t.pill="pill",t.rect="rect"}(nt||(nt={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(rt||(rt={})),function(t){t.OXXO="oxxo"}(it||(it={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(ot||(ot={}));var ut=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class lt{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalRequestSender=n,this.paypalSdkLoader=r}loadPayPalSdk(t,e,n,r){return ut(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 a;return this.paypalSdk}createBuyNowCartOrThrow(e){return ut(this,void 0,void 0,function*(){const n=e.getBuyNowCartRequestBody();if(!n)throw new s(t.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(t){throw new g}})}createOrder(t,e){return ut(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 ut(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 ut(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 ut(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(e,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new s(t.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:n},r.source===b.BuyNow&&{cart_id:r.id}))}submitPayment(t,e,n){return ut(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&&et[e]?e:void 0,height:this.getValidHeight(n),label:r&&tt[r]?r:void 0,shape:i&&nt[i]?i:void 0};return(0,y.omitBy)(o,y.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{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((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":E,"Content-Type":x.Json},T);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t,e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.put(n,{headers:i,body:r})).body})}getOrderStatus(t,e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}const ht=t=>{const{getHost:e}=t.getState();return new lt((0,h.createFormPoster)(),t,new pt((0,f.createRequestSender)({host:e()})),ct())},ft={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class yt extends o{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}const gt=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};var mt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class vt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.loadingIndicator=n,this.payPalSdkScriptLoader=r}initialize(t){return mt(this,void 0,void 0,function*(){const{methodId:e,paypalcommerce:n,paypalcommercecredit:r}=t||{},i=r||n;if(!e)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new U('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:c}=a.initializationData||{},{bannerContainerId:u,container:l}=i;if(void 0!==u){if(!document.getElementById(u))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,u,t)}c?this.orderId=c:(yield this.paypalIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==l?void 0:l.split("#")[1],this.renderButton(e,i))})}execute(t,e){return mt(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 R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}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 U('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:c,onValidate:u,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,u),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 yt(`PayPal ${t} is not available for your region. Please use PayPal Checkout instead.`);c&&"function"==typeof c&&c(),this.paypalButton.render(a),p=!0}})}handleClick(t,e){return mt(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:gt(n)};t.Messages(r).render(`#${e}`)}}const bt=i(t=>new vt(t,ht(t),new p({containerStyles:ft}),ct()),[{id:"paypalcommercecredit"}]);var wt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class St{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return wt(this,void 0,void 0,function*(){const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=t||{},a=o||i;if(!r)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new U('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 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 R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}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:c,onValidate:u,submitForm:l}=e,d={fundingSource:n.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(t,e)=>this.handleClick(e,u),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 yt("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");c&&"function"==typeof c&&c(),this.paypalButton.render(a)}handleClick(t,e){return wt(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 _t=i(t=>new St(t,D(t),new p({styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]);class It extends v{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var Pt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Ct{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=y.noop,this.isOrderApprovedProcessing=!1}initialize(t){return Pt(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 U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,e),{orderId:c,shouldRenderFields:u}=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),c?this.orderId=c:(this.paypalApms=yield this.paypalSdkScriptLoader.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,e,o),u&&this.renderFields(n,o))})}execute(t,e){return Pt(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 R(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new L;this.isOrderApprovedProcessing||"ideal"!==i||(yield new Promise((t,e)=>{this.initializePollingMechanism(i,t,e,o)})),this.isNonInstantPaymentMethod(i)&&(i!==C.IDEAL||this.isOrderApprovedProcessing)||(yield this.paymentIntegrationService.submitOrder(r,e)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new V)}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 Pt(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===O.Approved,a=i===O.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 It)}catch(t){n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}reinitializeStrategy(t){return Pt(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:c,submitForm:u}=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,u),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deinitializePollingMechanism()},onError:t=>{this.deinitializePollingMechanism(),this.handleFailure(t,s)},onClick:(t,e)=>Pt(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.paypalButton=r.Buttons(l),this.paypalButton.isEligible()&&(c&&"function"==typeof c&&c(),this.paypalButton.render(a))}onCreateOrder(t,e,n){var r;return Pt(this,void 0,void 0,function*(){const{onValidate:i}=n;yield i(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),y.noop);const o=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(t)&&(t===C.IDEAL&&this.isOrderApprovedProcessing||t===C.OXXO)){const n={useStoreCredit:!1},i={params:{methodId:t,gatewayId:e}};if(yield this.paymentIntegrationService.submitOrder(n,i),t===C.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:c}=e;if(!s)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const u=document.querySelector(s);u&&(u.innerHTML="");const l={fundingSource:t,style:c||{},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 C}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new a;return this.paypalApms}}const Ot=i(t=>new Ct(t,ht(t),ct(),new p({containerStyles:N})),[{gateway:"paypalcommercealternativemethods"}]);var At;!function(t){t.CVV="cvv",t.PAN="pan"}(At||(At={}));class kt{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){kt.set(t,"",Object.assign({expires:new Date(0)},e))}}var Et,jt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class xt{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return jt(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 a;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return jt(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return jt(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};kt.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){kt.remove("bc-fastlane-sessionId")}getStorageSessionId(){return kt.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,c=null==a?void 0:a.shippingAddress,u=null==a?void 0:a.name,l=null==a?void 0:a.card,d=c?this.mapPayPalToBcAddress(c.address,c.name,c.phoneNumber):void 0,p=s&&u?this.mapPayPalToBcAddress(s,u,null==c?void 0:c.phoneNumber):void 0,h=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,p]);return{authenticationState:o||rt.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,c]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:c,expiryYear:s,iin:"",last4:a,method:t,provider:t,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:At.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,y.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,y.omit)(t,["id","phone"])}}function Tt(){return new xt}!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(Et||(Et={}));const zt=Et;function Bt(t){return zt.CardNumber in t&&zt.CardName in t&&zt.CardExpiry in t}function Ft(t){return zt.CardNumberVerification in t&&zt.CardCodeVerification in t&&zt.CardExpiryVerification in t}class Mt extends o{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 Dt;!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"}(Dt||(Dt={}));class Nt extends o{constructor(t){super(function(t){switch(t){case Dt.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Dt.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Dt.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Dt.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 Ut extends o{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 Rt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Lt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){return Rt(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 U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new U('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=Bt(o.fields),this.isCreditCardVaultedForm=Ft(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 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"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new R(["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 V)}deinitialize(){var t,e,n,r;return Rt(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}=q(e)?e:{},a=e&&$(e)?e.instrumentId:void 0,s=(0,y.omitBy)({verification_nonce:r,token:a},y.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 Rt(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===w.No||n===w.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new Mt},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 Nt(Dt.PaymentNotInitialized);try{this.stylizeInputContainers(n),Bt(n)&&(yield this.renderFields(n)),Ft(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return Ft(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Rt(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:()=>Rt(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 Rt(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 Rt(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(q(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if($(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Rt(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 Mt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Rt(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 Ut(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 zt.CardCode:case zt.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case zt.CardNumber:case zt.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case zt.CardExpiry:case zt.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 zt.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?zt.CardNumber:zt.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?zt.CardExpiry:zt.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?zt.CardCode:zt.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new Nt(Dt.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 Rt(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 Vt=i(t=>new Lt(t,ht(t),ct(),Tt()),[{id:"paypalcommercecreditcards"}]);var qt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class $t{constructor(t,e,n,r=3e3,i=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=y.noop}initialize(t){return qt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerceratepay:r}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new U('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new U('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new U('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new U('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,e),{merchantId:c}=s.initializationData||{};if(!c)throw new U("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(c,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return qt(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 R(["payment"]);if(!i||"function"!=typeof i)throw new U('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),c={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:c}),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 V)}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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),c=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new U('Unable to initialize payment because "legalTextContainerElement" argument is not found.');c.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 qt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return qt(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("paypalcommercealternativemethods",{params:{useMetadata:!0}}),o=i===O.PollingStop,a=i===O.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 It)}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 Ht=i(t=>new $t(t,D(t),new p({containerStyles:Object.assign(Object.assign({},N),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);function Wt(t){return"string"!=typeof t}function Gt(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,y.omitBy)(t.root,Wt),o=(0,y.omitBy)(t.input,Wt),a=(0,y.omitBy)(t.toggle,Wt),s=(0,y.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,Wt),c=(0,y.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,Wt),u=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(c).length&&(r.text=Object.assign({},r.text),r.text.caption=c),u&&(r.branding=u),r}(function(t,e){var n,r,i,o,a,s,c,u,l,d,p,h,f,y,g,m,v,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===(c=null==e?void 0:e.input)||void 0===c?void 0:c.borderRadius),borderColor:(null==t?void 0:t.fastlaneInputSettingsBorderColor)||(null===(u=null==e?void 0:e.input)||void 0===u?void 0:u.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===(g=null==e?void 0:e.text)||void 0===g?void 0:g.body)||void 0===m?void 0:m.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(v=null==e?void 0:e.text)||void 0===v?void 0:v.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 Yt(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}var Kt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Jt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceRequestSender=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){var e,n;return Kt(this,void 0,void 0,function*(){const{methodId:r,paypalcommercefastlane:i}=t;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new U('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new U('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 U('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:c,isFastlaneStylingEnabled:u}=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=Gt(u?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,!!c,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 Kt(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 R(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&$(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 V)}deinitialize(){return Kt(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=Yt(r)?r:{},o=this.paypalFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===rt.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return Kt(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:c,addresses:u,instruments:l}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:c,addresses:u,instruments:l}),s.authenticationState===rt.CANCELED?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return Kt(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 U('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new a;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return Kt(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 Kt(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)}),c=i.config.is3dsEnabled?yield this.get3DSNonce(s):s;yield this.createOrder(c);const{shouldSaveInstrument:u=!1,shouldSetAsDefaultInstrument:l=!1}=q(e)?e:{};return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:u,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:c}}})}})}createOrder(t){return Kt(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 Kt(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,s=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!s)throw new a;const c={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:t,threeDSRequested:this.threeDSVerificationMethod===X.Always,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}},u=yield s.isEligible(c);if(this.threeDSVerificationMethod===X.Always&&!u)throw new L;if(u){const{liabilityShift:t,authenticationState:e,nonce:n}=yield s.show();if(t===w.No||t===w.Unknown||e===Z.Errored||e===Z.Cancelled)throw new L;if(e===Z.Succeeded&&[w.Yes,w.Possible].includes(t))return n}return t})}handlePayPalStoredInstrumentChange(t){return Kt(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=Yt(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 Xt=i(t=>{const{getHost:e}=t.getState();return new Jt(t,new B((0,f.createRequestSender)({host:e()})),ct(),Tt())},[{id:"paypalcommerceacceleratedcheckout"}]);var Zt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Qt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return Zt(this,void 0,void 0,function*(){const{paypalcommerce:e,methodId:n}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!e.container)throw new U('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new U('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.onError=e.onError||y.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 Zt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(t,e),Promise.resolve()})}signOut(t){return Zt(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}=e,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:u,paymentButtonStyles:l,isAppSwitchEnabled:d}=c.initializationData||{},{checkoutTopButtonStyles:p}=l||{},h=Object.assign(Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommerce"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)}),o&&{onClick:()=>o()}),f=Object.assign(Object.assign({},!d&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,a)}),y=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},p),{height:40}))},h),u&&f),g=s.Buttons(y);g.isEligible()?(null===(n=g.hasReturned)||void 0===n?void 0:n.call(g))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(r=g.resume)||void 0===r||r.call(g):g.render(`#${i}`):this.paypalCommerceIntegrationService.removeElement(i)}onHostedCheckoutApprove(e,n,r,i){return Zt(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Zt(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 Zt(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)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const te=i(t=>new Qt(t,D(t)),[{id:"paypalcommerce"}]);var ee=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class ne{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return ee(this,void 0,void 0,function*(){const{paypalcommercecredit:e,methodId:n}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!e.container)throw new U('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new U('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=e.onError||y.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 ee(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return ee(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:c,isAppSwitchEnabled:u}=a.initializationData||{},{checkoutTopButtonStyles:l}=c||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!u&&{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(e,n,r,i){return ee(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return ee(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 ee(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 re=i(t=>new ne(t,D(t)),[{id:"paypalcommercecredit"}]);var ie=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class oe{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return ie(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,methodId:n}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!e.container)throw new U('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new U('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 ie(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return ie(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||{},c=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()}),u=i.Buttons(c);u.isEligible()?u.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const ae=i(t=>new oe(t,D(t)),[{id:"paypalcommercevenmo"}]);var se=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class ce{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalSdkScriptLoader=e,this.paypalFastlaneUtils=n}initialize(t){var e;return se(this,void 0,void 0,function*(){const{methodId:n,paypalcommercefastlane:r}=t;if(!n)throw new U('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 se(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(t,e){return se(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return se(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){return se(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new U('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new U('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 se(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),c=s.authenticationState===rt.CANCELED;yield this.updateCustomerDataState(t,s),c?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return se(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:c}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,e);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:c}),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)||[],c=a[0],u=a.find(t=>t.isRecommended);if((u||c)&&i){const t=(null==u?void 0:u.id)||c.id;yield this.paymentIntegrationService.selectShippingOption(t)}}})}getFastlaneStyles(t,e){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return Gt(i?r:{},null==e?void 0:e.styles)}}const ue=i(t=>new ce(t,ct(),Tt()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);var le=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class de{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}initialize(t){var e;return le(this,void 0,void 0,function*(){const{paypalcommerce:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new U('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 U('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)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){var r,i;const{buyNowInitializeOptions:o,style:a,onComplete:s,onEligibilityFailure:c}=n,u=this.paypalIntegrationService.getPayPalSdkOrThrow(),l=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:d,isAppSwitchEnabled:p}=l.initializationData||{},h=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(e)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>le(this,void 0,void 0,function*(){if(o){const t=yield this.paypalIntegrationService.createBuyNowCartOrThrow(o);yield this.paymentIntegrationService.loadCheckout(t.id)}return this.paypalIntegrationService.createOrder("paypalcommerce")}),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)}),f={onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},y=Object.assign(Object.assign({},!p&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,s)}),g=Object.assign(Object.assign(Object.assign({fundingSource:u.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(a)},h),o&&f),d&&y),m=u.Buttons(g);m.isEligible()?(null===(r=m.hasReturned)||void 0===r?void 0:r.call(m))&&this.isPaypalCommerceAppSwitchEnabled(e)?null===(i=m.resume)||void 0===i||i.call(m):m.render(`#${t}`):c&&"function"==typeof c?c():this.paypalIntegrationService.removeElement(t)}onHostedCheckoutApprove(e,n,r,i){return le(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return le(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 le(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}})}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const pe=i(t=>new de(t,ht(t)),[{id:"paypalcommerce"}]);var he=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class fe{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalCommerceSdk=n}initialize(t){var e;return he(this,void 0,void 0,function*(){const{paypalcommercecredit:n,containerId:r,methodId:i}=t,{buyNowInitializeOptions:o,currencyCode:a,messagingContainerId:s}=n||{},c=!!o;if(!i)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(c&&!a)throw new U('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(c&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new U('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');c||(yield this.paymentIntegrationService.loadDefaultCheckout());const u=this.paymentIntegrationService.getState(),l=c?a:u.getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(i,l,!1),this.renderButton(r,i,n);const d=u.getStoreConfigOrThrow().checkoutSettings.features;if(null!==(e=d["PAYPAL-5557.Hide_ppc_banner_implementation"])&&void 0!==e&&e)return;const p=s&&document.getElementById(s);if(l&&p){const t=u.getPaymentMethodOrThrow(i),{paypalBNPLConfiguration:e=[]}=t.initializationData||{},n=e&&e.find(({id:t})=>"cart"===t);if(!(null==n?void 0:n.status))return;p.removeAttribute("data-pp-style-logo-type"),p.removeAttribute("data-pp-style-logo-position"),p.removeAttribute("data-pp-style-text-color"),p.removeAttribute("data-pp-style-text-size");const r=yield this.paypalCommerceSdk.getPayPalMessages(t,l);this.renderMessages(r,s,n)}})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:u,isAppSwitchEnabled:l}=c.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),u&&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 he(this,void 0,void 0,function*(){if(t){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(e,n,r,i){return he(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return he(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 he(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}})}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"cart",style:gt(n)};t.Messages(r).render(`#${e}`)}}const ye=i(t=>new fe(t,ht(t),ct()),[{id:"paypalcommercecredit"}]);var ge=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class me{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return ge(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 U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new U('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new U('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,c={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},u={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},c),r&&u),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===I.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return ge(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const ve=i(t=>new me(t,D(t)),[{id:"paypalcommercevenmo"}]);var be=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};const we=class{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}createPayPalButton(t,e,n,r=!1){const{style:i,fundingSource:o,onClick:a,onCancel:s,onPaymentComplete:c}=n,u=this.paypalIntegrationService.getPayPalSdkOrThrow();if(!Object.values(u.FUNDING).includes(o))throw new U('Unable to initialize PayPal button because "fundingSource" argument is not valid funding source.');const l={onShippingAddressChange:e=>this.onShippingAddressChange(e,t),onShippingOptionsChange:e=>this.onShippingOptionsChange(e,t),onApprove:(n,r)=>this.onHostedCheckoutApprove(n,r,e,t,c)};return u.Buttons(Object.assign(Object.assign(Object.assign({fundingSource:o,style:this.paypalIntegrationService.getValidButtonStyle(i),createOrder:()=>this.paypalIntegrationService.createOrder(t),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)},a?{onClick:a}:{}),s?{onCancel:s}:{}),r&&l))}onHostedCheckoutApprove(e,n,r,i,o){return be(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow(),c=yield n.order.get();try{const t=this.paypalIntegrationService.getBillingAddressFromOrderDetails(c);if(yield this.paymentIntegrationService.updateBillingAddress(t),a.lineItems.physicalItems.length>0){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(c);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalIntegrationService.updateOrder(i)}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalIntegrationService.submitPayment(r,e.orderID),o&&"function"==typeof o&&o(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t,e){return be(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){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t,e){return be(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){if("string"==typeof t)throw new Error(t);throw t}})}};var Se=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class _e{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalButtonCreationService=n}initialize(t){return Se(this,void 0,void 0,function*(){const{paypalcommercealternativemethods:e,containerId:n,methodId:r}=t,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=e||{},s=!!o;if(!r)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');if(!i)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods.apm" argument is not provided.');if(s&&!a)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');s||(yield this.paymentIntegrationService.loadDefaultCheckout());const c=s?a:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(r,c,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{apm:r,buyNowInitializeOptions:i,style:o,onEligibilityFailure:a}=n,s=Object.assign({fundingSource:r,style:o},i&&{onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()}),c=this.paypalButtonCreationService.createPayPalButton("paypalcommercealternativemethod",e,s);c.isEligible()?c.render(`#${t}`):a&&"function"==typeof a?a():this.paypalIntegrationService.removeElement(t)}handleClick(t){return Se(this,void 0,void 0,function*(){if(t){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const Ie=i(t=>{const e=ht(t),n=new we(t,e);return new _e(t,e,n)},[{id:"paypalcommercealternativemethods"}])})(),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]",c=/^\[object .+?Constructor\]$/,u=/^(?: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,g=f||y||Function("return this")(),m=e&&!e.nodeType&&e,v=m&&t&&!t.nodeType&&t,b=v&&v.exports===m,w=b&&f.process,S=function(){try{return v&&v.require&&v.require("util").types||w&&w.binding&&w.binding("util")}catch(t){}}(),_=S&&S.isTypedArray,I=Array.prototype,P=Function.prototype,C=Object.prototype,O=g["__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?g.Buffer:void 0,B=g.Symbol,F=g.Uint8Array,M=(z&&z.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(t){return p(h(t))}),D=Object.create,N=C.propertyIsEnumerable,U=I.splice,R=B?B.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(g,"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 c=lt(t,n),u=lt(e,n),l=a.get(u);if(l)Z(t,n,l);else{var d,p,h,f,y,g=o?o(c,u,n+"",t,e,a):void 0,m=void 0===g;if(m){var v=ft(u),b=!v&>(u),w=!v&&!b&&St(u);g=u,v||b||w?ft(c)?g=c:wt(y=c)&&yt(y)?g=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(c):b?(m=!1,g=function(t){return t.slice()}(u)):w?(m=!1,f=new(h=(d=u).buffer).constructor(h.byteLength),new F(f).set(new F(h)),p=f,g=new d.constructor(p,d.byteOffset,d.length)):g=[]:function(t){if(!wt(t)||nt(t)!=s)return!1;var e=M(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}(u)||ht(u)?(g=c,ht(c)?g=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))}(c):bt(c)&&!mt(c)||(g=function(t){return"function"!=typeof t.constructor||ut(t)?{}:G(M(t))}(u))):m=!1}m&&(a.set(u,g),i(g,u,r,o,a),a.delete(u)),Z(t,n,g)}}(t,e,a,n,it,r,i);else{var c=r?r(lt(t,a),o,a+"",t,e,i):void 0;void 0===c&&(c=o),Z(t,a,c)}},_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:c).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 ct(t,e){var n=typeof t;return!!(e=null==e?i:e)&&("number"==n||"symbol"!=n&&u.test(t))&&t>-1&&t%1==0&&t<e}function ut(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")&&!N.call(t,"callee")},ft=Array.isArray;function yt(t){return null!=t&&vt(t.length)&&!mt(t)}var gt=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 vt(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)&&vt(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&>(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):[],c=s.length;for(var u in t)!e&&!k.call(t,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ct(u,c))||s.push(u);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=ut(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)&&ct(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 c in o)o[c]&&(s+="; "+c,!0!==o[c]&&(s+="="+o[c].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("="),c=s.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=e(s[0]);if(c=(r.read||r)(c,u)||e(c),n)try{c=JSON.parse(c)}catch(t){}if(i[u]=c,t===u)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 c=a[s];t=t.replace(new RegExp(c,"g"),e[c])}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),c=1;c<arguments.length;c++){for(var u in o=Object(arguments[c]))n.call(o,u)&&(s[u]=o[u]);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:()=>u});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),c=n(2024);const u=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 c.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,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;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=c,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,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;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,c&&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 c=document.createElement("link");c.as="style",c.rel=a?"prefetch":"preload",c.href=t,c.onload=function(){r()},c.onerror=function(e){delete n._preloadedStylesheets[t],i(e)},document.head.appendChild(c)}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,c=128,u=1/0,l=9007199254740991,d=NaN,p=4294967295,h=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",g="[object Boolean]",m="[object Date]",v="[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]",B="[object Int8Array]",F="[object Int16Array]",M="[object Int32Array]",D="[object Uint8Array]",N="[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,ct=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,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+"]",Bt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+wt+"]",Mt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Nt="["+Pt+"]",Ut="\\u200d",Rt="(?:"+Tt+"|"+zt+")",Lt="(?:"+Nt+"|"+zt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+Et+"|"+Bt+")?",Ht="["+Ct+"]?",Wt=Ht+$t+"(?:"+Ut+"(?:"+[Ft,Mt,Dt].join("|")+")"+Ht+$t+")*",Gt="(?:"+[xt,Mt,Dt].join("|")+")"+Wt,Yt="(?:"+[Ft+Et+"?",Et,Mt,Dt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Xt=RegExp(Bt+"(?="+Bt+")|"+Yt+Wt,"g"),Zt=RegExp([Nt+"?"+Tt+"+"+Vt+"(?="+[kt,Nt,"$"].join("|")+")",Lt+"+"+qt+"(?="+[kt,Nt+Rt,"$"].join("|")+")",Nt+"?"+Rt+"+"+Vt,Nt+"+"+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[B]=re[F]=re[M]=re[D]=re[N]=re[U]=re[R]=!0,re[f]=re[y]=re[j]=re[g]=re[x]=re[m]=re[v]=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[g]=ie[m]=ie[T]=ie[z]=ie[B]=ie[F]=ie[M]=ie[S]=ie[_]=ie[I]=ie[C]=ie[O]=ie[A]=ie[k]=ie[D]=ie[N]=ie[U]=ie[R]=!0,ie[v]=ie[b]=ie[E]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,se=parseInt,ce="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ue="object"==typeof self&&self&&self.Object===Object&&self,le=ce||ue||Function("return this")(),de=e&&!e.nodeType&&e,pe=de&&t&&!t.nodeType&&t,he=pe&&pe.exports===de,fe=he&&ce.process,ye=function(){try{return pe&&pe.require&&pe.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),ge=ye&&ye.isArrayBuffer,me=ye&&ye.isDate,ve=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)&&Ne(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 Be(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 Fe=Ve("length");function Me(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 Ne(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&&Ne(e,t[n],0)>-1;);return n}function Ze(t,e){for(var n=t.length;n--&&Ne(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({"&":"&","<":"<",">":">",'"':""","'":"'"});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 cn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function un(t){return nn(t)?function(t){for(var e=Xt.lastIndex=0;Xt.test(t);)++e;return e}(t):Fe(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({"&":"&","<":"<",">":">",""":'"',"'":"'"}),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,Bt=0,Ft=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Mt=jt.toString,Dt=Tt.call(Pt),Nt=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=co(Pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ce=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ue=wt&&wt.now!==le.Date.now&&wt.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,pe=It.ceil,fe=It.floor,ye=Pt.getOwnPropertySymbols,Fe=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,yn=on(Pt.keys,Pt),gn=It.max,mn=It.min,vn=wt.now,bn=e.parseInt,wn=It.random,Sn=kt.reverse,_n=co(e,"DataView"),In=co(e,"Map"),Pn=co(e,"Promise"),Cn=co(e,"Set"),On=co(e,"WeakMap"),An=co(Pt,"create"),kn=On&&new On,En={},jn=Do(_n),xn=Do(In),Tn=Do(Pn),zn=Do(Cn),Bn=Do(On),Fn=Lt?Lt.prototype:r,Mn=Fn?Fn.valueOf:r,Dn=Fn?Fn.toString:r;function Nn(t){if(ts(t)&&!qa(t)&&!(t instanceof Vn)){if(t instanceof Ln)return t;if(zt.call(t,"__wrapped__"))return No(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&&cs(t),a=n||r||i||o,s=a?We(t.length,Ot):[],c=s.length;for(var u in t)!e&&!zt.call(t,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||go(u,c))||s.push(u);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,c=1&e,u=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),!c)return Oi(t,s)}else{var p=po(t),h=p==b||p==w;if(Ga(t))return wi(t,c);if(p==I||p==f||h&&!o){if(s=u||h?{}:fo(t),!c)return u?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,uo(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 g: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 B:case F:case M:case D:case N: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,Mn?Pt(Mn.call(r)):{}}}(t,p,c)}}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 v=d?r:(l?u?eo:to:u?xs:js)(t);return Pe(v||t,function(r,i){v&&(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 cr(t,e,n){if("function"!=typeof t)throw new At(i);return ko(function(){t.apply(r,n)},e)}function ur(t,e,n,r){var i=-1,o=ke,a=!0,s=t.length,c=[],u=e.length;if(!s)return c;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=u;p--;)if(e[p]===d)continue t;c.push(l)}else o(e,d,r)||c.push(l)}return c}Nn.templateSettings={escape:Y,evaluate:K,interpolate:J,variable:"",imports:{_:Nn}},Nn.prototype=Rn.prototype,Nn.prototype.constructor=Nn,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(vr),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&&(c===r?s==s&&!ss(s):n(s,c)))var c=s,u=a}return u}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 gr=xi(),mr=xi(!0);function vr(t,e){return t&&gr(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=gi(e,t)).length;null!=t&&n<i;)t=t[Mo(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=Mt.call(t);return i&&(e?t[Qt]=n:delete t[Qt]),o}(t):function(t){return Mt.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,c=rt(a),u=1/0,l=[];s--;){var d=t[s];s&&e&&(d=je(d,Ye(e))),u=mn(d.length,u),c[s]=!n&&(e||o>=120&&d.length>=120)?new Wn(s&&d):r}d=t[0];var p=-1,h=c[0];t:for(;++p<o&&l.length<u;){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 g=c[s];if(!(g?Je(g,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=gi(e,t)))?t:t[Mo(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),c=qa(e),u=s?y:po(t),l=c?y:po(e),d=(u=u==f?I:u)==I,p=(l=l==f?I:l)==I,h=u==l;if(h&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Gn),s||cs(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 g:case m:case _:return Ua(+t,+e);case v:return t.name==e.name&&t.message==e.message;case C:case A:return t==e+"";case S:var s=rn;case O:var c=1&r;if(s||(s=sn),t.size!=e.size&&!c)return!1;var u=a.get(t);if(u)return u==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(Mn)return Mn.call(t)==Mn.call(e)}return!1}(t,e,u,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,c=to(t),u=c.length;if(u!=to(e).length&&!s)return!1;for(var l=u;l--;){var d=c[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<u;){var g=t[d=c[l]],m=e[d];if(i)var v=s?i(m,g,d,e,t,a):i(g,m,d,t,e,a);if(!(v===r?g===m||o(g,m,n,i,a):v)){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 c=n[o];if(s&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<a;){var u=(c=n[o])[0],l=t[u],d=c[1];if(s&&c[2]){if(l===r&&!(u in t))return!1}else{var p=new Gn;if(i)var h=i(l,d,u,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,Ft&&Ft in e))&&(Ja(t)?Ut:ft).test(Do(t));var e}function zr(t){return"function"==typeof t?t:null==t?nc:"object"==typeof t?qa(t)?Nr(t[0],t[1]):Dr(t):dc(t)}function Br(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 Fr(t,e){return t<e}function Mr(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 Nr(t,e){return vo(t)&&_o(e)?Io(Mo(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&&gr(e,function(a,s){if(o||(o=new Gn),Qa(a))!function(t,e,n,i,o,a,s){var c=Oo(t,n),u=Oo(e,n),l=s.get(u);if(l)Zn(t,n,l);else{var d=a?a(c,u,n+"",t,e,s):r,p=d===r;if(p){var h=qa(u),f=!h&&Ga(u),y=!h&&!f&&cs(u);d=u,h||f||y?qa(c)?d=c:Wa(c)?d=Oi(c):f?(p=!1,d=wi(u,!0)):y?(p=!1,d=_i(u,!0)):d=[]:rs(u)||Va(u)?(d=c,Va(c)?d=gs(c):Qa(c)&&!Ja(c)||(d=fo(u))):p=!1}p&&(s.set(u,d),o(d,u,i,a,s),s.delete(u)),Zn(t,n,d)}}(t,e,s,n,Ur,i,o);else{var c=i?i(Oo(t,s),a,s+"",t,e,o):r;c===r&&(c=a),Zn(t,s,c)}},xs)}function Rr(t,e){var n=t.length;if(n)return go(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}):[nc];var r=-1;e=je(e,Ye(oo()));var i=Mr(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 c=Ii(i[r],o[r]);if(c)return r>=s?c:c*("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,gi(a,t),s)}return o}function qr(t,e,n,r){var i=r?Ue:Ne,o=-1,a=e.length,s=t;for(t===e&&(e=Oi(e)),n&&(s=je(t,Ye(n)));++o<a;)for(var c=0,u=e[o],l=n?n(u):u;(c=i(s,l,c,r))>-1;)s!==t&&Gt.call(s,c,1),Gt.call(t,c,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;go(i)?Gt.call(t,i,1):ci(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,nc),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=gi(e,t)).length,s=a-1,c=t;null!=c&&++o<a;){var u=Mo(e[o]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(o!=s){var d=c[u];(l=i?i(d,u,c):r)===r&&(l=Qa(d)?d:go(e[o+1])?[]:{})}Qn(c,u,l),c=c[u]}return t}var Xr=kn?function(t,e){return kn.set(t,e),t}:nc,Zr=oe?function(t,e){return oe(t,"toString",{configurable:!0,enumerable:!1,value:Qs(e),writable:!0})}:nc;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,nc,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,c=null===e,u=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,g=ss(p);if(s)var m=i||y;else m=l?y&&(i||h):c?y&&h&&(i||!f):u?y&&h&&!f&&(i||!g):!f&&!g&&(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,c)){var c=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=[],c=s;if(n)a=!1,i=Ee;else if(o>=200){var u=e?null:Wi(t);if(u)return sn(u);a=!1,i=Je,c=new Wn}else c=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=c.length;p--;)if(c[p]===d)continue t;e&&c.push(d),s.push(l)}else i(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ci(t,e){return null==(t=Co(t,e=gi(e,t)))||delete t[Mo(Ko(e))]}function ui(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]=ur(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 c=i<a?e[i]:r;n(s,t[i],c)}return s}function fi(t){return Wa(t)?t:[]}function yi(t){return"function"==typeof t?t:nc}function gi(t,e){return qa(t)?t:vo(t,e)?[t]:Fo(ms(t))}var mi=Gr;function vi(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ti(t,e,n)}var bi=ce||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,c=null===e,u=e==e,l=ss(e);if(!c&&!l&&!a&&t>e||a&&s&&u&&!c&&!l||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!l&&t<e||l&&n&&o&&!i&&!a||c&&n&&o||!s&&o||!u)return-1}return 0}function Pi(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,c=e.length,u=gn(o-a,0),l=rt(c+u),d=!r;++s<c;)l[s]=e[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=t[i]);for(;u--;)l[s++]=t[i++];return l}function Ci(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,c=-1,u=e.length,l=gn(o-s,0),d=rt(l+u),p=!r;++i<l;)d[i]=t[i];for(var h=i;++c<u;)d[h+c]=e[c];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 c=e[a],u=i?i(n[c],t[c],c,n,t):r;u===r&&(u=t[c]),o?rr(n,c,u):Qn(n,c,u)}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 c=n[i];c&&t(e,c,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 c=a[t?s:++i];if(!1===n(o[c],c,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?vi(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 Bi(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 Fi(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 Mi(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&&!c&&"wrapper"==ro(s))var c=new Ln([],!0)}for(o=c?o:n;++o<n;){var u=ro(s=e[o]),l="wrapper"==u?no(s):r;c=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ro(l[0])].apply(c,l[3]):1==s.length&&bo(s)?c[u]():c.thru(s)}return function(){var t=arguments,r=t[0];if(c&&1==t.length&&qa(r))return c.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,u,l,d){var p=e&c,h=1&e,f=2&e,y=24&e,g=512&e,m=f?r:Bi(t);return function c(){for(var v=arguments.length,b=rt(v),w=v;w--;)b[w]=arguments[w];if(y)var S=io(c),_=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)),v-=_,y&&v<d){var I=an(b,S);return $i(t,e,Di,c.placeholder,n,b,I,u,l,d-v)}var P=h?n:this,C=f?P[t]:t;return v=b.length,u?b=function(t,e){for(var n=t.length,i=mn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=go(a,n)?o[a]:r}return t}(b,u):g&&v>1&&b.reverse(),p&&l<v&&(b.length=l),this&&this!==le&&this instanceof c&&(C=m||Bi(C)),C.apply(P,b)}}function Ni(t,e){return function(n,r){return function(t,e,n,r){return vr(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/un(e)));return nn(e)?vi(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=gn(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,c,u,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?c:r,p?r:a,p?r:c,u,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]==u?function(t){return new Cn(t)}:sc;function Gi(t){return function(e){var n=po(e);return n==S?rn(e):n==O?cn(e):function(t,e){return je(e,function(e){return[e,t[e]]})}(e,t(e))}}function Yi(t,e,n,o,u,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=u=r),d=d===r?d:gn(hs(d),0),p=p===r?p:hs(p),f-=u?u.length:0,64&e){var y=o,g=u;o=u=r}var m=h?r:no(t),v=[t,e,n,o,u,y,g,l,d,p];if(m&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==c&&8==n||r==c&&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 u=e[3];if(u){var l=t[3];t[3]=l?Pi(l,u,e[4]):u,t[4]=l?an(t[3],a):e[4]}(u=e[5])&&(l=t[5],t[5]=l?Ci(l,u,e[6]):u,t[6]=l?an(t[5],a):e[6]),(u=e[7])&&(t[7]=u),r&c&&(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}(v,m),t=v[0],e=v[1],n=v[2],o=v[3],u=v[4],!(p=v[9]=v[9]===r?h?0:t.length:gn(v[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Bi(t);return function o(){for(var a=arguments.length,s=rt(a),c=a,u=io(o);c--;)s[c]=arguments[c];var l=a<3&&s[0]!==u&&s[a-1]!==u?[]:an(s,u);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||u.length?Di.apply(r,v):function(t,e,n,r){var i=1&e,o=Bi(t);return function e(){for(var a=-1,s=arguments.length,c=-1,u=r.length,l=rt(u+s),d=this&&this!==le&&this instanceof e?o:t;++c<u;)l[c]=r[c];for(;s--;)l[c++]=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=Bi(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,v),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,c=t.length,u=e.length;if(c!=u&&!(s&&u>c))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<c;){var y=t[p],g=e[p];if(i)var m=s?i(g,y,p,e,t,a):i(y,g,p,t,e,a);if(m!==r){if(m)continue;h=!1;break}if(f){if(!Be(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!==g&&!o(y,g,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,uo)}function eo(t){return _r(t,xs,lo)}var no=kn?function(t){return kn.get(t)}:sc;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(Nn,"placeholder")?Nn:t).placeholder}function oo(){var t=Nn.iteratee||rc;return t=t===rc?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 co(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return Tr(n)?n:r}var uo=ye?function(t){return null==t?[]:(t=Pt(t),Ae(ye(t),function(e){return Wt.call(t,e)}))}:fc,lo=ye?function(t){for(var e=[];t;)xe(e,uo(t)),t=$t(t);return e}:fc,po=Ir;function ho(t,e,n){for(var r=-1,i=(e=gi(e,t)).length,o=!1;++r<i;){var a=Mo(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)&&go(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 go(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&>.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)&&go(e,n.length):"string"==r&&e in n)&&Ua(n[e],t)}function vo(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=Nn[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 Bn:return E}return e});var wo=xt?Ja:yc;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=gn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=gn(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=vn(),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,Bo,Fo=(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(ut,"$1"):n||t)}),e},function(t){return 500===Bo.size&&Bo.clear(),t}),Bo=zo.cache,zo);function Mo(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 No(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)?ur(t,yr(e,1,Wa,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?ur(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)?ur(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=gn(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?gn(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 go(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=gn(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)?ur(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))}),ca=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,pi(Ae(t,Wa),r,e)}),ua=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=Nn(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&&go(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=Fi(Vo),ga=Fi(qo);function ma(t,e){return(qa(t)?Pe:lr)(t,oo(e,3))}function va(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:Mr)(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=ue||function(){return le.Date.now()};function Oa(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Yi(t,c,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,c,u,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,c=t.apply(i,n)}function g(t){var n=t-l;return l===r||n>=e||n<0||h&&t-d>=s}function m(){var t=Ca();if(g(t))return v(t);u=ko(m,function(t){var n=e-(t-l);return h?mn(n,s-(t-d)):n}(t))}function v(t){return u=r,f&&o?y(t):(o=a=r,c)}function b(){var t=Ca(),n=g(t);if(o=arguments,a=this,l=t,n){if(u===r)return function(t){return d=t,u=ko(m,e),p?y(t):c}(l);if(h)return bi(u),u=ko(m,e),y(l)}return u===r&&(u=ko(m,e)),c}return e=ys(e)||0,Qa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?gn(ys(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){u!==r&&bi(u),d=0,o=l=a=u=r},b.flush=function(){return u===r?c:v(Ca())},b}var xa=Gr(function(t,e){return cr(t,1,e)}),Ta=Gr(function(t,e,n){return cr(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 Ba(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 Fa=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)})}),Ma=Gr(function(t,e){var n=an(e,io(Ma));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)}),Na=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=ge?Ye(ge):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=Fe||yc,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==v||"[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=ve?Ye(ve):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 cs=Se?Ye(Se):function(t){return ts(t)&&Za(t.length)&&!!re[Ir(t)]},us=qi(Fr),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))===u||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 gs(t){return Ai(t,xs(t))}function ms(t){return null==t?"":ai(t)}var vs=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),c=-1,u=s.length;++c<u;){var l=s[c],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=Ni(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Mt.call(e)),t[e]=n},Qs(nc)),ks=Ni(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Mt.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):Br(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)}),Bs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=gi(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--;)ci(n,e[i]);return n}),Fs=Qi(function(t,e){return null==t?{}:function(t,e){return Vr(t,e,function(e,n){return Os(t,n)})}(t,e)});function Ms(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),Ns=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=Mo(e),rr(t,e,ka(t[e],t))}),t});function Qs(t){return function(){return t}}var tc=Mi(),ec=Mi(!0);function nc(t){return t}function rc(t){return zr("function"==typeof t?t:ar(t,1))}var ic=Gr(function(t,e){return function(n){return kr(n,t,e)}}),oc=Gr(function(t,e){return function(n){return kr(t,n,e)}});function ac(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 sc(){}var cc=Ri(je),uc=Ri(Oe),lc=Ri(Be);function dc(t){return vo(t)?Ve(Mo(t)):function(t){return function(e){return Sr(e,t)}}(t)}var pc=Vi(),hc=Vi(!0);function fc(){return[]}function yc(){return!1}var gc,mc=Ui(function(t,e){return t+e},0),vc=Hi("ceil"),bc=Ui(function(t,e){return t/e},1),wc=Hi("floor"),Sc=Ui(function(t,e){return t*e},1),_c=Hi("round"),Ic=Ui(function(t,e){return t-e},0);return Nn.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)}},Nn.ary=Oa,Nn.assign=vs,Nn.assignIn=bs,Nn.assignInWith=ws,Nn.assignWith=Ss,Nn.at=_s,Nn.before=Aa,Nn.bind=ka,Nn.bindAll=Zs,Nn.bindKey=Ea,Nn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Nn.chain=da,Nn.chunk=function(t,e,n){e=(n?mo(t,e,n):e===r)?1:gn(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},Nn.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},Nn.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))},Nn.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)}})},Nn.conforms=function(t){return function(t){var e=js(t);return function(n){return sr(n,t,e)}}(ar(t,1))},Nn.constant=Qs,Nn.countBy=fa,Nn.create=function(t,e){var n=Un(t);return null==e?n:nr(n,e)},Nn.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},Nn.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},Nn.debounce=ja,Nn.defaults=Is,Nn.defaultsDeep=Ps,Nn.defer=xa,Nn.delay=Ta,Nn.difference=Uo,Nn.differenceBy=Ro,Nn.differenceWith=Lo,Nn.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):[]},Nn.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):[]},Nn.dropRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0,!0):[]},Nn.dropWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0):[]},Nn.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)):[]},Nn.filter=function(t,e){return(qa(t)?Ae:fr)(t,oo(e,3))},Nn.flatMap=function(t,e){return yr(_a(t,e),1)},Nn.flatMapDeep=function(t,e){return yr(_a(t,e),u)},Nn.flatMapDepth=function(t,e,n){return n=n===r?1:hs(n),yr(_a(t,e),n)},Nn.flatten=$o,Nn.flattenDeep=function(t){return null!=t&&t.length?yr(t,u):[]},Nn.flattenDepth=function(t,e){return null!=t&&t.length?yr(t,e=e===r?1:hs(e)):[]},Nn.flip=function(t){return Yi(t,512)},Nn.flow=tc,Nn.flowRight=ec,Nn.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},Nn.functions=function(t){return null==t?[]:wr(t,js(t))},Nn.functionsIn=function(t){return null==t?[]:wr(t,xs(t))},Nn.groupBy=ba,Nn.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Nn.intersection=Wo,Nn.intersectionBy=Go,Nn.intersectionWith=Yo,Nn.invert=As,Nn.invertBy=ks,Nn.invokeMap=wa,Nn.iteratee=rc,Nn.keyBy=Sa,Nn.keys=js,Nn.keysIn=xs,Nn.map=_a,Nn.mapKeys=function(t,e){var n={};return e=oo(e,3),vr(t,function(t,r,i){rr(n,e(t,r,i),t)}),n},Nn.mapValues=function(t,e){var n={};return e=oo(e,3),vr(t,function(t,r,i){rr(n,r,e(t,r,i))}),n},Nn.matches=function(t){return Dr(ar(t,1))},Nn.matchesProperty=function(t,e){return Nr(t,ar(e,1))},Nn.memoize=za,Nn.merge=Ts,Nn.mergeWith=zs,Nn.method=ic,Nn.methodOf=oc,Nn.mixin=ac,Nn.negate=Ba,Nn.nthArg=function(t){return t=hs(t),Gr(function(e){return Rr(e,t)})},Nn.omit=Bs,Nn.omitBy=function(t,e){return Ms(t,Ba(oo(e)))},Nn.once=function(t){return Aa(2,t)},Nn.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))},Nn.over=cc,Nn.overArgs=Fa,Nn.overEvery=uc,Nn.overSome=lc,Nn.partial=Ma,Nn.partialRight=Da,Nn.partition=Ia,Nn.pick=Fs,Nn.pickBy=Ms,Nn.property=dc,Nn.propertyOf=function(t){return function(e){return null==t?r:Sr(t,e)}},Nn.pull=Jo,Nn.pullAll=Xo,Nn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,oo(n,2)):t},Nn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,r,n):t},Nn.pullAt=Zo,Nn.range=pc,Nn.rangeRight=hc,Nn.rearg=Na,Nn.reject=function(t,e){return(qa(t)?Ae:fr)(t,Ba(oo(e,3)))},Nn.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},Nn.rest=function(t,e){if("function"!=typeof t)throw new At(i);return Gr(t,e=e===r?e:hs(e))},Nn.reverse=Qo,Nn.sampleSize=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),(qa(t)?Jn:Kr)(t,e)},Nn.set=function(t,e,n){return null==t?t:Jr(t,e,n)},Nn.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:Jr(t,e,n,i)},Nn.shuffle=function(t){return(qa(t)?Xn:Qr)(t)},Nn.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)):[]},Nn.sortBy=Pa,Nn.sortedUniq=function(t){return t&&t.length?ii(t):[]},Nn.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Nn.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)?vi(ln(t),0,n):t.split(e,n):[]},Nn.spread=function(t,e){if("function"!=typeof t)throw new At(i);return e=null==e?0:gn(hs(e),0),Gr(function(n){var r=n[e],i=vi(n,0,e);return r&&xe(i,r),_e(t,this,i)})},Nn.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Nn.take=function(t,e,n){return t&&t.length?ti(t,0,(e=n||e===r?1:hs(e))<0?0:e):[]},Nn.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):[]},Nn.takeRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!1,!0):[]},Nn.takeWhile=function(t,e){return t&&t.length?li(t,oo(e,3)):[]},Nn.tap=function(t,e){return e(t),t},Nn.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})},Nn.thru=pa,Nn.toArray=ds,Nn.toPairs=Ds,Nn.toPairsIn=Ns,Nn.toPath=function(t){return qa(t)?je(t,Mo):ss(t)?[t]:Oi(Fo(ms(t)))},Nn.toPlainObject=gs,Nn.transform=function(t,e,n){var r=qa(t),i=r||Ga(t)||cs(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:vr)(t,function(t,r,i){return e(n,t,r,i)}),n},Nn.unary=function(t){return Oa(t,1)},Nn.union=ta,Nn.unionBy=ea,Nn.unionWith=na,Nn.uniq=function(t){return t&&t.length?si(t):[]},Nn.uniqBy=function(t,e){return t&&t.length?si(t,oo(e,2)):[]},Nn.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?si(t,r,e):[]},Nn.unset=function(t,e){return null==t||ci(t,e)},Nn.unzip=ra,Nn.unzipWith=ia,Nn.update=function(t,e,n){return null==t?t:ui(t,e,yi(n))},Nn.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ui(t,e,yi(n),i)},Nn.values=Us,Nn.valuesIn=function(t){return null==t?[]:Ke(t,xs(t))},Nn.without=oa,Nn.words=Js,Nn.wrap=function(t,e){return Ma(yi(e),t)},Nn.xor=aa,Nn.xorBy=sa,Nn.xorWith=ca,Nn.zip=ua,Nn.zipObject=function(t,e){return hi(t||[],e||[],Qn)},Nn.zipObjectDeep=function(t,e){return hi(t||[],e||[],Jr)},Nn.zipWith=la,Nn.entries=Ds,Nn.entriesIn=Ns,Nn.extend=bs,Nn.extendWith=ws,ac(Nn,Nn),Nn.add=mc,Nn.attempt=Xs,Nn.camelCase=Rs,Nn.capitalize=Ls,Nn.ceil=vc,Nn.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)},Nn.clone=function(t){return ar(t,4)},Nn.cloneDeep=function(t){return ar(t,5)},Nn.cloneDeepWith=function(t,e){return ar(t,5,e="function"==typeof e?e:r)},Nn.cloneWith=function(t,e){return ar(t,4,e="function"==typeof e?e:r)},Nn.conformsTo=function(t,e){return null==e||sr(t,e,js(e))},Nn.deburr=Vs,Nn.defaultTo=function(t,e){return null==t||t!=t?e:t},Nn.divide=bc,Nn.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},Nn.eq=Ua,Nn.escape=function(t){return(t=ms(t))&&G.test(t)?t.replace(H,tn):t},Nn.escapeRegExp=function(t){return(t=ms(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Nn.every=function(t,e,n){var i=qa(t)?Oe:pr;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Nn.find=ya,Nn.findIndex=Vo,Nn.findKey=function(t,e){return Me(t,oo(e,3),vr)},Nn.findLast=ga,Nn.findLastIndex=qo,Nn.findLastKey=function(t,e){return Me(t,oo(e,3),br)},Nn.floor=wc,Nn.forEach=ma,Nn.forEachRight=va,Nn.forIn=function(t,e){return null==t?t:gr(t,oo(e,3),xs)},Nn.forInRight=function(t,e){return null==t?t:mr(t,oo(e,3),xs)},Nn.forOwn=function(t,e){return t&&vr(t,oo(e,3))},Nn.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Nn.get=Cs,Nn.gt=Ra,Nn.gte=La,Nn.has=function(t,e){return null!=t&&ho(t,e,Cr)},Nn.hasIn=Os,Nn.head=Ho,Nn.identity=nc,Nn.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=gn(i+n,0)),as(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ne(t,e,n)>-1},Nn.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=gn(r+i,0)),Ne(t,e,i)},Nn.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<gn(e,n)}(t=ys(t),e,n)},Nn.invoke=Es,Nn.isArguments=Va,Nn.isArray=qa,Nn.isArrayBuffer=$a,Nn.isArrayLike=Ha,Nn.isArrayLikeObject=Wa,Nn.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Ir(t)==g},Nn.isBuffer=Ga,Nn.isDate=Ya,Nn.isElement=function(t){return ts(t)&&1===t.nodeType&&!rs(t)},Nn.isEmpty=function(t){if(null==t)return!0;if(Ha(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||cs(t)||Va(t)))return!t.length;var e=po(t);if(e==S||e==O)return!t.size;if(So(t))return!Br(t).length;for(var n in t)if(zt.call(t,n))return!1;return!0},Nn.isEqual=function(t,e){return jr(t,e)},Nn.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},Nn.isError=Ka,Nn.isFinite=function(t){return"number"==typeof t&&qe(t)},Nn.isFunction=Ja,Nn.isInteger=Xa,Nn.isLength=Za,Nn.isMap=es,Nn.isMatch=function(t,e){return t===e||xr(t,e,so(e))},Nn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,xr(t,e,so(e),n)},Nn.isNaN=function(t){return ns(t)&&t!=+t},Nn.isNative=function(t){if(wo(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(t)},Nn.isNil=function(t){return null==t},Nn.isNull=function(t){return null===t},Nn.isNumber=ns,Nn.isObject=Qa,Nn.isObjectLike=ts,Nn.isPlainObject=rs,Nn.isRegExp=is,Nn.isSafeInteger=function(t){return Xa(t)&&t>=-9007199254740991&&t<=l},Nn.isSet=os,Nn.isString=as,Nn.isSymbol=ss,Nn.isTypedArray=cs,Nn.isUndefined=function(t){return t===r},Nn.isWeakMap=function(t){return ts(t)&&po(t)==E},Nn.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Ir(t)},Nn.join=function(t,e){return null==t?"":fn.call(t,e)},Nn.kebabCase=qs,Nn.last=Ko,Nn.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?gn(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)},Nn.lowerCase=$s,Nn.lowerFirst=Hs,Nn.lt=us,Nn.lte=ls,Nn.max=function(t){return t&&t.length?hr(t,nc,Pr):r},Nn.maxBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Pr):r},Nn.mean=function(t){return Le(t,nc)},Nn.meanBy=function(t,e){return Le(t,oo(e,2))},Nn.min=function(t){return t&&t.length?hr(t,nc,Fr):r},Nn.minBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Fr):r},Nn.stubArray=fc,Nn.stubFalse=yc,Nn.stubObject=function(){return{}},Nn.stubString=function(){return""},Nn.stubTrue=function(){return!0},Nn.multiply=Sc,Nn.nth=function(t,e){return t&&t.length?Rr(t,hs(e)):r},Nn.noConflict=function(){return le._===this&&(le._=Nt),this},Nn.noop=sc,Nn.now=Ca,Nn.pad=function(t,e,n){t=ms(t);var r=(e=hs(e))?un(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(pe(i),n)},Nn.padEnd=function(t,e,n){t=ms(t);var r=(e=hs(e))?un(t):0;return e&&r<e?t+Li(e-r,n):t},Nn.padStart=function(t,e,n){t=ms(t);var r=(e=hs(e))?un(t):0;return e&&r<e?Li(e-r,n)+t:t},Nn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(ms(t).replace(nt,""),e||0)},Nn.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)},Nn.reduce=function(t,e,n){var r=qa(t)?Te:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,lr)},Nn.reduceRight=function(t,e,n){var r=qa(t)?ze:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,dr)},Nn.repeat=function(t,e,n){return e=(n?mo(t,e,n):e===r)?1:hs(e),Wr(ms(t),e)},Nn.replace=function(){var t=arguments,e=ms(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Nn.result=function(t,e,n){var i=-1,o=(e=gi(e,t)).length;for(o||(o=1,t=r);++i<o;){var a=null==t?r:t[Mo(e[i])];a===r&&(i=o,a=n),t=Ja(a)?a.call(t):a}return t},Nn.round=_c,Nn.runInContext=t,Nn.sample=function(t){return(qa(t)?Kn:Yr)(t)},Nn.size=function(t){if(null==t)return 0;if(Ha(t))return as(t)?un(t):t.length;var e=po(t);return e==S||e==O?t.size:Br(t).length},Nn.snakeCase=Ws,Nn.some=function(t,e,n){var i=qa(t)?Be:ei;return n&&mo(t,e,n)&&(e=r),i(t,oo(e,3))},Nn.sortedIndex=function(t,e){return ni(t,e)},Nn.sortedIndexBy=function(t,e,n){return ri(t,e,oo(n,2))},Nn.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},Nn.sortedLastIndex=function(t,e){return ni(t,e,!0)},Nn.sortedLastIndexBy=function(t,e,n){return ri(t,e,oo(n,2),!0)},Nn.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},Nn.startCase=Gs,Nn.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},Nn.subtract=Ic,Nn.sum=function(t){return t&&t.length?He(t,nc):0},Nn.sumBy=function(t,e){return t&&t.length?He(t,oo(e,2)):0},Nn.template=function(t,e,n){var i=Nn.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),c=js(s),u=Ke(s,c),l=0,d=e.interpolate||vt,p="__p += '",h=Ct((e.escape||vt).source+"|"+d.source+"|"+(d===J?lt:vt).source+"|"+(e.evaluate||vt).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,c){return r||(r=i),p+=t.slice(l,c).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=c+e.length,e}),p+="';\n";var y=zt.call(e,"variable")&&e.variable;if(y){if(ct.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 g=Xs(function(){return _t(c,f+"return "+p).apply(r,u)});if(g.source=p,Ka(g))throw g;return g},Nn.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},Nn.toFinite=ps,Nn.toInteger=hs,Nn.toLength=fs,Nn.toLower=function(t){return ms(t).toLowerCase()},Nn.toNumber=ys,Nn.toSafeInteger=function(t){return t?or(hs(t),-9007199254740991,l):0===t?t:0},Nn.toString=ms,Nn.toUpper=function(t){return ms(t).toUpperCase()},Nn.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 vi(i,Xe(i,o),Ze(i,o)+1).join("")},Nn.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 vi(i,0,Ze(i,ln(e))+1).join("")},Nn.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 vi(i,Xe(i,ln(e))).join("")},Nn.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 c=n-un(i);if(c<1)return i;var u=s?vi(s,0,c).join(""):t.slice(0,c);if(o===r)return u+i;if(s&&(c+=u.length-c),is(o)){if(t.slice(c).search(o)){var l,d=u;for(o.global||(o=Ct(o.source,ms(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var p=l.index;u=u.slice(0,p===r?c:p)}}else if(t.indexOf(ai(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+i},Nn.unescape=function(t){return(t=ms(t))&&W.test(t)?t.replace($,pn):t},Nn.uniqueId=function(t){var e=++Bt;return ms(t)+e},Nn.upperCase=Ys,Nn.upperFirst=Ks,Nn.each=ma,Nn.eachRight=va,Nn.first=Ho,ac(Nn,(gc={},vr(Nn,function(t,e){zt.call(Nn.prototype,e)||(gc[e]=t)}),gc),{chain:!1}),Nn.VERSION="4.17.21",Pe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Nn[t].placeholder=Nn}),Pe(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:gn(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(nc)},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(Ba(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)},vr(Vn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Nn[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(Nn.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,c=e instanceof Vn,u=s[0],l=c||qa(e),d=function(t){var e=o.apply(Nn,xe([t],s));return i&&p?e[0]:e};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=c&&!h;if(!a&&l){e=y?e:new Vn(this);var g=t.apply(e,s);return g.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(g,p)}return f&&y?t.apply(this,s):(g=this.thru(d),f?i?g.value()[0]:g.value():g)})}),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);Nn.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)})}}),vr(Vn.prototype,function(t,e){var n=Nn[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=gn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,p=0,h=mn(c,this.__takeCount__);if(!n||!r&&i==c&&h==c)return di(t,this.__actions__);var f=[];t:for(;c--&&p<h;){for(var y=-1,g=t[u+=e];++y<d;){var m=l[y],v=m.iteratee,b=m.type,w=v(g);if(2==b)g=w;else if(!w){if(1==b)continue t;break t}}f[p++]=g}return f},Nn.prototype.at=ha,Nn.prototype.chain=function(){return da(this)},Nn.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Nn.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__++]}},Nn.prototype.plant=function(t){for(var e,n=this;n instanceof Rn;){var i=No(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Nn.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)},Nn.prototype.toJSON=Nn.prototype.valueOf=Nn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Nn.prototype.first=Nn.prototype.head,Xt&&(Nn.prototype[Xt]=function(){return this}),Nn}();"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,{createPayPalCommerceAlternativeMethodsButtonStrategy:()=>Ie,createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>Ot,createPayPalCommerceButtonStrategy:()=>pe,createPayPalCommerceCreditButtonStrategy:()=>ye,createPayPalCommerceCreditCardsPaymentStrategy:()=>Vt,createPayPalCommerceCreditCustomerStrategy:()=>re,createPayPalCommerceCreditPaymentStrategy:()=>bt,createPayPalCommerceCustomerStrategy:()=>te,createPayPalCommerceFastlaneCustomerStrategy:()=>ue,createPayPalCommerceFastlanePaymentStrategy:()=>Xt,createPayPalCommercePaymentStrategy:()=>K,createPayPalCommerceRatePayPaymentStrategy:()=>Ht,createPayPalCommerceVenmoButtonStrategy:()=>ve,createPayPalCommerceVenmoCustomerStrategy:()=>ae,createPayPalCommerceVenmoPaymentStrategy:()=>_t});var t,e=n(315);function i(t,e){return Object.assign(t,{resolveIds:e})}class o 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 a extends o{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"}(t||(t={}));class s extends o{constructor(e){super(function(e){switch(e){case t.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case t.MissingCart:return"Unable to proceed because cart data is unavailable.";case t.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case t.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case t.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case t.MissingCheckoutConfig:case t.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case t.MissingOrder:return"Unable to proceed because order data is unavailable.";case t.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case t.MissingPayment:return"Unable to proceed because payment data is unavailable.";case t.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case t.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case t.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}var c=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class u{constructor(t){this.scriptLoader=t,this.window=window}getPayPalFastlaneSdk(t,e,n){return c(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 a}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return c(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 a;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return c(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 a}return this.window.paypalApms})}getPayPalMessages(t,e){return c(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 a;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return c(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})})}getPayPalFastlaneSdkConfiguration(e,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,attributionId:l}=o;return{options:{"client-id":c,"merchant-id":u,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:n,intent:a},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||r;return{options:Object.assign({"client-id":c,"merchant-id":u,commit:f,components:["googlepay"],currency:n,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:c,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=r,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:n,intent:i},l&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:c,buyerCountry:u}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},c&&{"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}}const l={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},d="embedded-checkout-loading-indicator-rotation";class p{constructor(t){this.styles=Object.assign(Object.assign({},l),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=`${d} 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(d))return;const e=document.createElement("style");e.id=d,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${d} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}var h=n(8686),f=n(4043),y=n(9440);class g extends o{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 m={body:{},headers:{},status:0};class v extends o{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||m;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 b,w,S,_,I,P,C,O;!function(t){t.BuyNow="BUY_NOW"}(b||(b={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(w||(w={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(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.OXXO="oxxo",t.IDEAL="ideal"}(C||(C={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(O||(O={}));var A=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class k{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(t,e,n,r){return A(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 a;return this.paypalSdk}createBuyNowCartOrThrow(e){return A(this,void 0,void 0,function*(){const n=e.getBuyNowCartRequestBody();if(!n)throw new s(t.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(t){throw new g}})}createOrder(t,e){return A(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 A(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 A(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 A(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(e,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new s(t.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:n},r.source===b.BuyNow&&{cart_id:r.id}))}submitPayment(t,e,n){return A(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&&I[e]?e:void 0,height:this.getValidHeight(n),label:r&&_[r]?r:void 0,shape:i&&P[i]?i:void 0};return(0,y.omitBy)(o,y.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 E="This API endpoint is for internal use only and may change in the future";var j;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(j||(j={}));const x=j,T={"X-Checkout-SDK-Version":"1.889.1"};var z=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class B{constructor(t){this.requestSender=t}createOrder(t,e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return z(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:e})).body})}getOrderStatus(t="paypalcommerce",e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}var F=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class M{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return F(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(t,e,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(t,e=!1){return F(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 a;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(e,n,r=!0){const{id:i,clientToken:o,initializationData:a}=e;if(!(null==a?void 0:a.clientId))throw new s(t.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=a,w=f||r,S="paypalcommercecreditcards"===i,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=r?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!v.includes(t))],k=[..._,...I,...P,...v];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:n,intent:c},g&&{"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 D=t=>{const{getHost:n}=t.getState();return new k((0,h.createFormPoster)(),t,new B((0,f.createRequestSender)({host:n()})),new M((0,e.vQ)()))},N={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class U extends o{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class R extends U{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 L 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 V extends o{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function q(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function $(t){return Boolean(t.instrumentId)}const H=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 W(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 G=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Y{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.loadingIndicator=r}initialize(t){var e;return G(this,void 0,void 0,function*(){const{methodId:n,paypalcommerce:r}=t||{};if(this.paypalcommerce=r,!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new U('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:c,paypalBNPLConfiguration:u=[],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==u?void 0:u.find(({id:t})=>"checkout"===t);if(l||!(null==t?void 0:t.status))return;const e=yield this.paypalCommerceSdk.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")}c?this.orderId=null===(e=o.initializationData)||void 0===e?void 0:e.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalCommerceIntegrationService.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 G(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 R(["payment"]);const{methodId:s,paymentData:c}=i;if(this.isPayPalVaultedInstrumentPaymentData(c)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new L;const u=this.isPayPalVaultedInstrumentPaymentData(c)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,c):this.preparePaymentPayload(s,this.orderId,c);try{yield this.paymentIntegrationService.submitOrder(o,e),yield this.paymentIntegrationService.submitPayment(u)}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.paypalCommerceIntegrationService.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 V)}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}=q(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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:c}=s.initializationData||{},{checkoutPaymentButtonStyles:u}=c||{},{container:l,onError:d,onRenderButton:p,onValidate:h,submitForm:f}=e;if(!l)throw new U('Unable to initialize payment because "container" argument is not provided.');const y=this.getSmartButtonContainerId(l);if(!document.getElementById(y))throw new U(`Unable to initialize payment because element with id ${y} does not exist.`);const g=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(u),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(g),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 G(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 G(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.paypalCommerceIntegrationService.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&&$(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>W(e)&&e.bigpayToken===t.instrumentId);return!(W(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&$(t)&&q(t)}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:H(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 K=i(t=>new Y(t,D(t),new u((0,e.vQ)()),new p({containerStyles:N})),[{id:"paypalcommerce"}]);var J,X,Z,Q,tt,et,nt,rt,it,ot,at=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class st{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return at(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 a}return this.window.paypal})}getPayPalFastlaneSdk(t,e,n){return at(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 a}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return at(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 a;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return at(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 a}return this.window.paypalApms})}getPayPalMessages(t,e){return at(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 a;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return at(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(e,n,r=!0){const{id:i,clientToken:o,initializationData:a}=e;if(!a||!a.clientId)throw new s(t.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:m=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=a,w=f||r,S="paypalcommercecreditcards"===i||"bigcommerce_payments_creditcards"===i,_=S?["card"]:[],I=y?["credit","paylater"]:[],P=h?["venmo"]:[],C=b?["googlepay"]:[],O=r?["card-fields"]:[],A=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...m.filter(t=>!v.includes(t))],k=[..._,...I,...P,...v];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:n,intent:c},g&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}getPayPalFastlaneSdkConfiguration(e,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,attributionId:l}=o;return{options:{"client-id":c,"merchant-id":u,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:n,intent:a},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:c,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||r;return{options:Object.assign({"client-id":c,"merchant-id":u,commit:f,components:["googlepay"],currency:n,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:c,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=r,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:n,intent:i},l&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:c,buyerCountry:u}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},c&&{"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 ct(){return new st((0,e.Hb)())}!function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(J||(J={})),function(t){t.Always="SCA_ALWAYS"}(X||(X={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(Z||(Z={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(Q||(Q={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(tt||(tt={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(et||(et={})),function(t){t.pill="pill",t.rect="rect"}(nt||(nt={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(rt||(rt={})),function(t){t.OXXO="oxxo"}(it||(it={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(ot||(ot={}));var ut=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class lt{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalRequestSender=n,this.paypalSdkLoader=r}loadPayPalSdk(t,e,n,r){return ut(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 a;return this.paypalSdk}createBuyNowCartOrThrow(e){return ut(this,void 0,void 0,function*(){const n=e.getBuyNowCartRequestBody();if(!n)throw new s(t.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(t){throw new g}})}createOrder(t,e){return ut(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 ut(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 ut(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 ut(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalRequestSender.getOrderStatus(t,e);return n}catch(t){throw new v}})}tokenizePayment(e,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new s(t.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:n},r.source===b.BuyNow&&{cart_id:r.id}))}submitPayment(t,e,n){return ut(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&&et[e]?e:void 0,height:this.getValidHeight(n),label:r&&tt[r]?r:void 0,shape:i&&nt[i]?i:void 0};return(0,y.omitBy)(o,y.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{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((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":E,"Content-Type":x.Json},T);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t,e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.put(n,{headers:i,body:r})).body})}getOrderStatus(t,e){return dt(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}const ht=t=>{const{getHost:e}=t.getState();return new lt((0,h.createFormPoster)(),t,new pt((0,f.createRequestSender)({host:e()})),ct())},ft={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class yt extends o{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}const gt=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};var mt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class vt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.loadingIndicator=n,this.payPalSdkScriptLoader=r}initialize(t){return mt(this,void 0,void 0,function*(){const{methodId:e,paypalcommerce:n,paypalcommercecredit:r}=t||{},i=r||n;if(!e)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new U('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:c}=a.initializationData||{},{bannerContainerId:u,container:l}=i;if(void 0!==u){if(!document.getElementById(u))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,u,t)}c?this.orderId=c:(yield this.paypalIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==l?void 0:l.split("#")[1],this.renderButton(e,i))})}execute(t,e){return mt(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 R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}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 U('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:c,onValidate:u,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,u),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 yt(`PayPal ${t} is not available for your region. Please use PayPal Checkout instead.`);c&&"function"==typeof c&&c(),this.paypalButton.render(a),p=!0}})}handleClick(t,e){return mt(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:gt(n)};t.Messages(r).render(`#${e}`)}}const bt=i(t=>new vt(t,ht(t),new p({containerStyles:ft}),ct()),[{id:"paypalcommercecredit"}]);var wt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class St{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return wt(this,void 0,void 0,function*(){const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=t||{},a=o||i;if(!r)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new U('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 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 R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}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:c,onValidate:u,submitForm:l}=e,d={fundingSource:n.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(t,e)=>this.handleClick(e,u),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 yt("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");c&&"function"==typeof c&&c(),this.paypalButton.render(a)}handleClick(t,e){return wt(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 _t=i(t=>new St(t,D(t),new p({styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]);class It extends v{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var Pt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Ct{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=y.noop,this.isOrderApprovedProcessing=!1}initialize(t){return Pt(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 U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,e),{orderId:c,shouldRenderFields:u}=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),c?this.orderId=c:(this.paypalApms=yield this.paypalSdkScriptLoader.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,e,o),u&&this.renderFields(n,o))})}execute(t,e){return Pt(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 R(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new L;this.isOrderApprovedProcessing||"ideal"!==i||(yield new Promise((t,e)=>{this.initializePollingMechanism(i,t,e,o)})),this.isNonInstantPaymentMethod(i)&&(i!==C.IDEAL||this.isOrderApprovedProcessing)||(yield this.paymentIntegrationService.submitOrder(r,e)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new V)}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 Pt(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===O.Approved,a=i===O.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 It)}catch(t){n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}reinitializeStrategy(t){return Pt(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:c,submitForm:u}=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,u),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deinitializePollingMechanism()},onError:t=>{this.deinitializePollingMechanism(),this.handleFailure(t,s)},onClick:(t,e)=>Pt(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.paypalButton=r.Buttons(l),this.paypalButton.isEligible()&&(c&&"function"==typeof c&&c(),this.paypalButton.render(a))}onCreateOrder(t,e,n){var r;return Pt(this,void 0,void 0,function*(){const{onValidate:i}=n;yield i(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),y.noop);const o=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(t)&&(t===C.IDEAL&&this.isOrderApprovedProcessing||t===C.OXXO)){const n={useStoreCredit:!1},i={params:{methodId:t,gatewayId:e}};if(yield this.paymentIntegrationService.submitOrder(n,i),t===C.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:c}=e;if(!s)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const u=document.querySelector(s);u&&(u.innerHTML="");const l={fundingSource:t,style:c||{},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 C}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new a;return this.paypalApms}}const Ot=i(t=>new Ct(t,ht(t),ct(),new p({containerStyles:N})),[{gateway:"paypalcommercealternativemethods"}]);var At;!function(t){t.CVV="cvv",t.PAN="pan"}(At||(At={}));class kt{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){kt.set(t,"",Object.assign({expires:new Date(0)},e))}}var Et,jt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class xt{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return jt(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 a;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return jt(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return jt(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};kt.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){kt.remove("bc-fastlane-sessionId")}getStorageSessionId(){return kt.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,c=null==a?void 0:a.shippingAddress,u=null==a?void 0:a.name,l=null==a?void 0:a.card,d=c?this.mapPayPalToBcAddress(c.address,c.name,c.phoneNumber):void 0,p=s&&u?this.mapPayPalToBcAddress(s,u,null==c?void 0:c.phoneNumber):void 0,h=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,p]);return{authenticationState:o||rt.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,c]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:c,expiryYear:s,iin:"",last4:a,method:t,provider:t,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:At.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,y.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,y.omit)(t,["id","phone"])}}function Tt(){return new xt}!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(Et||(Et={}));const zt=Et;function Bt(t){return zt.CardNumber in t&&zt.CardName in t&&zt.CardExpiry in t}function Ft(t){return zt.CardNumberVerification in t&&zt.CardCodeVerification in t&&zt.CardExpiryVerification in t}class Mt extends o{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 Dt;!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"}(Dt||(Dt={}));class Nt extends o{constructor(t){super(function(t){switch(t){case Dt.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Dt.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Dt.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Dt.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 Ut extends o{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 Rt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Lt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){return Rt(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 U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new U('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=Bt(o.fields),this.isCreditCardVaultedForm=Ft(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 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"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new R(["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 V)}deinitialize(){var t,e,n,r;return Rt(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}=q(e)?e:{},a=e&&$(e)?e.instrumentId:void 0,s=(0,y.omitBy)({verification_nonce:r,token:a},y.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 Rt(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===w.No||n===w.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new Mt},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 Nt(Dt.PaymentNotInitialized);try{this.stylizeInputContainers(n),Bt(n)&&(yield this.renderFields(n)),Ft(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return Ft(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Rt(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:()=>Rt(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 Rt(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 Rt(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(q(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if($(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Rt(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 Mt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Rt(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 Ut(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 zt.CardCode:case zt.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case zt.CardNumber:case zt.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case zt.CardExpiry:case zt.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 zt.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?zt.CardNumber:zt.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?zt.CardExpiry:zt.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?zt.CardCode:zt.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new Nt(Dt.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 Rt(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 Vt=i(t=>new Lt(t,ht(t),ct(),Tt()),[{id:"paypalcommercecreditcards"}]);var qt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class $t{constructor(t,e,n,r=3e3,i=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=y.noop}initialize(t){return qt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerceratepay:r}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new U('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new U('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new U('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new U('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,e),{merchantId:c}=s.initializationData||{};if(!c)throw new U("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(c,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return qt(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 R(["payment"]);if(!i||"function"!=typeof i)throw new U('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),c={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:c}),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 V)}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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),c=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new U('Unable to initialize payment because "legalTextContainerElement" argument is not found.');c.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 qt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return qt(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("paypalcommercealternativemethods",{params:{useMetadata:!0}}),o=i===O.PollingStop,a=i===O.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 It)}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 Ht=i(t=>new $t(t,D(t),new p({containerStyles:Object.assign(Object.assign({},N),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);function Wt(t){return"string"!=typeof t}function Gt(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,y.omitBy)(t.root,Wt),o=(0,y.omitBy)(t.input,Wt),a=(0,y.omitBy)(t.toggle,Wt),s=(0,y.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,Wt),c=(0,y.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,Wt),u=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(c).length&&(r.text=Object.assign({},r.text),r.text.caption=c),u&&(r.branding=u),r}(function(t,e){var n,r,i,o,a,s,c,u,l,d,p,h,f,y,g,m,v,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===(c=null==e?void 0:e.input)||void 0===c?void 0:c.borderRadius),borderColor:(null==t?void 0:t.fastlaneInputSettingsBorderColor)||(null===(u=null==e?void 0:e.input)||void 0===u?void 0:u.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===(g=null==e?void 0:e.text)||void 0===g?void 0:g.body)||void 0===m?void 0:m.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(v=null==e?void 0:e.text)||void 0===v?void 0:v.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 Yt(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}var Kt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Jt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceRequestSender=e,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(t){var e,n;return Kt(this,void 0,void 0,function*(){const{methodId:r,paypalcommercefastlane:i}=t;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new U('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new U('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 U('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:c,isFastlaneStylingEnabled:u}=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=Gt(u?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,!!c,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 Kt(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 R(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&$(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 V)}deinitialize(){return Kt(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=Yt(r)?r:{},o=this.paypalFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===rt.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return Kt(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:c,addresses:u,instruments:l}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:c,addresses:u,instruments:l}),s.authenticationState===rt.CANCELED?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return Kt(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 U('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new a;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return Kt(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 Kt(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)}),c=i.config.is3dsEnabled?yield this.get3DSNonce(s):s;yield this.createOrder(c);const{shouldSaveInstrument:u=!1,shouldSetAsDefaultInstrument:l=!1}=q(e)?e:{};return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:u,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:c}}})}})}createOrder(t){return Kt(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 Kt(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,s=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!s)throw new a;const c={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:t,threeDSRequested:this.threeDSVerificationMethod===X.Always,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}},u=yield s.isEligible(c);if(this.threeDSVerificationMethod===X.Always&&!u)throw new L;if(u){const{liabilityShift:t,authenticationState:e,nonce:n}=yield s.show();if(t===w.No||t===w.Unknown||e===Z.Errored||e===Z.Cancelled)throw new L;if(e===Z.Succeeded&&[w.Yes,w.Possible].includes(t))return n}return t})}handlePayPalStoredInstrumentChange(t){return Kt(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=Yt(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 Xt=i(t=>{const{getHost:e}=t.getState();return new Jt(t,new B((0,f.createRequestSender)({host:e()})),ct(),Tt())},[{id:"paypalcommerceacceleratedcheckout"}]);var Zt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class Qt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return Zt(this,void 0,void 0,function*(){const{paypalcommerce:e,methodId:n}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!e.container)throw new U('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new U('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.onError=e.onError||y.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 Zt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(t,e),Promise.resolve()})}signOut(t){return Zt(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}=e,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:u,paymentButtonStyles:l,isAppSwitchEnabled:d}=c.initializationData||{},{checkoutTopButtonStyles:p}=l||{},h=Object.assign(Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommerce"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)}),o&&{onClick:()=>o()}),f=Object.assign(Object.assign({},!d&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,a)}),y=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},p),{height:40}))},h),u&&f),g=s.Buttons(y);g.isEligible()?(null===(n=g.hasReturned)||void 0===n?void 0:n.call(g))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(r=g.resume)||void 0===r||r.call(g):g.render(`#${i}`):this.paypalCommerceIntegrationService.removeElement(i)}onHostedCheckoutApprove(e,n,r,i){return Zt(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Zt(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 Zt(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)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const te=i(t=>new Qt(t,D(t)),[{id:"paypalcommerce"}]);var ee=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class ne{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return ee(this,void 0,void 0,function*(){const{paypalcommercecredit:e,methodId:n}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!e.container)throw new U('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new U('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=e.onError||y.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 ee(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return ee(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:c,isAppSwitchEnabled:u}=a.initializationData||{},{checkoutTopButtonStyles:l}=c||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!u&&{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(e,n,r,i){return ee(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return ee(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 ee(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 re=i(t=>new ne(t,D(t)),[{id:"paypalcommercecredit"}]);var ie=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class oe{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return ie(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,methodId:n}=t;if(!n)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!e.container)throw new U('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new U('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 ie(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return ie(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||{},c=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()}),u=i.Buttons(c);u.isEligible()?u.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const ae=i(t=>new oe(t,D(t)),[{id:"paypalcommercevenmo"}]);var se=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class ce{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalSdkScriptLoader=e,this.paypalFastlaneUtils=n}initialize(t){var e;return se(this,void 0,void 0,function*(){const{methodId:n,paypalcommercefastlane:r}=t;if(!n)throw new U('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 se(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(t,e){return se(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return se(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){return se(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new U('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new U('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 se(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),c=s.authenticationState===rt.CANCELED;yield this.updateCustomerDataState(t,s),c?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return se(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:c}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,e);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:c}),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)||[],c=a[0],u=a.find(t=>t.isRecommended);if((u||c)&&i){const t=(null==u?void 0:u.id)||c.id;yield this.paymentIntegrationService.selectShippingOption(t)}}})}getFastlaneStyles(t,e){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return Gt(i?r:{},null==e?void 0:e.styles)}}const ue=i(t=>new ce(t,ct(),Tt()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);var le=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class de{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}initialize(t){var e;return le(this,void 0,void 0,function*(){const{paypalcommerce:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new U('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 U('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)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){var r,i;const{buyNowInitializeOptions:o,style:a,onComplete:s,onEligibilityFailure:c}=n,u=this.paypalIntegrationService.getPayPalSdkOrThrow(),l=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:d,isAppSwitchEnabled:p}=l.initializationData||{},h=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(e)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>le(this,void 0,void 0,function*(){if(o){const t=yield this.paypalIntegrationService.createBuyNowCartOrThrow(o);yield this.paymentIntegrationService.loadCheckout(t.id)}return this.paypalIntegrationService.createOrder("paypalcommerce")}),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)}),f={onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},y=Object.assign(Object.assign({},!p&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,s)}),g=Object.assign(Object.assign(Object.assign({fundingSource:u.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(a)},h),o&&f),d&&y),m=u.Buttons(g);m.isEligible()?(null===(r=m.hasReturned)||void 0===r?void 0:r.call(m))&&this.isPaypalCommerceAppSwitchEnabled(e)?null===(i=m.resume)||void 0===i||i.call(m):m.render(`#${t}`):c&&"function"==typeof c?c():this.paypalIntegrationService.removeElement(t)}onHostedCheckoutApprove(e,n,r,i){return le(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return le(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 le(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}})}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const pe=i(t=>new de(t,ht(t)),[{id:"paypalcommerce"}]);var he=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class fe{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalCommerceSdk=n}initialize(t){var e;return he(this,void 0,void 0,function*(){const{paypalcommercecredit:n,containerId:r,methodId:i}=t,{buyNowInitializeOptions:o,currencyCode:a,messagingContainerId:s}=n||{},c=!!o;if(!i)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(c&&!a)throw new U('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(c&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new U('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');c||(yield this.paymentIntegrationService.loadDefaultCheckout());const u=this.paymentIntegrationService.getState(),l=c?a:u.getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(i,l,!1),this.renderButton(r,i,n);const d=u.getStoreConfigOrThrow().checkoutSettings.features;if(null!==(e=d["PAYPAL-5557.Hide_ppc_banner_implementation"])&&void 0!==e&&e)return;const p=s&&document.getElementById(s);if(l&&p){const t=u.getPaymentMethodOrThrow(i),{paypalBNPLConfiguration:e=[]}=t.initializationData||{},n=e&&e.find(({id:t})=>"cart"===t);if(!(null==n?void 0:n.status))return;p.removeAttribute("data-pp-style-logo-type"),p.removeAttribute("data-pp-style-logo-position"),p.removeAttribute("data-pp-style-text-color"),p.removeAttribute("data-pp-style-text-size");const r=yield this.paypalCommerceSdk.getPayPalMessages(t,l);this.renderMessages(r,s,n)}})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:u,isAppSwitchEnabled:l}=c.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),u&&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 he(this,void 0,void 0,function*(){if(t){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(e,n,r,i){return he(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),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:r}}),yield this.paypalIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return he(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 he(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}})}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"cart",style:gt(n)};t.Messages(r).render(`#${e}`)}}const ye=i(t=>new fe(t,ht(t),ct()),[{id:"paypalcommercecredit"}]);var ge=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class me{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return ge(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 U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new U('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new U('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,c={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},u={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},c),r&&u),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===I.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return ge(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const ve=i(t=>new me(t,D(t)),[{id:"paypalcommercevenmo"}]);var be=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};const we=class{constructor(t,e){this.paymentIntegrationService=t,this.paypalIntegrationService=e}createPayPalButton(t,e,n,r=!1){const{style:i,fundingSource:o,onClick:a,onCancel:s,onPaymentComplete:c}=n,u=this.paypalIntegrationService.getPayPalSdkOrThrow();if(!Object.values(u.FUNDING).includes(o))throw new U('Unable to initialize PayPal button because "fundingSource" argument is not valid funding source.');const l={onShippingAddressChange:e=>this.onShippingAddressChange(e,t),onShippingOptionsChange:e=>this.onShippingOptionsChange(e,t),onApprove:(n,r)=>this.onHostedCheckoutApprove(n,r,e,t,c)};return u.Buttons(Object.assign(Object.assign(Object.assign({fundingSource:o,style:this.paypalIntegrationService.getValidButtonStyle(i),createOrder:()=>this.paypalIntegrationService.createOrder(t),onApprove:({orderID:t})=>this.paypalIntegrationService.tokenizePayment(e,t)},a?{onClick:a}:{}),s?{onCancel:s}:{}),r&&l))}onHostedCheckoutApprove(e,n,r,i,o){return be(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow(),c=yield n.order.get();try{const t=this.paypalIntegrationService.getBillingAddressFromOrderDetails(c);if(yield this.paymentIntegrationService.updateBillingAddress(t),a.lineItems.physicalItems.length>0){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(c);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalIntegrationService.updateOrder(i)}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalIntegrationService.submitPayment(r,e.orderID),o&&"function"==typeof o&&o(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t,e){return be(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){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t,e){return be(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){if("string"==typeof t)throw new Error(t);throw t}})}};var Se=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})};class _e{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalIntegrationService=e,this.paypalButtonCreationService=n}initialize(t){return Se(this,void 0,void 0,function*(){const{paypalcommercealternativemethods:e,containerId:n,methodId:r}=t,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=e||{},s=!!o;if(!r)throw new U('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new U('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');if(!i)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods.apm" argument is not provided.');if(s&&!a)throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new U('Unable to initialize payment because "options.paypalcommercealternativemethods.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');s||(yield this.paymentIntegrationService.loadDefaultCheckout());const c=s?a:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(r,c,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{apm:r,buyNowInitializeOptions:i,style:o,onEligibilityFailure:a}=n,s=Object.assign({fundingSource:r,style:o},i&&{onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()}),c=this.paypalButtonCreationService.createPayPalButton("paypalcommercealternativemethod",e,s);c.isEligible()?c.render(`#${t}`):a&&"function"==typeof a?a():this.paypalIntegrationService.removeElement(t)}handleClick(t){return Se(this,void 0,void 0,function*(){if(t){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const Ie=i(t=>{const e=ht(t),n=new we(t,e);return new _e(t,e,n)},[{id:"paypalcommercealternativemethods"}])})(),module.exports=r})();
|
|
3
3
|
//# sourceMappingURL=paypal-commerce.js.map
|