/** * @license Angular v5.2.11 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/Observable'), require('@angular/platform-browser')) : typeof define === 'function' && define.amd ? define('@angular/http', ['exports', '@angular/core', 'rxjs/Observable', '@angular/platform-browser'], factory) : (factory((global.ng = global.ng || {}, global.ng.http = {}),global.ng.core,global.Rx,global.ng.platformBrowser)); }(this, (function (exports,_angular_core,rxjs_Observable,_angular_platformBrowser) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } /** * @license Angular v5.2.11 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A backend for http that uses the `XMLHttpRequest` browser API. * * Take care not to evaluate this in non-browser contexts. * * @deprecated use \@angular/common/http instead */ var BrowserXhr = /** @class */ (function () { function BrowserXhr() { } /** * @return {?} */ BrowserXhr.prototype.build = /** * @return {?} */ function () { return /** @type {?} */ ((new XMLHttpRequest())); }; BrowserXhr.decorators = [ { type: _angular_core.Injectable }, ]; /** @nocollapse */ BrowserXhr.ctorParameters = function () { return []; }; return BrowserXhr; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** @enum {number} */ var RequestMethod = { Get: 0, Post: 1, Put: 2, Delete: 3, Options: 4, Head: 5, Patch: 6, }; RequestMethod[RequestMethod.Get] = "Get"; RequestMethod[RequestMethod.Post] = "Post"; RequestMethod[RequestMethod.Put] = "Put"; RequestMethod[RequestMethod.Delete] = "Delete"; RequestMethod[RequestMethod.Options] = "Options"; RequestMethod[RequestMethod.Head] = "Head"; RequestMethod[RequestMethod.Patch] = "Patch"; /** @enum {number} */ var ReadyState = { Unsent: 0, Open: 1, HeadersReceived: 2, Loading: 3, Done: 4, Cancelled: 5, }; ReadyState[ReadyState.Unsent] = "Unsent"; ReadyState[ReadyState.Open] = "Open"; ReadyState[ReadyState.HeadersReceived] = "HeadersReceived"; ReadyState[ReadyState.Loading] = "Loading"; ReadyState[ReadyState.Done] = "Done"; ReadyState[ReadyState.Cancelled] = "Cancelled"; /** @enum {number} */ var ResponseType = { Basic: 0, Cors: 1, Default: 2, Error: 3, Opaque: 4, }; ResponseType[ResponseType.Basic] = "Basic"; ResponseType[ResponseType.Cors] = "Cors"; ResponseType[ResponseType.Default] = "Default"; ResponseType[ResponseType.Error] = "Error"; ResponseType[ResponseType.Opaque] = "Opaque"; /** @enum {number} */ var ContentType = { NONE: 0, JSON: 1, FORM: 2, FORM_DATA: 3, TEXT: 4, BLOB: 5, ARRAY_BUFFER: 6, }; ContentType[ContentType.NONE] = "NONE"; ContentType[ContentType.JSON] = "JSON"; ContentType[ContentType.FORM] = "FORM"; ContentType[ContentType.FORM_DATA] = "FORM_DATA"; ContentType[ContentType.TEXT] = "TEXT"; ContentType[ContentType.BLOB] = "BLOB"; ContentType[ContentType.ARRAY_BUFFER] = "ARRAY_BUFFER"; /** @enum {number} */ var ResponseContentType = { Text: 0, Json: 1, ArrayBuffer: 2, Blob: 3, }; ResponseContentType[ResponseContentType.Text] = "Text"; ResponseContentType[ResponseContentType.Json] = "Json"; ResponseContentType[ResponseContentType.ArrayBuffer] = "ArrayBuffer"; ResponseContentType[ResponseContentType.Blob] = "Blob"; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as * specified in the [Fetch Spec](https://fetch.spec.whatwg.org/#headers-class). * * The only known difference between this `Headers` implementation and the spec is the * lack of an `entries` method. * * ### Example * * ``` * import {Headers} from '\@angular/http'; * * var firstHeaders = new Headers(); * firstHeaders.append('Content-Type', 'image/jpeg'); * console.log(firstHeaders.get('Content-Type')) //'image/jpeg' * * // Create headers from Plain Old JavaScript Object * var secondHeaders = new Headers({ * 'X-My-Custom-Header': 'Angular' * }); * console.log(secondHeaders.get('X-My-Custom-Header')); //'Angular' * * var thirdHeaders = new Headers(secondHeaders); * console.log(thirdHeaders.get('X-My-Custom-Header')); //'Angular' * ``` * * @deprecated use \@angular/common/http instead */ var Headers = /** @class */ (function () { // TODO(vicb): any -> string|string[] function Headers(headers) { var _this = this; /** * \@internal header names are lower case */ this._headers = new Map(); /** * \@internal map lower case names to actual names */ this._normalizedNames = new Map(); if (!headers) { return; } if (headers instanceof Headers) { headers.forEach(function (values, name) { values.forEach(function (value) { return _this.append(name, value); }); }); return; } Object.keys(headers).forEach(function (name) { var /** @type {?} */ values = Array.isArray(headers[name]) ? headers[name] : [headers[name]]; _this.delete(name); values.forEach(function (value) { return _this.append(name, value); }); }); } /** * Returns a new Headers instance from the given DOMString of Response Headers */ /** * Returns a new Headers instance from the given DOMString of Response Headers * @param {?} headersString * @return {?} */ Headers.fromResponseHeaderString = /** * Returns a new Headers instance from the given DOMString of Response Headers * @param {?} headersString * @return {?} */ function (headersString) { var /** @type {?} */ headers = new Headers(); headersString.split('\n').forEach(function (line) { var /** @type {?} */ index = line.indexOf(':'); if (index > 0) { var /** @type {?} */ name_1 = line.slice(0, index); var /** @type {?} */ value = line.slice(index + 1).trim(); headers.set(name_1, value); } }); return headers; }; /** * Appends a header to existing list of header values for a given header name. */ /** * Appends a header to existing list of header values for a given header name. * @param {?} name * @param {?} value * @return {?} */ Headers.prototype.append = /** * Appends a header to existing list of header values for a given header name. * @param {?} name * @param {?} value * @return {?} */ function (name, value) { var /** @type {?} */ values = this.getAll(name); if (values === null) { this.set(name, value); } else { values.push(value); } }; /** * Deletes all header values for the given name. */ /** * Deletes all header values for the given name. * @param {?} name * @return {?} */ Headers.prototype.delete = /** * Deletes all header values for the given name. * @param {?} name * @return {?} */ function (name) { var /** @type {?} */ lcName = name.toLowerCase(); this._normalizedNames.delete(lcName); this._headers.delete(lcName); }; /** * @param {?} fn * @return {?} */ Headers.prototype.forEach = /** * @param {?} fn * @return {?} */ function (fn) { var _this = this; this._headers.forEach(function (values, lcName) { return fn(values, _this._normalizedNames.get(lcName), _this._headers); }); }; /** * Returns first header that matches given name. */ /** * Returns first header that matches given name. * @param {?} name * @return {?} */ Headers.prototype.get = /** * Returns first header that matches given name. * @param {?} name * @return {?} */ function (name) { var /** @type {?} */ values = this.getAll(name); if (values === null) { return null; } return values.length > 0 ? values[0] : null; }; /** * Checks for existence of header by given name. */ /** * Checks for existence of header by given name. * @param {?} name * @return {?} */ Headers.prototype.has = /** * Checks for existence of header by given name. * @param {?} name * @return {?} */ function (name) { return this._headers.has(name.toLowerCase()); }; /** * Returns the names of the headers */ /** * Returns the names of the headers * @return {?} */ Headers.prototype.keys = /** * Returns the names of the headers * @return {?} */ function () { return Array.from(this._normalizedNames.values()); }; /** * Sets or overrides header value for given name. */ /** * Sets or overrides header value for given name. * @param {?} name * @param {?} value * @return {?} */ Headers.prototype.set = /** * Sets or overrides header value for given name. * @param {?} name * @param {?} value * @return {?} */ function (name, value) { if (Array.isArray(value)) { if (value.length) { this._headers.set(name.toLowerCase(), [value.join(',')]); } } else { this._headers.set(name.toLowerCase(), [value]); } this.mayBeSetNormalizedName(name); }; /** * Returns values of all headers. */ /** * Returns values of all headers. * @return {?} */ Headers.prototype.values = /** * Returns values of all headers. * @return {?} */ function () { return Array.from(this._headers.values()); }; /** * Returns string of all headers. */ // TODO(vicb): returns {[name: string]: string[]} /** * Returns string of all headers. * @return {?} */ Headers.prototype.toJSON = /** * Returns string of all headers. * @return {?} */ function () { var _this = this; var /** @type {?} */ serialized = {}; this._headers.forEach(function (values, name) { var /** @type {?} */ split = []; values.forEach(function (v) { return split.push.apply(split, v.split(',')); }); serialized[/** @type {?} */ ((_this._normalizedNames.get(name)))] = split; }); return serialized; }; /** * Returns list of header values for a given name. */ /** * Returns list of header values for a given name. * @param {?} name * @return {?} */ Headers.prototype.getAll = /** * Returns list of header values for a given name. * @param {?} name * @return {?} */ function (name) { return this.has(name) ? this._headers.get(name.toLowerCase()) || null : null; }; /** * This method is not implemented. */ /** * This method is not implemented. * @return {?} */ Headers.prototype.entries = /** * This method is not implemented. * @return {?} */ function () { throw new Error('"entries" method is not implemented on Headers class'); }; /** * @param {?} name * @return {?} */ Headers.prototype.mayBeSetNormalizedName = /** * @param {?} name * @return {?} */ function (name) { var /** @type {?} */ lcName = name.toLowerCase(); if (!this._normalizedNames.has(lcName)) { this._normalizedNames.set(lcName, name); } }; return Headers; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Creates a response options object to be optionally provided when instantiating a * {\@link Response}. * * This class is based on the `ResponseInit` description in the [Fetch * Spec](https://fetch.spec.whatwg.org/#responseinit). * * All values are null by default. Typical defaults can be found in the * {\@link BaseResponseOptions} class, which sub-classes `ResponseOptions`. * * This class may be used in tests to build {\@link Response Responses} for * mock responses (see {\@link MockBackend}). * * ### Example ([live demo](http://plnkr.co/edit/P9Jkk8e8cz6NVzbcxEsD?p=preview)) * * ```typescript * import {ResponseOptions, Response} from '\@angular/http'; * * var options = new ResponseOptions({ * body: '{"name":"Jeff"}' * }); * var res = new Response(options); * * console.log('res.json():', res.json()); // Object {name: "Jeff"} * ``` * * @deprecated use \@angular/common/http instead */ var ResponseOptions = /** @class */ (function () { function ResponseOptions(opts) { if (opts === void 0) { opts = {}; } var body = opts.body, status = opts.status, headers = opts.headers, statusText = opts.statusText, type = opts.type, url = opts.url; this.body = body != null ? body : null; this.status = status != null ? status : null; this.headers = headers != null ? headers : null; this.statusText = statusText != null ? statusText : null; this.type = type != null ? type : null; this.url = url != null ? url : null; } /** * Creates a copy of the `ResponseOptions` instance, using the optional input as values to * override * existing values. This method will not change the values of the instance on which it is being * called. * * This may be useful when sharing a base `ResponseOptions` object inside tests, * where certain properties may change from test to test. * * ### Example ([live demo](http://plnkr.co/edit/1lXquqFfgduTFBWjNoRE?p=preview)) * * ```typescript * import {ResponseOptions, Response} from '@angular/http'; * * var options = new ResponseOptions({ * body: {name: 'Jeff'} * }); * var res = new Response(options.merge({ * url: 'https://google.com' * })); * console.log('options.url:', options.url); // null * console.log('res.json():', res.json()); // Object {name: "Jeff"} * console.log('res.url:', res.url); // https://google.com * ``` */ /** * Creates a copy of the `ResponseOptions` instance, using the optional input as values to * override * existing values. This method will not change the values of the instance on which it is being * called. * * This may be useful when sharing a base `ResponseOptions` object inside tests, * where certain properties may change from test to test. * * ### Example ([live demo](http://plnkr.co/edit/1lXquqFfgduTFBWjNoRE?p=preview)) * * ```typescript * import {ResponseOptions, Response} from '\@angular/http'; * * var options = new ResponseOptions({ * body: {name: 'Jeff'} * }); * var res = new Response(options.merge({ * url: 'https://google.com' * })); * console.log('options.url:', options.url); // null * console.log('res.json():', res.json()); // Object {name: "Jeff"} * console.log('res.url:', res.url); // https://google.com * ``` * @param {?=} options * @return {?} */ ResponseOptions.prototype.merge = /** * Creates a copy of the `ResponseOptions` instance, using the optional input as values to * override * existing values. This method will not change the values of the instance on which it is being * called. * * This may be useful when sharing a base `ResponseOptions` object inside tests, * where certain properties may change from test to test. * * ### Example ([live demo](http://plnkr.co/edit/1lXquqFfgduTFBWjNoRE?p=preview)) * * ```typescript * import {ResponseOptions, Response} from '\@angular/http'; * * var options = new ResponseOptions({ * body: {name: 'Jeff'} * }); * var res = new Response(options.merge({ * url: 'https://google.com' * })); * console.log('options.url:', options.url); // null * console.log('res.json():', res.json()); // Object {name: "Jeff"} * console.log('res.url:', res.url); // https://google.com * ``` * @param {?=} options * @return {?} */ function (options) { return new ResponseOptions({ body: options && options.body != null ? options.body : this.body, status: options && options.status != null ? options.status : this.status, headers: options && options.headers != null ? options.headers : this.headers, statusText: options && options.statusText != null ? options.statusText : this.statusText, type: options && options.type != null ? options.type : this.type, url: options && options.url != null ? options.url : this.url, }); }; return ResponseOptions; }()); /** * Subclass of {\@link ResponseOptions}, with default values. * * Default values: * * status: 200 * * headers: empty {\@link Headers} object * * This class could be extended and bound to the {\@link ResponseOptions} class * when configuring an {\@link Injector}, in order to override the default options * used by {\@link Http} to create {\@link Response Responses}. * * ### Example ([live demo](http://plnkr.co/edit/qv8DLT?p=preview)) * * ```typescript * import {provide} from '\@angular/core'; * import {bootstrap} from '\@angular/platform-browser/browser'; * import {HTTP_PROVIDERS, Headers, Http, BaseResponseOptions, ResponseOptions} from * '\@angular/http'; * import {App} from './myapp'; * * class MyOptions extends BaseResponseOptions { * headers:Headers = new Headers({network: 'github'}); * } * * bootstrap(App, [HTTP_PROVIDERS, {provide: ResponseOptions, useClass: MyOptions}]); * ``` * * The options could also be extended when manually creating a {\@link Response} * object. * * ### Example ([live demo](http://plnkr.co/edit/VngosOWiaExEtbstDoix?p=preview)) * * ``` * import {BaseResponseOptions, Response} from '\@angular/http'; * * var options = new BaseResponseOptions(); * var res = new Response(options.merge({ * body: 'Angular', * headers: new Headers({framework: 'angular'}) * })); * console.log('res.headers.get("framework"):', res.headers.get('framework')); // angular * console.log('res.text():', res.text()); // Angular; * ``` * * @deprecated use \@angular/common/http instead */ var BaseResponseOptions = /** @class */ (function (_super) { __extends(BaseResponseOptions, _super); function BaseResponseOptions() { return _super.call(this, { status: 200, statusText: 'Ok', type: ResponseType.Default, headers: new Headers() }) || this; } BaseResponseOptions.decorators = [ { type: _angular_core.Injectable }, ]; /** @nocollapse */ BaseResponseOptions.ctorParameters = function () { return []; }; return BaseResponseOptions; }(ResponseOptions)); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Abstract class from which real backends are derived. * * The primary purpose of a `ConnectionBackend` is to create new connections to fulfill a given * {\@link Request}. * * @deprecated use \@angular/common/http instead * @abstract */ var ConnectionBackend = /** @class */ (function () { function ConnectionBackend() { } return ConnectionBackend; }()); /** * Abstract class from which real connections are derived. * * @deprecated use \@angular/common/http instead * @abstract */ var Connection = /** @class */ (function () { function Connection() { } return Connection; }()); /** * An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request. * * @deprecated use \@angular/common/http instead * @abstract */ var XSRFStrategy = /** @class */ (function () { function XSRFStrategy() { } return XSRFStrategy; }()); /** * Interface for options to construct a RequestOptions, based on * [RequestInit](https://fetch.spec.whatwg.org/#requestinit) from the Fetch spec. * * @deprecated use \@angular/common/http instead * @record */ /** * Required structure when constructing new Request(); * @record */ /** * Interface for options to construct a Response, based on * [ResponseInit](https://fetch.spec.whatwg.org/#responseinit) from the Fetch spec. * * @deprecated use \@angular/common/http instead * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} method * @return {?} */ function normalizeMethodName(method) { if (typeof method !== 'string') return method; switch (method.toUpperCase()) { case 'GET': return RequestMethod.Get; case 'POST': return RequestMethod.Post; case 'PUT': return RequestMethod.Put; case 'DELETE': return RequestMethod.Delete; case 'OPTIONS': return RequestMethod.Options; case 'HEAD': return RequestMethod.Head; case 'PATCH': return RequestMethod.Patch; } throw new Error("Invalid request method. The method \"" + method + "\" is not supported."); } var isSuccess = function (status) { return (status >= 200 && status < 300); }; /** * @param {?} xhr * @return {?} */ function getResponseURL(xhr) { if ('responseURL' in xhr) { return xhr.responseURL; } if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) { return xhr.getResponseHeader('X-Request-URL'); } return null; } /** * @param {?} input * @return {?} */ /** * @param {?} input * @return {?} */ function stringToArrayBuffer(input) { var /** @type {?} */ view = new Uint16Array(input.length); for (var /** @type {?} */ i = 0, /** @type {?} */ strLen = input.length; i < strLen; i++) { view[i] = input.charCodeAt(i); } return view.buffer; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?=} rawParams * @return {?} */ function paramParser(rawParams) { if (rawParams === void 0) { rawParams = ''; } var /** @type {?} */ map = new Map(); if (rawParams.length > 0) { var /** @type {?} */ params = rawParams.split('&'); params.forEach(function (param) { var /** @type {?} */ eqIdx = param.indexOf('='); var _a = eqIdx == -1 ? [param, ''] : [param.slice(0, eqIdx), param.slice(eqIdx + 1)], key = _a[0], val = _a[1]; var /** @type {?} */ list = map.get(key) || []; list.push(val); map.set(key, list); }); } return map; } /** * @deprecated use \@angular/common/http instead * */ var QueryEncoder = /** @class */ (function () { function QueryEncoder() { } /** * @param {?} k * @return {?} */ QueryEncoder.prototype.encodeKey = /** * @param {?} k * @return {?} */ function (k) { return standardEncoding(k); }; /** * @param {?} v * @return {?} */ QueryEncoder.prototype.encodeValue = /** * @param {?} v * @return {?} */ function (v) { return standardEncoding(v); }; return QueryEncoder; }()); /** * @param {?} v * @return {?} */ function standardEncoding(v) { return encodeURIComponent(v) .replace(/%40/gi, '@') .replace(/%3A/gi, ':') .replace(/%24/gi, '$') .replace(/%2C/gi, ',') .replace(/%3B/gi, ';') .replace(/%2B/gi, '+') .replace(/%3D/gi, '=') .replace(/%3F/gi, '?') .replace(/%2F/gi, '/'); } /** * Map-like representation of url search parameters, based on * [URLSearchParams](https://url.spec.whatwg.org/#urlsearchparams) in the url living standard, * with several extensions for merging URLSearchParams objects: * - setAll() * - appendAll() * - replaceAll() * * This class accepts an optional second parameter of ${\@link QueryEncoder}, * which is used to serialize parameters before making a request. By default, * `QueryEncoder` encodes keys and values of parameters using `encodeURIComponent`, * and then un-encodes certain characters that are allowed to be part of the query * according to IETF RFC 3986: https://tools.ietf.org/html/rfc3986. * * These are the characters that are not encoded: `! $ \' ( ) * + , ; A 9 - . _ ~ ? /` * * If the set of allowed query characters is not acceptable for a particular backend, * `QueryEncoder` can be subclassed and provided as the 2nd argument to URLSearchParams. * * ``` * import {URLSearchParams, QueryEncoder} from '\@angular/http'; * class MyQueryEncoder extends QueryEncoder { * encodeKey(k: string): string { * return myEncodingFunction(k); * } * * encodeValue(v: string): string { * return myEncodingFunction(v); * } * } * * let params = new URLSearchParams('', new MyQueryEncoder()); * ``` * @deprecated use \@angular/common/http instead */ var URLSearchParams = /** @class */ (function () { function URLSearchParams(rawParams, queryEncoder) { if (rawParams === void 0) { rawParams = ''; } if (queryEncoder === void 0) { queryEncoder = new QueryEncoder(); } this.rawParams = rawParams; this.queryEncoder = queryEncoder; this.paramsMap = paramParser(rawParams); } /** * @return {?} */ URLSearchParams.prototype.clone = /** * @return {?} */ function () { var /** @type {?} */ clone = new URLSearchParams('', this.queryEncoder); clone.appendAll(this); return clone; }; /** * @param {?} param * @return {?} */ URLSearchParams.prototype.has = /** * @param {?} param * @return {?} */ function (param) { return this.paramsMap.has(param); }; /** * @param {?} param * @return {?} */ URLSearchParams.prototype.get = /** * @param {?} param * @return {?} */ function (param) { var /** @type {?} */ storedParam = this.paramsMap.get(param); return Array.isArray(storedParam) ? storedParam[0] : null; }; /** * @param {?} param * @return {?} */ URLSearchParams.prototype.getAll = /** * @param {?} param * @return {?} */ function (param) { return this.paramsMap.get(param) || []; }; /** * @param {?} param * @param {?} val * @return {?} */ URLSearchParams.prototype.set = /** * @param {?} param * @param {?} val * @return {?} */ function (param, val) { if (val === void 0 || val === null) { this.delete(param); return; } var /** @type {?} */ list = this.paramsMap.get(param) || []; list.length = 0; list.push(val); this.paramsMap.set(param, list); }; // A merge operation // For each name-values pair in `searchParams`, perform `set(name, values[0])` // // E.g: "a=[1,2,3], c=[8]" + "a=[4,5,6], b=[7]" = "a=[4], c=[8], b=[7]" // // TODO(@caitp): document this better /** * @param {?} searchParams * @return {?} */ URLSearchParams.prototype.setAll = /** * @param {?} searchParams * @return {?} */ function (searchParams) { var _this = this; searchParams.paramsMap.forEach(function (value, param) { var /** @type {?} */ list = _this.paramsMap.get(param) || []; list.length = 0; list.push(value[0]); _this.paramsMap.set(param, list); }); }; /** * @param {?} param * @param {?} val * @return {?} */ URLSearchParams.prototype.append = /** * @param {?} param * @param {?} val * @return {?} */ function (param, val) { if (val === void 0 || val === null) return; var /** @type {?} */ list = this.paramsMap.get(param) || []; list.push(val); this.paramsMap.set(param, list); }; // A merge operation // For each name-values pair in `searchParams`, perform `append(name, value)` // for each value in `values`. // // E.g: "a=[1,2], c=[8]" + "a=[3,4], b=[7]" = "a=[1,2,3,4], c=[8], b=[7]" // // TODO(@caitp): document this better /** * @param {?} searchParams * @return {?} */ URLSearchParams.prototype.appendAll = /** * @param {?} searchParams * @return {?} */ function (searchParams) { var _this = this; searchParams.paramsMap.forEach(function (value, param) { var /** @type {?} */ list = _this.paramsMap.get(param) || []; for (var /** @type {?} */ i = 0; i < value.length; ++i) { list.push(value[i]); } _this.paramsMap.set(param, list); }); }; // A merge operation // For each name-values pair in `searchParams`, perform `delete(name)`, // followed by `set(name, values)` // // E.g: "a=[1,2,3], c=[8]" + "a=[4,5,6], b=[7]" = "a=[4,5,6], c=[8], b=[7]" // // TODO(@caitp): document this better /** * @param {?} searchParams * @return {?} */ URLSearchParams.prototype.replaceAll = /** * @param {?} searchParams * @return {?} */ function (searchParams) { var _this = this; searchParams.paramsMap.forEach(function (value, param) { var /** @type {?} */ list = _this.paramsMap.get(param) || []; list.length = 0; for (var /** @type {?} */ i = 0; i < value.length; ++i) { list.push(value[i]); } _this.paramsMap.set(param, list); }); }; /** * @return {?} */ URLSearchParams.prototype.toString = /** * @return {?} */ function () { var _this = this; var /** @type {?} */ paramsList = []; this.paramsMap.forEach(function (values, k) { values.forEach(function (v) { return paramsList.push(_this.queryEncoder.encodeKey(k) + '=' + _this.queryEncoder.encodeValue(v)); }); }); return paramsList.join('&'); }; /** * @param {?} param * @return {?} */ URLSearchParams.prototype.delete = /** * @param {?} param * @return {?} */ function (param) { this.paramsMap.delete(param); }; return URLSearchParams; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * HTTP request body used by both {\@link Request} and {\@link Response} * https://fetch.spec.whatwg.org/#body * @abstract */ var Body = /** @class */ (function () { function Body() { } /** * Attempts to return body as parsed `JSON` object, or raises an exception. */ /** * Attempts to return body as parsed `JSON` object, or raises an exception. * @return {?} */ Body.prototype.json = /** * Attempts to return body as parsed `JSON` object, or raises an exception. * @return {?} */ function () { if (typeof this._body === 'string') { return JSON.parse(/** @type {?} */ (this._body)); } if (this._body instanceof ArrayBuffer) { return JSON.parse(this.text()); } return this._body; }; /** * Returns the body as a string, presuming `toString()` can be called on the response body. * * When decoding an `ArrayBuffer`, the optional `encodingHint` parameter determines how the * bytes in the buffer will be interpreted. Valid values are: * * - `legacy` - incorrectly interpret the bytes as UTF-16 (technically, UCS-2). Only characters * in the Basic Multilingual Plane are supported, surrogate pairs are not handled correctly. * In addition, the endianness of the 16-bit octet pairs in the `ArrayBuffer` is not taken * into consideration. This is the default behavior to avoid breaking apps, but should be * considered deprecated. * * - `iso-8859` - interpret the bytes as ISO-8859 (which can be used for ASCII encoded text). */ /** * Returns the body as a string, presuming `toString()` can be called on the response body. * * When decoding an `ArrayBuffer`, the optional `encodingHint` parameter determines how the * bytes in the buffer will be interpreted. Valid values are: * * - `legacy` - incorrectly interpret the bytes as UTF-16 (technically, UCS-2). Only characters * in the Basic Multilingual Plane are supported, surrogate pairs are not handled correctly. * In addition, the endianness of the 16-bit octet pairs in the `ArrayBuffer` is not taken * into consideration. This is the default behavior to avoid breaking apps, but should be * considered deprecated. * * - `iso-8859` - interpret the bytes as ISO-8859 (which can be used for ASCII encoded text). * @param {?=} encodingHint * @return {?} */ Body.prototype.text = /** * Returns the body as a string, presuming `toString()` can be called on the response body. * * When decoding an `ArrayBuffer`, the optional `encodingHint` parameter determines how the * bytes in the buffer will be interpreted. Valid values are: * * - `legacy` - incorrectly interpret the bytes as UTF-16 (technically, UCS-2). Only characters * in the Basic Multilingual Plane are supported, surrogate pairs are not handled correctly. * In addition, the endianness of the 16-bit octet pairs in the `ArrayBuffer` is not taken * into consideration. This is the default behavior to avoid breaking apps, but should be * considered deprecated. * * - `iso-8859` - interpret the bytes as ISO-8859 (which can be used for ASCII encoded text). * @param {?=} encodingHint * @return {?} */ function (encodingHint) { if (encodingHint === void 0) { encodingHint = 'legacy'; } if (this._body instanceof URLSearchParams) { return this._body.toString(); } if (this._body instanceof ArrayBuffer) { switch (encodingHint) { case 'legacy': return String.fromCharCode.apply(null, new Uint16Array(/** @type {?} */ (this._body))); case 'iso-8859': return String.fromCharCode.apply(null, new Uint8Array(/** @type {?} */ (this._body))); default: throw new Error("Invalid value for encodingHint: " + encodingHint); } } if (this._body == null) { return ''; } if (typeof this._body === 'object') { return JSON.stringify(this._body, null, 2); } return this._body.toString(); }; /** * Return the body as an ArrayBuffer */ /** * Return the body as an ArrayBuffer * @return {?} */ Body.prototype.arrayBuffer = /** * Return the body as an ArrayBuffer * @return {?} */ function () { if (this._body instanceof ArrayBuffer) { return /** @type {?} */ (this._body); } return stringToArrayBuffer(this.text()); }; /** * Returns the request's body as a Blob, assuming that body exists. */ /** * Returns the request's body as a Blob, assuming that body exists. * @return {?} */ Body.prototype.blob = /** * Returns the request's body as a Blob, assuming that body exists. * @return {?} */ function () { if (this._body instanceof Blob) { return /** @type {?} */ (this._body); } if (this._body instanceof ArrayBuffer) { return new Blob([this._body]); } throw new Error('The request body isn\'t either a blob or an array buffer'); }; return Body; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Creates `Response` instances from provided values. * * Though this object isn't * usually instantiated by end-users, it is the primary object interacted with when it comes time to * add data to a view. * * ### Example * * ``` * http.request('my-friends.txt').subscribe(response => this.friends = response.text()); * ``` * * The Response's interface is inspired by the Response constructor defined in the [Fetch * Spec](https://fetch.spec.whatwg.org/#response-class), but is considered a static value whose body * can be accessed many times. There are other differences in the implementation, but this is the * most significant. * * @deprecated use \@angular/common/http instead */ var Response = /** @class */ (function (_super) { __extends(Response, _super); function Response(responseOptions) { var _this = _super.call(this) || this; _this._body = responseOptions.body; _this.status = /** @type {?} */ ((responseOptions.status)); _this.ok = (_this.status >= 200 && _this.status <= 299); _this.statusText = responseOptions.statusText; _this.headers = responseOptions.headers; _this.type = /** @type {?} */ ((responseOptions.type)); _this.url = /** @type {?} */ ((responseOptions.url)); return _this; } /** * @return {?} */ Response.prototype.toString = /** * @return {?} */ function () { return "Response with status: " + this.status + " " + this.statusText + " for URL: " + this.url; }; return Response; }(Body)); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var _nextRequestId = 0; var JSONP_HOME = '__ng_jsonp__'; var _jsonpConnections = null; /** * @return {?} */ function _getJsonpConnections() { var /** @type {?} */ w = typeof window == 'object' ? window : {}; if (_jsonpConnections === null) { _jsonpConnections = w[JSONP_HOME] = {}; } return _jsonpConnections; } var BrowserJsonp = /** @class */ (function () { function BrowserJsonp() { } // Construct a