linkpay-api
Version:
LinkPay JS/TS API SDK
2 lines • 31.2 kB
JavaScript
/*! For license information please see linkpay-api-sdk.browser.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["linkpay-api-sdk"]=e():t["linkpay-api-sdk"]=e()}(self,(()=>(()=>{var t={641:function(t,e,r){t.exports=function(){"use strict";function t(t){return"function"==typeof t}var e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,o=void 0,i=void 0,s=function(t,e){p[n]=t,p[n+1]=e,2===(n+=2)&&(i?i(d):m())};var a="undefined"!=typeof window?window:void 0,u=a||{},c=u.MutationObserver||u.WebKitMutationObserver,f="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function l(){var t=setTimeout;return function(){return t(d,1)}}var p=new Array(1e3);function d(){for(var t=0;t<n;t+=2)(0,p[t])(p[t+1]),p[t]=void 0,p[t+1]=void 0;n=0}var y,b,v,g,m=void 0;function _(t,e){var r=this,n=new this.constructor(O);void 0===n[T]&&C(n);var o=r._state;if(o){var i=arguments[o-1];s((function(){return M(o,n,i,r._result)}))}else B(r,n,t,e);return n}function w(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(O);return S(e,t),e}m=f?function(){return process.nextTick(d)}:c?(b=0,v=new c(d),g=document.createTextNode(""),v.observe(g,{characterData:!0}),function(){g.data=b=++b%2}):h?((y=new MessageChannel).port1.onmessage=d,function(){return y.port2.postMessage(0)}):void 0===a?function(){try{var t=Function("return this")().require("vertx");return void 0!==(o=t.runOnLoop||t.runOnContext)?function(){o(d)}:l()}catch(t){return l()}}():l();var T=Math.random().toString(36).substring(2);function O(){}var P=void 0,E=1,A=2;function j(e,r,n){r.constructor===e.constructor&&n===_&&r.constructor.resolve===w?function(t,e){e._state===E?D(t,e._result):e._state===A?R(t,e._result):B(e,void 0,(function(e){return S(t,e)}),(function(e){return R(t,e)}))}(e,r):void 0===n?D(e,r):t(n)?function(t,e,r){s((function(t){var n=!1,o=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(r,e,(function(r){n||(n=!0,e!==r?S(t,r):D(t,r))}),(function(e){n||(n=!0,R(t,e))}),t._label);!n&&o&&(n=!0,R(t,o))}),t)}(e,r,n):D(e,r)}function S(t,e){if(t===e)R(t,new TypeError("You cannot resolve a promise with itself"));else if(o=typeof(n=e),null===n||"object"!==o&&"function"!==o)D(t,e);else{var r=void 0;try{r=e.then}catch(e){return void R(t,e)}j(t,e,r)}var n,o}function x(t){t._onerror&&t._onerror(t._result),H(t)}function D(t,e){t._state===P&&(t._result=e,t._state=E,0!==t._subscribers.length&&s(H,t))}function R(t,e){t._state===P&&(t._state=A,t._result=e,s(x,t))}function B(t,e,r,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+E]=r,o[i+A]=n,0===i&&t._state&&s(H,t)}function H(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)n=e[s],o=e[s+r],n?M(r,n,o,i):o(i);t._subscribers.length=0}}function M(e,r,n,o){var i=t(n),s=void 0,a=void 0,u=!0;if(i){try{s=n(o)}catch(t){u=!1,a=t}if(r===s)return void R(r,new TypeError("A promises callback cannot return that same promise."))}else s=o;r._state!==P||(i&&u?S(r,s):!1===u?R(r,a):e===E?D(r,s):e===A&&R(r,s))}var U=0;function C(t){t[T]=U++,t._state=void 0,t._result=void 0,t._subscribers=[]}var I=function(){function t(t,r){this._instanceConstructor=t,this.promise=new t(O),this.promise[T]||C(this.promise),e(r)?(this.length=r.length,this._remaining=r.length,this._result=new Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(r),0===this._remaining&&D(this.promise,this._result))):R(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===P&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===w){var o=void 0,i=void 0,s=!1;try{o=t.then}catch(t){s=!0,i=t}if(o===_&&t._state!==P)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(r===q){var a=new r(O);s?R(a,i):j(a,t,o),this._willSettleAt(a,e)}else this._willSettleAt(new r((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===P&&(this._remaining--,t===A?R(n,r):this._result[e]=r),0===this._remaining&&D(n,this._result)},t.prototype._willSettleAt=function(t,e){var r=this;B(t,void 0,(function(t){return r._settledAt(E,e,t)}),(function(t){return r._settledAt(A,e,t)}))},t}();var q=function(){function e(t){this[T]=U++,this._result=this._state=void 0,this._subscribers=[],O!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){S(t,e)}),(function(e){R(t,e)}))}catch(e){R(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var r=this,n=r.constructor;return t(e)?r.then((function(t){return n.resolve(e()).then((function(){return t}))}),(function(t){return n.resolve(e()).then((function(){throw t}))})):r.then(e,e)},e}();return q.prototype.then=_,q.all=function(t){return new I(this,t).promise},q.race=function(t){var r=this;return e(t)?new r((function(e,n){for(var o=t.length,i=0;i<o;i++)r.resolve(t[i]).then(e,n)})):new r((function(t,e){return e(new TypeError("You must pass an array to race."))}))},q.resolve=w,q.reject=function(t){var e=new this(O);return R(e,t),e},q._setScheduler=function(t){i=t},q._setAsap=function(t){s=t},q._asap=s,q.polyfill=function(){var t=void 0;if(void 0!==r.g)t=r.g;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=q},q.Promise=q,q}()},447:(t,e,r)=>{r(845),t.exports=self.fetch.bind(self)},413:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.RequiredError=e.BaseAPI=void 0;var i=r(666),s=r(55),a=r(95),u=function(){function t(t){this.configuration=t,this.restClient=new a.RestClient(t)}return t.prototype.buildHeaders=function(t,e,r){var n=new s.default(t,e,this.configuration.signKey,r);return new i.HttpHeader(i.SignType.SHA256,n).toRecord()},t}();e.BaseAPI=u;var c=function(t){function e(e,r){var n=t.call(this,r)||this;return n.field=e,n.name="RequiredError",n}return o(e,t),e}(Error);e.RequiredError=c},567:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},613:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(567),e),o(r(211),e)},95:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.RestClient=e.copyAndPrepareBody=void 0;var a=r(641),u=r(602),c=r(447),f=r(413);function h(t){if(void 0!==t&&null!=t){if(t instanceof Date)return t;if(r=typeof(e=t),null==e||"object"!==r&&"function"!==r)return t;var e,r;if(Array.isArray(t)){if(0===t.length)return;return t.map((function(t){return h(t)}))}for(var n={},o=0,i=Object.keys(t);o<i.length;o++){var s=i[o],a=h(t[s]);void 0!==a&&(n[s]=a)}return n}}a.polyfill(),e.copyAndPrepareBody=h;var l=function(){function t(t){if(this.GET="GET",this.PATCH="PATCH",this.POST="POST",this.PUT="PUT",this.DELETE="DELETE",!t)throw new f.RequiredError("Configuration must be initialized!");if(!t.sid)throw new f.RequiredError("Sid must be set!");if(!t.signKey)throw new f.RequiredError("SignKey must be set!");this.sid=t.sid,this.signKey=t.signKey,this.baseUrl=t.baseUrl||"https://hkg-counter.everonet.com",this.fetch=t.fetch||c,this.headers=t.headers,this.httpHandler=this.buildHttpHandler()}return t.prototype.buildHttpHandler=function(){return[new d(this.sid,this.signKey,this.headers),new y].reduce((function(t,e){return e.innerHandler=t,e}),new b(this.fetch))},t.prototype.patch=function(t,e,r,n){return this.request(this.PATCH,t,e,r,n)},t.prototype.post=function(t,e,r,n){return this.request(this.POST,t,e,r,n)},t.prototype.get=function(t,e,r,n){return this.request(this.GET,t,e,r,void 0,n)},t.prototype.delete=function(t,e,r){return this.request(this.DELETE,t,e,r)},t.prototype.put=function(t,e,r,n){return this.request(this.PUT,t,e,r,n)},t.prototype.request=function(t,e,r,n,o,a){return i(this,void 0,void 0,(function(){var i,c,f;return s(this,(function(s){switch(s.label){case 0:return i=function(t,e,r,n){var o=e;if(r)for(var i=0,s=Object.keys(r);i<s.length;i++){var a=s[i];if(r[a]instanceof Date){var c=r[a],f=c.getDate(),h=c.getMonth()+1,l=c.getFullYear(),p=function(t){return t<10?"0".concat(t):"".concat(t)};r[a]="".concat(l,"-").concat(p(h),"-").concat(p(f))}o=o.replace(new RegExp("{".concat(a,"}")),r[a])}if(o.search("{|}")>0)throw new Error("After replacing ".concat(e," with parameter map ").concat(JSON.stringify(r)," there are still some placeholders left for replacing. Please make sure to provide a urlParameterMap that replaces all placeholders"));o=u(t,o);var d=function(t){if(!t)return"";for(var e,r="",n=!1,o=0,i=Object.keys(t);o<i.length;o++){var s=i[o];t[s]&&"function"!=typeof t[s]&&(r+="".concat((n?"&":"")+encodeURIComponent(s),"=").concat(encodeURIComponent((e=t[s])instanceof Date?e.toISOString().replace(/\.\d+Z/,"Z"):e)),n=!0)}return r}(n);return d&&(o=u(o,"?".concat(d))),new URL(o)}(this.baseUrl,e,n,a),o=h(o),c={method:t,url:i.toString(),body:JSON.stringify(o),headers:r||{}},[4,this.httpHandler.executeRequest(c)];case 1:return[4,s.sent().text()];case 2:if(0===(f=s.sent()).length)return[2,void 0];try{return[2,JSON.parse(f)]}catch(t){throw new Error("Response body could not be parsed to JSON")}return[2]}}))}))},t}();e.RestClient=l;var p=function(){},d=function(t){function e(e,r,n){var o=t.call(this)||this;return o.headers=Object.assign({SignType:"SHA256","Content-Type":"application/json"},n),o}return o(e,t),e.prototype.executeRequest=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return t.headers=Object.assign(t.headers,this.headers),[4,this.innerHandler.executeRequest(t)];case 1:return[2,e.sent()]}}))}))},e}(p),y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.executeRequest=function(t){return i(this,void 0,void 0,(function(){var e,r,n,o;return s(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.innerHandler.executeRequest(t)];case 1:return(e=i.sent()).status>=200&&e.status<=299?[2,e]:[3,3];case 2:throw r=i.sent(),new Error(r);case 3:return[4,e.text()];case 4:if(0===(n=i.sent()).length)throw new Error("HTTP response code was ".concat(e.status," ").concat(e.statusText," (response body is empty)"));try{o=JSON.parse(n)}catch(t){throw new Error("HTTP response code was ".concat(e.status," ").concat(e.statusText," (response body is invalid JSON)"))}throw new Error("HTTP response code was ".concat(e.status," ").concat(e.statusText,": ").concat(JSON.stringify(o)))}}))}))},e}(p),b=function(){function t(t){this.fetch=t}return t.prototype.executeRequest=function(t){return i(this,void 0,void 0,(function(){var e,r,n,o,i,a;return s(this,(function(s){switch(s.label){case 0:return e=t.url,r=t.method,n=t.body,o=t.headers,console.log(t),[4,this.fetch(e,{method:r,body:n,headers:o})];case 1:return[4,(i=s.sent()).text()];case 2:return a=s.sent(),i.text=function(){return new Promise((function(t){return t(a)}))},[2,i]}}))}))},t}()},211:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.genYYYYMMDDThhmmsshh00=e.genUUIDWithoutDash=void 0;var n=r(781);e.genUUIDWithoutDash=function(){return(0,n.randomUUID)().replace(/-/g,"").substring(0,32)},e.genYYYYMMDDThhmmsshh00=function(){var t=new Date,e=t.getFullYear(),r="0".concat(t.getMonth()+1).slice(-2),n="0".concat(t.getDate()).slice(-2),o="0".concat(t.getHours()).slice(-2),i="0".concat(t.getMinutes()).slice(-2),s="0".concat(t.getSeconds()).slice(-2),a="0".concat(t.getTimezoneOffset()/-60).slice(-2);return"".concat(e,"-").concat(r,"-").concat(n,"T").concat(o,":").concat(i,":").concat(s,"+").concat(a,":00")}},303:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0});var i=r(950);o(r(613),e),o(r(666),e),e.default=i.default},950:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var i=r(413),s=r(271),a=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.payment=function(t){var e="/g2/v0/payment/mer/".concat(this.configuration.sid,"/evo.e-commerce.linkpay"),r=this.buildHeaders(s.HttpMethod.POST,e,t),n={sid:this.configuration.sid};return this.restClient.post(e,r,n,t).then((function(t){return t}))},e.prototype.retrievePayment=function(t){var e="/g2/v0/payment/mer/".concat(this.configuration.sid,"/evo.e-commerce.linkpay/").concat(t),r=this.buildHeaders(s.HttpMethod.GET,e),n={sid:this.configuration.sid,merchantOrderID:t};return this.restClient.get(e,r,n).then((function(t){return t}))},e.prototype.refund=function(t,e){var r="/g2/v0/payment/mer/".concat(this.configuration.sid,"/evo.e-commerce.linkpayRefund/").concat(t),n=this.buildHeaders(s.HttpMethod.POST,r,e),o={sid:this.configuration.sid,merchantOrderID:t};return this.restClient.post(r,n,o,e).then((function(t){return t}))},e.prototype.retrieveRefund=function(t){var e="/g2/v0/payment/mer/".concat(this.configuration.sid,"/evo.e-commerce.linkpayRefund/").concat(t),r=this.buildHeaders(s.HttpMethod.GET,e),n={sid:this.configuration.sid,merchantTransID:t};return this.restClient.get(e,r,n).then((function(t){return t}))},e}(i.BaseAPI);e.default=a},271:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.HttpMethod=void 0,(r=e.HttpMethod||(e.HttpMethod={})).POST="POST",r.GET="GET",r.PUT="PUT",r.DELETE="DELETE"},684:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.HttpHeader=e.SignType=void 0,function(t){t.SHA256="SHA256",t.SHA512="SHA512"}(r=e.SignType||(e.SignType={}));var n=function(){function t(t,e){this.contentType="application/json",this.dateTime=e.dateTime,this.msgID=e.msgID,this.signType=t,this.signType===r.SHA256?this.authorization=e.sha256():this.authorization=e.sha512()}return t.prototype.toRecord=function(){return{Authorization:this.authorization,"Content-Type":this.contentType,DateTime:this.dateTime,MsgID:this.msgID,SignType:this.signType}},t}();e.HttpHeader=n,e.default=n},666:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(271),e),o(r(684),e),o(r(503),e),o(r(773),e),o(r(62),e),o(r(55),e)},503:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PaymentRequest=void 0;var r=function(){};e.PaymentRequest=r,e.default=r},773:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PaymentResponse=void 0;var r=function(){};e.PaymentResponse=r,e.default=r},62:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RetrievePaymentResponse=void 0;var r=function(){};e.RetrievePaymentResponse=r,e.default=r},55:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Signature=void 0;var n=r(921),o=r(211),i=function(){function t(t,e,r,n){this.httpMethod=t,this.urlString=e,this.dateTime=(0,o.genYYYYMMDDThhmmsshh00)(),this.key=r,this.msgID=(0,o.genUUIDWithoutDash)(),this.httpBody=n?JSON.stringify(n):""}return t.prototype.toString=function(){return"".concat(this.httpMethod,"\n").concat(this.urlString,"\n").concat(this.dateTime,"\n").concat(this.key,"\n").concat(this.msgID).concat(this.httpBody?"\n".concat(this.httpBody):"")},t.prototype.sha256=function(){var t=this.toString();return console.log(t),(0,n.createHash)("sha256").update(t).digest("hex")},t.prototype.sha512=function(){var t=this.toString();return(0,n.createHash)("sha512").update(t).digest("hex")},t}();e.Signature=i,e.default=i},602:function(t,e,r){var n,o,i;i=function(){return function(){return function(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var r=t.shift();t[0]=r+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<t.length;n++){var o=t[n];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(n>0&&(o=o.replace(/^[\/]+/,"")),o=n<t.length-1?o.replace(/[\/]+$/,""):o.replace(/[\/]+$/,"/"),e.push(o))}var i=e.join("/"),s=(i=i.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return s.shift()+(s.length>0?"?":"")+s.join("&")}("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=i():void 0===(o="function"==typeof(n=i)?n.call(e,r,e,t):n)||(t.exports=o)},845:(t,e,r)=>{"use strict";r.r(e),r.d(e,{DOMException:()=>w,Headers:()=>f,Request:()=>v,Response:()=>m,fetch:()=>T});var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==n&&n,o={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};if(o.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&i.indexOf(Object.prototype.toString.call(t))>-1};function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o.iterable&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function p(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o.arrayBuffer&&o.blob&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||s(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o.blob&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(p)}),this.text=function(){var t,e,r,n=h(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=l(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=a(t),e=u(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},f.prototype.delete=function(t){delete this.map[a(t)]},f.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},f.prototype.set=function(t,e){this.map[a(t)]=u(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},o.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){if(!(this instanceof v))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,o=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),b.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var i=/([?&])_=[^&]*/;i.test(this.url)?this.url=this.url.replace(i,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function m(t,e){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},y.call(v.prototype),y.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},m.error=function(){var t=new m(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];m.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new m(null,{status:e,headers:{location:t}})};var w=n.DOMException;try{new w}catch(t){(w=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),w.prototype.constructor=w}function T(t,e){return new Promise((function(r,i){var s=new v(t,e);if(s.signal&&s.signal.aborted)return i(new w("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;setTimeout((function(){r(new m(o,n))}),0)},a.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.onabort=function(){setTimeout((function(){i(new w("Aborted","AbortError"))}),0)},a.open(s.method,function(t){try{return""===t&&n.location.href?n.location.href:t}catch(e){return t}}(s.url),!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&(o.blob?a.responseType="blob":o.arrayBuffer&&s.headers.get("Content-Type")&&-1!==s.headers.get("Content-Type").indexOf("application/octet-stream")&&(a.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof f?s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){a.setRequestHeader(t,u(e.headers[t]))})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}T.polyfill=!0,n.fetch||(n.fetch=T,n.Headers=f,n.Request=v,n.Response=m)},781:()=>{},921:()=>{}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(303)})()));