{"version":3,"file":"typertext.min.js","sources":["typertext.js"],"names":["Typertext","BaseException","message","code","custom","this","prototype","GetCode","GetMessage","GetCustom","GenericResponse","status","responseHeaderGetter","httpResponseCode","responseBody","headers","httpStatus","content","GetContent","GetContentType","GetHeader","name","GetHttpStatus","GetStatus","__extends","d","b","__","constructor","p","hasOwnProperty","Http","HttpException","_super","apply","arguments","HttpMethod","HttpProtocol","HttpRequest","Get","request","callback","RawRequest","Post","postData","method","Transport","TransportChooser","GetTransport","HttpResponse","call","HttpResponseStatus","HttpUrl","domain","protocol","path","queryString","port","isNaN","DefaultPort","indexOf","FromUrl","location","l","document","createElement","href","hostname","slice","pathname","DecodeQueryString","search","parseInt","substring","UrlDecodeString","EncodeQueryString","query","rs","UrlEncodeObject","length","data","temp","encodeURIComponent","returnValue","params","splitString","i","param","key","decodeURIComponent","input","separator","limit","chunks","split","ret","splice","push","join","ToString","Json","JsonException","JsonRequest","jsonContentType","jsonType","_this","response","JsonResponse","fromInvalidHttpResponse","fromHttpResponse","parseSuccess","httpResponse","window","parse","e","GetParseStatus","GenericTransport","ieLte9","isXdomain","isXprotocol","XDR","XHR","xdr","XDomainRequest","getHeader","toLowerCase","contentType","undefined","ontimeout","onerror","responseText","onload","open","send","xhr","XMLHttpRequest","onreadystatechange","readyState","getResponseHeader","setRequestHeader"],"mappings":"AAAA,GAAIA,YACJ,SAAWA,GACP,GAAIC,GAAgB,WAChB,QAASA,GAAcC,EAASC,EAAMC,GAClCC,KAAKH,QAAUA,EACfG,KAAKF,KAAOA,EACZE,KAAKD,OAASA,EAalB,MAXAH,GAAcK,UAAUC,QAAU,WAC9B,MAAOF,MAAKF,MAGhBF,EAAcK,UAAUE,WAAa,WACjC,MAAOH,MAAKH,SAGhBD,EAAcK,UAAUG,UAAY,WAChC,MAAOJ,MAAKD,QAETH,IAEXD,GAAUC,cAAgBA,GAC3BD,YAAcA,cACjB,IAAIA,YACJ,aAEGA,YAAcA,cACjB,IAAIA,YACJ,SAAWA,GACP,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mBAAbH,KAA4BA,EAAW,WAC9C,MAAO,QAEXR,EAAOiB,KAAK7C,KAAMwC,EAAQL,EAASI,EAAUH,EAE7C,IAAI6F,GAAM,GAAIC,eA4Bd,OA1BAD,GAAIE,mBAAqB,WACrB,GAAsB,GAAlBF,EAAIG,WAAiB,CACrB,GAAIb,GAAY,SAAUvG,GACtB,MAAOiH,GAAII,kBAAkBrH,GAI7BoB,GADc,KAAd6F,EAAI3H,OACK,GAAIsC,GAAa,EAAiB2E,EAAWU,EAAI3H,OAAQ2H,EAAIJ,cAC/DI,EAAI3H,QAAU,KAAO2H,EAAI3H,OAAS,IAChC,GAAIsC,GAAa,EAAqB2E,EAAWU,EAAI3H,OAAQ2H,EAAIJ,cACnEI,EAAI3H,QAAU,KAAO2H,EAAI3H,OAAS,IAChC,GAAIsC,GAAa,EAAqB2E,EAAWU,EAAI3H,OAAQ2H,EAAIJ,cAEjE,GAAIjF,GAAa,EAAsB2E,EAAWU,EAAI3H,OAAQ2H,EAAIJ,iBAKvFI,EAAIN,UAAY,WACZvF,EAAS,GAAIQ,GAAa,EAAiB,WACvC,MAAO,IACR,GAAI,MAGXqF,EAAIF,KAAKhG,EAAWS,GAASL,EAAQ2D,YAAY,GAEnC,GAAVtD,MACAyF,GAAID,QAIRC,EAAIK,iBAAiB,eAAgB,yCAErCL,GAAID,KAAKjF,EAAQ0B,gBAAgBlC,KAErC,MA7CApB,WAAUiG,EAAKxF,GA6CRwF,GACRzH,EAAU8C,UAAUsE,iBACvBtE,GAAU2E,IAAMA,GACjBzH,EAAU8C,YAAc9C,EAAU8C,cACrB9C,GAAU8C,WAC3B9C,YAAcA","sourcesContent":["var Typertext;\n(function (Typertext) {\n var BaseException = (function () {\n function BaseException(message, code, custom) {\n this.message = message;\n this.code = code;\n this.custom = custom;\n }\n BaseException.prototype.GetCode = function () {\n return this.code;\n };\n\n BaseException.prototype.GetMessage = function () {\n return this.message;\n };\n\n BaseException.prototype.GetCustom = function () {\n return this.custom;\n };\n return BaseException;\n })();\n Typertext.BaseException = BaseException;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n \n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n var GenericResponse = (function () {\n function GenericResponse(status, responseHeaderGetter, httpResponseCode, responseBody) {\n this.status = status;\n this.headers = responseHeaderGetter;\n this.httpStatus = httpResponseCode;\n this.content = responseBody;\n }\n GenericResponse.prototype.GetContent = function () {\n return this.content;\n };\n\n GenericResponse.prototype.GetContentType = function () {\n return this.GetHeader(\"Content-Type\");\n };\n\n GenericResponse.prototype.GetHeader = function (name) {\n return this.headers(name);\n };\n\n GenericResponse.prototype.GetHttpStatus = function () {\n return this.httpStatus;\n };\n\n GenericResponse.prototype.GetStatus = function () {\n return this.status;\n };\n return GenericResponse;\n })();\n Typertext.GenericResponse = GenericResponse;\n})(Typertext || (Typertext = {}));\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpException = (function (_super) {\n __extends(HttpException, _super);\n function HttpException() {\n _super.apply(this, arguments);\n }\n return HttpException;\n })(Typertext.BaseException);\n Http.HttpException = HttpException;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n (function (HttpMethod) {\n HttpMethod[HttpMethod[\"GET\"] = 0] = \"GET\";\n HttpMethod[HttpMethod[\"POST\"] = 1] = \"POST\";\n })(Http.HttpMethod || (Http.HttpMethod = {}));\n var HttpMethod = Http.HttpMethod;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n (function (HttpProtocol) {\n HttpProtocol[HttpProtocol[\"http\"] = 0] = \"http\";\n HttpProtocol[HttpProtocol[\"https\"] = 1] = \"https\";\n })(Http.HttpProtocol || (Http.HttpProtocol = {}));\n var HttpProtocol = Http.HttpProtocol;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpRequest = (function () {\n function HttpRequest() {\n }\n HttpRequest.prototype.Get = function (request, callback) {\n this.RawRequest(0 /* GET */, request, {}, callback);\n };\n\n HttpRequest.prototype.Post = function (request, postData, callback) {\n this.RawRequest(1 /* POST */, request, postData, callback);\n };\n\n HttpRequest.prototype.RawRequest = function (method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n }; }\n Typertext.Transport.TransportChooser.GetTransport(method, request, postData, callback);\n };\n return HttpRequest;\n })();\n Http.HttpRequest = HttpRequest;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpResponse = (function (_super) {\n __extends(HttpResponse, _super);\n function HttpResponse(status, responseHeaderGetter, httpResponseCode, responseBody) {\n _super.call(this, status, responseHeaderGetter, httpResponseCode, responseBody);\n }\n return HttpResponse;\n })(Typertext.GenericResponse);\n Http.HttpResponse = HttpResponse;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n (function (HttpResponseStatus) {\n HttpResponseStatus[HttpResponseStatus[\"success\"] = 0] = \"success\";\n HttpResponseStatus[HttpResponseStatus[\"serverError\"] = 1] = \"serverError\";\n HttpResponseStatus[HttpResponseStatus[\"clientError\"] = 2] = \"clientError\";\n HttpResponseStatus[HttpResponseStatus[\"responseError\"] = 3] = \"responseError\";\n HttpResponseStatus[HttpResponseStatus[\"unknownError\"] = 4] = \"unknownError\";\n HttpResponseStatus[HttpResponseStatus[\"timeout\"] = 5] = \"timeout\";\n })(Http.HttpResponseStatus || (Http.HttpResponseStatus = {}));\n var HttpResponseStatus = Http.HttpResponseStatus;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpUrl = (function () {\n function HttpUrl(domain, protocol, path, queryString, port) {\n if (typeof protocol === \"undefined\") { protocol = 0 /* http */; }\n if (typeof path === \"undefined\") { path = \"/\"; }\n if (typeof queryString === \"undefined\") { queryString = {}; }\n if (typeof port === \"undefined\") { port = 0; }\n if (port < 1 || port > 65535 || isNaN(port)) {\n port = HttpUrl.DefaultPort(protocol);\n }\n\n if (path.indexOf(\"/\") != 0) {\n path = \"/\" + path;\n }\n\n this.domain = domain;\n this.protocol = protocol;\n this.path = path;\n this.queryString = queryString;\n this.port = port;\n }\n HttpUrl.DefaultPort = function (protocol) {\n switch (protocol) {\n case 0 /* http */:\n return 80;\n case 1 /* https */:\n return 443;\n default:\n return -1;\n }\n };\n\n HttpUrl.FromUrl = function (location) {\n var l = document.createElement(\"a\");\n l.href = location;\n return new HttpUrl(l.hostname, Typertext.Http.HttpProtocol[l.protocol.slice(0, -1)], l.pathname, HttpUrl.DecodeQueryString(l.search), parseInt(l.port));\n };\n\n HttpUrl.DecodeQueryString = function (queryString) {\n if (queryString.indexOf(\"?\") == 0) {\n queryString = queryString.substring(1);\n }\n\n return HttpUrl.UrlDecodeString(queryString);\n };\n\n HttpUrl.EncodeQueryString = function (query) {\n var rs = \"?\" + HttpUrl.UrlEncodeObject(query);\n return ((rs.length == 1) ? \"\" : rs);\n };\n\n HttpUrl.UrlEncodeObject = function (data) {\n var rs = \"\";\n var temp;\n\n for (temp in data) {\n rs += encodeURIComponent(temp) + \"=\" + encodeURIComponent(data[temp]) + \"&\";\n }\n\n return rs.slice(0, -1);\n };\n\n HttpUrl.UrlDecodeString = function (queryString) {\n var returnValue = {}, params = HttpUrl.splitString(queryString, \"&\");\n for (var i = 0; i < params.length; i++) {\n if (params[i] == \"\") {\n continue;\n }\n\n var param = HttpUrl.splitString(params[i], \"=\", 2);\n var key = decodeURIComponent(param[0]);\n if (param.length == 1) {\n returnValue[key] = \"\";\n continue;\n }\n\n returnValue[key] = decodeURIComponent(param[1]);\n }\n\n return returnValue;\n };\n\n HttpUrl.splitString = function (input, separator, limit) {\n if (typeof limit === \"undefined\") { limit = -1; }\n limit++;\n var chunks = input.split(separator);\n if (limit > 0 && chunks.length > limit) {\n var ret = chunks.splice(0, limit);\n ret.push(chunks.join(separator));\n return ret;\n }\n return chunks;\n };\n\n HttpUrl.prototype.ToString = function () {\n return Typertext.Http.HttpProtocol[this.protocol] + \"://\" + this.domain + ((this.port == HttpUrl.DefaultPort(this.protocol)) ? \"\" : \":\" + this.port) + this.path + HttpUrl.EncodeQueryString(this.queryString);\n };\n return HttpUrl;\n })();\n Http.HttpUrl = HttpUrl;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Json) {\n var JsonException = (function (_super) {\n __extends(JsonException, _super);\n function JsonException(message, code) {\n _super.call(this, message, code, null);\n }\n return JsonException;\n })(Typertext.BaseException);\n Json.JsonException = JsonException;\n })(Typertext.Json || (Typertext.Json = {}));\n var Json = Typertext.Json;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Json) {\n var HttpRequest = Typertext.Http.HttpRequest;\n\n var HttpMethod = Typertext.Http.HttpMethod;\n\n var JsonRequest = (function () {\n function JsonRequest(jsonContentType) {\n if (typeof jsonContentType === \"undefined\") { jsonContentType = \"application/json\"; }\n this.request = new HttpRequest();\n this.jsonType = jsonContentType;\n }\n JsonRequest.prototype.Get = function (request, callback) {\n this.RawRequest(0 /* GET */, request, {}, callback);\n };\n\n JsonRequest.prototype.Post = function (request, postData, callback) {\n this.RawRequest(1 /* POST */, request, postData, callback);\n };\n\n JsonRequest.prototype.RawRequest = function (method, request, postData, callback) {\n var _this = this;\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback != \"function\") {\n this.request.RawRequest(method, request, postData, function () {\n });\n return;\n }\n\n this.request.RawRequest(method, request, postData, function (response) {\n if (response.GetContentType() != _this.jsonType) {\n callback(Typertext.Json.JsonResponse.fromInvalidHttpResponse(response));\n return;\n }\n\n callback(Typertext.Json.JsonResponse.fromHttpResponse(response));\n });\n };\n return JsonRequest;\n })();\n Json.JsonRequest = JsonRequest;\n })(Typertext.Json || (Typertext.Json = {}));\n var Json = Typertext.Json;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Json) {\n var HttpResponseStatus = Typertext.Http.HttpResponseStatus;\n\n var JsonResponse = (function (_super) {\n __extends(JsonResponse, _super);\n function JsonResponse(status, responseHeaderGetter, httpResponseCode, responseBody, parseSuccess) {\n _super.call(this, status, responseHeaderGetter, httpResponseCode, responseBody);\n parseSuccess = !!parseSuccess || false;\n this.parseSuccess = parseSuccess;\n }\n JsonResponse.fromHttpResponse = function (httpResponse) {\n try {\n return new JsonResponse(httpResponse.GetStatus(), httpResponse.GetHeader, httpResponse.GetHttpStatus(), window[\"JSON\"].parse(httpResponse.GetContent()), true);\n } catch (e) {\n return new JsonResponse(httpResponse.GetStatus(), httpResponse.GetHeader, httpResponse.GetHttpStatus(), null);\n }\n };\n\n JsonResponse.fromInvalidHttpResponse = function (httpResponse) {\n return new JsonResponse(3 /* responseError */, httpResponse.GetHeader, httpResponse.GetHttpStatus());\n };\n\n JsonResponse.prototype.GetParseStatus = function () {\n return this.parseSuccess;\n };\n return JsonResponse;\n })(Typertext.GenericResponse);\n Json.JsonResponse = JsonResponse;\n })(Typertext.Json || (Typertext.Json = {}));\n var Json = Typertext.Json;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var GenericTransport = (function () {\n function GenericTransport(method, request, postData, callback) {\n }\n return GenericTransport;\n })();\n Transport.GenericTransport = GenericTransport;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var TransportChooser = (function () {\n function TransportChooser() {\n }\n TransportChooser.GetTransport = function (method, request, postData, callback) {\n var ieLte9 = false;\n var isXdomain = false;\n var isXprotocol = false;\n\n if (!ieLte9) {\n return new Typertext.Transport.XDR(method, request, postData, callback);\n } else if (isXdomain && !isXprotocol) {\n return new Typertext.Transport.XHR(method, request, postData, callback);\n }\n\n throw {};\n };\n return TransportChooser;\n })();\n Transport.TransportChooser = TransportChooser;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var HttpMethod = Typertext.Http.HttpMethod;\n var HttpUrl = Typertext.Http.HttpUrl;\n\n var HttpResponseStatus = Typertext.Http.HttpResponseStatus;\n var HttpResponse = Typertext.Http.HttpResponse;\n\n var XDR = (function (_super) {\n __extends(XDR, _super);\n function XDR(method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n return null;\n }; }\n _super.call(this, method, request, postData, callback);\n\n var xdr = new XDomainRequest();\n\n var getHeader = function (name) {\n if (name.toLowerCase() === \"content-type\") {\n return xdr.contentType;\n }\n return undefined;\n };\n\n xdr.ontimeout = function () {\n callback(new HttpResponse(5 /* timeout */, function (i) {\n return \"\";\n }, -1, \"\"));\n };\n\n xdr.onerror = function () {\n callback(new HttpResponse(4 /* unknownError */, getHeader, -1, xdr.responseText));\n };\n\n xdr.onload = function () {\n callback(new HttpResponse(0 /* success */, getHeader, 200, xdr.responseText));\n };\n\n xdr.open(HttpMethod[method], request.ToString());\n\n if (method == 0 /* GET */) {\n xdr.send();\n return;\n }\n\n xdr.send(HttpUrl.UrlEncodeObject(postData));\n }\n return XDR;\n })(Typertext.Transport.GenericTransport);\n Transport.XDR = XDR;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var HttpMethod = Typertext.Http.HttpMethod;\n var HttpUrl = Typertext.Http.HttpUrl;\n\n var HttpResponseStatus = Typertext.Http.HttpResponseStatus;\n var HttpResponse = Typertext.Http.HttpResponse;\n\n var XHR = (function (_super) {\n __extends(XHR, _super);\n function XHR(method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n return null;\n }; }\n _super.call(this, method, request, postData, callback);\n\n var xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState == 4) {\n var getHeader = function (name) {\n return xhr.getResponseHeader(name);\n };\n\n if (xhr.status == 200) {\n callback(new HttpResponse(0 /* success */, getHeader, xhr.status, xhr.responseText));\n } else if (xhr.status >= 400 && xhr.status < 500) {\n callback(new HttpResponse(2 /* clientError */, getHeader, xhr.status, xhr.responseText));\n } else if (xhr.status >= 500 && xhr.status < 600) {\n callback(new HttpResponse(1 /* serverError */, getHeader, xhr.status, xhr.responseText));\n } else {\n callback(new HttpResponse(4 /* unknownError */, getHeader, xhr.status, xhr.responseText));\n }\n }\n };\n\n xhr.ontimeout = function () {\n callback(new HttpResponse(5 /* timeout */, function (i) {\n return \"\";\n }, -1, \"\"));\n };\n\n xhr.open(HttpMethod[method], request.ToString(), true);\n\n if (method == 0 /* GET */) {\n xhr.send();\n return;\n }\n\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\n xhr.send(HttpUrl.UrlEncodeObject(postData));\n }\n return XHR;\n })(Typertext.Transport.GenericTransport);\n Transport.XHR = XHR;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\n//# sourceMappingURL=typertext.js.map\n"]}