mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-11-04 06:49:31 +00:00 
			
		
		
		
	Updated everything
This commit is contained in:
		
							
								
								
									
										18
									
								
								node_modules/uri-js/src/index.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								node_modules/uri-js/src/index.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,18 +0,0 @@
 | 
			
		||||
import { SCHEMES } from "./uri";
 | 
			
		||||
 | 
			
		||||
import http from "./schemes/http";
 | 
			
		||||
SCHEMES[http.scheme] = http;
 | 
			
		||||
 | 
			
		||||
import https from "./schemes/https";
 | 
			
		||||
SCHEMES[https.scheme] = https;
 | 
			
		||||
 | 
			
		||||
import mailto from "./schemes/mailto";
 | 
			
		||||
SCHEMES[mailto.scheme] = mailto;
 | 
			
		||||
 | 
			
		||||
import urn from "./schemes/urn";
 | 
			
		||||
SCHEMES[urn.scheme] = urn;
 | 
			
		||||
 | 
			
		||||
import uuid from "./schemes/urn-uuid";
 | 
			
		||||
SCHEMES[uuid.scheme] = uuid;
 | 
			
		||||
 | 
			
		||||
export * from "./uri";
 | 
			
		||||
							
								
								
									
										24
									
								
								node_modules/uri-js/src/punycode.d.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								node_modules/uri-js/src/punycode.d.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,24 +0,0 @@
 | 
			
		||||
declare module 'punycode' {
 | 
			
		||||
	function ucs2decode(string:string):Array<number>;
 | 
			
		||||
	function ucs2encode(array:Array<number>):string;
 | 
			
		||||
	function decode(string:string):string;
 | 
			
		||||
	function encode(string:string):string;
 | 
			
		||||
	function toASCII(string:string):string;
 | 
			
		||||
	function toUnicode(string:string):string;
 | 
			
		||||
 | 
			
		||||
	interface Punycode {
 | 
			
		||||
		'version': '2.2.0';
 | 
			
		||||
		'ucs2': {
 | 
			
		||||
			'decode': typeof ucs2decode;
 | 
			
		||||
			'encode': typeof ucs2encode;
 | 
			
		||||
		},
 | 
			
		||||
		'decode': typeof decode;
 | 
			
		||||
		'encode': typeof encode;
 | 
			
		||||
		'toASCII': typeof toASCII;
 | 
			
		||||
		'toUnicode': typeof toUnicode;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const punycode:Punycode;
 | 
			
		||||
 | 
			
		||||
	export default punycode;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								node_modules/uri-js/src/regexps-iri.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								node_modules/uri-js/src/regexps-iri.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,4 +0,0 @@
 | 
			
		||||
import { URIRegExps } from "./uri";
 | 
			
		||||
import { buildExps } from "./regexps-uri";
 | 
			
		||||
 | 
			
		||||
export default buildExps(true);
 | 
			
		||||
							
								
								
									
										89
									
								
								node_modules/uri-js/src/regexps-uri.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										89
									
								
								node_modules/uri-js/src/regexps-uri.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,89 +0,0 @@
 | 
			
		||||
import { URIRegExps } from "./uri";
 | 
			
		||||
import { merge, subexp } from "./util";
 | 
			
		||||
 | 
			
		||||
export function buildExps(isIRI:boolean):URIRegExps {
 | 
			
		||||
	const
 | 
			
		||||
		ALPHA$$ = "[A-Za-z]",
 | 
			
		||||
		CR$ = "[\\x0D]",
 | 
			
		||||
		DIGIT$$ = "[0-9]",
 | 
			
		||||
		DQUOTE$$ = "[\\x22]",
 | 
			
		||||
		HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),  //case-insensitive
 | 
			
		||||
		LF$$ = "[\\x0A]",
 | 
			
		||||
		SP$$ = "[\\x20]",
 | 
			
		||||
		PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),  //expanded
 | 
			
		||||
		GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
 | 
			
		||||
		SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
 | 
			
		||||
		RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
 | 
			
		||||
		UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",  //subset, excludes bidi control characters
 | 
			
		||||
		IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",  //subset
 | 
			
		||||
		UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$),
 | 
			
		||||
		SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"),
 | 
			
		||||
		USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"),
 | 
			
		||||
		DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$),
 | 
			
		||||
		DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),  //relaxed parsing rules
 | 
			
		||||
		IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
 | 
			
		||||
		H16$ = subexp(HEXDIG$$ + "{1,4}"),
 | 
			
		||||
		LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
 | 
			
		||||
		IPV6ADDRESS1$ = subexp(                                                            subexp(H16$ + "\\:") + "{6}" + LS32$), //                           6( h16 ":" ) ls32
 | 
			
		||||
		IPV6ADDRESS2$ = subexp(                                                 "\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), //                      "::" 5( h16 ":" ) ls32
 | 
			
		||||
		IPV6ADDRESS3$ = subexp(subexp(                                 H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), //[               h16 ] "::" 4( h16 ":" ) ls32
 | 
			
		||||
		IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
 | 
			
		||||
		IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
 | 
			
		||||
		IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" +        H16$ + "\\:"          + LS32$), //[ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
 | 
			
		||||
		IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:"                                + LS32$), //[ *4( h16 ":" ) h16 ] "::"              ls32
 | 
			
		||||
		IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:"                                + H16$ ), //[ *5( h16 ":" ) h16 ] "::"              h16
 | 
			
		||||
		IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"                                       ), //[ *6( h16 ":" ) h16 ] "::"
 | 
			
		||||
		IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
 | 
			
		||||
		ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"),  //RFC 6874
 | 
			
		||||
		IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$),  //RFC 6874
 | 
			
		||||
		IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$),  //RFC 6874, with relaxed parsing rules
 | 
			
		||||
		IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"),
 | 
			
		||||
		IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"),  //RFC 6874
 | 
			
		||||
		REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"),
 | 
			
		||||
		HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$),
 | 
			
		||||
		PORT$ = subexp(DIGIT$$ + "*"),
 | 
			
		||||
		AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"),
 | 
			
		||||
		PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")),
 | 
			
		||||
		SEGMENT$ = subexp(PCHAR$ + "*"),
 | 
			
		||||
		SEGMENT_NZ$ = subexp(PCHAR$ + "+"),
 | 
			
		||||
		SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"),
 | 
			
		||||
		PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"),
 | 
			
		||||
		PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"),  //simplified
 | 
			
		||||
		PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$),  //simplified
 | 
			
		||||
		PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$),  //simplified
 | 
			
		||||
		PATH_EMPTY$ = "(?!" + PCHAR$ + ")",
 | 
			
		||||
		PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
 | 
			
		||||
		QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"),
 | 
			
		||||
		FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"),
 | 
			
		||||
		HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
 | 
			
		||||
		URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
 | 
			
		||||
		RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$),
 | 
			
		||||
		RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
 | 
			
		||||
		URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$),
 | 
			
		||||
		ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"),
 | 
			
		||||
 | 
			
		||||
		GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
 | 
			
		||||
		RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
 | 
			
		||||
		ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$",
 | 
			
		||||
		SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
 | 
			
		||||
		AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"
 | 
			
		||||
	;
 | 
			
		||||
 | 
			
		||||
	return {
 | 
			
		||||
		NOT_SCHEME : new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
 | 
			
		||||
		NOT_USERINFO : new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
 | 
			
		||||
		NOT_HOST : new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
 | 
			
		||||
		NOT_PATH : new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
 | 
			
		||||
		NOT_PATH_NOSCHEME : new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
 | 
			
		||||
		NOT_QUERY : new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
 | 
			
		||||
		NOT_FRAGMENT : new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
 | 
			
		||||
		ESCAPE : new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
 | 
			
		||||
		UNRESERVED : new RegExp(UNRESERVED$$, "g"),
 | 
			
		||||
		OTHER_CHARS : new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
 | 
			
		||||
		PCT_ENCODED : new RegExp(PCT_ENCODED$, "g"),
 | 
			
		||||
		IPV4ADDRESS : new RegExp("^(" + IPV4ADDRESS$ + ")$"),
 | 
			
		||||
		IPV6ADDRESS : new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$")  //RFC 6874, with relaxed parsing rules
 | 
			
		||||
	};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default buildExps(false);
 | 
			
		||||
							
								
								
									
										36
									
								
								node_modules/uri-js/src/schemes/http.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								node_modules/uri-js/src/schemes/http.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,36 +0,0 @@
 | 
			
		||||
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
 | 
			
		||||
 | 
			
		||||
const handler:URISchemeHandler = {
 | 
			
		||||
	scheme : "http",
 | 
			
		||||
 | 
			
		||||
	domainHost : true,
 | 
			
		||||
 | 
			
		||||
	parse : function (components:URIComponents, options:URIOptions):URIComponents {
 | 
			
		||||
		//report missing host
 | 
			
		||||
		if (!components.host) {
 | 
			
		||||
			components.error = components.error || "HTTP URIs must have a host.";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return components;
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	serialize : function (components:URIComponents, options:URIOptions):URIComponents {
 | 
			
		||||
		//normalize the default port
 | 
			
		||||
		if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
 | 
			
		||||
			components.port = undefined;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		//normalize the empty path
 | 
			
		||||
		if (!components.path) {
 | 
			
		||||
			components.path = "/";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//NOTE: We do not parse query strings for HTTP URIs
 | 
			
		||||
		//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
 | 
			
		||||
		//and not the HTTP spec.
 | 
			
		||||
 | 
			
		||||
		return components;
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default handler;
 | 
			
		||||
							
								
								
									
										11
									
								
								node_modules/uri-js/src/schemes/https.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								node_modules/uri-js/src/schemes/https.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,11 +0,0 @@
 | 
			
		||||
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
 | 
			
		||||
import http from "./http";
 | 
			
		||||
 | 
			
		||||
const handler:URISchemeHandler = {
 | 
			
		||||
	scheme : "https",
 | 
			
		||||
	domainHost : http.domainHost,
 | 
			
		||||
	parse : http.parse,
 | 
			
		||||
	serialize : http.serialize
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default handler;
 | 
			
		||||
							
								
								
									
										182
									
								
								node_modules/uri-js/src/schemes/mailto.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										182
									
								
								node_modules/uri-js/src/schemes/mailto.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,182 +0,0 @@
 | 
			
		||||
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
 | 
			
		||||
import { pctEncChar, pctDecChars, unescapeComponent } from "../uri";
 | 
			
		||||
import punycode from "punycode";
 | 
			
		||||
import { merge, subexp, toUpperCase, toArray } from "../util";
 | 
			
		||||
 | 
			
		||||
export interface MailtoHeaders {
 | 
			
		||||
	[hfname:string]:string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface MailtoComponents extends URIComponents {
 | 
			
		||||
	to:Array<string>,
 | 
			
		||||
	headers?:MailtoHeaders,
 | 
			
		||||
	subject?:string,
 | 
			
		||||
	body?:string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const O:MailtoHeaders = {};
 | 
			
		||||
const isIRI = true;
 | 
			
		||||
 | 
			
		||||
//RFC 3986
 | 
			
		||||
const UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]";
 | 
			
		||||
const HEXDIG$$ = "[0-9A-Fa-f]";  //case-insensitive
 | 
			
		||||
const PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$));  //expanded
 | 
			
		||||
 | 
			
		||||
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
 | 
			
		||||
//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
 | 
			
		||||
//const WSP$$ = "[\\x20\\x09]";
 | 
			
		||||
//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]";  //(%d1-8 / %d11-12 / %d14-31 / %d127)
 | 
			
		||||
//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$);  //%d33 / %d35-91 / %d93-126 / obs-qtext
 | 
			
		||||
//const VCHAR$$ = "[\\x21-\\x7E]";
 | 
			
		||||
//const WSP$$ = "[\\x20\\x09]";
 | 
			
		||||
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$));  //%d0 / CR / LF / obs-qtext
 | 
			
		||||
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
 | 
			
		||||
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
 | 
			
		||||
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
 | 
			
		||||
const ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
 | 
			
		||||
const QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
 | 
			
		||||
const VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
 | 
			
		||||
const DOT_ATOM_TEXT$ = subexp(ATEXT$$ + "+" + subexp("\\." + ATEXT$$ + "+") + "*");
 | 
			
		||||
const QUOTED_PAIR$ = subexp("\\\\" + VCHAR$$);
 | 
			
		||||
const QCONTENT$ = subexp(QTEXT$$ + "|" + QUOTED_PAIR$);
 | 
			
		||||
const QUOTED_STRING$ = subexp('\\"' + QCONTENT$ + "*" + '\\"');
 | 
			
		||||
 | 
			
		||||
//RFC 6068
 | 
			
		||||
const DTEXT_NO_OBS$$ = "[\\x21-\\x5A\\x5E-\\x7E]";  //%d33-90 / %d94-126
 | 
			
		||||
const SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
 | 
			
		||||
const QCHAR$ = subexp(UNRESERVED$$ + "|" + PCT_ENCODED$ + "|" + SOME_DELIMS$$);
 | 
			
		||||
const DOMAIN$ = subexp(DOT_ATOM_TEXT$ + "|" + "\\[" + DTEXT_NO_OBS$$ + "*" + "\\]");
 | 
			
		||||
const LOCAL_PART$ = subexp(DOT_ATOM_TEXT$ + "|" + QUOTED_STRING$);
 | 
			
		||||
const ADDR_SPEC$ = subexp(LOCAL_PART$ + "\\@" + DOMAIN$);
 | 
			
		||||
const TO$ = subexp(ADDR_SPEC$ + subexp("\\," + ADDR_SPEC$) + "*");
 | 
			
		||||
const HFNAME$ = subexp(QCHAR$ + "*");
 | 
			
		||||
const HFVALUE$ = HFNAME$;
 | 
			
		||||
const HFIELD$ = subexp(HFNAME$ + "\\=" + HFVALUE$);
 | 
			
		||||
const HFIELDS2$ = subexp(HFIELD$ + subexp("\\&" + HFIELD$) + "*");
 | 
			
		||||
const HFIELDS$ = subexp("\\?" + HFIELDS2$);
 | 
			
		||||
const MAILTO_URI = new RegExp("^mailto\\:" + TO$ + "?" + HFIELDS$ + "?$");
 | 
			
		||||
 | 
			
		||||
const UNRESERVED = new RegExp(UNRESERVED$$, "g");
 | 
			
		||||
const PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
 | 
			
		||||
const NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
 | 
			
		||||
const NOT_DOMAIN = new RegExp(merge("[^]", ATEXT$$, "[\\.]", "[\\[]", DTEXT_NO_OBS$$, "[\\]]"), "g");
 | 
			
		||||
const NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
 | 
			
		||||
const NOT_HFVALUE = NOT_HFNAME;
 | 
			
		||||
const TO = new RegExp("^" + TO$ + "$");
 | 
			
		||||
const HFIELDS = new RegExp("^" + HFIELDS2$ + "$");
 | 
			
		||||
 | 
			
		||||
function decodeUnreserved(str:string):string {
 | 
			
		||||
	const decStr = pctDecChars(str);
 | 
			
		||||
	return (!decStr.match(UNRESERVED) ? str : decStr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const handler:URISchemeHandler<MailtoComponents> =  {
 | 
			
		||||
	scheme : "mailto",
 | 
			
		||||
 | 
			
		||||
	parse : function (components:URIComponents, options:URIOptions):MailtoComponents {
 | 
			
		||||
		const mailtoComponents = components as MailtoComponents;
 | 
			
		||||
		const to = mailtoComponents.to = (mailtoComponents.path ? mailtoComponents.path.split(",") : []);
 | 
			
		||||
		mailtoComponents.path = undefined;
 | 
			
		||||
 | 
			
		||||
		if (mailtoComponents.query) {
 | 
			
		||||
			let unknownHeaders = false
 | 
			
		||||
			const headers:MailtoHeaders = {};
 | 
			
		||||
			const hfields = mailtoComponents.query.split("&");
 | 
			
		||||
 | 
			
		||||
			for (let x = 0, xl = hfields.length; x < xl; ++x) {
 | 
			
		||||
				const hfield = hfields[x].split("=");
 | 
			
		||||
 | 
			
		||||
				switch (hfield[0]) {
 | 
			
		||||
					case "to":
 | 
			
		||||
						const toAddrs = hfield[1].split(",");
 | 
			
		||||
						for (let x = 0, xl = toAddrs.length; x < xl; ++x) {
 | 
			
		||||
							to.push(toAddrs[x]);
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					case "subject":
 | 
			
		||||
						mailtoComponents.subject = unescapeComponent(hfield[1], options);
 | 
			
		||||
						break;
 | 
			
		||||
					case "body":
 | 
			
		||||
						mailtoComponents.body = unescapeComponent(hfield[1], options);
 | 
			
		||||
						break;
 | 
			
		||||
					default:
 | 
			
		||||
						unknownHeaders = true;
 | 
			
		||||
						headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (unknownHeaders) mailtoComponents.headers = headers;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		mailtoComponents.query = undefined;
 | 
			
		||||
 | 
			
		||||
		for (let x = 0, xl = to.length; x < xl; ++x) {
 | 
			
		||||
			const addr = to[x].split("@");
 | 
			
		||||
 | 
			
		||||
			addr[0] = unescapeComponent(addr[0]);
 | 
			
		||||
 | 
			
		||||
			if (!options.unicodeSupport) {
 | 
			
		||||
				//convert Unicode IDN -> ASCII IDN
 | 
			
		||||
				try {
 | 
			
		||||
					addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
 | 
			
		||||
				} catch (e) {
 | 
			
		||||
					mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				addr[1] = unescapeComponent(addr[1], options).toLowerCase();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			to[x] = addr.join("@");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return mailtoComponents;
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	serialize : function (mailtoComponents:MailtoComponents, options:URIOptions):URIComponents {
 | 
			
		||||
		const components = mailtoComponents as URIComponents;
 | 
			
		||||
		const to = toArray(mailtoComponents.to);
 | 
			
		||||
		if (to) {
 | 
			
		||||
			for (let x = 0, xl = to.length; x < xl; ++x) {
 | 
			
		||||
				const toAddr = String(to[x]);
 | 
			
		||||
				const atIdx = toAddr.lastIndexOf("@");
 | 
			
		||||
				const localPart = (toAddr.slice(0, atIdx)).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
 | 
			
		||||
				let domain = toAddr.slice(atIdx + 1);
 | 
			
		||||
 | 
			
		||||
				//convert IDN via punycode
 | 
			
		||||
				try {
 | 
			
		||||
					domain = (!options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain));
 | 
			
		||||
				} catch (e) {
 | 
			
		||||
					components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				to[x] = localPart + "@" + domain;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			components.path = to.join(",");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const headers = mailtoComponents.headers = mailtoComponents.headers || {};
 | 
			
		||||
 | 
			
		||||
		if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
 | 
			
		||||
		if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
 | 
			
		||||
 | 
			
		||||
		const fields = [];
 | 
			
		||||
		for (const name in headers) {
 | 
			
		||||
			if (headers[name] !== O[name]) {
 | 
			
		||||
				fields.push(
 | 
			
		||||
					name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) +
 | 
			
		||||
					"=" +
 | 
			
		||||
					headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)
 | 
			
		||||
				);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (fields.length) {
 | 
			
		||||
			components.query = fields.join("&");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return components;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default handler;
 | 
			
		||||
							
								
								
									
										36
									
								
								node_modules/uri-js/src/schemes/urn-uuid.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								node_modules/uri-js/src/schemes/urn-uuid.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,36 +0,0 @@
 | 
			
		||||
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
 | 
			
		||||
import { URNComponents } from "./urn";
 | 
			
		||||
import { SCHEMES } from "../uri";
 | 
			
		||||
 | 
			
		||||
export interface UUIDComponents extends URNComponents {
 | 
			
		||||
	uuid?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
 | 
			
		||||
const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
 | 
			
		||||
 | 
			
		||||
//RFC 4122
 | 
			
		||||
const handler:URISchemeHandler<UUIDComponents, URIOptions, URNComponents> = {
 | 
			
		||||
	scheme : "urn:uuid",
 | 
			
		||||
 | 
			
		||||
	parse : function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
 | 
			
		||||
		const uuidComponents = urnComponents as UUIDComponents;
 | 
			
		||||
		uuidComponents.uuid = uuidComponents.nss;
 | 
			
		||||
		uuidComponents.nss = undefined;
 | 
			
		||||
 | 
			
		||||
		if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
 | 
			
		||||
			uuidComponents.error = uuidComponents.error || "UUID is not valid.";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return uuidComponents;
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	serialize : function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
 | 
			
		||||
		const urnComponents = uuidComponents as URNComponents;
 | 
			
		||||
		//normalize UUID
 | 
			
		||||
		urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
 | 
			
		||||
		return urnComponents;
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default handler;
 | 
			
		||||
							
								
								
									
										69
									
								
								node_modules/uri-js/src/schemes/urn.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										69
									
								
								node_modules/uri-js/src/schemes/urn.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,69 +0,0 @@
 | 
			
		||||
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
 | 
			
		||||
import { pctEncChar, SCHEMES } from "../uri";
 | 
			
		||||
 | 
			
		||||
export interface URNComponents extends URIComponents {
 | 
			
		||||
	nid?:string;
 | 
			
		||||
	nss?:string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface URNOptions extends URIOptions {
 | 
			
		||||
	nid?:string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const NID$ = "(?:[0-9A-Za-z][0-9A-Za-z\\-]{1,31})";
 | 
			
		||||
const PCT_ENCODED$ = "(?:\\%[0-9A-Fa-f]{2})";
 | 
			
		||||
const TRANS$$ = "[0-9A-Za-z\\(\\)\\+\\,\\-\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\/\\?\\#]";
 | 
			
		||||
const NSS$ = "(?:(?:" + PCT_ENCODED$ + "|" + TRANS$$ + ")+)";
 | 
			
		||||
const URN_SCHEME = new RegExp("^urn\\:(" + NID$ + ")$");
 | 
			
		||||
const URN_PATH = new RegExp("^(" + NID$ + ")\\:(" + NSS$ + ")$");
 | 
			
		||||
const URN_PARSE = /^([^\:]+)\:(.*)/;
 | 
			
		||||
const URN_EXCLUDED = /[\x00-\x20\\\"\&\<\>\[\]\^\`\{\|\}\~\x7F-\xFF]/g;
 | 
			
		||||
 | 
			
		||||
//RFC 2141
 | 
			
		||||
const handler:URISchemeHandler<URNComponents,URNOptions> = {
 | 
			
		||||
	scheme : "urn",
 | 
			
		||||
 | 
			
		||||
	parse : function (components:URIComponents, options:URNOptions):URNComponents {
 | 
			
		||||
		const matches = components.path && components.path.match(URN_PARSE);
 | 
			
		||||
		let urnComponents = components as URNComponents;
 | 
			
		||||
 | 
			
		||||
		if (matches) {
 | 
			
		||||
			const scheme = options.scheme || urnComponents.scheme || "urn";
 | 
			
		||||
			const nid = matches[1].toLowerCase();
 | 
			
		||||
			const nss = matches[2];
 | 
			
		||||
			const urnScheme = `${scheme}:${options.nid || nid}`;
 | 
			
		||||
			const schemeHandler = SCHEMES[urnScheme];
 | 
			
		||||
 | 
			
		||||
			urnComponents.nid = nid;
 | 
			
		||||
			urnComponents.nss = nss;
 | 
			
		||||
			urnComponents.path = undefined;
 | 
			
		||||
 | 
			
		||||
			if (schemeHandler) {
 | 
			
		||||
				urnComponents = schemeHandler.parse(urnComponents, options) as URNComponents;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			urnComponents.error = urnComponents.error || "URN can not be parsed.";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return urnComponents;
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	serialize : function (urnComponents:URNComponents, options:URNOptions):URIComponents {
 | 
			
		||||
		const scheme = options.scheme || urnComponents.scheme || "urn";
 | 
			
		||||
		const nid = urnComponents.nid;
 | 
			
		||||
		const urnScheme = `${scheme}:${options.nid || nid}`;
 | 
			
		||||
		const schemeHandler = SCHEMES[urnScheme];
 | 
			
		||||
 | 
			
		||||
		if (schemeHandler) {
 | 
			
		||||
			urnComponents = schemeHandler.serialize(urnComponents, options) as URNComponents;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const uriComponents = urnComponents as URIComponents;
 | 
			
		||||
		const nss = urnComponents.nss;
 | 
			
		||||
		uriComponents.path = `${nid || options.nid}:${nss}`;
 | 
			
		||||
 | 
			
		||||
		return uriComponents;
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default handler;
 | 
			
		||||
							
								
								
									
										556
									
								
								node_modules/uri-js/src/uri.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										556
									
								
								node_modules/uri-js/src/uri.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,556 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * URI.js
 | 
			
		||||
 *
 | 
			
		||||
 * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
 | 
			
		||||
 * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
 | 
			
		||||
 * @see http://github.com/garycourt/uri-js
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2011 Gary Court. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without modification, are
 | 
			
		||||
 * permitted provided that the following conditions are met:
 | 
			
		||||
 *
 | 
			
		||||
 *    1. Redistributions of source code must retain the above copyright notice, this list of
 | 
			
		||||
 *       conditions and the following disclaimer.
 | 
			
		||||
 *
 | 
			
		||||
 *    2. Redistributions in binary form must reproduce the above copyright notice, this list
 | 
			
		||||
 *       of conditions and the following disclaimer in the documentation and/or other materials
 | 
			
		||||
 *       provided with the distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
 | 
			
		||||
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
 | 
			
		||||
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 | 
			
		||||
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 | 
			
		||||
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 | 
			
		||||
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 *
 | 
			
		||||
 * The views and conclusions contained in the software and documentation are those of the
 | 
			
		||||
 * authors and should not be interpreted as representing official policies, either expressed
 | 
			
		||||
 * or implied, of Gary Court.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import URI_PROTOCOL from "./regexps-uri";
 | 
			
		||||
import IRI_PROTOCOL from "./regexps-iri";
 | 
			
		||||
import punycode from "punycode";
 | 
			
		||||
import { toUpperCase, typeOf, assign } from "./util";
 | 
			
		||||
 | 
			
		||||
export interface URIComponents {
 | 
			
		||||
	scheme?:string;
 | 
			
		||||
	userinfo?:string;
 | 
			
		||||
	host?:string;
 | 
			
		||||
	port?:number|string;
 | 
			
		||||
	path?:string;
 | 
			
		||||
	query?:string;
 | 
			
		||||
	fragment?:string;
 | 
			
		||||
	reference?:string;
 | 
			
		||||
	error?:string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface URIOptions {
 | 
			
		||||
	scheme?:string;
 | 
			
		||||
	reference?:string;
 | 
			
		||||
	tolerant?:boolean;
 | 
			
		||||
	absolutePath?:boolean;
 | 
			
		||||
	iri?:boolean;
 | 
			
		||||
	unicodeSupport?:boolean;
 | 
			
		||||
	domainHost?:boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
 | 
			
		||||
	scheme:string;
 | 
			
		||||
	parse(components:ParentComponents, options:Options):Components;
 | 
			
		||||
	serialize(components:Components, options:Options):ParentComponents;
 | 
			
		||||
	unicodeSupport?:boolean;
 | 
			
		||||
	domainHost?:boolean;
 | 
			
		||||
	absolutePath?:boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface URIRegExps {
 | 
			
		||||
	NOT_SCHEME : RegExp,
 | 
			
		||||
	NOT_USERINFO : RegExp,
 | 
			
		||||
	NOT_HOST : RegExp,
 | 
			
		||||
	NOT_PATH : RegExp,
 | 
			
		||||
	NOT_PATH_NOSCHEME : RegExp,
 | 
			
		||||
	NOT_QUERY : RegExp,
 | 
			
		||||
	NOT_FRAGMENT : RegExp,
 | 
			
		||||
	ESCAPE : RegExp,
 | 
			
		||||
	UNRESERVED : RegExp,
 | 
			
		||||
	OTHER_CHARS : RegExp,
 | 
			
		||||
	PCT_ENCODED : RegExp,
 | 
			
		||||
	IPV4ADDRESS : RegExp,
 | 
			
		||||
	IPV6ADDRESS : RegExp,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const SCHEMES:{[scheme:string]:URISchemeHandler} = {};
 | 
			
		||||
 | 
			
		||||
export function pctEncChar(chr:string):string {
 | 
			
		||||
	const c = chr.charCodeAt(0);
 | 
			
		||||
	let e:string;
 | 
			
		||||
 | 
			
		||||
	if (c < 16) e = "%0" + c.toString(16).toUpperCase();
 | 
			
		||||
	else if (c < 128) e = "%" + c.toString(16).toUpperCase();
 | 
			
		||||
	else if (c < 2048) e = "%" + ((c >> 6) | 192).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
 | 
			
		||||
	else e = "%" + ((c >> 12) | 224).toString(16).toUpperCase() + "%" + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
 | 
			
		||||
 | 
			
		||||
	return e;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function pctDecChars(str:string):string {
 | 
			
		||||
	let newStr = "";
 | 
			
		||||
	let i = 0;
 | 
			
		||||
	const il = str.length;
 | 
			
		||||
 | 
			
		||||
	while (i < il) {
 | 
			
		||||
		const c = parseInt(str.substr(i + 1, 2), 16);
 | 
			
		||||
 | 
			
		||||
		if (c < 128) {
 | 
			
		||||
			newStr += String.fromCharCode(c);
 | 
			
		||||
			i += 3;
 | 
			
		||||
		}
 | 
			
		||||
		else if (c >= 194 && c < 224) {
 | 
			
		||||
			if ((il - i) >= 6) {
 | 
			
		||||
				const c2 = parseInt(str.substr(i + 4, 2), 16);
 | 
			
		||||
				newStr += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
 | 
			
		||||
			} else {
 | 
			
		||||
				newStr += str.substr(i, 6);
 | 
			
		||||
			}
 | 
			
		||||
			i += 6;
 | 
			
		||||
		}
 | 
			
		||||
		else if (c >= 224) {
 | 
			
		||||
			if ((il - i) >= 9) {
 | 
			
		||||
				const c2 = parseInt(str.substr(i + 4, 2), 16);
 | 
			
		||||
				const c3 = parseInt(str.substr(i + 7, 2), 16);
 | 
			
		||||
				newStr += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
 | 
			
		||||
			} else {
 | 
			
		||||
				newStr += str.substr(i, 9);
 | 
			
		||||
			}
 | 
			
		||||
			i += 9;
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			newStr += str.substr(i, 3);
 | 
			
		||||
			i += 3;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return newStr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
 | 
			
		||||
	function decodeUnreserved(str:string):string {
 | 
			
		||||
		const decStr = pctDecChars(str);
 | 
			
		||||
		return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
 | 
			
		||||
	if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
 | 
			
		||||
	if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
 | 
			
		||||
	if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace((components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME), pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
 | 
			
		||||
	if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
 | 
			
		||||
	if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
 | 
			
		||||
 | 
			
		||||
	return components;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function _stripLeadingZeros(str:string):string {
 | 
			
		||||
	return str.replace(/^0*(.*)/, "$1") || "0";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function _normalizeIPv4(host:string, protocol:URIRegExps):string {
 | 
			
		||||
	const matches = host.match(protocol.IPV4ADDRESS) || [];
 | 
			
		||||
	const [, address] = matches;
 | 
			
		||||
	
 | 
			
		||||
	if (address) {
 | 
			
		||||
		return address.split(".").map(_stripLeadingZeros).join(".");
 | 
			
		||||
	} else {
 | 
			
		||||
		return host;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function _normalizeIPv6(host:string, protocol:URIRegExps):string {
 | 
			
		||||
	const matches = host.match(protocol.IPV6ADDRESS) || [];
 | 
			
		||||
	const [, address, zone] = matches;
 | 
			
		||||
 | 
			
		||||
	if (address) {
 | 
			
		||||
		const [last, first] = address.toLowerCase().split('::').reverse();
 | 
			
		||||
		const firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
 | 
			
		||||
		const lastFields = last.split(":").map(_stripLeadingZeros);
 | 
			
		||||
		const isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
 | 
			
		||||
		const fieldCount = isLastFieldIPv4Address ? 7 : 8;
 | 
			
		||||
		const lastFieldsStart = lastFields.length - fieldCount;
 | 
			
		||||
		const fields = Array<string>(fieldCount);
 | 
			
		||||
 | 
			
		||||
		for (let x = 0; x < fieldCount; ++x) {
 | 
			
		||||
			fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (isLastFieldIPv4Address) {
 | 
			
		||||
			fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const allZeroFields = fields.reduce<Array<{index:number,length:number}>>((acc, field, index) => {
 | 
			
		||||
			if (!field || field === "0") {
 | 
			
		||||
				const lastLongest = acc[acc.length - 1];
 | 
			
		||||
				if (lastLongest && lastLongest.index + lastLongest.length === index) {
 | 
			
		||||
					lastLongest.length++;
 | 
			
		||||
				} else {
 | 
			
		||||
					acc.push({ index, length : 1 });
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			return acc;
 | 
			
		||||
		}, []);
 | 
			
		||||
 | 
			
		||||
		const longestZeroFields = allZeroFields.sort((a, b) => b.length - a.length)[0];
 | 
			
		||||
 | 
			
		||||
		let newHost:string;
 | 
			
		||||
		if (longestZeroFields && longestZeroFields.length > 1) {
 | 
			
		||||
			const newFirst = fields.slice(0, longestZeroFields.index) ;
 | 
			
		||||
			const newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
 | 
			
		||||
			newHost = newFirst.join(":") + "::" + newLast.join(":");
 | 
			
		||||
		} else {
 | 
			
		||||
			newHost = fields.join(":");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (zone) {
 | 
			
		||||
			newHost += "%" + zone;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return newHost;
 | 
			
		||||
	} else {
 | 
			
		||||
		return host;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
 | 
			
		||||
const NO_MATCH_IS_UNDEFINED = (<RegExpMatchArray>("").match(/(){0}/))[1] === undefined;
 | 
			
		||||
 | 
			
		||||
export function parse(uriString:string, options:URIOptions = {}):URIComponents {
 | 
			
		||||
	const components:URIComponents = {};
 | 
			
		||||
	const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
 | 
			
		||||
 | 
			
		||||
	if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
 | 
			
		||||
 | 
			
		||||
	const matches = uriString.match(URI_PARSE);
 | 
			
		||||
 | 
			
		||||
	if (matches) {
 | 
			
		||||
		if (NO_MATCH_IS_UNDEFINED) {
 | 
			
		||||
			//store each component
 | 
			
		||||
			components.scheme = matches[1];
 | 
			
		||||
			components.userinfo = matches[3];
 | 
			
		||||
			components.host = matches[4];
 | 
			
		||||
			components.port = parseInt(matches[5], 10);
 | 
			
		||||
			components.path = matches[6] || "";
 | 
			
		||||
			components.query = matches[7];
 | 
			
		||||
			components.fragment = matches[8];
 | 
			
		||||
 | 
			
		||||
			//fix port number
 | 
			
		||||
			if (isNaN(components.port)) {
 | 
			
		||||
				components.port = matches[5];
 | 
			
		||||
			}
 | 
			
		||||
		} else {  //IE FIX for improper RegExp matching
 | 
			
		||||
			//store each component
 | 
			
		||||
			components.scheme = matches[1] || undefined;
 | 
			
		||||
			components.userinfo = (uriString.indexOf("@") !== -1 ? matches[3] : undefined);
 | 
			
		||||
			components.host = (uriString.indexOf("//") !== -1 ? matches[4] : undefined);
 | 
			
		||||
			components.port = parseInt(matches[5], 10);
 | 
			
		||||
			components.path = matches[6] || "";
 | 
			
		||||
			components.query = (uriString.indexOf("?") !== -1 ? matches[7] : undefined);
 | 
			
		||||
			components.fragment = (uriString.indexOf("#") !== -1 ? matches[8] : undefined);
 | 
			
		||||
 | 
			
		||||
			//fix port number
 | 
			
		||||
			if (isNaN(components.port)) {
 | 
			
		||||
				components.port = (uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (components.host) {
 | 
			
		||||
			//normalize IP hosts
 | 
			
		||||
			components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//determine reference type
 | 
			
		||||
		if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
 | 
			
		||||
			components.reference = "same-document";
 | 
			
		||||
		} else if (components.scheme === undefined) {
 | 
			
		||||
			components.reference = "relative";
 | 
			
		||||
		} else if (components.fragment === undefined) {
 | 
			
		||||
			components.reference = "absolute";
 | 
			
		||||
		} else {
 | 
			
		||||
			components.reference = "uri";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//check for reference errors
 | 
			
		||||
		if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
 | 
			
		||||
			components.error = components.error || "URI is not a " + options.reference + " reference.";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//find scheme handler
 | 
			
		||||
		const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
 | 
			
		||||
 | 
			
		||||
		//check if scheme can't handle IRIs
 | 
			
		||||
		if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
 | 
			
		||||
			//if host component is a domain name
 | 
			
		||||
			if (components.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost))) {
 | 
			
		||||
				//convert Unicode IDN -> ASCII IDN
 | 
			
		||||
				try {
 | 
			
		||||
					components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
 | 
			
		||||
				} catch (e) {
 | 
			
		||||
					components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			//convert IRI -> URI
 | 
			
		||||
			_normalizeComponentEncoding(components, URI_PROTOCOL);
 | 
			
		||||
		} else {
 | 
			
		||||
			//normalize encodings
 | 
			
		||||
			_normalizeComponentEncoding(components, protocol);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//perform scheme specific parsing
 | 
			
		||||
		if (schemeHandler && schemeHandler.parse) {
 | 
			
		||||
			schemeHandler.parse(components, options);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		components.error = components.error || "URI can not be parsed.";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return components;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
 | 
			
		||||
	const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
 | 
			
		||||
	const uriTokens:Array<string> = [];
 | 
			
		||||
 | 
			
		||||
	if (components.userinfo !== undefined) {
 | 
			
		||||
		uriTokens.push(components.userinfo);
 | 
			
		||||
		uriTokens.push("@");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (components.host !== undefined) {
 | 
			
		||||
		//normalize IP hosts, add brackets and escape zone separator for IPv6
 | 
			
		||||
		uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, (_, $1, $2) => "[" + $1 + ($2 ? "%25" + $2 : "") + "]"));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (typeof components.port === "number") {
 | 
			
		||||
		uriTokens.push(":");
 | 
			
		||||
		uriTokens.push(components.port.toString(10));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return uriTokens.length ? uriTokens.join("") : undefined;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const RDS1 = /^\.\.?\//;
 | 
			
		||||
const RDS2 = /^\/\.(\/|$)/;
 | 
			
		||||
const RDS3 = /^\/\.\.(\/|$)/;
 | 
			
		||||
const RDS4 = /^\.\.?$/;
 | 
			
		||||
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
 | 
			
		||||
 | 
			
		||||
export function removeDotSegments(input:string):string {
 | 
			
		||||
	const output:Array<string> = [];
 | 
			
		||||
 | 
			
		||||
	while (input.length) {
 | 
			
		||||
		if (input.match(RDS1)) {
 | 
			
		||||
			input = input.replace(RDS1, "");
 | 
			
		||||
		} else if (input.match(RDS2)) {
 | 
			
		||||
			input = input.replace(RDS2, "/");
 | 
			
		||||
		} else if (input.match(RDS3)) {
 | 
			
		||||
			input = input.replace(RDS3, "/");
 | 
			
		||||
			output.pop();
 | 
			
		||||
		} else if (input === "." || input === "..") {
 | 
			
		||||
			input = "";
 | 
			
		||||
		} else {
 | 
			
		||||
			const im = input.match(RDS5);
 | 
			
		||||
			if (im) {
 | 
			
		||||
				const s = im[0];
 | 
			
		||||
				input = input.slice(s.length);
 | 
			
		||||
				output.push(s);
 | 
			
		||||
			} else {
 | 
			
		||||
				throw new Error("Unexpected dot segment condition");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return output.join("");
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function serialize(components:URIComponents, options:URIOptions = {}):string {
 | 
			
		||||
	const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
 | 
			
		||||
	const uriTokens:Array<string> = [];
 | 
			
		||||
 | 
			
		||||
	//find scheme handler
 | 
			
		||||
	const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
 | 
			
		||||
 | 
			
		||||
	//perform scheme specific serialization
 | 
			
		||||
	if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
 | 
			
		||||
 | 
			
		||||
	if (components.host) {
 | 
			
		||||
		//if host component is an IPv6 address
 | 
			
		||||
		if (protocol.IPV6ADDRESS.test(components.host)) {
 | 
			
		||||
			//TODO: normalize IPv6 address as per RFC 5952
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//if host component is a domain name
 | 
			
		||||
		else if (options.domainHost || (schemeHandler && schemeHandler.domainHost)) {
 | 
			
		||||
			//convert IDN via punycode
 | 
			
		||||
			try {
 | 
			
		||||
				components.host = (!options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host));
 | 
			
		||||
			} catch (e) {
 | 
			
		||||
				components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//normalize encoding
 | 
			
		||||
	_normalizeComponentEncoding(components, protocol);
 | 
			
		||||
 | 
			
		||||
	if (options.reference !== "suffix" && components.scheme) {
 | 
			
		||||
		uriTokens.push(components.scheme);
 | 
			
		||||
		uriTokens.push(":");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const authority = _recomposeAuthority(components, options);
 | 
			
		||||
	if (authority !== undefined) {
 | 
			
		||||
		if (options.reference !== "suffix") {
 | 
			
		||||
			uriTokens.push("//");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		uriTokens.push(authority);
 | 
			
		||||
 | 
			
		||||
		if (components.path && components.path.charAt(0) !== "/") {
 | 
			
		||||
			uriTokens.push("/");
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (components.path !== undefined) {
 | 
			
		||||
		let s = components.path;
 | 
			
		||||
 | 
			
		||||
		if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
 | 
			
		||||
			s = removeDotSegments(s);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (authority === undefined) {
 | 
			
		||||
			s = s.replace(/^\/\//, "/%2F");  //don't allow the path to start with "//"
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		uriTokens.push(s);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (components.query !== undefined) {
 | 
			
		||||
		uriTokens.push("?");
 | 
			
		||||
		uriTokens.push(components.query);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (components.fragment !== undefined) {
 | 
			
		||||
		uriTokens.push("#");
 | 
			
		||||
		uriTokens.push(components.fragment);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return uriTokens.join("");  //merge tokens into a string
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
 | 
			
		||||
	const target:URIComponents = {};
 | 
			
		||||
 | 
			
		||||
	if (!skipNormalization) {
 | 
			
		||||
		base = parse(serialize(base, options), options);  //normalize base components
 | 
			
		||||
		relative = parse(serialize(relative, options), options);  //normalize relative components
 | 
			
		||||
	}
 | 
			
		||||
	options = options || {};
 | 
			
		||||
 | 
			
		||||
	if (!options.tolerant && relative.scheme) {
 | 
			
		||||
		target.scheme = relative.scheme;
 | 
			
		||||
		//target.authority = relative.authority;
 | 
			
		||||
		target.userinfo = relative.userinfo;
 | 
			
		||||
		target.host = relative.host;
 | 
			
		||||
		target.port = relative.port;
 | 
			
		||||
		target.path = removeDotSegments(relative.path || "");
 | 
			
		||||
		target.query = relative.query;
 | 
			
		||||
	} else {
 | 
			
		||||
		if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
 | 
			
		||||
			//target.authority = relative.authority;
 | 
			
		||||
			target.userinfo = relative.userinfo;
 | 
			
		||||
			target.host = relative.host;
 | 
			
		||||
			target.port = relative.port;
 | 
			
		||||
			target.path = removeDotSegments(relative.path || "");
 | 
			
		||||
			target.query = relative.query;
 | 
			
		||||
		} else {
 | 
			
		||||
			if (!relative.path) {
 | 
			
		||||
				target.path = base.path;
 | 
			
		||||
				if (relative.query !== undefined) {
 | 
			
		||||
					target.query = relative.query;
 | 
			
		||||
				} else {
 | 
			
		||||
					target.query = base.query;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				if (relative.path.charAt(0) === "/") {
 | 
			
		||||
					target.path = removeDotSegments(relative.path);
 | 
			
		||||
				} else {
 | 
			
		||||
					if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
 | 
			
		||||
						target.path = "/" + relative.path;
 | 
			
		||||
					} else if (!base.path) {
 | 
			
		||||
						target.path = relative.path;
 | 
			
		||||
					} else {
 | 
			
		||||
						target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
 | 
			
		||||
					}
 | 
			
		||||
					target.path = removeDotSegments(target.path);
 | 
			
		||||
				}
 | 
			
		||||
				target.query = relative.query;
 | 
			
		||||
			}
 | 
			
		||||
			//target.authority = base.authority;
 | 
			
		||||
			target.userinfo = base.userinfo;
 | 
			
		||||
			target.host = base.host;
 | 
			
		||||
			target.port = base.port;
 | 
			
		||||
		}
 | 
			
		||||
		target.scheme = base.scheme;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	target.fragment = relative.fragment;
 | 
			
		||||
 | 
			
		||||
	return target;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function resolve(baseURI:string, relativeURI:string, options?:URIOptions):string {
 | 
			
		||||
	const schemelessOptions = assign({ scheme : 'null' }, options);
 | 
			
		||||
	return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function normalize(uri:string, options?:URIOptions):string;
 | 
			
		||||
export function normalize(uri:URIComponents, options?:URIOptions):URIComponents;
 | 
			
		||||
export function normalize(uri:any, options?:URIOptions):any {
 | 
			
		||||
	if (typeof uri === "string") {
 | 
			
		||||
		uri = serialize(parse(uri, options), options);
 | 
			
		||||
	} else if (typeOf(uri) === "object") {
 | 
			
		||||
		uri = parse(serialize(<URIComponents>uri, options), options);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return uri;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function equal(uriA:string, uriB:string, options?: URIOptions):boolean;
 | 
			
		||||
export function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean;
 | 
			
		||||
export function equal(uriA:any, uriB:any, options?:URIOptions):boolean {
 | 
			
		||||
	if (typeof uriA === "string") {
 | 
			
		||||
		uriA = serialize(parse(uriA, options), options);
 | 
			
		||||
	} else if (typeOf(uriA) === "object") {
 | 
			
		||||
		uriA = serialize(<URIComponents>uriA, options);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (typeof uriB === "string") {
 | 
			
		||||
		uriB = serialize(parse(uriB, options), options);
 | 
			
		||||
	} else if (typeOf(uriB) === "object") {
 | 
			
		||||
		uriB = serialize(<URIComponents>uriB, options);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return uriA === uriB;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function escapeComponent(str:string, options?:URIOptions):string {
 | 
			
		||||
	return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE), pctEncChar);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function unescapeComponent(str:string, options?:URIOptions):string {
 | 
			
		||||
	return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED), pctDecChars);
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										40
									
								
								node_modules/uri-js/src/util.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								node_modules/uri-js/src/util.ts
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,40 +0,0 @@
 | 
			
		||||
export function merge(...sets:Array<string>):string {
 | 
			
		||||
	if (sets.length > 1) {
 | 
			
		||||
		sets[0] = sets[0].slice(0, -1);
 | 
			
		||||
		const xl = sets.length - 1;
 | 
			
		||||
		for (let x = 1; x < xl; ++x) {
 | 
			
		||||
			sets[x] = sets[x].slice(1, -1);
 | 
			
		||||
		}
 | 
			
		||||
		sets[xl] = sets[xl].slice(1);
 | 
			
		||||
		return sets.join('');
 | 
			
		||||
	} else {
 | 
			
		||||
		return sets[0];
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function subexp(str:string):string {
 | 
			
		||||
	return "(?:" + str + ")";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function typeOf(o:any):string {
 | 
			
		||||
	return o === undefined ? "undefined" : (o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function toUpperCase(str:string):string {
 | 
			
		||||
	return str.toUpperCase();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function toArray(obj:any):Array<any> {
 | 
			
		||||
	return obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : [];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export function assign(target: object, source: any): any {
 | 
			
		||||
	const obj = target as any;
 | 
			
		||||
	if (source) {
 | 
			
		||||
		for (const key in source) {
 | 
			
		||||
			obj[key] = source[key];
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return obj;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user