UNPKG

hc-sdk

Version:

hc-sdk is a library for working with the HuaChain Horizon server.

1 lines 512 kB
var StellarSdk=function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={exports:{},id:e,loaded:!1};return r[e].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}return o.m=r,o.c=n,o.p="",o(0)}([function(e,t,r){"use strict";e.exports=r(1),e.exports.axios=r(394),e.exports.StellarBase=r(118)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var o=r(3);Object.defineProperty(t,"Config",{enumerable:!0,get:function(){return o.Config}});var i=r(113);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return i.Server}});var a=r(473);Object.defineProperty(t,"FederationServer",{enumerable:!0,get:function(){return a.FederationServer}}),Object.defineProperty(t,"FEDERATION_RESPONSE_MAX_SIZE",{enumerable:!0,get:function(){return a.FEDERATION_RESPONSE_MAX_SIZE}});var s=r(474);Object.defineProperty(t,"StellarTomlResolver",{enumerable:!0,get:function(){return s.StellarTomlResolver}}),Object.defineProperty(t,"STELLAR_TOML_MAX_SIZE",{enumerable:!0,get:function(){return s.STELLAR_TOML_MAX_SIZE}});var u=r(393);Object.defineProperty(t,"HorizonAxiosClient",{enumerable:!0,get:function(){return function(e){return e&&e.__esModule?e:{default:e}}(u).default}});var c=r(118);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})}),r(478).polyfill(),t.default=e.exports},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e};function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s,u=t.NetworkError=(a(f,(s=Error,c.prototype=Object.create(s.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s,c)),r(f,[{key:"getResponse",value:function(){return this.response}}]),f);function c(){var e=Reflect.construct(s,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}function f(e,t){o(this,f);var r=i(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,e));return r.constructor=f,r.response=t,r}t.NotFoundError=(a(l,u),l);function l(e,t){o(this,l);var r=i(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,e,t));return r.constructor=l,r}t.BadRequestError=(a(h,u),h);function h(e,t){o(this,h);var r=i(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,e,t));return r.constructor=h,r}t.BadResponseError=(a(p,u),p);function p(e,t){o(this,p);var r=i(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,e,t));return r.constructor=p,r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Config=void 0;var n=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e};function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i,a=r(4),s=(i=a)&&i.__esModule?i:{default:i};var u={allowHttp:!1,timeout:0},c=(0,s.default)(u),f=(n(l,null,[{key:"setAllowHttp",value:function(e){c.allowHttp=e}},{key:"setTimeout",value:function(e){c.timeout=e}},{key:"isAllowHttp",value:function(){return(0,s.default)(c.allowHttp)}},{key:"getTimeout",value:function(){return(0,s.default)(c.timeout)}},{key:"setDefault",value:function(){c=(0,s.default)(u)}}]),l);function l(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l)}t.Config=f},function(e,t,r){var n=r(5);e.exports=function(e){return n(e,4)}},function(e,t,r){var g=r(6),m=r(50),b=r(51),w=r(54),_=r(77),E=r(81),O=r(82),A=r(83),x=r(87),k=r(91),S=r(93),T=r(94),P=r(99),j=r(100),R=r(107),I=r(62),C=r(63),M=r(109),B=r(30),U=r(111),N=r(56),L=1,D=2,q=4,F="[object Arguments]",z="[object Function]",V="[object GeneratorFunction]",H="[object Object]",K={};K[F]=K["[object Array]"]=K["[object ArrayBuffer]"]=K["[object DataView]"]=K["[object Boolean]"]=K["[object Date]"]=K["[object Float32Array]"]=K["[object Float64Array]"]=K["[object Int8Array]"]=K["[object Int16Array]"]=K["[object Int32Array]"]=K["[object Map]"]=K["[object Number]"]=K[H]=K["[object RegExp]"]=K["[object Set]"]=K["[object String]"]=K["[object Symbol]"]=K["[object Uint8Array]"]=K["[object Uint8ClampedArray]"]=K["[object Uint16Array]"]=K["[object Uint32Array]"]=!0,K["[object Error]"]=K[z]=K["[object WeakMap]"]=!1,e.exports=function r(n,o,i,e,t,a){var s,u=o&L,c=o&D,f=o&q;if(i&&(s=t?i(n,e,t,a):i(n)),void 0!==s)return s;if(!B(n))return n;var l=I(n);if(l){if(s=P(n),!u)return O(n,s)}else{var h=T(n),p=h==z||h==V;if(C(n))return E(n,u);if(h==H||h==F||p&&!t){if(s=c||p?{}:R(n),!u)return c?x(n,_(s,n)):A(n,w(s,n))}else{if(!K[h])return t?n:{};s=j(n,h,u)}}var d=(a=a||new g).get(n);if(d)return d;if(a.set(n,s),U(n))return n.forEach(function(e){s.add(r(e,o,i,e,n,a))}),s;if(M(n))return n.forEach(function(e,t){s.set(t,r(e,o,i,t,n,a))}),s;var y=f?c?S:k:c?keysIn:N,v=l?void 0:y(n);return m(v||n,function(e,t){v&&(e=n[t=e]),b(s,t,r(e,o,i,t,n,a))}),s}},function(e,t,r){var n=r(7),o=r(15),i=r(16),a=r(17),s=r(18),u=r(19);function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=o,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=s,c.prototype.set=u,e.exports=c},function(e,t,r){var n=r(8),o=r(9),i=r(12),a=r(13),s=r(14);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,e.exports=u},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,r){var n=r(10),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,r=n(t,e);return!(r<0)&&(r==t.length-1?t.pop():o.call(t,r,1),--this.size,!0)}},function(e,t,r){var n=r(11);e.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,r){var n=r(10);e.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}},function(e,t,r){var n=r(10);e.exports=function(e){return-1<n(this.__data__,e)}},function(e,t,r){var o=r(10);e.exports=function(e,t){var r=this.__data__,n=o(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}},function(e,t,r){var n=r(7);e.exports=function(){this.__data__=new n,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,r){var o=r(7),i=r(20),a=r(35);e.exports=function(e,t){var r=this.__data__;if(r instanceof o){var n=r.__data__;if(!i||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new a(n)}return r.set(e,t),this.size=r.size,this}},function(e,t,r){var n=r(21)(r(26),"Map");e.exports=n},function(e,t,r){var n=r(22),o=r(34);e.exports=function(e,t){var r=o(e,t);return n(r)?r:void 0}},function(e,t,r){var n=r(23),o=r(31),i=r(30),a=r(33),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,l=c.hasOwnProperty,h=RegExp("^"+f.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(n(e)?h:s).test(a(e))}},function(e,t,r){var n=r(24),o=r(30);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,r){var n=r(25),o=r(28),i=r(29),a=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},function(e,t,r){var n=r(26).Symbol;e.exports=n},function(e,t,r){var n=r(27),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},function(r,e){(function(e){var t="object"==typeof e&&e&&e.Object===Object&&e;r.exports=t}).call(e,function(){return this}())},function(e,t,r){var n=r(25),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),r=e[s];try{var n=!(e[s]=void 0)}catch(e){}var o=a.call(e);return n&&(t?e[s]=r:delete e[s]),o}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,r){var n,o=r(32),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!i&&i in e}},function(e,t,r){var n=r(26)["__core-js_shared__"];e.exports=n},function(e,t){var r=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,r){var n=r(36),o=r(44),i=r(47),a=r(48),s=r(49);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,e.exports=u},function(e,t,r){var n=r(37),o=r(7),i=r(20);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},function(e,t,r){var n=r(38),o=r(40),i=r(41),a=r(42),s=r(43);function u(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,e.exports=u},function(e,t,r){var n=r(39);e.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(e,t,r){var n=r(21)(Object,"create");e.exports=n},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,r){var n=r(39),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(n){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(t,e)?t[e]:void 0}},function(e,t,r){var n=r(39),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:o.call(t,e)}},function(e,t,r){var n=r(39);e.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,r){var n=r(45);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t,r){var n=r(46);e.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,r){var n=r(45);e.exports=function(e){return n(this,e).get(e)}},function(e,t,r){var n=r(45);e.exports=function(e){return n(this,e).has(e)}},function(e,t,r){var o=r(45);e.exports=function(e,t){var r=o(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}},function(e,t){e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}},function(e,t,r){var o=r(52),i=r(11),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){var n=e[t];a.call(e,t)&&i(n,r)&&(void 0!==r||t in e)||o(e,t,r)}},function(e,t,r){var n=r(53);e.exports=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}},function(e,t,r){var n=r(21),o=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,r){var n=r(55),o=r(56);e.exports=function(e,t){return e&&n(t,o(t),e)}},function(e,t,r){var c=r(51),f=r(52);e.exports=function(e,t,r,n){var o=!r;r=r||{};for(var i=-1,a=t.length;++i<a;){var s=t[i],u=n?n(r[s],e[s],s,r,e):void 0;void 0===u&&(u=e[s]),o?f(r,s,u):c(r,s,u)}return r}},function(e,t,r){var n=r(57),o=r(72),i=r(76);e.exports=function(e){return i(e)?n(e):o(e)}},function(e,t,r){var f=r(58),l=r(59),h=r(62),p=r(63),d=r(66),y=r(67),v=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=h(e),n=!r&&l(e),o=!r&&!n&&p(e),i=!r&&!n&&!o&&y(e),a=r||n||o||i,s=a?f(e.length,String):[],u=s.length;for(var c in e)!t&&!v.call(e,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||d(c,u))||s.push(c);return s}},function(e,t){e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},function(e,t,r){var n=r(60),o=r(61),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return o(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=u},function(e,t,r){var n=r(24),o=r(61);e.exports=function(e){return o(e)&&"[object Arguments]"==n(e)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t){var r=Array.isArray;e.exports=r},function(e,s,u){(function(e){var t=u(26),r=u(65),n="object"==typeof s&&s&&!s.nodeType&&s,o=n&&"object"==typeof e&&e&&!e.nodeType&&e,i=o&&o.exports===n?t.Buffer:void 0,a=(i?i.isBuffer:void 0)||r;e.exports=a}).call(s,u(64)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){e.exports=function(){return!1}},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&-1<e&&e%1==0&&e<t}},function(e,t,r){var n=r(68),o=r(70),i=r(71),a=i&&i.isTypedArray,s=a?o(a):n;e.exports=s},function(e,t,r){var n=r(24),o=r(69),i=r(61),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[n(e)]}},function(e,t){e.exports=function(e){return"number"==typeof e&&-1<e&&e%1==0&&e<=9007199254740991}},function(e,t){e.exports=function(t){return function(e){return t(e)}}},function(e,a,s){(function(e){var t=s(27),r="object"==typeof a&&a&&!a.nodeType&&a,n=r&&"object"==typeof e&&e&&!e.nodeType&&e,o=n&&n.exports===r&&t.process,i=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=i}).call(a,s(64)(e))},function(e,t,r){var n=r(73),o=r(74),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return o(e);var t=[];for(var r in Object(e))i.call(e,r)&&"constructor"!=r&&t.push(r);return t}},function(e,t){var r=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}},function(e,t,r){var n=r(75)(Object.keys,Object);e.exports=n},function(e,t){e.exports=function(t,r){return function(e){return t(r(e))}}},function(e,t,r){var n=r(23),o=r(69);e.exports=function(e){return null!=e&&o(e.length)&&!n(e)}},function(e,t,r){var n=r(55),o=r(78);e.exports=function(e,t){return e&&n(t,o(t),e)}},function(e,t,r){var n=r(57),o=r(79),i=r(76);e.exports=function(e){return i(e)?n(e,!0):o(e)}},function(e,t,r){var o=r(30),i=r(73),a=r(80),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!o(e))return a(e);var t=i(e),r=[];for(var n in e)("constructor"!=n||!t&&s.call(e,n))&&r.push(n);return r}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},function(e,a,s){(function(e){var t=s(26),r="object"==typeof a&&a&&!a.nodeType&&a,n=r&&"object"==typeof e&&e&&!e.nodeType&&e,o=n&&n.exports===r?t.Buffer:void 0,i=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=i?i(r):new e.constructor(r);return e.copy(n),n}}).call(a,s(64)(e))},function(e,t){e.exports=function(e,t){var r=-1,n=e.length;for(t=t||Array(n);++r<n;)t[r]=e[r];return t}},function(e,t,r){var n=r(55),o=r(84);e.exports=function(e,t){return n(e,o(e),t)}},function(e,t,r){var n=r(85),o=r(86),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(t){return null==t?[]:(t=Object(t),n(a(t),function(e){return i.call(t,e)}))}:o;e.exports=s},function(e,t){e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var a=e[r];t(a,r,e)&&(i[o++]=a)}return i}},function(e,t){e.exports=function(){return[]}},function(e,t,r){var n=r(55),o=r(88);e.exports=function(e,t){return n(e,o(e),t)}},function(e,t,r){var n=r(89),o=r(90),i=r(84),a=r(86),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)n(t,i(e)),e=o(e);return t}:a;e.exports=s},function(e,t){e.exports=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}},function(e,t,r){var n=r(75)(Object.getPrototypeOf,Object);e.exports=n},function(e,t,r){var n=r(92),o=r(84),i=r(56);e.exports=function(e){return n(e,i,o)}},function(e,t,r){var o=r(89),i=r(62);e.exports=function(e,t,r){var n=t(e);return i(e)?n:o(n,r(e))}},function(e,t,r){var n=r(92),o=r(88),i=r(78);e.exports=function(e){return n(e,i,o)}},function(e,t,r){var n=r(95),o=r(20),i=r(96),a=r(97),s=r(98),u=r(24),c=r(33),f="[object Map]",l="[object Promise]",h="[object Set]",p="[object WeakMap]",d="[object DataView]",y=c(n),v=c(o),g=c(i),m=c(a),b=c(s),w=u;(n&&w(new n(new ArrayBuffer(1)))!=d||o&&w(new o)!=f||i&&w(i.resolve())!=l||a&&w(new a)!=h||s&&w(new s)!=p)&&(w=function(e){var t=u(e),r="[object Object]"==t?e.constructor:void 0,n=r?c(r):"";if(n)switch(n){case y:return d;case v:return f;case g:return l;case m:return h;case b:return p}return t}),e.exports=w},function(e,t,r){var n=r(21)(r(26),"DataView");e.exports=n},function(e,t,r){var n=r(21)(r(26),"Promise");e.exports=n},function(e,t,r){var n=r(21)(r(26),"Set");e.exports=n},function(e,t,r){var n=r(21)(r(26),"WeakMap");e.exports=n},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},function(e,t,r){var o=r(101),i=r(103),a=r(104),s=r(105),u=r(106);e.exports=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return o(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return i(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return u(e,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return a(e);case"[object Set]":return new n;case"[object Symbol]":return s(e)}}},function(e,t,r){var n=r(102);e.exports=function(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}},function(e,t,r){var n=r(26).Uint8Array;e.exports=n},function(e,t,r){var n=r(101);e.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}},function(e,t){var r=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,r.exec(e));return t.lastIndex=e.lastIndex,t}},function(e,t,r){var n=r(25),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},function(e,t,r){var n=r(101);e.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}},function(e,t,r){var n=r(108),o=r(90),i=r(73);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:n(o(e))}},function(e,t,r){function n(e){if(!o(e))return{};if(i)return i(e);a.prototype=e;var t=new a;return a.prototype=void 0,t}var o=r(30),i=Object.create;function a(){}e.exports=n},function(e,t,r){var n=r(110),o=r(70),i=r(71),a=i&&i.isMap,s=a?o(a):n;e.exports=s},function(e,t,r){var n=r(94),o=r(61);e.exports=function(e){return o(e)&&"[object Map]"==n(e)}},function(e,t,r){var n=r(112),o=r(70),i=r(71),a=i&&i.isSet,s=a?o(a):n;e.exports=s},function(e,t,r){var n=r(94),o=r(61);e.exports=function(e){return o(e)&&"[object Set]"==n(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Server=t.SUBMIT_TRANSACTION_TIMEOUT=void 0;var n=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e};function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=S(r(114)),h=r(118),p=S(r(348)),i=r(2),s=r(389),u=r(459),c=r(390),f=r(3),l=r(393),d=S(l),y=r(461),v=r(462),g=r(463),m=r(464),b=r(465),w=r(466),_=r(467),E=r(468),O=r(469),A=r(470),x=r(471),k=r(472);function S(e){return e&&e.__esModule?e:{default:e}}var T=t.SUBMIT_TRANSACTION_TIMEOUT=6e4;function P(e){return new p.default(e).div(1e7).toString()}t.Server=(n(j,[{key:"fetchTimebounds",value:function(e,t){var r=this,n=1<arguments.length&&void 0!==t&&t,o=(0,l.getCurrentServerTime)(this.serverURL.hostname());return o?Promise.resolve({minTime:0,maxTime:o+e}):n?Promise.resolve({minTime:0,maxTime:Math.floor((new Date).getTime()/1e3)+e}):d.default.get((0,a.default)(this.serverURL).toString()).then(function(){return r.fetchTimebounds(e,!0)})}},{key:"fetchBaseFee",value:function(){return this.ledgers().order("desc").limit(1).call().then(function(e){return e&&e.records[0]&&e.records[0].base_fee_in_stroops||100})}},{key:"operationFeeStats",value:function(){var e=new c.CallBuilder((0,a.default)(this.serverURL));return e.filter.push(["operation_fee_stats"]),e.call()}},{key:"submitTransaction",value:function(e){var t=encodeURIComponent(e.toEnvelope().toXDR().toString("base64"));return d.default.post((0,a.default)(this.serverURL).segment("transactions").toString(),"tx="+t,{timeout:T}).then(function(e){if(!e.data.result_xdr)return e.data;var t=h.xdr.TransactionResult.fromXDR(e.data.result_xdr,"base64").result().value(),r=void 0,l=void 0;return t.length&&(r=t.map(function(e,t){if("manageBuyOffer"!==e.value().switch().name&&"manageSellOffer"!==e.value().switch().name)return null;l=!0;var s=new p.default(0),u=new p.default(0),r=e.value().value().success(),n=r.offersClaimed().map(function(e){var t=new p.default(e.amountBought().toString()),r=new p.default(e.amountSold().toString());s=s.add(r),u=u.add(t);var n=h.Asset.fromOperation(e.assetSold()),o=h.Asset.fromOperation(e.assetBought()),i={type:n.getAssetType(),assetCode:n.getCode(),issuer:n.getIssuer()},a={type:o.getAssetType(),assetCode:o.getCode(),issuer:o.getIssuer()};return{sellerId:h.StrKey.encodeEd25519PublicKey(e.sellerId().ed25519()),offerId:e.offerId().toString(),assetSold:i,amountSold:P(r),assetBought:a,amountBought:P(t)}}),o=r.offer().switch().name,i=void 0;if("function"==typeof r.offer().value&&r.offer().value()){var a=r.offer().value();i={offerId:a.offerId().toString(),selling:{},buying:{},amount:P(a.amount().toString()),price:{n:a.price().n(),d:a.price().d()}};var c=h.Asset.fromOperation(a.selling());i.selling={type:c.getAssetType(),assetCode:c.getCode(),issuer:c.getIssuer()};var f=h.Asset.fromOperation(a.buying());i.buying={type:f.getAssetType(),assetCode:f.getCode(),issuer:f.getIssuer()}}return{offersClaimed:n,effect:o,operationIndex:t,currentOffer:i,amountBought:P(s),amountSold:P(u),isFullyOpen:!n.length&&"manageOfferDeleted"!==o,wasPartiallyFilled:!!n.length&&"manageOfferDeleted"!==o,wasImmediatelyFilled:!!n.length&&"manageOfferDeleted"===o,wasImmediatelyDeleted:!n.length&&"manageOfferDeleted"===o}}).filter(function(e){return!!e})),Object.assign({},e.data,{offerResults:l?r:void 0})}).catch(function(e){return e instanceof Error?Promise.reject(e):Promise.reject(new i.BadResponseError("Transaction submission failed. Server responded: "+e.status+" "+e.statusText,e.data))})}},{key:"accounts",value:function(){return new s.AccountCallBuilder((0,a.default)(this.serverURL))}},{key:"ledgers",value:function(){return new y.LedgerCallBuilder((0,a.default)(this.serverURL))}},{key:"transactions",value:function(){return new v.TransactionCallBuilder((0,a.default)(this.serverURL))}},{key:"offers",value:function(e){for(var t=arguments.length,r=Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new(Function.prototype.bind.apply(m.OfferCallBuilder,[null].concat([(0,a.default)(this.serverURL),e],r)))}},{key:"orderbook",value:function(e,t){return new b.OrderbookCallBuilder((0,a.default)(this.serverURL),e,t)}},{key:"trades",value:function(){return new w.TradesCallBuilder((0,a.default)(this.serverURL))}},{key:"operations",value:function(){return new g.OperationCallBuilder((0,a.default)(this.serverURL))}},{key:"paths",value:function(e,t,r,n){return new _.PathCallBuilder((0,a.default)(this.serverURL),e,t,r,n)}},{key:"payments",value:function(){return new E.PaymentCallBuilder((0,a.default)(this.serverURL))}},{key:"effects",value:function(){return new O.EffectCallBuilder((0,a.default)(this.serverURL))}},{key:"friendbot",value:function(e){return new A.FriendbotBuilder((0,a.default)(this.serverURL),e)}},{key:"assets",value:function(){return new x.AssetsCallBuilder((0,a.default)(this.serverURL))}},{key:"loadAccount",value:function(e){return this.accounts().accountId(e).call().then(function(e){return new u.AccountResponse(e)})}},{key:"tradeAggregation",value:function(e,t,r,n,o,i){return new k.TradeAggregationCallBuilder((0,a.default)(this.serverURL),e,t,r,n,o,i)}}]),j);function j(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,j),this.serverURL=(0,a.default)(e);var r=f.Config.isAllowHttp();if(void 0!==t.allowHttp&&(r=t.allowHttp),"https"!==this.serverURL.protocol()&&!r)throw new Error("Cannot connect to insecure horizon server")}},function(r,n,o){var i,a,s;!function(e,t){"use strict";"object"==typeof r&&r.exports?r.exports=t(o(115),o(116),o(117)):(a=[o(115),o(116),o(117)],void 0===(s="function"==typeof(i=t)?i.apply(n,a):i)||(r.exports=s))}(0,function(s,t,c,r){"use strict";var n=r&&r.URI;function g(e,t){var r=1<=arguments.length;if(!(this instanceof g))return r?2<=arguments.length?new g(e,t):new g(e):new g;if(void 0===e){if(r)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&r)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}g.version="1.19.1";var e=g.prototype,f=Object.prototype.hasOwnProperty;function u(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function a(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function l(e){return"Array"===a(e)}function h(e,t){var r,n,o={};if("RegExp"===a(t))o=null;else if(l(t))for(r=0,n=t.length;r<n;r++)o[t[r]]=!0;else o[t]=!0;for(r=0,n=e.length;r<n;r++){(o&&void 0!==o[e[r]]||!o&&t.test(e[r]))&&(e.splice(r,1),n--,r--)}return e}function p(e,t){var r,n;if(l(t)){for(r=0,n=t.length;r<n;r++)if(!p(e,t[r]))return!1;return!0}var o=a(t);for(r=0,n=e.length;r<n;r++)if("RegExp"===o){if("string"==typeof e[r]&&e[r].match(t))return!0}else if(e[r]===t)return!0;return!1}function d(e,t){if(!l(e)||!l(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function y(e){return e.replace(/^\/+|\/+$/g,"")}function o(e){return escape(e)}function i(e){return encodeURIComponent(e).replace(/[!'()*]/g,o).replace(/\*/g,"%2A")}g._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:g.preventInvalidHostname,duplicateQueryParameters:g.duplicateQueryParameters,escapeQuerySpace:g.escapeQuerySpace}},g.preventInvalidHostname=!1,g.duplicateQueryParameters=!1,g.escapeQuerySpace=!0,g.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,g.idn_expression=/[^a-z0-9\._-]/i,g.punycode_expression=/(xn--)/i,g.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,g.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,g.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))/gi,g.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\xab\xbb\u201c\u201d\u201e\u2018\u2019]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},g.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},g.hostProtocols=["http","https"],g.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,g.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},g.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return g.domAttributes[t]}},g.encode=i,g.decode=decodeURIComponent,g.iso8859=function(){g.encode=escape,g.decode=unescape},g.unicode=function(){g.encode=i,g.decode=decodeURIComponent},g.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},g.encodeQuery=function(e,t){var r=g.encode(e+"");return void 0===t&&(t=g.escapeQuerySpace),t?r.replace(/%20/g,"+"):r},g.decodeQuery=function(t,e){t+="",void 0===e&&(e=g.escapeQuerySpace);try{return g.decode(e?t.replace(/\+/g,"%20"):t)}catch(e){return t}};function v(r,n){return function(t){try{return g[n](t+"").replace(g.characters[r][n].expression,function(e){return g.characters[r][n].map[e]})}catch(e){return t}}}var m,b={encode:"encode",decode:"decode"};for(m in b)g[m+"PathSegment"]=v("pathname",b[m]),g[m+"UrnPathSegment"]=v("urnpath",b[m]);function w(i,a,s){return function(e){var t;t=s?function(e){return g[a](g[s](e))}:g[a];for(var r=(e+"").split(i),n=0,o=r.length;n<o;n++)r[n]=t(r[n]);return r.join(i)}}function _(r){return function(e,t){return void 0===e?this._parts[r]||"":(this._parts[r]=e||null,this.build(!t),this)}}function E(r,n){return function(e,t){return void 0===e?this._parts[r]||"":(null!==e&&(e+="").charAt(0)===n&&(e=e.substring(1)),this._parts[r]=e,this.build(!t),this)}}g.decodePath=w("/","decodePathSegment"),g.decodeUrnPath=w(":","decodeUrnPathSegment"),g.recodePath=w("/","encodePathSegment","decode"),g.recodeUrnPath=w(":","encodeUrnPathSegment","decode"),g.encodeReserved=v("reserved","encode"),g.parse=function(e,t){var r;return t=t||{preventInvalidHostname:g.preventInvalidHostname},-1<(r=e.indexOf("#"))&&(t.fragment=e.substring(r+1)||null,e=e.substring(0,r)),-1<(r=e.indexOf("?"))&&(t.query=e.substring(r+1)||null,e=e.substring(0,r)),"//"===e.substring(0,2)?(t.protocol=null,e=e.substring(2),e=g.parseAuthority(e,t)):-1<(r=e.indexOf(":"))&&(t.protocol=e.substring(0,r)||null,t.protocol&&!t.protocol.match(g.protocol_expression)?t.protocol=void 0:"//"===e.substring(r+1,r+3)?(e=e.substring(r+3),e=g.parseAuthority(e,t)):(e=e.substring(r+1),t.urn=!0)),t.path=e,t},g.parseHost=function(e,t){var r,n,o=(e=(e=e||"").replace(/\\/g,"/")).indexOf("/");if(-1===o&&(o=e.length),"["===e.charAt(0))r=e.indexOf("]"),t.hostname=e.substring(1,r)||null,t.port=e.substring(r+2,o)||null,"/"===t.port&&(t.port=null);else{var i=e.indexOf(":"),a=e.indexOf("/"),s=e.indexOf(":",i+1);-1!==s&&(-1===a||s<a)?(t.hostname=e.substring(0,o)||null,t.port=null):(n=e.substring(0,o).split(":"),t.hostname=n[0]||null,t.port=n[1]||null)}return t.hostname&&"/"!==e.substring(o).charAt(0)&&(o++,e="/"+e),t.preventInvalidHostname&&g.ensureValidHostname(t.hostname,t.protocol),t.port&&g.ensureValidPort(t.port),e.substring(o)||"/"},g.parseAuthority=function(e,t){return e=g.parseUserinfo(e,t),g.parseHost(e,t)},g.parseUserinfo=function(e,t){var r,n=e.indexOf("/"),o=e.lastIndexOf("@",-1<n?n:e.length-1);return-1<o&&(-1===n||o<n)?(r=e.substring(0,o).split(":"),t.username=r[0]?g.decode(r[0]):null,r.shift(),t.password=r[0]?g.decode(r.join(":")):null,e=e.substring(o+1)):(t.username=null,t.password=null),e},g.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var r,n,o,i={},a=e.split("&"),s=a.length,u=0;u<s;u++)r=a[u].split("="),n=g.decodeQuery(r.shift(),t),o=r.length?g.decodeQuery(r.join("="),t):null,f.call(i,n)?("string"!=typeof i[n]&&null!==i[n]||(i[n]=[i[n]]),i[n].push(o)):i[n]=o;return i},g.build=function(e){var t="";return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//"),t+=g.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&"string"==typeof e.hostname&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},g.buildHost=function(e){var t="";return e.hostname?(g.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},g.buildAuthority=function(e){return g.buildUserinfo(e)+g.buildHost(e)},g.buildUserinfo=function(e){var t="";return e.username&&(t+=g.encode(e.username)),e.password&&(t+=":"+g.encode(e.password)),t&&(t+="@"),t},g.buildQuery=function(e,t,r){var n,o,i,a,s="";for(o in e)if(f.call(e,o)&&o)if(l(e[o]))for(n={},i=0,a=e[o].length;i<a;i++)void 0!==e[o][i]&&void 0===n[e[o][i]+""]&&(s+="&"+g.buildQueryParameter(o,e[o][i],r),!0!==t&&(n[e[o][i]+""]=!0));else void 0!==e[o]&&(s+="&"+g.buildQueryParameter(o,e[o],r));return s.substring(1)},g.buildQueryParameter=function(e,t,r){return g.encodeQuery(e,r)+(null!==t?"="+g.encodeQuery(t,r):"")},g.addQuery=function(e,t,r){if("object"==typeof t)for(var n in t)f.call(t,n)&&g.addQuery(e,n,t[n]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=r);"string"==typeof e[t]&&(e[t]=[e[t]]),l(r)||(r=[r]),e[t]=(e[t]||[]).concat(r)}},g.setQuery=function(e,t,r){if("object"==typeof t)for(var n in t)f.call(t,n)&&g.setQuery(e,n,t[n]);else{if("string"!=typeof t)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");e[t]=void 0===r?null:r}},g.removeQuery=function(e,t,r){var n,o,i;if(l(t))for(n=0,o=t.length;n<o;n++)e[t[n]]=void 0;else if("RegExp"===a(t))for(i in e)t.test(i)&&(e[i]=void 0);else if("object"==typeof t)for(i in t)f.call(t,i)&&g.removeQuery(e,i,t[i]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==r?"RegExp"===a(r)?!l(e[t])&&r.test(e[t])?e[t]=void 0:e[t]=h(e[t],r):e[t]!==String(r)||l(r)&&1!==r.length?l(e[t])&&(e[t]=h(e[t],r)):e[t]=void 0:e[t]=void 0}},g.hasQuery=function(e,t,r,n){switch(a(t)){case"String":break;case"RegExp":for(var o in e)if(f.call(e,o)&&t.test(o)&&(void 0===r||g.hasQuery(e,o,r)))return!0;return!1;case"Object":for(var i in t)if(f.call(t,i)&&!g.hasQuery(e,i,t[i]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(a(r)){case"Undefined":return t in e;case"Boolean":return r===Boolean(l(e[t])?e[t].length:e[t]);case"Function":return!!r(e[t],t,e);case"Array":return!!l(e[t])&&(n?p:d)(e[t],r);case"RegExp":return l(e[t])?!!n&&p(e[t],r):Boolean(e[t]&&e[t].match(r));case"Number":r=String(r);case"String":return l(e[t])?!!n&&p(e[t],r):e[t]===r;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},g.joinPaths=function(){for(var e=[],t=[],r=0,n=0;n<arguments.length;n++){var o=new g(arguments[n]);e.push(o);for(var i=o.segment(),a=0;a<i.length;a++)"string"==typeof i[a]&&t.push(i[a]),i[a]&&r++}if(!t.length||!r)return new g("");var s=new g("").segment(t);return""!==e[0].path()&&"/"!==e[0].path().slice(0,1)||s.path("/"+s.path()),s.normalize()},g.commonPath=function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r)){r--;break}return r<1?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":("/"===e.charAt(r)&&"/"===t.charAt(r)||(r=e.substring(0,r).lastIndexOf("/")),e.substring(0,r+1))},g.withinString=function(e,t,r){var n=(r=r||{}).start||g.findUri.start,o=r.end||g.findUri.end,i=r.trim||g.findUri.trim,a=r.parens||g.findUri.parens,s=/[a-z0-9-]=["']?$/i;for(n.lastIndex=0;;){var u=n.exec(e);if(!u)break;var c=u.index;if(r.ignoreHtml){var f=e.slice(Math.max(c-3,0),c);if(f&&s.test(f))continue}for(var l=c+e.slice(c).search(o),h=e.slice(c,l),p=-1;;){var d=a.exec(h);if(!d)break;var y=d.index+d[0].length;p=Math.max(p,y)}if(!((h=-1<p?h.slice(0,p)+h.slice(p).replace(i,""):h.replace(i,"")).length<=u[0].length||r.ignore&&r.ignore.test(h))){var v=t(h,c,l=c+h.length,e);void 0!==v?(v=String(v),e=e.slice(0,c)+v+e.slice(l),n.lastIndex=c+v.length):n.lastIndex=l}}return n.lastIndex=0,e},g.ensureValidHostname=function(e,t){var r=!!e,n=!1;if(!!t&&(n=p(g.hostProtocols,t)),n&&!r)throw new TypeError("Hostname cannot be empty, if protocol is "+t);if(e&&e.match(g.invalid_hostname_characters)){if(!s)throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(s.toASCII(e).match(g.invalid_hostname_characters))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_]')}},g.ensureValidPort=function(e){if(e){var t=Number(e);if(!(function(e){return/^[0-9]+$/.test(e)}(t)&&0<t&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},g.noConflict=function(e){if(e){var t={URI:this.noConflict()};return r.URITemplate&&"function"==typeof r.URITemplate.noConflict&&(t.URITemplate=r.URITemplate.noConflict()),r.IPv6&&"function"==typeof r.IPv6.noConflict&&(t.IPv6=r.IPv6.noConflict()),r.SecondLevelDomains&&"function"==typeof r.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=r.SecondLevelDomains.noConflict()),t}return r.URI===this&&(r.URI=n),this},e.build=function(e){return!0===e?this._deferred_build=!0:void 0!==e&&!this._deferred_build||(this._string=g.build(this._parts),this._deferred_build=!1),this},e.clone=function(){return new g(this)},e.valueOf=e.toString=function(){return this.build(!1)._string},e.protocol=_("protocol"),e.username=_("username"),e.password=_("password"),e.hostname=_("hostname"),e.port=_("port"),e.query=E("query","?"),e.fragment=E("fragment","#"),e.search=function(e,t){var r=this.query(e,t);return"string"==typeof r&&r.length?"?"+r:r},e.hash=function(e,t){var r=this.fragment(e,t);return"string"==typeof r&&r.length?"#"+r:r},e.pathname=function(e,t){if(void 0!==e&&!0!==e)return this._parts.urn?this._parts.path=e?g.recodeUrnPath(e):"":this._parts.path=e?g.recodePath(e):"/",this.build(!t),this;var r=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?g.decodeUrnPath:g.decodePath)(r):r},e.path=e.pathname,e.href=function(e,t){var r;if(void 0===e)return this.toString();this._string="",this._parts=g._parts();var n=e instanceof g,o="object"==typeof e&&(e.hostname||e.path||e.pathname);e.nodeName&&(e=e[g.getDomAttribute(e)]||"",o=!1);if(!n&&o&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=g.parse(String(e),this._parts);else{if(!n&&!o)throw new TypeError("invalid input");var i=n?e._parts:e;for(r in i)"query"!==r&&f.call(this._parts,r)&&(this._parts[r]=i[r]);i.query&&this.query(i.query,!1)}return this.build(!t),this},e.is=function(e){var t=!1,r=!1,n=!1,o=!1,i=!1,a=!1,s=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,r=g.ip4_expression.test(this._parts.hostname),n=g.ip6_expression.test(this._parts.hostname),i=(o=!(t=r||n))&&c&&c.has(this._parts.hostname),a=o&&g.idn_expression.test(this._parts.hostname),s=o&&g.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return u;case"absolute":return!u;case"domain":case"name":return o;case"sld":return i;case"ip":return t;case"ip4":case"ipv4":case"inet4":return r;case"ip6":case"ipv6":case"inet6":return n;case"idn":return a;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return s}return null};var O=e.protocol,A=e.port,x=e.hostname;e.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(g.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return O.call(this,e,t)},e.scheme=e.protocol,e.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),g.ensureValidPort(e))),A.call(this,e,t))},e.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var r={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==g.parseHost(e,r))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=r.hostname,this._parts.preventInvalidHostname&&g.ensureValidHostname(e,this._parts.protocol)}return x.call(this,e,t)},e.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var r=this.protocol();return this.authority()?(r?r+"://":"")+this.authority():""}var n=g(e);return this.protocol(n.protocol()).authority(n.authority()).build(!t),this},e.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?g.buildHost(this._parts):"";if("/"!==g.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},e.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?g.buildAuthority(this._parts):"";if("/"!==g.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},e.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e)return"@"!==e[e.length-1]&&(e+="@"),g.parseUserinfo(e,this._parts),this.build(!t),this;var r=g.buildUserinfo(this._parts);return r?r.substring(0,r.length-1):r},e.resource=function(e,t){var r;return void 0===e?this.path()+this.search()+this.hash():(r=g.parse(e),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!t),this)},e.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,o=this._parts.hostname.substring(0,n),i=new RegExp("^"+u(o));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&g.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(i,e),this.build(!t),this},e.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(t).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(g.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var o=new RegExp(u(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},e.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.lastIndexOf("."),n=this._parts.hostname.substring(r+1);return!0!==t&&c&&c.list[n.toLowerCase()]&&c.get(this._parts.hostname)||n}var o;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!c||!c.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},e.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return e?g.decodePath(n):n}var o=this._parts.path.length-this.filename().length,i=this._parts.path.substring(0,o),a=new RegExp("^"+u(i));return this.is("relative")||"/"!==(e=e||"/").charAt(0)&&(e="/"+e),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=g.recodePath(e),this._parts.path=this._parts.path.replace(a,e),this.build(!t),this},e.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return e?g.decodePathSegment(n):n}var o=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(o=!0);var i=new RegExp(u(this.filename())+"$");return e=g.recodePath(e),this._parts.path=this._parts.path.replace(i,e),o?this.normalizePath(t):this.build(!t),this},e.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,o=this.filename(),i=o.lastIndexOf(".");return-1===i?"":(r=o.substring(i+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",e?g.decodePathSegment(n):n)}"."===e.charAt(0)&&(e=e.substring(1));var a,s=this.suffix();if(s)a=e?new RegExp(u(s)+"$"):new RegExp(u("."+s)+"$");else{if(!e)return this;this._parts.path+="."+g.recodePath(e)}return a&&(e=g.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},e.segment=function(e,t,r){var n=this._parts.urn?":":"/",o=this.path(),i="/"===o.substring(0,1),a=o.split(n);if(void 0!==e&&"number"!=typeof e&&(r=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(i&&a.shift(),e<0&&(e=Math.max(a.length+e,0)),void 0===t)return void 0===e?a:a[e];if(null===e||void 0===a[e])if(l(t)){a=[];for(var s=0,u=t.length;s<u;s++)(t[s].length||a.length&&a[a.length-1].length)&&(a.length&&!a[a.length-1].length&&a.pop(),a.push(y(t[s])))}else!t&&"string"!=typeof t||(t=y(t),""===a[a.length-1]?a[a.length-1]=t:a.push(t));else t?a[e]=y(t):a.splice(e,1);return i&&a.unshift(""),this.path(a.join(n),r)},e.segmentCoded=function(e,t,r){var n,o,i;if("number"!=typeof e&&(r=t,t=e,e=void 0),void 0===t){if(l(n=this.segment(e,t,r)))for(o=0,i=n.length;o<i;o++)n[o]=g.decode(n[o]);else n=void 0!==n?g.decode(n):void 0;return n}if(l(t))for(o=0,i=t.length;o<i;o++)t[o]=g.encode(t[o]);else t="string"==typeof t||t instanceof String?g.encode(t):t;return this.segment(e,t,r)};var k=e.query;return e.query=function(e,t){if(!0===e)return g.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"!=typeof e)return void 0!==e&&"string"!=typeof e?(this._parts.query=g.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):k.call(this,e,t);var r=g.parseQuery(this._parts.query,this._parts.escapeQuerySpace),n=e.call(this,r);ret