!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,n||"default");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"===e(n)?n:String(n)}function n(e,n,r){return(n=t(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function a(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){c(a,r,o,i,s,"next",e)}function s(e){c(a,r,o,i,s,"throw",e)}i(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(t){return l="function"==typeof Symbol&&"symbol"==e(Symbol.iterator)?function(t){return e(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},l(t)}function d(e){var t=function(e,t){if("object"!==l(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===l(t)?t:String(t)}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function p(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},v={exports:{}},m={exports:{}};!function(t){function n(r){return t.exports=n="function"==typeof Symbol&&"symbol"==e(Symbol.iterator)?function(t){return e(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},t.exports.__esModule=!0,t.exports.default=t.exports,n(r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(m),function(e){var t=m.exports.default;function n(){e.exports=n=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var r={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:k(e,n,c)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=f;var h={};function y(){}function v(){}function m(){}var g={};d(g,s,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(E([])));w&&w!==o&&a.call(w,s)&&(g=w);var _=m.prototype=y.prototype=Object.create(g);function O(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,n){function r(o,i,c,s){var u=p(e[o],e,i);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==t(d)&&a.call(d,"__await")?n.resolve(d.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):n.resolve(d).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,t){function a(){return new n((function(n,o){r(e,t,n,o)}))}return o=o?o.then(a,a):a()}})}function k(e,t,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=S(i,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=p(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function S(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,h;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function E(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:T}}function T(){return{value:void 0,done:!0}}return v.prototype=m,i(_,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:v,configurable:!0}),v.displayName=d(m,l,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,d(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},r.awrap=function(e){return{__await:e}},O(C.prototype),d(C.prototype,u,(function(){return this})),r.AsyncIterator=C,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new C(f(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},O(_),d(_,l,"Generator"),d(_,s,(function(){return this})),d(_,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},r.values=E,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(v);var g,b,w,_,O=v.exports(),C=O;try{regeneratorRuntime=O}catch(e){"object"===("undefined"==typeof globalThis?"undefined":l(globalThis))?globalThis.regeneratorRuntime=O:Function("r","regeneratorRuntime = r")(O)}function k(e){return(k="function"==typeof Symbol&&"symbol"==l(Symbol.iterator)?function(e){return l(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":l(e)})(e)}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function x(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||P(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function T(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function j(e){return j="function"==typeof Symbol&&"symbol"==k(Symbol.iterator)?function(e){return k(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":k(e)},j(e)}function A(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":j(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}(e,t)||P(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}!function(e){e.P0="P0",e.P1="P1",e.P2="P2"}(g||(g={})),function(e){e.Start="Start",e.Success="Success",e.Failure="Failure"}(b||(b={})),function(e){e.Info="info",e.Log="log",e.Warn="warn",e.Error="error"}(w||(w={}));var N=new Uint8Array(16);function B(){if(!_&&!(_="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _(N)}for(var M=[],R=0;R<256;++R)M.push((R+256).toString(16).slice(1));var F={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function U(e,t,n){if(F.randomUUID&&!t&&!e)return F.randomUUID();var r=(e=e||{}).random||(e.rng||B)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(M[e[t+0]]+M[e[t+1]]+M[e[t+2]]+M[e[t+3]]+"-"+M[e[t+4]]+M[e[t+5]]+"-"+M[e[t+6]]+M[e[t+7]]+"-"+M[e[t+8]]+M[e[t+9]]+"-"+M[e[t+10]]+M[e[t+11]]+M[e[t+12]]+M[e[t+13]]+M[e[t+14]]+M[e[t+15]]).toLowerCase()}(r)}var H=function(e){return function(t,n,r){var o=r.value;r.value=function(){try{for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return o.apply(this,r)}catch(t){return window[window.__sl_console__?"__sl_console__":"console"].error("logger: There is an error in the execution of method ".concat(n),t),e}}}},q=function(e){return e.reduce((function(e,t){var n={};try{n=t()}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("There is an error in the calculation list results.",e)}return Object.assign(Object.assign({},e),n)}),{})},G=function(e){var t=window.__SL_LOGGER__;if(t)return t[e]},Y=function(e,t){window.__SL_LOGGER__||(window.__SL_LOGGER__={}),window.__SL_LOGGER__[e]=t},V=function(e){return"string"==typeof e?e:"Request"in window&&e instanceof Request?e.url:String(e)},z=function(e){return e instanceof Request},W=function(){var e,t=null,n={},r=arguments.length<=0?void 0:arguments[0];return e=V(r),z(r)&&(t=r),(arguments.length<=1?void 0:arguments[1])&&(n=arguments.length<=1?void 0:arguments[1]),[e,t,n]},K=function(){return U()},X=["localhost",/^\/(?!\/).*$/],J=function(){function e(){I(this,e),this.fnList=[],this.get()}return T(e,[{key:"get",value:function(){var e,t,n=sessionStorage.getItem("SL_LOGGER_SESSION_ID"),r=(e=document.cookie.split("; "),t={},e.forEach((function(e){var n=D(e.split("="),2),r=n[0],o=n[1];r&&(t[r]=o||"")})),t.log_session_id||"");if(n)return n!==r&&this.updateId(n),n;var o=U();return this.updateId(o),o}},{key:"set",value:function(e){return!!e&&(this.updateId(e),this.fnList.forEach((function(t){return t(e)})),!0)}},{key:"refresh",value:function(){var e=U();return this.updateId(e),this.fnList.forEach((function(t){return t(e)})),!0}},{key:"onChange",value:function(e){this.fnList.push(e)}},{key:"updateId",value:function(e){sessionStorage.setItem("SL_LOGGER_SESSION_ID",e),function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",r="".concat(e,"=").concat(t);n&&(r+="; path=".concat(n)),document.cookie=r}("log_session_id",e)}}]),e}();A([H("")],J.prototype,"get",null),A([H(!1)],J.prototype,"set",null),A([H(!1)],J.prototype,"refresh",null),A([H()],J.prototype,"onChange",null),A([H()],J.prototype,"updateId",null);var $=new J,Z=function(){function e(){I(this,e),this.fnList=[],this.get()}return T(e,[{key:"get",value:function(){var e=localStorage.getItem("SL_LOGGER_CLIENT_ID");if(e)return e;var t=U();return this.set(t),t}},{key:"set",value:function(e){return!!e&&(localStorage.setItem("SL_LOGGER_CLIENT_ID",e),this.fnList.forEach((function(t){return t(e)})),!0)}},{key:"refresh",value:function(){var e=U();return this.set(e),!0}},{key:"onChange",value:function(e){this.fnList.push(e)}}]),e}();A([H("")],Z.prototype,"get",null),A([H(!1)],Z.prototype,"set",null),A([H(!1)],Z.prototype,"refresh",null),A([H()],Z.prototype,"onChange",null);var Q,ee=new Z;!function(e){e.InstrumentFetch="instrumentFetch",e.InstrumentXHR="instrumentXHR"}(Q||(Q={}));var te=function(){function e(t,n){I(this,e),this.idType="sessionId",this.sessionId=t,this.clientId=n,this.instrumentFetch(),this.instrumentXHR()}return T(e,[{key:"setIdType",value:function(e){this.idType=e}},{key:"getSessionId",value:function(){return"sessionId"===this.idType?this.sessionId.get():this.clientId.get()}},{key:"instrumentFetch",value:function(){if(window.fetch&&"function"==typeof window.fetch&&!0!==G(Q.InstrumentFetch)){Y(Q.InstrumentFetch,!0);var e=this,t=window.fetch;window.fetch=function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];try{var a=D(W.apply(void 0,r),3),i=a[0],c=a[1],s=a[2],u=e.getSessionId(),l=K();if(e.needAddHeader(i)){var d,f=s.headers;if(c&&(f=c.headers),f)if("function"==typeof f.append)f.append("Log-Session-Id",u),f.append("X-Request-Id",l);else if(Array.isArray(f))f=[].concat(x(f),[["Log-Session-Id",u],["X-Request-Id",l]]);else{var p;f=Object.assign(Object.assign({},f),(L(p={},"Log-Session-Id",u),L(p,"X-Request-Id",l),p))}else L(d={},"Log-Session-Id",u),L(d,"X-Request-Id",l),f=d;s.headers=f}}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("instrumentFetch error",e)}return t.apply(window,r)}}}},{key:"instrumentXHR",value:function(){if(window.XMLHttpRequest&&"function"==typeof window.XMLHttpRequest&&!0!==G(Q.InstrumentXHR)){Y(Q.InstrumentXHR,!0);var e=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];try{var o=n[1],a="string"==typeof o?o:o.toString();this.__logger_xhr_info__={url:a}}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("instrumentXHR open error",e)}return e.apply(this,n)};var t=this,n=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){var e;try{var r=t.getSessionId(),o=K();t.needAddHeader((null===(e=this.__logger_xhr_info__)||void 0===e?void 0:e.url)||"")&&(this.setRequestHeader("Log-Session-Id",r),this.setRequestHeader("X-Request-Id",o))}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("instrumentXHR send error",e)}for(var a=arguments.length,i=new Array(a),c=0;c<a;c++)i[c]=arguments[c];return n.apply(this,i)}}}},{key:"needAddHeader",value:function(e){return X.some((function(t){return t instanceof RegExp?t.test(e):"string"==typeof t&&-1!==e.indexOf(t)}))}}]),e}();new te($,ee);var ne=function(){function e(t){I(this,e),this.options={owner:"",action:"",tags:{},getTagsFn:[],data:{},getDataFn:[],transports:[]},this.options=Object.assign(Object.assign({},this.options),t)}return T(e,[{key:"withOwner",value:function(e){return new this.constructor(Object.assign(Object.assign({},this.options),{owner:e}))}},{key:"pipeOwner",value:function(e){return e?(t=this.options.owner?"".concat(this.options.owner,".").concat(e):e,new this.constructor(Object.assign(Object.assign({},this.options),{owner:t}))):this;var t}},{key:"withAction",value:function(e){return new this.constructor(Object.assign(Object.assign({},this.options),{action:e}))}},{key:"pipeTags",value:function(e){return e?"function"==typeof e?new this.constructor(Object.assign(Object.assign({},this.options),{getTagsFn:[].concat(x(this.options.getTagsFn),[e])})):new this.constructor(Object.assign(Object.assign({},this.options),{tags:Object.assign(Object.assign({},this.options.tags),e)})):this}},{key:"pipeData",value:function(e){return e?"function"==typeof e?new this.constructor(Object.assign(Object.assign({},this.options),{getDataFn:[].concat(x(this.options.getDataFn),[e])})):new this.constructor(Object.assign(Object.assign({},this.options),{data:Object.assign(Object.assign({},this.options.data),e)})):this}},{key:"pipeTransport",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this.options.transports.concat(t);return new this.constructor(Object.assign(Object.assign({},this.options),{transports:r}))}},{key:"report",value:function(e,t,n){var r=function(e){var t,n=e.level,r=e.message,o=e.context,a=e.options,i=q(a.getTagsFn),c=q(a.getDataFn),s=Object.assign(Object.assign({level:n,owner:a.owner,action:a.action},o),{tags:Object.assign(Object.assign({},a.tags),i),data:Object.assign(Object.assign({},a.data),c),message:r});return(null==o?void 0:o.data)&&(t=o.data,"[object Object]"===Object.prototype.toString.call(t))?s.data=Object.assign(Object.assign({},s.data),o.data):void 0!==(null==o?void 0:o.data)&&(s.data=Object.assign(Object.assign({},s.data),{custom_data:o.data})),o&&"tags"in o&&o.tags&&(s.tags=Object.assign(Object.assign({},s.tags),o.tags)),o&&"errorLevel"in o&&o.errorLevel&&(s.tags=Object.assign(Object.assign({},s.tags),{errorLevel:o.errorLevel})),s}({level:e,message:t,context:n,options:this.options});!function(e,t){var n=e;t.forEach((function(e){var t=e(n);t&&(n=t)}))}(r,this.options.transports)}},{key:"info",value:function(e,t){this.report(w.Info,e,t)}},{key:"log",value:function(e,t){this.report(w.Log,e,t)}},{key:"warn",value:function(e,t){this.report(w.Warn,e,t)}},{key:"error",value:function(e,t){this.report(w.Error,e,t)}}]),e}();A([H(new ne)],ne.prototype,"withOwner",null),A([H(new ne)],ne.prototype,"pipeOwner",null),A([H(new ne)],ne.prototype,"withAction",null),A([H(new ne)],ne.prototype,"pipeTags",null),A([H(new ne)],ne.prototype,"pipeData",null),A([H(new ne)],ne.prototype,"pipeTransport",null),A([H(new ne)],ne.prototype,"info",null),A([H(new ne)],ne.prototype,"log",null),A([H(new ne)],ne.prototype,"warn",null),A([H(new ne)],ne.prototype,"error",null);var re=new ne;Object.defineProperty(re,"options",{writable:!1,configurable:!1});var oe=new ne,ae={get:function(){return oe},set:function(e){e&&(oe=e)}};function ie(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function ce(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ie(a,r,o,i,c,"next",e)}function c(e){ie(a,r,o,i,c,"throw",e)}i(void 0)}))}}function se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ue(e){var t=function(e,t){if("object"!==k(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===k(t)?t:String(t)}function le(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ue(r.key),r)}}function de(e,t,n){return t&&le(e.prototype,t),n&&le(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function fe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(e,t){return pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pe(e,t)}function he(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pe(e,t)}function ye(e,t){if(t&&("object"===k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return fe(e)}function ve(e){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ve(e)}function me(e,t,n){return(t=ue(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ge="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},be={exports:{}},we={exports:{}};!function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==l(Symbol.iterator)?function(e){return l(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":l(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(we),function(e){var t=we.exports.default;function n(){e.exports=n=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var r={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:k(e,n,c)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=f;var h={};function y(){}function v(){}function m(){}var g={};d(g,s,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(E([])));w&&w!==o&&a.call(w,s)&&(g=w);var _=m.prototype=y.prototype=Object.create(g);function O(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,n){function r(o,i,c,s){var u=p(e[o],e,i);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==t(d)&&a.call(d,"__await")?n.resolve(d.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):n.resolve(d).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,t){function a(){return new n((function(n,o){r(e,t,n,o)}))}return o=o?o.then(a,a):a()}})}function k(e,t,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=S(i,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=p(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function S(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,h;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function E(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:T}}function T(){return{value:void 0,done:!0}}return v.prototype=m,i(_,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:v,configurable:!0}),v.displayName=d(m,l,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,d(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},r.awrap=function(e){return{__await:e}},O(C.prototype),d(C.prototype,u,(function(){return this})),r.AsyncIterator=C,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new C(f(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},O(_),d(_,l,"Generator"),d(_,s,(function(){return this})),d(_,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},r.values=E,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(be);var _e=be.exports(),Oe=_e;try{regeneratorRuntime=_e}catch(zu){"object"===("undefined"==typeof globalThis?"undefined":k(globalThis))?globalThis.regeneratorRuntime=_e:Function("r","regeneratorRuntime = r")(_e)}var Ce={exports:{}};Ce.exports=function(){var e=function(){},t={},n={},r={};function o(e,t){if(e){var o=r[e];if(n[e]=t,o)for(;o.length;)o[0](e,t),o.splice(0,1)}}function a(t,n){t.call&&(t={success:t}),n.length?(t.error||e)(n):(t.success||e)(t)}function i(t,n,r,o){var a,c,s=document,u=r.async,l=(r.numRetries||0)+1,d=r.before||e,f=t.replace(/[\?|#].*$/,""),p=t.replace(/^(css|img)!/,"");o=o||0,/(^css!|\.css$)/.test(f)?((c=s.createElement("link")).rel="stylesheet",c.href=p,(a="hideFocus"in c)&&c.relList&&(a=0,c.rel="preload",c.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(f)?(c=s.createElement("img")).src=p:((c=s.createElement("script")).src=t,c.async=void 0===u||u),c.onload=c.onerror=c.onbeforeload=function(e){var s=e.type[0];if(a)try{c.sheet.cssText.length||(s="e")}catch(e){18!=e.code&&(s="e")}if("e"==s){if((o+=1)<l)return i(t,n,r,o)}else if("preload"==c.rel&&"style"==c.as)return c.rel="stylesheet";n(t,s,e.defaultPrevented)},!1!==d(t,c)&&s.head.appendChild(c)}function c(e,t,n){var r,o,a=(e=e.push?e:[e]).length,c=a,s=[];for(r=function(e,n,r){if("e"==n&&s.push(e),"b"==n){if(!r)return;s.push(e)}--a||t(s)},o=0;o<c;o++)i(e[o],r,n)}function s(e,n,r){var i,s;if(n&&n.trim&&(i=n),s=(i?r:n)||{},i){if(i in t)throw"LoadJS";t[i]=!0}function u(t,n){c(e,(function(e){a(s,e),t&&a({success:t,error:n},e),o(i,e)}),s)}if(s.returnPromise)return new Promise(u);u()}return s.ready=function(e,t){return function(e,t){e=e.push?e:[e];var o,a,i,c=[],s=e.length,u=s;for(o=function(e,n){n.length&&c.push(e),--u||t(c)};s--;)a=e[s],(i=n[a])?o(a,i):(r[a]=r[a]||[]).push(o)}(e,(function(e){a(t,e)})),s},s.done=function(e){o(e,[])},s.reset=function(){t={},n={},r={}},s.isDefined=function(e){return e in t},s}();var ke,Se,Pe,xe,Ie,Ee,Te,je,Ae,Le,De,Ne,Be,Me,Re,Fe,Ue,He=Ce.exports;!function(e){e.Init="init",e.PullUpChannel="pullUpChannel",e.CreateOrder="createOrder",e.Pay="pay",e.Hooks="Hooks",e.CreateExpected="createExpected",e.ReRender="rerender"}(ke||(ke={})),function(e){e.Continue="continue",e.PayNow="pay_now",e.All="all"}(Se||(Se={})),function(e){e.AdyenExpress="AdyenExpress",e.Paypal="Paypal",e.SLpayments="SLpayments",e.StripeOther="StripeOther",e.Tyro="TyroWindows",e.CybsOther="CybsOther"}(Pe||(Pe={})),function(e){e.Paypal="Paypal",e.GooglePay="GooglePay",e.ApplePay="ApplePay"}(xe||(xe={})),(Ie||(Ie={})).StandardEC="standard_ec",(Ee||(Ee={})).Prod="prod",function(e){e.Done="done",e.Pending="pending",e.Await="await",e.Fail="fail"}(Te||(Te={})),function(e){e[e.Fail=0]="Fail",e[e.Success=1]="Success"}(je||(je={})),function(e){e.Ordinary="ordinary",e.ChangeAddress="change_address",e.ChangeDeliveryMethod="change_delivery_method",e.UseDiscountCode="use_discount_code"}(Ae||(Ae={})),(Le||(Le={})).PAYMENT_OPEN="PAYMENT_OPEN",function(e){e.NetworkUnstable="networkUnstable",e.RateLimited="rateLimited",e.Other="other"}(De||(De={})),function(e){e.Init="init",e.RedirectOrPopup="RedirectOrPopup",e.Redirect="Redirect",e.ChannelInfoUpdate="ChannelInfoUpdate",e.ChannelConfirm="ChannelConfirm",e.OpenIframe="OpenIframe",e.Confirm="Confirm",e.Challenge="Challenge",e.Gather="Gather"}(Ne||(Ne={})),function(e){e.GET="GET",e.POST="POST"}(Be||(Be={})),function(e){e.PAY_AND_BIND="PAY_AND_BIND",e.PAY_NORMAL="PAY_NORMAL"}(Me||(Me={})),function(e){e.Hidden="Hidden",e.Visible="Visible"}(Re||(Re={})),function(e){e.Form="Form",e.Direct="Direct",e.Both="Both"}(Fe||(Fe={})),function(e){e.Confirm="Confirm",e.Init="Init",e.I18n="I18n",e.SaveAbandonOrder="SaveAbandonOrder",e.ExpressFirstLoad="ExpressFirstLoad",e.ExpressUpdateDetail="ExpressUpdateDetail"}(Ue||(Ue={}));var qe="paypal",Ge="rememberedCb",Ye={props:{payMode:Se.Continue,buttonTimeoutConfig:{enable:!1,timeoutMillis:5e3},styleOptions:{layout:"horizontal",color:"gold",shape:"rect",label:"paypal",tagline:!1,height:55},timing:!1,currency:"USD"}};function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var We,Ke=function(){function e(t){var n;se(this,e),me(this,"initialData",void 0),me(this,"paypalInstanceName",void 0),this.initialData=t,this.paypalInstanceName=(null==t||null===(n=t.scriptParams)||void 0===n?void 0:n["data-namespace"])||qe,window.__PAYPALSPB_LOADJS||(window.__PAYPALSPB_LOADJS=He,window.__PAYPALSPB_LOADJS.ids={})}var t;return de(e,[{key:"render",value:(t=ce(Oe.mark((function e(){var t,n,r,o,a,i,c,s=this;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="https://www.paypal.com/sdk/js",null!==(t=this.initialData)&&void 0!==t&&t.queryParams&&(r+="".concat(this.initialData.queryParams)),o=r,a={},null!==(n=this.initialData)&&void 0!==n&&n.scriptParams&&(c=(null===(i=this.initialData)||void 0===i?void 0:i.scriptParams)||{},a.before=function(e,t){Object.keys(c).forEach((function(e){var n=c[e];n&&t.setAttribute(e,n)}))},null!=c&&c["data-namespace"]&&(this.paypalInstanceName=c["data-namespace"]),Object.keys(c).forEach((function(e){var t=c[e];o+="".concat(e,"&").concat(t)}))),window.__PAYPALSPB_LOADJS.ids[o]||(window.__PAYPALSPB_LOADJS.ids[o]=window.__PAYPALSPB_LOADJS([r],ze(ze({},a),{},{returnPromise:!0}))),e.abrupt("return",window.__PAYPALSPB_LOADJS.ids[o].then((function(){s.initPaypal()})).catch((function(e){throw window.__PAYPALSPB_LOADJS.ids[o]=!1,e})));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),Xe=function(e){he(n,Ke);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(n);function n(e){return se(this,n),t.call(this,e)}return de(n,[{key:"initPaypal",value:function(){var e,t=null===(e=this.initialData.style)||void 0===e?void 0:e["border-radius"],n=ze({},this.initialData);n.style||(n.style={}),n.style.shape=t>=10?"pill":"rect";var r=document.querySelector("#".concat(this.initialData.domId," .").concat("paypal-buttons"));r&&r.remove(),window[this.paypalInstanceName].Buttons(this.initialData).render("#".concat(this.initialData.domId))}}]),n}(),Je=function(){function e(){se(this,e),me(this,"handlers",[])}return de(e,[{key:"use",value:function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){this.handlers.forEach((function(t){null!==t&&e(t)}))}}]),e}();function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$e(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Qe={maxCount:3,interval:1e3},et={};function tt(e,t){if(!e)return null;var n=et[e]||{};return n=Ze(Ze(Ze(Ze({},n),Qe),t),{},{retryCount:n.retryCount||0}),et[e]=n,n}var nt=function(e){return e.useRetry&&e.action},rt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"xhr";return JSON.parse(JSON.stringify(e,(function(e,n){if(e!==t)return n})))};function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it=function(){function e(t){se(this,e),me(this,"options",{}),me(this,"interceptors",{}),me(this,"getLogData",(function(e){return{readyState:e.readyState,status:e.status,statusText:e.statusText,timeout:e.timeout,withCredentials:e.withCredentials}})),me(this,"serialize",(function(e){var t=Object.prototype.toString.call(e);return e&&"[object Object]"===t?Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&"):""})),this.options=t||{},this.interceptors={request:new Je,response:new Je}}return de(e,[{key:"logger",get:function(){return ae.get().pipeOwner("payment-common.request")}},{key:"setOptions",value:function(e){this.options=e}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=this.buildUrl(e,null==t?void 0:t.params),this.http(e,at(at(at({method:"GET"},this.options),t),{},{headers:at(at({},{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"}),t.headers)}))}},{key:"post",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={Accept:"application/json"},o=t||n.data||null;return"form"===n.requestType?(r["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8",o=this.serialize(o)):(r["Content-Type"]="application/json;charset=UTF-8",o=o?JSON.stringify(o):null),this.http(e,at(at(at({method:"POST",body:o},this.options),n),{},{headers:at(at({},r),n.headers)}))}},{key:"dispatchRequest",value:function(e,t){var n=this;return new Promise((function(r,o){var a=new window.XMLHttpRequest,i=!1,c=t.body,s=n.options.baseUrl&&!/^(https?:)?(\/\/)/.test(e)?"".concat(n.options.baseUrl).concat(e):e;a.open(t.method||"",s),t.headers&&Object.keys(t.headers).forEach((function(e){var n;a.setRequestHeader(e,(null===(n=t.headers)||void 0===n?void 0:n[e])||"")}));var u={options:t,url:s};if(a.onreadystatechange=function(){if(4===a.readyState){u.statusCode=a.status;var e="";try{e=JSON.parse(a.responseText)}catch(t){e=a.responseText}if(/^(2|3)\d{2}$/.test(a.status.toString())){try{r(at({data:e},u))}catch(t){r(at({data:e},u))}return}o(at({data:e},u))}},a.send(c),a.onabort=function(t){i=!0,n.logger.error("xhr_onabort",{data:at(at({},n.getLogData(a)),{},{url:e})}),u.statusCode=a.status,t=rt(t),o(at({error:t},u))},a.onerror=function(t){n.logger.error("xhr_onerror",{data:at(at({},n.getLogData(a)),{},{url:e})}),u.statusCode=a.status,t=rt(t),o(at({error:t},u))},a.ontimeout=function(){n.logger.error("xhr_ontimeout",{data:at(at({},n.getLogData(a)),{},{url:e,withCredentials:a.withCredentials})})},t.timeout){if(i)return;setTimeout((function(){a.abort();var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",n.logger.error("xhr_timeout",{data:{url:e}}),u.statusCode=a.status,o(at({error:t},u))}),t.timeout)}}))}},{key:"http",value:function(e,t){var n,r,o,a,i=[];null===(n=this.interceptors)||void 0===n||null===(r=n.request)||void 0===r||r.forEach((function(e){i.unshift(e.fulfilled,e.rejected)}));var c,s=[];null===(o=this.interceptors)||void 0===o||null===(a=o.response)||void 0===a||a.forEach((function(e){s.push(e.fulfilled,e.rejected)}));for(var u=t;i.length;){var l=i.shift(),d=i.shift();try{l&&(u=l(u))}catch(e){d&&d(e);break}}try{c=this.dispatchRequest(e,u)}catch(e){return Promise.reject(e)}for(;s.length;){var f=s.shift(),p=s.shift();c=c.then(f,p)}return c}},{key:"buildUrl",value:function(e,t){var n=Object.prototype.toString.call(t);if(!t||"[object Object]"!==n)return e;var r=Object.keys(t);return(e=decodeURIComponent(e).indexOf("?")>-1?"".concat(e,"&"):"".concat(e,"?"))+r.map((function(e){return"".concat(e,"=").concat(t[e])})).join("&")}}]),e}(),ct=new it;function st(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}!function(e){var t,n,r,o;null==e||null===(t=e.interceptors)||void 0===t||null===(n=t.request)||void 0===n||n.use((function(e){We||(We=ae.get().pipeOwner("payment-common.retry"));var t=tt(e.action);return nt(e)&&t?(t.lastRequestTime=Date.now(),e):e})),null==e||null===(r=e.interceptors)||void 0===r||null===(o=r.response)||void 0===o||o.use(null,(function(t){var n=t.options,r=t.url;if(!n)return Promise.reject(t);var o=tt(n.action,n.retryOptions);if(!nt(n)||!o)return Promise.reject(t);var a=function(e,t,n){if(!e)return!1;if(!function(e,t){switch(e){case Ue.Init:case Ue.SaveAbandonOrder:case Ue.ExpressFirstLoad:case Ue.ExpressUpdateDetail:return function(e){return!!e&&400!==e.statusCode}(t);case Ue.I18n:return!0;default:return!1}}(e,n))return!1;var r,o,a=t.retryCount<(null==t?void 0:t.maxCount),i=n.statusCode,c={action:e,statusCode:i,url:n.url};return a?null===(r=We)||void 0===r||r.log("start_retry",{data:Ze(Ze({},c),{},{retryCount:t.retryCount})}):(null===(o=We)||void 0===o||o.error("retry_max_times",{data:c,errorLevel:0===i?g.P2:g.P1}),t.retryCount=0),a}(n.action,o,t);if(a){if(o.retryCount+=1,n.timeout&&o.lastRequestTime){var i=Date.now()-o.lastRequestTime;n.timeout=Math.max(n.timeout-i-o.interval,1)}return new Promise((function(t){return setTimeout((function(){t(e.http(r,n))}),o.interval)}))}return Promise.reject(t)}))}(ct);var ut=function(e){return ct.post("/leproxy/api/trade/center/pay/fast-checkout/prepare-pay",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?st(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):st(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e))};function lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return lt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ft=function(e){return"function"==typeof e};function pt(e){return"[object Object]"===Object.prototype.toString.call(e)}function ht(e){return!e||e.nodeType||"object"!==k(e)?e:JSON.parse(JSON.stringify(e))}function yt(e,t){if(function(e){return function(e){return void 0===e}(e)||function(e){return null===e}(e)}(t))return ht(e);if(!pt(t)||!pt(e))return ht(t);var n={};return Object.keys(e).map((function(r){n[r]=yt(e[r],t[r])})),Object.keys(t).map((function(e){n[e]||(n[e]=ht(t[e]))})),n}var vt=window.performance&&"function"==typeof window.performance.now?window.performance:Date,mt=function e(t){t instanceof Array?t.forEach((function(t){return e(t)})):"object"===k(t)&&null!==t&&Object.entries(t).forEach((function(n){var r=dt(n,2),o=r[0],a=r[1];null===a?delete t[o]:a instanceof Array?a.forEach((function(t){return e(t)})):"object"===k(a)&&e(a)}))},gt=function(){var e=ce(Oe.mark((function e(t){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return setTimeout(e,t)})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),bt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{retries:5,interval:1e3},n=function(){var r=ce(Oe.mark((function r(){var o,a=arguments;return Oe.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e.apply(void 0,a);case 3:return o=r.sent,r.abrupt("return",o);case 7:if(r.prev=7,r.t0=r.catch(0),0!==t.retries){r.next=11;break}throw r.t0;case 11:return t.retries--,r.next=14,gt(t.interval);case 14:return r.abrupt("return",n.apply(void 0,a));case 15:case"end":return r.stop()}}),r,null,[[0,7]])})));return function(){return r.apply(this,arguments)}}();return n},wt=ae.get();function _t(e){var t=e.prototype,n={validate:t.validate,handleError:t.handleError,handleDynamicNotify:t.handleDynamicNotify,dynamicJsonpCallback:t.dynamicJsonpCallback,handleDynamic:t.handleDynamic,handleRenderTimeout:t.handleRenderTimeout,beforeInit:t.beforeInit,beforeCreateOrder:t.beforeCreateOrder,afterCreateOrder:t.afterCreateOrder,removeSkeleton:t.removeSkeleton};Object.keys(n).forEach((function(t){e.prototype[t]=function(e){return ce(Oe.mark((function t(){var r,o,a,i,c=arguments;return Oe.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r="【".concat(e,"】"),t.prev=1,wt.info("".concat(r,"[execution started]")),o=c.length,a=new Array(o),i=0;i<o;i++)a[i]=c[i];return t.abrupt("return",n[e].apply(this,a));case 7:throw t.prev=7,t.t0=t.catch(1),wt.error("".concat(r,"[execution failed]"),{error:t.t0}),t.t0;case 11:case"end":return t.stop()}}),t,this,[[1,7]])})))}(t)}))}var Ot,Ct="smart-payment-hide",kt="smart-payment-button-disabled",St="smart-payment-button-loading",Pt="express_common_style_id",xt=de((function e(t){var n=this;se(this,e),me(this,"config",void 0),me(this,"isVisible",!0),me(this,"showButton",(function(){var e=document.getElementById(n.config.paymentInfo.currentDomId);null==e||e.classList.remove(Ct),n.isVisible=!0})),me(this,"hideButton",(function(){var e=document.getElementById(n.config.paymentInfo.currentDomId);null==e||e.classList.add(Ct),n.isVisible=!1})),this.config=t})),It=function(e,t){var n=Object.entries(t).filter((function(e){var t=dt(e,2),n=t[0],r=t[1];return n&&null!=r&&""!==r})).map((function(e){var t=dt(e,2),n=t[0],r=t[1];return"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(String(r)))}));if(!n.length)return e;var r=-1===e.search(/\?/)?"?":"&";return e+r+n.join("&")},Et=function(e){return/^https:\/\/([^.]+)?\.myshopline([^.]+)?\.com$/.test(e)},Tt=function(e){return new URL(e).origin},jt=function(){function e(t,n){var r=this;se(this,e),me(this,"type",void 0),me(this,"domId",void 0),me(this,"payOptions",void 0),me(this,"timer",null),me(this,"resolveFn",void 0),me(this,"rejectFn",void 0),me(this,"logger",ae.get().pipeOwner("payment-common.3DS")),me(this,"handlePostmessage",(function(e){var t=e.data,n=e.origin;if(!1!==Et(n)){r.logger.log("3DS_handlePostmessage",{data:{data:t,origin:n,domId:r.domId}});var o=t.success,a=t.nextAction||{},i=t.nextAction||{},c=i.url,s=i.type;if(o){if(s===Ne.Redirect&&c){if(window.removeEventListener("message",r.handlePostmessage,!1),r.domId){var u=document.getElementById(r.domId);u&&u.parentElement&&u.parentElement.removeChild(u)}return on(a),void(r.resolveFn&&r.resolveFn())}if(s===Ne.OpenIframe)return r.openIframe(t.nextAction),void(r.resolveFn&&r.resolveFn());r.logger.error("do not match nextAction type",{data:{nextAction:a},error:new Error("")}),r.rejectFn&&r.rejectFn(new Error("do not match nextAction type"))}}})),this.type=t,this.payOptions=n}return de(e,[{key:"handleIframe",value:function(e){var t,n=e.type,r=e.iframeType,o=e.url,a=void 0===o?"":o,i=e.size,c="".concat(n,"Iframe-").concat(Date.now());return this.domId=c,r===Re.Hidden?t=function(e,t){var n=document.createElement("iframe");return n.src=e,n.name=t,n.style.width="1px",n.style.height="1px",n.style.display="none",n.style.border="none",document.body.appendChild(n),n}(a,c):r===Re.Visible&&(t=function(e,t,n){var r,o,a=document.createElement("iframe");a.src=e,a.name=t,a.style.width=(null==n||null===(r=n.size)||void 0===r?void 0:r.width)||"100%",a.style.height=(null==n||null===(o=n.size)||void 0===o?void 0:o.height)||"100%",a.style.display="block",a.style.border="none",a.style.zIndex="1000",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.bottom="0",a.style.right="0",a.style.margin="auto",a.style.background="#fff";var i=document.createElement("div");return i.style.position="fixed",i.style.zIndex="999",i.style.width="100%",i.style.height="100%",i.style.top="0",i.style.left="0",i.style.background="rgba(0, 0, 0, 0.5)",document.body.appendChild(i),document.body.appendChild(a),a}(a,c,{size:i})),t}},{key:"handleForm",value:function(e){var t=this,n=e.urlAccessType,r=e.url,o=e.method,a=e.channelData,i=e.iframeName,c=e.formField;return(n===Fe.Form||n===Fe.Both&&o===Be.POST)&&function(){var e=function(e){var t=e.action,n=e.method,r=void 0===n?"POST":n,o=e.channelData,a=e.formField,i=e.iframeName,c=document.createElement("form");for(var s in c.action=t,c.method=r,i&&(c.target=i),o){var u=document.createElement("input");u.name=s,u.value=o[s],u.type="hidden",c.appendChild(u)}return a&&a.forEach((function(e){var t=document.createElement(e.element);Object.keys(e.attribute).forEach((function(n){var r=e.attribute[n];r&&t.setAttribute(n,r)})),c.appendChild(t)})),document.body.appendChild(c),c}({action:r,method:o,channelData:a,iframeName:i,formField:c});t.logger.log("3DS_handleForm_about_to_trigger_form_submission"),e.submit()}(),new Promise((function(e){e()}))}},{key:"gather",value:function(e){var t=this;return new Promise((function(n,r){t.resolveFn=n,t.rejectFn=r,t.logger.log("3DS_gather_start",{data:{nextAction:e}});var o=e.data,a=e.method,i=void 0===a?Be.GET:a,c=e.url,s=e.type,u=JSON.parse((null==o?void 0:o.additionalData)||"")[s]||{},l=u.urlAccessType,d=u.iframeType,f=u.formField,p=u.closePolling,h=void 0!==p&&p,y=u.listenMessageFromChannel,v=void 0!==y&&y,m=u.channelMessageTimeout,g=t.handleIframe({type:s,iframeType:d,url:c,method:i}),b=null==g?void 0:g.getAttribute("name");if(!h){var w=e.nextAction;!0===v&&w?t.gatherFromChannel(w,{timeout:m,origin:Tt(c)}):(window.removeEventListener("message",t.handlePostmessage,!1),window.addEventListener("message",t.handlePostmessage,!1))}t.handleForm({urlAccessType:l,url:c,method:i,channelData:null==o?void 0:o.channelData,iframeName:b,formField:f})}))}},{key:"gatherFromChannel",value:function(e,t){var n=this,r=function(){var r=ce(Oe.mark((function r(o){var a,i;return Oe.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=o.data,(i=o.origin)===t.origin){r.next=3;break}return r.abrupt("return");case 3:if(n.logger.log("3DS_handleChannelMessage",{data:{data:a,origin:i}}),n.timer&&(clearTimeout(n.timer),n.timer=null),!n.resolveFn){r.next=9;break}return r.next=8,pn(e,{channelInfoData:a});case 8:n.resolveFn();case 9:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}();t.timeout>0&&(this.timer=window.setTimeout(ce(Oe.mark((function t(){return Oe.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(window.removeEventListener("message",r,!1),!n.resolveFn){t.next=5;break}return t.next=4,pn(e,{channelInfoData:{}});case 4:n.resolveFn();case 5:case"end":return t.stop()}}),t)}))),t.timeout)),window.removeEventListener("message",r,!1),window.addEventListener("message",r,!1)}},{key:"challenge",value:function(e){var t=this;return new Promise((function(n,r){t.resolveFn=n,t.rejectFn=r,t.logger.log("3DS_challenge_start",{data:{nextAction:e}});var o=e.data,a=e.method,i=void 0===a?Be.GET:a,c=e.url,s=e.type,u=JSON.parse((null==o?void 0:o.additionalData)||"")[s]||{},l=u.urlAccessType,d=u.iframeType,f=u.formField,p=u.closePolling,h=void 0!==p&&p,y=t.handleIframe({type:s,iframeType:d,url:c,method:i,size:null==o?void 0:o.size}),v=null==y?void 0:y.getAttribute("name");h||(window.removeEventListener("message",t.handlePostmessage,!1),window.addEventListener("message",t.handlePostmessage,!1)),t.handleForm({urlAccessType:l,url:c,method:i,channelData:null==o?void 0:o.channelData,iframeName:v,formField:f})}))}},{key:"openIframe",value:function(e){var t;this.logger.log("3DS_openIframe_start",{data:{nextAction:e,domId:this.domId}});var n=e.url,r=e.type,o=e.header,a=null!=o&&null!==(t=o.openIframeOptions)&&void 0!==t&&t.hidden?Re.Hidden:Re.Visible;this.handleIframe({type:r,iframeType:a,url:n}),window.removeEventListener("message",this.handlePostmessage,!1),window.addEventListener("message",this.handlePostmessage,!1)}}]),e}(),At={exports:{}},Lt={exports:{}},Dt=function(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}(Object.freeze({__proto__:null,default:{}}));Lt.exports=(Ot=Ot||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==ge&&ge.crypto&&(n=ge.crypto),!n)try{n=Dt}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},i=a.lib={},c=i.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var a=0;a<o;a++){var i=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=i<<24-(r+a)%4*8}else for(var c=0;c<o;c+=4)t[r+c>>>2]=n[c>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new s.init(t,e)}}),u=a.enc={},l=u.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var a=t[o>>>2]>>>24-o%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var a=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},f=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=i.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,a=r.sigBytes,i=this.blockSize,c=a/(4*i),u=(c=t?e.ceil(c):e.max((0|c)-this._minBufferSize,0))*i,l=e.min(4*u,a);if(u){for(var d=0;d<u;d+=i)this._doProcessBlock(o,d);n=o.splice(0,u),r.sigBytes-=l}return new s.init(n,l)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=p.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}});var h=a.algo={};return a}(Math),Ot),function(e){(function(){var t=e,n=t.lib.WordArray;function r(e,t,r){for(var o=[],a=0,i=0;i<t;i++)if(i%4){var c=r[e.charCodeAt(i-1)]<<i%4*2|r[e.charCodeAt(i)]>>>6-i%4*2;o[a>>>2]|=c<<24-a%4*8,a++}return n.create(o,a)}t.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var o=[],a=0;a<n;a+=3)for(var i=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c<n;c++)o.push(r.charAt(i>>>6*(3-c)&63));var s=r.charAt(64);if(s)for(;o.length%4;)o.push(s);return o.join("")},parse:function(e){var t=e.length,n=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<n.length;a++)o[n.charCodeAt(a)]=a}var i=n.charAt(64);if(i){var c=e.indexOf(i);-1!==c&&(t=c)}return r(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(),e.enc.Base64}(Lt.exports),function(e){(function(t){var n=e,r=n.lib,o=r.WordArray,a=r.Hasher,i=n.algo,c=[];!function(){for(var e=0;e<64;e++)c[e]=4294967296*t.abs(t.sin(e+1))|0}();var s=i.MD5=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var a=this._hash.words,i=e[t+0],s=e[t+1],p=e[t+2],h=e[t+3],y=e[t+4],v=e[t+5],m=e[t+6],g=e[t+7],b=e[t+8],w=e[t+9],_=e[t+10],O=e[t+11],C=e[t+12],k=e[t+13],S=e[t+14],P=e[t+15],x=a[0],I=a[1],E=a[2],T=a[3];x=u(x,I,E,T,i,7,c[0]),T=u(T,x,I,E,s,12,c[1]),E=u(E,T,x,I,p,17,c[2]),I=u(I,E,T,x,h,22,c[3]),x=u(x,I,E,T,y,7,c[4]),T=u(T,x,I,E,v,12,c[5]),E=u(E,T,x,I,m,17,c[6]),I=u(I,E,T,x,g,22,c[7]),x=u(x,I,E,T,b,7,c[8]),T=u(T,x,I,E,w,12,c[9]),E=u(E,T,x,I,_,17,c[10]),I=u(I,E,T,x,O,22,c[11]),x=u(x,I,E,T,C,7,c[12]),T=u(T,x,I,E,k,12,c[13]),E=u(E,T,x,I,S,17,c[14]),x=l(x,I=u(I,E,T,x,P,22,c[15]),E,T,s,5,c[16]),T=l(T,x,I,E,m,9,c[17]),E=l(E,T,x,I,O,14,c[18]),I=l(I,E,T,x,i,20,c[19]),x=l(x,I,E,T,v,5,c[20]),T=l(T,x,I,E,_,9,c[21]),E=l(E,T,x,I,P,14,c[22]),I=l(I,E,T,x,y,20,c[23]),x=l(x,I,E,T,w,5,c[24]),T=l(T,x,I,E,S,9,c[25]),E=l(E,T,x,I,h,14,c[26]),I=l(I,E,T,x,b,20,c[27]),x=l(x,I,E,T,k,5,c[28]),T=l(T,x,I,E,p,9,c[29]),E=l(E,T,x,I,g,14,c[30]),x=d(x,I=l(I,E,T,x,C,20,c[31]),E,T,v,4,c[32]),T=d(T,x,I,E,b,11,c[33]),E=d(E,T,x,I,O,16,c[34]),I=d(I,E,T,x,S,23,c[35]),x=d(x,I,E,T,s,4,c[36]),T=d(T,x,I,E,y,11,c[37]),E=d(E,T,x,I,g,16,c[38]),I=d(I,E,T,x,_,23,c[39]),x=d(x,I,E,T,k,4,c[40]),T=d(T,x,I,E,i,11,c[41]),E=d(E,T,x,I,h,16,c[42]),I=d(I,E,T,x,m,23,c[43]),x=d(x,I,E,T,w,4,c[44]),T=d(T,x,I,E,C,11,c[45]),E=d(E,T,x,I,P,16,c[46]),x=f(x,I=d(I,E,T,x,p,23,c[47]),E,T,i,6,c[48]),T=f(T,x,I,E,g,10,c[49]),E=f(E,T,x,I,S,15,c[50]),I=f(I,E,T,x,v,21,c[51]),x=f(x,I,E,T,C,6,c[52]),T=f(T,x,I,E,h,10,c[53]),E=f(E,T,x,I,_,15,c[54]),I=f(I,E,T,x,s,21,c[55]),x=f(x,I,E,T,b,6,c[56]),T=f(T,x,I,E,P,10,c[57]),E=f(E,T,x,I,m,15,c[58]),I=f(I,E,T,x,k,21,c[59]),x=f(x,I,E,T,y,6,c[60]),T=f(T,x,I,E,O,10,c[61]),E=f(E,T,x,I,p,15,c[62]),I=f(I,E,T,x,w,21,c[63]),a[0]=a[0]+x|0,a[1]=a[1]+I|0,a[2]=a[2]+E|0,a[3]=a[3]+T|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;n[o>>>5]|=128<<24-o%32;var a=t.floor(r/4294967296),i=r;n[15+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(n.length+1),this._process();for(var c=this._hash,s=c.words,u=0;u<4;u++){var l=s[u];s[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return c},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,o,a,i){var c=e+(t&n|~t&r)+o+i;return(c<<a|c>>>32-a)+t}function l(e,t,n,r,o,a,i){var c=e+(t&r|n&~r)+o+i;return(c<<a|c>>>32-a)+t}function d(e,t,n,r,o,a,i){var c=e+(t^n^r)+o+i;return(c<<a|c>>>32-a)+t}function f(e,t,n,r,o,a,i){var c=e+(n^(t|~r))+o+i;return(c<<a|c>>>32-a)+t}n.MD5=a._createHelper(s),n.HmacMD5=a._createHmacHelper(s)})(Math),e.MD5}(Lt.exports),function(e){(function(){var t=e,n=t.lib,r=n.WordArray,o=n.Hasher,a=t.algo,i=[],c=a.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],a=n[2],c=n[3],s=n[4],u=0;u<80;u++){if(u<16)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}var d=(r<<5|r>>>27)+s+i[u];d+=u<20?1518500249+(o&a|~o&c):u<40?1859775393+(o^a^c):u<60?(o&a|o&c|a&c)-1894007588:(o^a^c)-899497514,s=c,c=a,a=o<<30|o>>>2,o=r,r=d}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+c|0,n[4]=n[4]+s|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=o._createHelper(c),t.HmacSHA1=o._createHmacHelper(c)})(),e.SHA1}(Lt.exports),function(e){!function(){var t=e,n=t.lib.Base,r=t.enc.Utf8;t.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,o=4*n;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),i=this._iKey=t.clone(),c=a.words,s=i.words,u=0;u<n;u++)c[u]^=1549556828,s[u]^=909522486;a.sigBytes=i.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})}()}(Lt.exports),function(e){(function(){var t=e,n=t.lib,r=n.Base,o=n.WordArray,a=t.algo,i=a.MD5,c=a.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:i,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,r=this.cfg,a=r.hasher.create(),i=o.create(),c=i.words,s=r.keySize,u=r.iterations;c.length<s;){n&&a.update(n),n=a.update(e).finalize(t),a.reset();for(var l=1;l<u;l++)n=a.finalize(n),a.reset();i.concat(n)}return i.sigBytes=4*s,i}});t.EvpKDF=function(e,t,n){return c.create(n).compute(e,t)}})(),e.EvpKDF}(Lt.exports),function(e){e.lib.Cipher||function(t){var n=e,r=n.lib,o=r.Base,a=r.WordArray,i=r.BufferedBlockAlgorithm,c=n.enc;c.Utf8;var s=c.Base64,u=n.algo.EvpKDF,l=r.Cipher=i.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:m}return function(t){return{encrypt:function(n,r,o){return e(r).encrypt(t,n,r,o)},decrypt:function(n,r,o){return e(r).decrypt(t,n,r,o)}}}}()});r.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=n.mode={},f=r.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=d.CBC=function(){var e=f.extend();function n(e,n,r){var o,a=this._iv;a?(o=a,this._iv=t):o=this._prevBlock;for(var i=0;i<r;i++)e[n+i]^=o[i]}return e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize;n.call(this,e,t,o),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,a=e.slice(t,t+o);r.decryptBlock(e,t),n.call(this,e,t,o),this._prevBlock=a}}),e}(),h=(n.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,r=n-e.sigBytes%n,o=r<<24|r<<16|r<<8|r,i=[],c=0;c<r;c+=4)i.push(o);var s=a.create(i,r);e.concat(s)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:p,padding:h}),reset:function(){var e;l.reset.call(this);var t=this.cfg,n=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(r,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var y=r.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),v=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?a.create([1398893684,1701076831]).concat(n).concat(t):t).toString(s)},parse:function(e){var t,n=s.parse(e),r=n.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=a.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),y.create({ciphertext:n,salt:t})}},m=r.SerializableCipher=o.extend({cfg:o.extend({format:v}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var o=e.createEncryptor(n,r),a=o.finalize(t),i=o.cfg;return y.create({ciphertext:a,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(n.kdf={}).OpenSSL={execute:function(e,t,n,r,o){if(r||(r=a.random(8)),o)i=u.create({keySize:t+n,hasher:o}).compute(e,r);else var i=u.create({keySize:t+n}).compute(e,r);var c=a.create(i.words.slice(t),4*n);return i.sigBytes=4*t,y.create({key:i,iv:c,salt:r})}},b=r.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:g}),encrypt:function(e,t,n,r){var o=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=o.iv;var a=m.encrypt.call(this,e,t,o.key,r);return a.mixIn(o),a},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var o=r.kdf.execute(n,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=o.iv,m.decrypt.call(this,e,t,o.key,r)}})}()}(Lt.exports),At.exports=function(e){return function(){var t=e,n=t.lib.BlockCipher,r=t.algo,o=[],a=[],i=[],c=[],s=[],u=[],l=[],d=[],f=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var h=r^r<<1^r<<2^r<<3^r<<4;h=h>>>8^255&h^99,o[n]=h,a[h]=n;var y=e[n],v=e[y],m=e[v],g=257*e[h]^16843008*h;i[n]=g<<24|g>>>8,c[n]=g<<16|g>>>16,s[n]=g<<8|g>>>24,u[n]=g,g=16843009*m^65537*v^257*y^16843008*n,l[h]=g<<24|g>>>8,d[h]=g<<16|g>>>16,f[h]=g<<8|g>>>24,p[h]=g,n?(n=y^e[e[e[m^y]]],r^=e[e[r]]):n=r=1}}();var h=[0,1,2,4,8,16,32,64,128,27,54],y=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),a=this._keySchedule=[],i=0;i<r;i++)i<n?a[i]=t[i]:(u=a[i-1],i%n?n>6&&i%n==4&&(u=o[u>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u]):(u=o[(u=u<<8|u>>>24)>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u],u^=h[i/n|0]<<24),a[i]=a[i-n]^u);for(var c=this._invKeySchedule=[],s=0;s<r;s++){if(i=r-s,s%4)var u=a[i];else u=a[i-4];c[s]=s<4||i<=4?u:l[o[u>>>24]]^d[o[u>>>16&255]]^f[o[u>>>8&255]]^p[o[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,c,s,u,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,d,f,p,a),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,o,a,i,c){for(var s=this._nRounds,u=e[t]^n[0],l=e[t+1]^n[1],d=e[t+2]^n[2],f=e[t+3]^n[3],p=4,h=1;h<s;h++){var y=r[u>>>24]^o[l>>>16&255]^a[d>>>8&255]^i[255&f]^n[p++],v=r[l>>>24]^o[d>>>16&255]^a[f>>>8&255]^i[255&u]^n[p++],m=r[d>>>24]^o[f>>>16&255]^a[u>>>8&255]^i[255&l]^n[p++],g=r[f>>>24]^o[u>>>16&255]^a[l>>>8&255]^i[255&d]^n[p++];u=y,l=v,d=m,f=g}y=(c[u>>>24]<<24|c[l>>>16&255]<<16|c[d>>>8&255]<<8|c[255&f])^n[p++],v=(c[l>>>24]<<24|c[d>>>16&255]<<16|c[f>>>8&255]<<8|c[255&u])^n[p++],m=(c[d>>>24]<<24|c[f>>>16&255]<<16|c[u>>>8&255]<<8|c[255&l])^n[p++],g=(c[f>>>24]<<24|c[u>>>16&255]<<16|c[l>>>8&255]<<8|c[255&d])^n[p++],e[t]=y,e[t+1]=v,e[t+2]=m,e[t+3]=g},keySize:8});t.AES=n._createHelper(y)}(),e.AES}(Lt.exports);var Nt=At.exports,Bt={exports:{}};Bt.exports=function(e){return e.mode.ECB=function(){var t=e.lib.BlockCipherMode.extend();return t.Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t}(),e.mode.ECB}(Lt.exports);var Mt=Bt.exports,Rt={exports:{}};Rt.exports=Lt.exports.pad.Pkcs7;var Ft=Rt.exports,Ut={exports:{}};Ut.exports=Lt.exports.enc.Utf8;var Ht,qt,Gt=Ut.exports;!function(e){e.Channel="channel",e.Custom="custom"}(Ht||(Ht={})),function(e){e.RequestComplete="payment.request.complete",e.PayResult="payment.request.result",e.RefundResult="refund.request.result"}(qt||(qt={}));var Yt,Vt=function(){var e=ce(Oe.mark((function e(t,n){var r;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=bt(ct.post.bind(ct),{retries:10,interval:1e3}),e.next=3,r(t,n,{timeout:1e4});case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),zt={Android:["(?:(?:Orca-)?Android|Adr)[ /](?:[a-z]+ )?(\\d+[\\.\\d]*)","Android|Silk-Accelerated=[a-z]{4,5}","(?:TwitterAndroid).*[ /](?:[a-z]+ )?(\\d+[\\.\\d]*)","FB4A.*FBSV/(\\d+[\\.\\d]*);","BeyondPod|AntennaPod|Podkicker|DoggCatcher|Player FM|okhttp|Podcatcher Deluxe"],Linux:["Arch ?Linux(?:[ /\\-](\\d+[\\.\\d]+))?","VectorLinux(?: package)?(?:[ /\\-](\\d+[\\.\\d]+))?","Linux(?:OS)?[^a-z]"],iOS:["CFNetwork/889","CFNetwork/887","CFNetwork/811","CFNetwork/808\\.3","CFNetwork/808\\.2","CFNetwork/808\\.1","CFNetwork/808\\.0","CFNetwork/808","CFNetwork/758\\.4\\.3","CFNetwork/758\\.3\\.15","CFNetwork/758\\.2\\.[78]","CFNetwork/758\\.1\\.6","CFNetwork/758\\.0\\.2","CFNetwork/711\\.5\\.6","CFNetwork/711\\.4\\.6","CFNetwork/711\\.3\\.18","CFNetwork/711\\.2\\.23","CFNetwork/711\\.1\\.1[26]","CFNetwork/711\\.0\\.6","CFNetwork/672\\.1","CFNetwork/672\\.0","CFNetwork/609\\.1","CFNetwork/60[29]","CFNetwork/548\\.1","CFNetwork/548\\.0","CFNetwork/485\\.13","CFNetwork/485\\.12","CFNetwork/485\\.10","CFNetwork/485\\.2","CFNetwork/467\\.12","CFNetwork/459","(?:CPU OS|iPh(?:one)?[ _]OS|iOS)[ _/](\\d+(?:[_\\.]\\d+)*)","FBIOS.*FBSV/(\\d+[\\.\\d]*);","(?:Apple-)?(?:iPhone|iPad|iPod)(?:.*Mac OS X.*Version/(\\d+\\.\\d+)|; Opera)?","Podcasts/(?:[\\d\\.]+)|Instacast(?:HD)?/(?:\\d\\.[\\d\\.abc]+)|Pocket Casts, iOS|Overcast|Castro|Podcat|i[cC]atcher|RSSRadio/","iTunes-(iPod|iPad|iPhone)/(?:[\\d\\.]+)"],MacOS:["CFNetwork/887.*(x86_64)","CFNetwork/811.*(x86_64)","CFNetwork/807","CFNetwork/760","CFNetwork/720","CFNetwork/673","CFNetwork/596","CFNetwork/520","CFNetwork/454","CFNetwork/(?:438|422|339|330|221|220|217)","CFNetwork/12[89]","CFNetwork/1\\.2","CFNetwork/1\\.1","Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?","Mac (\\d+(?:[_\\.]\\d+)+)","Darwin|Macintosh|Mac_PowerPC|PPC|Mac PowerPC|iMac|MacBook"],Windows:["CYGWIN_NT-10.0|Windows NT 10.0|Windows 10","CYGWIN_NT-6.4|Windows NT 6.4|Windows 10","CYGWIN_NT-6.3|Windows NT 6.3|Windows 8.1","CYGWIN_NT-6.2|Windows NT 6.2|Windows 8","CYGWIN_NT-6.1|Windows NT 6.1|Windows 7","CYGWIN_NT-6.0|Windows NT 6.0|Windows Vista","CYGWIN_NT-5.2|Windows NT 5.2|Windows Server 2003 / XP x64","CYGWIN_NT-5.1|Windows NT 5.1|Windows XP","CYGWIN_NT-5.0|Windows NT 5.0|Windows 2000","CYGWIN_NT-4.0|Windows NT 4.0|WinNT|Windows NT","CYGWIN_ME-4.90|Win 9x 4.90|Windows ME","CYGWIN_98-4.10|Win98|Windows 98","CYGWIN_95-4.0|Win32|Win95|Windows 95|Windows_95","Windows 3.1","Windows"],HarmonyOS:[],Other:[]},Wt=(Yt={},{set:function(e,t){Yt[e]=t},get:function(e){if(Object.prototype.hasOwnProperty.call(Yt,e))return Yt[e]}}),Kt=function(e,t){try{var n=function(e){var t=Wt.get(e);if(t)return t.value;var n=RegExp("(?:^|[^A-Z0-9-_]|[^A-Z0-9-]_|sprd-)(?:".concat(e,")"),"i");return Wt.set(e,{value:n}),n}(e),r=n.exec(t);return r?r.slice(1):null}catch(e){return null}};function Xt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Jt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jt(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw a}}}}function Jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $t=de((function e(){se(this,e),me(this,"parse",(function(e){for(var t=null,n=0,r=Object.keys(zt);n<r.length;n++){var o=r[n];if(o&&Object.prototype.hasOwnProperty.call(zt,o)){var a,i=Xt(zt[o]);try{for(i.s();!(a=i.n()).done;){var c=a.value;if(Kt(c,e))return t=o}}catch(e){i.e(e)}finally{i.f()}}}return t})),me(this,"getVersion",(function(e,t){switch(t){case"MacOS":return e.replace(/^.*Mac OS X ([\d_]+).*$/,"$2").replace(/_/g,".");case"iOS":return e.replace(/^.*OS ([\d_]+) like.*$/,"$2").replace(/_/g,".");case"Windows":return e.replace(/^.*Windows NT ([\d.]+);.*$/,"$2");case"Android":return e.replace(/^.*Android ([\d.]+);.*$/,"$2")}return""}))})),Zt=function(){var e,t,n=window.navigator,r=n.userAgent,o=n.language,a=window.screen,i=a.colorDepth,c=a.width,s=a.height,u=window.navigator.javaEnabled().toString(),l=(t=(e=new $t).parse(navigator.userAgent)||"Other",e.getVersion(navigator.userAgent,t));return{transactionWebSite:window.location.href,javaEnabled:u,colorDepth:i.toString(),screenHeight:c.toString(),screenWidth:s.toString(),timeZoneOffset:(new Date).getTimezoneOffset().toString(),accept:"application/json",userAgent:r,language:o,javaScriptEnabled:"true",deviceOsVersion:l}};function Qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function en(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qt(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tn(e){return nn.apply(this,arguments)}function nn(){return(nn=ce(Oe.mark((function e(t){var n,r,o,a,i,c;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.method,o=void 0===r?"GET":r,a=t.url,i=t.data,o!==Be.GET){e.next=7;break}return e.next=4,ct.get(a);case 4:c=e.sent,e.next=11;break;case 7:if(o!==Be.POST){e.next=11;break}return e.next=10,ct.post(a,i||{});case 10:c=e.sent;case 11:return e.abrupt("return",null===(n=c)||void 0===n?void 0:n.data);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"post",r=arguments.length>3?arguments[3]:void 0,o=document.createElement("form");for(var a in o.style.display="none",o.method=n,o.action=e,r&&(o.target=r),t){var i=document.createElement("input");i.name=a,i.value=t[a]||"",o.appendChild(i)}document.body.appendChild(o),o.submit()}function on(e){return an.apply(this,arguments)}function an(){return(an=ce(Oe.mark((function e(t){var n,r,o,a;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.method,r=void 0===n?"GET":n,o=t.url,a=t.data,ae.get().info("ready to redirect",{data:{nextAction:t}}),"POST"===r?rn(o,a):"GET"===r&&window.location.assign(o);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var cn,sn,un,ln,dn,fn=function(){var e=ce(Oe.mark((function e(t,n){var r,o,a,i,c,s,u;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.data,o=r.needNotify,a=r.notifyUrl,i=r.notifySecretKey,c=(n||{}).data,o){e.next=4;break}return e.abrupt("return");case 4:if(a&&i&&c){e.next=6;break}throw{message:"require props missed",data:{needNotify:o,notifyUrl:a,notifySecretKey:i,data:c}};case 6:return l=JSON.stringify(null==c?void 0:c.eventData),d=i,f=Gt.parse(l),p=Gt.parse(d),s=Nt.encrypt(f,p,{mode:Mt,padding:Ft}).toString(),u=en(en({},c),{},{eventData:s}),e.next=10,Vt(a,u);case 10:case"end":return e.stop()}var l,d,f,p}),e)})));return function(t,n){return e.apply(this,arguments)}}(),pn=function(){var e=ce(Oe.mark((function e(t,n){var r,o,a,i,c,s,u,l,d,f,p,h,y,v,m;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.type,o=t.url,r!==Ne.Confirm){e.next=11;break}return s=en(en({},null==n?void 0:n.data),{},{additionalData:{language:(null===(a=window)||void 0===a||null===(i=a.Shopline)||void 0===i?void 0:i.locale)||"en"},client:Zt()}),e.next=5,ct.post(o,s);case 5:if(200===(u=e.sent).statusCode&&null!==(c=u.data)&&void 0!==c&&c.nextAction){e.next=8;break}throw new Error("confirm return return error or no nextAction");case 8:pn(u.data.nextAction),e.next=54;break;case 11:if(r!==Ne.Redirect){e.next=15;break}on(t),e.next=54;break;case 15:if(r!==Ne.ChannelInfoUpdate){e.next=25;break}return t.data&&(null!=n&&n.data&&(t.data=en(en({},t.data),n.data)),null!=n&&n.channelInfoData&&null!==(l=t.data)&&void 0!==l&&null!==(d=l.channelInfoJsonData)&&void 0!==d&&d.includes("@@channelInfoData@@")&&(f=null!=n&&n.channelInfoData?JSON.stringify(n.channelInfoData):"",t.data.channelInfoJsonData=t.data.channelInfoJsonData.replace("@@channelInfoData@@",f))),e.next=19,tn(t);case 19:if(null==(p=e.sent)||!p.nextAction){e.next=23;break}return e.next=23,pn(p.nextAction,n);case 23:e.next=54;break;case 25:if(r!==Ne.ChannelConfirm){e.next=32;break}if(null==(y=null==n||null===(h=n.payOptions)||void 0===h?void 0:h.hooks)||!y.channelConfirm){e.next=30;break}return e.next=30,y.channelConfirm(t);case 30:e.next=54;break;case 32:if(r!==Ne.OpenIframe){e.next=37;break}new jt(t.type).openIframe(t),e.next=54;break;case 37:if(r!==Ne.RedirectOrPopup){e.next=42;break}return e.next=40,fn(t,n);case 40:e.next=54;break;case 42:if(r!==Ne.Gather){e.next=47;break}return v=new jt(t.type,n),e.abrupt("return",v.gather(t));case 47:if(r!==Ne.Challenge){e.next=52;break}return m=new jt(t.type,n),e.abrupt("return",m.challenge(t));case 52:ae.get().error("do not match nextAction type",{data:{nextAction:t},error:new Error("")});case 54:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();!function(e){e.TEST="TEST",e.PRODUCTION="PRODUCTION"}(sn||(sn={})),function(e){e.INITIALIZE="INITIALIZE",e.SHIPPING_ADDRESS="SHIPPING_ADDRESS",e.SHIPPING_OPTION="SHIPPING_OPTION",e.OFFER="OFFER"}(un||(un={})),function(e){e.NOT_CURRENTLY_KNOWN="NOT_CURRENTLY_KNOWN",e.ESTIMATED="ESTIMATED",e.FINAL="FINAL"}(ln||(ln={})),function(e){e.DEFAULT="DEFAULT",e.COMPLETE_IMMEDIATE_PURCHASE="COMPLETE_IMMEDIATE_PURCHASE"}(dn||(dn={}));var hn,yn,vn,mn=(me(cn={},un.INITIALIZE,Ae.Ordinary),me(cn,un.SHIPPING_ADDRESS,Ae.ChangeAddress),me(cn,un.SHIPPING_OPTION,Ae.ChangeDeliveryMethod),me(cn,un.OFFER,Ae.UseDiscountCode),cn);!function(e){e.OFFER_INVALID="OFFER_INVALID",e.PAYMENT_DATA_INVALID="PAYMENT_DATA_INVALID",e.SHIPPING_ADDRESS_INVALID="SHIPPING_ADDRESS_INVALID",e.SHIPPING_ADDRESS_UNSERVICEABLE="SHIPPING_ADDRESS_UNSERVICEABLE",e.SHIPPING_OPTION_INVALID="SHIPPING_OPTION_INVALID",e.OTHER_ERROR="OTHER_ERROR"}(hn||(hn={})),function(e){e[e.TimeoutToLoadPaymentData=18]="TimeoutToLoadPaymentData",e[e.UserCancel=20]="UserCancel"}(yn||(yn={})),(vn||(vn={})).CANCELED="CANCELED";var gn,bn,wn,_n,On,Cn=function(){function e(t,n,r){var o=this;se(this,e),me(this,"container",void 0),me(this,"button",void 0),me(this,"styleElement",null),me(this,"options",void 0),me(this,"insertStyle",(function(){var e=document.createElement("style"),t="\n      .gpay-card-info-container {\n        border-radius: 0;\n        min-width: 140px;\n        min-height: 36px;\n      }\n\n      .".concat(St," .gpay-card-info-container-fill {\n        display: none;\n      }\n    ");void 0===o.options["border-radius"]&&(t+="\n        #".concat(o.container.id," .gpay-card-info-container {\n          border-radius: 4px;\n        }\n\n        [data-button_style=square] #").concat(o.container.id," .gpay-card-info-container {\n          border-radius: 0;\n        }\n\n        [data-button_style=rounded] #").concat(o.container.id," .gpay-card-info-container {\n          border-radius: 9999px;\n        }\n      ")),e.innerHTML=t;var n=48;o.options.height&&(n=o.options.height),o.container.style.height="".concat(n,"px"),o.styleElement=e,o.container.appendChild(e)})),me(this,"insertButton",(function(){o.container.appendChild(o.button)})),me(this,"removeElement",(function(){o.container.removeChild(o.button),o.styleElement&&o.container.removeChild(o.styleElement)})),me(this,"destroy",(function(){o.removeElement()})),this.container=t,this.button=n,this.options=r,this.insertStyle(),this.insertButton()}return de(e,[{key:"setDisabled",value:function(e){e?this.container.classList.add(kt):this.container.classList.remove(kt)}},{key:"setLoading",value:function(e){e?this.container.classList.add(St):this.container.classList.remove(St)}}]),e}();!function(e){e.Dev="dev",e.Test="test",e.Test2="test2",e.Stg="stg",e.Prev="prev",e.Alpha="alpha",e.Prod="prod"}(bn||(bn={})),function(e){e.Dev="stg",e.Test="stg",e.Test2="stg",e.Prev="prev",e.Alpha="prev",e.Prod="prod"}(wn||(wn={})),function(e){e.Test1="test1",e.Test2="test2",e.Test3="test3",e.Alpha="alpha",e.Prod="prod"}(_n||(_n={})),function(e){e.Dev="https://ec-pa-cashier.myshoplinedev.com",e.Test="https://ec-pa-cashier.myshoplinestg.com",e.Test2="https://paygate-cashier-test.myshoplinestg.com",e.Stg="https://ec-pa-cashier-stg.myshoplinestg.com",e.Prev="https://ec-pa-cashier-prev.myshopline.com",e.Alpha="https://ec-pa-cashier-preview.myshopline.com",e.Prod="https://ec-pa-cashier.myshopline.com"}(On||(On={}));var kn,Sn={host:"ec-pa-cashier.myshopline.com",staticHost:"https://cdn.myshopline.com/sl/payment-sdk"};function Pn(e){return"".concat(Sn.staticHost,"/").concat(e,"assets")}!function(e){e.Dev="dev/",e.Test="test/",e.Test2="test/",e.Stg="test/",e.Prev="prev/",e.Alpha="prev/",e.Prod=""}(kn||(kn={}));var xn=Object.freeze((me(gn={},bn.Dev,{env:_n.Test3,host:On.Dev,slI18nEnv:wn.Dev,staticPath:Pn(kn.Dev)}),me(gn,bn.Test,{env:_n.Test3,host:On.Test,slI18nEnv:wn.Test,staticPath:Pn(kn.Test)}),me(gn,bn.Test2,{env:_n.Test2,host:On.Test2,slI18nEnv:wn.Test2,staticPath:Pn(kn.Test2)}),me(gn,bn.Stg,{env:_n.Test3,host:On.Stg,slI18nEnv:wn.Test,staticPath:Pn(kn.Test)}),me(gn,bn.Prev,{env:_n.Test3,host:On.Prev,slI18nEnv:wn.Prev,staticPath:Pn(kn.Prev)}),me(gn,bn.Alpha,{env:_n.Alpha,host:On.Alpha,slI18nEnv:wn.Alpha,staticPath:Pn(kn.Alpha)}),me(gn,bn.Prod,{env:_n.Prod,host:On.Prod,slI18nEnv:wn.Prod,staticPath:Pn(kn.Prod)}),gn)),In=function(e){return window.loadjs=He,new Promise((function(t,n){var r=e;He.isDefined(r)?t(!0):He(e,r,{returnPromise:!0}).then((function(){t(!0)})).catch((function(e){n(e)}))}))},En=function(){if(/iphone|ipod|ipad/i.test(navigator.userAgent.toLowerCase()))return!1;var e=navigator.userAgent.match(/Chrome\/(\d+)/),t=e&&e[1]&&Number(e[1])>=61;return function(){var e=window.navigator.userAgent;return!!e.match("CriOS")||/Chrome/.test(e)&&/Google Inc./.test(window.navigator.vendor)&&!!window.chrome}()&&t};function Tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function jn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tn(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var An=function(e){he(a,xt);var t,n,r,o=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(a);function a(e){var t,n,r;return se(this,a),me(fe(r=o.call(this,e)),"name","GOOGLE_PAY"),me(fe(r),"config",void 0),me(fe(r),"paymentsClient",null),me(fe(r),"buttonElement",null),me(fe(r),"disabled",!1),me(fe(r),"loading",!1),me(fe(r),"initSuccess",!0),me(fe(r),"loadResourceFail",!1),me(fe(r),"initTime",0),me(fe(r),"logger",void 0),me(fe(r),"onPaymentDataChanged",function(){var e=ce(Oe.mark((function e(t){var n,o,a,i,c,s,u,l,d;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.callbackTrigger,e.next=3,null===(n=(o=r.config).onFormDataChange)||void 0===n?void 0:n.call(o,t,mn[a]).catch((function(){r.handleError(new Error("Failed to update abandonedOrder info"),ke.Pay)}));case 3:if(i=e.sent,r.logger.info("Order information updated, data received from business side",{data:jn({},i)}),i&&!i.error){e.next=7;break}return e.abrupt("return",{error:{reason:hn.OTHER_ERROR,intent:a===un.OFFER?un.INITIALIZE:a,message:(null==i||null===(c=i.error)||void 0===c?void 0:c.message)||"update error"}});case 7:return s=i.newOfferInfo,u=i.newTransactionInfo,l=i.newShippingOptionParameters,mt(d={newOfferInfo:s,newTransactionInfo:u,newShippingOptionParameters:l}),r.logger.log("Order information updated, data returned to channel",{data:jn({},d)}),e.abrupt("return",d);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),me(fe(r),"onPaymentAuthorized",(function(e){return new Promise((function(t,n){var o,a;(null===(o=(a=r.config).createOrder)||void 0===o?void 0:o.call(a,r.config.paymentInfo,{payChannelData:e,token:e})).then((function(e){if(!e||e.error)throw e.error;r.afterCreateOrder(je.Success),t({transactionState:"SUCCESS"}),pn(e.nextAction)})).catch((function(e){var t;r.afterCreateOrder(je.Fail),n({reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_AUTHORIZATION",message:null!==(t=e.message)&&void 0!==t?t:"pay error"})}))}))})),me(fe(r),"onGooglePaymentButtonClicked",ce(Oe.mark((function e(){var t,n,o,a;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.paymentsClient&&!r.loading&&!r.disabled){e.next=2;break}return e.abrupt("return");case 2:return r.setLoading(!0),e.next=5,r.beforeCreateOrder().catch((function(){return{valid:!1}}));case 5:if(n=e.sent,r.setLoading(!1),!1!==(null==n?void 0:n.valid)){e.next=9;break}return e.abrupt("return");case 9:if(o=null==n||null===(t=n.paymentConfig)||void 0===t?void 0:t.payChannelData){e.next=12;break}return e.abrupt("return");case 12:mt(o),a=setTimeout((function(){r.onChannelModalSuccess()}),1e3),r.logger.log("User clicked GP button, launching payment modal",{data:jn({},o)}),r.paymentsClient.loadPaymentData(o).catch((function(e){clearTimeout(a),e.statusCode!==vn.CANCELED||e.code!==yn.TimeoutToLoadPaymentData?e.statusCode!==vn.CANCELED?r.handleError(new Error("pay failed"),ke.Pay,{error:e}):r.logger.log("loadPaymentData return cancel error",{data:{error:e}}):r.handleError(new Error("Failed to pull up the channel"),ke.PullUpChannel,{error:e})}));case 16:case"end":return e.stop()}}),e)})))),me(fe(r),"destroy",(function(){var e;null===(e=r.buttonElement)||void 0===e||e.destroy(),r.buttonElement=null,r.paymentsClient=null})),r.config=e,ae.set(null===(t=(n=r.config).loggerFn)||void 0===t?void 0:t.call(n)),r.logger=ae.get().pipeOwner("payment-common.SLP-GooglePay").pipeData({domId:"".concat(r.config.props.domId)}),r}return de(a,[{key:"render",value:(r=ce(Oe.mark((function e(){var t,n;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(En()){e.next=3;break}return this.handleError(new Error("The current browser does not support Google Pay"),ke.Init),e.abrupt("return");case 3:return this.beforeInit(),e.next=6,this.loadChannelJs();case 6:if(e.sent){e.next=9;break}return e.abrupt("return");case 9:if(t=this.createClient()){e.next=12;break}return e.abrupt("return");case 12:if(n={},this.config.paymentInfo.channelSdkInitConfig){e.next=16;break}return this.handleError(new Error("channelSdkInitConfig is empty"),ke.Init),e.abrupt("return");case 16:e.prev=16,n=JSON.parse(this.config.paymentInfo.channelSdkInitConfig),e.next=24;break;case 20:return e.prev=20,e.t0=e.catch(16),this.handleError(new Error("Failure to parse channel configuration JSON string"),ke.Init,{channelSdkInitConfig:this.config.paymentInfo.channelSdkInitConfig}),e.abrupt("return");case 24:return e.next=26,this.canMakePayments(t,n.payChannelData);case 26:if(e.sent){e.next=30;break}return this.handleError(new Error("The current browser does not support Google Pay"),ke.Init),e.abrupt("return");case 30:this.renderButton(),this.afterInit();case 32:case"end":return e.stop()}}),e,this,[[16,20]])}))),function(){return r.apply(this,arguments)})},{key:"canMakePayments",value:(n=ce(Oe.mark((function e(t,n){var r;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.isReadyToPay(n);case 3:return r=e.sent,e.abrupt("return",r.result);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),function(e,t){return n.apply(this,arguments)})},{key:"beforeInit",value:function(){this.initTime=vt.now(),ft(this.config.beforeInit)&&this.config.beforeInit()}},{key:"afterInit",value:function(){this.initSuccess=!0,this.showButton();var e=vt.now()-this.initTime;this.logger.log("afterInit",{data:{duration:e}}),ft(this.config.afterInit)&&this.config.afterInit()}},{key:"onChannelModalSuccess",value:function(){ft(this.config.onChannelModalSuccess)&&this.config.onChannelModalSuccess(this.config.paymentInfo)}},{key:"beforeCreateOrder",value:(t=ce(Oe.mark((function e(){var t,n,r,o,a,i;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ft(this.config.beforeCreateOrder)){e.next=2;break}return e.abrupt("return");case 2:return t=this.config.paymentInfo,n=t.channelCode,r=t.methodCode,o=t.paymentId,a=t.accessMode,e.next=5,this.config.beforeCreateOrder({channelCode:n,methodCode:r,paymentId:o,accessMode:a});case 5:return i=e.sent,e.abrupt("return",i);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"afterCreateOrder",value:function(e){ft(this.config.afterCreateOrder)&&this.config.afterCreateOrder(e,{channelCode:this.config.paymentInfo.channelCode,methodCode:xe.GooglePay})}},{key:"setDisabled",value:function(e){var t;this.disabled=e,null===(t=this.buttonElement)||void 0===t||t.setDisabled(e)}},{key:"setLoading",value:function(e){var t;this.loading=e,null===(t=this.buttonElement)||void 0===t||t.setLoading(e)}},{key:"loadChannelJs",value:function(){var e=this;return new Promise((function(t){In("https://pay.google.com/gp/p/js/pay.js").then((function(){e.loadResourceFail=!1,t(!0)})).catch((function(n){e.loadResourceFail=!0,e.handleError(new Error("Failed to load channel js resource:".concat(n)),ke.Init),t(!1)}))}))}},{key:"createClient",value:function(){var e=this.config.paymentInfo.sdkEnv===bn.Prod?sn.PRODUCTION:sn.TEST;try{return this.paymentsClient=new window.google.payments.api.PaymentsClient({environment:e,paymentDataCallbacks:{onPaymentDataChanged:this.onPaymentDataChanged,onPaymentAuthorized:this.onPaymentAuthorized}}),this.paymentsClient}catch(e){this.handleError(new Error("Failed to create channel instance"),ke.Init,{channelMsg:e.message})}}},{key:"renderButton",value:function(){if(this.paymentsClient)try{var e,t,n=this.paymentsClient.createButton({onClick:this.onGooglePaymentButtonClicked,buttonSizeMode:"fill"}),r=document.getElementById(this.config.paymentInfo.currentDomId);if(!r)throw new Error("Container not found: #".concat(this.config.paymentInfo.currentDomId));this.buttonElement=new Cn(r,n,{height:null===(e=this.config.props.styleOptions)||void 0===e?void 0:e.height,"border-radius":null===(t=this.config.props.styleOptions)||void 0===t?void 0:t["border-radius"]})}catch(e){this.handleError(new Error("Failed to render button"),ke.Init,{channelMsg:e.message})}}},{key:"handleError",value:function(e,t,n){window[window.__sl_console__?"__sl_console__":"console"].error("GP unified error handling: ",{error:e,type:t,extData:n}),t!==ke.CreateExpected&&this.logger.error("handleError",{action:t,error:e,data:jn({},n)}),t===ke.Init&&(this.initSuccess=!1,this.hideButton()),ft(this.config.onError)&&this.config.onError(e,t,n)}}]),a}();function Ln(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Dn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ln(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ln(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Nn=function(e){var t=e;if(null!=e&&e.paymentInfo){var n=e.paymentInfo.configData;t.props=Dn(Dn({},e.props),n)}return t};function Bn(e){return"object"===("undefined"==typeof Node?"undefined":k(Node))?e instanceof Node:e&&"object"===k(e)&&"number"==typeof e.nodeType}function Mn(){var e=[];return{watch:e.push.bind(e),trigger:function(t,n){for(var r=!0,o={detail:n,preventDefault:function(){r=!1}},a=0;a<e.length;a++)e[a](t,o);return r}}}function Rn(e){return"none"===window.getComputedStyle(e).display}function Fn(e){this.elem=e}function Un(e,t){return Fn.make(e("parent")).clazz("pico-overlay").clazz(e("overlayClass","")).stylize({display:"none",position:"fixed",top:"0px",left:"0px",height:"100%",width:"100%",zIndex:1e4}).stylize(e("overlayStyles",{opacity:.5,background:"#000"})).onClick((function(){e("overlayClose",!0)&&t()}))}Fn.make=function(e,t){"string"==typeof e&&(e=document.querySelector(e));var n=document.createElement(t||"div");return(e||document.body).appendChild(n),new Fn(n)},Fn.prototype={child:function(e){return Fn.make(this.elem,e)},stylize:function(e){for(var t in void 0!==(e=e||{}).opacity&&(e.filter="alpha(opacity="+100*e.opacity+")"),e)e.hasOwnProperty(t)&&(this.elem.style[t]=e[t]);return this},clazz:function(e){return this.elem.className+=" "+e,this},html:function(e){return Bn(e)?this.elem.appendChild(e):this.elem.innerHTML=e,this},onClick:function(e){return this.elem.addEventListener("click",e),this},destroy:function(){this.elem.parentNode.removeChild(this.elem)},hide:function(){this.elem.style.display="none"},show:function(){this.elem.style.display="block"},attr:function(e,t){return void 0!==t&&this.elem.setAttribute(e,t),this},anyAncestor:function(e){for(var t=this.elem;t;){if(e(new Fn(t)))return!0;t=t.parentNode}return!1},isVisible:function(){return!Rn(this.elem)}};var Hn=1;function qn(e,t){if(t("closeButton",!0))return e.child("button").html(t("closeHtml","&#xD7;")).clazz("pico-close").clazz(t("closeClass","")).stylize(t("closeStyles",{borderRadius:"2px",border:0,padding:0,cursor:"pointer",height:"15px",width:"15px",position:"absolute",top:"5px",right:"5px",fontSize:"16px",textAlign:"center",lineHeight:"15px",background:"#CCC"})).attr("aria-label",t("close-label","Close"))}function Gn(e){return function(){return e().elem}}var Yn,Vn,zn,Wn,Kn,Xn=Mn(),Jn=Mn();function $n(e){("string"==typeof e||Bn(e))&&(e={content:e});var t=Mn(),n=Mn(),r=Mn(),o=Mn(),a=Mn();function i(t,n){var r=e[t];return"function"==typeof r&&(r=r(n)),void 0===r?n:r}var c,s,u=y.bind(window,"modal"),l=y.bind(window,"overlay"),d=y.bind(window,"close");function f(e){l().hide(),u().hide(),a.trigger(c,e)}function p(e){o.trigger(c,e)&&f(e)}function h(e){return function(){return e.apply(this,arguments),c}}function y(e,n){if(!s){var r=function(e,t){var n=e("width","auto");"number"==typeof n&&(n+="px");var r=e("modalId","pico-"+Hn++);return Fn.make(e("parent")).clazz("pico-content").clazz(e("modalClass","")).stylize({display:"none",position:"fixed",zIndex:10001,left:"50%",top:"38.1966%",maxHeight:"90%",boxSizing:"border-box",width:n,"-ms-transform":"translate(-50%,-38.1966%)","-moz-transform":"translate(-50%,-38.1966%)","-webkit-transform":"translate(-50%,-38.1966%)","-o-transform":"translate(-50%,-38.1966%)",transform:"translate(-50%,-38.1966%)"}).stylize(e("modalStyles",{overflow:"auto",backgroundColor:"white",padding:"20px",borderRadius:"5px"})).html(e("content")).attr("id",r).attr("role","dialog").attr("aria-labelledby",e("ariaLabelledBy")).attr("aria-describedby",e("ariaDescribedBy",r)).onClick((function(e){new Fn(e.target).anyAncestor((function(e){return/\bpico-close\b/.test(e.elem.className)}))&&t()}))}(i,p);s={modal:r,overlay:Un(i,p),close:qn(r,i)},t.trigger(c,n)}return s[e]}return function(e,t){function n(e,t){return(e.msMatchesSelector||e.webkitMatchesSelector||e.matches).call(e,t)}function r(e){return!(Rn(e)||n(e,":disabled")||e.hasAttribute("contenteditable"))&&(e.hasAttribute("tabindex")||n(e,"input,select,textarea,button,a[href],area[href],iframe"))}function o(e){for(var t=e.getElementsByTagName("*"),n=0;n<t.length;n++)if(r(t[n]))return t[n]}var a;e.beforeShow((function(){a=document.activeElement})),e.afterShow((function(){if(t()){var n=o(e.modalElem());n&&n.focus()}})),e.afterClose((function(){t()&&a&&a.focus(),a=null})),Jn.watch((function(n){if(t()&&e.isVisible()){var a=o(e.modalElem()),i=function(e){for(var t=e.getElementsByTagName("*"),n=t.length;n--;)if(r(t[n]))return t[n]}(e.modalElem());(n.shiftKey?a:i)===document.activeElement&&((n.shiftKey?i:a).focus(),n.preventDefault())}}))}(c={modalElem:Gn(u),closeElem:Gn(d),overlayElem:Gn(l),buildDom:h(y.bind(null,null)),isVisible:function(){return!!(s&&u&&u().isVisible())},show:function(e){return n.trigger(c,e)&&(l().show(),d(),u().show(),r.trigger(c,e)),this},close:h(p),forceClose:h(f),destroy:function(){u().destroy(),l().destroy(),l=u=d=void 0},options:function(t){Object.keys(t).map((function(n){e[n]=t[n]}))},afterCreate:h(t.watch),beforeShow:h(n.watch),afterShow:h(r.watch),beforeClose:h(o.watch),afterClose:h(a.watch)},i.bind(null,"focus",!0)),function(e,t){var n,r=new Fn(document.body);e.beforeShow((function(){n=r.elem.style.overflow,t()&&r.stylize({overflow:"hidden"})})),e.afterClose((function(){r.stylize({overflow:n})}))}(c,i.bind(null,"bodyOverflow",!0)),Xn.watch((function(){i("escCloses",!0)&&c.isVisible()&&c.close()})),c}document.documentElement.addEventListener("keydown",(function(e){var t=e.which||e.keyCode;27===t?Xn.trigger():9===t&&Jn.trigger(e)})),function(e){e.Validatemerchant="validatemerchant",e.Paymentmethodselected="paymentmethodselected",e.Cancel="cancel",e.Shippingcontactselected="shippingcontactselected",e.Authorize="Authorize",e.Create="create",e.Couponcodechanged="couponcodechanged",e.Shippingmethodselected="shippingmethodselected",e.Paymentauthorized="paymentauthorized"}(Yn||(Yn={})),function(e){e.ShippingContactInvalid="shippingContactInvalid",e.BillingContactInvalid="billingContactInvalid",e.AddressUnserviceable="addressUnserviceable",e.CouponCodeInvalid="couponCodeInvalid",e.CouponCodeExpired="couponCodeExpired",e.Unknown="unknown"}(Vn||(Vn={})),(zn||(zn={})).Credit="credit",(Wn||(Wn={})).Unknown="unknown";var Zn,Qn="applepay-confirm-modal",er='<svg width="59" height="24" viewBox="0 0 59 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M10.6871 3.0942C10.002 3.90485 8.90594 4.54424 7.80985 4.4529C7.67283 3.3568 8.20947 2.1922 8.83744 1.47288C9.5225 0.639391 10.7214 0.0456708 11.6919 0C11.806 1.14177 11.3608 2.2607 10.6871 3.0942ZM11.6804 4.66984C10.0934 4.5785 8.73468 5.57184 7.98111 5.57184C7.21613 5.57184 6.06294 4.71551 4.80699 4.73834C3.17426 4.76118 1.65571 5.68601 0.822213 7.1589C-0.890442 10.1047 0.376923 14.4662 2.03249 16.8639C2.84315 18.0514 3.81365 19.353 5.09243 19.3073C6.30271 19.2617 6.78225 18.5195 8.24372 18.5195C9.7166 18.5195 10.1391 19.3073 11.4178 19.2845C12.7423 19.2617 13.5758 18.0971 14.3864 16.9096C15.3113 15.5623 15.6881 14.2493 15.7109 14.1808C15.6881 14.1579 13.1533 13.1874 13.1305 10.2645C13.1077 7.82112 15.1286 6.65652 15.2199 6.58801C14.0782 4.89819 12.297 4.71551 11.6804 4.66984ZM20.8489 1.35871V19.1589H23.6119V13.0733H27.4369C30.9307 13.0733 33.3855 10.6755 33.3855 7.20457C33.3855 3.73359 30.9764 1.35871 27.5282 1.35871H20.8489ZM23.6119 3.68792H26.7975C29.1952 3.68792 30.5653 4.9667 30.5653 7.21598C30.5653 9.46527 29.1952 10.7555 26.7861 10.7555H23.6119V3.68792ZM38.4321 19.2959C40.1676 19.2959 41.7775 18.4167 42.5082 17.0238H42.5653V19.1589H45.1229V10.2988C45.1229 7.72978 43.0677 6.07421 39.905 6.07421C36.9706 6.07421 34.8013 7.75262 34.7214 10.059H37.2104C37.4159 8.96289 38.4321 8.24358 39.8251 8.24358C41.5149 8.24358 42.4626 9.0314 42.4626 10.4814V11.4634L39.0144 11.6689C35.806 11.863 34.0706 13.176 34.0706 15.4596C34.0706 17.7659 35.8631 19.2959 38.4321 19.2959ZM39.1743 17.1836C37.7014 17.1836 36.7651 16.4757 36.7651 15.3911C36.7651 14.2721 37.6671 13.6213 39.3912 13.5186L42.4626 13.3245V14.3292C42.4626 15.9962 41.0468 17.1836 39.1743 17.1836ZM48.5368 24C51.2314 24 52.4987 22.9724 53.6062 19.8554L58.4588 6.24548H55.65L52.396 16.7612H52.3389L49.0848 6.24548H46.1962L50.8774 19.2046L50.6262 19.9924C50.2038 21.3283 49.5187 21.8421 48.297 21.8421C48.0801 21.8421 47.6576 21.8192 47.4864 21.7964V23.9315C47.6462 23.9772 48.3313 24 48.5368 24Z" fill="currentColor"/>\n</svg>',tr={props:{payMode:Se.Continue,buttonTimeoutConfig:{enable:!1,timeoutMillis:5e3},timing:!1}},nr=(me(Kn={},Yn.Paymentmethodselected,Ae.Ordinary),me(Kn,Yn.Shippingcontactselected,Ae.ChangeAddress),me(Kn,Yn.Cancel,Ae.Ordinary),me(Kn,Yn.Validatemerchant,Ae.Ordinary),me(Kn,Yn.Authorize,Ae.Ordinary),me(Kn,Yn.Create,Ae.Ordinary),me(Kn,Yn.Couponcodechanged,Ae.UseDiscountCode),me(Kn,Yn.Shippingmethodselected,Ae.ChangeDeliveryMethod),me(Kn,Yn.Paymentauthorized,Ae.Ordinary),Kn),rr=function(){var e=ce(Oe.mark((function e(t){var n,r,o,a,i;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={useRetry:!0,action:Ue.I18n,retryOptions:{maxCount:3,interval:1e3}},r=t.project,o=t.env,a=t.lang,e.next=4,ct.get("https://cdn.myshopline.com/t/i18n/".concat(r,"/").concat(o,"/").concat(a,".raw.tree.json"),n);case 4:return i=e.sent,e.abrupt("return",i.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();!function(e){e.Dev="develop",e.Stg="staging",e.Prev="preview",e.Prod="product"}(Zn||(Zn={}));var or,ar="pay-button";!function(e){e.Stg="stg",e.Prev="prev",e.Prod="prod"}(or||(or={}));var ir=function(e,t){var n=t.split(".").reduce((function(e,t){var n;return null!==(n=e[t])&&void 0!==n?n:{}}),e);return function(e){return function(e,t){return"[object Object]"===Object.prototype.toString.call(e)}(e)}(n)?"":n},cr=function(e){var t;return(me(t={},Zn.Dev,or.Stg),me(t,Zn.Stg,or.Stg),me(t,Zn.Prev,or.Prev),me(t,Zn.Prod,or.Prod),t)[e]},sr={en:{applepay:{cancel:"Cancel",enquire:"Continue to place the order with Apple Pay?",paywith:"Pay with"},cart:{cart:{buy_now:"Buy now"},checkout:{max_amount_limit:"You exceeded the maximum amount for checkout"},couponCode:{existCode:"Discount code already exists"},error:{default:"Failed to load resource",noshipping:"No available shipping rate plans",order:"Unable to place order",renew:"Failed to update data"}},general:{abandon:{Order:{risk:"You have sent too many requests"}}},products:{product_details:{link_preview_does_not_support:"The link preview does not support this action",more_payment_options:"More payment options"},product_list:{select_product_all_options:"Please select all options of this product"}},sdk:{button:{show:"More",unavailable:{network_unstable:"Network unstable. Try again to continue.",wait_and_retry:"There are currently too many customers. Please wait patiently and try again after {seconds} seconds."}}},transaction:{discount:{code_error:"Enter a valid discount code"}},unvisiable:{shopby:{button:{show:"Secured and Faster"}}}}},ur=de((function e(){var t=this;se(this,e),me(this,"locale",sr.en),me(this,"envLocal",window.__I18N__),me(this,"language",""),me(this,"getI18nJsonPromise",null),me(this,"setLanguage",function(){var e=ce(Oe.mark((function e(n){var r,o,a,i;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.getI18nJsonPromise){e.next=3;break}return e.next=3,t.getI18nJsonPromise;case 3:if(t.language!==n){e.next=5;break}return e.abrupt("return");case 5:return t.language=n,r=(null===(c=window.__ENV__)||void 0===c?void 0:c.APP_ENV)||Zn.Prod,o=cr(r),a=sr.en,i=ae.get().withOwner("I18n"),e.prev=10,i.info("get i18n json",{data:{project:ar,env:o,lang:n}}),t.getI18nJsonPromise=rr({project:ar,env:o,lang:n}),e.next=15,t.getI18nJsonPromise;case 15:a=e.sent,e.next=21;break;case 18:e.prev=18,e.t0=e.catch(10),i.error("get i18n json error",{error:e.t0});case 21:return e.prev=21,t.getI18nJsonPromise=null,e.finish(21);case 24:t.locale=a;case 25:case"end":return e.stop()}var c}),e,null,[[10,18,21,24]])})));return function(t){return e.apply(this,arguments)}}()),me(this,"useI18n",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return function(n,r){var o=ir(t.envLocal||{},e?[e,n].join("."):n)||"";return o||(o=ir(t.locale||{},e?[e,n].join("."):n)||""),o||(o=ir(sr.en||{},e?[e,n].join("."):n)||""),r&&Object.entries(r).forEach((function(e){var t=dt(e,2),n=t[0],r=t[1];return o=o.replace(new RegExp("{".concat(n,"}"),"ig"),r)})),o}}))})),lr=new ur,dr=lr.useI18n,fr=lr.setLanguage,pr=dr(),hr=function(){var e=ce(Oe.mark((function e(t){var n,r,o,a,i;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ok,r=t.cancel,o="".concat(Qn,"-action-ok"),a="".concat(Qn,"-action-cancel"),i=$n({content:'<div>\n        <div class="'.concat(Qn,'-header">').concat(er,'</div>\n        <div class="').concat(Qn,'-content">').concat(pr("applepay.enquire"),'</div>\n        <div class="').concat(Qn,'-action">\n          <button class="').concat(o,'"><span>').concat(pr("applepay.paywith"),"</span> ").concat(er,'</button>\n          <button class="').concat(a,'">').concat(pr("applepay.cancel"),"</button>\n        </div>\n      </div>"),modalStyles:function(e){return e.width="calc(100% - 32px)",e.maxWidth="397px",e.padding="24px",e.top="45%",e.borderRadius="8px",e.background="rgba(255, 255, 255, 1)",e.backdropFilter="blur(6px)",e},overlayStyles:function(e){return e.backgroundColor="rgba(0, 0, 0, 0.5)",e.opacity="1",e},modalClass:"sl-payment ".concat(Qn),closeButton:!1,overlayClose:!1,escCloses:!1}).afterCreate((function(e){var t,i,c=e.modalElem();if(!c)throw new Error("picoModal instantiated object not found");null===(t=c.querySelector(".".concat(o)))||void 0===t||t.addEventListener("click",(function(){e.close(),n(e)})),null===(i=c.querySelector(".".concat(a)))||void 0===i||i.addEventListener("click",(function(){e.close(),null==r||r()}))})),e.abrupt("return",i);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),yr=function(e){var t,n=e.node,r=e.domId,o=e.height,a=e.wrapperClass,i=document.createElement("div");i.classList.add("applepay__bg");var c=document.createElement("style");if(vr({styleTag:c,domId:r,height:o}),n)return a&&n.classList.add(a),null===(t=n.parentElement)||void 0===t||t.insertBefore(c,n),n.appendChild(i),i},vr=function(e){var t=e.styleTag,n=e.domId,r=e.height;t.innerHTML="\n    #".concat(n," applepay__bg {\n        overflow: hidden;\n        text-align: center;\n        height: ").concat(r,"px;\n      }\n    ")};function mr(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var gr=function(e){return e.channelCode===Pe.SLpayments},br=function(e){return e.channelCode===Pe.AdyenExpress},wr=function(e){return function(e){return e.accessMode===Le.PAYMENT_OPEN}(e)||e.channelCode===Pe.CybsOther};function _r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}window.crypto||(window.crypto=window.msCrypto);var Or=function(){try{return function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,t="",n=crypto.getRandomValues(new Uint8Array(e));e--;){var r=63&n[e];t+=r<36?r.toString(36):r<62?(r-26).toString(36).toUpperCase():r<63?"_":"-"}return t}(36)}catch(e){return Date.now()+Math.random().toString(36).slice(2)}},Cr=function e(){_r(this,e),this.pvId=Or()};Cr.setPvIdInGlobal=function(e){window.__PAYMENT_SDK_PVID__=e},Cr.getPvIdInGlobal=function(){return window.__PAYMENT_SDK_PVID__};var kr=function(){var e=Cr.getPvIdInGlobal();if(e)return e;var t=(new Cr).pvId;return Cr.setPvIdInGlobal(t),t}();function Sr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Pr(e,t,n){return t&&Sr(e.prototype,t),n&&Sr(e,n),e}var xr="",Ir=function(){function e(){_r(this,e);var t=navigator.userAgent;this.ua=t,this.os=this.detectOS(this.ua),this.os_version=this.detectOSVersion(this.ua,this.os),this.browser=this.detectBrowser(this.ua),this.browser_version=this.detectBrowserVersion(this.ua,this.browser)}return Pr(e,[{key:"detectOS",value:function(e){switch(!0){case/Android/.test(e):return"Android";case/iPhone|iPad|iPod/.test(e):return"iOS";case/Windows/.test(e):return"Windows";case/Mac OS X/.test(e):return"Mac";case/CrOS/.test(e):return"Chrome OS";case/Firefox/.test(e):return"Firefox OS"}return""}},{key:"detectOSVersion",value:function(e,t){switch(t){case"Android":return this.getVersion(e,"Android");case"iOS":return this.getVersion(e,/OS /);case"Windows":return this.getVersion(e,/Phone/.test(e)?/Windows Phone (?:OS )?/:/Windows NT/);case"Mac":return this.getVersion(e,/Mac OS X /)}return"0.0.0"}},{key:"getVersion",value:function(e,t){try{return this.normalizeSemverString(e.split(t)[1].trim().split(/[^\w.]/)[0])}catch(e){}return"0.0.0"}},{key:"normalizeSemverString",value:function(e){var t=e.split(/[._]/);return(parseInt(t[0],10)||0)+"."+(parseInt(t[1],10)||0)+"."+(parseInt(t[2],10)||0)}},{key:"detectBrowser",value:function(e){var t=/Android/.test(e);switch(!0){case/CriOS/.test(e):return"Chrome for iOS";case/Edge/.test(e):return"Edge";case t&&/Silk\//.test(e):return"Silk";case/Chrome/.test(e):return"Chrome";case/Firefox/.test(e):return"Firefox";case t:return"AOSP";case/MSIE|Trident/.test(e):return"IE";case/Safari\//.test(e):return"Safari";case/AppleWebKit/.test(e):return"WebKit"}return""}},{key:"detectBrowserVersion",value:function(e,t){switch(t){case"Chrome for iOS":return this.getVersion(e,"CriOS/");case"Edge":return this.getVersion(e,"Edge/");case"Chrome":return this.getVersion(e,"Chrome/");case"Firefox":return this.getVersion(e,"Firefox/");case"Silk":return this.getVersion(e,"Silk/");case"AOSP":case"Safari":return this.getVersion(e,"Version/");case"IE":return/IEMobile/.test(e)?this.getVersion(e,"IEMobile/"):/MSIE/.test(e)?this.getVersion(e,"MSIE "):this.getVersion(e,"rv:");case"WebKit":return this.getVersion(e,"WebKit/")}return"0.0.0"}}]),e}();function Er(e){return(Er="function"==typeof Symbol&&"symbol"==k(Symbol.iterator)?function(e){return k(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":k(e)})(e)}function Tr(e){if("object"!==Er(e))return"";var t=[];for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=encodeURIComponent(e[n]);t.push("".concat(n,"=").concat(r))}return t.join("&")}var jr=new(function(){function e(){_r(this,e),this.buildUrl=function(e,t){var n=Object.prototype.toString.call(t);return t&&"[object Object]"===n?(e=decodeURIComponent(e).indexOf("?")>-1?"".concat(e,"&"):"".concat(e,"?"))+Tr(t):e}}return Pr(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=this.buildUrl(e,t.params),this.http(e,Object.assign(Object.assign({method:"GET"},t),{headers:Object.assign(Object.assign({},{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"}),t.headers)}))}},{key:"post",value:function(e,t){var n,r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a={Accept:"application/json"},i=t||o.data;return"form"==((null===(n=null==o?void 0:o.headers)||void 0===n?void 0:n["Content-Type"])&&/application\/json/.test(null===(r=null==o?void 0:o.headers)||void 0===r?void 0:r["Content-Type"])?"json":"form")?(a["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8",i=Tr(i)):(a["Content-Type"]="application/json;charset=UTF-8",i=i?JSON.stringify(i):null),this.http(e,Object.assign(Object.assign({method:"POST",body:i},o),{headers:Object.assign(Object.assign({},a),o.headers)}))}},{key:"http",value:function(e,t){return new Promise((function(n,r){var o=new XMLHttpRequest,a=t.body,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["body"]);for(var c in o.open(t.method,e),t.headers)Object.prototype.hasOwnProperty.call(t.headers,c)&&o.setRequestHeader(c,t.headers[c]);o.onreadystatechange=function(){if(4===o.readyState){var t={options:i,statusCode:o.status,url:e},a="";try{a=JSON.parse(o.responseText)}catch(e){a=o.responseText}if(/^(2|3)\d{2}$/.test(o.status.toString())){try{n(Object.assign({data:a},t))}catch(e){n(Object.assign({data:a},t))}return}r(Object.assign({data:a},t))}},o.send(a),o.onerror=function(e){throw e}}))}}]),e}()),Ar=0;function Lr(e,t){return(Lr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Dr(e){return(Dr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Nr(e,t,n){return(Nr=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Lr(o,n.prototype),o}).apply(null,arguments)}function Br(e){var t="function"==typeof Map?new Map:void 0;return(Br=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Nr(e,arguments,Dr(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Lr(r,e)})(e)}var Mr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Lr(e,t)}(n,Br(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Dr(e);if(t){var o=Dr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!==Er(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,n)}}(n);function n(e){var r;return _r(this,n),(r=t.call(this,e)).name="LinkMonitorError",r.message="[LinkMonitorError]: "+e||"[LinkMonitorError]: Error",r}return n}(),Rr=function(){function e(t,n){var r=this;if(_r(this,e),this.act="",this.reportNetworkConfig={},this.defaultOptions={},this.bs_queue=0,this.queue=[],this.queueIsRIFScheduled=!1,this.upload=function(e){if(r.queueIsRIFScheduled=!1,e||(e={didTimeout:!0,timeRemaining:function(){return Number.MAX_VALUE}}),(null==e?void 0:e.timeRemaining())>0||r.queue.length>0){var t=r.queue.shift();t&&function(e,t){var n=e.url,r=e.mode,o=e.method,a=e.headers,i=e.onError;if(n&&!(Ar>=5))if("image"!==r)"ajax"!==r||"post"!==o?"ajax"!==r||"get"!==o||jr.get(n,{params:t,headers:a}).catch((function(e){Ar+=1,"function"==typeof i&&i(e),window[window.__sl_console__?"__sl_console__":"console"].log("linkMonitor:",e)})):jr.post(n,t,{headers:a}).catch((function(e){Ar+=1,"function"==typeof i&&i(e),window[window.__sl_console__?"__sl_console__":"console"].log("linkMonitor:",e)}));else try{!function(e,t,n){var r=new Image(1,1),o=Tr(t),a="".concat(e,"?").concat(o);r.onerror=function(){"function"==typeof n&&n(new Error("linkMonitor: fail to get img"))},r.onload=function(){},r.src=a}(n,t,i)}catch(e){Ar+=1,window[window.__sl_console__?"__sl_console__":"console"].log("linkMonitor:",e)}}(t.reportNetworkConfig,t.reportData)}r.queue.length>0&&r.upload()},this.sendBeacon=function(e){!function(e,t){var n=e.url,r=e.onError;if(n&&!(Ar>=5))try{navigator.sendBeacon(e.url,URLSearchParams?new URLSearchParams(t):Tr(t))}catch(e){Ar+=1,"function"==typeof r&&r(e)}}(e.reportNetworkConfig,e.reportData)},!t)throw new Mr("Core class initialization requires the act field");this.act=t,this.reportNetworkConfig=n,this.getDefaultOptions()}return Pr(e,[{key:"updateReportNetworkConfig",value:function(e){this.reportNetworkConfig=Object.assign(Object.assign({},this.reportNetworkConfig),e)}},{key:"getDefaultOptions",value:function(){var e,t=this.act,n={bs_ua:(e=new Ir).ua,bs_os:e.os,bs_os_version:e.os_version,bs_browser:e.browser,bs_browser_version:e.browser_version},r={bs_screen_height:window.screen.height,bs_screen_width:window.screen.width,bs_color_depth:window.screen.colorDepth.toString()},o=window.navigator.javaEnabled().toString(),a=(new Date).getTimezoneOffset().toString(),i=window.navigator.language,c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"2021-12-08";try{var t=document.createElement("canvas"),n=t.getContext("2d"),r=e;if(!n)return Date.now()+Math.random().toString(36).slice(2);n.textBaseline="top",n.font="14px 'Arial'",n.textBaseline="tencent",n.fillStyle="#f60",n.fillRect(125,1,62,20),n.fillStyle="#069",n.fillText(r,2,15),n.fillStyle="rgba(102, 204, 0, 0.7)",n.fillText(r,4,17);var o=t.toDataURL().replace("data:image/png;base64,","");return function(e){var t,n,r,o="";for(t=0,n=(e+="").length;t<n;t++)o+=(r=e.charCodeAt(t).toString(16)).length<2?"0"+r:r;return o}(window.atob(o).slice(-16,-12))}catch(e){return Date.now()+Math.random().toString(36).slice(2)}}();this.defaultOptions=Object.assign(Object.assign(Object.assign({act:t,bs_lib_plugin_version:"1.7.1"},n),r),{bs_java_enabled:o,bs_time_zone_offset:a,bs_language:i,fg:c})}},{key:"getDefaultDynamicOptions",value:function(){var e=Date.now(),t=Math.floor(e/1e3),n=document.title,r=window.location.href,o=document.referrer,a={bs_viewport_height:document.documentElement.offsetHeight||document.body.offsetHeight,bs_viewport_width:document.documentElement.offsetWidth||document.body.offsetWidth},i=a.bs_viewport_height,c=a.bs_viewport_width,s=this.bs_queue++,u=Or();return{pvId:kr,time:t,bs_create_time:e,bs_title:n,bs_url:r,bs_referrer:o,bs_viewport_height:i,bs_viewport_width:c,bs_queue:s,bs_uuid:u}}},{key:"send",value:function(e,t){var n=this.getDefaultDynamicOptions(),r=Object.assign(Object.assign(Object.assign(Object.assign({},this.defaultOptions),n),{eventName:e}),t),o=function(e){try{var t="ajax"===e.mode&&"post"===e.method,n=!!e.headers&&Object.keys(e.headers).length>0;return t&&!n&&window.navigator&&"function"==typeof window.navigator.sendBeacon}catch(e){return!1}}(this.reportNetworkConfig),a={reportNetworkConfig:this.reportNetworkConfig,reportData:r};o?this.sendBeacon(a):(this.queue.push(a),this.queueUpload())}},{key:"queueUpload",value:function(){var e,t;this.queueIsRIFScheduled||(this.queueIsRIFScheduled=!0,e=this.upload,t={timeout:2e3},"requestIdleCallback"in window?window.requestIdleCallback(e,t):setTimeout(e,0))}}]),e}(),Fr={debug:!1,url:"",mode:"ajax",method:"post"},Ur=function(){function e(t,n){_r(this,e),this.businessDefaultOptions={version:"0.0.0",environment:"production"},this.act=t,this.options=Object.assign(Object.assign({},Fr),n),this.options.debug&&(this.options.url=xr),this.fedLog=new Rr(t,{url:this.options.url,mode:this.options.mode,method:this.options.method,headers:this.options.headers})}return Pr(e,[{key:"init",value:function(e,t){t&&this.fedLog.updateReportNetworkConfig(t),this.businessDefaultOptions=Object.assign(Object.assign({},this.businessDefaultOptions),e)}},{key:"report",value:function(e,t){var n=function(e){var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t[n]=r instanceof Object?JSON.stringify(r):r}return t}(t),r=Object.assign(Object.assign({},this.businessDefaultOptions),n);this.fedLog.send(e,r)}}]),e}();function Hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qr(e){return function(e){if(Array.isArray(e))return Hr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Hr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function zr(e,t,n){return t&&Vr(e.prototype,t),n&&Vr(e,n),e}function Wr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kr(e){return(Kr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xr(e,t,n){return(Xr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Kr(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function Jr(e,t){return(Jr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $r(e){return($r="function"==typeof Symbol&&"symbol"==k(Symbol.iterator)?function(e){return k(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":k(e)})(e)}"function"!=typeof Object.assign&&(Object.assign=function(e){for(var t=arguments.length,n=1;n<t;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e});var Zr=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Qr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,eo=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,to=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;function no(e){return(e&&e.message||"No error message").split("\n").filter((function(e){return!!e}))[0]}function ro(e){try{var t=function(e){if(!e.stack)return null;for(var t,n,r=[],o=e.stack.split("\n"),a=0;a<o.length;++a){if(t=Zr.exec(o[a]))n={filename:t[2]&&0===t[2].indexOf("address at ")?t[2].substr("address at ".length):t[2],function:t[1]||"?",lineno:t[3]?+t[3]:null,colno:t[4]?+t[4]:null};else if(t=eo.exec(o[a]))n={filename:t[2],function:t[1]||"?",lineno:+t[3],colno:t[4]?+t[4]:null};else{if(!(t=Qr.exec(o[a])))continue;0!==a||t[5]||void 0===e.columnNumber||(r[0].column=e.columnNumber+1),n={filename:t[3],function:t[1]||"?",lineno:t[4]?+t[4]:null,colno:t[5]?+t[5]:null}}!n.function&&n.lineno&&(n.function="?"),r.push(n)}return r.length?{value:no(e),type:e.name,stacktrace:{frames:r.reverse()}}:null}(e);if(t)return t}catch(e){}return{value:no(e),type:e&&e.name,stacktrace:{frames:[]}}}var oo=Object.assign||function(e){for(var t=arguments.length,n=1;n<t;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ao=function(){function e(t){if(Yr(this,e),t.dsn){var n=to.exec(t.dsn),r=n?n.slice(1):[],o=r[5].split("/"),a=o.slice(0,-1).join("/");this.apiUrl=r[0]+"://"+r[3]+(r[4]?":"+r[4]:"")+(a?"/"+a:"")+"/api/"+o.pop()+"/store/",this.authHeader="Sentry sentry_version=7,sentry_key="+r[1]+(r[2]?",sentry_secret="+r[2]:"")}this.environment=t.environment}return zr(e,[{key:"prepare",value:function(e){return oo(this.getRequestBlank(),{exception:{values:[ro(e)]}})}},{key:"report",value:function(e){this.send(this.prepare(e))}},{key:"send",value:function(e){if(this.apiUrl){var t=new XMLHttpRequest;t.open("POST",this.apiUrl,!0),t.setRequestHeader("Content-type","application/json"),t.setRequestHeader("X-Sentry-Auth",this.authHeader||""),t.send(JSON.stringify(e))}}},{key:"getRequestBlank",value:function(){return{platform:"javascript",sdk:{name:"micro-sentry.javascript.browser",version:"0.0.0"},timestamp:Date.now()/1e3,request:{url:window.location.toString(),headers:{"User-Agent":window.navigator.userAgent}},environment:this.environment}}}]),e}();function io(e,t){return"[object RegExp]"===Object.prototype.toString.call(t)?t.test(e):"string"==typeof t&&-1!==e.indexOf(t)}var co=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Jr(e,t)}(n,ao);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Kr(e);if(t){var o=Kr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!==$r(t)&&"function"!=typeof t?Wr(e):t}(this,n)}}(n);function n(e){var r;Yr(this,n),(r=t.call(this,e)).options=e,r.destroyed=!1,r._state={};var o=r.options||{},a=o.plugins,i=void 0===a?[]:a,c=o.beforeSend,s=void 0===c?function(e){return e}:c,u=o.beforeBreadcrumb,l=void 0===u?function(e){return e}:u,d=o.blacklistUrls,f=void 0===d?[]:d,p=o.ignoreErrors,h=void 0===p?[]:p,y=o.release,v=void 0===y?void 0:y;return r.plugins=i.map((function(e){return new e(Wr(r))})),r.beforeSend=s,r.beforeBreadcrumb=l,r.blacklistUrls=f,r.ignoreErrors=h,r.release=v,r}return zr(n,[{key:"state",get:function(){return this._state}},{key:"clearState",value:function(){this._state={}}},{key:"setTags",value:function(e){return this.setKeyState("tags",Object.assign({},e)),this}},{key:"setTag",value:function(e,t){return this.extendState({tags:Gr({},e,t)}),this}},{key:"setExtra",value:function(e,t){return this.extendState({extra:Gr({},e,t)}),this}},{key:"setExtras",value:function(e){return this.setKeyState("extra",Object.assign({},e)),this}},{key:"setUser",value:function(e){return this.setKeyState("user",Object.assign({},e)),this}},{key:"clone",value:function(){var e=new n(Object.assign(Object.assign({},this.options),{plugins:[]}));return e.extendState(this.state),e}},{key:"withScope",value:function(e){var t=this.clone();e(t),t.destroy(),this.setBreadcrumbs(void 0)}},{key:"addBreadcrumb",value:function(e){this.extendState({breadcrumbs:[Object.assign({timestamp:Date.now()/1e3},this.beforeBreadcrumb(e))]})}},{key:"setBreadcrumbs",value:function(e){this.setKeyState("breadcrumbs",e)}},{key:"captureMessage",value:function(e,t){this.send(Object.assign(Object.assign({},this.getRequestBlank()),{message:e,level:t}))}},{key:"destroy",value:function(){this.destroyed=!0,this.plugins.forEach((function(e){e.destroy&&e.destroy()}))}},{key:"isIgnoredError",value:function(e){var t=this;return!!this.ignoreErrors.length&&this.getPossibleEventMessages(e).some((function(e){return t.ignoreErrors.some((function(t){return io(e,t)}))}))}},{key:"getRequestBlank",value:function(){return Object.assign(Object.assign({},Xr(Kr(n.prototype),"getRequestBlank",this).call(this)),this.state)}},{key:"send",value:function(e){this.destroyed||this.isDeniedUrl(e)||this.isIgnoredError(e)||(Xr(Kr(n.prototype),"send",this).call(this,this.beforeSend(Object.assign({release:this.release},e))),this.setBreadcrumbs(void 0))}},{key:"getPossibleEventMessages",value:function(e){if(e.message)return[e.message];if(e.exception)try{var t=e.exception.values&&e.exception.values[0]||{},n=t.type,r=void 0===n?"":n,o=t.value,a=void 0===o?"":o;return["".concat(a),"".concat(r,": ").concat(a)]}catch(e){return[]}return[]}},{key:"isDeniedUrl",value:function(e){if(!this.blacklistUrls.length)return!1;var t=this.getEventFilterUrl(e);return!!t&&this.blacklistUrls.some((function(e){return io(t,e)}))}},{key:"getEventFilterUrl",value:function(e){try{if(e.exception){var t=e.exception.values&&e.exception.values[0].stacktrace&&e.exception.values[0].stacktrace.frames;return t&&t[t.length-1].filename||null}return null}catch(e){return null}}},{key:"extendState",value:function(e){var t=this;this._state=Object.keys(e).reduce((function(n,r){var o=t.state[r],a=Array.isArray(o)?o:null,i=e[r],c=Array.isArray(i)?i:null;return Object.assign(Object.assign({},n),Gr({},r,a||c?[].concat(qr(a||[]),qr(c||[])):Object.assign(Object.assign({},"string"!=typeof o?o:{}),"string"!=typeof i?i:{})))}),{})}},{key:"setKeyState",value:function(e,t){this._state[e]=t}}]),n}();function so(e,t,n){var r=e[t],o=n(r);if("function"==typeof o)try{o.prototype=o.prototype||{},Object.defineProperties(o,{__original__:{enumerable:!1,value:r}})}catch(e){}e[t]=o}function uo(e){if(!e)return{};var t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};var n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+n+r}}function lo(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return"Request"in window&&e[0]instanceof Request&&e[0].method?String(e[0].method).toUpperCase():e[1]&&e[1].method?String(e[1].method).toUpperCase():"GET"}function fo(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return"string"==typeof e[0]?e[0]:"Request"in window&&e[0]instanceof Request?e[0].url:String(e[0])}function po(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function ho(e){var t=e,n=[];if(!t||!t.tagName)return"";n.push(t.tagName.toLowerCase()),t.id&&n.push("#".concat(t.id));var r=t.className;if(r&&"string"==typeof r){var o=r.split(/\s+/);n.concat(o.map((function(e){return".".concat(e)})))}return["type","name","title","alt","automation-id"].forEach((function(e){var r=t.getAttribute(e);r&&n.push("[".concat(e,'="').concat(r,'"]'))})),n.join("")}function yo(e){try{for(var t,n=e,r=[],o=0,a=0,i=" > ".length;n&&o++<5&&!("html"===(t=ho(n))||o>1&&a+r.length*i+t.length>=80);)r.push(t),a+=t.length,n=n.parentNode;return r.reverse().join(" > ")}catch(e){return"<unknown>"}}function vo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return Array.isArray(e)?e.map((function(e){try{return String(e)}catch(e){return""}})).filter((function(e){return""!==e})).join(t):""}function mo(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function go(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){mo(a,r,o,i,c,"next",e)}function c(e){mo(a,r,o,i,c,"throw",e)}i(void 0)}))}}function bo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _o(e,t,n){return t&&wo(e.prototype,t),n&&wo(e,n),e}function Oo(e,t){return(Oo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Co(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Oo(e,t)}function ko(e){return(ko="function"==typeof Symbol&&"symbol"==k(Symbol.iterator)?function(e){return k(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":k(e)})(e)}function So(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Po(e,t){return!t||"object"!==ko(t)&&"function"!=typeof t?So(e):t}function xo(e){return(xo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Io(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}zr((function e(t){Yr(this,e),this.client=t,this.subscriptions=[],this.initDOM(),this.initConsole(),this.initFetch(),this.initHistory(),this.initXHR()}),[{key:"initXHR",value:function(){if("XMLHttpRequest"in window){var e=this,t=XMLHttpRequest.prototype;so(t,"open",(function(t){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var a=this,i=r[1];a.__sentry_xhr__={method:"string"==typeof r[0]?r[0].toUpperCase():r[0],url:r[1]},"string"==typeof i&&"POST"===a.__sentry_xhr__.method&&i.match(/sentry_key/)&&(a.__sentry_own_request__=!0);var c=function(){if(4===a.readyState){try{a.__sentry_xhr__&&(a.__sentry_xhr__.status_code=a.status)}catch(e){}e.xhrBreadcrumb({args:r,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:a})}};return"onreadystatechange"in a&&"function"==typeof a.onreadystatechange?so(a,"onreadystatechange",(function(e){return function(){c();for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.apply(a,n)}})):a.addEventListener("readystatechange",c),t.apply(a,r)}})),so(t,"send",(function(t){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.xhrBreadcrumb({args:r,startTimestamp:Date.now(),xhr:this}),t.apply(this,r)}}))}}},{key:"initHistory",value:function(){var e=this,t=window.onpopstate;function n(t){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var a=r.length>2?r[2]:void 0;if(a){var i=e.lastHref,c=String(a);e.lastHref=c,e.historyBreadcrumb({from:i,to:c})}return t.apply(this,r)}}window.onpopstate=function(){var n=window.location.href,r=e.lastHref;if(e.lastHref=n,e.historyBreadcrumb({from:r,to:n}),t){for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return t.apply(this,a)}},so(window.history,"pushState",n),so(window.history,"replaceState",n)}},{key:"destroy",value:function(){this.subscriptions.forEach((function(e){return e()}))}},{key:"initDOM",value:function(){var e=this,t=function(t){return e.prepareDomEvent("click",t)},n=function(t){return e.prepareDomEvent("keypress",t)};window.document.addEventListener("click",t,!1),window.document.addEventListener("keypress",n,!1),this.subscriptions.push((function(){window.document.removeEventListener("click",t,!1),window.document.removeEventListener("keypress",n,!1)}))}},{key:"prepareDomEvent",value:function(e,t){var n;try{n=t.target?yo(t.target):yo(t)}catch(e){n="<unknown>"}0!==n.length&&this.client.addBreadcrumb({category:"ui.".concat(e),message:n})}},{key:"initFetch",value:function(){var e=this;(function(){if(!function(){if(!("fetch"in window))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}())return!1;if(po(window.fetch))return!0;var e=!1,t=window.document;if(t&&"function"==typeof t.createElement)try{var n=t.createElement("iframe");n.sandbox.add("allow-scripts"),n.sandbox.add("allow-same-origin"),n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=po(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){}return e})()&&so(window,"fetch",(function(t){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var a={args:r,fetchData:{method:lo(r),url:fo(r)},startTimestamp:Date.now()};return e.fetchBreadcrumb(Object.assign({},a)),t.apply(window,r).then((function(t){return e.fetchBreadcrumb(Object.assign(Object.assign({},a),{endTimestamp:Date.now(),response:t})),t}),(function(t){throw e.fetchBreadcrumb(Object.assign(Object.assign({},a),{endTimestamp:Date.now(),error:t})),t}))}}))}},{key:"fetchBreadcrumb",value:function(e){e.endTimestamp&&(e.fetchData.url.match(/sentry_key/)&&"POST"===e.fetchData.method||(e.error?this.client.addBreadcrumb({category:"fetch",data:e.fetchData,level:"error",type:"http"}):this.client.addBreadcrumb({category:"fetch",data:Object.assign(Object.assign({},e.fetchData),{status_code:e.response.status}),type:"http"})))}},{key:"xhrBreadcrumb",value:function(e){if(e.endTimestamp){if(e.xhr.__sentry_own_request__)return;this.client.addBreadcrumb({category:"xhr",data:e.xhr.__sentry_xhr__,type:"http"})}}},{key:"initConsole",value:function(){var e=this;["debug","info","warn","error","log","assert"].forEach((function(t){t in window[window.__sl_console__?"__sl_console__":"console"]&&so(window[window.__sl_console__?"__sl_console__":"console"],t,(function(n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var i={category:"console",data:{arguments:o.map((function(e){try{return JSON.stringify(e),e}catch(t){return Object.prototype.toString.call(e)}})),logger:"console"},level:t,message:vo(o," ")};if("assert"===t){if(!1!==o[0])return;i.message="Assertion failed: ".concat(vo(o.slice(1)," ")||"console.assert"),i.data.arguments=o.slice(1)}e.client.addBreadcrumb(i),n&&Function.prototype.apply.call(n,window[window.__sl_console__?"__sl_console__":"console"],o)}}))}))}},{key:"historyBreadcrumb",value:function(e){var t=e.from,n=e.to,r=uo(window.location.href),o=uo(t),a=uo(n);o.path||(o=r),r.protocol===a.protocol&&r.host===a.host&&(n=a.relative),r.protocol===o.protocol&&r.host===o.host&&(t=o.relative),this.client.addBreadcrumb({category:"navigation",data:{from:t,to:n}})}}]);var Eo={};!function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),i=new E(r||[]);return a._invoke=function(e,t,n){var r=d;return function(o,a){if(r===p)throw new Error("Generator is already running");if(r===h){if("throw"===o)throw a;return j()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=P(i,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var s=l(e,t,n);if("normal"===s.type){if(r=n.done?h:f,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=h,n.method="throw",n.arg=s.arg)}}}(e,n,i),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d="suspendedStart",f="suspendedYield",p="executing",h="completed",y={};function v(){}function m(){}function g(){}var b={};b[a]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(T([])));_&&_!==n&&r.call(_,a)&&(b=_);var O=g.prototype=v.prototype=Object.create(b);function C(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(o,a,i,c){var s=l(e[o],e,a);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==k(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(d).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(s.arg)}var o;this._invoke=function(e,r){function a(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(a,a):a()}}function P(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,P(e,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}return{next:j}}function j(){return{value:t,done:!0}}return m.prototype=O.constructor=g,g.constructor=m,m.displayName=s(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},C(S.prototype),S.prototype[i]=function(){return this},e.AsyncIterator=S,e.async=function(t,n,r,o,a){void 0===a&&(a=Promise);var i=new S(u(t,n,r,o),a);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},C(O),s(O,c,"Generator"),O[a]=function(){return this},O.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}(Eo);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}();var To,jo,Ao,Lo,Do=Eo;function No(e,t,n){return(No=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Oo(o,n.prototype),o}).apply(null,arguments)}function Bo(e){var t="function"==typeof Map?new Map:void 0;return(Bo=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return No(e,arguments,xo(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Oo(r,e)})(e)}function Mo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=xo(e);if(t){var o=xo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Po(this,n)}}!function(e){e.NotSupportBrowser="1026",e.InnerSDKError="1027",e.RenderFail="1028",e.NetworkError="1109",e.FrequentRequest="1904",e.AbnormalTrade="4205"}(To||(To={})),function(e){e.AbnormalTrade="TRANSACTION_ABNORMAL",e.NetworkError="Network error"}(jo||(jo={})),function(e){e.Fatal="fatal",e.Error="error"}(Ao||(Ao={})),function(e){e.IframeError="PciIframeError",e.NoDom="NoDomError"}(Lo||(Lo={}));var Ro=function(e){Co(n,Bo(Error));var t=Mo(n);function n(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:To.InnerSDKError,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UnknownError",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ao.Error;return bo(this,n),Io(So(r=t.call(this,e)),"code",void 0),Io(So(r),"isReported",!1),Io(So(r),"data",void 0),Io(So(r),"errorLevel",void 0),r.name=a,r.code=o,r.errorLevel=i,r}return _o(n,[{key:"setIsReported",value:function(){this.isReported=!0}}]),n}(),Fo=function(e){Co(n,Ro);var t=Mo(n);function n(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:To.InnerSDKError,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"SilenceError",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ao.Error;return bo(this,n),Io(So(r=t.call(this,e,o,a,i)),"statusCode",void 0),r}return n}();function Uo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ho(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uo(Object(n),!0).forEach((function(t){Io(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var qo=new co({dsn:"https://820fe9124d6a4b4d8ef0ee1e44a29c4b@sentry-new.myshopline.com/305",release:"3.6.1",environment:"production",beforeSend:function(e){return e}});function Go(e,t){var n=JSON.stringify(Ho(Ho({},e||{}),{},{originErrorMessage:null==t?void 0:t.message,originErrorData:t?JSON.stringify(t):void 0,errorLevel:(null==t?void 0:t.errorLevel)||(null==e?void 0:e.errorLevel)||Ao.Error})),r=new Error(n);if(null!=t&&t.stack)try{r.stack=t.stack}catch(e){qo.report(e),qo.report(t)}qo.report(r)}function Yo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return e?function(e,t){for(var n="",r=0;r<t;r++)n+="*";return n}(0,t)+e.slice(t):e}function Vo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vo(Object(n),!0).forEach((function(t){Io(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Wo,Ko,Xo,Jo,$o=new Ur("webpaymentsdk"),Zo=function(){function e(){bo(this,e)}return _o(e,null,[{key:"init",value:function(e){$o.init({projectName:"pcisdk",environment:"production",version:"3.6.1"},e.eventTrackingConfig),qo.setTag("pvId",kr)}},{key:"setHost",value:function(e){qo.setTag("host",e)}},{key:"reportError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"report_error",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e instanceof Fo||e.name===Lo.IframeError||(e instanceof Ro?e.isReported||(Go(zo({eventName:t},n),e),e.setIsReported()):Go(zo({eventName:t},n),e))}},{key:"handleError",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pci_sdk_default_error",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.reportData(n,zo(zo({},t),r)),e.reportError(t,n,r),t instanceof Fo||t instanceof Ro)throw t;var o="".concat(n," ").concat(t.message||"pci sdk inner error"),a=new Fo(o);throw a.statusCode=t.statusCode,a.name=t.name||"Error",a.code=t.code||a.code,a.errorLevel=t.errorLevel||Ao.Error,a.data=zo({code:To.InnerSDKError,msg:o},t.data||{}),a}},{key:"formatReportData",value:function(e){if(!e)return{};var t=zo({},e);return t.customerToken&&(t.customerToken=Yo(t.customerToken,30)),t.payToken&&(t.payToken=Yo(t.payToken,10)),t}},{key:"reportData",value:function(t,n){try{$o.report(t,n?{extraData:JSON.stringify(n)}:{})}catch(r){e.reportError(r,"".concat(t,"_report_data_error"),n)}}},{key:"reportErrorData",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ao.Error;e.reportData(t,n),Go(zo({eventName:t,errorLevel:r},n))}}]),e}();!function(e){e.Redirect="Redirect",e.Confirm="Confirm",e.QrCode="QrCode",e.WorldPayGather="WorldPayGather",e.ExchangeTicket="ExchangeTicket"}(Wo||(Wo={})),function(e){e.Success="success",e.Fail="fail"}(Ko||(Ko={})),function(e){e.Number="number",e.Cvc="cvc",e.FirstName="firstName",e.ExpDate="expDate"}(Xo||(Xo={})),function(e){e.Hidden="hidden-iframe",e.Cache="cache-iframe"}(Jo||(Jo={})),Xo.Number,Xo.Cvc,Xo.ExpDate;var Qo,ea,ta,na,ra=[Xo.Number,Xo.Cvc,Xo.ExpDate,Xo.FirstName];function oa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function aa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oa(Object(n),!0).forEach((function(t){Io(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}(Qo||(Qo={})).CN="CN",function(e){e.SL2="shopline2",e.SLP="slp"}(ea||(ea={})),function(e){e.validate="getValidate",e.pay="pay",e.getBeforePayData="getBeforePayData",e.getCardToken="getCardToken",e.updateCardToken="updateCardToken",e.getCurrentCardInfo="getCurrentCardInfo",e.getCardTokenInfoByCardToken="getCardTokenInfoByCardToken"}(ta||(ta={})),function(e){e.validate="validate",e.pay="payResult",e.getBeforePayData="getBeforePayData",e.getCardToken="cardTokenResult",e.updateCardToken="updateCardTokenResult",e.getCurrentCardInfo="cardInfoResult",e.getCardTokenInfoByCardToken="getCardTokenInfoByCardTokenResult"}(na||(na={}));var ia=function(){function e(t){var n=this,r=t.uuid,o=t.host,a=t.channelId,i=t.env,c=t.receiveMessageHandler;bo(this,e),Io(this,"uuid",void 0),Io(this,"iframeHost","https://cashiers.myshopline.com"),Io(this,"isDev",!1),Io(this,"env",void 0),Io(this,"config",{}),Io(this,"channelId",void 0),Io(this,"mainIframe",Xo.Number),Io(this,"receiveMessageHandler",void 0),Io(this,"onIframeLoaded",(function(e){var t=e.name,r=e.mainIframe,o=e.displayFieldNames,a=n.config.placeholder;n.postToIframe(t,"initData",{pvId:kr,env:n.env,mainIframe:r,displayFieldNames:o,parentUrl:window.location.href,parentOrigin:window.location.origin,channelId:n.channelId}),a&&a[t]&&n.postToIframe(t,"setAttr",{attr:{placeholder:a[t]}})})),this.uuid=r,this.channelId=a,this.env=i,this.receiveMessageHandler=c,o&&!this.isDev&&(this.iframeHost=o)}return _o(e,[{key:"setConfig",value:function(e){this.config=e}},{key:"setIframeStatus",value:function(e){this.mainIframe=e.mainIframe}},{key:"handleApi",value:function(e,t,n){var r=this,o=ta[e];return Zo.reportData("pci_sdk_".concat(o,"_start"),{eventData:null!=t&&t.nextAction?aa(aa({},t),{},{nextAction:Zo.formatReportData(t.nextAction)}):t}),new Promise((function(n,a){r.receiveMessageHandler.setApiHandlerMap(e,n,a),r.postToMainIframe(o,t)})).then((function(e){var t=n?n(e):{result:e};return Zo.reportData("pci_sdk_".concat(o,"_end"),t),e})).catch((function(e){return Zo.handleError(e,"pci_sdk_".concat(o,"_error"))}))}},{key:"handleApiWithKey",value:function(e,t,n){var r=this,o=ta[e];return Zo.reportData("pci_sdk_".concat(o,"_start"),{eventData:t?t(""):void 0}),new Promise((function(n,a){var i=r.receiveMessageHandler.setApiHandlerMapWithKey(e,n,a),c=t?t(i):void 0;r.postToMainIframe(o,c)})).then((function(e){var t=e.key,r=e.result,a=n?n({key:t,result:r}):{key:t,result:r};return Zo.reportData("pci_sdk_".concat(o,"_end"),a),r})).catch((function(e){return Zo.handleError(e,"pci_sdk_".concat(o,"_error"))}))}},{key:"postToMainIframe",value:function(e,t){this.postToIframe(this.mainIframe,e,t)}},{key:"postToIframe",value:function(e,t,n){var r,o=aa({eventType:t,uuid:this.uuid},n||{}),a="".concat(e).concat(this.uuid);(null===(r=window.frames[a])||void 0===r?void 0:r.postMessage)&&window.frames[a].postMessage(o,this.iframeHost)}}]),e}(),ca=function(){var e=go(Do.mark((function e(t){return Do.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){setTimeout((function(){e()}),t)})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),sa=function(){function e(t){var n=t.uuid,r=t.host,o=t.receiveMessageHandler,a=t.cdn;bo(this,e),Io(this,"uuid",void 0),Io(this,"iframePath","https://cashiers.myshopline.com/pci-sdk"),Io(this,"innerDisplayIframeNames",[]),Io(this,"cdn",void 0),Io(this,"renderIframeDomMap",{}),Io(this,"innerMainIframe",Xo.Number),Io(this,"receiveMessageHandler",void 0),Io(this,"destroyed",!1),Io(this,"isDev",!1),this.uuid=n,this.receiveMessageHandler=o,r&&!this.isDev&&(this.iframePath="".concat(r,"/pci-sdk")),this.cdn=a,this.createCacheIframe()}var t;return _o(e,[{key:"displayIframeNames",get:function(){return this.innerDisplayIframeNames}},{key:"mainIframe",get:function(){return this.innerMainIframe}},{key:"mountIframe",value:function(e,t,n,r){if(!e)throw new Ro("Can't find the related dom node to mount the iframe",To.InnerSDKError,Lo.NoDom);var o=document.createElement("iframe");o.onload=r,o.src=n,o.name=t,o.id=t,o.style.width="100%",o.style.height="100%",o.style.border="none",e.innerHTML="",e.appendChild(o)}},{key:"getIframeLink",value:function(e){var t=this.isDev?"":"v".concat("3.6.1".split(".")[0],"/");return"".concat(this.iframePath,"/").concat(t,"iframe").concat(this.cdn===Qo.CN?"-oss":"",".html#name=").concat(e,"&uuid=").concat(this.uuid)}},{key:"createHiddenMountDom",value:function(e){var t=document.createElement("div");return t.setAttribute("data-pci",e),t.setAttribute("style","display: none !important"),t.hidden=!0,document.body.appendChild(t),t}},{key:"doRenderIframe",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this.destroyed||e.forEach((function(e){n.mountIframe(n.renderIframeDomMap[e],"".concat(e).concat(n.uuid),n.getIframeLink(e),(function(){return t({name:e,mainIframe:n.innerMainIframe,displayFieldNames:r})}))}))}},{key:"createHiddenIframeDom",value:function(e){var t=Jo.Hidden,n=this.createHiddenMountDom(t);this.innerDisplayIframeNames.push(t),this.renderIframeDomMap[t]=n,this.innerMainIframe=t,this.doRenderIframe(this.innerDisplayIframeNames,e),this.startIframeReloadTiming(e)}},{key:"createCacheIframe",value:function(){var e=Jo.Cache,t=document.querySelector("div[data-pci=".concat(e,"]"));if(!t||!t.querySelector("iframe[id=".concat(e,"]"))){var n=this.createHiddenMountDom(e);this.mountIframe(n,e,this.getIframeLink(e),(function(){Zo.reportData("pci_sdk_cache_iframe_onload")}))}}},{key:"renderIframe",value:function(e,t){var n=this,r=[];if(e.querySelectorAll("[data-pci]").forEach((function(e,t){var o=e.getAttribute("data-pci");0!==t&&o!==Xo.Number||(n.innerMainIframe=o),ra.indexOf(o)>-1&&(n.innerDisplayIframeNames.push(o),n.renderIframeDomMap[o]=e,r.push(o))})),0===this.innerDisplayIframeNames.length)throw new Ro("Can't find any dom node to mount the iframe",To.InnerSDKError,Lo.NoDom);this.doRenderIframe(this.innerDisplayIframeNames,t,r),this.startIframeReloadTiming(t,r)}},{key:"startIframeReloadTiming",value:(t=go(Do.mark((function e(t){var n,r,o,a,i,c=this,s=arguments;return Do.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=s.length>1&&void 0!==s[1]?s[1]:[],r=3,o=Do.mark((function e(o){var a,i;return Do.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!c.destroyed){e.next=2;break}return e.abrupt("return",{v:void 0});case 2:return e.next=4,ca(15e3);case 4:if(!c.destroyed){e.next=6;break}return e.abrupt("return",{v:void 0});case 6:if(a=c.receiveMessageHandler.getIframeLoadedStatus(),i=Object.keys(a).filter((function(e){return!a[e]})),Zo.reportData("pci_sdk_check_iframe_status",{loadFailIframeNames:i}),i.length){e.next=13;break}return e.abrupt("return",{v:void 0});case 13:if(!(o<r-1)){e.next=19;break}Zo.reportData("pci_sdk_reload_iframe"),i.forEach((function(e){var t=c.renderIframeDomMap[e];t&&(t.innerHTML="")})),c.doRenderIframe(i,t,n),e.next=23;break;case 19:return c.unmountIframe(),c.receiveMessageHandler.triggerEvent("onError",{}),Zo.reportError(new Error("failed to load iframe"),"pci_sdk_load_iframe_failed"),e.abrupt("return",{v:void 0});case 23:case"end":return e.stop()}}),e)})),a=0;case 4:if(!(a<r)){e.next=12;break}return e.delegateYield(o(a),"t0",6);case 6:if("object"!==ko(i=e.t0)){e.next=9;break}return e.abrupt("return",i.v);case 9:a++,e.next=4;break;case 12:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"unmountDom",value:function(e){if(e){var t=this.renderIframeDomMap[e];t&&(Zo.reportData("pci_sdk_unmount_dom",{name:e}),e===Jo.Hidden?t.parentNode.removeChild(t):t.innerHTML="",this.renderIframeDomMap[e]=null)}}},{key:"unmountIframe",value:function(){var e=this;Zo.reportData("pci_sdk_unmount_iframe"),this.innerDisplayIframeNames.forEach((function(t){return e.unmountDom(t)}))}},{key:"destroy",value:function(){this.destroyed=!0,this.unmountIframe()}}]),e}();function ua(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var la,da,fa=function(){function e(t){var n,r=this;bo(this,e),Io(this,"uuid",void 0),Io(this,"config",void 0),Io(this,"iframeLoaded",{}),Io(this,"ApiHandlerMap",{}),Io(this,"ReceiveMessageHandler",(Io(n={loadFinished:function(e){r.iframeLoaded[e.name]=!0,Zo.reportData("pci_sdk_iframe_loadFinished",e),Object.keys(r.iframeLoaded).every((function(e){return r.iframeLoaded[e]}))&&(Zo.reportData("pci_sdk_onInit"),r.triggerEvent("onInit",{}))},focus:function(e){r.triggerEvent("onFocus",{fieldName:e.name,isEmpty:e.isEmpty,isFocus:e.isFocus})},input:function(e){r.triggerEvent("onFieldValidChange",{fieldName:e.name,isValid:e.isValid,isEmpty:e.isEmpty})},cardBinChange:function(e){r.triggerEvent("onCardBinChange",e.value)}},na.validate,(function(e){Zo.reportData("pci_sdk_validate_credit_card_cache",e.reportData),r.resolveApiHandler("validate",e.isValid)})),Io(n,na.pay,(function(e){Zo.reportData("pci_sdk_pay_credit_card_cache",e.reportData),e.status===Ko.Success?r.resolveApiHandler("pay",e.value):r.rejectApiHandler("pay",e.value)})),Io(n,na.getBeforePayData,(function(e){r.resolveApiHandler("getBeforePayData",e.value)})),Io(n,na.getCardToken,(function(e){var t=(e.extraOptions||{}).key;t&&(e.status===Ko.Success?r.resolveApiHandlerWithKey("getCardToken",e.value,t):r.rejectApiHandlerWithKey("getCardToken",e.value,t))})),Io(n,na.updateCardToken,(function(e){var t=(e.extraOptions||{}).key;t&&(e.status===Ko.Success?r.resolveApiHandlerWithKey("updateCardToken",e.value,t):r.rejectApiHandlerWithKey("updateCardToken",e.value,t))})),Io(n,na.getCardTokenInfoByCardToken,(function(e){var t=(e.extraOptions||{}).key;t&&(e.status===Ko.Success?r.resolveApiHandlerWithKey("getCardTokenInfoByCardToken",e.value,t):r.rejectApiHandlerWithKey("getCardTokenInfoByCardToken",e.value,t))})),Io(n,na.getCurrentCardInfo,(function(e){e.status===Ko.Success?r.resolveApiHandler("getCurrentCardInfo",e.value):r.rejectApiHandler("getCurrentCardInfo",e.value)})),n)),this.uuid=t}return _o(e,[{key:"init",value:function(e,t){var n=this;this.config=t,e.forEach((function(e){return n.iframeLoaded[e]=!1})),this.listenMessage()}},{key:"getIframeLoadedStatus",value:function(){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ua(Object(n),!0).forEach((function(t){Io(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ua(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.iframeLoaded)}},{key:"listenMessage",value:function(){var e=this;window.addEventListener("message",(function(t){var n=t.data,r=n.uuid,o=n.eventType;r===e.uuid&&e.ReceiveMessageHandler[o]&&e.ReceiveMessageHandler[o](t.data)}))}},{key:"setApiHandlerMap",value:function(e,t,n){this.ApiHandlerMap[e]={resolve:t,reject:n}}},{key:"setApiHandlerMapWithKey",value:function(e,t,n){var r=((new Date).getTime()+Math.floor(Math.random()*Math.pow(10,13))).toString();return this.ApiHandlerMap[e]||(this.ApiHandlerMap[e]={}),this.ApiHandlerMap[e][r]={resolve:t,reject:n},r}},{key:"resolveApiHandler",value:function(e,t){var n;(null===(n=this.ApiHandlerMap[e])||void 0===n?void 0:n.resolve)&&this.ApiHandlerMap[e].resolve(t)}},{key:"rejectApiHandler",value:function(e,t){var n;(null===(n=this.ApiHandlerMap[e])||void 0===n?void 0:n.reject)&&this.ApiHandlerMap[e].reject(t)}},{key:"resolveApiHandlerWithKey",value:function(e,t,n){var r,o;null!==(r=this.ApiHandlerMap[e])&&void 0!==r&&null!==(o=r[n])&&void 0!==o&&o.resolve&&(this.ApiHandlerMap[e][n].resolve({key:n,result:t}),delete this.ApiHandlerMap[e][n])}},{key:"rejectApiHandlerWithKey",value:function(e,t,n){var r,o;null!==(r=this.ApiHandlerMap[e])&&void 0!==r&&null!==(o=r[n])&&void 0!==o&&o.reject&&(this.ApiHandlerMap[e][n].reject(t),delete this.ApiHandlerMap[e][n])}},{key:"triggerEvent",value:function(e,t){try{this.config[e]&&this.config[e](t)}catch(n){Zo.handleError(n,"pci_sdk_triggerEvent_".concat(e,"_error"),t)}}}]),e}();!function(e){e.Test1="test1",e.Test2="test2",e.Test3="test3",e.Alpha="alpha",e.Prod="prod"}(la||(la={}));var pa=(Io(da={},la.Test1,{host:"https://cashiers-test1.myshoplinestg.com"}),Io(da,la.Test2,{host:"https://cashiers-test2.myshoplinestg.com"}),Io(da,la.Test3,{host:"https://cashiers-test3.myshoplinestg.com"}),Io(da,la.Alpha,{host:"https://cashiers-alpha.myshopline.com"}),Io(da,la.Prod,{host:"https://cashiers.myshopline.com"}),da);function ha(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ya(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ha(Object(n),!0).forEach((function(t){Io(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ha(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var va=function(){function e(t){bo(this,e),Io(this,"apiInstance",void 0),Io(this,"iframeInstance",void 0),Io(this,"receiveMessageInstance",void 0),Io(this,"cardToken",void 0),Io(this,"config",void 0),this.initReporter(t);try{var n;Zo.reportData("pci_sdk_constructor_start",Zo.formatReportData(t));var r=(null===(n=pa[t.env])||void 0===n?void 0:n.host)||"";Zo.setHost(r);var o=(a=(new Date).getTime(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(a+16*Math.random())%16|0;return a=Math.floor(a/16),("x"===e?t:3&t|8).toString(16)})));this.cardToken=t.cardToken,this.receiveMessageInstance=new fa(o),this.apiInstance=new ia({uuid:o,host:r,channelId:null==t?void 0:t.channelId,env:t.env,receiveMessageHandler:this.receiveMessageInstance}),this.iframeInstance=new sa({uuid:o,host:r,receiveMessageHandler:this.receiveMessageInstance,cdn:t.cdn}),Zo.reportData("pci_sdk_constructor_end")}catch(e){Zo.handleError(e,"pci_sdk_constructor_error")}var a}var t;return _o(e,[{key:"initReporter",value:function(e){try{Zo.init(e)}catch(e){Zo.handleError(e,"pci_sdk_init_reporter_error")}}},{key:"update",value:(t=go(Do.mark((function e(){var t,n=arguments;return Do.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.length>0&&void 0!==n[0]?n[0]:{},Zo.reportData("pci_sdk_update_start",Zo.formatReportData(t)),t.cardToken&&(this.cardToken=t.cardToken),Zo.reportData("pci_sdk_update_end");case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"setConfig",value:function(e){this.apiInstance.setConfig(e)}},{key:"getCardToken",value:function(e){return this.apiInstance.handleApiWithKey("getCardToken",(function(t){return{options:e,extraOptions:{key:t}}}),(function(t){var n=t.key,r=t.result;return ya(ya({},e),{},{token:(r.token||"").slice(-6),key:n})}))}},{key:"checkCardToken",value:function(){if(!this.cardToken)return Zo.handleError(new Ro("Empty CardToken",To.InnerSDKError,"EmptyCardToken"),"pci_sdk_getCardTokenInfoByCardToken_empty_cardToken_error")}},{key:"getCardTokenInfoByCardToken",value:function(e){var t=this;return this.checkCardToken(),this.apiInstance.handleApiWithKey("getCardTokenInfoByCardToken",(function(n){return{options:ya(ya({},e),{},{token:t.cardToken}),extraOptions:{key:n}}}),(function(t){var n=t.key,r=t.result;return ya(ya({},e),{},{token:Yo(r.token),key:n})}))}},{key:"pay",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.apiInstance.handleApi("pay",{nextAction:e,requestParams:ya(ya({},t),{},{cardToken:this.cardToken})})}},{key:"destroy",value:function(){try{Zo.reportData("pci_sdk_destroy_start"),this.iframeInstance.destroy(),Zo.reportData("pci_sdk_destroy_end")}catch(e){Zo.handleError(e,"pci_sdk_destroy_error")}}}]),e}(),ma=function(e){Co(n,va);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=xo(e);if(t){var o=xo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Po(this,n)}}(n);function n(){return bo(this,n),t.apply(this,arguments)}return _o(n,[{key:"create",value:function(e){try{Zo.reportData("api_only_pci_sdk_create_start"),this.config=e,this.setConfig(e),this.iframeInstance.createHiddenIframeDom(this.apiInstance.onIframeLoaded),this.receiveMessageInstance.init(this.iframeInstance.displayIframeNames,this.config),this.apiInstance.setIframeStatus({mainIframe:this.iframeInstance.mainIframe}),Zo.reportData("api_only_pci_sdk_create_end")}catch(e){Zo.handleError(e,"api_only_pci_sdk_create_error")}}}]),n}();function ga(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ga(Object(n),!0).forEach((function(t){Io(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ga(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var wa=function(e){Co(r,va);var t,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=xo(e);if(t){var o=xo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Po(this,n)}}(r);function r(){return bo(this,r),n.apply(this,arguments)}return _o(r,[{key:"create",value:function(e){try{Zo.reportData("pci_sdk_create_start",{config:e}),this.config=e,this.apiInstance.setConfig(e),Zo.reportData("pci_sdk_create_end")}catch(e){Zo.handleError(e,"pci_sdk_create_error")}}},{key:"mount",value:function(e){try{Zo.reportData("pci_sdk_mount_start");var t="string"==typeof e?document.querySelector(e):e;if(!t)throw new Ro("Can't find the mount dom",To.InnerSDKError,Lo.NoDom);this.iframeInstance.renderIframe(t,this.apiInstance.onIframeLoaded),this.receiveMessageInstance.init(this.iframeInstance.displayIframeNames,this.config),this.apiInstance.setIframeStatus({mainIframe:this.iframeInstance.mainIframe}),Zo.reportData("pci_sdk_mount_end",{displayIframeNames:this.iframeInstance.displayIframeNames,mainIframe:this.iframeInstance.mainIframe})}catch(e){Zo.handleError(e,"pci_sdk_mount_error")}}},{key:"setStyle",value:function(e){try{Zo.reportData("pci_sdk_setStyle_start",{params:e});var t=e.type,n=e.fieldName,r=e.style;this.apiInstance.postToIframe(n,"setStyle",{style:r,type:t}),Zo.reportData("pci_sdk_setStyle_end")}catch(e){Zo.handleError(e,"pci_sdk_setStyle_error")}}},{key:"validate",value:function(e){return this.apiInstance.handleApi("validate",{validateItems:e})}},{key:"getBeforePayData",value:function(e){return this.apiInstance.handleApi("getBeforePayData",{nextAction:e})}},{key:"updateCardToken",value:function(e){var t=this;return this.checkCardToken(),this.apiInstance.handleApiWithKey("updateCardToken",(function(n){return{options:ba(ba({},e),{},{token:t.cardToken}),extraOptions:{key:n}}}),(function(t){var n=t.key,r=t.result;return ba(ba({},e),{},{token:Yo(r.token),key:n})})).then((function(e){return t.cardToken=e.token,Zo.reportData("pci_sdk_updateCardToken_update_token"),e}))}},{key:"getCurrentCardInfo",value:(t=go(Do.mark((function e(){return Do.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiInstance.handleApi("getCurrentCardInfo"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}();function _a(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function Oa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Io(wa,"ApiOnly",ma);var Ca={};!function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),i=new E(r||[]);return a._invoke=function(e,t,n){var r=d;return function(o,a){if(r===p)throw new Error("Generator is already running");if(r===h){if("throw"===o)throw a;return j()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=P(i,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var s=l(e,t,n);if("normal"===s.type){if(r=n.done?h:f,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r=h,n.method="throw",n.arg=s.arg)}}}(e,n,i),a}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d="suspendedStart",f="suspendedYield",p="executing",h="completed",y={};function v(){}function m(){}function g(){}var b={};s(b,a,(function(){return this}));var w=Object.getPrototypeOf,_=w&&w(w(T([])));_&&_!==n&&r.call(_,a)&&(b=_);var O=g.prototype=v.prototype=Object.create(b);function C(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(o,a,i,c){var s=l(e[o],e,a);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==k(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(d).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(s.arg)}var o;this._invoke=function(e,r){function a(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(a,a):a()}}function P(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,P(e,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}return{next:j}}function j(){return{value:t,done:!0}}return m.prototype=g,s(O,"constructor",g),s(g,"constructor",m),m.displayName=s(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},C(S.prototype),s(S.prototype,i,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,o,a){void 0===a&&(a=Promise);var i=new S(u(t,n,r,o),a);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},C(O),s(O,c,"Generator"),s(O,a,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}(Ca);try{regeneratorRuntime=t}catch(e){"object"==("undefined"==typeof globalThis?"undefined":k(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}();var ka,Sa=Ca;!function(e){e.Google="googleFont",e.ShopLine="slFont",e.System="system"}(ka||(ka={}));var Pa,xa=["Helvetica Neue","Arial","sans-serif"];!function(){var e,t,n,r;e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ka.System,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xa;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),Oa(this,"fontLib",void 0),Oa(this,"fontFamily",void 0),this.fontLib=t,this.fontFamily=n},(t=[{key:"setFontFamily",value:(n=Sa.mark((function e(t){var n;return Sa.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.fontLib!==ka.Google){e.next=5;break}return e.next=3,this.injectGoogleFontCss();case 3:e.next=8;break;case 5:if(this.fontLib!==ka.ShopLine){e.next=8;break}return e.next=8,this.injectSLPFontCss();case 8:n=t.getAttribute("style")||"",t.setAttribute("style","".concat(n,"font-family:").concat(this.fontFamily.join(",")));case 10:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,t=arguments;return new Promise((function(r,o){var a=n.apply(e,t);function i(e){_a(a,r,o,i,c,"next",e)}function c(e){_a(a,r,o,i,c,"throw",e)}i(void 0)}))},function(e){return r.apply(this,arguments)})},{key:"injectCss",value:function(e){var t=document.getElementsByTagName("head")[0],n=document.createElement("link");return n.rel="stylesheet",n.href=e,t.appendChild(n),new Promise((function(t,r){n.onerror=function(){r({message:"inject css failed",url:e})},n.onload=function(){t()}}))}},{key:"injectGoogleFontCss",value:function(){var e=this.fontFamily.map((function(e){return"family=".concat(e.replace(/\s/g,"+"))}));return this.injectCss("https://fonts.googleapis.com/css?".concat(e.join("&"),"&display=swap"))}},{key:"injectSLPFontCss",value:function(){var e=this,t=this.fontFamily.map((function(t){return e.injectCss("https://cdn-theme.myshopline.com/cdn/shop/fonts/".concat(t,".css"))}));return Promise.all(t)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(),(Pa||(Pa={})).SL="sl_pci";var Ia=function(e,t){var n;return{card:{bin:e.bin,last4:null==e||null===(n=e.first6Last4)||void 0===n?void 0:n.slice(-4),data:JSON.stringify({host:t,token:null==e?void 0:e.token}),type:Pa.SL},channelToken:e.extend}},Ea=["paymentRequest","paymentOptions","paymentSession","version"],Ta=["newTotal","newLineItems","newShippingMethods","version","paymentSession","paymentRequest","paymentOptions"];function ja(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Aa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ja(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ja(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var La=function(){function e(t,n){se(this,e),me(this,"payClient",null),me(this,"config",void 0),me(this,"logger",void 0),me(this,"payChannelData",void 0),me(this,"isUsePciToken",!1),this.config=t,this.logger=n.logger,this.isUsePciToken=wr(t.paymentInfo)}var t,n;return de(e,[{key:"setPayChannelData",value:function(e){var t=e.payChannelData,n=t.paymentRequest,r=t.paymentOptions,o=t.paymentSession,a=t.version,i=mr(t,Ea);this.payChannelData={version:a,paymentRequest:n,paymentOptions:r,paymentSession:o,rest:Aa({},i)},mt(this.payChannelData)}},{key:"beforePay",value:function(e){this.logger.info("beforePay",{data:Aa({},e)}),this.setPayChannelData(e),this.payChannelData&&(this.payClient=new window.ApplePaySession(this.payChannelData.version,this.payChannelData.paymentRequest,this.payChannelData.paymentOptions))}},{key:"pay",value:(n=ce(Oe.mark((function e(t){var n=this;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.setPayChannelData(t),this.logger.info("pay",{data:Aa({},t)}),e.abrupt("return",new Promise((function(e,t){var r,o=Yn.Create,a=function(e){var t=e.type,r=e.originalEvent,a=e.updateEvent;o=t,n.logger.info("handleLogUpdateCurrentEvent",{data:{eventName:t,originalEvent:r,updateEvent:a}})},i=function(e,r){window[window.__sl_console__?"__sl_console__":"console"].error("AP unified error handling:",{error:e,type:ke.Pay,extData:r}),n.logger.error("handleError",{action:ke.Pay,error:e,data:Aa({},r)}),t(e),ft(n.config.onError)&&n.config.onError(e,ke.Pay,r)},c=function(){var e=ce(Oe.mark((function e(t){var r,o,a,c,s,u,l,d,f,p,h,y,v,m,g,b,w,_,O,C,k,S,P,x;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=t.type,s=t.paymentMethod,u=t.shippingContact,l=t.couponCode,d=t.shippingMethod,f=Aa(Aa({},n.payChannelData),null===(r=n.payChannelData)||void 0===r?void 0:r.rest)){e.next=5;break}return i(new Error("without payChannelData")),e.abrupt("return");case 5:p="unknown",e.t0=c,e.next=e.t0===Yn.Paymentmethodselected?9:e.t0===Yn.Shippingcontactselected?11:e.t0===Yn.Couponcodechanged?14:e.t0===Yn.Shippingmethodselected?17:19;break;case 9:return f.newPaymentMethod=s,e.abrupt("break",20);case 11:return f.newShippingContact=u,p="shippingContactInvalid",e.abrupt("break",20);case 14:return f.newCouponCode=l,p="couponCodeInvalid",e.abrupt("break",20);case 17:return f.newShippingMethod=d,e.abrupt("break",20);case 19:return e.abrupt("break",20);case 20:if(ft(n.config.onFormDataChange)){e.next=23;break}return i(new Error("without onFormDataChange")),e.abrupt("return");case 23:return delete f.rest,e.next=26,null===(o=(a=n.config).onFormDataChange)||void 0===o?void 0:o.call(a,f,nr[c]).catch((function(e){window[window.__sl_console__?"__sl_console__":"console"].error("onPaymentDataChanged fetch error",e),i(new Error("onPaymentDataChanged fetch error"))}));case 26:if((h=e.sent)&&!h.error){e.next=29;break}return e.abrupt("return",{errors:[new window.ApplePayError(p,void 0,(null==h||null===(y=h.error)||void 0===y?void 0:y.message)||"update error")],newTotal:null===(v=n.payChannelData)||void 0===v?void 0:v.rest.newTotal,newLineItems:null===(m=n.payChannelData)||void 0===m?void 0:m.rest.newLineItems,newShippingMethods:null===(g=n.payChannelData)||void 0===g?void 0:g.rest.newShippingMethods});case 29:return b=h.newTotal,w=h.newLineItems,_=h.newShippingMethods,O=h.version,C=h.paymentSession,k=h.paymentRequest,S=h.paymentOptions,P=mr(h,Ta),n.payChannelData={version:O,paymentSession:C,paymentRequest:k,paymentOptions:S,rest:Aa(Aa({},P),{},{newTotal:b,newShippingMethods:_,newLineItems:w})},mt(n.payChannelData),x={newTotal:b,newLineItems:w,newShippingMethods:_},e.abrupt("return",x);case 34:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();if(!n.payChannelData||!n.payChannelData.paymentSession)return window[window.__sl_console__?"__sl_console__":"console"].error("without payChannelData"),void i(new Error("without payChannelData"));try{var s=JSON.parse(window.atob(n.payChannelData.paymentSession)),u=n.payClient,l=n.logger;if(!u)throw new Error("No payment instance found");u.onvalidatemerchant=function(){var e=ce(Oe.mark((function e(t){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a({type:Yn.Validatemerchant,originalEvent:t,decodeMerchantSession:s}),u.completeMerchantValidation(s);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u.onpaymentmethodselected=function(){var e=ce(Oe.mark((function e(t){var n,r;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={type:Yn.Paymentmethodselected,paymentMethod:t.paymentMethod},a({type:Yn.Paymentmethodselected,originalEvent:t,updateEvent:n}),e.next=4,c(n);case 4:if(r=e.sent){e.next=7;break}throw new Error("no update information");case 7:u.completePaymentMethodSelection(r);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u.onshippingcontactselected=function(){var e=ce(Oe.mark((function e(t){var n,r;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={type:Yn.Shippingcontactselected,shippingContact:t.shippingContact},a({type:Yn.Shippingcontactselected,originalEvent:t,updateEvent:n}),e.next=4,c(n);case 4:if(r=e.sent){e.next=7;break}throw new Error("no update information");case 7:r.status=window.ApplePaySession.STATUS_SUCCESS,u.completeShippingContactSelection(r);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u.onshippingmethodselected=function(){var e=ce(Oe.mark((function e(t){var n,r,o;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={type:Yn.Shippingmethodselected,shippingMethod:Aa(Aa({},t.shippingMethod),{},{selected:!0})},a({type:Yn.Shippingmethodselected,originalEvent:t,updateEvent:n}),e.next=4,c(n);case 4:r=e.sent,o=Aa(Aa({},r),{},{status:window.ApplePaySession.STATUS_SUCCESS}),u.completeShippingMethodSelection(o);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u.oncouponcodechanged=function(){var e=ce(Oe.mark((function e(t){var n,r;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={type:Yn.Couponcodechanged,couponCode:t.couponCode},a({type:Yn.Couponcodechanged,originalEvent:t,updateEvent:n}),e.next=4,c(n);case 4:if(r=e.sent){e.next=7;break}throw new Error("no update information");case 7:u.completeCouponCodeChange(r);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u.onpaymentauthorized=function(){var t=ce(Oe.mark((function t(r){var o,c,s,d,f,p,h,y,v,m,g,b,w,_,O;return Oe.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a({type:Yn.Paymentauthorized,originalEvent:r}),o=function(e){var t={status:e};l.info("pay",{data:{status:e}}),e===window.ApplePaySession.STATUS_SUCCESS&&u.completePayment(t)},t.prev=2,f=r.payment,p=f.billingContact,h=f.shippingContact,y=f.token,ft(n.config.createOrder)){t.next=7;break}return i(new Error("onPaymentAuthorized failed, createOrder not triggered")),t.abrupt("return");case 7:return null==(v=Aa(Aa(Aa({},n.payChannelData),null===(c=n.payChannelData)||void 0===c?void 0:c.rest),{},{newShippingContact:h,newBillingContact:p}))||delete v.rest,t.next=11,null===(s=(d=n.config).createOrder)||void 0===s?void 0:s.call(d,n.config.paymentInfo,{payChannelData:v,token:{token:y}});case 11:if((m=t.sent)&&(null==m||!m.error)){t.next=15;break}throw o(window.ApplePaySession.STATUS_FAILURE),new Error("Failed to place order");case 15:if(o(window.ApplePaySession.STATUS_SUCCESS),n.afterCreateOrder(je.Success),!n.isUsePciToken){t.next=27;break}return g=m.nextAction.pciInfo,t.next=21,n.getCardToken(r.payment,g).catch((function(e){i(e)}));case 21:if(b=t.sent){t.next=24;break}return t.abrupt("return");case 24:return e("onpaymentauthorized"),w=Ia(b,(null==g?void 0:g.host)||""),_=w.card,O=w.channelToken,t.abrupt("return",pn(m.nextAction,{data:{fastCheckout:!0,paymentMethodOptions:{paymentMethodInstrument:JSON.stringify(O)},paymentInstrument:{paymentMethod:n.config.paymentInfo.methodCode,card:n.config.channelCode===Pe.CybsOther?Aa(Aa({},_),{},{binInfo:b.binInfo}):_}}}));case 27:e("onpaymentauthorized"),pn(m.nextAction),t.next=37;break;case 31:t.prev=31,t.t0=t.catch(2),o(window.ApplePaySession.STATUS_FAILURE),n.afterCreateOrder(je.Fail),window[window.__sl_console__?"__sl_console__":"console"].error("pay failed",t.t0),i(new Error("pay failed"));case 37:case"end":return t.stop()}}),t,null,[[2,31]])})));return function(e){return t.apply(this,arguments)}}(),u.oncancel=function(){var t=ce(Oe.mark((function t(r){return Oe.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o!==Yn.Paymentauthorized){t.next=3;break}return window[window.__sl_console__?"__sl_console__":"console"].warn("Cannot cancel payment after token has been received"),t.abrupt("return");case 3:a({type:Yn.Cancel,originalEvent:r}),e("oncancel"),ft(n.config.onCancel)&&n.config.onCancel(null==r?void 0:r.sessionError);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),r=setTimeout((function(){ft(n.config.onChannelModalSuccess)&&n.config.onChannelModalSuccess(n.config.paymentInfo)}),1e3),u.begin(),n.logger.log("Final parameters for launching Apple Pay",{data:{payChannelData:n.payChannelData}})}catch(e){clearTimeout(r),i(e)}})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"afterCreateOrder",value:function(e){ft(this.config.afterCreateOrder)&&this.config.afterCreateOrder(e,{channelCode:this.config.paymentInfo.channelCode,methodCode:xe.ApplePay})}},{key:"getCardToken",value:(t=ce(Oe.mark((function e(t,n){var r,o,a,i,c=this;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n&&n.host&&null!=n&&n.resourceId){e.next=2;break}throw new Error("host or resourceId is required");case 2:return r=this.config.paymentInfo.sdkEnv,o=xn[r].env||_n.Prod,a=new wa.ApiOnly({env:o,channelId:this.config.paymentInfo.paymentId}),e.next=7,new Promise((function(e,t){a.create({onInit:function(){c.logger.info("hidden_iframe_has_loaded"),e("")},onError:function(){c.logger.error("hidden_iframe_load_fail"),t(new Error("hidden_iframe_load_fail"))}})}));case 7:return e.next=9,a.getCardToken({rawToken:t,paymentMethod:"ApplePay",partnerId:ea.SL2,pciHost:n.host,resourceId:n.resourceId});case 9:return i=e.sent,e.abrupt("return",i);case 11:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})}]),e}();function Da(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Na(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Da(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Da(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ba,Ma,Ra,Fa=function(e){he(a,xt);var t,n,r,o=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(a);function a(e){var t,n,r;return se(this,a),me(fe(r=o.call(this,e)),"name","APPLE_PAY"),me(fe(r),"config",void 0),me(fe(r),"initTime",0),me(fe(r),"element",void 0),me(fe(r),"domId",void 0),me(fe(r),"client",null),me(fe(r),"skeleton",void 0),me(fe(r),"disabled",void 0),me(fe(r),"orderData",void 0),me(fe(r),"loading",void 0),me(fe(r),"initSuccess",!0),me(fe(r),"loadResourceFail",!1),me(fe(r),"logger",void 0),me(fe(r),"handleClick",ce(Oe.mark((function e(){var t,n,o,a,i,c,s,u,l,d,f,p,h;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.disabled&&!r.loading){e.next=3;break}return r.logger.warn("applepay is disabled or loading"),e.abrupt("return");case 3:return r.logger.log("applepay onClick"),r.setLoading(!0),(t=r.config.props.expressOptimizationSwitch)&&(l=null!==(n=r.channelSdkInitConfig)&&void 0!==n?n:{},d=null!==(o=null===(a=l.payChannelData)||void 0===a||null===(i=a.paymentRequest)||void 0===i?void 0:i.total)&&void 0!==o?o:{},f={amount:null!==(c=d.amount)&&void 0!==c?c:"99.99",label:null!==(s=d.label)&&void 0!==s?s:"Total",type:null!==(u=d.type)&&void 0!==u?u:"pending"},p=Na(Na({},l),{},{payChannelData:Na(Na({},l.payChannelData),{},{paymentRequest:Na(Na({},l.payChannelData.paymentRequest),{},{total:f,lineItems:[f]})})}),r.beforePay(p)),e.next=9,r.getOrderData();case 9:if((h=e.sent)&&h.paymentConfig){e.next=12;break}return e.abrupt("return");case 12:t?r.pay(h.paymentConfig):r.openModal(h.paymentConfig);case 13:case"end":return e.stop()}}),e)})))),me(fe(r),"destroy",(function(){r.client=null,r.removeEvents()})),r.validate(),r.config=Nn(yt(tr,e)),ae.set(null===(t=(n=r.config).loggerFn)||void 0===t?void 0:t.call(n)),r.logger=ae.get().pipeOwner("payment-common.SLP-ApplePay").pipeData({domId:"".concat(r.config.props.domId)}),r}return de(a,[{key:"channelSdkInitConfig",get:function(){var e;return JSON.parse((null===(e=this.config.paymentInfo)||void 0===e?void 0:e.channelSdkInitConfig)||"{}")}},{key:"validate",value:function(){return!0}},{key:"onError",value:function(e,t,n){ft(this.config.onError)&&this.config.onError(e,t,n)}},{key:"handleError",value:function(e,t,n){t!==ke.CreateExpected&&this.logger.error("handleError",{action:t,data:{type:t},error:e}),t===ke.Init&&(this.initSuccess=!1,this.hideButton()),this.onError(e,t,n)}},{key:"beforeInit",value:function(){this.initTime=vt.now(),ft(this.config.beforeInit)&&this.config.beforeInit()}},{key:"afterInit",value:function(e){try{this.initSuccess=!0,this.showButton();var t=vt.now()-this.initTime;this.logger.log("afterInit",{data:{data:e,duration:t}}),ft(this.config.afterInit)&&this.config.afterInit()}catch(e){this.handleError(e)}}},{key:"beforeCreateOrder",value:(r=ce(Oe.mark((function e(){var t,n,r,o,a,i;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ft(this.config.beforeCreateOrder)){e.next=2;break}return e.abrupt("return");case 2:return t=this.config.paymentInfo,n=t.channelCode,r=t.methodCode,o=t.paymentId,a=t.accessMode,e.next=5,this.config.beforeCreateOrder({channelCode:n,methodCode:r,paymentId:o,accessMode:a});case 5:return i=e.sent,e.abrupt("return",i);case 7:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"loadResource",value:function(){var e=this;return new Promise((function(t){In("https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js").then((function(){e.loadResourceFail=!1,t(!0)})).catch((function(n){e.loadResourceFail=!0,e.handleError(new Error("Failed to load channel js resource:".concat(n)),ke.Init),t(!1)}))}))}},{key:"canMakePayments",value:function(){try{var e,t,n=window.ApplePaySession;return!!(n&&n.canMakePayments()&&n.supportsVersion((null===(e=this.channelSdkInitConfig)||void 0===e||null===(t=e.payChannelData)||void 0===t?void 0:t.version)||4))}catch(e){return!1}}},{key:"renderButton",value:function(){var e,t;this.element&&this.domId?(function(e){var t,n=e.domId,r=e.node,o=e.height,a=e.borderRadius,i=document.createElement("style"),c=document.createElement("div");r.style.height="".concat(o||43,"px"),c.innerHTML="<apple-pay-button id=".concat(n,' buttonstyle="black" type="plain" locale="en"></apple-pay-button>');var s="\n    #".concat(n," {\n      --apple-pay-button-width: 100%;\n      --apple-pay-button-height: ").concat(o||43,"px;\n      --apple-pay-button-border-radius: 0px;\n      --apple-pay-button-padding: 0px 0px;\n      --apple-pay-button-box-sizing: border-box;\n    }\n\n    .").concat(St," apple-pay-button {\n      display: none;\n    }\n\n    ").concat("\n    .applepay-confirm-modal-header {\n      margin-bottom: 12px;\n    }\n\n    .applepay-confirm-modal-content {\n      font-family: 'Helvetica Neue';\n      font-style: normal;\n      font-weight: 400;\n      font-size: 16px;\n      line-height: 24px;\n      color: #2c2c2c;\n    }\n\n    .applepay-confirm-modal-action {\n      margin-top: 24px;\n      display: flex;\n      flex-direction: column;\n    }\n\n    .applepay-confirm-modal-action > button {\n      border: 0;\n      text-align: center;\n      border-radius: 4px;\n      cursor: pointer;\n      font-style: normal;\n      line-height: 24px;\n    }\n\n    .applepay-confirm-modal-action-ok {\n      padding: 9px 0;\n      color: #fff;\n      background: #000;\n      font-size: 19px;\n      font-weight: 500;\n    }\n\n    .applepay-confirm-modal-action-ok > span {\n      vertical-align: middle;\n      font-family: 'SF Pro', 'Helvetica Neue';\n    }\n\n    .applepay-confirm-modal-action-ok > svg {\n      vertical-align: middle;\n    }\n\n    .applepay-confirm-modal-action-cancel {\n      padding: 0;\n      margin-top: 24px;\n      color: rgba(44, 44, 44, 0.5);\n      background: transparent;\n      font-size: 16px;\n      font-weight: 500;\n      font-family: 'Helvetica Neue';\n    }\n  ","\n  ");void 0===a&&(s+="\n      #".concat(n," {\n        --apple-pay-button-border-radius: 4px;\n      }\n\n      [data-button_style=square] #").concat(n," {\n        --apple-pay-button-border-radius: 0px;\n      }\n  \n      [data-button_style=rounded] #").concat(n," {\n        --apple-pay-button-border-radius: 9999px;\n      }\n    ")),i.innerHTML=s,null===(t=r.parentElement)||void 0===t||t.insertBefore(i,r),r.appendChild(c)}({node:this.element,domId:this.domId,height:null===(e=this.config.props.styleOptions)||void 0===e?void 0:e.height,borderRadius:null===(t=this.config.props.styleOptions)||void 0===t?void 0:t["border-radius"]}),this.removeSkeleton(this.element)):window[window.__sl_console__?"__sl_console__":"console"].error("applepay has no node")}},{key:"removeSkeleton",value:function(e){var t=this,n=null;n&&clearTimeout(n),n=setTimeout((function(){e&&t.skeleton&&e.removeChild(t.skeleton)}),300)}},{key:"openModal",value:function(e){var t=this;hr({ok:function(n){t.beforePay(e),t.pay(e),null==n||n.close(),t.setLoading(!1)},cancel:function(){t.setLoading(!1),t.logger.info("user cancelled payment")}}).then((function(e){t.logger.info("Payment modal launched successfully"),e.show()})).catch((function(e){window[window.__sl_console__?"__sl_console__":"console"].error("Failed to prepare order",e),t.handleError(e,ke.Pay)}))}},{key:"pay",value:function(e){var t,n=this;this.setLoading(!1),null===(t=this.client)||void 0===t||t.pay(e).then((function(e){n.logger.info("User payment completed without errors",{data:{res:e}})})).catch((function(e){window[window.__sl_console__?"__sl_console__":"console"].error("User payment error",{error:e}),n.handleError(e,ke.Pay)}))}},{key:"beforePay",value:function(e){try{var t;null===(t=this.client)||void 0===t||t.beforePay(e)}catch(e){this.setLoading(!1),window[window.__sl_console__?"__sl_console__":"console"].error("Failed to prepare order",e),this.handleError(e,ke.Pay)}}},{key:"getOrderData",value:(n=ce(Oe.mark((function e(){var t;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.beforeCreateOrder();case 2:if(t=e.sent,this.logger.log("Requesting API to get order data",{data:{params:t}}),!1!==(null==t?void 0:t.valid)){e.next=8;break}return this.setLoading(!1),this.onError(new Error("create order data no found"),ke.Pay,{params:t}),e.abrupt("return");case 8:if(t.paymentConfig){e.next=13;break}return window[window.__sl_console__?"__sl_console__":"console"].error("No payment information"),this.handleError(new Error("no payment information"),ke.Pay,{params:t}),this.setLoading(!1),e.abrupt("return");case 13:return this.orderData=t,e.abrupt("return",t);case 15:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getEle",value:function(){var e,t=null===(e=this.element)||void 0===e?void 0:e.querySelector("#".concat(this.domId));if(t)return t;window[window.__sl_console__?"__sl_console__":"console"].error("Apple Pay node not found")}},{key:"bindEvents",value:function(){var e=this.getEle();e&&e.addEventListener("click",this.handleClick)}},{key:"removeEvents",value:function(){var e=this.getEle();e&&e.removeEventListener("click",this.handleClick)}},{key:"render",value:(t=ce(Oe.mark((function e(){var t,n,r,o,a,i;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.config,r=n.props,o=n.paymentInfo,a=document.getElementById(o.currentDomId)){e.next=5;break}return this.handleError(new Error("[onError][Init failed][Cannot find mounted DOM]"),ke.Init),e.abrupt("return",null);case 5:return this.domId="".concat(o.currentDomId,"-contain"),this.element=a,this.logger.log("render start",{data:{config:this.config}}),e.next=10,this.loadResource();case 10:if(e.sent){e.next=13;break}return window[window.__sl_console__?"__sl_console__":"console"].error("load applePay resource failed"),e.abrupt("return");case 13:return e.next=15,this.canMakePayments();case 15:if(e.sent){e.next=20;break}return this.handleError(new Error("Cannot use applePay"),ke.Init),window[window.__sl_console__?"__sl_console__":"console"].error("Cannot use applePay"),e.abrupt("return");case 20:if(this.beforeInit(),i=yr({node:a,domId:this.domId,height:(null===(t=r.styleOptions)||void 0===t?void 0:t.height)||"",wrapperClass:r.wrapperClass,wrapperStyle:r.wrapperStyle}),this.skeleton=i,this.renderButton(),this.client=new La(this.config,{logger:this.logger}),this.client){e.next=28;break}return window[window.__sl_console__?"__sl_console__":"console"].error("new Failed to create new Client"),e.abrupt("return");case 28:return this.afterInit(),this.bindEvents(),e.abrupt("return",this.client);case 31:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"setDisabled",value:function(e){if(this.element)try{if(this.disabled=e,e)return void this.element.classList.add(kt);this.element.classList.remove(kt)}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("This error does not affect functionality, no need to address",e)}}},{key:"setLoading",value:function(e){if(this.element)try{if(this.disabled=e,e)return void this.element.classList.add(St);this.element.classList.remove(St)}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("This error does not affect functionality, no need to address",e)}}}]),a}();!function(e){e.GooglePay="googlePay",e.ApplePay="applePay",e.Link="link",e.BrowserCard="browserCard"}(Ba||(Ba={})),function(e){e.Default="default",e.Square="square",e.Rounded="rounded"}(Ma||(Ma={}));var Ua=[Ba.ApplePay,Ba.GooglePay,Ba.Link,Ba.BrowserCard],Ha=(me(Ra={},Ma.Default,4),me(Ra,Ma.Rounded,9999),me(Ra,Ma.Square,0),Ra),qa=function(e,t,n){if(e){var r=e.contains(t);n&&!r?e.add(t):!n&&r&&e.remove(t)}},Ga=function(){function e(t,n){var r=this;se(this,e),me(this,"container",void 0),me(this,"styleElement",null),me(this,"insertStyle",(function(e){if(r.container){var t=document.createElement("style");t.innerHTML="\n      .".concat(St," .__PrivateStripeElement {\n        display: none !important;\n        visibility: hidden;\n      }\n    "),e.height&&(r.container.style.height="".concat(e.height,"px")),r.styleElement=t,r.container.parentElement&&r.container.parentElement.insertBefore(t,r.container)}})),me(this,"destroy",(function(){r.container.parentElement&&r.styleElement&&r.container.parentElement.removeChild(r.styleElement)})),this.container=t,this.insertStyle(n)}return de(e,[{key:"setDisabled",value:function(e){qa(this.container.classList,kt,e)}},{key:"setLoading",value:function(e){qa(this.container.classList,St,e)}}]),e}();function Ya(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Va(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ya(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ya(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var za=function(e){return(e||"").toLowerCase()},Wa=function(e,t){return{label:"Total",amount:e,pending:t}},Ka=function(e){return e===Ba.ApplePay},Xa=function(e){he(u,xt);var t,n,r,o,a,i,c,s=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(u);function u(e){var t,n,r;return se(this,u),me(fe(r=s.call(this,e)),"config",void 0),me(fe(r),"payChannelData",null),me(fe(r),"instance",null),me(fe(r),"paymentRequest",null),me(fe(r),"prButton",null),me(fe(r),"buttonElement",null),me(fe(r),"styleElement",null),me(fe(r),"paymentMethod",null),me(fe(r),"confirmModalLoadState",null),me(fe(r),"disabled",!1),me(fe(r),"loading",!1),me(fe(r),"initSuccess",!0),me(fe(r),"loadResourceFail",!1),me(fe(r),"initTime",0),me(fe(r),"logger",void 0),me(fe(r),"destroy",(function(){try{var e,t;null===(e=r.buttonElement)||void 0===e||e.destroy(),r.buttonElement=null,null===(t=r.prButton)||void 0===t||t.unmount();var n,o=document.getElementById(r.config.paymentInfo.currentDomId);null!=o&&o.parentElement&&r.styleElement&&(null==o||null===(n=o.parentElement)||void 0===n||n.removeChild(r.styleElement),o.innerHTML=""),r.paymentRequest=null,r.instance=null}catch(e){r.logger.error("stripeOther destroy error",{error:e,data:{channelSdkInitConfig:r.config.paymentInfo.channelSdkInitConfig}})}})),r.config=e,ae.set(null===(t=(n=r.config).loggerFn)||void 0===t?void 0:t.call(n)),r.logger=ae.get().pipeOwner("payment-common.StripeOther").pipeData({domId:"".concat(r.config.props.domId)}),r}return de(u,[{key:"render",value:(c=ce(Oe.mark((function e(){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.beforeInit(),e.next=3,this.init();case 3:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"init",value:(i=ce(Oe.mark((function e(){var t,n,r,o;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.paymentMethod=Ba[this.config.paymentInfo.methodCode]||null,e.next=3,this.loadChannelJs();case 3:if(e.sent){e.next=6;break}return e.abrupt("return");case 6:if(this.createStripeInstance(),!this.paymentRequest){e.next=23;break}return t=vt.now(),e.next=11,this.paymentRequest.canMakePayment();case 11:if(n=e.sent,r=vt.now()-t,o={canMakePaymentResult:n,paymentMethod:this.paymentMethod,taken:r},this.logger.info("canMakePaymentResult",{data:{logInfo:o}}),window[window.__sl_console__?"__sl_console__":"console"].log("canMakePaymentResult:",o),!(this.paymentMethod&&n&&n[this.paymentMethod])){e.next=21;break}this.renderButton(),this.afterInit(),e.next=23;break;case 21:return this.handleError(new Error("The current browser does not support this payment method"),ke.Init,{canMakePaymentResult:n}),e.abrupt("return");case 23:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"beforeInit",value:function(){this.initTime=vt.now(),ft(this.config.beforeInit)&&this.config.beforeInit()}},{key:"afterInit",value:function(){this.initSuccess=!0,this.showButton();var e=vt.now()-this.initTime;this.logger.log("afterInit",{data:{duration:e}}),ft(this.config.afterInit)&&this.config.afterInit()}},{key:"onChannelModalSuccess",value:function(){ft(this.config.onChannelModalSuccess)&&this.config.onChannelModalSuccess(this.config.paymentInfo)}},{key:"beforeCreateOrder",value:(a=ce(Oe.mark((function e(){var t,n,r,o,a;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ft(this.config.beforeCreateOrder)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.confirmModalLoadState;case 4:return t=this.config.paymentInfo,n=t.channelCode,r=t.methodCode,o=t.paymentId,e.next=7,this.config.beforeCreateOrder({channelCode:n,methodCode:r,paymentId:o});case 7:return a=e.sent,e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"afterCreateOrder",value:function(e){ft(this.config.afterCreateOrder)&&this.config.afterCreateOrder(e,{channelCode:Pe.StripeOther,methodCode:this.config.paymentInfo.methodCode})}},{key:"setDisabled",value:function(e){this.disabled=e,this.buttonElement&&this.buttonElement.setDisabled(e)}},{key:"setLoading",value:function(e){this.loading=e,this.buttonElement&&this.buttonElement.setLoading(e)}},{key:"loadChannelJs",value:function(){var e=this;return new Promise((function(t){In("https://js.stripe.com/v3/").then((function(){e.loadResourceFail=!1,t(!0)})).catch((function(n){e.loadResourceFail=!0,e.handleError(new Error("Failed to load channel js resource: ".concat(n)),ke.Init),t(!1)}))}))}},{key:"createStripeInstance",value:function(){var e=this;try{var t=this.config.paymentInfo,n=t.configData,r=n.publicApiKey,o=void 0===r?"":r,a=n.stripeApiVersion,i=n.accountId,c=n.accountCountry,s=void 0===c?"":c,u=t.channelSdkInitConfig,l=this.config.paymentInfo.settleCurrency||"",d=Ua.filter((function(t){return t!==e.paymentMethod}));if(!u)return void this.handleError(new Error("channelSdkInitConfig is empty"),ke.Init);var f={};try{f=JSON.parse(u)}catch(e){return void this.handleError(new Error("Failure to parse channel configuration JSON string"),ke.Init,{channelSdkInitConfig:u})}this.instance=window.Stripe(o,{apiVersion:a,stripeAccount:i});var p=this.instance.paymentRequest(Va(Va({},f),{},{currency:za(l),country:s,total:Wa(9999,!0),disableWallets:d}));this.paymentRequest=p}catch(e){this.handleError(new Error("Failed to create channel instance"),ke.Init,{channelMsg:e.message})}}},{key:"onPaymentAuthorized",value:(o=ce(Oe.mark((function e(t){var n,r,o,a,i,c,s,u,l,d,f,p,h=this;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.config.createOrder,ft(n)){e.next=3;break}return e.abrupt("return");case 3:return r=t.paymentMethod,o=t.shippingAddress,a=t.shippingOption,i=t.payerName,c=t.payerPhone,s=t.payerEmail,u=r.id,l=void 0===u?"":u,d=r.billing_details,f=Va(Va({},this.payChannelData),{},{paymentMethod:l,billing_details:d,shippingAddress:o,shippingOption:a,payerInfo:{name:i,phone:c,email:s}}),e.prev=6,e.next=9,n(this.config.paymentInfo,{payChannelData:f,token:f});case 9:if(!(y=p=e.sent)||!Boolean(y.error)){e.next=13;break}throw p.error;case 13:return e.next=15,pn(p.nextAction,{payOptions:{hooks:{channelConfirm:function(e){return h.channelConfirm(e,t)}}}});case 15:e.next=22;break;case 17:e.prev=17,e.t0=e.catch(6),t.complete("fail"),this.handleError(e.t0,ke.Pay),this.afterCreateOrder(je.Fail);case 22:case"end":return e.stop()}var y}),e,this,[[6,17]])}))),function(e){return o.apply(this,arguments)})},{key:"channelConfirm",value:(r=ce(Oe.mark((function e(t,n){var r,o,a,i;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=(null===(r=t.data)||void 0===r?void 0:r.clientSecret)||"",this.instance){e.next=3;break}throw new Error("stripe instance not found");case 3:if(o){e.next=9;break}if(!t.nextAction){e.next=8;break}return e.next=7,pn(t.nextAction);case 7:return e.abrupt("return");case 8:throw new Error("The interface does not return clientSecret, and the sdk`s confirm cannot be called");case 9:return e.prev=9,e.next=12,this.instance.confirmCardPayment(o);case 12:a=e.sent,(i=a.error)?(n.complete("fail"),this.afterCreateOrder(je.Fail),this.handleError(new Error("confirm error"),ke.Pay,{error:i,clientSecret:o})):(n.complete("success"),this.afterCreateOrder(je.Success));case 15:if(e.prev=15,!t.nextAction){e.next=19;break}return e.next=19,pn(t.nextAction);case 19:return e.finish(15);case 20:case"end":return e.stop()}}),e,this,[[9,,15,20]])}))),function(e,t){return r.apply(this,arguments)})},{key:"renderButton",value:function(){if(this.instance&&this.paymentRequest)try{var e,t,n=document.getElementById(this.config.paymentInfo.currentDomId);if(!n)throw new Error("Container not found: #".concat(this.config.paymentInfo.currentDomId));var r=this.instance.elements(),o=null===(e=this.config.props.styleOptions)||void 0===e?void 0:e.height;if(Ka(this.paymentMethod)){var a,i=document.createElement("style");i.innerHTML="\n    .applepay-confirm-modal-header {\n      margin-bottom: 12px;\n    }\n\n    .applepay-confirm-modal-content {\n      font-family: 'Helvetica Neue';\n      font-style: normal;\n      font-weight: 400;\n      font-size: 16px;\n      line-height: 24px;\n      color: #2c2c2c;\n    }\n\n    .applepay-confirm-modal-action {\n      margin-top: 24px;\n      display: flex;\n      flex-direction: column;\n    }\n\n    .applepay-confirm-modal-action > button {\n      border: 0;\n      text-align: center;\n      border-radius: 4px;\n      cursor: pointer;\n      font-style: normal;\n      line-height: 24px;\n    }\n\n    .applepay-confirm-modal-action-ok {\n      padding: 9px 0;\n      color: #fff;\n      background: #000;\n      font-size: 19px;\n      font-weight: 500;\n    }\n\n    .applepay-confirm-modal-action-ok > span {\n      vertical-align: middle;\n      font-family: 'SF Pro', 'Helvetica Neue';\n    }\n\n    .applepay-confirm-modal-action-ok > svg {\n      vertical-align: middle;\n    }\n\n    .applepay-confirm-modal-action-cancel {\n      padding: 0;\n      margin-top: 24px;\n      color: rgba(44, 44, 44, 0.5);\n      background: transparent;\n      font-size: 16px;\n      font-weight: 500;\n      font-family: 'Helvetica Neue';\n    }\n  ",this.styleElement=i,null===(a=n.parentElement)||void 0===a||a.insertBefore(i,n)}var c=null===(t=this.config.props.styleOptions)||void 0===t?void 0:t["border-radius"];if(void 0===c){var s,u=document.querySelector("[data-button_style]"),l=null==u?void 0:u.getAttribute("data-button_style");this.logger.info("buttonStyle",{data:{buttonStyle:l}}),c=null!==(s=Ha[l])&&void 0!==s?s:Ha.default}var d={height:o?"".concat(o,"px"):"",theme:"dark",borderRadius:"".concat(c,"px")},f=r.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:d}});this.prButton=f,this.initButtonListener(this.paymentRequest,this.prButton),this.buttonElement=new Ga(n,{height:o}),this.prButton.mount(n);var p=n.querySelector(".__PrivateStripeElement");p&&(p.style.display="block")}catch(e){this.handleError(new Error("Failed to render button"),ke.Init,{channelMsg:e.message})}}},{key:"initButtonListener",value:function(e,t){var n=this;e.on("shippingaddresschange",(function(e){var t=e.shippingAddress,r=e.updateWith;n.handleFormDataChange(Ae.ChangeAddress,{shippingAddress:t},r)})),e.on("shippingoptionchange",function(){var e=ce(Oe.mark((function e(t){var r,o;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.shippingOption,o=t.updateWith,n.handleFormDataChange(Ae.ChangeDeliveryMethod,{shippingOption:r},o);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("cancel",(function(){n.logger.info("User closed payment modal")})),e.on("paymentmethod",this.onPaymentAuthorized.bind(this)),t.on("click",(function(e){e.preventDefault(),n.handleStripeOtherButtonClick()}))}},{key:"handleFormDataChange",value:(n=ce(Oe.mark((function e(t,n,r){var o,a,i,c,s,u,l,d;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("handleFormDataChange: ".concat(t),{data:{params:n}}),o=this.config.onFormDataChange,ft(o)){e.next=5;break}return r({status:"fail"}),e.abrupt("return");case 5:return e.prev=5,e.next=8,o(Va(Va({},this.payChannelData),n),t);case 8:if((a=e.sent)&&!a.error){e.next=11;break}throw new Error(null==a||null===(i=a.error)||void 0===i?void 0:i.message);case 11:if(this.payChannelData=a,c=this.payChannelData,s=c.amount,u=void 0===s?0:s,l=c.shippingOptions,d=c.displayItems,null!=l&&l.length){e.next=16;break}return r({status:"invalid_shipping_address"}),e.abrupt("return");case 16:r({status:"success",total:Wa(u,!1),displayItems:d,shippingOptions:l}),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(5),r({status:"fail"}),this.handleError(new Error("Failed to update abandonedOrder info"),ke.Pay,{error:e.t0});case 23:case"end":return e.stop()}}),e,this,[[5,19]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"handleStripeOtherButtonClick",value:(t=ce(Oe.mark((function e(){var t,n,r,o,a,i,c,s,u=this;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.instance&&this.paymentRequest&&!this.loading&&!this.disabled){e.next=2;break}return e.abrupt("return");case 2:return t=this.config.props.expressOptimizationSwitch,n=function(){var e=null;try{u.paymentRequest&&(e=setTimeout((function(){u.onChannelModalSuccess()}),1e3),u.paymentRequest.show(),u.logger.info("Payment modal launched successfully"))}catch(t){e&&(clearTimeout(e),e=null),u.handleError(new Error("Failed to pull up the channel"),ke.PullUpChannel,{error:t})}},this.setLoading(!0),Ka(this.paymentMethod)&&t&&setTimeout((function(){n()})),e.next=8,this.beforeCreateOrder().catch((function(e){u.handleError(e,ke.PullUpChannel)}));case 8:if(r=e.sent,this.setLoading(!1),(l=r)&&!1!==l.valid&&r.paymentConfig&&r.paymentConfig.payChannelData){e.next=13;break}return e.abrupt("return");case 13:o=r.paymentConfig.payChannelData,a=o.amount,i=o.currency,c=o.shippingOptions,s=o.displayItems,this.payChannelData=Va({},o),this.logger.info("Updating payment modal information",{data:{amount:a,shippingOptions:c,displayItems:s}}),this.paymentRequest.update({currency:za(i),total:Wa(a,!1),shippingOptions:c,displayItems:s}),Ka(this.paymentMethod)?t||hr({ok:n,cancel:function(){u.logger.info("user cancelled payment")}}).then((function(e){e.show()})).catch((function(e){u.handleError(e,ke.Pay)})):setTimeout((function(){n()}));case 19:case"end":return e.stop()}var l}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"handleError",value:function(e,t,n){window[window.__sl_console__?"__sl_console__":"console"].error("Unified Error Handling for StripeOther:",{error:e,type:t,extData:n}),t!==ke.CreateExpected&&this.logger.error("handleError",{action:t,error:e,data:Va({},n)}),t===ke.Init&&(this.initSuccess=!1,this.hideButton()),ft(this.config.onError)&&this.config.onError(e,t,n)}}]),u}(),Ja=function(e){he(n,Xa);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(n);function n(e){var r;return se(this,n),me(fe(r=t.call(this,e)),"name","GOOGLE_PAY"),r}return de(n)}(),$a=function(e){he(n,Xa);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(n);function n(e){var r;return se(this,n),me(fe(r=t.call(this,e)),"name","APPLE_PAY"),r}return de(n)}();function Za(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Za(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Za(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ei=function(e){var t=e.paymentInfo,n=t.configData,r=t.channelSdkInitConfig,o=t.captureInfo.autoCapture,a=e.props.payMode===Se.Continue,i=e.props.isSubscription,c=function(e,t){var n="",r=function(e){var t=e.key,r=e.value;n=It(n,me({},t,r))};return Array.isArray(e)&&(null==e||e.forEach((function(e){e.scope===Se.All?r(e):(t&&e.scope===Se.Continue&&r(e),t||e.scope!==Se.PayNow||r(e))}))),n}(JSON.parse(r),a),s={currency:e.paymentInfo.settleCurrency||"USD",commit:!a,"merchant-id":n.paypalMerchantId,"client-id":n.clientId};return It(c,Qa(Qa({},s),i?{intent:"tokenize",vault:!0}:{intent:o?"capture":"authorize"}))},ti=function(e){var t=e;if(null!=e&&e.paymentInfo){var n=e.paymentInfo.configData;t.props=Qa(Qa({},e.props),{},{queryParams:ei(e)},n)}return t},ni=function(e,t){var n,r=t.props.isSubscription;return{abandonedOrderInfo:e.abandonedOrderInfo,orderFrom:e.orderFrom||e.abandonedOrderInfo.orderFrom,channelCode:Pe.Paypal,spbCurrencyCode:t.paymentInfo.settleCurrency,payInfo:{cancelUrl:window.location.href,returnUrl:e.returnUrl,captureInfo:null===(n=t.paymentInfo)||void 0===n?void 0:n.captureInfo,paymentScenes:r?Me.PAY_AND_BIND:Me.PAY_NORMAL},dataReportReq:e.dataReportReq}},ri=function(e){var t=Math.floor(e);return t>=5e3&&t<=1e4?"warn":t>1e4?"error":"info"};function oi(e){var t,n=(me(t={},"".concat(Pe.Paypal,"-").concat(xe.Paypal),{validate:function(){return e.props&&pt(e.props)?{result:!0}:{result:!1,errorTip:"props illegal"}},getConfig:function(){return e},component:bi}),me(t,"".concat(Pe.StripeOther,"-").concat(xe.ApplePay),{validate:function(){return e.props&&pt(e.props)?{result:!0}:{result:!1,errorTip:"props illegal"}},getConfig:function(){return e},component:$a}),me(t,"".concat(Pe.StripeOther,"-").concat(xe.GooglePay),{validate:function(){return e.props&&pt(e.props)?{result:!0}:{result:!1,errorTip:"props illegal"}},getConfig:function(){return e},component:Ja}),me(t,xe.GooglePay,{validate:function(){return e.props&&pt(e.props)?{result:!0}:{result:!1,errorTip:"props illegal"}},getConfig:function(){return e},component:An}),me(t,xe.ApplePay,{validate:function(){return e.props&&pt(e.props)?{result:!0}:{result:!1,errorTip:"props illegal"}},getConfig:function(){return e},component:Fa}),t);return gr(e.paymentInfo)||wr(e.paymentInfo)||br(e.paymentInfo)?n["".concat(e.paymentInfo.methodCode)]:n["".concat(e.channelCode,"-").concat(e.paymentInfo.methodCode)]}function ai(e){var t=!0;return e&&e.type||(t=!1),t}function ii(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ci(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ii(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ii(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var si,ui=function(e){var t,n=e.node,r=e.domId,o=e.height,a=e.isContinueMode,i=e.isVerticalLayout,c=e.wrapperClass,s=e.wrapperStyle,u=document.createElement("div");u.classList.add("paypal__skeleton--animated");var l=document.createElement("style");if(li({styleTag:l,domId:r,height:o,isContinueMode:a,isVerticalLayout:i}),n){if(c&&n.classList.add(c),s){var d,f={},p=(null===(d=n.getAttribute("style"))||void 0===d?void 0:d.replace(/\s+/g,""))||"",h=function(e){var t={};return e.split(";").forEach((function(e){var n=dt(e.split(":"),2),r=n[0],o=n[1],a=null==r?void 0:r.replace(/-[^0-9]/g,(function(e){return e.charAt(1).toUpperCase()}));a&&(t[a]=o)})),t};"string"==typeof s?f=ci(ci({},h(p)),h(s)):"object"===k(s)&&(f=ci(ci({},h(p)),s)),n.style="object"!==k(y=f)?"":Object.entries(y).map((function(e){return e.join(":")})).join(";").replace(/[A-Z]/g,(function(e){return"-".concat(e.charAt(0).toLowerCase())}))}var y;return null===(t=n.parentElement)||void 0===t||t.insertBefore(l,n),n.appendChild(u),u}},li=function(e){var t=e.styleTag,n=e.domId,r=e.height,o=e.isContinueMode,a=e.isVerticalLayout;t.innerHTML=o&&!a?"\n        #".concat(n," {\n          overflow: hidden;\n          text-align: center;\n          height: ").concat(r,"px;\n          z-index: 1;\n        }\n        /** paypal background color */\n        #").concat(n,".paypal__bg::before,\n        #").concat(n,".paypal__bg::after {\n          content:'';\n          position: absolute;\n          top: 0;\n          bottom: 0;\n          left: 0;\n          width: calc(50% - 3px);\n          border-radius: 4px;\n        }\n        #").concat(n,".paypal__bg::after {\n          left: unset;\n          right: 0;\n        }\n        [data-button_style=square] #").concat(n,".paypal__bg::before,\n        [data-button_style=square] #").concat(n,".paypal__bg::after{\n          border-radius: 0 !important;\n        }\n        [data-button_style=rounded] #").concat(n,".paypal__bg{\n          border-radius: 9999px !important;\n        }\n      "):"\n        #".concat(n," {\n          min-height: ").concat(r,"px;\n        }\n        ");var i=["90deg","hsla(0, 0%, 74.5%, 0.2) 25%","hsla(0, 0%, 50.6%, 0.24) 37%","hsla(0, 0%, 74.5%, 0.2) 63%"].join(", ");t.innerHTML+="\n      #".concat(n," {\n        position: relative;\n        user-select: none;\n      }\n      #").concat(n," .paypal__skeleton--animated {\n        margin: 0 auto;\n        border-radius: 4px;\n        width: 100%;\n        height: ").concat(r,"px;\n        position: absolute;\n      }\n\n      .paypal__skeleton--animated {\n        background: linear-gradient(").concat(i,");\n        background-size: 400% 100%;\n        animation: skeleton 2s linear infinite;\n      }\n\n      ").concat("\n            @keyframes skeleton {\n              0% {\n                background-position: 100% 50%;\n              }\n              100% {\n                background-position: 0 50%;\n              }\n            }\n          ","\n      ")};function di(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?di(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):di(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function hi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pi(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}!function(e){he(a,Ke);var t,n,r,o=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(a);function a(e){var t;return se(this,a),me(fe(t=o.call(this,e)),"paypalInstance",null),t}de(a,[{key:"initPaypal",value:function(){this.paypalInstance=window[this.paypalInstanceName]}},{key:"getConfig",value:(r=ce(Oe.mark((function e(){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.paypalInstance){e.next=2;break}throw new Error("paypalInstance is not initialized");case 2:return e.abrupt("return",this.paypalInstance.Applepay().config());case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"validateMerchant",value:(n=ce(Oe.mark((function e(t){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.paypalInstance){e.next=2;break}throw new Error("paypalInstance is not initialized");case 2:return e.abrupt("return",this.paypalInstance.Applepay().validateMerchant(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"confirmOrder",value:(t=ce(Oe.mark((function e(t,n){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.paypalInstance){e.next=2;break}throw new Error("paypalInstance is not initialized");case 2:return e.abrupt("return",this.paypalInstance.Applepay().confirmOrder(fi({orderId:t},n||{})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"destroy",value:function(){this.paypalInstance=null}}])}(),function(e){he(a,Ke);var t,n,r,o=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(a);function a(e){var t;return se(this,a),me(fe(t=o.call(this,e)),"paypalInstance",null),t}de(a,[{key:"initPaypal",value:function(){this.paypalInstance=window[this.paypalInstanceName]}},{key:"getConfig",value:(r=ce(Oe.mark((function e(t){var n,r,o,a;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.paypalInstance){e.next=2;break}throw new Error("paypalInstance is not initialized");case 2:return e.next=4,this.paypalInstance.Googlepay().config();case 4:return a=e.sent,"JP"==t&&null!=a&&null!==(n=a.allowedPaymentMethods)&&void 0!==n&&null!==(r=n[0])&&void 0!==r&&null!==(o=r.parameters)&&void 0!==o&&o.allowedAuthMethods&&(a.allowedPaymentMethods[0].parameters.allowedAuthMethods=["PAN_ONLY"]),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"confirmOrder",value:(n=ce(Oe.mark((function e(t,n){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.paypalInstance){e.next=2;break}throw new Error("paypalInstance is not initialized");case 2:return e.abrupt("return",this.paypalInstance.Googlepay().confirmOrder({orderId:t,paymentMethodData:n}));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"initiatePayerAction",value:(t=ce(Oe.mark((function e(t){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.paypalInstance){e.next=2;break}throw new Error("paypalInstance is not initialized");case 2:return e.abrupt("return",this.paypalInstance.Googlepay().initiatePayerAction({orderId:t}));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this.paypalInstance=null}}])}();var yi={loadingStatus:Te.Await,info:{},promise:null},vi=function(e){he(c,xt);var t,n,r,o,a,i=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ve(e);if(t){var o=ve(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}(c);function c(e){var t,n;return se(this,c),me(fe(n=i.call(this,e)),"name","PAY_PAL"),me(fe(n),"config",void 0),me(fe(n),"payMode",void 0),me(fe(n),"isHidePayPalButton",void 0),me(fe(n),"isRendered",void 0),me(fe(n),"element",null),me(fe(n),"initTimer",void 0),me(fe(n),"initActions",void 0),me(fe(n),"createOrderParams",void 0),me(fe(n),"returnUrl",void 0),me(fe(n),"orderInfoMap",{}),me(fe(n),"initTime",0),me(fe(n),"skeleton",void 0),me(fe(n),"initSuccess",!0),me(fe(n),"loadResourceFail",!1),me(fe(n),"logger",void 0),me(fe(n),"dynamicJsonpCallback",(function(e){yi=hi(hi({},yi),{},{info:e,loadingStatus:Te.Done}),n.handleDynamicNotify(e)})),me(fe(n),"destroy",(function(){try{si&&(si.disconnect(),si=null),n.element&&(n.element.innerHTML="",n.element=null)}catch(e){n.logger.error("paypal destroy error",{error:e,data:{channelSdkInitConfig:n.config.paymentInfo.channelSdkInitConfig}})}})),n.payMode=e.props.payMode||Se.Continue,n.returnUrl="",ae.set(null===(t=e.loggerFn)||void 0===t?void 0:t.call(e)),n.logger=ae.get().pipeOwner("payment-common.PayPal").pipeData({domId:"".concat(e.props.domId)}),n.config=ti(yt(Ye,e)),n.handleDomHeight(),n.validate(e)?n:ye(n)}return de(c,[{key:"validate",value:function(e){var t=oi(e);if(!t)return!1;var n=t.validate(),r=n.result,o=n.errorTip;return!!r||(this.logger.error("constructor error ".concat(o)),!1)}},{key:"handleDomHeight",value:function(){var e,t=(null===(e=this.config.props.styleOptions)||void 0===e?void 0:e.height)||45;t>55&&(this.logger.warn("Button height input exception",{data:{height:t}}),t=55),t<25&&(this.logger.warn("Button height input exception",{data:{height:t}}),t=25),this.config.props.styleOptions=hi(hi({},this.config.props.styleOptions),{},{height:t})}},{key:"isContinueMode",get:function(){return this.payMode===Se.Continue}},{key:"expressButtonConfig",get:function(){try{var e;return JSON.parse((null===(e=this.config.paymentInfo)||void 0===e?void 0:e.expressButtonConfig)||"{}")}catch(e){var t;this.logger.error("parse expressButtonConfig error",{error:e,data:{expressButtonConfig:null===(t=this.config.paymentInfo)||void 0===t?void 0:t.expressButtonConfig}})}}},{key:"isVerticalLayout",get:function(){var e;return"vertical"===(null===(e=this.expressButtonConfig)||void 0===e?void 0:e.layout)}},{key:"isSubscription",get:function(){return this.config.props.isSubscription}},{key:"handleError",value:function(e,t,n){this.initTimer&&clearTimeout(this.initTimer),t!==ke.CreateExpected&&this.logger.error("handleError",{action:t,error:e,data:{type:t,extData:n},tags:null==n?void 0:n.tags}),t===ke.Init&&(this.initSuccess=!1,this.hideButton()),ft(this.config.onError)&&this.config.onError(e,t,n)}},{key:"handleDynamicNotify",value:function(e){var t=(e||{}).paypal;this.isHidePayPalButton=!t,t||(ft(this.config.onDynamicNotify)&&this.config.onDynamicNotify(hi(hi({},e),{},{isHidePayPalButton:!0})),this.handleError(new Error("Dynamic button loading failed"),ke.Init))}},{key:"handleDynamic",value:(a=ce(Oe.mark((function e(){var t,n,r=this;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return me(t={},Te.Done,(function(){r.handleDynamicNotify(yi.info)})),me(t,Te.Fail,(function(){})),me(t,Te.Pending,ce(Oe.mark((function e(){return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,yi.promise;case 2:r.handleDynamicNotify(yi.info);case 3:case"end":return e.stop()}}),e)})))),me(t,Te.Await,(function(){var e;return yi.loadingStatus=Te.Pending,window[Ge]=r.dynamicJsonpCallback,yi.promise=He([(e=Ge,"https://www.paypal.com/checkoutnow/remembered?callback=".concat(e))],{returnPromise:!0}).catch((function(){r.loadResourceFail=!0,r.handleError(new Error("[Failed to load remember script]:".concat(Ge)),ke.Init)})),yi.promise})),n=t[yi.loadingStatus],e.abrupt("return",n());case 3:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})},{key:"handlePay",value:function(e){var t=e.nextAction,n=e.context,r=(void 0===n?{returnUrl:""}:n).returnUrl;if(this.returnUrl=r,this.isSubscription){var o=t.data.popupData.tokenId;return this.orderInfoMap[o||""]={returnUrl:r},o||""}var a=t.data.popupData.id;return this.orderInfoMap[a||""]={returnUrl:r},a||""}},{key:"continueMode",value:(o=ce(Oe.mark((function e(t,n){var r,o,a,i,c,s,u,l,d,f,p,h;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.createOrderParams&&!1!==this.createOrderParams.valid){e.next=2;break}return e.abrupt("return","");case 2:return e.prev=2,s=ni(this.createOrderParams,this.config),e.next=6,ut(s);case 6:if(u=e.sent,null==(l=null===(r=u.data)||void 0===r?void 0:r.data)||!l.errorInfo){e.next=11;break}return this.handleError(new Error("Place order failed"),ke.CreateExpected,{errorInfo:null==l?void 0:l.errorInfo}),e.abrupt("return","");case 11:if(!(d=(null===(o=u.data)||void 0===o?void 0:o.code)||(null===(a=u.data)||void 0===a||null===(i=a.data)||void 0===i||null===(c=i.paymentError)||void 0===c?void 0:c.code))||"SUCCESS"===d){e.next=15;break}return this.handleError(new Error("prepare-pay request failed"),ke.Pay,{tags:{code:d},res:u.data}),e.abrupt("return","");case 15:if(ai(f=JSON.parse((null==l?void 0:l.nextAction)||"{}"))){e.next=19;break}return this.handleError(new Error("prepare-pay response illegal"),ke.Pay,{res:u.data}),e.abrupt("return","");case 19:return p={nextAction:f,context:null==l?void 0:l.context},this.logger.info("continueMode",{data:{data:l,payOptions:p,actions:n}}),e.next=23,this.handlePay(p);case 23:return(h=e.sent)&&ft(this.config.onChannelModalSuccess)&&this.config.onChannelModalSuccess(this.config.paymentInfo),e.abrupt("return",h);case 28:return e.prev=28,e.t0=e.catch(2),this.handleError(e.t0,ke.Pay),e.abrupt("return","");case 32:case"end":return e.stop()}}),e,this,[[2,28]])}))),function(e,t){return o.apply(this,arguments)})},{key:"payNowMode",value:(r=ce(Oe.mark((function e(t,n){var r;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!ft(this.config.createOrder)){e.next=13;break}return e.next=4,this.config.createOrder(this.config.paymentInfo,t,n);case 4:if(r=e.sent,this.logger.info("payNowMode, createOrder input parameters",{data:hi({},r)}),!1!==r.valid){e.next=9;break}return this.logger.log("Business side input parameter exception, process interrupted",{data:hi({},r)}),e.abrupt("return","");case 9:if(ai(null==r?void 0:r.nextAction)){e.next=12;break}return this.handleError(new Error("prepare-pay response illegal"),ke.Pay,{res:r}),e.abrupt("return","");case 12:return e.abrupt("return",this.handlePay(r));case 13:return e.abrupt("return","");case 16:return e.prev=16,e.t0=e.catch(0),this.handleError(e.t0,ke.Pay),e.abrupt("return","");case 20:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(e,t){return r.apply(this,arguments)})},{key:"handleRenderTimeout",value:function(e){var t,n,r=this;si&&(si.disconnect(),si=null),this.initTimer=setTimeout((function(){var t,n,o,a;r.element&&(r.element.innerHTML="");var i=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;si=new i((function(e){e.forEach((function(){r.element&&(r.element.innerHTML="")}))})),r.element&&si.observe(r.element,{childList:!0,attributes:!1,subtree:!1}),setTimeout((function(){si&&(si.disconnect(),si=null)}),5e3),r.handleError(new Error("[Init rendering failed][Call onInit timeout][Current timeout time: ".concat(null===(t=r.config.props)||void 0===t||null===(n=t.buttonTimeoutConfig)||void 0===n?void 0:n.timeoutMillis,"ms]")),ke.Init),e(new Error("[Init rendering failed][Call onInit timeout][Current timeout time: ".concat(null===(o=r.config.props)||void 0===o||null===(a=o.buttonTimeoutConfig)||void 0===a?void 0:a.timeoutMillis,"ms]")))}),null===(t=this.config.props)||void 0===t||null===(n=t.buttonTimeoutConfig)||void 0===n?void 0:n.timeoutMillis)}},{key:"setDisabled",value:function(e){if(this.element)try{if(e)return this.initActions&&this.initActions.disable(),void this.element.classList.add(kt);this.initActions&&this.initActions.enable(),this.element.classList.remove(kt)}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("This error does not affect functionality, no need to address",e)}}},{key:"beforeInit",value:function(){this.initTime=vt.now(),ft(this.config.beforeInit)&&this.config.beforeInit()}},{key:"afterInit",value:function(e,t){try{this.initSuccess=!0,this.showButton();var n=vt.now()-this.initTime;this.logger.info("afterInit",{data:{data:e,actions:t,duration:n,level:ri(n)}}),ft(this.config.afterInit)&&this.config.afterInit()}catch(e){this.handleError(e)}}},{key:"beforeCreateOrder",value:(n=ce(Oe.mark((function e(){var t,n,r,o,a;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ft(this.config.beforeCreateOrder)){e.next=2;break}return e.abrupt("return");case 2:return t=this.config.paymentInfo,n=t.channelCode,r=t.methodCode,o=t.paymentId,e.next=5,this.config.beforeCreateOrder({channelCode:n,methodCode:r,paymentId:o});case 5:return a=e.sent,e.abrupt("return",a);case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"afterCreateOrder",value:function(e){ft(this.config.afterCreateOrder)&&this.config.afterCreateOrder(e,{channelCode:Pe.Paypal,methodCode:xe.Paypal})}},{key:"removeSkeleton",value:function(e){var t=this,n=null;n&&clearTimeout(n),n=setTimeout((function(){e&&(t.skeleton&&e.removeChild(t.skeleton),t.isContinueMode&&e.classList.add("paypal__bg"))}),300)}},{key:"specialParamsByScenes",get:function(){var e,t,n=this;return this.isSubscription?{actions:{createBillingAgreement:(e=ce(Oe.mark((function e(t,r){var o;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.logger.log("createBillingAgreement PayPal starting to place order",{data:{data:t,actions:r}}),e.prev=1,!n.isContinueMode){e.next=8;break}return e.next=5,n.continueMode(t,r);case 5:e.t1=e.sent,e.next=11;break;case 8:return e.next=10,n.payNowMode(t,r);case 10:e.t1=e.sent;case 11:if(e.t0=e.t1,e.t0){e.next=14;break}e.t0="";case 14:return o=e.t0,n.afterCreateOrder(o?je.Success:je.Fail),e.abrupt("return",o);case 19:return e.prev=19,e.t2=e.catch(1),n.afterCreateOrder(je.Fail),e.abrupt("return","");case 23:case"end":return e.stop()}}),e,null,[[1,19]])}))),function(t,n){return e.apply(this,arguments)})}}:{actions:{createOrder:(t=ce(Oe.mark((function e(t,r){var o;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.logger.log("createOrder PayPal starting to place order",{data:{data:t,actions:r}}),e.prev=1,!n.isContinueMode){e.next=8;break}return e.next=5,n.continueMode(t,r);case 5:e.t1=e.sent,e.next=11;break;case 8:return e.next=10,n.payNowMode(t,r);case 10:e.t1=e.sent;case 11:if(e.t0=e.t1,e.t0){e.next=14;break}e.t0="";case 14:return o=e.t0,n.afterCreateOrder(o?je.Success:je.Fail),e.abrupt("return",o);case 19:return e.prev=19,e.t2=e.catch(1),n.afterCreateOrder(je.Fail),e.abrupt("return","");case 23:case"end":return e.stop()}}),e,null,[[1,19]])}))),function(e,n){return t.apply(this,arguments)})}}}},{key:"render",value:(t=ce(Oe.mark((function e(){var t,n,r,o,a,i,c=this;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.config,r=n.props,o=n.paymentInfo,a=document.getElementById(o.currentDomId),!r.dynamic){e.next=5;break}return e.next=5,this.handleDynamic();case 5:if(!this.isHidePayPalButton){e.next=7;break}return e.abrupt("return",null);case 7:if(!this.isRendered){e.next=9;break}return e.abrupt("return",null);case 9:if(a){e.next=12;break}return this.handleError(new Error("[onError][Initialization failed][Could not find mounted DOM]"),ke.Init,{domId:o.currentDomId}),e.abrupt("return",null);case 12:return this.element=a,i=ui({node:a,domId:o.currentDomId,height:(null===(t=r.styleOptions)||void 0===t?void 0:t.height)||"",isContinueMode:this.isContinueMode,isVerticalLayout:this.isVerticalLayout,wrapperClass:r.wrapperClass,wrapperStyle:r.wrapperStyle}),this.skeleton=i,this.logger.log("render start",{data:{config:this.config}}),this.beforeInit(),e.abrupt("return",new Promise((function(e,t){r.buttonTimeoutConfig&&r.buttonTimeoutConfig.enable&&c.handleRenderTimeout(t);var n,i,s,u=null,l=hi({domId:o.currentDomId,clientId:r.clientId,currency:o.settleCurrency,queryParams:r.queryParams,scriptParams:r.scriptParams,style:hi(hi(hi({},r.styleOptions),c.expressButtonConfig),{},{disableMaxWidth:!0}),onInit:function(t,n){c.logger.info("onInit"),c.afterInit(t,n),c.initTimer&&clearTimeout(c.initTimer),c.initActions=n,e(u)},onClick:(s=ce(Oe.mark((function e(t,n){var r,o;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.beforeCreateOrder();case 2:if(o=e.sent,c.logger.log("onClick, user clicked the button",{data:{data:t,params:o,actions:n}}),o){e.next=6;break}return e.abrupt("return");case 6:if(!1!==o.valid){e.next=8;break}return e.abrupt("return",n.reject());case 8:null===(r=c.initActions)||void 0===r||r.enable(),c.isContinueMode&&(c.createOrderParams=o);case 10:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)}),onApprove:(i=ce(Oe.mark((function e(t,n){var r,o,a;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(o=null===(r=c.orderInfoMap[t.orderID])||void 0===r?void 0:r.returnUrl)!==c.returnUrl&&c.logger.error("Front-end recorded returnUrl does not match this.returnUrl",{action:ke.Pay,data:{orderId:t.orderID,map:c.orderInfoMap,url:c.returnUrl}}),a=o||c.returnUrl,c.logger.log("onApprove PayPal order placed successfully, triggering callback",{data:{data:t,returnUrl:a,actions:n}}),ft(c.config.onApprove)&&c.config.onApprove(t,n),window.location.href=a;case 6:case"end":return e.stop()}}),e)}))),function(e,t){return i.apply(this,arguments)}),onCancel:(n=ce(Oe.mark((function e(t,n){var r;return Oe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.logger.log("user cancelled payment",{data:t}),!ft(null==n?void 0:n.redirect)||!ft(c.config.onCancel)){e.next=6;break}return e.next=4,c.config.onCancel(t);case 4:r=e.sent,null==n||n.redirect(r);case 6:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)}),onError:function(e,n,r){c.handleError(e,n,r),t(e)}},c.specialParamsByScenes.actions);(u=new Xe(l)).render().then((function(){c.loadResourceFail=!1})).catch((function(e){c.loadResourceFail=!0,c.handleError(new Error("Load Paypal resource failed"),ke.Init,{error:e}),t(e)})),u&&c.removeSkeleton(a)})));case 18:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),c}();vi=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":k(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}([_t],vi);var mi,gi,bi=vi;function wi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _i(e,t){return _i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_i(e,t)}function Oi(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_i(e,t)}function Ci(e,t){if(t&&("object"===l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return wi(e)}function ki(e){return ki=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ki(e)}!function(e){e.TEXT="text",e.I18N_CODE="i18n_code"}(mi||(mi={})),function(e){e.NonGray="NON_GRAY",e.GrayForAbort="GRAY_FOR_ABORT",e.GrayForTips="GRAY_FOR_TIPS"}(gi||(gi={}));var Si,Pi,xi,Ii,Ei={BUY_NOW:"pay-button-buy-now",MORE_OPTIONS:"pay-button-more-options",CHECKOUT:"pay-button-checkout",PAY_PAL:"pay-button-Paypal",APPLE_PAY:"pay-button-ApplePay",GOOGLE_PAY:"pay-button-GooglePay",SHOP_BY_FAST_CHECKOUT:"pay-button-shop-by",COMMON_ITEM_LAYOUT:"pay-button-common-item-layout",COMMON_ITEM:"pay-button-common-item",COMMON_ITEM_EXPRESS:"pay-button-common-item-express",BUTTON_SUBSCRIPTION:"pay-button-subscription",BUTTON_CUSTOM:"pay-button-custom",BUTTON_LOADING:"pay-button-loading",BUTTON_DISABLED:"pay-button-disabled",BUTTON_HIDE:"pay-button-hide",BUTTON_MASK:"pay-button-mask",BUTTON_SKELETON:"pay-button-skeleton",BUTTON_COLLAPSE:"pay-button-collapse",PAY_PAL_BG_BEFORE:"pay-button-Paypal-bg-before",PAY_PAL_BG_AFTER:"pay-button-Paypal-bg-after"},Ti="smart-payment-hide",ji="pay-button-more-options-theme-color",Ai={height:48,width:null,"border-radius":0},Li=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1"],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1"],["Antigua and Barbuda","ag","1"],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Australia","au","61"],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1"],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1"],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1"],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1"],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1"],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599"],["Cayman Islands","ky","1"],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61"],["Cocos (Keeling) Islands","cc","61"],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599"],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1"],["Dominican Republic (República Dominicana)","do","1"],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358"],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1"],["Guadeloupe","gp","590"],["Guam","gu","1"],["Guatemala","gt","502"],["Guernsey","gg","44"],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44"],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39"],["Jamaica","jm","1"],["Japan (日本)","jp","81"],["Jersey","je","44"],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7"],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262"],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1"],["Morocco (‫المغرب‬‎)","ma","212"],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1"],["Norway (Norge)","no","47"],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1"],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262"],["Romania (România)","ro","40"],["Russia (Россия)","ru","7"],["Rwanda","rw","250"],["Saint Barthélemy","bl","590"],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1"],["Saint Lucia","lc","1"],["Saint Martin (Saint-Martin (partie française))","mf","590"],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1"],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47"],["Swaziland","sz","268"],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1"],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1"],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1"],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44"],["United States","us","1"],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39"],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212"],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358"]],Di=dr(),Ni=function(){function e(t){var n=this;u(this,e),h(this,"needRender",!1),h(this,"buttonElement",null),h(this,"isLoading",!1),h(this,"isDisabled",!1),h(this,"isVisible",!1),h(this,"disabledMessage",""),h(this,"setLoading",(function(e){n.logger.info("setLoading",{data:{bool:e}}),n.isLoading=e;var t=n.buttonElement;e?null==t||t.classList.add(Ei.BUTTON_LOADING):null==t||t.classList.remove(Ei.BUTTON_LOADING)})),h(this,"setDisabled",(function(e,t){if(n.logger.info("setDisabled",{data:{value:e,options:t}}),n.needRender){n.isDisabled=e,n.disabledMessage=Di("products.product_list.select_product_all_options"),null!=t&&t.message&&(n.disabledMessage=t.message);var r=n.buttonElement;e?null==r||r.classList.add(Ei.BUTTON_DISABLED):null==r||r.classList.remove(Ei.BUTTON_DISABLED)}})),h(this,"setVisible",(function(e){if(n.logger.info("setVisible",{data:{value:e}}),n.needRender){n.isVisible=e;var t=n.buttonElement;e?null==t||t.classList.remove(Ei.BUTTON_HIDE):null==t||t.classList.add(Ei.BUTTON_HIDE)}})),h(this,"renderedList",[]),this.config=t,this.container=document.getElementById(t.domId),this.logger=this.config.props.logger}return p(e,[{key:"getRenderedList",value:function(){return this.isVisible?this.renderedList:[]}}]),e}();!function(e){e.ProductDetail="productDetail",e.Cart="cart",e.Checkout="checkout"}(Pi||(Pi={})),function(e){e.Normal="normalButton",e.Express="expressCheckoutButton",e.Fast="fastCheckoutButton"}(xi||(xi={})),function(e){e.BUY_NOW="BUY_NOW",e.MORE_OPTIONS="MORE_OPTIONS",e.CHECKOUT="CHECKOUT",e.PAY_PAL="PAY_PAL",e.APPLE_PAY="APPLE_PAY",e.GOOGLE_PAY="GOOGLE_PAY",e.SHOP_BY_FAST_CHECKOUT="SHOP_BY_FAST_CHECKOUT"}(Ii||(Ii={}));var Bi,Mi=(h(Si={},xe.Paypal,Ii.PAY_PAL),h(Si,xe.ApplePay,Ii.APPLE_PAY),h(Si,xe.GooglePay,Ii.GOOGLE_PAY),Si);!function(e){e.ButtonClick="buttonClick",e.ModalOpen="modalOpen"}(Bi||(Bi={}));var Ri,Fi=[Ii.PAY_PAL,Ii.APPLE_PAY,Ii.GOOGLE_PAY];function Ui(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ui(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ui(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}!function(e){e.Column="column",e.Row="row",e.BuyNowRow="buyNowRow",e.Checkout="checkout"}(Ri||(Ri={}));var qi,Gi,Yi,Vi=function(e){return e.buttonTypeDataList.map((function(e){return e.buttonNameDataList})).reduce((function(e,t){return e.concat.apply(e,a(t))}),[]).map((function(e){return e.buttonName}))},zi=function(e){return e.isSystem},Wi=function(e){return e.className.includes(Ei.BUY_NOW)?Ii.BUY_NOW:e.className.includes(Ei.MORE_OPTIONS)?Ii.MORE_OPTIONS:e.className.includes(Ei.PAY_PAL)?Ii.PAY_PAL:e.className.includes(Ei.GOOGLE_PAY)?Ii.GOOGLE_PAY:e.className.includes(Ei.APPLE_PAY)?Ii.APPLE_PAY:e.className.includes(Ei.SHOP_BY_FAST_CHECKOUT)?Ii.SHOP_BY_FAST_CHECKOUT:void 0},Ki={exports:{}};!function(e){function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==y?y:"undefined"!=typeof self?self:{},o=1/0,a=17976931348623157e292,i=NaN,c="[object Symbol]",s=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,f=/^0o[0-7]+$/i,p=parseInt,h="object"==l(r)&&r&&r.Object===Object&&r,v="object"==("undefined"==typeof self?"undefined":l(self))&&self&&self.Object===Object&&self,m=h||v||Function("return this")(),g=Object.prototype.toString,b=m.Symbol,w=Math.min,_=b?b.prototype:void 0,O=_?_.toString:void 0;function C(e){var t=l(e);return!!e&&("object"==t||"function"==t)}function k(e){return"symbol"==l(e)||function(e){return!!e&&"object"==l(e)}(e)&&g.call(e)==c}function S(e){if("number"==typeof e)return e;if(k(e))return i;if(C(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=C(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var n=d.test(e);return n||f.test(e)?p(e.slice(2),n?2:8):u.test(e)?i:+e}function P(e){return null==e?"":function(e){if("string"==typeof e)return e;if(k(e))return O?O.call(e):"";var t=e+"";return"0"==t&&1/e==-o?"-0":t}(e)}var x,I,E,T,j,A=function(e){var t=Math[e];return function(e,n){if(e=S(e),n=w(function(e){var t=function(e){return e?(e=S(e))===o||e===-o?(e<0?-1:1)*a:e==e?e:0:0===e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}(n),292)){var r=(P(e)+"e").split("e");return+((r=(P(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}("round"),L="CNY",D=2,N={amount:{value:"amount",decimalSymbol:".",groupSymbol:",",format:"amount"},amount_no_decimals:{value:"amount_no_decimals",decimalSymbol:"",groupSymbol:",",format:"amount_no_decimals"},amount_with_comma_separator:{value:"amount_with_comma_separator",decimalSymbol:",",groupSymbol:".",format:"amount_with_comma_separator"},amount_no_decimals_with_comma_separator:{value:"amount_no_decimals_with_comma_separator",decimalSymbol:"",groupSymbol:".",format:"amount_no_decimals_with_comma_separator"},amount_with_apostrophe_separator:{value:"amount_with_apostrophe_separator",decimalSymbol:".",groupSymbol:"'",format:"amount_with_apostrophe_separator"},amount_no_decimals_with_space_separator:{value:"amount_no_decimals_with_space_separator",decimalSymbol:"",groupSymbol:" ",format:"amount_no_decimals_with_space_separator"},amount_with_space_separator:{value:"amount_with_space_separator",decimalSymbol:",",groupSymbol:" ",format:"amount_with_space_separator"}},B=/.*\{\{(.*)\}\}/,M=/(\{\{.*\}\})/,R="amount";!function(e){e.PREFIX="prefix",e.SUFFIX="suffix"}(x||(x={}));var F=Object.entries(N).map((function(e){return t(e,2)[1].value})),U=new Map,H=new Map,q=new Map,G=new Map,Y=new Map,V=new Map,z=new Map,W=new Map,K=new Map,X=function(e){T=e},J=function(){return T},$=function(){return j},Z=function(e){return F.includes(e||"")},Q=function(e){var t=e.match(B);if(t&&t.length){var n=(t[1]||"").trim();return Z(n)?N[n]:null}return null},ee=function(e,t,n){var r=n?V:Y,o=Q(t),a=r.get(e),i=a&&a.format;return o||(Z(i)?N[i]:N[R])},te=function(e){return Q(e)||N[R]},ne=function(e,t,n){var r,o,a=e.match(B);return null!=a&&a.length&&F.includes((null==a||null===(r=a[1])||void 0===r?void 0:r.trim())||"")?e:(null===(o=(n?V:Y).get(t))||void 0===o?void 0:o.origin)||"{{amount}}"},re=function(e,t){var n=te(t).format;Y.set(e,{format:n,origin:t})},oe=function(e,t){var n=te(t).format;V.set(e,{format:n,origin:t})},ae=function(e,t){var n=ee(e,t,!1),r=n.format,o=n.decimalSymbol,a=n.groupSymbol;W.set(e,o),K.set(e,a),q.set(e,{format:r,origin:ne(t,e,!1)})},ie=function(e,t){var n=ee(e,t,!0),r=n.format,o=n.decimalSymbol,a=n.groupSymbol;W.set(e,o),K.set(e,a),G.set(e,{format:r,origin:ne(t,e,!0)})},ce=function(e){var t=function(e){return $().find((function(t){return t.currencyCode===e}))}(e);if(t){var n=t.messageWithoutDefaultCurrency,r=t.messageWithCurrency,o=t.messageWithoutCurrency,a=t.messageWithDefaultCurrency,i=t.currencyCode,c=t.rate,s=void 0===c?D:c,u=t.currencySymbol;(function(e,t){U.set(e,t)})(i,s),function(e,t){H.set(e,t)}(i,u),function(e,t){t?(null==t?void 0:t.replace(/^\s+/,"").indexOf("{{"))>0?z.set(e,x.PREFIX):z.set(e,x.SUFFIX):window[window.__sl_console__?"__sl_console__":"console"].error("".concat(e,"无对应的messageWithoutDefaultCurrency配置"))}(i,n),re(i,n),oe(i,a),ae(i,o),ie(i,r)}else window[window.__sl_console__?"__sl_console__":"console"].error("获取".concat(e,"对应的货币配置失败"))},se=function(e,t,n){var r=N[t],o=r.groupSymbol,a=r.decimalSymbol,i=e<0,c=function(e,t,n){var r,o,a=A(e,t);return 0!==t&&n?(r=Math.floor(a),o="".concat(A(a-r,t)).replace(/^0?\.?/,"").padEnd(t,"0")):(r=A(a),o=""),{integerPart:r,fractionPart:o}}(i?-e:e,n,a),s=c.fractionPart,u=function(e,t){return"".concat(e||0).replace(/(\d)(?=(?:\d{3})+$)/g,"$2".concat(t))}(c.integerPart,o);return{integer:"".concat(i?"-":"").concat(u),fraction:s,groupSymbol:o,decimalSymbol:a}},ue=function(e,t){var n,r=(null==t?void 0:t.code)||I||L;q.get(r)||ce(r);var o=we(r),a=be(r),i=ye(r),c=ve(r),s=(q.get(r)||{}).format,u=Z(s)?s:R,l=se(e,u,D),d=l.integer,f=l.fraction,p=[],h=(null==d?void 0:d.split(o))||[];return h.forEach((function(e,t){p.push({type:"integer",value:e}),t!==h.length-1&&p.push({type:"group",value:o})})),p.push({type:"decimal",value:a}),p.push({type:"fraction",value:null!==(n=null==f?void 0:f.trim())&&void 0!==n?n:""}),"prefix"===c?p.unshift({type:"currency",value:i}):p.push({type:"currency",value:i}),p},le=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:L,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E,a=(arguments.length>3?arguments[3]:void 0)||J();return r===o?e:e*(null!==(t=a[o])&&void 0!==t?t:1)/(null!==(n=a[r])&&void 0!==n?n:1)},de=function(e,t,n){var r=t?G:q,o=t?pe:he,a=n||{},i=a.from,c=void 0===i?I:i,s=a.to,u=void 0===s?E:s,l=a.currencyRates;r.get(c)||ce(c),r.get(u)||ce(u);var d=l||J();return o(le(e,c,u,d),{code:u})},fe=function(e,t,n){var r,o=t?G:q,a=(null==n?void 0:n.code)||I||L;o.get(a)||ce(a);var i=o.get(a)||{},c=i.format,s=i.origin,u=null!==(r=null==n?void 0:n.digits)&&void 0!==r?r:D,l=Z(c)?c:R,d=se(e/Math.pow(10,u),l,u),f=d.integer,p=d.fraction,h=d.decimalSymbol;return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").replace(M,e)}(h&&u?"".concat(f).concat(h).concat(p):f,s)},pe=function(e,t){return fe(e,!0,t)},he=function(e,t){return fe(e,!1,t)},ye=function(e){var t;return q.get(e)||ce(e),null!==(t=H.get(e))&&void 0!==t?t:""},ve=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L;return q.get(e)||ce(e),z.get(e)},me=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D;return("number"!=typeof e?Number(e):e)/Math.pow(10,t)},ge=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D;return A(("number"!=typeof e?Number(e):e)*Math.pow(10,t),0)},be=function(e){var t;return q.get(e)||ce(e),null!==(t=W.get(e))&&void 0!==t?t:""},we=function(e){var t;return q.get(e)||ce(e),null!==(t=K.get(e))&&void 0!==t?t:""};e.convertCalc=le,e.convertFormat=function(e,t){return de(e,!0,t)},e.convertFormatWithoutCurrency=function(e,t){return de(e,!1,t)},e.covertCalc=le,e.defaultCurrency=L,e.defaultCurrencyDigit=D,e.defaultPresentDigit=2,e.format=pe,e.formatCurrency=function(e){return me(e,D)},e.formatMoneyWithoutCurrency=function(e,t){var n=q,r=(null==t?void 0:t.code)||I||L;n.get(r)||ce(r);var o=(n.get(r)||{}).format,a=Z(o)?o:R,i=D,c=se(e/Math.pow(10,i),a,i),s=c.integer,u=c.fraction,l=c.decimalSymbol;return l&&i?"".concat(s).concat(l).concat(u):s},e.formatNumber=me,e.formatPercent=function(e){return me(e,2)},e.formatWithoutCurrency=he,e.getConvertPrice=function(e,t){var n=null!=t?t:{},r=n.from,o=n.code,a=n.to,i=n.currencyRates,c=r||I||L;q.get(c)||ce(c);var s=a||o||E;q.get(s)||ce(s);var u=me(e),l=le(u,c,s,i||T),d=ue(l,{code:s}),f={group:"",integer:"",decimal:"",fraction:"",symbolOrder:"",currencySymbol:""},p=ve(s);return p&&(f.symbolOrder=p),d.forEach((function(e){var t=e.value;"currency"===e.type&&(f.currencySymbol=t),"integer"===e.type&&(f.integer?f.integer="".concat(f.integer).concat(f.group).concat(t):f.integer=t),"group"===e.type&&(f.group=t),"decimal"===e.type&&(f.decimal=t),"fraction"===e.type&&(f.fraction=t)})),f},e.getCurrencyConfig=$,e.getCurrencyRates=J,e.getDecimalSymbolByCode=be,e.getDefaultToCurrency=function(){return E},e.getDigitsByCode=function(e){return q.get(e)||ce(e),U.get(e)},e.getFormatParts=ue,e.getGroupSymbolByCode=we,e.getStoreCurrency=function(){return I},e.getSymbolByCode=ye,e.getSymbolOrderByCode=ve,e.parseCustomFormat=ee,e.parseCustomFormatWithCurrency=ie,e.parseCustomFormatWithoutCurrency=ae,e.parseDefaultFormat=te,e.parseDefaultFormatWithCurrency=oe,e.parseDefaultFormatWithoutCurrency=re,e.setCurrencyConfig=function(e){var t={};(j=e).forEach((function(e){t[e.currencyCode]=e.exchangeRate})),X(t),"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)&&(U.clear(),H.clear(),q.clear(),G.clear(),Y.clear(),V.clear(),z.clear(),W.clear(),K.clear())},e.setCurrencyRates=X,e.setDefaultToCurrency=function(e){E=e},e.setStoreCurrency=function(e){I=e},e.unformatCurrency=function(e){return ge(e,D)},e.unformatNumber=ge,e.unformatPercent=function(e){return ge(e,2)},Object.defineProperty(e,"__esModule",{value:!0})}(Ki.exports),function(e){e.PayButtonView="View",e.PayButtonClick="",e.InitiateCheckout="InitiateCheckout",e.AddCustomerInfo="AddCustomerInfo",e.AddShippingInfo="AddShippingInfo",e.AddPaymentInfo="AddPaymentInfo",e.FastCheckout="FastCheckout"}(Yi||(Yi={}));var Xi=(h(qi={FastCheckout:158},Pi.ProductDetail,159),h(qi,Pi.Cart,162),h(qi,Pi.Checkout,163),qi),Ji=(h(Gi={Other:-999},Ii.BUY_NOW,102),h(Gi,Ii.MORE_OPTIONS,102),h(Gi,Ii.PAY_PAL,103),h(Gi,Ii.APPLE_PAY,180),h(Gi,Ii.GOOGLE_PAY,181),h(Gi,Ii.SHOP_BY_FAST_CHECKOUT,182),Gi);function $i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$i(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Qi,ec=function(e){window.HdSdk&&window.HdSdk.shopTracker&&window.HdSdk.shopTracker.collect(e)},tc={reportConversionEvent:function(e,t){var n=t.currency,r=t.orderAmount,o=t.productInfos,a=t.shipping_method,i=this.generateReportData(e,{currency:n,orderAmount:r,productInfos:o,shipping_method:a});ec(i)},reportAddPaymentInfo:function(e){var t=e.currency,n=e.orderAmount,r=e.productInfos,o=e.payment_method,a=e.coupon_code,i=e.shipping_method,c=e.basicInfo,s=Zi(Zi({},this.generateReportData(Yi.AddPaymentInfo,{currency:t,orderAmount:n,productInfos:r,basicInfo:c,shipping_method:i})),{},{payment_method:o,coupon_code:a});ec(s)},generateReportData:function(e,t){if(e){var n=this.generateProductParams(e,{productInfos:t.productInfos||[]}),r=t.orderAmount||0,o=Zi(Zi({page:-999,component:Ji.Other,module:Xi.FastCheckout,action_type:-999,billing_address_status:1,event_name:e,value:Ki.exports.formatNumber(r).toString(),currency:t.currency,referral_code:""},n),{},{payment_method:t.payment_method,coupon_code:"",shipping_method:t.shipping_method});if(e===Yi.AddPaymentInfo){var a=sessionStorage.getItem("tradeAttributeInfo");if(a){var i=(JSON.parse(a)||{}).referralCode;o.referral_code=i?i.value:void 0}}else delete o.referral_code,delete o.payment_method,delete o.coupon_code;return e!==Yi.AddPaymentInfo&&delete o.billing_address_status,e!==Yi.AddShippingInfo&&delete o.shipping_method,o}},generateProductParams:function(e,t){var n=t.productInfos,r=new Set,o=[],i=0;return n.forEach((function(e){i+=e.productNum||0,o.push(e.productSku||""),r.add(e.productSeq||"")})),{content_ids:a(r.values()).join(","),variantion_id:o.join(","),quantity:i.toString()}},reportPayButtonView:function(e,t){var n={event_name:Yi.PayButtonView,page:"",module:Xi[t],component:Ji[e],action_type:101};ec(n)},reportPayButtonClick:function(e,t){ec({event_name:"",page:"",module:Xi[t],component:Ji[e],action_type:102})},reportFastCheckout:function(e){var t={event_name:Yi.FastCheckout,component:Ji[e],fastcheckout_type:e};ec(t)}},nc=new Uint8Array(16);function rc(){if(!Qi&&!(Qi="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qi(nc)}for(var oc=[],ac=0;ac<256;++ac)oc.push((ac+256).toString(16).slice(1));var ic={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function cc(e,t,n){if(ic.randomUUID&&!t&&!e)return ic.randomUUID();var r=(e=e||{}).random||(e.rng||rc)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(oc[e[t+0]]+oc[e[t+1]]+oc[e[t+2]]+oc[e[t+3]]+"-"+oc[e[t+4]]+oc[e[t+5]]+"-"+oc[e[t+6]]+oc[e[t+7]]+"-"+oc[e[t+8]]+oc[e[t+9]]+"-"+oc[e[t+10]]+oc[e[t+11]]+oc[e[t+12]]+oc[e[t+13]]+oc[e[t+14]]+oc[e[t+15]]).toLowerCase()}(r)}var sc=function(){return Number(Math.random().toString().slice(2)+Date.now()).toString(36)},uc=function(e){var t=document.cookie.split("; "),n={};return t.forEach((function(e){var t=i(e.split("="),2),r=t[0],o=t[1];r&&(n[r]=o||"")})),n[e]||""},lc=function(){return"".concat(Date.now(),"_").concat(cc().replace(/-/g,""))},dc=function(e){return null===e.offsetParent},fc=function(e){var t=document.createElement("style");return t.innerHTML=e.replace(/\/\*(.*?)\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;,])\s*/g,"$2"),{style:t,cssInsertBefore:function(e){var n;return null===(n=e.parentNode)||void 0===n?void 0:n.insertBefore(t,e)}}},pc=function(e,t){return!t||!!Array.isArray(t)&&t.includes(e)};function hc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hc(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var vc,mc,gc,bc=dr(),wc=function(e){return'<button type="button" class="btn btn-primary button '.concat(Ei.COMMON_ITEM," ").concat(Ei.BUY_NOW," ").concat(null!=e?e:"",'" type="button">\n    <span class="').concat(Ei.BUY_NOW,'-text">').concat(bc("cart.cart.buy_now"),'</span><span class="loading-icon" /></button>')},_c=function(){return'\n  <div class="'.concat(Ei.MORE_OPTIONS," ").concat(Ei.BUTTON_HIDE," body3 fw-bold ").concat(ji,'">\n    ').concat(bc("products.product_details.more_payment_options"),"\n  </div>")},Oc=function(e){Oi(n,Ni);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ki(e);if(t){var o=ki(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ci(this,n)}}(n);function n(e){var r;u(this,n),h(wi(r=t.call(this,e)),"customHandleClick",null),h(wi(r),"render",function(){var e=s(C.mark((function e(t){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.logger.info("render"),r.needRender){e.next=3;break}return e.abrupt("return",[]);case 3:return n=r.insertDom(t),r.addListener(),r.renderedList=n,e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(wi(r),"setSubscription",(function(e){var t;if(r.logger.info("setSubscription",{data:{value:e}}),r.needRender){var n=null===(t=r.container)||void 0===t?void 0:t.querySelectorAll(".".concat(Ei.COMMON_ITEM_EXPRESS)),o=zi(r.config.paymentConfig);n&&o&&(Boolean(a(n).find((function(e){return!dc(e)})))?r.render(Ii.MORE_OPTIONS):r.render(Ii.BUY_NOW),r.setVisible(!0))}})),h(wi(r),"customButton",(function(e,t){var n,o;if(r.logger.log("customBuyNow",{data:yc({buttonName:e},t)}),r.needRender){var i,c,s,u,l,d,f=t.className,p=t.handle;if((e!==Ii.BUY_NOW||null!==(n=r.buttonElement)&&void 0!==n&&n.className.includes(Ei.BUY_NOW))&&(e!==Ii.MORE_OPTIONS||null!==(o=r.buttonElement)&&void 0!==o&&o.className.includes(Ei.MORE_OPTIONS)))f&&(null===(i=r.buttonElement)||void 0===i||(c=i.classList).add.apply(c,a(f.split(" ")))),p&&(null===(s=r.buttonElement)||void 0===s||s.classList.add(Ei.BUTTON_CUSTOM),null===(u=r.buttonElement)||void 0===u||u.removeEventListener("click",r.handleClick),r.customHandleClick&&(null===(l=r.buttonElement)||void 0===l||l.removeEventListener("click",r.customHandleClick)),r.customHandleClick=function(){return p(r.handleClick)},null===(d=r.buttonElement)||void 0===d||d.addEventListener("click",r.customHandleClick))}})),h(wi(r),"insertDom",(function(e){var t,n=r.config,o=n.paymentConfig,a=n.props,i=a.layout,c=a.extraBuyNowDomId,s=Vi(o),u=zi(o),l=s.includes(Ii.BUY_NOW);r.logger.info("insertDom data",{data:{isDynamic:u,hasBuyNow:l}});var d,f,p=wc(Ei.BUTTON_HIDE),h=_c();if(null===(t=r.container)||void 0===t||t.querySelectorAll(".".concat(Ei.BUY_NOW,", .").concat(Ei.MORE_OPTIONS)).forEach((function(e){return e.remove()})),e===Ii.BUY_NOW||!e&&l){if(i===Ri.BuyNowRow&&c){r.logger.info("BuyNowRow layout render buy now");var y=document.getElementById(c);y&&(y.innerHTML=p,r.buttonElement=(null==y?void 0:y.querySelector(".".concat(Ei.BUY_NOW)))||null)}else{var v,m;r.logger.info("normal render buy now"),null===(v=r.container)||void 0===v||v.insertAdjacentHTML("afterbegin",p),r.buttonElement=(null===(m=r.container)||void 0===m?void 0:m.querySelector(".".concat(Ei.BUY_NOW)))||null}return[Ii.BUY_NOW]}return e===Ii.MORE_OPTIONS||u?(r.logger.info("render more payment options"),null===(d=r.container)||void 0===d||d.insertAdjacentHTML("beforeend",h),r.buttonElement=(null===(f=r.container)||void 0===f?void 0:f.querySelector(".".concat(Ei.MORE_OPTIONS)))||null,[Ii.MORE_OPTIONS]):[]})),h(wi(r),"addListener",(function(){var e=wi(r).buttonElement;e&&(e.removeEventListener("click",r.handleClick),e.addEventListener("click",r.handleClick))})),h(wi(r),"handleClick",s(C.mark((function e(){var t,n,o,a,i,c,s,u,l;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.config,n=t.paymentConfig.buttonLocation,o=t.saveAbandonedOrder,a=t.props,i=a.isPreview,c=a.toast,tc.reportPayButtonClick(Ii.BUY_NOW,n),!i){e.next=6;break}return r.logger.info("预览模式,按钮点击触发toast提示"),c(bc("products.product_details.link_preview_does_not_support")),e.abrupt("return");case 6:if(!r.isDisabled){e.next=10;break}return r.logger.info("按钮禁用",{data:{isDisabled:r.isDisabled}}),c(r.disabledMessage),e.abrupt("return");case 10:if(!r.isLoading){e.next=13;break}return r.logger.info("按钮点击中",{data:{isLoading:r.isLoading}}),e.abrupt("return");case 13:return r.setLoading(!0),e.next=16,o(r.renderedList[0]||Ii.BUY_NOW);case 16:if(s=e.sent,u=s.canContinue,l=s.url,u){e.next=22;break}return r.setLoading(!1),e.abrupt("return");case 22:l&&(r.logger.info("jump to checkout",{data:l}),window.location.href=l);case 23:case"end":return e.stop()}}),e)})))),h(wi(r),"destroy",(function(){var e;null===(e=r.buttonElement)||void 0===e||e.removeEventListener("click",r.handleClick)}));var o=e.buttonTypes;return r.logger=r.config.props.logger.pipeOwner("NormalButton"),r.needRender=pc(xi.Normal,o),r}return p(n)}();function Cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cc(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}!function(e){e.checkout="checkout",e.orders="orders",e.payButton="payButton"}(vc||(vc={})),function(e){e.count="count",e.success="success",e.failed="failed"}(mc||(mc={})),function(e){e.third="third",e.jsErr="js",e.network="network"}(gc||(gc={}));var Sc,Pc,xc,Ic,Ec,Tc,jc,Ac,Lc,Dc=(jc=(null===(Sc=window)||void 0===Sc||null===(Pc=Sc.__ENV__)||void 0===Pc||null===(xc=Pc.TRADE__METRIC_REPORT_CONFIG)||void 0===xc?void 0:xc.rate)||0,Ac=(null===(Ic=window)||void 0===Ic||null===(Ec=Ic.__ENV__)||void 0===Ec||null===(Tc=Ec.TRADE__METRIC_REPORT_CONFIG)||void 0===Tc?void 0:Tc.version)||"",Lc={enable:!1,rate:jc,init:!1},function(){try{if(Lc.init)return Lc;if("number"==typeof jc&&"string"==typeof Ac){var e=1e4-jc;Lc.enable="v1"===Ac&&1e4*Math.random()>e}return Lc.init=!0,Lc}catch(e){return window[window.__sl_console__?"__sl_console__":"console"].warn("createMetricReportConfig error: ",e),Lc}});function Nc(e,t){return Bc.apply(this,arguments)}function Bc(){return Bc=s(C.mark((function e(t,n){var r,o,i,c,s;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(r=Dc()).enable){e.next=11;break}if(o=[],i=Wc(t,xi.Express),c=Wc(t,xi.Fast),s=Kc(t,xi.Normal),[].concat(a(i),a(c),[s]).forEach((function(e){e&&o.push({owner:vc.payButton,subOwner:e.subOwner,diveSubOwner:e.channelCode,eventType:mc.count,rate:r.rate})})),!o.length){e.next=11;break}return e.next=11,u={logs:o},ct.post("/api/bff-web/trade/metric/report/batch",kc({},u));case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(0),n.warn("Metric Report Error: buttonRender",{data:{config:t,error:e.t0}});case 16:case"end":return e.stop()}var u}),e,null,[[0,13]])}))),Bc.apply(this,arguments)}function Mc(e,t){return Rc.apply(this,arguments)}function Rc(){return Rc=s(C.mark((function e(t,n){var r,o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,r=Kc(t,xi.Normal),o=Dc(),!r||!o.enable){e.next=6;break}return e.next=6,Vc({owner:vc.payButton,subOwner:r.subOwner,diveSubOwner:r.channelCode,eventType:mc.count,rate:o.rate});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),n.warn("Metric Report Error: patchBuyNowRender",{data:{config:t,error:e.t0}});case 11:case"end":return e.stop()}}),e,null,[[0,8]])}))),Rc.apply(this,arguments)}function Fc(e,t,n){return Uc.apply(this,arguments)}function Uc(){return Uc=s(C.mark((function e(t,n,r){var o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,0!==(o=Dc()).rate){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Vc({owner:vc.payButton,eventType:mc.failed,rate:o.rate,subOwner:t.subOwner,diveSubOwner:t.channelCode,errorType:gc.jsErr,errorSource:null==r?void 0:r.stack,errorReason:null==r?void 0:r.message});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),n.warn("Metric Report Error: buttonRenderJsError",{data:{config:t,error:e.t0}});case 11:case"end":return e.stop()}}),e,null,[[0,8]])}))),Uc.apply(this,arguments)}function Hc(e,t,n){return qc.apply(this,arguments)}function qc(){return qc=s(C.mark((function e(t,n,r){var o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,0!==(o=Dc()).rate){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Vc({owner:vc.payButton,eventType:mc.failed,rate:o.rate,subOwner:t.methodCode,diveSubOwner:t.channelCode,errorType:gc.third,errorSource:t.channelCode,errorReason:null==r?void 0:r.message});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),n.warn("Metric Report Error: buttonRenderThirdError",{data:{config:t,error:e.t0}});case 11:case"end":return e.stop()}}),e,null,[[0,8]])}))),qc.apply(this,arguments)}function Gc(e,t,n,r){return Yc.apply(this,arguments)}function Yc(){return Yc=s(C.mark((function e(t,n,r,o){var a;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(a=Kc(n,t))){e.next=5;break}return e.next=5,Fc(a,r,o);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),r.warn("Metric Report Error: ".concat(t," RenderJsError"),{data:{config:n,error:e.t0}});case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),Yc.apply(this,arguments)}function Vc(e){return ct.post("/api/bff-web/trade/metric/report",kc({},e))}function zc(e){switch(e){case Ii.PAY_PAL:return xe.Paypal;case Ii.GOOGLE_PAY:return xe.GooglePay;case Ii.APPLE_PAY:return xe.ApplePay;case Ii.BUY_NOW:return"BuyNow";case Ii.MORE_OPTIONS:return"MoreOptions";case Ii.CHECKOUT:return"Checkout";case Ii.SHOP_BY_FAST_CHECKOUT:return"ShopByFastCheckout";default:return e}}function Wc(e,t){var n;if(!pc(t,null==e?void 0:e.buttonTypes))return[];var r=e.paymentConfig.buttonTypeDataList.find((function(e){return e.buttonType===t}));return(null==r||null===(n=r.buttonNameDataList)||void 0===n?void 0:n.map((function(e){var t,n,r=zc(e.buttonName);return{channelCode:(null===(t=e.buttonConfigData)||void 0===t?void 0:t.channelCode)||r,methodCode:(null===(n=e.buttonConfigData)||void 0===n?void 0:n.methodCode)||r,buttonName:e.buttonName,subOwner:r}})))||[]}function Kc(e,t){var n=function(e){var t=zc(e);return{channelCode:t,methodCode:t,buttonName:e,subOwner:t}};if(t==xi.Normal){if(Wc(e,t).find((function(e){return e.buttonName===Ii.BUY_NOW})))return n(Ii.BUY_NOW);if(zi(e.paymentConfig))return n(Ii.MORE_OPTIONS)}return t===xi.Fast?n(Ii.SHOP_BY_FAST_CHECKOUT):null}function Xc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Jc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jc(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw a}}}}function Jc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$c(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Qc=function(){function e(t){var n,r,o=this;u(this,e),h(this,"renderList",[]),h(this,"checkAllButtonsInitFail",(function(){var e=0===o.renderList.filter((function(e){return e.instance.isVisible})).length;o.logger.info("checkAllButtonsInitFail",{data:{isAllButtonInitFail:e}}),e&&ft(o.configData.onAllButtonsInitFail)&&o.configData.onAllButtonsInitFail()})),this.configData=t,ae.set(null===(n=(r=this.configData).loggerFn)||void 0===n?void 0:n.call(r)),this.logger=ae.get().pipeOwner("SmartPayment")}var t,n,r;return p(e,[{key:"handleElement",value:function(){!function(e){var t=e.styleOptions,n=e.domId;(function(e){var t;e.styleOptions;var n=e.domId,r=document.getElementById(n),o=document.getElementById(Pt);if(r&&!o){var a=document.createElement("style");a.setAttribute("id",Pt);var i="\n    .".concat(Ct," {\n      display: none !important;\n    }\n    .").concat(kt,"::before {\n      width: 0 !important;\n    }\n    .").concat(kt,"::after {\n      content: '';\n      display: block;\n      z-index: 100;\n      width: 100% !important;\n      height: 100% !important;\n      border-radius: 4px;\n      cursor: not-allowed;\n      position: absolute;\n      top: 0;\n      left: 0 !important;\n      background: transparent !important;\n    }\n    .").concat(kt," {\n      opacity: 0.3;\n    }\n\n    @keyframes rotate {\n      from {\n        transform: rotate(0deg);\n      }\n      to {\n        transform: rotate(359deg);\n      }\n    }\n\n    .").concat(St,"::before {\n      content: '';\n      display: inline-block;\n      background-color: black;\n      width: 100%;\n      height: 100%;\n      border-radius: 0px;\n    }\n\n    .").concat(St,"::after {\n      content: '';\n      display: inline-block;\n      position: absolute;\n      border: 2px solid white;\n      top: calc(50% - 8px);\n      left: calc(50% - 8px);\n      width: 16px;\n      height: 16px;\n      border-radius: 16px;\n      clip-path: polygon(0% 0%, 100% 0%, 100% 70%, 0% 70%);\n      animation: rotate 1s linear infinite;\n    }\n  ");a.innerHTML="".concat(i),null===(t=r.parentElement)||void 0===t||t.insertBefore(a,r)}})({styleOptions:t,domId:n}),function(e){var t,n=e.styleOptions,r=e.domId,o=document.getElementById(r);if(o){var a=document.createElement("style"),i="\n    #".concat(r," .express-payment-button-common-item {\n      min-height: ").concat((null==n?void 0:n.height)||48,"px;\n      width: 100%;\n    }\n  ");void 0===(null==n?void 0:n["border-radius"])&&(i+="\n      #".concat(r," .").concat(St,"::before {\n        border-radius: 4px;\n      }\n\n      [data-button_style=square] #").concat(r," .").concat(St,"::before {\n        border-radius: 0;\n      }\n\n      [data-button_style=rounded] #").concat(r," .").concat(St,"::before {\n        border-radius: 9999px;\n      }\n    ")),a.innerHTML="".concat(i),null===(t=o.parentElement)||void 0===t||t.insertBefore(a,o)}}({styleOptions:t,domId:n})}({styleOptions:this.configData.props.styleOptions,domId:this.configData.props.domId})}},{key:"renderPaymentItem",value:(r=s(C.mark((function e(t){var n,r,o,a,i,c,s,u,l=this;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=oi(Zc(Zc({channelCode:t.channelCode,paymentInfo:t},this.configData),{},{onError:function(e,n,r){ft(l.configData.onError)&&l.configData.onError(e,n,Zc(Zc({},r),{},{channelCode:t.channelCode,methodCode:t.methodCode})),n===ke.Init&&Hc(t,l.logger,e)}}))){e.next=6;break}return null==(r=document.getElementById(t.currentDomId))||r.classList.add(Ct),e.abrupt("return");case 6:return o=n.validate(),a=o.result,i=o.errorTip,a||this.logger.error("render error ".concat(i)),c=n.getConfig(),s=n.component,u=new s(Zc({},c)),e.next=13,u.render();case 13:this.renderList.push({channelCode:c.channelCode,params:c,instance:u}),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(0),this.logger.error("render error",{error:e.t0});case 19:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(e){return r.apply(this,arguments)})},{key:"render",value:(n=s(C.mark((function e(){var t,n,r,o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.logger.log("render",{data:{config:this.configData}}),this.configData.payments&&Array.isArray(this.configData.payments)||this.logger.error("render error 传值有误[payments]"),e.next=5,fr(this.configData.language||"en");case 5:this.handleElement(),t=this.configData.payments,n=Xc(t),e.prev=8,n.s();case 10:if((r=n.n()).done){e.next=16;break}return o=r.value,e.next=14,this.renderPaymentItem(o);case 14:e.next=10;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(8),n.e(e.t0);case 21:return e.prev=21,n.f(),e.finish(21);case 24:this.checkAllButtonsInitFail(),e.next=30;break;case 27:e.prev=27,e.t1=e.catch(0),this.logger.error("render error",{error:e.t1});case 30:case"end":return e.stop()}}),e,this,[[0,27],[8,18,21,24]])}))),function(){return n.apply(this,arguments)})},{key:"rerender",value:(t=s(C.mark((function e(t){var n,r,o,a,i,c,s,u,l,d,f,p=this;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,n=this.renderList,this.logger.info("rerender start",{action:ke.ReRender,data:{renderList:n.map((function(e){return e.channelCode}))}}),r=Xc(n),e.prev=4,r.s();case 6:if((o=r.n()).done){e.next=14;break}if(a=o.value,!(i=a.instance).loadResourceFail){e.next=12;break}return e.next=12,i.render();case 12:e.next=6;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:c=Xc(t),e.prev=23,u=C.mark((function e(){var t,r,o,a,i,c;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.value,r=n.find((function(e){var n,r=(null===(n=e.instance.config)||void 0===n?void 0:n.paymentInfo)||{},o=r.channelCode,a=r.methodCode;return o===t.channelCode&&a===t.methodCode}))){e.next=6;break}return e.next=5,p.renderPaymentItem(t);case 5:return e.abrupt("return","continue");case 6:r.instance.initSuccess&&!r.instance.isVisible&&(null===(o=(a=r.instance).showButton)||void 0===o||o.call(a),null===(i=(c=p.configData).afterInit)||void 0===i||i.call(c));case 7:case"end":return e.stop()}}),e)})),c.s();case 26:if((s=c.n()).done){e.next=33;break}return e.delegateYield(u(),"t1",28);case 28:if("continue"!==e.t1){e.next=31;break}return e.abrupt("continue",31);case 31:e.next=26;break;case 33:e.next=38;break;case 35:e.prev=35,e.t2=e.catch(23),c.e(e.t2);case 38:return e.prev=38,c.f(),e.finish(38);case 41:l=Xc(n),e.prev=42,f=C.mark((function e(){var n,r,o,a;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=d.value,r=t.find((function(e){var t,r=(null===(t=n.instance.config)||void 0===t?void 0:t.paymentInfo)||{},o=r.channelCode,a=r.methodCode;return o===e.channelCode&&a===e.methodCode})),r||null===(o=(a=n.instance).hideButton)||void 0===o||o.call(a);case 3:case"end":return e.stop()}}),e)})),l.s();case 45:if((d=l.n()).done){e.next=49;break}return e.delegateYield(f(),"t3",47);case 47:e.next=45;break;case 49:e.next=54;break;case 51:e.prev=51,e.t4=e.catch(42),l.e(e.t4);case 54:return e.prev=54,l.f(),e.finish(54);case 57:this.checkAllButtonsInitFail(),e.next=63;break;case 60:e.prev=60,e.t5=e.catch(0),this.logger.error("rerender error",{action:ke.ReRender,error:e.t5});case 63:case"end":return e.stop()}}),e,this,[[0,60],[4,16,19,22],[23,35,38,41],[42,51,54,57]])}))),function(e){return t.apply(this,arguments)})},{key:"getPaymentMethods",value:function(){return this.renderList.map((function(e){return{channelCode:e.channelCode,params:e.params}}))}},{key:"setDisabled",value:function(e){try{this.logger.info("setDisabled start",{data:{disabled:e}}),this.renderList.forEach((function(t){t.instance.setDisabled(e)}))}catch(e){this.logger.error("setDisabled error",{error:e})}}},{key:"destroy",value:function(){this.renderList.forEach((function(e){var t;null===(t=e.instance)||void 0===t||t.destroy()}))}}]),e}();Qc=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":l(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}([_t],Qc);var es=Qc;Ki.exports.setCurrencyConfig(window.Shopline.currencyConfig.currencyDetailList);var ts=function(e){return String(Number(e)/100)};function ns(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ns(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ns(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var os=function(e,t){return t.isSubscription?"".concat(e.channelCode,"_").concat(e.methodCode,"_").concat(t.uniqueId,"_subscription"):"".concat(e.channelCode,"_").concat(e.methodCode,"_").concat(t.uniqueId)},as=function(e){var t;return(null===(t=e.buttonTypeDataList.find((function(e){return e.buttonType===xi.Express})))||void 0===t?void 0:t.buttonNameDataList.map((function(e){return e.buttonConfigData})))||[]},is=function(e,t){return e.map((function(e){return"".concat(e.channelCode,"_").concat(e.methodCode)})).sort().join(",")===t.map((function(e){return"".concat(e.channelCode,"_").concat(e.methodCode)})).sort().join(",")},cs=function(e){if(e.redirect&&e.fullUri){var t="".concat(window.location.protocol,"//").concat(window.location.host).concat(e.fullUri);return window.location.href=t,!0}return!1},ss=function(e,t){var n=t.expressCheckoutChannelInfo,r=rs({},e);if(gr(n)||wr(n)||br(n)){if(n.methodCode===xe.GooglePay){var o=r.transactionInfo,a=r.newTransactionInfo,i=(o||a).currencyCode,c=function(e){var t=rs({},e);return t.totalPrice=ts(t.totalPrice||""),Array.isArray(t.displayItems)&&t.displayItems.length&&(t.displayItems=t.displayItems.map((function(e){return rs(rs({},e),{},{price:ts(e.price||"")})}))),t},s=function(e){var t=rs({},e);return Array.isArray(t.shippingOptions)&&t.shippingOptions.length&&(t.shippingOptions=t.shippingOptions.map((function(e){return rs(rs({},e),{},{description:"".concat(i,": ").concat(Ki.exports.formatWithoutCurrency(Number(e.description),{code:i}))})}))),t};return r.newTransactionInfo&&(r.newTransactionInfo=c(r.newTransactionInfo)),r.transactionInfo&&(r.transactionInfo=c(r.transactionInfo)),r.newShippingOptionParameters&&(r.newShippingOptionParameters=s(r.newShippingOptionParameters)),r.shippingOptionParameters&&(r.shippingOptionParameters=s(r.shippingOptionParameters)),r}if(n.methodCode===xe.ApplePay){var u=r.paymentRequest,l=r.newTotal;return Array.isArray(r.newShippingMethods)&&(r.newShippingMethods=r.newShippingMethods.map((function(e){return rs(rs({},e),{},{amount:ts(e.amount)})}))),Array.isArray(null==u?void 0:u.shippingMethods)&&(u.shippingMethods=u.shippingMethods.map((function(e){return rs(rs({},e),{},{amount:ts(e.amount)})}))),l&&(l.amount=ts(l.amount)),u.total&&(u.total.amount=ts(u.total.amount)),Array.isArray(r.newLineItems)&&(r.newLineItems=r.newLineItems.map((function(e){return rs(rs({},e),{},{amount:ts(e.amount)})}))),Array.isArray(u.lineItems)&&(u.lineItems=u.lineItems.map((function(e){return rs(rs({},e),{},{amount:ts(e.amount)})}))),r}}return r},us=function(e,t){var n=t.expressCheckoutChannelInfo;if(gr(n)||wr(n)||br(n))return function(e){if(e){var t=e.defaultSelectedOptionId,n=e.shippingOptions;if(t&&Array.isArray(n)){var r=n.find((function(e){return e.id===t}));if(r)return r.label}}}(e.newShippingOptionParameters||e.shippingOptionParameters);if(n.channelCode===Pe.StripeOther&&Array.isArray(e.shippingOptions)){var r=e.shippingOptions.find((function(e){return e.selected}));if(r)return r.label}},ls=function(e,t){var n,r=Mi[t.methodCode];if(r){var o={type:e,data:{buttonName:r,buttonLocation:t.buttonLocation}},a=new CustomEvent("PayButton::Update",{bubbles:!0,detail:o});document.dispatchEvent(a),null===(n=window.Shopline.event)||void 0===n||n.emit("PayButton::Update",o)}},ds=function(e){var t=Ii.PAY_PAL;switch(e){case xe.GooglePay:t=Ii.GOOGLE_PAY;break;case xe.ApplePay:t=Ii.APPLE_PAY;break;default:t=Ii.PAY_PAL}return t},fs=function(){var e={sid:"",createAt:Date.now()};try{var t=window.localStorage.getItem("tracker_sid");if(!t)return e;var n=JSON.parse(t).value;return{sid:n.sid,createAt:n.createAt}}catch(t){return window[window.__sl_console__?"__sl_console__":"console"].error("get session info error: ",t),e}},ps={},hs=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())}))},ys="%[a-f0-9]{2}",vs=new RegExp("("+ys+")|([^%]+?)","gi"),ms=new RegExp("("+ys+")+","gi");function gs(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],gs(n),gs(r))}function bs(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(vs)||[],n=1;n<t.length;n++)t=(e=gs(t,n).join("")).match(vs)||[];return e}}var ws,_s=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+l(e)+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=ms.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=bs(n[0]);r!==n[0]&&(t[n[0]]=r)}n=ms.exec(e)}t["%C2"]="�";for(var o=Object.keys(t),a=0;a<o.length;a++){var i=o[a];e=e.replace(new RegExp(i,"g"),t[i])}return e}(e)}},Os=function(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];var n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},Cs=function(e,t){for(var n={},r=Object.keys(e),o=Array.isArray(t),a=0;a<r.length;a++){var i=r[a],c=e[i];(o?-1!==t.indexOf(i):t(i,c,e))&&(n[i]=c)}return n};function ks(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(e){var t=hs,n=_s,r=Os,o=Cs,c=Symbol("encodeFragmentIdentifier");function s(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}function d(e,t){return t.decode?n(e):e}function f(e){return Array.isArray(e)?e.sort():"object"===l(e)?f(Object.keys(e)).sort((function(e,t){return Number(e)-Number(t)})).map((function(t){return e[t]})):e}function p(e){var t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function y(e){var t=(e=p(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function v(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);var n=function(e){var t;switch(e.arrayFormat){case"index":return function(e,n,r){t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return function(e,n,r){t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return function(e,n,r){t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return function(t,n,r){var o="string"==typeof n&&n.includes(e.arrayFormatSeparator),a="string"==typeof n&&!o&&d(n,e).includes(e.arrayFormatSeparator);n=a?d(n,e):n;var i=o||a?n.split(e.arrayFormatSeparator).map((function(t){return d(t,e)})):null===n?n:d(n,e);r[t]=i};case"bracket-separator":return function(t,n,r){var o=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),o){var a=null===n?[]:n.split(e.arrayFormatSeparator).map((function(t){return d(t,e)}));void 0!==r[t]?r[t]=[].concat(r[t],a):r[t]=a}else r[t]=n?d(n,e):n};default:return function(e,t,n){void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),o=Object.create(null);if("string"!=typeof e)return o;if(!(e=e.trim().replace(/^[?#&]/,"")))return o;var a,c=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ks(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ks(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw a}}}}(e.split("&"));try{for(c.s();!(a=c.n()).done;){var u=a.value;if(""!==u){var p=i(r(t.decode?u.replace(/\+/g," "):u,"="),2),h=p[0],y=p[1];y=void 0===y?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?y:d(y,t),n(d(h,t),y,o)}}}catch(e){c.e(e)}finally{c.f()}for(var m=0,g=Object.keys(o);m<g.length;m++){var b=g[m],w=o[b];if("object"===l(w)&&null!==w)for(var _=0,O=Object.keys(w);_<O.length;_++){var C=O[_];w[C]=v(w[C],t)}else o[b]=v(w,t)}return!1===t.sort?o:(!0===t.sort?Object.keys(o).sort():Object.keys(o).sort(t.sort)).reduce((function(e,t){var n=o[t];return Boolean(n)&&"object"===l(n)&&!Array.isArray(n)?e[t]=f(n):e[t]=n,e}),Object.create(null))}e.extract=y,e.parse=m,e.stringify=function(e,t){if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);for(var n=function(n){return t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n]},r=function(e){switch(e.arrayFormat){case"index":return function(t){return function(n,r){var o=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:[].concat(a(n),null===r?[[u(t,e),"[",o,"]"].join("")]:[[u(t,e),"[",u(o,e),"]=",u(r,e)].join("")])}};case"bracket":return function(t){return function(n,r){return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:[].concat(a(n),null===r?[[u(t,e),"[]"].join("")]:[[u(t,e),"[]=",u(r,e)].join("")])}};case"colon-list-separator":return function(t){return function(n,r){return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:[].concat(a(n),null===r?[[u(t,e),":list="].join("")]:[[u(t,e),":list=",u(r,e)].join("")])}};case"comma":case"separator":case"bracket-separator":var t="bracket-separator"===e.arrayFormat?"[]=":"=";return function(n){return function(r,o){return void 0===o||e.skipNull&&null===o||e.skipEmptyString&&""===o?r:(o=null===o?"":o,0===r.length?[[u(n,e),t,u(o,e)].join("")]:[[r,u(o,e)].join(e.arrayFormatSeparator)])}};default:return function(t){return function(n,r){return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:[].concat(a(n),null===r?[u(t,e)]:[[u(t,e),"=",u(r,e)].join("")])}}}}(t),o={},i=0,c=Object.keys(e);i<c.length;i++){var l=c[i];n(l)||(o[l]=e[l])}var d=Object.keys(o);return!1!==t.sort&&d.sort(t.sort),d.map((function(n){var o=e[n];return void 0===o?"":null===o?u(n,t):Array.isArray(o)?0===o.length&&"bracket-separator"===t.arrayFormat?u(n,t)+"[]":o.reduce(r(n),[]).join("&"):u(n,t)+"="+u(o,t)})).filter((function(e){return e.length>0})).join("&")},e.parseUrl=function(e,t){t=Object.assign({decode:!0},t);var n=i(r(e,"#"),2),o=n[0],a=n[1];return Object.assign({url:o.split("?")[0]||"",query:m(y(e),t)},t&&t.parseFragmentIdentifier&&a?{fragmentIdentifier:d(a,t)}:{})},e.stringifyUrl=function(t,n){n=Object.assign(h({encode:!0,strict:!0},c,!0),n);var r=p(t.url).split("?")[0]||"",o=e.extract(t.url),a=e.parse(o,{sort:!1}),i=Object.assign(a,t.query),s=e.stringify(i,n);s&&(s="?".concat(s));var l=function(e){var t="",n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(t.url);return t.fragmentIdentifier&&(l="#".concat(n[c]?u(t.fragmentIdentifier,n):t.fragmentIdentifier)),"".concat(r).concat(s).concat(l)},e.pick=function(t,n,r){r=Object.assign(h({parseFragmentIdentifier:!0},c,!1),r);var a=e.parseUrl(t,r),i=a.url,s=a.query,u=a.fragmentIdentifier;return e.stringifyUrl({url:i,query:o(s,n),fragmentIdentifier:u},r)},e.exclude=function(t,n,r){var o=Array.isArray(n)?function(e){return!n.includes(e)}:function(e,t){return!n(e,t)};return e.pick(t,o,r)}}(ps);var Ss,Ps=(h(ws={},Pi.ProductDetail,"detail"),h(ws,Pi.Cart,"cart"),h(ws,Pi.Checkout,void 0),ws);!function(e){e.InitFail="initFail",e.UpdateFail="updateFail",e.NoShippingOption="noShippingOption",e.InvalidDiscountCode="invalidDiscountCode",e.DiscountCodeExists="discountCodeExists",e.CreateFail="createFail",e.CreateTimeout="createTimeout"}(Ss||(Ss={}));var xs={maxCount:3,interval:1e3},Is=function(){var e=s(C.mark((function e(t){var n,r,o,a,i,c,s,u,l,d,f,p,h;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.products,o=t.associateCart,a=void 0!==o&&o,i=t.discountCodes,c=void 0===i?[]:i,s=t.useMemberPoint,u=t.notSupportSubscriptionCheck,l=t.otherInfo,d=window.Shopline.locale,f=uc("lang"),p={useRetry:!0,action:Ue.SaveAbandonOrder,retryOptions:xs},e.next=6,ct.post(Es,{products:r,associateCart:a,discountCodes:c,orderFrom:"web",languageInfo:{marketLanguage:d,displayLanguage:f},useMemberPoint:s,notSupportSubscriptionCheck:u,otherInfo:l},p);case 6:if(h=e.sent,null!==(n=h.data)&&void 0!==n&&n.success){e.next=9;break}throw h;case 9:return e.abrupt("return",h.data.data);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Es="/leproxy/api/trade/center/order/abandoned/save",Ts=function(){var e=s(C.mark((function e(t){var n,r,o,a,i;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.notSupportSubscriptionCheck,o=t.trackerCid,a={useRetry:!0,action:Ue.SaveAbandonOrder,retryOptions:xs},e.next=4,ct.post(js,{notSupportSubscriptionCheck:r,trackerCid:o},a);case 4:if(i=e.sent,null!==(n=i.data)&&void 0!==n&&n.success){e.next=7;break}throw i.data;case 7:return e.abrupt("return",i.data.data);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),js="/leproxy/api/trade/center/checkout/save/base-on-cart-cookie/return-data",As=function(){var e=s(C.mark((function e(t){var n,r,o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={useRetry:!0,action:Ue.ExpressFirstLoad,retryOptions:xs},t.expressCheckoutChannelInfo.methodCode===xe.GooglePay&&(r.useRetry=!1),e.next=4,ct.post("/leproxy/api/trade/center/express/checkout/first-load",t,r);case 4:if(o=e.sent,null!==(n=o.data)&&void 0!==n&&n.success){e.next=7;break}throw o.data;case 7:return e.abrupt("return",o.data.data);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ls=function(){var e=s(C.mark((function e(t){var n,r,o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={useRetry:!0,action:Ue.ExpressUpdateDetail,retryOptions:xs},e.next=3,ct.post("/leproxy/api/trade/center/express/checkout/detail",t,r);case 3:if(o=e.sent,null!==(n=o.data)&&void 0!==n&&n.success){e.next=6;break}throw o.data;case 6:return e.abrupt("return",o.data.data);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ds=function(){var e=s(C.mark((function e(t){var n,r;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ct.post("/leproxy/api/trade/center/express/checkout/create",t);case 2:if(r=e.sent,null!==(n=r.data)&&void 0!==n&&n.success){e.next=5;break}throw r.data;case 5:return e.abrupt("return",r.data.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function Ns(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bs(e){return ct.post("/api/bff-web/trade/metric/report/apiError",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ns(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ns(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e))}function Ms(e){return"object"===l(e)&&null!==e&&"statusCode"in e&&("number"==typeof e.statusCode||void 0===e.statusCode)}var Rs,Fs=function(e,t){var n=t.isNetworkError,r=t.isRateLimited,o="";n?o="Network error":r&&(o="Rate limited"),null==e||e.info("[PayButton non-bizerror: ".concat(o,"]"))};function Us(e,t){var n,r="",o="",a=0,i=new Error("non-error"),c=De.Other,s="",u=function(e){if(!Ms(e))return!1;if("object"!==l(e.data)||null===e.data)return!1;var t=e.data;return"code"in t&&("string"==typeof t.code||void 0===t.code)||"success"in t}(e),d=Ms(e);u?(r=(null===(n=e.data)||void 0===n?void 0:n.code)||"",a=e.statusCode,o="request biz error",i=new Error(o),s=(null==e?void 0:e.url)||""):d?(a=e.statusCode,o="request error",s=(null==e?void 0:e.url)||""):e instanceof Error?(o=e.message,i=e):(o=String(e),i=new Error(o));var f=!1,p=!1;(u||d)&&(f=void 0===a||a<=0,p=429===a||"0429"===r);var h=f||p;return h&&(c=f?De.NetworkUnstable:De.RateLimited,Fs(null==t?void 0:t.logger,{isNetworkError:f,isRateLimited:p}),s&&Bs({url:s,statusCode:a||999,errorCode:r||"",errorMessage:o})),{isServiceUnavailable:h,isRateLimited:p,isNetworkError:f,errorForLog:i,errorType:c,endpoint:s,message:o,httpStatusCode:a,bizErrorCode:r}}!function(e){e.DiscountCode="TCTD0122",e.NoShippingOption="TC_000000_B0019",e.IllegalAmount="TC_000000_B0046"}(Rs||(Rs={}));var Hs=["DISCOUNT_CODE_OR_GIFT_CARD_INVALID","DISCOUNT_CODE_INVALID","DISCOUNT_CODE_EXPIRED","DISCOUNT_CODE_USER_INVALID","DISCOUNT_CODE_USE_TIMES_LIMIT","DISCOUNT_CODE_NO_REACH","UN_MATCH_PAYMENT","UN_MATCH_LOGISTICS"],qs=["DISCOUNT_CODE_REPEAT"];function Gs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ys(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gs(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Vs=function(e){var t,n,r=e.eventId,o=e.channelCode,a=e.abandonedInfo,i=e.createOrderParams,c=e.logger,s=i.priceInfo,u=i.productInfos,l={eventId:r,value:null!==(t=null==s?void 0:s.originalSettleSumAmount)&&void 0!==t?t:0,paymentType:o,productPrice:null==s?void 0:s.productSumAmount,list:Ks(u),checkout:Xs({abandonedInfo:a,createOrderParams:i}),userInfo:Zs(i)};c.info("report event orderAddPaymentInfo",{data:l}),null===(n=window.Shopline.Analytics)||void 0===n||n.track({name:"orderAddPaymentInfo",payload:l})},zs=function(e){var t,n,r=e.abandonedInfo,o=e.createOrderParams,a=e.logger,i=o.priceInfo,c=o.productInfos,s=o.buyerInfo,u=o.receiverInfo,l={eventId:"addCustomerInfo".concat(lc()),value:(null==i?void 0:i.originalSettleSumAmount)||(null==i?void 0:i.orderAmount),currency:null===(t=o.marketInfo)||void 0===t?void 0:t.marketCurrencyCode,email:null==s?void 0:s.buyerEmail,phone:null==s?void 0:s.buyerPhone,country:null==u?void 0:u.receiverCountry,countryCode:null==u?void 0:u.receiverCountryCode,first_name:null==u?void 0:u.receiverFirstName,last_name:null==u?void 0:u.receiverLastName,address:null==u?void 0:u.receiverAddress,address2:null==u?void 0:u.receiverAddressAdd,state:null==u?void 0:u.receiverProvince,city:null==u?void 0:u.receiverCity,zip_code:null==u?void 0:u.receiverPostcode,receiver_phone:(null==u?void 0:u.receiverMobile)||"",items:Ks(c,!0),checkout:Xs({abandonedInfo:r,createOrderParams:o})};a.info("report event orderAddCustomerInfo",{data:l}),null===(n=window.Shopline.Analytics)||void 0===n||n.track({name:"orderAddCustomerInfo",payload:l})},Ws=function(e){var t,n,r=e.shipping_method,o=e.abandonedInfo,a=e.createOrderParams,i=e.logger,c=a.priceInfo,s=a.productInfos,u=a.marketInfo,l={checkout_option:r,checkout_step:3,value:null==c?void 0:c.originalSettleSumAmount,list:Ks(s),checkout:Xs({abandonedInfo:o,createOrderParams:a})};i.info("report event orderCompleteStep",{data:l}),null===(t=window.Shopline.Analytics)||void 0===t||t.track({name:"orderCompleteStep",payload:l,whitelistTransports:["GoogleAnalytics4"]});var d={eventId:"addShippingInfo".concat(lc()),value:(null==c?void 0:c.originalSettleSumAmount)||(null==c?void 0:c.orderAmount),currency:null==u?void 0:u.marketCurrencyCode,list:Ks(s,!0),checkout:Xs({abandonedInfo:o,createOrderParams:a})};i.info("report event AddShippingInfo",{data:d}),null===(n=window.Shopline.Analytics)||void 0===n||n.track({name:"AddShippingInfo",payload:d})},Ks=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(e||[]).map((function(e){var n,r,o;return Ys(Ys({},{lineItems_amount:$s(null==e?void 0:e.discountAllocations,"totalAllocatedAmount"),lineItemsDiscount_targetSelection:$s(null==e?void 0:e.discountAllocations,"targetSelection"),lineItemsDiscount_targetType:$s(null==e?void 0:e.discountAllocations,"targetType"),lineItemsDiscount_title:$s(null==e?void 0:e.discountAllocations,"title"),lineItemsDiscount_activityType:$s(null==e?void 0:e.discountAllocations,"activityType"),lineItemsDiscount_valueType:$s(null==e?void 0:e.discountAllocations,"valueType"),lineItemsDiscount_value:$s(null==e?void 0:e.discountAllocations,"value"),finalPrice:null==e?void 0:e.finalPrice,lineItems_title:null==e?void 0:e.productName,price:null==e?void 0:e.productPrice,product_id:null==e?void 0:e.productSeq,product_title:null==e?void 0:e.productName,sku_title:((null==e?void 0:e.productSkuAttrList)||[]).join("·")||null,category:null!==(n=null==e?void 0:e.standardCategoryName)&&void 0!==n?n:null,custom_category:null!==(r=null==e?void 0:e.customCategoryName)&&void 0!==r?r:null,image:null!==(o=null==e?void 0:e.productImage)&&void 0!==o?o:""}),{},t?{spu_id:e.productSeq,sku_id:e.productSku,SKU:e.itemNo,product_name:e.productName,variant:(e.productSkuAttrList||[]).join("·"),quantity:e.productNum}:{spuId:e.productSeq,skuId:e.productSku,skuItemNo:e.itemNo,title:e.productName,variant:(e.productSkuAttrList||[]).join(","),quantity:e.productNum})}))},Xs=function(e){var t,n,r,o,a,i=e.abandonedInfo,c=e.createOrderParams,s=c.checkoutLevelDiscountApplications||[];return{currencyCode:null===(t=c.marketInfo)||void 0===t?void 0:t.marketCurrencyCode,discountApplication_targetSelection:Js(s,"targetSelection"),discountApplication_targetType:Js(s,"targetType"),discountApplication_title:Js(s,"title"),discountApplication_activityType:Js(s,"activityType"),discountApplication_valueType:Js(s,"valueType"),discountApplication_value:Js(s,"value"),email:(null==c||null===(n=c.buyerInfo)||void 0===n?void 0:n.buyerEmail)||null,subtotalPrice:null==c||null===(r=c.priceInfo)||void 0===r?void 0:r.productSumAmount,totalPrice:null==c||null===(o=c.priceInfo)||void 0===o?void 0:o.originalSettleSumAmount,shipping_price:null==c||null===(a=c.priceInfo)||void 0===a?void 0:a.logisticsSumAmount,token:(null==i?void 0:i.checkoutToken)||null,transactions:[]}};function Js(e,t){return(null==e?void 0:e.map((function(e){return(null==e?void 0:e[t])||null})))||null}function $s(e,t){return(null==e?void 0:e.map((function(e){var n;return(null==e||null===(n=e.discountApplication)||void 0===n?void 0:n[t])||null})))||null}var Zs=function(e){var t,n=(null==e?void 0:e.buyerInfo)||{},r=n.buyerEmail,o=n.buyerPhone,a=(null==e?void 0:e.receiverInfo)||{},i=a.receiverCountryCode,c=a.receiverProvince,s=a.receiverCity,u=a.receiverFirstName,l=a.receiverLastName,d=a.receiverPostcode,f=a.receiverAddress,p=a.receiverMobile,h=null==e||null===(t=e.buyerInfo)||void 0===t?void 0:t.buyerPhoneAreaCode;h=h?Qs(h,"+"):tu({buyerPhoneAreaCode:h,receiverCountryCode:i});var y=o||p||"";if(y){var v=/[^0-9]/g;y="+"===y[0]?"+".concat(y.replace(v,"")):"".concat(h).concat(y.replace(v,""))}return{email:r,phone:y,country:i,province:c,city:s,firstName:u,lastName:l,postcode:d,address:f}},Qs=function(e){return"".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"+").concat(eu(e))},eu=function(e){if(!e)return"";var t=i(e,2),n=t[0],r=t[1];return"+"===n?e.slice(1):"0"===n&&"0"===r?e.slice(2):e},tu=function(e){var t,n=e.buyerPhoneAreaCode,r=e.receiverCountryCode,o=n;return!o&&r&&(o=(Li.find((function(e){return e[1]===r.toLowerCase()}))||[])[2]),(null===(t=o)||void 0===t?void 0:t.replace(/^(?:00|\b)/,"+"))||"+86"},nu="undefined"!=typeof window&&"undefined"!=typeof navigator;function ru(e){return{get:function(t){if(nu){var n=window[e].getItem(t)||"";try{"string"==typeof n&&n&&(/^\d+$/.test(n)||/^(true|false|null)$/.test(n)||/(^\{.*\}$)|(^\[.*\]$)/.test(n))?n=JSON.parse(n):"undefined"===n&&(n=void 0)}catch(e){n={}}return n}}}}var ou=ru("sessionStorage"),au=ru("localStorage"),iu=Object.freeze({__proto__:null,sessionStorage:ou,localStorage:au});function cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var su,uu="tradeAttributeInfo",lu=function(e){var t,n=e.logger,r=e.seq,o=null===(t=iu.sessionStorage)||void 0===t?void 0:t.get(uu);if(!o)return n.info("[abandonedSeq:".concat(r,"][cannot find ").concat(uu," info]")),{};var a={};return Object.keys(o).forEach((function(e){var t=(o[e]||{}).value;a[e]=function(e){return"string"==typeof e?e:JSON.stringify(e)}(t)})),n.info("[abandonedSeq:".concat(r,"][").concat(uu,":]"),{data:{tradeAttributeInfo:a}}),function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cu(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},a)},du=(su="",function(e){var t=e.logger;if(su)return su;try{var n,r=null===(n=window.Shopline.Analytics)||void 0===n?void 0:n.getTrackerCid();return r?su=r:(null==t||t.warn("get trackerCid from analytics empty"),"")}catch(e){return null==t||t.error("Failed to get trackerCid",{error:e}),""}});function fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fu(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var hu=dr(),yu=p((function e(t,n){var r=this;u(this,e),h(this,"checkoutUrl",""),h(this,"abandonedInfo",null),h(this,"createOrderParams",{basicInfo:null,otherInfo:null,buyerInfo:null,marketInfo:null,priceInfo:null,productInfos:null,checkoutLevelDiscountApplications:null,receiverInfo:null,passThrough:""}),h(this,"expressCheckoutChannelInfo",null),h(this,"shippingMethodName",""),h(this,"firstLoadRes",{status:Te.Await,promise:null}),h(this,"getConfig",(function(){var e=r.config,t=e.domId,n=e.paymentConfig,o=e.props,a=o.style,i=o.expressOptimizationSwitch,c=o.buttonTimeoutConfig,s=r.extra,u=s.uniqueId,l=s.isSubscription,d=as(n).map((function(e){var t=os({channelCode:e.channelCode,methodCode:e.methodCode},{uniqueId:u,isSubscription:l});return pu(pu({},e),{},{currentDomId:t})}));return l&&(d=d.filter((function(e){return e.methodCode===xe.Paypal}))),r.logger.info("获取快捷支付按钮配置 payments",{data:{payments:d}}),{language:window.Shopline.locale,payments:d,props:{dynamic:n.isSystem,domId:t,styleOptions:{height:a.height,"border-radius":a["border-radius"]},buttonTimeoutConfig:{enable:"boolean"!=typeof(null==c?void 0:c.enable)||c.enable,timeoutMillis:null==c?void 0:c.timeoutMillis},isSubscription:l,scriptParams:l?{"data-namespace":"subscriptionDynamicPaypal"}:void 0,expressOptimizationSwitch:i},loggerFn:function(){return r.logger.withOwner("")},beforeCreateOrder:r.beforeCreateOrder,onChannelModalSuccess:r.onChannelModalSuccess,onFormDataChange:r.onFormDataChange,createOrder:r.createOrder,onError:r.onError,onAllButtonsInitFail:r.onAllButtonsInitFail}})),h(this,"updateCreateOrderParams",(function(e){var t,n,o,a,i=(null===(t=r.createOrderParams.otherInfo)||void 0===t?void 0:t.clientLang)||(null===(n=e.otherInfo)||void 0===n||null===(o=n.checkoutLanguageInfo)||void 0===o?void 0:o.displayLanguage)||(null===(a=e.otherInfo)||void 0===a?void 0:a.clientLang);r.createOrderParams.basicInfo=e.basicInfo||null,r.createOrderParams.otherInfo=pu(pu({},e.otherInfo),{},{clientLang:i,trackerCid:du({logger:r.logger})}),r.createOrderParams.buyerInfo=e.buyerInfo||null,r.createOrderParams.marketInfo=e.marketInfo||null,r.createOrderParams.passThrough=e.passThrough||"",e.priceInfo&&(r.createOrderParams.priceInfo=e.priceInfo),e.productInfos&&(r.createOrderParams.productInfos=e.productInfos),e.receiverInfo&&(r.createOrderParams.receiverInfo=e.receiverInfo),e.checkoutLevelDiscountApplications&&(r.createOrderParams.checkoutLevelDiscountApplications=e.checkoutLevelDiscountApplications)})),h(this,"beforeCreateOrder",function(){var e=s(C.mark((function e(t){var n,o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(){var e=s(C.mark((function e(t){var n,o,a,i,c,s,u,l,d,f,p,h,y,v,m,g,b,w,_,O,k,S,P;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(n=t||{}).channelCode,a=n.methodCode,i=n.paymentId,c=n.accessMode,s=r.config,u=s.saveAbandonedOrder,l=s.paymentConfig,d=s.props.toast,f={valid:!1},r.logger.info("beforeCreateOrder",{data:{channelCode:o,methodCode:a,paymentId:i}}),r.reportButtonClick(a),ls(Bi.ButtonClick,{methodCode:a,buttonLocation:l.buttonLocation}),e.prev=6,r.firstLoadRes.status=Te.Pending,e.next=10,u(ds(a));case 10:if(p=e.sent,h=p.canContinue,y=p.abandonedInfo,v=p.url,h&&y){e.next=17;break}return r.logger.info("save abandon order process terminated",{data:{abandonedInfo:y,url:v}}),e.abrupt("return",f);case 17:if(r.checkoutUrl=v||"",m={abandonedOrderInfo:y,returnUrl:v||""},![xe.ApplePay,xe.GooglePay].includes(a)){e.next=40;break}return r.abandonedInfo=y,r.expressCheckoutChannelInfo={channelCode:o,methodCode:a,accessMode:c,paymentId:i||"",storeWebsiteUrl:window.location.origin},g=y.seq,b=y.checkoutToken,w={abandonedOrderInfo:{seq:g,checkoutToken:b,abandonedOrderType:"SETTLE",orderFrom:"MAIN_SITE"},expressCheckoutChannelInfo:r.expressCheckoutChannelInfo,otherInfo:{buyScence:Ps[l.buttonLocation],trackerCid:du({logger:r.logger})},buttonTraceId:l.buttonTraceId},r.logger.info("快捷支付请求firstLoad接口",{data:pu({},w)}),e.next=27,As(w);case 27:if(_=e.sent,r.logger.info("快捷支付firstLoad接口返回",{data:pu({},_)}),!_){e.next=38;break}if(!cs(_)){e.next=33;break}return r.logger.log("需要跳转"),e.abrupt("return",f);case 33:r.updateCreateOrderParams(_),(O=pu({},_)).payChannelData=ss(O.payChannelData,{expressCheckoutChannelInfo:r.expressCheckoutChannelInfo}),r.shippingMethodName=us(O.payChannelData,{expressCheckoutChannelInfo:r.expressCheckoutChannelInfo})||"",m.paymentConfig=O;case 38:r.logger.info("快捷支付firstLoad接口返回",{data:pu({},_)}),r.firstLoadRes.status=Te.Done;case 40:return r.logger.info("beforeCreateOrder返回值",{data:pu({},m)}),e.abrupt("return",m);case 44:return e.prev=44,e.t0=e.catch(6),r.firstLoadRes.status=Te.Fail,window[window.__sl_console__?"__sl_console__":"console"].error("beforeCreateOrder error: ",e.t0),k=Us(e.t0,{logger:r.logger}),S=k.isServiceUnavailable,P=k.errorType,S?ft(r.config.onError)&&r.config.onError(ke.PullUpChannel,{errorType:P}):(r.logger.error("beforeCreateOrder执行出错",{error:e.t0}),e.t0.code===Rs.NoShippingOption?d(hu("cart.error.noshipping")):d(hu("cart.error.default"))),e.abrupt("return",f);case 51:case"end":return e.stop()}}),e,null,[[6,44]])})));return function(t){return e.apply(this,arguments)}}(),o=n(t),r.firstLoadRes.promise=o,e.next=5,o;case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(this,"onChannelModalSuccess",(function(e){var t=r.config.paymentConfig.buttonLocation;if(ls(Bi.ModalOpen,{methodCode:e.methodCode,buttonLocation:t}),e.methodCode!==xe.Paypal)try{var n=r.createOrderParams,o=n.priceInfo,a=n.productInfos,i=(null==o?void 0:o.originalSettleSumAmount)||(null==o?void 0:o.orderAmount),c=e.settleCurrency;!function(e){var t,n=e.abandonedInfo,r=e.createOrderParams,o=e.logger,a=function(e){var t=JSON.parse(decodeURIComponent(uc("".concat(e,"_fb_data")))||"{}");return t&&t.ed?t.ed:lc()}((null==n?void 0:n.seq)||""),i="initiateCheckout".concat(a),c=r.priceInfo,s=r.productInfos,u={eventId:i,value:(null==c?void 0:c.originalSettleSumAmount)||(null==c?void 0:c.orderAmount),list:Ks(s),checkout:Xs({abandonedInfo:n,createOrderParams:r})};o.info("report event orderStart",{data:u}),null===(t=window.Shopline.Analytics)||void 0===t||t.track({name:"orderStart",payload:u})}({abandonedInfo:r.abandonedInfo||null,createOrderParams:r.createOrderParams,logger:r.logger}),tc.reportConversionEvent(Yi.InitiateCheckout,{currency:c,orderAmount:i,productInfos:a})}catch(e){r.logger.error("开始结账事件上报出错",{error:e})}})),h(this,"onFormDataChange",function(){var e=s(C.mark((function e(t,n){var o,a,i,c,u,l;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a={code:Ss.UpdateFail,message:hu("cart.error.renew")},r.logger.log("onFormDataChange",{data:{firstLoadRes:r.firstLoadRes}}),h(o={},Te.Await,(function(){})),h(o,Te.Done,s(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))),h(o,Te.Fail,(function(){})),h(o,Te.Pending,s(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.firstLoadRes.promise;case 2:case"end":return e.stop()}}),e)})))),i=o[r.firstLoadRes.status],e.next=6,i();case 6:return c={abandonedOrderInfo:r.abandonedInfo,expressCheckoutChannelInfo:r.expressCheckoutChannelInfo,basicInfo:pu(pu({},r.createOrderParams.basicInfo),{},{action:n}),otherInfo:r.createOrderParams.otherInfo,buyerInfo:r.createOrderParams.buyerInfo,payChannelData:t,passThrough:r.createOrderParams.passThrough},r.logger.info("快捷支付请求弃单更新参数",{data:pu({},c)}),e.next=10,Ls(c).catch((function(e){return r.logger.error("快捷支付弃单更新失败",{error:e}),e.code===Rs.NoShippingOption&&(a.message=hu("cart.error.noshipping")),e.code===Rs.DiscountCode&&Hs.includes(e.msg)&&(a.message=hu("transaction.discount.code_error")),e.code===Rs.DiscountCode&&qs.includes(e.msg)&&(a.message=hu("cart.couponCode.existCode")),{error:a}}));case 10:if(u=e.sent,r.logger.info("快捷支付弃单更新返回值",{data:pu({},u)}),r.isValidReturn(u)){e.next=14;break}return e.abrupt("return",u);case 14:if(!cs(u)){e.next=17;break}return r.logger.log("需要跳转"),e.abrupt("return",{error:{code:Ss.UpdateFail,message:hu("cart.error.renew")}});case 17:if(r.updateCreateOrderParams(u),!r.expressCheckoutChannelInfo){e.next=22;break}return l=ss(u.payChannelData,{expressCheckoutChannelInfo:r.expressCheckoutChannelInfo}),r.shippingMethodName=us(l,{expressCheckoutChannelInfo:r.expressCheckoutChannelInfo})||"",e.abrupt("return",l);case 22:return e.abrupt("return",u.payChannelData);case 23:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),h(this,"createOrder",function(){var e=s(C.mark((function e(t,n){var o,a,i,c,s,u,l,d,f,p,h,y,v,m,g,b,w,_,O,k,S,P,x,I,E,T,j,A,L,D,N,B,M,R;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=n.payChannelData,s=n.token,u="",window.__DF__&&"function"==typeof window.__DF__.getToken&&(u=window.__DF__.getToken()),l=fs(),d=l.sid,f=l.createAt,p="",window.HdSdk&&window.HdSdk.shopTracker&&"function"==typeof window.HdSdk.shopTracker.getDataId&&(p=window.HdSdk.shopTracker.getDataId()),h="addPaymentInfo".concat(lc()),y={abandonedOrderInfo:r.abandonedInfo,expressCheckoutChannelInfo:r.expressCheckoutChannelInfo,basicInfo:r.createOrderParams.basicInfo,lastVisit:lu({logger:r.logger,seq:null!==(o=null===(a=r.abandonedInfo)||void 0===a?void 0:a.seq)&&void 0!==o?o:""}),otherInfo:pu(pu({},r.createOrderParams.otherInfo),{},{dfpToken:u}),buyerInfo:r.createOrderParams.buyerInfo,marketInfo:r.createOrderParams.marketInfo,passThrough:r.createOrderParams.passThrough,payChannelData:c,instrumentOption:s,sessionInfo:{sessionId:d,sessionCreateTime:f},dataReportReq:{eventName:"AddPaymentInfo",dataId:p,eventTime:Date.now(),eventId:h,currency:t.settleCurrency,payAmount:null===(i=r.createOrderParams.priceInfo)||void 0===i?void 0:i.originalSettleSumAmount},clientInfo:Zt()},v={error:{code:Ss.CreateFail,message:hu("cart.error.order")}},r.logger.info("快捷支付请求下单",{data:pu({},y)}),e.next=12,Ds(y).catch((function(e){if(r.logger.error("快捷支付下单失败",{error:e}),e.code===Rs.IllegalAmount){var t=window.Shopline.storeId,n="".concat(window.location.protocol,"//").concat(window.location.host,"/").concat(t,"/checkouts/").concat(y.abandonedOrderInfo.checkoutToken);r.logger.info("下单金额不一致,跳转结算页",{data:{url:n}}),window.location.href=n}return v}));case 12:if(m=e.sent,r.logger.info("快捷支付请求下单返回值",{data:pu({},m)}),r.isValidReturn(m)){e.next=16;break}return e.abrupt("return",m);case 16:if(!cs(m)){e.next=19;break}return r.logger.info("需要跳转"),e.abrupt("return",v);case 19:g=m.buyerInfo,b=m.receiverInfo,g&&(r.createOrderParams.buyerInfo=pu(pu({},r.createOrderParams.buyerInfo),{},{buyerEmail:g.email,buyerPhone:g.phone,buyerPhoneAreaCode:g.phoneAreaCode})),b&&(r.createOrderParams.receiverInfo=pu(pu({},r.createOrderParams.receiverInfo),{},{receiverCountry:b.country,receiverCountryCode:b.countryCode,receiverFirstName:b.firstName,receiverLastName:b.lastName,receiverAddress:b.address,receiverAddressAdd:b.addressAdd,receiverProvince:b.state,receiverCity:b.city,receiverPostcode:b.postCode,receiverMobile:b.phone}));try{O=r.createOrderParams,k=O.basicInfo,S=O.otherInfo,P=O.priceInfo,Vs({eventId:h,channelCode:null===(w=r.expressCheckoutChannelInfo)||void 0===w?void 0:w.channelCode,abandonedInfo:r.abandonedInfo||null,createOrderParams:r.createOrderParams,logger:r.logger}),zs({abandonedInfo:r.abandonedInfo||null,createOrderParams:r.createOrderParams,logger:r.logger}),Ws({shipping_method:r.shippingMethodName,abandonedInfo:r.abandonedInfo||null,createOrderParams:r.createOrderParams,logger:r.logger}),x=(null==P?void 0:P.originalSettleSumAmount)||(null==P?void 0:P.orderAmount),I=t.settleCurrency||"",E={payment_method:null===(_=r.expressCheckoutChannelInfo)||void 0===_?void 0:_.channelCode,shipping_method:r.shippingMethodName,coupon_code:null==k?void 0:k.discountCode,currency:I,orderAmount:x,productInfos:m.productInfos||[],basicInfo:k,otherInfo:S},tc.reportConversionEvent(Yi.AddCustomerInfo,E),tc.reportConversionEvent(Yi.AddShippingInfo,E),tc.reportAddPaymentInfo(E)}catch(e){r.logger.error("完成订单事件上报出错",{error:e})}return e.prev=23,A=m.orderMark,L=m.orderSeq,D=m.transactionId,N=m.paySeq,B=m.nextAction,M={orderMark:A,orderSeq:L,transactionId:D,paySeq:N,abOrderSeq:null===(T=r.abandonedInfo)||void 0===T?void 0:T.seq,abOrderMark:null===(j=r.abandonedInfo)||void 0===j?void 0:j.mark},sessionStorage.setItem("processing_data",JSON.stringify(M)),R=JSON.parse(B),e.abrupt("return",{nextAction:R});case 31:return e.prev=31,e.t0=e.catch(23),r.logger.error("快捷支付下单,解析数据失败",{error:e.t0,data:m}),e.abrupt("return",v);case 35:case"end":return e.stop()}}),e,null,[[23,31]])})));return function(t,n){return e.apply(this,arguments)}}()),h(this,"onError",(function(e,t,n){var o=r.config.props.toast;if(t&&(null==n?void 0:n.methodCode)===xe.Paypal&&[ke.PullUpChannel,ke.Pay].includes(t)){var a=Us(e,{logger:r.logger}),i=a.isServiceUnavailable,c=a.errorType;if(i)return void(ft(r.config.onError)&&r.config.onError(ke.PullUpChannel,{errorType:c}))}if(t===ke.CreateExpected){var s=ps.exclude(r.checkoutUrl,["spb"]);return r.logger.warn("下单异常,跳到结算页",{data:{url:s}}),void(window.location.href=s)}r.logger.error("快捷支付流程出错",{error:e,data:{type:t,extData:n}}),t===ke.PullUpChannel&&o(hu("cart.error.default"))})),h(this,"onAllButtonsInitFail",(function(){var e=r.config.paymentConfig;zi(e)&&(r.logger.info("所有快捷支付按钮渲染失败,渲染兜底buy now按钮"),r.extra.onAllButtonsInitFail())})),h(this,"isValidReturn",(function(e){return!(!e||e.error)})),h(this,"reportButtonClick",(function(e){var t=r.config.paymentConfig.buttonLocation,n=Mi[e]||"";n?tc.reportPayButtonClick(n,t):window[window.__sl_console__?"__sl_console__":"console"].warn("快捷支付按钮点击上报,未知的按钮支付方式: ".concat(e))})),this.config=t,this.extra=n,this.logger=this.config.props.logger.pipeOwner("ExpressConfig")}));function vu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mu(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var bu=dr(),wu=function(e){Oi(n,Ni);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ki(e);if(t){var o=ki(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ci(this,n)}}(n);function n(e){var r;u(this,n),h(wi(r=t.call(this,e)),"expressInstance",null),h(wi(r),"subscriptionExpressInstance",null),h(wi(r),"isVisible",!1),h(wi(r),"isSubscription",!1),h(wi(r),"isAllButtonsInitFail",!1),h(wi(r),"render",s(C.mark((function e(){var t,n,o,a;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.logger.info("render"),r.needRender){e.next=3;break}return e.abrupt("return",[]);case 3:if(t=r.config.props,n=t.isPreview,o=t.isSubscription,a=t.isVisible,r.isVisible=a,r.isSubscription=Boolean(o),r.insertButtonContainer(r.configList),n&&(r.logger.info("预览模式,渲染按钮遮罩层,阻断下单"),r.addMaskListener()),!o){e.next=14;break}return r.logger.info("订阅模式,渲染订阅和普通按钮"),e.next=12,Promise.all([r.renderSceneButton(!0),r.renderSceneButton(!1)]);case 12:e.next=17;break;case 14:return r.logger.info("普通模式,渲染普通按钮"),e.next=17,r.renderSceneButton(!1);case 17:if(!r.isAllButtonsInitFail){e.next=19;break}return e.abrupt("return",Promise.reject(new Error("all button init failed.")));case 19:return e.abrupt("return",r.getRenderedList());case 20:case"end":return e.stop()}}),e)})))),h(wi(r),"rerender",function(){var e=s(C.mark((function e(t){var n,o,a,i,c,s,u;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.logger.info("rerender"),n=r.configList,o=as(t),!is(n,o)||r.renderedList.length!==o.length){e.next=6;break}return r.logger.info("same paymentConfig, no need to rerender"),e.abrupt("return");case 6:if(a=function(e){return os({channelCode:e.channelCode,methodCode:e.methodCode},{uniqueId:r.uniqueId,isSubscription:r.isSubscription})},(i=o.filter((function(e){var t;if(n.find((function(t){return t.channelCode===e.channelCode&&t.methodCode===e.methodCode})))return!1;var o=a(e);return null===(t=r.container)||void 0===t||!t.querySelector("#".concat(o))}))).length&&r.insertButtonContainer(i),c=o.map((function(e){var t=a(e);return gu(gu({},e),{},{currentDomId:t})})),!r.isSubscription){e.next=15;break}return e.next=13,null===(s=r.subscriptionExpressInstance)||void 0===s?void 0:s.rerender(c.filter((function(e){return e.methodCode===xe.Paypal})));case 13:e.next=17;break;case 15:return e.next=17,null===(u=r.expressInstance)||void 0===u?void 0:u.rerender(c);case 17:r.setVisible(!0),r.configList=o;case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(wi(r),"setDisabled",(function(e){var t,n;r.logger.info("setDisabled",{data:e}),r.needRender&&(r.isDisabled=e,null===(t=r.expressInstance)||void 0===t||t.setDisabled(e),null===(n=r.subscriptionExpressInstance)||void 0===n||n.setDisabled(e))})),h(wi(r),"setVisible",(function(e){var t,n;if(r.logger.info("setVisible",{data:e}),r.needRender){r.isVisible=e,r.setPaypalBgVisible(!1);var o,a=r.config.paymentConfig,i=zi(a),c=null===(t=r.container)||void 0===t?void 0:t.querySelectorAll(".".concat(Ei.COMMON_ITEM_EXPRESS,":not(.").concat(Ei.BUTTON_SUBSCRIPTION,")"));i&&(c=r.getDynamicButtonElements()),r.isSubscription&&(r.logger.info("订阅模式:只控制paypal按钮"),c=null===(o=r.container)||void 0===o?void 0:o.querySelectorAll(".".concat(Ei.COMMON_ITEM_EXPRESS,".").concat(Ei.BUTTON_SUBSCRIPTION))),null===(n=c)||void 0===n||n.forEach((function(t){e?null==t||t.classList.remove(Ei.BUTTON_HIDE):null==t||t.classList.add(Ei.BUTTON_HIDE)})),r.setPaypalBgVisible(!0)}})),h(wi(r),"setSubscription",(function(e){var t,n,o;if(r.logger.info("setSubscription",{data:e}),r.needRender&&(r.isSubscription=e,r.setPaypalBgVisible(!1),r.isVisible)){var a,i=r.config.paymentConfig,c=zi(i),s=null===(t=r.container)||void 0===t?void 0:t.querySelectorAll(".".concat(Ei.COMMON_ITEM_EXPRESS,".").concat(Ei.BUTTON_SUBSCRIPTION)),u=null===(n=r.container)||void 0===n?void 0:n.querySelectorAll(".".concat(Ei.COMMON_ITEM_EXPRESS,":not(.").concat(Ei.BUTTON_SUBSCRIPTION,")"));if(c&&(u=r.getDynamicButtonElements()),e)return null==s||s.forEach((function(e){null==e||e.classList.remove(Ei.BUTTON_HIDE)})),null===(a=u)||void 0===a||a.forEach((function(e){null==e||e.classList.add(Ei.BUTTON_HIDE)})),void(r.subscriptionExpressInstance||r.renderSceneButton(!0));null===(o=u)||void 0===o||o.forEach((function(e){null==e||e.classList.remove(Ei.BUTTON_HIDE)})),null==s||s.forEach((function(e){null==e||e.classList.add(Ei.BUTTON_HIDE)})),r.expressInstance||r.renderSceneButton(!1),r.setPaypalBgVisible(!0)}})),h(wi(r),"insertButtonContainer",(function(e){var t,n=r.config,o=n.paymentConfig,a=n.props,i=a.isPreview,c=a.style,s=a.isSubscription,u=function(e,t){return'\n      <div\n        class="'.concat(Ei.COMMON_ITEM," ").concat(Ei.COMMON_ITEM_EXPRESS," pay-button-").concat(e.methodCode," ").concat(t?Ei.BUTTON_SUBSCRIPTION:""," ").concat(s!==t?Ei.BUTTON_HIDE:""," ").concat(Ei.BUTTON_HIDE,'"\n        id="').concat(os(e,{uniqueId:r.uniqueId,isSubscription:t}),'"\n      >').concat(i?'<div class="'.concat(Ei.BUTTON_MASK,'"></div>'):"").concat(e.methodCode===xe.Paypal&&0===c["border-radius"]?'<div class="'.concat(Ei.PAY_PAL_BG_BEFORE,'"></div><div class="').concat(Ei.PAY_PAL_BG_AFTER,'"></div>'):"","</div>\n    ")},l=Vi(o).includes(Ii.PAY_PAL),d=e.map((function(e){return u(e)})).join("\n");l&&(d+=u({channelCode:Pe.Paypal,methodCode:xe.Paypal},!0)),null===(t=r.container)||void 0===t||t.insertAdjacentHTML("beforeend",d)})),h(wi(r),"getExpressPaymentConfig",(function(e){return new yu(r.config,{uniqueId:r.uniqueId,onAllButtonsInitFail:function(){return r.isAllButtonsInitFail=!0},isSubscription:e}).getConfig()})),h(wi(r),"addMaskListener",(function(){var e,t=r.config.props.toast,n=null===(e=r.container)||void 0===e?void 0:e.querySelectorAll(".".concat(Ei.COMMON_ITEM_EXPRESS));null==n||n.forEach((function(e){e.addEventListener("click",(function(){t(bu("products.product_details.link_preview_does_not_support"))}))}))})),h(wi(r),"renderSceneButton",function(){var e=s(C.mark((function e(t){var n,o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.logger.info("renderSceneButton",{data:t}),n=r.getExpressPaymentConfig(t),r.logger.info("expressPaymentConfig",{data:gu({},n)}),o=new es(n),e.next=6,o.render();case 6:r.isDisabled&&o.setDisabled(!0),t?r.subscriptionExpressInstance=o:r.expressInstance=o;case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(wi(r),"getDynamicButtonElements",(function(){r.logger.info("动态结算模式:只控制一种渠道的按钮 paypal/gp/ap");var e,t=void 0,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return vu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vu(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw a}}}}(Fi);try{for(n.s();!(e=n.n()).done;){var o,a=e.value,i=Ei[a],c=null===(o=r.container)||void 0===o?void 0:o.querySelector(".".concat(i,":not(.").concat(Ei.BUTTON_SUBSCRIPTION,")"));if(c&&!c.className.includes(Ti)){var s;r.logger.info("控制支付方式: ".concat(a)),t=null===(s=r.container)||void 0===s?void 0:s.querySelectorAll(".".concat(i,":not(.").concat(Ei.BUTTON_SUBSCRIPTION,")"));break}}}catch(e){n.e(e)}finally{n.f()}return t})),h(wi(r),"setPaypalBgVisible",(function(e){var t,n=null===(t=r.container)||void 0===t?void 0:t.querySelectorAll(".".concat(Ei.PAY_PAL_BG_BEFORE,", .").concat(Ei.PAY_PAL_BG_AFTER));e?setTimeout((function(){null==n||n.forEach((function(e){e.style.opacity="1"}))}),200):null==n||n.forEach((function(e){e.style.opacity="0"}))})),h(wi(r),"destroy",(function(){var e,t;null===(e=r.expressInstance)||void 0===e||e.destroy(),null===(t=r.subscriptionExpressInstance)||void 0===t||t.destroy()}));var o=e.buttonTypes;return r.logger=r.config.props.logger.pipeOwner("ExpressButton"),r.needRender=pc(xi.Express,o),r.configList=as(e.paymentConfig),r.uniqueId=sc(),r}return p(n,[{key:"getRenderedList",value:function(){if(!this.isVisible||!this.needRender)return[];var e=this.expressInstance;return this.isSubscription&&(e=this.subscriptionExpressInstance),e&&e.renderList.filter((function(e){return e.instance.initSuccess&&e.instance.isVisible})).map((function(e){return e.instance.name}))||[]}}]),n}(),_u=function(e){var t,n=e.buttonTypeDataList.find((function(e){return e.buttonType===xi.Fast}));if(!n)return"";var r=n.buttonNameDataList.find((function(e){return e.buttonName===Ii.SHOP_BY_FAST_CHECKOUT}));return r&&(null===(t=r.buttonConfigData.configData)||void 0===t?void 0:t.checkoutUrl)||""};var Ou=dr(),Cu='<svg width="68" height="18" viewBox="0 0 68 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.3554 0.772522L14.3313 0.488281H11.2835L11.2668 0.781076C11.2627 0.852932 11.2607 0.926892 11.2607 1.0029V14.5641H14.3657V8.86666C14.4287 8.35695 14.6465 7.95264 15.0213 7.63644L15.0234 7.63464L15.0255 7.6328C15.4044 7.30127 15.8744 7.13003 16.4563 7.13003C16.8955 7.13003 17.2325 7.22397 17.4873 7.39011L17.4938 7.39433L17.5005 7.39823C17.7749 7.55832 17.9804 7.78526 18.1202 8.08814C18.2633 8.39812 18.34 8.77287 18.34 9.22071V14.5641H21.4243V9.24141C21.4243 8.23355 21.2225 7.33936 20.8076 6.56883C20.3967 5.80576 19.8351 5.20518 19.1236 4.7748C18.4085 4.3284 17.5992 4.10787 16.7047 4.10787C16.0374 4.10787 15.4469 4.25649 14.9475 4.56832C14.7377 4.69697 14.5435 4.83297 14.3657 4.97654V1.0236C14.3657 0.937544 14.3623 0.853814 14.3554 0.772522Z" fill="#052855"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M25.4418 4.03229C26.1167 3.73912 26.8347 3.5932 27.5927 3.5932C28.6108 3.5932 29.542 3.84101 30.3789 4.33978C31.2108 4.82179 31.8762 5.48035 32.3719 6.31141C32.8722 7.15015 33.1195 8.09606 33.1195 9.14074C33.1195 9.96627 32.9673 10.7276 32.6578 11.4202L32.6573 11.4213L32.6568 11.4225C32.3507 12.0929 31.9342 12.678 31.4076 13.1752L31.406 13.1768L31.4043 13.1784C30.8803 13.6587 30.2898 14.0306 29.6342 14.293C28.9905 14.5562 28.3231 14.6883 27.6341 14.6883C26.9319 14.6883 26.245 14.5564 25.5752 14.2943L25.5713 14.2928L25.5675 14.2912C24.9128 14.0148 24.3169 13.6293 23.7809 13.1367L23.7793 13.1353L23.7777 13.1338C23.2524 12.6376 22.8298 12.0543 22.5102 11.3861L22.509 11.3836L22.5079 11.3811C22.198 10.7023 22.0452 9.96097 22.0452 9.16144C22.0452 8.3899 22.191 7.66441 22.4849 6.98836C22.7762 6.31833 23.1777 5.72684 23.6886 5.21593C24.1991 4.70539 24.784 4.31025 25.4418 4.03229ZM27.572 6.65676C27.1143 6.65676 26.7078 6.76736 26.3449 6.98511L26.3416 6.9871L26.3382 6.989C25.9745 7.19508 25.6826 7.48553 25.4609 7.86695C25.2559 8.22928 25.1501 8.64431 25.1501 9.12004C25.1501 9.6505 25.2694 10.0955 25.4965 10.4669C25.7309 10.8364 26.0298 11.1228 26.395 11.3309C26.7783 11.5277 27.1763 11.6247 27.5927 11.6247C27.995 11.6247 28.3791 11.5279 28.7491 11.3309C29.1274 11.1231 29.4326 10.8307 29.667 10.4482L29.6689 10.4451L29.6709 10.4421C29.9102 10.0712 30.0353 9.62772 30.0353 9.09934C30.0353 8.61079 29.9231 8.19116 29.7069 7.83081L29.7049 7.82749L29.703 7.82414C29.4961 7.45903 29.2123 7.17519 28.8472 6.9683C28.4857 6.76348 28.0637 6.65676 27.572 6.65676Z" fill="#052855"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M33.7459 8.26328H33.7403V17.2702H36.7832V13.5593C36.8987 13.618 37.0167 13.6728 37.137 13.7236C37.8118 14.0168 38.5298 14.1627 39.2878 14.1627C40.3059 14.1627 41.2371 13.9149 42.074 13.4161C42.9059 12.9341 43.5713 12.2756 44.0671 11.4445C44.5674 10.6058 44.8147 9.65985 44.8147 8.61517C44.8147 7.78964 44.6624 7.02827 44.353 6.33573L44.3525 6.33459L44.352 6.33345C44.0459 5.66302 43.6293 5.07796 43.1028 4.58068L43.1011 4.57909L43.0994 4.57753C42.5755 4.09726 41.985 3.7253 41.3294 3.46289C40.6856 3.19971 40.0182 3.06764 39.3292 3.06764C38.627 3.06764 37.9401 3.19949 37.2703 3.46158L37.2665 3.46308L37.2627 3.46468C36.6079 3.74115 36.0121 4.12657 35.476 4.61919L35.4744 4.62062L35.4729 4.62208C34.9475 5.11827 34.525 5.70164 34.2054 6.36983L34.2042 6.37233L34.203 6.37485C33.9412 6.94852 33.7912 7.56669 33.7512 8.22799C33.7504 8.23174 33.7498 8.2349 33.7494 8.23729L33.7488 8.24116L33.7487 8.24134C33.7475 8.249 33.7467 8.25541 33.7463 8.25929L33.7459 8.26328ZM37.1916 7.28898C37.426 6.91948 37.725 6.63309 38.0902 6.42503C38.4735 6.22821 38.8715 6.1312 39.2878 6.1312C39.6901 6.1312 40.0743 6.22802 40.4442 6.42501C40.8225 6.63281 41.1277 6.9252 41.3622 7.30774L41.3641 7.3108L41.366 7.31382C41.6053 7.68474 41.7304 8.12819 41.7304 8.65657C41.7304 9.14512 41.6183 9.56475 41.4021 9.92511L41.4001 9.92842L41.3982 9.93178C41.1913 10.2969 40.9075 10.5807 40.5424 10.7876C40.1809 10.9924 39.7588 11.0991 39.2672 11.0991C38.8095 11.0991 38.4029 10.9886 38.04 10.7708L38.0367 10.7688L38.0333 10.7669C37.6697 10.5608 37.3778 10.2704 37.156 9.88896C36.951 9.52663 36.8453 9.1116 36.8453 8.63587C36.8453 8.10542 36.9645 7.66038 37.1916 7.28898Z" fill="#052855"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M48.4788 0.731349H45.436V8.98816C45.436 9.63584 45.6305 10.289 45.8987 10.8766L45.8999 10.8791L45.9011 10.8816C46.2206 11.5498 46.6432 12.1332 47.1686 12.6294L47.1701 12.6308L47.1717 12.6322C47.7078 13.1249 48.3036 13.5103 48.9584 13.7868L48.9622 13.7884L48.966 13.7899C49.6358 14.0519 50.3227 14.1838 51.0249 14.1838C51.7139 14.1838 52.3813 14.0517 53.0251 13.7885C53.6807 13.5261 54.2712 13.1542 54.7951 12.6739L54.7968 12.6723L54.7985 12.6708C55.325 12.1735 55.7416 11.5884 56.0476 10.918L56.0481 10.9168L56.0487 10.9157C56.3581 10.2232 56.5104 9.46179 56.5104 8.63626C56.5104 7.59159 56.263 6.64568 55.7627 5.80694C55.267 4.97588 54.6016 4.31733 53.7697 3.83532C52.9328 3.33654 52.0016 3.08873 50.9835 3.08873C50.2255 3.08873 49.5075 3.23465 48.8327 3.52781C48.7123 3.57866 48.5944 3.63345 48.4788 3.69218V0.731349ZM49.7357 6.48064C50.0986 6.26289 50.5051 6.15229 50.9628 6.15229C51.4545 6.15229 51.8766 6.259 52.238 6.46383C52.6031 6.67072 52.887 6.95456 53.0939 7.31966L53.0958 7.32302L53.0977 7.32633C53.314 7.68669 53.4261 8.10632 53.4261 8.59487C53.4261 9.12325 53.301 9.56669 53.0617 9.93762L53.0597 9.94064L53.0579 9.9437C52.8234 10.3262 52.5182 10.6186 52.1399 10.8264C51.7699 11.0234 51.3858 11.1202 50.9835 11.1202C50.5672 11.1202 50.1691 11.0232 49.7858 10.8264C49.4207 10.6184 49.1217 10.332 48.8873 9.96246C48.6602 9.59106 48.541 9.14602 48.541 8.61557C48.541 8.13984 48.6467 7.72481 48.8517 7.36248C49.0735 6.98105 49.3653 6.69061 49.729 6.48453L49.7324 6.48263L49.7357 6.48064Z" fill="#052855"/>\n<path d="M56.2303 15.1868L56.3274 15.0898L54.6696 13.432L54.5726 13.529C54.1048 13.9968 53.5494 14.3679 52.9382 14.621C52.327 14.8742 51.6719 15.0045 51.0104 15.0045C50.3488 15.0045 49.6937 14.8742 49.0825 14.621C48.4713 14.3679 47.916 13.9968 47.4482 13.529L47.3511 13.432L45.6934 15.0898L45.7904 15.1868C46.4759 15.8723 47.2897 16.4161 48.1853 16.7871C49.081 17.158 50.0409 17.349 51.0104 17.349C51.9798 17.349 52.9398 17.158 53.8354 16.7871C54.731 16.4161 55.5448 15.8723 56.2303 15.1868Z" fill="#052855"/>\n<path d="M56.2101 3.96665H59.2163L61.9071 9.98946L64.6136 3.96665H67.6248L61.5697 17.2792H58.5541L60.3986 13.3416L56.2101 3.96665Z" fill="#052855"/>\n<path d="M3.03671 1.04181C3.69296 0.702008 4.43508 0.53557 5.2564 0.53557C5.774 0.53557 6.24259 0.585665 6.65971 0.689121C7.07665 0.777637 7.4409 0.899338 7.74776 1.05804C8.04854 1.19592 8.30366 1.34427 8.50743 1.5054C8.69941 1.63749 8.85568 1.76297 8.96249 1.88132C9.10051 2.0124 9.23762 2.16318 9.37706 2.34031C9.81301 2.89408 10.0908 3.60793 10.1819 4.40262L10.217 4.7084H7.39709L7.34038 4.50901C7.33619 4.49427 7.33183 4.47997 7.32732 4.4661L7.32448 4.45736L7.32223 4.44846C7.20991 4.00354 6.92075 3.65909 6.49182 3.45493L6.48403 3.45123L6.47649 3.44704C6.3431 3.37294 6.19646 3.31545 6.03549 3.27533L6.03385 3.27492L6.03221 3.27449C5.82951 3.22131 5.56668 3.19185 5.23802 3.19185C5.0208 3.19185 4.80967 3.22427 4.60364 3.28913L4.59908 3.29057L4.59447 3.29184C4.40825 3.34342 4.25463 3.42385 4.12843 3.53031L4.12355 3.53443L4.11848 3.53832C3.99314 3.63444 3.89079 3.75449 3.81102 3.90155C3.74657 4.04195 3.71129 4.20689 3.71129 4.40165C3.71129 4.66354 3.7798 4.859 3.90033 5.00816C4.0521 5.16745 4.26069 5.31014 4.53538 5.43116C4.83087 5.5488 5.16385 5.66147 5.5349 5.76887C5.91659 5.87935 6.30434 5.99594 6.69815 6.11863L6.70062 6.1194L6.70307 6.12022C7.11768 6.25801 7.5258 6.42078 7.9274 6.60846C8.34285 6.80262 8.71492 7.04943 9.04217 7.34916C9.3803 7.64647 9.64687 8.02121 9.84443 8.46721C10.0484 8.91539 10.1442 9.45101 10.1442 10.0639C10.1442 10.7711 10.0086 11.402 9.72789 11.9485C9.45148 12.4865 9.07411 12.9296 8.59649 13.2736C8.1287 13.6104 7.60941 13.8562 7.04052 14.0112C6.47758 14.1768 5.90713 14.2598 5.32992 14.2598C4.75639 14.2598 4.22726 14.19 3.74478 14.047L3.74378 14.0467L3.74279 14.0464C3.56682 13.9927 3.39763 13.9333 3.23535 13.868L3.22469 13.8911L2.97547 13.7761C2.40551 13.513 1.74507 13.1129 1.22848 12.4567C0.691295 11.7743 0.386719 10.9129 0.386719 9.87693V9.60244H3.20241V9.87693C3.20241 9.92922 3.20403 9.97851 3.20705 10.025L3.20844 10.0463L3.2065 10.0677C3.20371 10.0982 3.2023 10.1291 3.2023 10.1603C3.2023 10.7928 3.82094 11.4104 4.78746 11.5557L4.79397 11.5567L4.80041 11.558C4.95298 11.5884 5.10489 11.6036 5.2564 11.6036C5.70989 11.6036 6.09378 11.5457 6.41303 11.4366C6.727 11.3172 6.9561 11.15 7.11522 10.9417L7.11767 10.9385L7.12022 10.9354C7.28063 10.7378 7.37128 10.4733 7.37128 10.1189C7.37128 9.85231 7.28969 9.65672 7.13951 9.50699L7.1338 9.5013L7.12843 9.49528C6.96362 9.31042 6.73485 9.14812 6.43178 9.01383L6.42796 9.01214L6.4242 9.01033C6.10892 8.85898 5.74944 8.72353 5.34458 8.60481L5.33989 8.60343L5.33525 8.60189C4.92876 8.4668 4.51638 8.31957 4.09813 8.16021C3.7962 8.05964 3.49484 7.94056 3.19407 7.80312L3.18985 7.80119L3.18569 7.79912C2.87931 7.64639 2.59127 7.47416 2.32184 7.28228L2.31924 7.28044L2.31669 7.27853C2.05266 7.0811 1.81549 6.85107 1.60531 6.58913L1.60062 6.58329L1.59626 6.5772C1.39496 6.29623 1.23605 5.97801 1.11796 5.6248C0.996191 5.26061 0.938373 4.84524 0.938373 4.38333C0.938373 3.64028 1.12203 2.97647 1.49689 2.40199C1.86828 1.82062 2.38431 1.36742 3.03671 1.04181Z" fill="#052855"/>\n</svg>\n',ku=function(e){return'<button class="btn '.concat(Ei.SHOP_BY_FAST_CHECKOUT,"-item ").concat(Ei.SHOP_BY_FAST_CHECKOUT,'-securey">\n  <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4851 3.19066C8.89661 3.19066 7.60892 4.47835 7.60892 6.06679V6.98466H13.3612V6.06679C13.3612 4.47835 12.0735 3.19066 10.4851 3.19066ZM6.01787 6.06679V6.98466H5.5895C4.23763 6.98466 3.14172 8.08056 3.14172 9.43243V15.5519C3.14172 16.9037 4.23763 17.9996 5.5895 17.9996H15.3806C16.7324 17.9996 17.8284 16.9037 17.8284 15.5519V9.43243C17.8284 8.08056 16.7324 6.98466 15.3806 6.98466H14.9522V6.06679C14.9522 3.59964 12.9522 1.59961 10.4851 1.59961C8.0179 1.59961 6.01787 3.59964 6.01787 6.06679ZM5.5895 8.57571H15.3806C15.8537 8.57571 16.2373 8.95927 16.2373 9.43243V15.5519C16.2373 16.025 15.8537 16.4086 15.3806 16.4086H5.5895C5.11634 16.4086 4.73278 16.025 4.73278 15.5519V9.43243C4.73278 8.95927 5.11634 8.57571 5.5895 8.57571ZM11.2194 12.7853C11.6584 12.5313 11.9538 12.0567 11.9538 11.513C11.9538 10.7019 11.2962 10.0444 10.4851 10.0444C9.67399 10.0444 9.01645 10.7019 9.01645 11.513C9.01645 12.0566 9.31176 12.5312 9.75071 12.7852V14.4504C9.75071 14.8559 10.0795 15.1847 10.485 15.1847C10.8906 15.1847 11.2194 14.8559 11.2194 14.4504V12.7853Z" fill="#052855"/>\n  </svg>\n  <span>').concat(e,"</span>\n</button>")},Su=function(e){Oi(n,Ni);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ki(e);if(t){var o=ki(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ci(this,n)}}(n);function n(e){var r;u(this,n),h(wi(r=t.call(this,e)),"isCheckout",!1),h(wi(r),"render",s(C.mark((function e(){var t;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.logger.info("render"),r.needRender){e.next=3;break}return e.abrupt("return",[]);case 3:return t=r.insertDom(),r.addListener(),r.isCheckout||r.createAnimateInterval(),r.renderedList=t,e.abrupt("return",t);case 8:case"end":return e.stop()}}),e)})))),h(wi(r),"insertDom",(function(){var e,t,n=r.config.paymentConfig,o=Vi(n).includes(Ii.SHOP_BY_FAST_CHECKOUT);if(r.logger.info("insertDom hasShopby",{data:o}),!o)return[];var a='<div class="'.concat(Ei.COMMON_ITEM," ").concat(Ei.BUTTON_HIDE," ").concat(Ei.SHOP_BY_FAST_CHECKOUT,'">\n      <div class="').concat(Ei.SHOP_BY_FAST_CHECKOUT,'-group">\n        ').concat(ku(Ou("unvisiable.shopby.button.show")),'\n        <button class="btn ').concat(Ei.SHOP_BY_FAST_CHECKOUT,'-item shopby-text-btn">\n          ').concat(Cu,'\n          <span>Checkout</span>\n        </button>\n      </div>\n      <span class="loading-icon" />\n    </div>');return r.isCheckout&&(a='<div class="'.concat(Ei.COMMON_ITEM," ").concat(Ei.BUTTON_HIDE," ").concat(Ei.SHOP_BY_FAST_CHECKOUT,' checkout">\n        <div class="').concat(Ei.SHOP_BY_FAST_CHECKOUT,'-group">\n          <button class="btn ').concat(Ei.SHOP_BY_FAST_CHECKOUT,'-item shopby-text-btn">\n            ').concat(Cu,'\n          </button>\n        </div>\n        <span class="loading-icon" />\n      </div>')),null===(e=r.container)||void 0===e||e.insertAdjacentHTML("beforeend",a),r.buttonElement=(null===(t=r.container)||void 0===t?void 0:t.querySelector(".".concat(Ei.SHOP_BY_FAST_CHECKOUT)))||null,[Ii.SHOP_BY_FAST_CHECKOUT]})),h(wi(r),"addListener",(function(){var e=wi(r).buttonElement;e&&(e.removeEventListener("click",r.handleClick),e.addEventListener("click",r.handleClick))})),h(wi(r),"handleClick",function(){var e=s(C.mark((function e(t){var n,o,a,i,c,s,u,l,d,f,p,h,y,v,m,g,b,w;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.preventDefault(),i=r.config,c=i.paymentConfig.buttonLocation,s=i.saveAbandonedOrder,u=i.props,l=u.isPreview,d=u.toast,tc.reportPayButtonClick(Ii.SHOP_BY_FAST_CHECKOUT,c),!l){e.next=7;break}return r.logger.info("预览模式,按钮点击触发toast提示"),d(Ou("products.product_details.link_preview_does_not_support")),e.abrupt("return");case 7:if(!r.isDisabled&&!r.isLoading){e.next=10;break}return r.logger.info("按钮不可点击",{data:{isDisabled:r.isDisabled,isLoading:r.isLoading}}),e.abrupt("return");case 10:return r.setLoading(!0),e.next=13,s(Ii.SHOP_BY_FAST_CHECKOUT);case 13:if(f=e.sent,p=f.canContinue,h=f.abandonedInfo,p){e.next=19;break}return r.setLoading(!1),e.abrupt("return");case 19:if(y=_u(r.config.paymentConfig),v=r.marketCountry||uc("localization")||(null===(n=window.__PRELOAD_STATE__)||void 0===n||null===(o=n.request)||void 0===o||null===(a=o.cookie)||void 0===a?void 0:a.localization),h&&y&&v){e.next=24;break}return r.logger.error("跳转fc页面失败,跳转参数异常",{data:{abandonedInfo:h,domain:y,country:v},error:new Error}),e.abrupt("return");case 24:m=window.Shopline.storeId,g="".concat(y,"/checkouts/").concat(m,"/").concat(h.checkoutToken),b="?mark=".concat(h.mark,"&clientLang=").concat(window.Shopline.locale,"&country=").concat(v,"&domain=").concat(window.origin),w="".concat(g).concat(b),r.logger.info("跳转fc页面",{data:w}),window.location.href=w;case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(wi(r),"destroy",(function(){var e;r.timer&&window.clearInterval(r.timer),null===(e=r.buttonElement)||void 0===e||e.removeEventListener("click",r.handleClick)}));var o=e.buttonTypes,a=e.props.marketInfo;return r.logger=r.config.props.logger.pipeOwner("FastButton"),r.needRender=pc(xi.Fast,o),r.isCheckout=r.config.paymentConfig.buttonLocation===Pi.Checkout,r.marketCountry=null==a?void 0:a.marketRegionCountryCode,r}return p(n,[{key:"isButtonInViewPort",value:function(){if(!this.buttonElement)return!1;var e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight,n=this.buttonElement.getBoundingClientRect(),r=n.top,o=n.right,a=n.bottom,i=n.left;return r>=0&&i>=0&&o<=e&&a<=t}},{key:"createAnimateInterval",value:function(){this.timer=setInterval(this.addAnimateClass.bind(this),100)}},{key:"addAnimateClass",value:function(){var e,t=null===(e=this.buttonElement)||void 0===e?void 0:e.querySelector(".".concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group"));this.isButtonInViewPort()&&t&&(t.classList.add("shopby-button-slide"),this.timer&&window.clearInterval(this.timer))}}]),n}(),Pu=p((function e(t){var n=this;u(this,e),h(this,"needRender",!0),h(this,"show",(function(){var e;if(n.needRender){var t=n.config.props,r=t.layout,o=t.extraBuyNowDomId,a=Vi(n.config.paymentConfig),i=zi(n.config.paymentConfig),c=a.includes(Ii.SHOP_BY_FAST_CHECKOUT),s=a.includes(Ii.BUY_NOW),u=1;i?u=c?2:1:c&&s?u=2:(c||s)&&(u=1),n.logger.info("渲染骨架屏",{data:u});var l='<div class="'.concat(Ei.COMMON_ITEM," ").concat(Ei.BUTTON_SKELETON,'"></div>');if(r===Ri.BuyNowRow&&s&&o){var d=document.getElementById(o);null==d||d.insertAdjacentHTML("beforeend",l),u--}null===(e=n.container)||void 0===e||e.insertAdjacentHTML("beforeend",new Array(u).fill('<div class="'.concat(Ei.COMMON_ITEM," ").concat(Ei.BUTTON_SKELETON,'"></div>')).join(""))}})),h(this,"hide",(function(){var e;if(n.needRender){var t=n.config.props,r=t.layout,o=t.extraBuyNowDomId,a=null===(e=n.container)||void 0===e?void 0:e.querySelectorAll(".".concat(Ei.BUTTON_SKELETON));if(null==a||a.forEach((function(e){e.remove()})),r===Ri.BuyNowRow&&o){var i,c=document.getElementById(o);null==c||null===(i=c.querySelector(".".concat(Ei.BUTTON_SKELETON)))||void 0===i||i.remove()}}})),this.config=t,this.logger=this.config.props.logger;var r=this.config,o=r.domId,a=r.paymentConfig.buttonLocation;this.container=document.getElementById(o),this.needRender=a!==Pi.Cart})),xu="pay-button-common-style-sheet-id",Iu=function(){},Eu=function(e){var t=e.domId,n=e.props.layout,r=document.getElementById(t);r&&(r.dataset.payButtonLayout=n),function(){if(!document.getElementById(xu)){var e=document.createElement("style");e.setAttribute("id",xu),e.innerHTML="\n  /* ----- 骨架屏 ----- */\n  @keyframes skeleton {\n    0% {\n      background-position: 100% 50%;\n    }\n    100% {\n      background-position: 0 50%;\n    }\n  }\n  .".concat(Ei.BUTTON_SKELETON," {\n    background: linear-gradient(\n      90deg,\n      hsla(0, 0%, 74.5%, 0.2) 25%,\n      hsla(0, 0%, 50.6%, 0.24) 37%,\n      hsla(0, 0%, 74.5%, 0.2) 63%\n    );\n    background-size: 400% 100%;\n    animation: skeleton 2s linear infinite;\n  }\n\n  /* ----- 按钮loading ----- */\n  @keyframes rotate {\n    from {\n      transform: rotate(0deg);\n    }\n    to {\n      transform: rotate(359deg);\n    }\n  }\n  .").concat(Ei.BUTTON_LOADING," .loading-icon {\n    display: inline-block;\n    position: absolute;\n    border: 2px solid white;\n    top: calc(50% - 8px);\n    left: calc(50% - 8px);\n    width: 16px;\n    height: 16px;\n    border-radius: 16px;\n    clip-path: polygon(0% 0%, 100% 0%, 100% 70%, 0% 70%);\n    animation: rotate 1s linear infinite;\n  }\n  \n  /* ----- 按钮遮罩 ----- */\n  .").concat(Ei.BUTTON_MASK," {\n    cursor: pointer;\n    position: absolute;\n    left: 0;\n    top: 0;\n    height: 100%;\n    width: 100%;\n    z-index: 101;\n  }\n\n  /* ----- 按钮公共 ----- */\n  .").concat(Ei.BUTTON_HIDE," {\n    display: none !important;\n  }\n  .").concat(Ei.COMMON_ITEM," {\n    position: relative;\n    overflow: hidden;\n  }\n\n  /* ----- buy now ----- */\n  .").concat(Ei.BUY_NOW," {\n    line-height: 1;\n  }\n  .").concat(Ei.BUY_NOW,".").concat(Ei.BUTTON_LOADING," .").concat(Ei.BUY_NOW,"-text{\n      opacity: 0;\n  }\n\n  /* ----- more options ----- */\n  .").concat(Ei.MORE_OPTIONS," {\n    color: #000000;\n    cursor: pointer;\n    font-family: Helvetica Neue;\n    font-size: 14px;\n    font-weight: 500;\n    margin-top: 15px;\n    text-align: center;\n    text-decoration: underline;\n  }\n\n  .").concat(Ei.MORE_OPTIONS,".").concat(ji,"{\n    color: var(--color-text);\n  }\n\n  /* ----- paypal ----- */\n  .").concat(Ei.PAY_PAL," {\n    line-height: 0;\n  }\n  .").concat(Ei.PAY_PAL," .").concat(Ei.PAY_PAL_BG_BEFORE,",\n  .").concat(Ei.PAY_PAL," .").concat(Ei.PAY_PAL_BG_AFTER," {\n    position: absolute;\n    left: 0;\n    width: 100%;\n    height: calc(50% - 6px);\n    opacity: 0;\n  }\n  .").concat(Ei.PAY_PAL," .").concat(Ei.PAY_PAL_BG_BEFORE," {\n    top: 0;\n  }\n  .").concat(Ei.PAY_PAL," .").concat(Ei.PAY_PAL_BG_AFTER,' {\n    bottom: 0;\n  }\n\n  /* ----- shop by ----- */\n  @keyframes shopby-button-slide-rtl {\n    0% {\n      transform: translateX(-50%);\n    }\n    25% {\n      transform: translateX(0%);\n    }\n    80% {\n      transform: translateX(0%);\n    }\n    100% {\n      transform: translateX(50%);\n    }\n  }\n\n  @keyframes shopby-button-slide {\n    0% {\n      transform: translateX(50%);\n    }\n    25% {\n      transform: translateX(0%);\n    }\n    80% {\n      transform: translateX(0%);\n    }\n    100% {\n      transform: translateX(-50%);\n    }\n  }\n  .shopby-button-slide {\n    animation: shopby-button-slide 1.5s;\n    animation-fill-mode: forwards;\n  }\n\n  html[dir="rtl"] .shopby-button-slide {\n    animation: shopby-button-slide-rtl 1.5s;\n    animation-fill-mode: forwards;\n  }\n\n  .').concat(Ei.SHOP_BY_FAST_CHECKOUT," {\n    background-color: #60F5B2;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT,".").concat(Ei.BUTTON_DISABLED," {\n    cursor: not-allowed;\n    opacity: .3;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT,".").concat(Ei.BUTTON_DISABLED," button {\n    cursor: not-allowed;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group {\n    height: 100%;\n    width: 200%;\n    display: flex;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT,".checkout .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group {\n    width: 100%;\n    height: 100%;\n    transform: none;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-item {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    flex: 1;\n    font-family: PingFang SC;\n    background-color: #60f5b2;\n    border: none;\n    cursor: pointer;\n    color: #052855;\n    margin: 0;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-item:hover {\n    background-color: #60e1b2;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-item:active, .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-item:focus {\n    background-color: #60ffb2;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,'-item svg {\n    margin-right: 6px;\n  }\n\n  html[dir="rtl"] .').concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-item svg {\n    margin-left: 6px;\n  }\n\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-item span {\n    font-style: normal;\n    font-weight: 600;\n    line-height: normal;\n    letter-spacing: -0.02em;\n    font-size: 16px;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-securey {\n    background: #3dee9f;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," .").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-group ").concat(Ei.SHOP_BY_FAST_CHECKOUT,"-securey span {\n    font-weight: 600;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT,".").concat(Ei.BUTTON_LOADING," {\n    opacity: 0.3;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT,".").concat(Ei.BUTTON_LOADING," .loading-icon {\n    border-color: #052855;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT,".").concat(Ei.BUTTON_LOADING," > div {\n    visibility: hidden;\n  }\n\n  /* ----- 布局 ----- */\n  .").concat(Ei.BUY_NOW," {\n    order: 1;\n  }\n  .").concat(Ei.PAY_PAL," {\n    order: 2;\n  }\n  .").concat(Ei.GOOGLE_PAY," {\n    order: 3;\n  }\n  .").concat(Ei.APPLE_PAY," {\n    order: 4;\n  }\n  .").concat(Ei.SHOP_BY_FAST_CHECKOUT," {\n    order: 5;\n  }\n  .").concat(Ei.MORE_OPTIONS,' {\n    order: 6;\n  }\n  [data-pay-button-layout="').concat(Ri.Column,'"],\n  [data-pay-button-layout="').concat(Ri.BuyNowRow,'"] {\n    display: flex;\n    flex-direction: column;\n    margin: -5px 0;\n  }\n  [data-pay-button-layout="').concat(Ri.Column,'"] .').concat(Ei.COMMON_ITEM,',\n  [data-pay-button-layout="').concat(Ri.BuyNowRow,'"] .').concat(Ei.COMMON_ITEM,',\n  [data-pay-button-layout="').concat(Ri.Column,'"] .').concat(Ei.COMMON_ITEM_LAYOUT,',\n  [data-pay-button-layout="').concat(Ri.BuyNowRow,'"] .').concat(Ei.COMMON_ITEM_LAYOUT,' {\n    margin: 5px 0;\n    flex-shrink: 0;\n    flex-grow: 0;\n  }\n  [data-pay-button-layout="').concat(Ri.Row,'"] {\n    display: flex;\n  }\n  [data-pay-button-layout="').concat(Ri.Row,'"] > .').concat(Ei.COMMON_ITEM,' {\n    margin-top: 0;\n    margin-right: 12px;\n  }\n  [data-pay-button-layout="').concat(Ri.Checkout,'"] {\n    display: flex;\n    flex-wrap: wrap;\n    margin: -7px -6px;\n  }\n  [data-pay-button-layout="').concat(Ri.Checkout,'"] .').concat(Ei.COMMON_ITEM,' {\n    margin: 7px 6px;\n  }\n  [data-pay-button-layout="').concat(Ri.Checkout,'"] .').concat(Ei.COMMON_ITEM,":not(.").concat(Ei.PAY_PAL,") {\n    flex-basis: 1px;\n    flex-grow: 1;\n    padding: 0;\n  }\n  "),document.body.appendChild(e)}}(),Iu=function(e){var t=e.domId,n=e.props.extraBuyNowDomId,r=document.getElementById(t),o=document.createElement("style");return o.innerHTML="\n  /* ----- 按钮公共 ----- */\n  #".concat(t," .").concat(Ei.COMMON_ITEM," ").concat(n?",#".concat(n," .").concat(Ei.COMMON_ITEM):""," {\n    height: ").concat(e.props.style.height,"px;\n    width: ").concat(e.props.style.width?"".concat(e.props.style.width,"px"):"100%",";\n    border-radius: ").concat(e.props.style["border-radius"],"px;\n  }\n\n  /* ----- paypal ----- */\n  #").concat(t," .").concat(Ei.PAY_PAL," {\n    min-height: ").concat(e.props.style.height,"px;\n    height: auto;\n    border-radius: 0px;\n    z-index: 1;\n  }\n  "),null==r||r.appendChild(o),function(){null==r||r.removeChild(o)}}(e)},Tu=function(){function e(t){u(this,e),h(this,"renderedButtonCount",0),this.config=t,this.container=this.getContainer(),this.logger=t.props.logger.pipeOwner("Collapse")}return p(e,[{key:"getContainer",value:function(){if(!this.container){var e=document.getElementById(this.config.domId);if(!e)throw new Error("Please check if the DOM node in the configuration is valid.");this.container=e}return this.container}},{key:"init",value:function(e){var t=this.config,n=t.displayButtonCount,r=t.props,o=r.layout,a=r.extraBuyNowDomId,i=t.paymentConfig;if(!zi(i)){this.renderedButtonCount=e;var c=o===Ri.BuyNowRow&&a,s=c?1:2;if(c&&(this.renderedButtonCount=e-1),n)return this.renderedButtonCount>s&&this.renderedButtonCount>n?(this.addContainerAnimation(n),void this.createCollapseButton(n)):void 0}}},{key:"update",value:function(e){e!==this.renderedButtonCount&&(this.logger.info("update",{data:{renderedButtonCount:e}}),this.remove(),this.computedStyleCache=null,this.init(e))}},{key:"remove",value:function(){this.config.displayButtonCount&&(this.container.classList.add("remove"),this.removeCollapseButton())}},{key:"addContainerAnimation",value:function(e){var t=this.config.domId,n=this.computeStyle(e).collapseHeight;this.container.classList.remove("remove");var r=fc("\n      #".concat(t," {\n        height: ").concat(n,"px;\n        overflow: hidden;\n        transition: height 0.3s ease;\n      }\n\n      #").concat(t,".remove {\n        height: auto;\n      }\n    ")),o=r.style,a=r.cssInsertBefore;this.container.contains(o)||a(this.container)}},{key:"createCollapseButton",value:function(e){if(!this.collapseButton){var t=dr(),n=this.container,r=n.parentNode;r||this.logger.log("Cannot find the parent node, affecting the mounting of the collapse button",{data:{container:n}});var o=this.computeStyle(e),a=o.buttonHeight,i=o.containerHeight,c=o.collapseHeight;o.buttonMargin;var s=document.createElement("button");s.id="more-payment-".concat(sc(),"-button"),s.className=Ei.BUTTON_COLLAPSE,s.innerHTML="".concat(t("sdk.button.show")).concat('<svg id="arrowIcon" class="flip-vertical" width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.899486 3.44971L4.94974 7.49996L9 3.44971" stroke="#29252C" stroke-width="1.5" stroke-linecap="round"/></svg>');var u=fc("\n      #".concat(s.id," {\n        height: ").concat(a,"px;\n        min-height: ").concat(a,"px;\n        width: 100%;\n        text-align: center;\n        background: transparent;\n        line-height: ").concat(a,"px;\n        margin-bottom: 0;\n        border: none;\n        font-weight: 500;\n        font-size: 14px;\n        color: #29252C;\n      }\n\n      #").concat(s.id,":active {\n        -webkit-tap-highlight-color: transparent;\n        -webkit-tap-highlight-color: rgba(0,0,0,0);\n      }\n\n      #").concat(s.id," svg {\n        margin-left: 10px;\n      }\n\n      #").concat(s.id," svg.flip-vertical {\n        transform: scaleY(-1);\n      }\n    ")),l=u.style,d=u.cssInsertBefore;null==r||r.insertBefore(s,n.nextSibling),d(s);var f=null==r?void 0:r.querySelector("#arrowIcon");s.addEventListener("click",(function(){if(Math.abs(Number.parseInt(n.style.height)-i)<=1)return n.style.height="".concat(c,"px"),void(null==f||f.classList.add("flip-vertical"));n.style.height="".concat(i,"px"),null==f||f.classList.remove("flip-vertical")})),l.id="collapse-button-style",this.collapseButton=s}}},{key:"removeCollapseButton",value:function(){var e,t;null===(e=this.collapseButton)||void 0===e||e.remove(),this.collapseButton=null,null===(t=this.container.querySelector("#collapse-button-style"))||void 0===t||t.remove()}},{key:"computeStyle",value:function(e){if(this.computedStyleCache)return this.logger.info("computeStyle cache",{data:{style:this.computedStyleCache}}),this.computedStyleCache;var t=this.config.props.style,n=this.container.querySelectorAll(".".concat(Ei.COMMON_ITEM)),r=n[n.length-1];r||this.logger.warn("Unable to calculate container height accurately, will return offsetHeight.",{data:{container:this.container}});var o=(null==r?void 0:r.offsetHeight)||t.height,a=r?2*parseInt(window.getComputedStyle(r).marginTop):this.container.offsetHeight,i=(o+a)*this.renderedButtonCount,c={buttonHeight:o,containerHeight:i,buttonMargin:a,collapseHeight:i-(o+a)*(this.renderedButtonCount-e)};return this.computedStyleCache=c,this.logger.info("computeStyle",{data:{style:c}}),c}}]),e}(),ju=function(){function e(){u(this,e),h(this,"queue",[]),h(this,"running",!1)}var t;return p(e,[{key:"enqueue",value:function(e,t){this.queue.push(e),this.running||this.run(t)}},{key:"run",value:(t=s(C.mark((function e(t){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.running=!0;case 1:if(!(this.queue.length>0)){e.next=9;break}if(n=this.queue.shift(),e.t0=n,!e.t0){e.next=7;break}return e.next=7,n();case 7:e.next=1;break;case 9:null==t||t(),this.running=!1;case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"clear",value:function(){this.queue=[]}}]),e}();function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Lu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Au(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Du=function(){function e(t){var n=this;u(this,e),h(this,"renderPromise",null),h(this,"rerenderAsyncQueue",new ju),h(this,"isVisible",!0),h(this,"render",s(C.mark((function e(){var t,r;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.logger.info("支付按钮渲染"),t=n.config.domId,n.container){e.next=5;break}return n.logger.error("pay button can not find container",{data:n.container}),e.abrupt("return");case 5:if("true"!==n.container.dataset.rendered){e.next=8;break}return n.logger.warn("同一容器重复渲染支付按钮",{data:t}),e.abrupt("return");case 8:return n.container.dataset.rendered="true",Nc(n.config,n.logger),r=function(){var e=s(C.mark((function e(){var t;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fr(window.Shopline.locale||"en");case 2:return Eu(n.config),n.isVisible&&n.skeleton.show(),t=!0,e.next=7,n.expressButton.render().catch((function(e){n.logger.error("快捷支付按钮渲染失败",{error:e}),t=!1}));case 7:return e.next=9,n.fastButton.render().catch((function(e){n.logger.error("快速结账按钮渲染失败",{error:e}),Gc(xi.Fast,n.config,n.logger,e)}));case 9:if(t){e.next=15;break}return Mc(n.config,n.logger),e.next=13,n.normalButton.render(Ii.BUY_NOW).catch((function(e){n.logger.error("普通支付按钮渲染失败",{error:e}),Gc(xi.Normal,n.config,n.logger,e)}));case 13:e.next=17;break;case 15:return e.next=17,n.normalButton.render().catch((function(e){n.logger.error("普通支付按钮渲染失败",{error:e}),Gc(xi.Normal,n.config,n.logger,e)}));case 17:n.collapse.init(n.getRenderedButtons().length),n.injectRenderedButtonsToContainer(),n.skeleton.hide(),n.isVisible&&n.setVisible(!0),n.logger.info("隐藏骨架屏,显示支付按钮");case 22:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n.renderPromise=r(),e.next=14,n.renderPromise;case 14:case"end":return e.stop()}}),e)})))),h(this,"rerender",function(){var e=s(C.mark((function e(t,r){var o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.logger.info("rerender",{data:{paymentConfig:t}}),e.next=3,n.renderPromise;case 3:o=function(){var e=s(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.expressButton.rerender(t);case 2:n.injectRenderedButtonsToContainer();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n.rerenderAsyncQueue.enqueue(o,null==r?void 0:r.afterRerender);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),h(this,"setDisabled",function(){var e=s(C.mark((function e(t,r){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.logger.info("setDisabled",{data:{value:t,options:r}}),e.next=3,n.renderPromise;case 3:n.normalButton.setDisabled(t,r),n.expressButton.setDisabled(t),n.fastButton.setDisabled(t,r);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),h(this,"setVisible",function(){var e=s(C.mark((function e(t,r){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.logger.info("setVisible",{data:{value:t,options:r}}),n.isVisible=t,e.next=4,n.renderPromise;case 4:[{type:xi.Express,instance:n.expressButton},{type:xi.Normal,instance:n.normalButton},{type:xi.Fast,instance:n.fastButton}].forEach((function(e){var n=e.type,o=e.instance;pc(n,null==r?void 0:r.buttonTypes)&&o.setVisible(t)})),t&&n.reportButtonView(),n.collapse.update(n.getRenderedButtons().length),n.injectRenderedButtonsToContainer();case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),h(this,"setSubscription",function(){var e=s(C.mark((function e(t){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.logger.info("setSubscription",{data:{value:t}}),e.next=3,n.renderPromise;case 3:n.expressButton.setSubscription(t),n.normalButton.setSubscription(t),n.collapse.update(n.getRenderedButtons().length),n.injectRenderedButtonsToContainer();case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(this,"customButtons",function(){var e=s(C.mark((function e(t){var r,o,c,s,u,l,d,f,p;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.logger.log("自定义支付按钮 customButtons",{data:Lu({},t)}),e.next=3,n.renderPromise;case 3:r=0,o=Object.entries(t);case 4:if(!(r<o.length)){e.next=15;break}if(s=i(o[r],2),u=s[0],l=s[1],d=l.className,f=null===(c=n.container)||void 0===c?void 0:c.querySelector(".".concat(Ei[u])),![Ii.BUY_NOW,Ii.MORE_OPTIONS].includes(u)){e.next=11;break}return n.normalButton.customButton(u,l),e.abrupt("continue",12);case 11:d&&f&&(p=f.classList).add.apply(p,a(d.split(" ")));case 12:r++,e.next=4;break;case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(this,"getButtonElement",(function(e){var t,r=Ei[e];return null===(t=n.container)||void 0===t?void 0:t.querySelectorAll(".".concat(r))})),h(this,"preProcessConfig",(function(e){var t,n=e.props.style,r=Ai.height;"number"==typeof(null==n?void 0:n.height)&&(r=n.height<40?40:n.height>55?55:n.height);var o="number"==typeof(null==n?void 0:n.width)?n.width:Ai.width,a="number"==typeof(null==n?void 0:n["border-radius"])?n["border-radius"]:Ai["border-radius"];return Lu(Lu({},e),{},{props:Lu(Lu({},e.props),{},{isVisible:!1!==e.props.isVisible,layout:null!==(t=e.props.layout)&&void 0!==t?t:Ri.Column,logger:e.props.logger.pipeOwner("@sl/pay-button"),style:{width:o,height:r,"border-radius":a}})})})),h(this,"reportedButtonViewList",[]),h(this,"reportButtonView",(function(){var e,t=n.config.paymentConfig.buttonLocation,r=null===(e=n.container)||void 0===e?void 0:e.querySelectorAll(".".concat(Ei.COMMON_ITEM,", .").concat(Ei.MORE_OPTIONS));null==r||r.forEach((function(e){var r=Wi(e);dc(e)||!r||n.reportedButtonViewList.includes(r)||(n.reportedButtonViewList.push(r),tc.reportPayButtonView(r,t))}))}));var r=this.preProcessConfig(t),o=r.domId,c=r.props.isVisible;this.config=r,this.container=document.getElementById(o),this.logger=r.props.logger.pipeOwner("PayButton"),this.logger.info("支付按钮实例化参数",{data:Lu({},t)}),this.isVisible=c,this.skeleton=new Pu(r),this.normalButton=new Oc(r),this.expressButton=new wu(r),this.fastButton=new Su(r),this.collapse=new Tu(r)}return p(e,[{key:"getRenderedButtons",value:function(){var e=[].concat(a(this.expressButton.getRenderedList()),a(this.normalButton.getRenderedList()),a(this.fastButton.getRenderedList()));return this.config.paymentConfig.buttonLocation===Pi.Cart&&e.push(Ii.CHECKOUT),e}},{key:"injectRenderedButtonsToContainer",value:function(){var e;null===(e=this.container)||void 0===e||e.setAttribute("data-inject-rendered-buttons",this.getRenderedButtons().join(","))}},{key:"destroy",value:function(){try{if(this.expressButton.destroy(),this.normalButton.destroy(),this.fastButton.destroy(),function(e){var t=e.domId,n=document.getElementById(xu),r=document.getElementById(t);r&&delete r.dataset.payButtonLayout,n&&document.body.removeChild(n),Iu()}(this.config),this.rerenderAsyncQueue.clear(),this.container){delete this.container.dataset.rendered,this.container.removeAttribute("data-inject-rendered-buttons"),this.container.innerHTML="";var e=this.container.parentNode;null==e||e.querySelectorAll(":scope > style").forEach((function(t){return e.removeChild(t)}))}}catch(e){this.logger.error("destroy error",{error:e})}}},{key:"getI18nTranslator",value:function(){return dr()}}]),e}();function Nu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nu(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Mu,Ru,Fu={options:{skipNull:!0,skipEmptyString:!0}},Uu={SignIn:(Mu="/user/signIn",window.Shopline&&window.Shopline.redirectTo&&window.Shopline.redirectTo(Mu)||Mu),Checkout:"/trade/checkout",Checkouts:"/checkouts"},Hu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.query,r=t.fragmentIdentifier,o=t.fullQuery,a=void 0===o||o,i=ps.parseUrl(window.location.href,Bu(Bu({},Fu.options),{},{parseFragmentIdentifier:!0})),c=a?Bu(Bu({},i.query||{}),n||{}):Bu({},n),s=ps.stringifyUrl({url:e,query:c,fragmentIdentifier:r||i.fragmentIdentifier},Fu.options),u="".concat(window.location.protocol,"//").concat(window.location.host).concat(s);return Bu(Bu({originUrl:e},i),{},{query:c,url:s,wholeUrl:u})};!function(e){e.AMOUNT_EXCEEDS_LIMIT="TCTDEXCEEDED_MAX_AMOUNT_LIMIT",e.ABANDONED_RISK_CONTROL="TRD_123768_B1409"}(Ru||(Ru={}));var qu={PRODUCT_VERIFY:"product_verify",SAVE_ORDER:"save_order",NetworkUnstable:De.NetworkUnstable,RateLimited:De.RateLimited},Gu=[De.NetworkUnstable,De.RateLimited];function Yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yu(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var zu=dr(),Wu=function(e,t){var n=t.logger,r=t.query,o=t.associateCart,a=Boolean(uc("osudb_uid")),i=function(){var e,t;return window.Shopline.themeTypeVersion>=2.1?window.__customer_accounts_enabled__:"ONLY_LOGIN"===(null===(e=window.__PRELOAD_STATE__)||void 0===e||null===(t=e.tradeSettleConfig)||void 0===t?void 0:t.loginType)}(),c=!a&&i;null==n||n.info("checkout/save 登录状态",{data:{isLogin:a,needLogin:i,redirectToSignIn:c}});var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.query,r=void 0===n?{}:n,o=t.associateCart,a=t.abandonedOrderMark,i=void 0===a?"":a,c="".concat(window.location.protocol,"//").concat(window.location.host),s=e.storeId,u=e.checkoutToken,l=e.seq;return Hu(u?"".concat(c,"/").concat(s).concat(Uu.Checkouts,"/").concat(u):"".concat(c).concat(Uu.Checkout,"/").concat(l),{query:Bu(Bu({buyScence:o?"cart":"detail"},r),{},{mark:i}),fullQuery:!1}).url}({storeId:window.Shopline.storeId,checkoutToken:e.checkoutToken,seq:e.seq},{query:Vu(Vu({},r),{},{spb:c?null:null==r?void 0:r.spb}),associateCart:o});if(c){var u="".concat(window.location.protocol,"//").concat(window.location.host),l=Hu("".concat(u).concat(Uu.SignIn),{query:{redirectUrl:s},fullQuery:!1}).url;return null==n||n.info("checkout/save 需要登录",{data:{url:l,abandonedInfo:e,needLogin:!0}}),{url:l,abandonedInfo:e,needLogin:!0}}return null==n||n.info("checkout/save 正常返回",{data:{url:s,abandonedInfo:e,needLogin:!1}}),{url:s,abandonedInfo:e,needLogin:!1}},Ku=function(e,t){var n=t.logger,r=t.toast,o=Us(e,{logger:n}),a=o.isNetworkError,i=o.isRateLimited,c=o.isServiceUnavailable,s=o.errorForLog,u=o.message,l=o.httpStatusCode,d=o.bizErrorCode,f=qu.SAVE_ORDER;return c?f=a?qu.NetworkUnstable:qu.RateLimited:(function(e,t,n){switch(null==e||e.info("[PayButton bizerror: ".concat(t,"]")),t){case Ru.AMOUNT_EXCEEDS_LIMIT:n("cart.checkout.max_amount_limit");break;case Ru.ABANDONED_RISK_CONTROL:n("general.abandon.Order.risk");break;default:n("cart.error.order")}}(n,d,(function(e){r(zu(e))})),f=qu.SAVE_ORDER),null==n||n.error("[PayButton Checkout Save Error]".concat(u?": ".concat(u):""),{error:s,data:{bizErrorCode:d,httpStatusCode:l,message:u,extra:t,from:"STANDARD_BUTTON",isNetworkError:a,isRateLimited:i,originalError:e}}),Promise.resolve({errorType:f})};!function(){var e=s(C.mark((function e(t){var n,r,o,a,i,c,s,u,l,d,f;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.products,r=t.associateCart,o=void 0!==r&&r,a=t.discountCodes,i=t.useMemberPoint,c=t.logger,s=t.notSupportSubscriptionCheck,u=void 0!==s&&s,e.prev=1,l=[],"function"!=typeof n){e.next=9;break}return e.next=6,n();case 6:l=e.sent,e.next=10;break;case 9:l=n;case 10:if(l){e.next=13;break}return null==c||c.log("业务方传入商品非法",{data:{products:l,getProducts:n}}),e.abrupt("return",Promise.resolve({errorType:qu.PRODUCT_VERIFY}));case 13:return null==c||c.info("checkout/save 保存弃单",{data:{products:l,associateCart:o,discountCodes:a}}),d={trackerCid:du({logger:c})},e.next=17,Is({products:l,associateCart:o,discountCodes:a,useMemberPoint:i,notSupportSubscriptionCheck:u,otherInfo:d});case 17:return f=e.sent,null==c||c.info("checkout/save 保存弃单返回值",{data:f}),e.abrupt("return",Wu(f,t));case 22:return e.prev=22,e.t0=e.catch(1),e.abrupt("return",Ku(e.t0,t));case 25:case"end":return e.stop()}}),e,null,[[1,22]])})))}();var Xu=function(){var e=s(C.mark((function e(t){var n,r,o,a;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=t.logger,r=t.notSupportSubscriptionCheck,o=void 0!==r&&r,e.next=4,Ts({notSupportSubscriptionCheck:o,trackerCid:du({logger:n})});case 4:return a=e.sent,null==n||n.info("cart save abandoned order response",{data:Vu({},a)}),e.abrupt("return",Wu(a,t));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",Ku(e.t0,t));case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}(),Ju=function(e){var t=e.abandonedSeq,n=e.logger;try{sessionStorage.setItem(function(e){if("undefined"==typeof window)return"";var t=window&&window.encodeURI("checkout_track");return window&&window.btoa(t)}(),"[]"),function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",r="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent));n&&(r+="; path=".concat(n)),document.cookie=r}("".concat(t,"_fb_data"),JSON.stringify({tp:1,et:Date.now(),ed:lc(),currency:window.Shopline.currency}))}catch(e){null==n||n.error("进结算页前设置“开始结账”事件数据失败",{error:e})}};function $u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Zu(e,t){if(e){if("string"==typeof e)return $u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$u(e,t):void 0}}function Qu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||Zu(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var el=function(e){return function(e,t){return Object.prototype.toString.call(e)===t}(e,"[object Object]")},tl=function(){return Number(Math.random().toString().slice(2)+Date.now()).toString(36)};function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nl(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ol,al,il;function cl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sl(e,t){if(e){if("string"==typeof e)return cl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cl(e,t):void 0}}function ul(e){return function(e){if(Array.isArray(e))return cl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||sl(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ll(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fl(e,t,n){return t&&dl(e.prototype,t),n&&dl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pl(t){return pl="function"==typeof Symbol&&"symbol"==e(Symbol.iterator)?function(t){return e(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},pl(t)}function hl(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":pl(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function yl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.P0="P0",e.P1="P1",e.P2="P2"}(ol||(ol={})),function(e){e.Start="Start",e.Success="Success",e.Failure="Failure"}(al||(al={})),function(e){e.Info="info",e.Log="log",e.Warn="warn",e.Error="error"}(il||(il={}));function vl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}(e,t)||sl(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ml,gl=function(e){return function(t,n,r){var o=r.value;r.value=function(){try{for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return o.apply(this,r)}catch(t){return window[window.__sl_console__?"__sl_console__":"console"].error("logger: ".concat(n,"方法执行出错"),t),e}}}},bl=function(e){return e.reduce((function(e,t){var n={};try{n=t()}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("计算列表结果出错",e)}return Object.assign(Object.assign({},e),n)}),{})},wl=function(e){var t=window.__SL_LOGGER__;if(t)return t[e]},_l=function(e,t){window.__SL_LOGGER__||(window.__SL_LOGGER__={}),window.__SL_LOGGER__[e]=t},Ol=function(e){return"string"==typeof e?e:"Request"in window&&e instanceof Request?e.url:String(e)},Cl=function(e){return e instanceof Request},kl=function(){var e,t=null,n={},r=arguments.length<=0?void 0:arguments[0];return e=Ol(r),Cl(r)&&(t=r),(arguments.length<=1?void 0:arguments[1])&&(n=arguments.length<=1?void 0:arguments[1]),[e,t,n]},Sl=new Uint8Array(16);function Pl(){if(!ml&&!(ml="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ml(Sl)}for(var xl=[],Il=0;Il<256;++Il)xl.push((Il+256).toString(16).slice(1));var El={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Tl(e,t,n){if(El.randomUUID&&!t&&!e)return El.randomUUID();var r=(e=e||{}).random||(e.rng||Pl)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(xl[e[t+0]]+xl[e[t+1]]+xl[e[t+2]]+xl[e[t+3]]+"-"+xl[e[t+4]]+xl[e[t+5]]+"-"+xl[e[t+6]]+xl[e[t+7]]+"-"+xl[e[t+8]]+xl[e[t+9]]+"-"+xl[e[t+10]]+xl[e[t+11]]+xl[e[t+12]]+xl[e[t+13]]+xl[e[t+14]]+xl[e[t+15]]).toLowerCase()}(r)}var jl,Al=["localhost",/^\/(?!\/).*$/];!function(e){e.InstrumentFetch="instrumentFetch",e.InstrumentXHR="instrumentXHR"}(jl||(jl={}));var Ll=function(){function e(){ll(this,e),this.fnList=[],this.get(),this.instrumentFetch(),this.instrumentXHR()}return fl(e,[{key:"get",value:function(){var e,t,n=sessionStorage.getItem("SL_LOGGER_SESSION_ID"),r=("log_session_id",e=document.cookie.split("; "),t={},e.forEach((function(e){var n=vl(e.split("="),2),r=n[0],o=n[1];r&&(t[r]=o||"")})),t.log_session_id||"");if(n)return n!==r&&this.updateId(n),n;var o=Tl();return this.updateId(o),o}},{key:"set",value:function(e){return!!e&&(this.updateId(e),this.fnList.forEach((function(t){return t(e)})),!0)}},{key:"refresh",value:function(){var e=Tl();return this.updateId(e),this.fnList.forEach((function(t){return t(e)})),!0}},{key:"onChange",value:function(e){this.fnList.push(e)}},{key:"updateId",value:function(e){sessionStorage.setItem("SL_LOGGER_SESSION_ID",e),function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",r="".concat(e,"=").concat(t);n&&(r+="; path=".concat(n)),document.cookie=r}("log_session_id",e)}},{key:"instrumentFetch",value:function(){if(window.fetch&&"function"==typeof window.fetch&&!0!==wl(jl.InstrumentFetch)){_l(jl.InstrumentFetch,!0);var e=this,t=window.fetch;window.fetch=function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];try{var a=vl(kl.apply(void 0,r),3),i=a[0],c=a[1],s=a[2],u=e.get();if(e.needAddHeader(i)){var l=s.headers;c&&(l=c.headers),l?"function"==typeof l.append?l.append("Log-Session-Id",u):l=Array.isArray(l)?[].concat(ul(l),[["Log-Session-Id",u]]):Object.assign(Object.assign({},l),yl({},"Log-Session-Id",u)):l=yl({},"Log-Session-Id",u),s.headers=l}}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("instrumentFetch error",e)}return t.apply(window,r)}}}},{key:"instrumentXHR",value:function(){if(window.XMLHttpRequest&&"function"==typeof window.XMLHttpRequest&&!0!==wl(jl.InstrumentXHR)){_l(jl.InstrumentXHR,!0);var e=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];try{var o=n[1],a="string"==typeof o?o:o.toString();this.__logger_xhr_info__={url:a}}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("instrumentXHR open error",e)}return e.apply(this,n)};var t=this,n=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){var e;try{var r=t.get();t.needAddHeader((null===(e=this.__logger_xhr_info__)||void 0===e?void 0:e.url)||"")&&this.setRequestHeader("Log-Session-Id",r)}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("instrumentXHR send error",e)}for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n.apply(this,a)}}}},{key:"needAddHeader",value:function(e){return Al.some((function(t){return t instanceof RegExp?t.test(e):"string"==typeof t&&-1!==e.indexOf(t)}))}}]),e}();hl([gl("")],Ll.prototype,"get",null),hl([gl(!1)],Ll.prototype,"set",null),hl([gl(!1)],Ll.prototype,"refresh",null),hl([gl()],Ll.prototype,"onChange",null),hl([gl()],Ll.prototype,"updateId",null);var Dl=new Ll,Nl=function(){function e(){ll(this,e),this.fnList=[],this.get()}return fl(e,[{key:"get",value:function(){var e=localStorage.getItem("SL_LOGGER_CLIENT_ID");if(e)return e;var t=Tl();return this.set(t),t}},{key:"set",value:function(e){return!!e&&(localStorage.setItem("SL_LOGGER_CLIENT_ID",e),this.fnList.forEach((function(t){return t(e)})),!0)}},{key:"refresh",value:function(){var e=Tl();return this.set(e),!0}},{key:"onChange",value:function(e){this.fnList.push(e)}}]),e}();hl([gl("")],Nl.prototype,"get",null),hl([gl(!1)],Nl.prototype,"set",null),hl([gl(!1)],Nl.prototype,"refresh",null),hl([gl()],Nl.prototype,"onChange",null);var Bl=new Nl,Ml=function(){function e(t){ll(this,e),this.options={owner:"",action:"",tags:{},getTagsFn:[],data:{},getDataFn:[],transports:[]},this.options=Object.assign(Object.assign({},this.options),t)}return fl(e,[{key:"withOwner",value:function(e){return new this.constructor(Object.assign(Object.assign({},this.options),{owner:e}))}},{key:"pipeOwner",value:function(e){if(!e)return this;var t;return t=this.options.owner?"".concat(this.options.owner,".").concat(e):e,new this.constructor(Object.assign(Object.assign({},this.options),{owner:t}))}},{key:"withAction",value:function(e){return new this.constructor(Object.assign(Object.assign({},this.options),{action:e}))}},{key:"pipeTags",value:function(e){return e?"function"==typeof e?new this.constructor(Object.assign(Object.assign({},this.options),{getTagsFn:[].concat(ul(this.options.getTagsFn),[e])})):new this.constructor(Object.assign(Object.assign({},this.options),{tags:Object.assign(Object.assign({},this.options.tags),e)})):this}},{key:"pipeData",value:function(e){return e?"function"==typeof e?new this.constructor(Object.assign(Object.assign({},this.options),{getDataFn:[].concat(ul(this.options.getDataFn),[e])})):new this.constructor(Object.assign(Object.assign({},this.options),{data:Object.assign(Object.assign({},this.options.data),e)})):this}},{key:"pipeTransport",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this.options.transports.concat(t);return new this.constructor(Object.assign(Object.assign({},this.options),{transports:r}))}},{key:"report",value:function(e,t,n){var r=function(e){var t,n=e.level,r=e.message,o=e.context,a=e.options,i=bl(a.getTagsFn),c=bl(a.getDataFn),s=Object.assign(Object.assign({level:n,owner:a.owner,action:a.action},o),{tags:Object.assign(Object.assign({},a.tags),i),data:Object.assign(Object.assign({},a.data),c),message:r});return(null==o?void 0:o.data)&&(t=o.data,"[object Object]"===Object.prototype.toString.call(t))?s.data=Object.assign(Object.assign({},s.data),o.data):void 0!==(null==o?void 0:o.data)&&(s.data=Object.assign(Object.assign({},s.data),{custom_data:o.data})),o&&"tags"in o&&o.tags&&(s.tags=Object.assign(Object.assign({},s.tags),o.tags)),o&&"errorLevel"in o&&o.errorLevel&&(s.tags=Object.assign(Object.assign({},s.tags),{errorLevel:o.errorLevel})),s}({level:e,message:t,context:n,options:this.options});!function(e,t){var n=e;t.forEach((function(e){var t=e(n);t&&(n=t)}))}(r,this.options.transports)}},{key:"info",value:function(e,t){this.report(il.Info,e,t)}},{key:"log",value:function(e,t){this.report(il.Log,e,t)}},{key:"warn",value:function(e,t){this.report(il.Warn,e,t)}},{key:"error",value:function(e,t){this.report(il.Error,e,t)}}]),e}();hl([gl(new Ml)],Ml.prototype,"withOwner",null),hl([gl(new Ml)],Ml.prototype,"pipeOwner",null),hl([gl(new Ml)],Ml.prototype,"withAction",null),hl([gl(new Ml)],Ml.prototype,"pipeTags",null),hl([gl(new Ml)],Ml.prototype,"pipeData",null),hl([gl(new Ml)],Ml.prototype,"pipeTransport",null),hl([gl(new Ml)],Ml.prototype,"info",null),hl([gl(new Ml)],Ml.prototype,"log",null),hl([gl(new Ml)],Ml.prototype,"warn",null),hl([gl(new Ml)],Ml.prototype,"error",null);var Rl=new Ml;function Fl(e){return" ","",(e||"@sl/logger").replace(new RegExp(" ","g"),"")}Object.defineProperty(Rl,"options",{writable:!1,configurable:!1});var Ul,Hl,ql=Rl.pipeTransport((function(e){var t,n,r,o,a=e.level,i=e.message,c=e.tags,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["level","message","tags"]),u=Object.assign(Object.assign({},s),{message:i,tags:Object.assign(Object.assign({},c),{sessionId:Dl.get(),clientId:Bl.get()})});switch(a){case il.Info:case il.Log:case il.Warn:null===(n=null===(t=window.__SL_Track__)||void 0===t?void 0:t.info)||void 0===n||n.call(t,Fl(s.owner),u);break;case il.Error:null===(o=null===(r=window.__SL_Track__)||void 0===r?void 0:r.error)||void 0===o||o.call(r,Fl(s.owner),u);break;default:window[window.__sl_console__?"__sl_console__":"console"].error("不是期望的上报类型",a,i,s)}})).pipeOwner("button-kits"),Gl=ql;function Yl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vl(e,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function zl(e,t,n){return t&&Vl(e.prototype,t),n&&Vl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}!function(e){e.GET="GET",e.POST="POST"}(Ul||(Ul={})),function(e){e.FORM="form"}(Hl||(Hl={}));var Wl=function(){function e(){Yl(this,e),n(this,"handlers",[])}return zl(e,[{key:"use",value:function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){this.handlers.forEach((function(t){null!==t&&e(t)}))}}]),e}(),Kl=Wl,Xl=function(e){return e&&el(e)?Object.entries(e).map((function(e){var t=Qu(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(encodeURIComponent(r))})).join("&"):""};var Jl=function(e,t){return el(t)?function(e,t){if(!t)return e;var n=e.indexOf("#"),r=-1===n?"":e.substr(n);return e=-1===n?e:e.substr(0,n),Object.entries(t).forEach((function(t){var n=Qu(t,2),r=n[0],o=n[1],a=new RegExp("([?&])".concat(r,"=.*?(&|$)"),"i"),i=-1!==e.indexOf("?")?"&":"?";null===o?("?"===(e=e.replace(new RegExp("([?&]?)".concat(r,"=[^&]*"),"i"),"")).slice(-1)&&(e=e.slice(0,-1)),-1===e.indexOf("?")&&(e=e.replace(/&/,"?"))):e=e.match(a)?e.replace(a,"$2".concat(r,"=").concat(o,"$3")):"".concat(e+i+r,"=").concat(o)})),e+r}(e,t):e};function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$l(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ql={Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},ed=function(){function e(t){Yl(this,e),n(this,"options",{}),n(this,"interceptors",{request:new Kl,response:new Kl}),this.options=t||{}}return zl(e,[{key:"post",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.requestType,o=Ql["Content-Type"],a=t||n.data||null;r===Hl.FORM?(o="application/x-www-form-urlencoded;charset=UTF-8",a=a?Xl(a):null):a=a?JSON.stringify(a):null;var i=Zl(Zl(Zl({},Ql),n.headers),{},{"Content-Type":o});return this.send(e,Zl(Zl({method:Ul.POST,body:a},n),{},{headers:i}))}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Jl(e,t.params);var n=Zl(Zl({},Ql),t.headers);return this.send(e,Zl(Zl({},t),{},{method:Ul.GET,headers:n}))}},{key:"send",value:function(e){var t,n,r,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[];null===(t=this.interceptors)||void 0===t||null===(n=t.request)||void 0===n||n.forEach((function(e){i.unshift(e.fulfilled,e.rejected)}));var c,s=[];null===(r=this.interceptors)||void 0===r||null===(o=r.response)||void 0===o||o.forEach((function(e){s.push(e.fulfilled,e.rejected)}));for(var u=a;i.length;){var l=i.shift(),d=i.shift();try{l&&(u=l(u))}catch(e){d&&d(e);break}}for(c=this.request(e,u);s.length;){var f=s.shift(),p=s.shift();c=c.then(f,p)}return c}},{key:"request",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.assign({},this.options,t),r=n.method,o=n.baseUrl,a=n.headers,i=n.body,c=n.timeout;return new Promise((function(n,s){var u=new window.XMLHttpRequest,l=o&&!/^(https?:)?(\/\/)/.test(e)?[o,e].join(e.startsWith("/")?"":"/"):e;u.open(r||Ul.GET,l),a&&Object.entries(a).forEach((function(e){var t=Qu(e,2),n=t[0],r=t[1];return r&&u.setRequestHeader(n,r)}));var d={options:t,url:l};u.addEventListener("load",(function(){d.statusCode=u.status;var e=u.getResponseHeader("Content-Type"),t=u.responseText,r="";if(null!=e&&e.includes("application/json"))try{r=JSON.parse(t)}catch(e){r=t}else r=t;200==u.status?n(Zl({data:r},d)):s(Zl({data:r},d))})),u.addEventListener("abort",(function(e){d.statusCode=u.status,s(Zl({error:e},d))})),u.addEventListener("error",(function(e){d.statusCode=u.status,s(Zl({error:e},d))})),u.send(i),c&&setTimeout((function(){u.abort();var e=new Error("XMLHttpRequest timeout");d.statusCode=u.status,s(Zl({error:e},d))}),c)}))}}]),e}();function td(e){return function(e){if(Array.isArray(e))return $u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Zu(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var nd=new Map([["for","htmlFor"],["class","className"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["usemap","useMap"],["frameborder","frameBorder"]]);function rd(e){return e.nodeType===Node.ELEMENT_NODE}function od(e){return e.nodeType===Node.TEXT_NODE}function ad(e){return e.nodeType===Node.COMMENT_NODE}function id(e){return"INPUT"===e.nodeName}var cd,sd=function(){function e(t){Yl(this,e),this.elems=t}return zl(e,[{key:"get",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.elems[e]}},{key:"size",value:function(){var e;return(null===(e=this.elems)||void 0===e?void 0:e.length)||0}},{key:"isEmpty",value:function(){return 0===this.elems.length}},{key:"each",value:function(e){return this.elems.forEach(e),this}},{key:"html",value:function(e){var t=this.elems;return void 0===e?t[0]&&rd(t[0])?t[0].innerHTML:null:(t.filter(rd).forEach((function(t){return t.innerHTML=e})),this)}},{key:"attr",value:function(e,t){var n=this.elems,r=nd.has(e)?nd.get(e):e;if(void 0===t){var o=n[0];return!o||od(o)||ad(o)?void 0:o[r]||o.getAttribute(r)}return n.filter((function(e){return!od(e)&&!ad(e)})).forEach((function(e){return e.setAttribute(r,t)})),this}},{key:"val",value:function(e){var t=this.elems;return void 0===e?t[0]&&id(t[0])?t[0].value:null:(t.filter(id).forEach((function(t){return t.value=e})),this)}},{key:"append",value:function(e){var t=this.elems;if(1===t.length){var n=t[0];e.each((function(e){return n.appendChild(e)}))}else t.length>1&&t.forEach((function(t){e.each((function(e){var n=document.createElement("div");n.appendChild(e),n.innerHTML=n.innerHTML,n.firstChild&&t.appendChild(n.firstChild)}))}));return this}},{key:"remove",value:function(){return this.elems.forEach((function(e){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)})),this}},{key:"parents",value:function(t){var n=this.get(),r=[];if(n){for(var o=n;o&&o!==document.body;){var a;if(o.parentElement&&(o=o.parentElement),t){if(null!==(a=o)&&void 0!==a&&a.matches(t)){r=[o];break}}else o&&r.push(o)}return new e(r)}return new e([])}}]),e}();function ud(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=document.createElement(e);return n.length&&(t=o.classList).add.apply(t,td(n)),r&&(o.innerHTML=r),o}var ld="shopline-payment-button--service-unavailable-countdown",dd="unavailable_ts_",fd=(n(cd={},De.NetworkUnstable,{text:"sdk.button.unavailable.network_unstable",seconds:!1}),n(cd,De.RateLimited,{text:"sdk.button.unavailable.wait_and_retry",seconds:!0}),cd),pd="pay-button-common-unavailable-style-id",hd=function(){var e,t;if(!document.getElementById(pd)){var n=document.createElement("style");n.setAttribute("id",pd);var r=null!==(e=null===(t=window.Shopline.theme)||void 0===t?void 0:t.btn_border_radius)&&void 0!==e?e:4;n.innerHTML="\n    .".concat(ld," {\n      border: 1px solid #EEB96B;\n      padding: 8px 12px;\n      display: flex;\n      align-items: flex-start; \n      background: #FFF8E5;\n      border-radius: ").concat(r,"px;\n      margin-bottom: 5px;\n    }\n    .").concat(ld," .icon {\n      flex: 0 0 auto; \n      width: 18px;\n      color: #F79E1B;\n      height: 18px;\n      display: flex;\n      align-items: flex-start;\n      justify-content: flex-start;\n    }\n    .").concat(ld," .content {\n      margin-left: 8px;\n      word-break: break-word;\n      text-align: left;\n    }\n  "),document.body.appendChild(n)}};function yd(e){return Gu.includes(e)}var vd=function(){function e(t){Yl(this,e),n(this,"intervalId",null),n(this,"message",{element:null}),this.instance=t}return zl(e,[{key:"calculateRandomDelay",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=Math.max(1,e-t),r=e+t;return Math.floor(Math.random()*(r-n+1))+n}},{key:"recordTimestamp",value:function(e,t){if(e)try{var n={startTs:Date.now(),duration:t};localStorage.setItem("".concat(dd).concat(e),JSON.stringify(n))}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("Failed to record countdown data to localStorage:",e)}}},{key:"readStoredData",value:function(e){if(!e)return null;try{var t=localStorage.getItem("".concat(dd).concat(e));if(t){var n=JSON.parse(t);if("number"==typeof n.startTs&&"number"==typeof n.duration)return n}}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("Failed to read or parse countdown data from localStorage:",e)}return null}},{key:"clearStoredData",value:function(e){if(e)try{localStorage.removeItem("".concat(dd).concat(e))}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error("Failed to clear countdown data from localStorage:",e)}}},{key:"clearCurrentCountdownState",value:function(){if(this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.message.element){this.message.element.remove();var e=this.instance.getContainer();this.containerRemoveCountdownMessage(e),this.message={element:null,type:void 0}}}},{key:"updateCountdownMessage",value:function(e){var t=this.instance.getPayButton(),n=null==t?void 0:t.getI18nTranslator();if(this.message.element&&this.message.type&&yd(this.message.type)&&n){var r=Math.max(1,Math.ceil(e)),o=fd[this.message.type],a=o.seconds?n(o.text,{seconds:r}):n(o.text);this.message.element.textContent=a}}},{key:"containerRemoveCountdownMessage",value:function(e){Array.from(e.getElementsByClassName(ld)).forEach((function(e){return e.remove()}))}},{key:"renderCountdownMessage",value:function(e,t){this.containerRemoveCountdownMessage(e);var n=ud("div",[ld,Ei.COMMON_ITEM_LAYOUT,"body5","text-center","notranslate"]),r=ud("span",["icon"],'\n<svg viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8 2.40039C4.90721 2.40039 2.40039 4.90721 2.40039 8C2.40039 11.0928 4.90721 13.5996 8 13.5996C11.0928 13.5996 13.5996 11.0928 13.5996 8C13.5996 4.90721 11.0928 2.40039 8 2.40039ZM8 10.6504C8.47971 10.6506 8.89546 11.0529 8.89941 11.5459C8.89566 12.0466 8.47983 12.45 8 12.4502C7.50518 12.45 7.09586 12.0466 7.09961 11.5459C7.09606 11.0529 7.5053 10.6506 8 10.6504ZM8 4C8.44176 4 8.7997 4.35807 8.7998 4.7998V9C8.7998 9.44183 8.44183 9.7998 8 9.7998C7.55835 9.79959 7.2002 9.4417 7.2002 9V4.7998C7.2003 4.3582 7.55842 4.00021 8 4Z" />\n</svg>\n'),o=ud("div",["content"]);return n.append(r,o),e.insertBefore(n,e.firstChild),this.message.element=o,this.updateCountdownMessage(t),n}},{key:"setPayButtonDisabled",value:function(e){var t=this.instance.getPayButton();[Ii.BUY_NOW,Ii.MORE_OPTIONS].forEach((function(n){var r=null==t?void 0:t.getButtonElement(n);r&&r.forEach((function(t){t.classList.toggle("unavailable--disabled",e),e?t.setAttribute("disabled",String(e)):t.removeAttribute("disabled")}))})),null==t||t.setDisabled(e)}},{key:"startCountdownInterval",value:function(e,t){var n=this;this.setPayButtonDisabled(!0),this.updateCountdownMessage(e),this.intervalId=setInterval((function(){e--,n.updateCountdownMessage(e),e<=0&&(n.clearCurrentCountdownState(),n.clearStoredData(t),n.setPayButtonDisabled(!1))}),1e3),this.message.element&&this.message.type===De.RateLimited&&(this.message.element.dataset.intervalId=String(this.intervalId))}},{key:"restore",value:function(e){this.clearCurrentCountdownState();var t=this.readStoredData(e||"");if(t){var n=(Date.now()-t.startTs)/1e3,r=t.duration-n;if(r>0){var o=this.instance.getContainer();return this.renderCountdownMessage(o,r),this.startCountdownInterval(r,e),!0}this.clearStoredData(e)}return!1}},{key:"start",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,o=this.instance.getContainer();if(hd(),t===De.NetworkUnstable)return this.message.type=t,void this.renderCountdownMessage(o,0);this.clearCurrentCountdownState();var a=this.calculateRandomDelay(n,r);this.message.type=t,this.recordTimestamp(e,a),this.renderCountdownMessage(o,a),this.startCountdownInterval(a,e)}}]),e}();function md(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function gd(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){md(a,r,o,i,c,"next",e)}function c(e){md(a,r,o,i,c,"throw",e)}i(void 0)}))}}var bd={},wd={get exports(){return bd},set exports(e){bd=e}},_d={},Od={get exports(){return _d},set exports(e){_d=e}};!function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Od),function(e){var t=_d.default;function n(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
e.exports=n=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var r={},o=Object.prototype,a=o.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),c=new I(r||[]);return i(a,"_invoke",{value:k(e,n,c)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=f;var h={};function y(){}function v(){}function m(){}var g={};d(g,s,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(E([])));w&&w!==o&&a.call(w,s)&&(g=w);var _=m.prototype=y.prototype=Object.create(g);function O(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,n){function r(o,i,c,s){var u=p(e[o],e,i);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==t(d)&&a.call(d,"__await")?n.resolve(d.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):n.resolve(d).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,t){function a(){return new n((function(n,o){r(e,t,n,o)}))}return o=o?o.then(a,a):a()}})}function k(e,t,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return T()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var c=S(i,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=p(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function S(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,h;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function E(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:T}}function T(){return{value:void 0,done:!0}}return v.prototype=m,i(_,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:v,configurable:!0}),v.displayName=d(m,l,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,d(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},r.awrap=function(e){return{__await:e}},O(C.prototype),d(C.prototype,u,(function(){return this})),r.AsyncIterator=C,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new C(f(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},O(_),d(_,l,"Generator"),d(_,s,(function(){return this})),d(_,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},r.values=E,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(wd);var Cd=bd(),kd=Cd;try{regeneratorRuntime=Cd}catch(t){"object"===("undefined"==typeof globalThis?"undefined":e(globalThis))?globalThis.regeneratorRuntime=Cd:Function("r","regeneratorRuntime = r")(Cd)}var Sd,Pd=Gl.pipeOwner("button-common.toast"),xd={open:(Sd=gd(kd.mark((function e(t){var n,r,o,a,i,c;return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=null===(n=window.Shopline)||void 0===n||null===(r=n.utils)||void 0===r||null===(o=r.toast)||void 0===o?void 0:o.open,Boolean(s)&&"function"==typeof s){e.next=3;break}return e.next=3,new Promise((function(e,t){window.Shopline.loadFeatures([{name:"component-toast",version:"0.1"}],(function(n){n&&t(n),e("")}))})).catch((function(e){Pd.error("加载toast模块出错",{error:e})}));case 3:null===(a=window.Shopline)||void 0===a||null===(i=a.utils)||void 0===i||null===(c=i.toast)||void 0===c||c.open({content:t});case 4:case"end":return e.stop()}var s}),e)}))),function(e){return Sd.apply(this,arguments)})};function Id(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ed(e){return function(e){if(Array.isArray(e))return Id(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Id(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Id(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Td(e){return Td="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Td(e)}function jd(e){return jd="function"==typeof Symbol&&"symbol"==Td(Symbol.iterator)?function(e){return Td(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":Td(e)},jd(e)}function Ad(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ld(e){var t=function(e,t){if("object"!=jd(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=jd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==jd(t)?t:t+""}function Dd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ld(r.key),r)}}function Nd(e,t,n){return t&&Dd(e.prototype,t),n&&Dd(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Bd,Md={exports:{}},Rd={exports:{}};function Fd(){return Bd||(Bd=1,(e=Rd).exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports),Rd.exports;var e}Rd.exports;var Ud,Hd,qd={exports:{}},Gd={exports:{}};function Yd(){return Ud||(Ud=1,function(e){function t(n,r,o,a){var i=Object.defineProperty;try{i({},"",{})}catch(n){i=0}e.exports=t=function(e,n,r,o){function a(n,r){t(e,n,(function(e){return this._invoke(n,r,e)}))}n?i?i(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(a("next",0),a("throw",1),a("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,a)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Gd)),Gd.exports}function Vd(){return Hd||(Hd=1,function(e){var t=Yd();function n(){var r,o,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.toStringTag||"@@toStringTag";function s(e,n,a,i){var c=n&&n.prototype instanceof l?n:l,s=Object.create(c.prototype);return t(s,"_invoke",function(e,t,n){var a,i,c,s=0,l=n||[],d=!1,f={p:0,n:0,v:r,a:p,f:p.bind(r,4),d:function(e,t){return a=e,i=0,c=r,f.n=t,u}};function p(e,t){for(i=e,c=t,o=0;!d&&s&&!n&&o<l.length;o++){var n,a=l[o],p=f.p,h=a[2];e>3?(n=h===t)&&(c=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=r):a[0]<=p&&((n=e<2&&p<a[1])?(i=0,f.v=t,f.n=a[1]):p<h&&(n=e<3||a[0]>t||t>h)&&(a[4]=e,a[5]=t,f.n=h,i=0))}if(n||e>1)return u;throw d=!0,t}return function(n,l,h){if(s>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,h),i=l,c=h;(o=i<2?r:c)||!d;){a||(i?i<3?(i>1&&(f.n=-1),p(i,c)):f.n=c:f.v=c);try{if(s=2,a){if(i||(n="next"),o=a[n]){if(!(o=o.call(a,c)))throw TypeError("iterator result is not an object");if(!o.done)return o;c=o.value,i<2&&(i=0)}else 1===i&&(o=a.return)&&o.call(a),i<2&&(c=TypeError("The iterator does not provide a '"+n+"' method"),i=1);a=r}else if((o=(d=f.n<0)?c:e.call(t,f))!==u)break}catch(e){a=r,i=1,c=e}finally{s=1}}return{value:o,done:d}}}(e,a,i),!0),s}var u={};function l(){}function d(){}function f(){}o=Object.getPrototypeOf;var p=[][i]?o(o([][i]())):(t(o={},i,(function(){return this})),o),h=f.prototype=l.prototype=Object.create(p);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,t(e,c,"GeneratorFunction")),e.prototype=Object.create(h),e}return d.prototype=f,t(h,"constructor",f),t(f,"constructor",d),d.displayName="GeneratorFunction",t(f,c,"GeneratorFunction"),t(h),t(h,c,"Generator"),t(h,i,(function(){return this})),t(h,"toString",(function(){return"[object Generator]"})),(e.exports=n=function(){return{w:s,m:y}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(qd)),qd.exports}Gd.exports,qd.exports;var zd,Wd,Kd,Xd={exports:{}},Jd={exports:{}},$d={exports:{}};function Zd(){return zd||(zd=1,e=$d,t=Fd(),n=Yd(),e.exports=function e(r,o){function a(e,n,i,c){try{var s=r[e](n),u=s.value;return u instanceof t?o.resolve(u.v).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):o.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return a("throw",e,i,c)}))}catch(e){c(e)}}var i;this.next||(n(e.prototype),n(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),n(this,"_invoke",(function(e,t,n){function r(){return new o((function(t,r){a(e,n,t,r)}))}return i=i?i.then(r,r):r()}),!0)},e.exports.__esModule=!0,e.exports.default=e.exports),$d.exports;var e,t,n}function Qd(){return Wd||(Wd=1,e=Jd,t=Vd(),n=Zd(),e.exports=function(e,r,o,a,i){return new n(t().w(e,r,o,a),i||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports),Jd.exports;var e,t,n}$d.exports,Jd.exports,Xd.exports;var ef,tf={exports:{}};tf.exports;var nf,rf,of,af,cf,sf={exports:{}},uf={exports:{}};function lf(){return rf||(rf=1,e=sf,t=(nf||(nf=1,function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==Td(Symbol.iterator)?function(e){return Td(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":Td(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(uf)),uf.exports).default,e.exports=function(e){if(null!=e){var n=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(t(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports),sf.exports;var e,t}function df(){return of||(of=1,function(e){var t=Fd(),n=Vd(),r=function(){return Kd||(Kd=1,e=Xd,t=Qd(),e.exports=function(e,n,r,o,a){var i=t(e,n,r,o,a);return i.next().then((function(e){return e.done?e.value:i.next()}))},e.exports.__esModule=!0,e.exports.default=e.exports),Xd.exports;var e,t}(),o=Qd(),a=Zd(),i=function(){return ef||(ef=1,(e=tf).exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports),tf.exports;var e}(),c=lf();function s(){var u=n(),l=u.m(s),d=(Object.getPrototypeOf?Object.getPrototypeOf(l):l.__proto__).constructor;function f(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function h(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,a){return t.resultName=o,n(r.d,c(e),a)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=s=function(){return{wrap:function(e,t,n,r){return u.w(h(e),t,n,r&&r.reverse())},isGeneratorFunction:f,mark:u.m,awrap:function(e,n){return new t(e,n)},AsyncIterator:a,async:function(e,t,n,a,i){return(f(t)?o:r)(h(e),t,n,a,i)},keys:i,values:c}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}(Md)),Md.exports}uf.exports,sf.exports,Md.exports;var ff,pf,hf=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(function(){if(cf)return af;cf=1;var e=df()();af=e;try{regeneratorRuntime=e}catch(t){"object"==("undefined"==typeof globalThis?"undefined":Td(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return af}());function yf(e){return"undefined"!=typeof window&&e===window||"[object Window]"===Object.prototype.toString.call(e)}function vf(e){var t=[];return e.replace(/([^[.\]]+)|\[(\d+)\]/g,(function(e,n,r){return void 0!==n?t.push(n):void 0!==r&&t.push(Number(r)),""})),t}"function"==typeof SuppressedError&&SuppressedError,function(e){e.GET="get",e.SET="set"}(ff||(ff={})),function(e){e.OBJECT="object",e.REQUEST="request"}(pf||(pf={}));var mf=Nd((function e(t){Ad(this,e),this.pendingPayloads=[],this.flushTimer=null,this.options=t,this.logger=t.logger}),[{key:"report",value:function(e){var t,n,r=this;if(this.pendingPayloads.push(e),null===(n=null===(t=this.logger)||void 0===t?void 0:t.info)||void 0===n||n.call(t,"[Patrol] report",{data:e}),this.pendingPayloads.length>=100)this.flush();else{this.flushTimer||(this.flushTimer=setTimeout((function(){return r.flush()}),this.options.flushInterval||3e3));try{this.options.metricFn&&this.options.metricFn(e)}catch(e){}}}},{key:"sendBatch",value:function(e,t){var n=t.map((function(e){return{type:e.sourceType,labelMap:{domain:e.domain,field:e.field,operation:e.operation,url:e.url,deduceStack:e.deduceStack}}})),r=JSON.stringify({data:n}),o=new Blob([r],{type:"application/json"});"undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon?navigator.sendBeacon(e,o):fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}).catch((function(){}))}},{key:"flush",value:function(){var e,t;this.pendingPayloads.length>0&&(null===(t=null===(e=this.logger)||void 0===e?void 0:e.log)||void 0===t||t.call(e,"[Patrol] log empty",{}),this.options.metricApi&&this.sendBatch(this.options.metricApi,this.pendingPayloads),this.pendingPayloads.length=0),this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null)}}]);function gf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var bf=Nd((function e(){var t,n,r,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ad(this,e),this.requestTargets=[],this.options=Object.assign(Object.assign({},o),{maxDepth:null!==(t=o.maxDepth)&&void 0!==t?t:2,sampleRate:null!==(n=o.sampleRate)&&void 0!==n?n:.3}),this.patchNetwork();var a=null===(r=o.logger)||void 0===r?void 0:r.pipeOwner("vatchdog");this.reporter=new mf({logger:a,metricFn:o.metricFn,metricApi:o.metricApi}),this.logger=a}),[{key:"watch",value:function(e){var t=this,n=Array.isArray(e)?e:[e],r=[];n.forEach((function(e){e.sourceType===pf.REQUEST?t.requestTargets.push(e):r.push(e)})),this.watchObject(r)}},{key:"watchObject",value:function(e){var t=this;e.forEach((function(e){var n,r,o,a;if(yf(e.source))null===(n=t.logger)||void 0===n||n.warn("[Patrol] source is window",{data:e});else if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(e.source))if(e.sourceType!==pf.REQUEST||e.requestApi){if(function(e){return void 0!==e&&(e>=1||Math.random()<=e)}(t.options.sampleRate)){var i,c=new WeakMap,s=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return gf(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gf(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw a}}}}(Array.isArray(e.fields)&&e.fields.length>0?e.fields:Object.keys(e.source));try{for(s.s();!(i=s.n()).done;){var u=i.value;try{t.walkAndWatch({obj:e.source,pathArr:vf(u),depth:0,seen:c,target:e,parentPath:[u],domain:e.domain})}catch(n){null===(a=t.logger)||void 0===a||a.warn("[Patrol] cycle detected or error",{data:{item:e,error:n}})}}}catch(e){s.e(e)}finally{s.f()}}}else null===(o=t.logger)||void 0===o||o.warn("[Patrol] request sourceType must provide requestApi",{data:e});else null===(r=t.logger)||void 0===r||r.warn("[Patrol] source is not an object",{data:e})}))}},{key:"patchNetwork",value:function(){this.patchFetch()}},{key:"patchFetch",value:function(){if(!window.__PatrolFetchPatched__){window.__PatrolFetchPatched__=!0;var e=window.fetch,t=this;window.fetch=function(n){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(o.method||"GET").toUpperCase();return r="string"==typeof n?n:n instanceof Request?n.url:"undefined"!=typeof URL&&n instanceof URL?n.href:String(n),e(n,o).then((function(e){if(e.__PatrolPatched__)return e;e.__PatrolPatched__=!0;for(var n=function(){var n=i[o];if("function"==typeof e[n]){var c=e[n].bind(e);e[n]=function(){return function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,hf.mark((function e(){var n;return hf.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,c();case 1:return n=e.sent,t.handleResponse({method:a,url:r,data:n}),e.abrupt("return",n);case 2:case"end":return e.stop()}}),e)})))}}},o=0,i=["json","text","blob","arrayBuffer","formData"];o<i.length;o++)n();return e}))}}}},{key:"handleResponse",value:function(e){var t=e.method,n=e.url,r=e.data,o=this.requestTargets.find((function(e){var r,o=null===(r=e.requestApi)||void 0===r?void 0:r.split(":");if(null==o?void 0:o.length){var a=o[0],i=o[1];return e.sourceType===pf.REQUEST&&t===a&&i&&n.includes(i)}}));o&&this.watchObject([Object.assign(Object.assign({},o),{source:r})])}},{key:"walkAndWatch",value:function(e){var t,n,r=this,o=e.obj,a=e.pathArr,i=e.depth,c=e.seen,s=e.target,u=e.parentPath,l=e.domain;if(!(void 0!==this.options.maxDepth&&i>this.options.maxDepth))if(yf(o))null===(t=this.logger)||void 0===t||t.warn("[Patrol] source is window",{data:o});else if("object"===jd(o)&&null!==o){var d=a[0];if(void 0!==d){var f=o[d];if("object"===jd(f)&&null!==f){if(c.has(f))return void(null===(n=this.logger)||void 0===n||n.warn("[Patrol] cycle detected",{data:f}));c.set(f,!0)}1===a.length?(this.definePatrolProperty(o,d,s,u,l),void 0!==this.options.maxDepth&&i<this.options.maxDepth&&"object"===jd(f)&&null!==f&&Object.keys(f).forEach((function(e){r.walkAndWatch({obj:f,pathArr:[e],depth:i+1,seen:c,target:s,domain:l,parentPath:[].concat(Ed(u),[e])})}))):"object"===jd(f)&&null!==f&&this.walkAndWatch({obj:f,pathArr:a.slice(1),depth:i+1,seen:c,target:s,domain:l,parentPath:[].concat(Ed(u),[d])})}}}},{key:"definePatrolProperty",value:function(e,t,n,r,o){var a,i=this,c=String(t),s=Object.getOwnPropertyDescriptor(e,c);if(!(s&&s.get&&s.set)||s.configurable){var u=e[c],l=!1!==n.readable,d=!1!==n.writable,f=null!==(a=n.operations)&&void 0!==a?a:[ff.GET],p=r.join("."),h=function(e,t){var r,a=i.getStack(),c=function(e){if(e)for(var t=e.split("\n").map((function(e){return e.trim()})).filter(Boolean),n=/(https?:\/\/[^\s)]+:\d+:\d+|file:\/\/\/[^\s)]+:\d+:\d+)/,r=t.length-1;r>=0;r--){var o=t[r],a=null==o?void 0:o.match(n);if(a)return a[1]}}(a);i.report({sourceType:null!==(r=n.sourceType)&&void 0!==r?r:pf.OBJECT,requestApi:n.requestApi,field:p,url:"undefined"!=typeof window&&window.location?window.location.href:"",operation:e,value:t.value,oldValue:t.oldValue,stack:a,deduceStack:c,domain:n.sourceType===pf.REQUEST?"".concat(o," ").concat(n.requestApi):o})};Object.defineProperty(e,c,{configurable:!0,enumerable:!0,get:function(){if(l)return f.includes(ff.GET)&&h(ff.GET,{value:u}),u;h(ff.GET,{value:void 0})},set:function(e){d?(f.includes(ff.SET)&&h(ff.SET,{value:e,oldValue:u}),u=e):h(ff.SET,{value:e,oldValue:u})}})}}},{key:"report",value:function(e){this.reporter.report(e)}},{key:"getStack",value:function(){try{throw new Error}catch(e){return e instanceof Error&&e.stack?e.stack:""}}}]);function wf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wf(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Of=new bf({logger:Gl,metricApi:"/api/bff-web/trade/metric/report/variable",sampleRate:.3}),Cf={sourceType:pf.OBJECT,operations:[ff.SET,ff.GET],fields:[]},kf="trade_button-kits";Of.watch([_f({source:window.__tradeSettleConfig__,domain:"".concat(kf,"_window.__tradeSettleConfig__")},Cf),_f({source:window.__paymentButtonConfig__,domain:"".concat(kf,"_window.__paymentButtonConfig__")},Cf)]);var Sf={getPayButtonStyle:function(e){var t=document.createElement("div");t.style.opacity="0",t.innerHTML='\n    <button type="button" class="button button--secondary">\n      <span>fake button</span>\n    </button>\n  ',e.append(t);var n=t.offsetHeight,r=0,o=t.children[0];return o&&(r=parseInt(window.getComputedStyle(o).getPropertyValue("border-radius"))),t.remove(),{height:n,borderRadius:r}},getContainerId:function(e,t){var r;if(e.id)return e.id;var o=(n(r={},Pi.ProductDetail,"payment_button_".concat(tl())),n(r,Pi.Cart,"additional_button_".concat(tl())),n(r,Pi.Checkout,"alternative_button_".concat(tl())),r)[t];return e.id=o,o},getPaymentConfig:function(e){var t,n=function(e){var t,n,r;return e?Hi(Hi({},e),{},{buttonLocationDataList:null!==(t=null===(n=e.buttonLocationDataList)||void 0===n||null===(r=n.map)||void 0===r?void 0:r.call(n,(function(e){var t,n,r;return Hi(Hi({},e),{},{buttonTypeDataList:null!==(t=null===(n=e.buttonTypeDataList)||void 0===n||null===(r=n.map)||void 0===r?void 0:r.call(n,(function(e){var t,n,r;return Hi(Hi({},e),{},{buttonNameDataList:null!==(t=null===(n=e.buttonNameDataList)||void 0===n||null===(r=n.map)||void 0===r?void 0:r.call(n,(function(e){return Hi({},e)})))&&void 0!==t?t:[]})})))&&void 0!==t?t:[]})})))&&void 0!==t?t:[]}):null}(window.__paymentButtonConfig__);if(!n||!n.buttonLocationDataList)return null;var r=null===(t=n.buttonLocationDataList)||void 0===t?void 0:t.find((function(t){return t.buttonLocation===e}));if(!r)return null;var o=rl(rl({},r),{},{buttonTraceId:n.buttonTraceId});return e===Pi.Cart&&(o.buttonTypeDataList=o.buttonTypeDataList.filter((function(e){return e.buttonType!==xi.Normal}))),o},getPaymentProps:function(){var e=window.__paymentButtonConfig__;return{expressOptimizationSwitch:(null==e?void 0:e.expressOptimizationSwitch)||!1,buttonTimeoutConfig:(null==e?void 0:e.buttonTimeoutConfig)||{enable:!0}}}},Pf={logger:Gl,patrol:Of,Request:ed,AJAX_CART:"/api/carts/ajax-cart",$:function(e){if("string"==typeof e){var t=document.querySelectorAll(e);return new sd(td(t))}return new sd([e])},toast:xd,utils:{isValidateJson:function(e){try{JSON.parse(e)}catch(e){return!1}return!0}}},xf=42,If=function(){window.magpieBridge||(window.magpieBridge={})},Ef=function(){If(),window.magpieBridge.promise||(window.magpieBridge.promise=new Promise((function(e){window.magpieBridge._resolve_=e})));var e="/cf-edge-static/5714c1327c4014a703e02b0f3cce0f74/magpie-bridge-sdk-load.js",t=0;return window.magpieBridge.isLoaded||(window.magpieBridge.isLoaded=!0,function n(){var r=document.createElement("script");r.src=e,r.defer=!0,r.type="module",r.crossOrigin="anonymous",document.body.appendChild(r),r.onerror=function(){t>3?window.magpieBridge.isLoaded=!1:(t++,n())}}()),window.magpieBridge.promise},Tf=function(){function e(){Yl(this,e),this._events={},this._caches={}}return zl(e,[{key:"addEventListener",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._events[e]||(this._events[e]=[]),t.once=n,this._events[e].push(t)}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this._events[e];this._caches[e]||(this._caches[e]=[]),this._caches[e].push(n),Array.isArray(o)&&(this._events[e]=o.filter((function(e){try{e.apply(void 0,n)}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error(e)}return!e.once})))}},{key:"on",value:function(e,t){this._caches[e]&&this._caches[e].forEach((function(e){try{t.apply(void 0,td(e))}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error(e)}})),this.addEventListener(e,t)}},{key:"once",value:function(e,t){if(this._caches[e]){var n=this._caches[e][0];try{t.apply(void 0,td(n))}catch(e){window[window.__sl_console__?"__sl_console__":"console"].error(e)}}else this.addEventListener(e,t,!0)}},{key:"off",value:function(e,t){this._events[e]=this._events[e].filter((function(e){return t!==e}))}}]),e}(),jf=function(){var e,t;If(),null!==(e=window)&&void 0!==e&&null!==(t=e.magpieBridge)&&void 0!==t&&t.event||(window.magpieBridge.event=new Tf)},Af={skuChanged:"Product::SkuChanged",updateCollectionSection:"Product::UpdateSection::Filter",miniCartOpen:"Cart::MiniCart::Open",miniCartClose:"Cart::MiniCart::Close",miniCartUpdate:"Cart::MiniCart::Update",recommendUpdate:"Product::Recommend::Update",quickAddClose:"Product::CloseQuickAdd::AddToCart",quickAddOpen:"Product::OpenQuickAdd::AddToCart",stageHeaderSticky:"Stage::Header::Sticky",bannerMiniCartClose:"Cart::BannerMiniCart::Close",bannerMiniCartOpen:"Cart::BannerMiniCart::Open",cartPageUpdate:"Cart::CartPage::Update"};If();var Lf=window.magpieBridge,Df=Pf.AJAX_CART,Nf=new(0,Pf.Request),Bf=function(){var e=gd(kd.mark((function e(){var t;return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Nf.get(Df);case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();function Mf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mf(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ff,Uf=Pf.logger,Hf=Pf.toast,qf=Uf.pipeOwner("additional-button"),Gf={};!function(e){e.Done="done",e.Pending="pending"}(Ff||(Ff={}));var Yf={action:null},Vf=function(){function e(t){var r=this;Yl(this,e),n(this,"payButton",null),n(this,"countdownManager",null),n(this,"render",gd(kd.mark((function e(){return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.renderButton();case 2:r.initializeAndRestoreCountdown();case 3:case"end":return e.stop()}}),e)})))),n(this,"initializeAndRestoreCountdown",(function(){r.countdownManager||(r.countdownManager=new vd(r));var e=r.getCartToken();e&&r.countdownManager.restore(e)})),n(this,"renderButton",gd(kd.mark((function e(){var t,n,o,a,i,c,s,u;return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.payButton){e.next=2;break}return e.abrupt("return");case 2:if(qf.info("render button"),t=r.container,n=Sf.getContainerId(t,Pi.Cart),o=Sf.getPayButtonStyle(t),a=o.height,i=o.borderRadius,c=Sf.getPaymentConfig(Pi.Cart)){e.next=10;break}return qf.error("first load paymentButtonConfig data is null"),e.abrupt("return");case 10:return e.next=12,r.getSubscription().catch((function(e){return qf.error("cart init get subscription info fail",{error:e}),!1}));case 12:return s=e.sent,t.style.marginBottom="5px",u={domId:n,props:Rf(Rf({},Sf.getPaymentProps()),{},{style:{height:a||xf,"border-radius":i},logger:Uf,toast:function(e){return Hf.open(e)},isSubscription:s}),paymentConfig:c,saveAbandonedOrder:r.saveAbandonedOrder.bind(r),onError:function(e,t){null!=t&&t.errorType&&r.countdownManagerStart(null==t?void 0:t.errorType)}},r.payButton=new Du(u),e.next=18,r.payButton.render();case 18:r.observerSubscription(n);case 19:case"end":return e.stop()}}),e)})))),n(this,"observerSubscription",function(){var e=gd(kd.mark((function e(t){var n,o;return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(qf.info("observer subscription",{data:{domId:t,registerMap:Gf}}),!Gf[t]){e.next=3;break}return e.abrupt("return");case 3:return Gf[t]=!0,jf(),e.next=7,Ef();case 7:null==Lf||null===(n=Lf.registerEventName)||void 0===n||n.call(Lf,[Af.cartPageUpdate]),null==Lf||null===(o=Lf.event)||void 0===o||o.on(Af.cartPageUpdate,gd(kd.mark((function e(){var t,n;return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getSubscription();case 2:n=e.sent,qf.info("subscription state change",{data:{isSubscription:n}}),null===(t=r.payButton)||void 0===t||t.setSubscription(n);case 5:case"end":return e.stop()}}),e)}))));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n(this,"getSubscription",gd(kd.mark((function e(){var t,n,o;return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getCartDetailRes();case 2:return t=e.sent,r.cartDetail=t,qf.info("getCartDetail res",{data:{cartDetail:t}}),n=(null==t?void 0:t.items)||[],o=n.findIndex((function(e){return e.selling_plan_allocation}))>=0,e.abrupt("return",o);case 8:case"end":return e.stop()}}),e)})))),n(this,"getCartDetailRes",(function(){return Yf.status===Ff.Pending||(Yf.status=Ff.Pending,Yf.action=Bf().finally((function(){Yf.status=Ff.Done}))),Yf.action})),this.container=t}var t;return zl(e,[{key:"getContainer",value:function(){return this.container}},{key:"getPayButton",value:function(){return this.payButton}},{key:"countdownManagerStart",value:function(e){yd(e)&&(this.countdownManager||(this.countdownManager=new vd(this)),this.countdownManager.start(this.getCartToken(),e))}},{key:"saveAbandonedOrder",value:(t=gd(kd.mark((function e(t){var n,r,o,a,i,c,s;return kd.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},r={},t===Ii.PAY_PAL&&(n.spb=!0),t===Ii.SHOP_BY_FAST_CHECKOUT&&(r.notSupportSubscriptionCheck=!0),qf.info("save abandon order",{data:{query:n,restParams:r,buttonName:t}}),e.next=7,Xu(Rf({query:n,toast:function(e){return Hf.open(e)},logger:qf},r));case 7:if(o=e.sent,a=o.errorType,i=o.needLogin,c=o.abandonedInfo,s=o.url,!a){e.next=16;break}return qf.info("save abandonOrder error",{data:{errorType:a}}),this.countdownManagerStart(a),e.abrupt("return",{canContinue:!1});case 16:if(tc.reportFastCheckout(t),[Ii.CHECKOUT,Ii.PAY_PAL].includes(t)&&Ju({abandonedSeq:(null==c?void 0:c.seq)||""}),!i){e.next=22;break}return qf.info("save abandonOrder need login"),setTimeout((function(){s&&(window.location.href=s)}),0),e.abrupt("return",{canContinue:!1});case 22:return e.abrupt("return",{canContinue:!0,abandonedInfo:c,url:s});case 23:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getCartToken",value:function(){var e;return(null===(e=this.cartDetail)||void 0===e?void 0:e.token)||""}}]),e}(),zf=Pf.$,Wf=Pf.logger.pipeOwner("additional-button");Wf.info("additional-button js entry");var Kf=function(){var e=zf(".dynamic-checkout__content");e.size()?e.each((function(e){new Vf(e).render()})):Wf.warn("can not find pay button container")};Kf(),window.Shopline.AdditionalButton={init:Kf}}));