/*! URI.js v1.17.1 medialize.github.io/URI.js/ */ /* build contains: URI.js */ (function(p,w)“object”===typeof exports?module.exports=w(require(“./punycode”),require(“./IPv6”),require(“./SecondLevelDomains”)):“function”===typeof define&&define.amd?define([“./punycode”,“./IPv6”,“./SecondLevelDomains”],w):p.URI=w(p.punycode,p.IPv6,p.SecondLevelDomains,p)})(this,function(p,w,u,m){function d(a,b){var c=1<=arguments.length,f=2<=arguments.length;if(!(this instanceof d))return c?f?new d(a,b):new d(a):new d;if(void 0===a){if(c)throw new TypeError("undefined is not a valid argument for URI"); a="undefined"!==typeof location?location.href+"":""}this.href(a);return void 0!==b?this.absoluteTo(b):this}function r(a){return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function v(a){return void 0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}function h(a){return"Array"===v(a)}function D(a,b){var c={},d,g;if("RegExp"===v(b))c=null;else if(h(b))for(d=0,g=b.length;da.hostname
”]“):b+a.hostname;else return”“;a.port&&(b+=”:“+a.port);return b};d.buildAuthority= function(a){return d.buildUserinfo(a)+d.buildHost(a)};d.buildUserinfo=function(a){var b=”“;a.username&&(b+=d.encode(a.username),a.password&&(b+=”:“+d.encode(a.password)),b+=”@“);return b};d.buildQuery=function(a,b,c){var f=”“,g,e,l,n;for(e in a)if(q.call(a,e)&&e)if(h(a))for(g={},l=0,n=a.length;l<n;l++)void 0!==a[l]&&void 0===g[a[l]+”“]&&(f+=”&“+d.buildQueryParameter(e,a[l],c),!0!==b&&(g[a[l]+”“]=!0));else void 0!==a&&(f+=”&“+d.buildQueryParameter(e,a,c));return f.substring(1)}; d.buildQueryParameter=function(a,b,c){return d.encodeQuery(a,c)+(null!==b?”=“+d.encodeQuery(b,c):”“)};d.addQuery=function(a,b,c){if(”object“===typeof b)for(var f in b)q.call(b,f)&&d.addQuery(a,f,b);else if(”string“===typeof b)void 0===a?a=c:(”string“===typeof a&&(a=[a]),h©||(c=),a=(a||[]).concat©);else throw new TypeError(”URI.addQuery() accepts an object, string as the name parameter“);};d.removeQuery=function(a,b,c){var f;if(h(b))for(c=0,f=b.length;ca
'” contains characters other than [A-Z0-9.-] and Punycode.js is not available');if(p.toASCII(a).match(d.invalid_hostname_characters))throw new TypeError('Hostname “'a
'” contains characters other than [A-Z0-9.-]');}};d.noConflict=function(a){if(a)return a={URI:this.noConflict()},m.URITemplate&&“function”===typeof m.URITemplate.noConflict&&(a.URITemplate=m.URITemplate.noConflict()),m.IPv6&&“function”=== typeof m.IPv6.noConflict&&(a.IPv6=m.IPv6.noConflict()),m.SecondLevelDomains&&“function”===typeof m.SecondLevelDomains.noConflict&&(a.SecondLevelDomains=m.SecondLevelDomains.noConflict()),a;m.URI===this&&(m.URI=H);return this};e.build=function(a){if(!0===a)this._deferred_build=!0;else if(void 0===a||this._deferred_build)this._string=d.build(this._parts),this._deferred_build=!1;return this};e.clone=function(){return new d(this)};e.valueOf=e.toString=function(){return this.build(!1)._string};e.protocol= x(“protocol”);e.username=x(“username”);e.password=x(“password”);e.hostname=x(“hostname”);e.port=x(“port”);e.query=F(“query”,“?”);e.fragment=F(“fragment”,“#”);e.search=function(a,b){var c=this.query(a,b);return“string”===typeof c&&c.length?“?”+c:c};e.hash=function(a,b){var c=this.fragment(a,b);return“string”===typeof c&&c.length?“#”+c:c};e.pathname=function(a,b){if(void 0===a||!0===a){var c=this._parts.path||(this._parts.hostname?“/”:“”);return a?(this._parts.urn?d.decodeUrnPath:d.decodePath)©:c}this._parts.path= this._parts.urn?a?d.recodeUrnPath(a):“”:a?d.recodePath(a):“/”;this.build(!b);return this};e.path=e.pathname;e.href=function(a,b){var c;if(void 0===a)return this.toString();this._string=“”;this._parts=d._parts();var f=a instanceof d,e=“object”===typeof a&&(a.hostname||a.path||a.pathname);a.nodeName&&(e=d.getDomAttribute(a),a=a||“”,e=!1);!f&&e&&void 0!==a.pathname&&(a=a.toString());if(“string”===typeof a||a instanceof String)this._parts=d.parse(String(a),this._parts);else if(f||e)for(c in f=f?a._parts: a,f)q.call(this._parts,c)&&(this._parts=f);else throw new TypeError(“invalid input”);this.build(!b);return this};e.is=function(a){var b=!1,c=!1,f=!1,e=!1,k=!1,l=!1,h=!1,m=!this._parts.urn;this._parts.hostname&&(m=!1,c=d.ip4_expression.test(this._parts.hostname),f=d.ip6_expression.test(this._parts.hostname),b=c||f,k=(e=!b)&&u&&u.has(this._parts.hostname),l=e&&d.idn_expression.test(this._parts.hostname),h=e&&d.punycode_expression.test(this._parts.hostname));switch(a.toLowerCase()){case “relative”:return m; case “absolute”:return!m;case “domain”:case “name”:return e;case “sld”:return k;case “ip”:return b;case “ip4”:case “ipv4”:case “inet4”:return c;case “ip6”:case “ipv6”:case “inet6”:return f;case “idn”:return l;case “url”:return!this._parts.urn;case “urn”:return!!this._parts.urn;case “punycode”:return h}return null};var I=e.protocol,J=e.port,K=e.hostname;e.protocol=function(a,b){if(void 0!==a&&a&&(a=a.replace(/:(//)?$/,“”),!a.match(d.protocol_expression)))throw new TypeError('Protocol “'a
”" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]“); return I.call(this,a,b)};e.scheme=e.protocol;e.port=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0!==a&&(0===a&&(a=null),a&&(a+=”“,”:“===a.charAt(0)&&(a=a.substring(1)),a.match(//))))throw new TypeError('Port ”'a
'“ contains characters other than [0-9]');return J.call(this,a,b)};e.hostname=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0!==a){var c={};if(”/“!==d.parseHost(a,c))throw new TypeError('Hostname ”'a
'“ contains characters other than [A-Z0-9.-]'); a=c.hostname}return K.call(this,a,b)};e.origin=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a){var c=this.protocol();return this.authority()?(c?c+”://“:”“)+this.authority():”“}c=d(a);this.protocol(c.protocol()).authority(c.authority()).build(!b);return this};e.host=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a)return this._parts.hostname?d.buildHost(this._parts):”“;if(”/“!==d.parseHost(a,this._parts))throw new TypeError('Hostname ”'a
'“ contains characters other than [A-Z0-9.-]'); this.build(!b);return this};e.authority=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a)return this._parts.hostname?d.buildAuthority(this._parts):”“;if(”/“!==d.parseAuthority(a,this._parts))throw new TypeError('Hostname ”'a
'“ contains characters other than [A-Z0-9.-]');this.build(!b);return this};e.userinfo=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a){if(!this._parts.username)return”“;var c=d.buildUserinfo(this._parts);return c.substring(0,c.length- 1)}”@“!==a&&(a+=”@“);d.parseUserinfo(a,this._parts);this.build(!b);return this};e.resource=function(a,b){var c;if(void 0===a)return this.path()+this.search()+this.hash();c=d.parse(a);this._parts.path=c.path;this._parts.query=c.query;this._parts.fragment=c.fragment;this.build(!b);return this};e.subdomain=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a){if(!this._parts.hostname||this.is(”IP“))return”“;var c=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0, c)||”“}c=this._parts.hostname.length-this.domain().length;c=this._parts.hostname.substring(0,c);c=new RegExp(”^“+r©);a&&”.“!==a.charAt(a.length-1)&&(a+=”.“);a&&d.ensureValidHostname(a);this._parts.hostname=this._parts.hostname.replace(c,a);this.build(!b);return this};e.domain=function(a,b){if(this._parts.urn)return void 0===a?”“:this;”boolean“===typeof a&&(b=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is(”IP“))return”“;var c=this._parts.hostname.match(/./g);if(c&&2>c.length)return this._parts.hostname; c=this._parts.hostname.length-this.tld(b).length-1;c=this._parts.hostname.lastIndexOf(”.“,c-1)+1;return this._parts.hostname.substring©||”“}if(!a)throw new TypeError(”cannot set domain empty“);d.ensureValidHostname(a);!this._parts.hostname||this.is(”IP“)?this._parts.hostname=a:(c=new RegExp(r(this.domain())+”$“),this._parts.hostname=this._parts.hostname.replace(c,a));this.build(!b);return this};e.tld=function(a,b){if(this._parts.urn)return void 0===a?”“:this;”boolean“===typeof a&&(b=a,a=void 0); if(void 0===a){if(!this._parts.hostname||this.is(”IP“))return”“;var c=this._parts.hostname.lastIndexOf(”.“),c=this._parts.hostname.substring(c+1);return!0!==b&&u&&u.list?u.get(this._parts.hostname)||c:c}if(a)if(a.match(//))if(u&&u.is(a))c=new RegExp(r(this.tld())+”$“),this._parts.hostname=this._parts.hostname.replace(c,a);else throw new TypeError('TLD ”'a
'“ contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is(”IP“))throw new ReferenceError(”cannot set TLD on non-domain host“); c=new RegExp(r(this.tld())+”$“);this._parts.hostname=this._parts.hostname.replace(c,a)}else throw new TypeError(”cannot set TLD empty“);this.build(!b);return this};e.directory=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return”“;if(”/“===this._parts.path)return”/“;var c=this._parts.path.length-this.filename().length-1,c=this._parts.path.substring(0,c)||(this._parts.hostname?”/“:”“);return a?d.decodePath©:c}c=this._parts.path.length- this.filename().length;c=this._parts.path.substring(0,c);c=new RegExp(”^“+r©);this.is(”relative“)||(a||(a=”/“),”/“!==a.charAt(0)&&(a=”/“+a));a&&”/“!==a.charAt(a.length-1)&&(a+=”/“);a=d.recodePath(a);this._parts.path=this._parts.path.replace(c,a);this.build(!b);return this};e.filename=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a||!0===a){if(!this._parts.path||”/“===this._parts.path)return”“;var c=this._parts.path.lastIndexOf(”/“),c=this._parts.path.substring(c+1);return a? d.decodePathSegment©:c}c=!1;”/“===a.charAt(0)&&(a=a.substring(1));a.match(/.?//)&&(c=!0);var f=new RegExp(r(this.filename())+”$“);a=d.recodePath(a);this._parts.path=this._parts.path.replace(f,a);c?this.normalizePath(b):this.build(!b);return this};e.suffix=function(a,b){if(this._parts.urn)return void 0===a?”“:this;if(void 0===a||!0===a){if(!this._parts.path||”/“===this._parts.path)return”“;var c=this.filename(),f=c.lastIndexOf(”.“);if(-1===f)return”“;c=c.substring(f+1);c=/^+$/i.test©? c:”“;return a?d.decodePathSegment©:c}”.“===a.charAt(0)&&(a=a.substring(1));if(c=this.suffix())f=a?new RegExp(r©+”$“):new RegExp(r(”.“c)
”$“);else{if(!a)return this;this._parts.path+=”.“+d.recodePath(a)}f&&(a=d.recodePath(a),this._parts.path=this._parts.path.replace(f,a));this.build(!b);return this};e.segment=function(a,b,c){var d=this._parts.urn?”:“:”/“,e=this.path(),k=”/“===e.substring(0,1),e=e.split(d);void 0!==a&&”number“!==typeof a&&(c=b,b=a,a=void 0);if(void 0!==a&&”number“!==typeof a)throw Error('Bad segment ”'+ a+'“, must be 0-based integer');k&&e.shift();0>a&&(a=Math.max(e.length+a,0));if(void 0===b)return void 0===a?e:e;if(null===a||void 0===e)if(h(b)){e=[];a=0;for(var l=b.length;a